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>2006-04-11 16:27:50 +0400
committerTon Roosendaal <ton@blender.org>2006-04-11 16:27:50 +0400
commit18a8479931d56bef403871f5b2542198388c1c2b (patch)
treed1c4b0025e18f6a0052e23badb9d9cd622a1b899 /source/blender/ftfont
parentf6fb4a30a1cadda320f6d9fb17988d946a23fa73 (diff)
Bugfix #3665
Using "International Fonts" (silly name, it's pixmap fonts) the special characters (values above 127) were disregarded completely. This was caused with the extremely confusing unicode conversion call, which actually only was needed when translations were set. Disabling the unicode conversion then gives correct text drawing. However, I suspect that this code will give issues for translations too... that I cannot judge nor fix.
Diffstat (limited to 'source/blender/ftfont')
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp49
1 files changed, 34 insertions, 15 deletions
diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp
index e6bfb33e339..4b6843cfcd4 100644
--- a/source/blender/ftfont/intern/FTF_TTFont.cpp
+++ b/source/blender/ftfont/intern/FTF_TTFont.cpp
@@ -317,12 +317,11 @@ float FTF_TTFont::DrawString(char* str, unsigned int flag)
{
float color[4];
wchar_t wstr[FTF_MAX_STR_SIZE-1]={'\0'};
- int len=0;
+ /* note; this utf8towchar() function I totally don't understand... without using translations it
+ removes special characters completely. So, for now we just skip that then. (ton) */
if (FTF_USE_GETTEXT & flag)
- len=utf8towchar(wstr,gettext(str));
- else
- len=utf8towchar(wstr,str);
+ utf8towchar(wstr, gettext(str));
glGetFloatv(GL_CURRENT_COLOR, color);
@@ -332,7 +331,10 @@ float FTF_TTFont::DrawString(char* str, unsigned int flag)
glPixelTransferf(GL_GREEN_SCALE, color[1]);
glPixelTransferf(GL_BLUE_SCALE, color[2]);
- font->Render(wstr);
+ if (FTF_USE_GETTEXT & flag)
+ font->Render(wstr);
+ else
+ font->Render(str);
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
@@ -347,14 +349,21 @@ float FTF_TTFont::DrawString(char* str, unsigned int flag)
glTranslatef(pen_x, pen_y, 0.0);
glScalef(fsize, fsize, 1.0);
- font->Render(wstr);
+ if (FTF_USE_GETTEXT & flag)
+ font->Render(wstr);
+ else
+ font->Render(str);
+
glPopMatrix();
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
}
- return font->Advance(wstr);
+ if (FTF_USE_GETTEXT & flag)
+ return font->Advance(wstr);
+ else
+ return font->Advance(str);
}
@@ -363,16 +372,26 @@ float FTF_TTFont::GetStringWidth(char* str, unsigned int flag)
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);
+ /* note; this utf8towchar() function I totally don't understand... without using translations it
+ removes special characters completely. So, for now we just skip that then. (ton) */
- if(mode == FTF_PIXMAPFONT) {
- return font->Advance(wstr);
- } else if(mode == FTF_TEXTUREFONT) {
- return font->Advance(wstr);// * fsize;
+ if (FTF_USE_GETTEXT & flag) {
+ len=utf8towchar(wstr, gettext(str));
+
+ if(mode == FTF_PIXMAPFONT) {
+ return font->Advance(wstr);
+ } else if(mode == FTF_TEXTUREFONT) {
+ return font->Advance(wstr);// * fsize;
+ }
+ }
+ else {
+ if(mode == FTF_PIXMAPFONT) {
+ return font->Advance(str);
+ } else if(mode == FTF_TEXTUREFONT) {
+ return font->Advance(str);// * fsize;
+ }
}
+
return 0.0;
}