From 061cde65a63bc8bb74ba1d003e7c75ea556eba55 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 8 Nov 2004 15:46:57 +0000 Subject: To end the issues with AA (International) Fonts; the .bfont.tff now is compiled in (datatoc) and doesn't need installation anymore. Also reviewed weird path conventions for searching AA fonts; - U.fontdir is only used as standard search path for fileselecting - U.fontname stores only full path to AA font if used one - If a font cannot be found, it always falls back to the compiled in one - If .B.blend is saved with default font, U.fontname is not set Also added a button in usermenu "restore default". When this works as expected, I'll commit changes for installation too. --- source/blender/ftfont/FTF_Api.h | 2 +- source/blender/ftfont/intern/FTF_Api.cpp | 8 ++++---- source/blender/ftfont/intern/FTF_TTFont.cpp | 20 ++++++++++++-------- source/blender/ftfont/intern/FTF_TTFont.h | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) (limited to 'source/blender/ftfont') diff --git a/source/blender/ftfont/FTF_Api.h b/source/blender/ftfont/FTF_Api.h index dd8b48a242a..8f603d73ae1 100644 --- a/source/blender/ftfont/FTF_Api.h +++ b/source/blender/ftfont/FTF_Api.h @@ -132,7 +132,7 @@ FTF_EXPORT void FTF_SetFontSize(char size); * @param str * @param size */ -FTF_EXPORT int FTF_SetFont(char* str, int size); +FTF_EXPORT int FTF_SetFont(const unsigned char* str, int datasize, int fontsize); /** * SetLanguage diff --git a/source/blender/ftfont/intern/FTF_Api.cpp b/source/blender/ftfont/intern/FTF_Api.cpp index 40d904b253f..46638d9f4eb 100644 --- a/source/blender/ftfont/intern/FTF_Api.cpp +++ b/source/blender/ftfont/intern/FTF_Api.cpp @@ -132,14 +132,14 @@ FTF_EXPORT void FTF_GetBoundingBox(char* str, float *llx, float *lly, float *llz /** * added by phase - * + * changed by ton; to allow both file load as memory load (datasize!=0) */ -FTF_EXPORT int FTF_SetFont(char* str, int size) +FTF_EXPORT int FTF_SetFont(const unsigned char* str, int datasize, int fontsize) { - return _FTF_GetFont()->SetFont(str, size); + return _FTF_GetFont()->SetFont(str, datasize, fontsize); } -/* added bt ton */ +/* added by ton */ FTF_EXPORT void FTF_SetFontSize(char size) { diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp index 5562b9403a4..c0652ef50fe 100644 --- a/source/blender/ftfont/intern/FTF_TTFont.cpp +++ b/source/blender/ftfont/intern/FTF_TTFont.cpp @@ -159,7 +159,7 @@ void FTF_TTFont::SetFontSize(char size) } -int FTF_TTFont::SetFont(char* str, int size) +int FTF_TTFont::SetFont(const unsigned char* str, int datasize, int fontsize) { int err = 0; bool success = 0; @@ -171,7 +171,9 @@ int FTF_TTFont::SetFont(char* str, int size) fontm= NULL; fontl= NULL; - font = new FTGLPixmapFont(str); + if(datasize) font = new FTGLPixmapFont(str, datasize); + else font = new FTGLPixmapFont(str); + err = font->Error(); if(err) { @@ -180,12 +182,15 @@ int FTF_TTFont::SetFont(char* str, int size) } else { fontm= font; - fonts = new FTGLPixmapFont(str); - fontl = new FTGLPixmapFont(str); + + if(datasize) fonts = new FTGLPixmapFont(str, datasize); + else fonts = new FTGLPixmapFont(str); + if(datasize) fontl = new FTGLPixmapFont(str, datasize); + else fontl = new FTGLPixmapFont(str); - success = fonts->FaceSize(size-2<8?8:size-2); - success = fontm->FaceSize(size-1<8?8:size-1); - success = fontl->FaceSize(size); + success = fonts->FaceSize(fontsize-2<8?8:fontsize-2); + success = fontm->FaceSize(fontsize-1<8?8:fontsize-1); + success = fontl->FaceSize(fontsize); if(!success) return 0; success = fonts->CharMap(ft_encoding_unicode); @@ -197,7 +202,6 @@ int FTF_TTFont::SetFont(char* str, int size) } } - void FTF_TTFont::SetLanguage(char* str) { diff --git a/source/blender/ftfont/intern/FTF_TTFont.h b/source/blender/ftfont/intern/FTF_TTFont.h index bec5df3265d..103a25a1a71 100644 --- a/source/blender/ftfont/intern/FTF_TTFont.h +++ b/source/blender/ftfont/intern/FTF_TTFont.h @@ -85,7 +85,7 @@ public: */ void SetFontSize(char size); - int SetFont(char* str, int size); + int SetFont(const unsigned char* str, int datasize, int fontsize); void SetLanguage(char* str); -- cgit v1.2.3