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:
authorRob Haarsma <phaseIV@zonnet.nl>2005-01-21 17:48:03 +0300
committerRob Haarsma <phaseIV@zonnet.nl>2005-01-21 17:48:03 +0300
commit136ecd46442d5cb95c7f546e5a401d5df458a2f9 (patch)
treed837c5ca98abc7ff6844749aa2c2e2760b2d78b8 /source/blender/ftfont
parent465b15eb695ef96534b008199fa90af0936febde (diff)
Modified interface texture font support, which should work nicely with the freshly added bFTGL library.
Also removed some redundant #include's on some files.
Diffstat (limited to 'source/blender/ftfont')
-rw-r--r--source/blender/ftfont/intern/FTF_Api.cpp4
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp33
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.h4
3 files changed, 23 insertions, 18 deletions
diff --git a/source/blender/ftfont/intern/FTF_Api.cpp b/source/blender/ftfont/intern/FTF_Api.cpp
index 036e13a7e6e..52fc9378f00 100644
--- a/source/blender/ftfont/intern/FTF_Api.cpp
+++ b/source/blender/ftfont/intern/FTF_Api.cpp
@@ -69,7 +69,7 @@ FTF_EXPORT int FTF_GetSize(void)
return _FTF_GetFont()->GetSize();
}
-
+/*
FTF_EXPORT int FTF_Ascender(void)
{
return _FTF_GetFont()->Ascender();
@@ -79,7 +79,7 @@ FTF_EXPORT int FTF_Descender(void)
{
return _FTF_GetFont()->Descender();
}
-
+*/
FTF_EXPORT void FTF_TransConvString(char* str, char* ustr, unsigned int flag)
{
diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp
index d25c60ea402..0c979ea5a94 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.cpp
+++ b/source/blender/ftfont/intern/FTF_TTFont.cpp
@@ -156,13 +156,9 @@ FTF_TTFont::~FTF_TTFont(void)
void FTF_TTFont::SetFontSize(char size)
{
- if(mode == FTF_PIXMAPFONT) {
if(size=='s') font=fonts;
else if(size=='l') font=fontl;
else font=fontm;
- } else if(mode == FTF_TEXTUREFONT) {
- font=fontl;
- }
}
int FTF_TTFont::SetFont(const unsigned char* str, int datasize, int fontsize)
@@ -221,11 +217,23 @@ int FTF_TTFont::SetFont(const unsigned char* str, int datasize, int fontsize)
return 0;
} else {
- fontl= font;
+ fontm= font;
+ if(datasize) fonts = new FTGLTextureFont(str, datasize);
+ else fonts = new FTGLTextureFont((char *)str);
+ if(datasize) fontl = new FTGLTextureFont(str, datasize);
+ else fontl = new FTGLTextureFont((char *)str);
+
+ success = fonts->FaceSize(fontsize-2<8?8:fontsize-2);
+ success = fontm->FaceSize(fontsize-1<8?8:fontsize-1);
success = fontl->FaceSize(fontsize);
+// success = fonts->FaceSize(fontsize/2);
+// success = fontm->FaceSize(fontsize);
+// success = fontl->FaceSize(fontsize*2);
if(!success) return 0;
+ success = fonts->CharMap(ft_encoding_unicode);
+ success = fontm->CharMap(ft_encoding_unicode);
success = fontl->CharMap(ft_encoding_unicode);
if(!success) return 0;
@@ -274,13 +282,9 @@ void FTF_TTFont::SetEncoding(char* str)
void FTF_TTFont::SetSize(int size)
{
- if(mode == FTF_PIXMAPFONT) {
- fonts->FaceSize(size-2<8?8:size-2);
- fontm->FaceSize(size-1<8?8:size-1);
- fontl->FaceSize(size);
- } else if(mode == FTF_TEXTUREFONT) {
- fontl->FaceSize(size);
- }
+ fonts->FaceSize(size-2<8?8:size-2);
+ fontm->FaceSize(size-1<8?8:size-1);
+ fontl->FaceSize(size);
font_size = size;
}
@@ -290,6 +294,7 @@ int FTF_TTFont::GetSize(void)
return font_size;
}
+/*
int FTF_TTFont::Ascender(void)
{
return (int)font->Ascender();
@@ -300,7 +305,7 @@ int FTF_TTFont::Descender(void)
return (int)font->Descender();
}
-
+*/
int FTF_TTFont::TransConvString(char* str, char* ustr, unsigned int flag)
{
return 0;
@@ -365,7 +370,7 @@ float FTF_TTFont::GetStringWidth(char* str, unsigned int flag)
if(mode == FTF_PIXMAPFONT) {
return font->Advance(wstr);
} else if(mode == FTF_TEXTUREFONT) {
- return font->Advance(wstr) * fsize;
+ return font->Advance(wstr);// * fsize;
}
}
diff --git a/source/blender/ftfont/intern/FTF_TTFont.h b/source/blender/ftfont/intern/FTF_TTFont.h
index 15682bd4fde..c4dee93c5dc 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.h
+++ b/source/blender/ftfont/intern/FTF_TTFont.h
@@ -64,8 +64,8 @@ public:
void SetSize(int size);
int GetSize(void);
- int Ascender(void);
- int Descender(void);
+// int Ascender(void);
+// int Descender(void);
int TransConvString(char* str, char* ustr, unsigned int flag);