mirror of
https://github.com/glest/glest-source.git
synced 2025-08-27 17:59:48 +02:00
- attempt to fix 'blurry fonts'
This commit is contained in:
@@ -65,6 +65,7 @@ public:
|
||||
static bool fontIsMultibyte;
|
||||
static bool forceLegacyFonts;
|
||||
static bool fontIsRightToLeft;
|
||||
static float scaleFontValue;
|
||||
|
||||
public:
|
||||
enum Width {
|
||||
|
@@ -38,6 +38,7 @@ bool Font::fontIsMultibyte = false;
|
||||
bool Font::forceLegacyFonts = false;
|
||||
float FontMetrics::DEFAULT_Y_OFFSET_FACTOR = 8.0f;
|
||||
bool Font::fontIsRightToLeft = false;
|
||||
float Font::scaleFontValue = 0.65;
|
||||
//
|
||||
|
||||
// =====================================================
|
||||
|
@@ -121,6 +121,11 @@ void TextFTGL::init(string fontName, int fontSize) {
|
||||
}
|
||||
else if(type == ftht_3D) {
|
||||
ftFont = new FTGLTextureFont(fontFile);
|
||||
|
||||
//ftFont = new FTBufferFont(fontFile);
|
||||
//ftFont = new FTGLExtrdFont(fontFile);
|
||||
//ftFont = new FTGLPolygonFont("/usr/share/fonts/truetype/arphic/uming.ttc");
|
||||
|
||||
//printf("3D font [%s]\n",fontFile);
|
||||
}
|
||||
else {
|
||||
|
@@ -435,7 +435,7 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
|
||||
const unsigned char *utext= NULL;
|
||||
//assertGl();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
//glMatrixMode(GL_TEXTURE);
|
||||
|
||||
//assertGl();
|
||||
|
||||
@@ -518,18 +518,28 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
|
||||
|
||||
//assertGl();
|
||||
|
||||
float scaleX = Font::scaleFontValue;
|
||||
float scaleY = Font::scaleFontValue;
|
||||
float scaleZ = 1.0;
|
||||
|
||||
//int scaleWidthX = (font->getTextHandler()->Advance(renderText.c_str()) * scaleX) / 2.0;
|
||||
//glTranslatef(translatePos.x + scaleWidthX, translatePos.y, translatePos.z);
|
||||
glTranslatef(translatePos.x, translatePos.y, translatePos.z);
|
||||
|
||||
//assertGl();
|
||||
|
||||
//glScalef(scaleX, scaleY, scaleZ);
|
||||
|
||||
|
||||
//glTranslatef(0.45, 0.45, 1.0);
|
||||
|
||||
//assertGl();
|
||||
|
||||
// font->getTextHandler()->Render(text.c_str());
|
||||
// specialFTGLErrorCheckWorkaround(text);
|
||||
|
||||
if(font->getTextHandler() != NULL) {
|
||||
glScalef(scaleX, scaleY, scaleZ);
|
||||
if(text.find("\n") == renderText.npos && renderText.find("\t") == renderText.npos) {
|
||||
//assertGl();
|
||||
font->getTextHandler()->Render(renderText.c_str());
|
||||
@@ -577,7 +587,7 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
|
||||
{
|
||||
line++;
|
||||
//assertGl();
|
||||
float yLineValue = font->getTextHandler()->LineHeight(parts[i].c_str());
|
||||
float yLineValue = (font->getTextHandler()->LineHeight(parts[i].c_str()) * Font::scaleFontValue);
|
||||
//assertGl();
|
||||
translatePos= Vec3f(translatePos.x, translatePos.y - yLineValue, translatePos.z);
|
||||
needsRecursiveRender = true;
|
||||
@@ -589,6 +599,7 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glTranslatef(translatePos.x, translatePos.y, translatePos.z);
|
||||
glScalef(scaleX, scaleY, scaleZ);
|
||||
font->getTextHandler()->Render(parts[i].c_str());
|
||||
specialFTGLErrorCheckWorkaround(parts[i]);
|
||||
glPopMatrix();
|
||||
@@ -646,6 +657,9 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
//assertGl();
|
||||
//glDisable(GL_TEXTURE_2D);
|
||||
|
||||
assertGl();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user