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:
Diffstat (limited to 'source/blender/ftfont')
-rw-r--r--source/blender/ftfont/FTF_Api.h10
-rw-r--r--source/blender/ftfont/intern/FTF_Api.cpp11
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp41
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.h6
4 files changed, 14 insertions, 54 deletions
diff --git a/source/blender/ftfont/FTF_Api.h b/source/blender/ftfont/FTF_Api.h
index 4fa97f0acba..5272697c777 100644
--- a/source/blender/ftfont/FTF_Api.h
+++ b/source/blender/ftfont/FTF_Api.h
@@ -88,16 +88,8 @@ FTF_EXPORT void FTF_TransConvString(char* str, char* ustr, unsigned int flag);
* @param mode flag to forward to FTF_TransConvString()
* @return Width drawing
*/
-FTF_EXPORT float FTF_DrawString(char* str, unsigned int flag, int select);
+FTF_EXPORT float FTF_DrawString(char* str, unsigned int flag);
-/**
- * Draws a string at the current raster postion with rgb coloring.
- * @param str The string to draw
- * @param rgb Floats to manipulate the the glyph pixmap coloring.
- * @param mode flag to forward to FTF_TransConvString()
- * @return Width drawing
- */
-FTF_EXPORT float FTF_DrawStringRGB(char* str, unsigned int flag, float r, float g, float b);
/**
* Get a character width
diff --git a/source/blender/ftfont/intern/FTF_Api.cpp b/source/blender/ftfont/intern/FTF_Api.cpp
index ac158ae191f..42fac0c4061 100644
--- a/source/blender/ftfont/intern/FTF_Api.cpp
+++ b/source/blender/ftfont/intern/FTF_Api.cpp
@@ -84,15 +84,10 @@ FTF_EXPORT float FTF_DrawCharacter(char c, unsigned int flag)
*/
-FTF_EXPORT float FTF_DrawString(char* str, unsigned int flag, int select)
+/* does color too, using glGet */
+FTF_EXPORT float FTF_DrawString(char* str, unsigned int flag)
{
- return ttfont.DrawString(str, flag, select);
-}
-
-
-FTF_EXPORT float FTF_DrawStringRGB(char* str, unsigned int flag, float r, float g, float b)
-{
- return ttfont.DrawStringRGB(str, flag, r, g, b);
+ return ttfont.DrawString(str, flag);
}
diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp
index 6f50c2e0841..3233082cca7 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.cpp
+++ b/source/blender/ftfont/intern/FTF_TTFont.cpp
@@ -225,12 +225,12 @@ int FTF_TTFont::GetSize(void)
int FTF_TTFont::Ascender(void)
{
- return font->Ascender();
+ return (int)font->Ascender();
}
int FTF_TTFont::Descender(void)
{
- return font->Descender();
+ return (int)font->Descender();
}
@@ -240,8 +240,9 @@ int FTF_TTFont::TransConvString(char* str, char* ustr, unsigned int flag)
}
-float FTF_TTFont::DrawString(char* str, unsigned int flag, int select)
+float FTF_TTFont::DrawString(char* str, unsigned int flag)
{
+ float color[4];
wchar_t wstr[FTF_MAX_STR_SIZE-1]={'\0'};
int len=0;
@@ -250,37 +251,11 @@ float FTF_TTFont::DrawString(char* str, unsigned int flag, int select)
else
len=utf8towchar(wstr,str);
- if(!select) {
- glPixelTransferf(GL_RED_SCALE, 0.0);
- glPixelTransferf(GL_GREEN_SCALE, 0.0);
- glPixelTransferf(GL_BLUE_SCALE, 0.0);
- }
+ glGetFloatv(GL_CURRENT_COLOR, color);
- 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);
-}
-
-
-float FTF_TTFont::DrawStringRGB(char* str, unsigned int flag, float r, float g, float b)
-{
- wchar_t wstr[FTF_MAX_STR_SIZE-1]={'\0'};
- int len=0;
-
- if (FTF_USE_GETTEXT & flag)
- len=utf8towchar(wstr,gettext(str));
- else
- len=utf8towchar(wstr,str);
-
- glPixelTransferf(GL_RED_SCALE, r);
- glPixelTransferf(GL_GREEN_SCALE, g);
- glPixelTransferf(GL_BLUE_SCALE, b);
+ glPixelTransferf(GL_RED_SCALE, color[0]);
+ glPixelTransferf(GL_GREEN_SCALE, color[1]);
+ glPixelTransferf(GL_BLUE_SCALE, color[2]);
font->Render(wstr);
diff --git a/source/blender/ftfont/intern/FTF_TTFont.h b/source/blender/ftfont/intern/FTF_TTFont.h
index 9492e326a7e..e4cdfd75b16 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.h
+++ b/source/blender/ftfont/intern/FTF_TTFont.h
@@ -68,13 +68,11 @@ public:
int TransConvString(char* str, char* ustr, unsigned int flag);
/**
- * Draws a string at the current raster position.
+ * Draws a string at the current raster position in current opengl color.
* @param str The string to draw.
* @param flag Whether use gettext and UTF8 or system encoding.
*/
- float DrawString(char* str, unsigned int flag, int select);
-// float DrawString(char* str, unsigned char r, unsigned char g, unsigned char b, unsigned int flag);
- float DrawStringRGB(char* str, unsigned int flag, float r, float g, float b);
+ float DrawString(char* str, unsigned int flag);
float GetStringWidth(char* str, unsigned int flag);