Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2003-10-23 22:25:08 +0400
committerTon Roosendaal <ton@blender.org>2003-10-23 22:25:08 +0400
commit9efe4b7f9aa4c0da1122ad1d8ef414f479fef023 (patch)
treef9713eeaa7dfc5936478084c183cfdd58dc330f4 /source/blender/ftfont
parent0c177df76644f3fad5881e9600da465cd1cce384 (diff)
- AntiAlias fonts (FTF) now are used in three sizes, like the normal
fonts, and switched based at the window zoom. Might be something to tweak when to switch exactly, but it works cool!
Diffstat (limited to 'source/blender/ftfont')
-rw-r--r--source/blender/ftfont/FTF_Api.h8
-rw-r--r--source/blender/ftfont/intern/FTF_Api.cpp7
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp38
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.h10
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;