diff options
Diffstat (limited to 'source/blender/ftfont')
-rw-r--r-- | source/blender/ftfont/FTF_Api.h | 8 | ||||
-rw-r--r-- | source/blender/ftfont/intern/FTF_Api.cpp | 7 | ||||
-rw-r--r-- | source/blender/ftfont/intern/FTF_TTFont.cpp | 38 | ||||
-rw-r--r-- | source/blender/ftfont/intern/FTF_TTFont.h | 10 |
4 files changed, 54 insertions, 9 deletions
diff --git a/source/blender/ftfont/FTF_Api.h b/source/blender/ftfont/FTF_Api.h index 5272697c777..5c6b441df0c 100644 --- a/source/blender/ftfont/FTF_Api.h +++ b/source/blender/ftfont/FTF_Api.h @@ -118,10 +118,16 @@ FTF_EXPORT float FTF_GetStringWidth(char* str, unsigned int flag); FTF_EXPORT void FTF_GetBoundingBox(char* str, float*llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag); /** - * Following stuff added by phase + * Following stuff added by phase, ton */ /** + * SetFontSize + * @param size + */ +FTF_EXPORT void FTF_SetFontSize(char size); + +/** * SetFont * @param str * @param size diff --git a/source/blender/ftfont/intern/FTF_Api.cpp b/source/blender/ftfont/intern/FTF_Api.cpp index 42fac0c4061..cf9171d6ba5 100644 --- a/source/blender/ftfont/intern/FTF_Api.cpp +++ b/source/blender/ftfont/intern/FTF_Api.cpp @@ -128,6 +128,13 @@ FTF_EXPORT int FTF_SetFont(char* str, int size) return ttfont.SetFont(str, size); } +/* added bt ton */ + +FTF_EXPORT void FTF_SetFontSize(char size) +{ + ttfont.SetFontSize( size); +} + /** * added by phase * diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp index 3233082cca7..ef17a610cd9 100644 --- a/source/blender/ftfont/intern/FTF_TTFont.cpp +++ b/source/blender/ftfont/intern/FTF_TTFont.cpp @@ -147,28 +147,51 @@ FTF_TTFont::FTF_TTFont(void) FTF_TTFont::~FTF_TTFont(void) { - if (font) delete font; + if (fonts) delete fonts; + if (fontm) delete fontm; + if (fontl) delete fontl; } +void FTF_TTFont::SetFontSize(char size) +{ + if(size=='s') font=fonts; + else if(size=='l') font=fontl; + else font=fontm; + +} int FTF_TTFont::SetFont(char* str, int size) { int err = 0; bool success = 0; - delete font; + delete fonts; + fonts= NULL; + delete fontm; + fontm= NULL; + delete fontl; + fontl= NULL; font = new FTGLPixmapFont(str); err = font->Error(); if(err) { -// printf("Failed to open font %s\n", str); + printf("Failed to open font %s\n", str); return 0; } else { - success = font->FaceSize(size); + + fontm= font; + fonts = new FTGLPixmapFont(str); + fontl = new FTGLPixmapFont(str); + + success = fonts->FaceSize(size-2<8?8:size-2); + success = fontm->FaceSize(size); + success = fontl->FaceSize(size+2); if(!success) return 0; - success = font->CharMap(ft_encoding_unicode); + success = fonts->CharMap(ft_encoding_unicode); + success = fontm->CharMap(ft_encoding_unicode); + success = fontl->CharMap(ft_encoding_unicode); if(!success) return 0; return 1; @@ -214,7 +237,10 @@ void FTF_TTFont::SetEncoding(char* str) void FTF_TTFont::SetSize(int size) { - font->FaceSize(size); + fonts->FaceSize(size-2<8?8:size-2); + fontm->FaceSize(size); + fontl->FaceSize(size+2); + font_size = size; } diff --git a/source/blender/ftfont/intern/FTF_TTFont.h b/source/blender/ftfont/intern/FTF_TTFont.h index e4cdfd75b16..18d30e944f3 100644 --- a/source/blender/ftfont/intern/FTF_TTFont.h +++ b/source/blender/ftfont/intern/FTF_TTFont.h @@ -79,9 +79,11 @@ public: void GetBoundingBox(char* str, float *llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag); /** - * added by phase + * added by phase, ton * functions to communicate with the preference menu */ + void SetFontSize(char size); + int SetFont(char* str, int size); void SetLanguage(char* str); @@ -97,7 +99,11 @@ protected: int font_size; /** FTGL's */ - FTFont* font; + FTFont* font; /* active */ + + FTFont* fonts; /* opened, small medium and large */ + FTFont* fontm; + FTFont* fontl; /** from system encoding in .locale to UNICODE */ // iconv_t cd; |