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>2003-05-16 16:48:38 +0400
committerRob Haarsma <phaseIV@zonnet.nl>2003-05-16 16:48:38 +0400
commitef736e8bccbce8eebe4b1a9c9542d791ce1474a6 (patch)
treec5d1e5b10cba518c320cca79c74020bee991453f /source/blender/ftfont
parent447dd3c9597dd91b5229437e43a27a0fa26b6a53 (diff)
reverted to 2.27 original fontcoloring method
reverted to patched ftgl library. speed improvements were not really noticable.
Diffstat (limited to 'source/blender/ftfont')
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp68
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.h3
2 files changed, 28 insertions, 43 deletions
diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp
index f0979e4fdd8..50839c44063 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.cpp
+++ b/source/blender/ftfont/intern/FTF_TTFont.cpp
@@ -28,12 +28,6 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- */
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -107,7 +101,7 @@ FTF_TTFont::FTF_TTFont(void)
char *bundlepath;
#endif
- fontB = fontW =NULL;
+ font=NULL;
font_size=FONT_SIZE_DEFAULT;
strcpy(encoding_name, SYSTEM_ENCODING_DEFAULT);
@@ -145,8 +139,7 @@ FTF_TTFont::FTF_TTFont(void)
FTF_TTFont::~FTF_TTFont(void)
{
- if (fontB) delete fontB;
- if (fontW) delete fontW;
+ if (font) delete font;
}
@@ -155,26 +148,19 @@ int FTF_TTFont::SetFont(char* str, int size)
int err = 0;
bool success = 0;
- if(fontB) delete fontB;
- if(fontW) delete fontW;
+ delete font;
- fontB = new FTGLPixmapFont(str);
- fontW = new FTGLPixmapFont(str);
- err = fontB->Error();
+ font = new FTGLPixmapFont(str);
+ err = font->Error();
if(err) {
// printf("Failed to open font %s\n", str);
return 0;
} else {
- success = fontB->FaceSize(size);
- if(!success) return 0;
- success = fontW->FaceSize(size);
- if(!success) return 0;
-
- success = fontB->CharMap(ft_encoding_unicode);
+ success = font->FaceSize(size);
if(!success) return 0;
- success = fontW->CharMap(ft_encoding_unicode);
+ success = font->CharMap(ft_encoding_unicode);
if(!success) return 0;
return 1;
@@ -220,8 +206,7 @@ void FTF_TTFont::SetEncoding(char* str)
void FTF_TTFont::SetSize(int size)
{
- fontB->FaceSize(size);
- fontW->FaceSize(size);
+ font->FaceSize(size);
font_size = size;
}
@@ -232,12 +217,12 @@ int FTF_TTFont::GetSize(void)
int FTF_TTFont::Ascender(void)
{
- return fontB->Ascender();
+ return font->Ascender();
}
int FTF_TTFont::Descender(void)
{
- return fontB->Descender();
+ return font->Descender();
}
@@ -258,14 +243,20 @@ float FTF_TTFont::DrawString(char* str, unsigned int flag, int select)
len=utf8towchar(wstr,str);
if(!select) {
- glColor4f(0.0, 0.0, 0.0, 1.0);
- fontB->Render(wstr);
- return fontB->Advance(wstr);
- } else {
- glColor4f(1.0, 1.0, 1.0, 1.0);
- fontW->Render(wstr);
- return fontW->Advance(wstr);
+ glPixelTransferf(GL_RED_SCALE, 0.0);
+ glPixelTransferf(GL_GREEN_SCALE, 0.0);
+ glPixelTransferf(GL_BLUE_SCALE, 0.0);
+ }
+
+ font->Render(wstr);
+
+ if(!select) {
+ glPixelTransferf(GL_RED_SCALE, 1.0);
+ glPixelTransferf(GL_GREEN_SCALE, 1.0);
+ glPixelTransferf(GL_BLUE_SCALE, 1.0);
}
+
+ return font->Advance(wstr);
}
@@ -279,19 +270,17 @@ float FTF_TTFont::DrawStringRGB(char* str, unsigned int flag, float r, float g,
else
len=utf8towchar(wstr,str);
- glColor4f(1.0, 1.0, 1.0, 1.0);
-
glPixelTransferf(GL_RED_SCALE, r);
glPixelTransferf(GL_GREEN_SCALE, g);
glPixelTransferf(GL_BLUE_SCALE, b);
- fontW->Render(wstr);
+ font->Render(wstr);
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
glPixelTransferf(GL_BLUE_SCALE, 1.0);
- return fontW->Advance(wstr);
+ return font->Advance(wstr);
}
@@ -305,8 +294,7 @@ float FTF_TTFont::GetStringWidth(char* str, unsigned int flag)
else
len=utf8towchar(wstr,str);
- glColor4f(0.0, 0.0, 0.0, 1.0);
- return fontB->Advance(wstr);
+ return font->Advance(wstr);
}
@@ -320,7 +308,5 @@ void FTF_TTFont::GetBoundingBox(char* str, float *llx, float *lly, float *llz, f
else
len=utf8towchar(wstr,str);
- glColor4f(0.0, 0.0, 0.0, 1.0);
- fontB->BBox(wstr, *llx, *lly, *llz, *urx, *ury, *urz);
+ font->BBox(wstr, *llx, *lly, *llz, *urx, *ury, *urz);
}
-
diff --git a/source/blender/ftfont/intern/FTF_TTFont.h b/source/blender/ftfont/intern/FTF_TTFont.h
index 4e0e5ae7ff1..9492e326a7e 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.h
+++ b/source/blender/ftfont/intern/FTF_TTFont.h
@@ -99,8 +99,7 @@ protected:
int font_size;
/** FTGL's */
- FTFont* fontB;
- FTFont* fontW;
+ FTFont* font;
/** from system encoding in .locale to UNICODE */
// iconv_t cd;