got ftgl raster fonts working when ini setting is:

Enable3DFontRendering=false and NOT running legacy font mode
This commit is contained in:
Mark Vejvoda 2011-11-02 00:17:57 +00:00
parent 3dfd316484
commit bcc97704b6
3 changed files with 7 additions and 1 deletions

View File

@ -1789,6 +1789,8 @@ Vec2i computeCenteredPos(const string &text, Font2D *font, int x, int y) {
x-metrics.toVirtualX(virtualX),
y-metrics.toVirtualY(virtualY));
//printf("text [%s] x = %d y = %d virtualX = %d virtualY = %d fontMetrics->getHeight() = %f\n",text.c_str(),x,y,virtualX,virtualY,fontMetrics->getHeight());
return textPos;
}

View File

@ -132,6 +132,7 @@ float FontMetrics::getTextWidth(const string &str) {
float FontMetrics::getHeight() const {
if(textHandler != NULL) {
//printf("(textHandler->LineHeight(" ") = %f Font::scaleFontValue = %f\n",textHandler->LineHeight(" "),Font::scaleFontValue);
return (textHandler->LineHeight(" ") * Font::scaleFontValue);
}
else {

View File

@ -74,10 +74,13 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere
if(centered) {
rasterPos.x= x - font->getTextHandler()->Advance(renderText.c_str()) / 2.f;
rasterPos.y= y + font->getTextHandler()->LineHeight(renderText.c_str()) / 2;
//printf("text [%s] x = %f, y = %f rasterPos [%s]\n",text.c_str(),x,y,rasterPos.getString().c_str());
}
else {
rasterPos= Vec2f(static_cast<float>(x), static_cast<float>(y));
rasterPos.y= y + font->getTextHandler()->LineHeight(renderText.c_str());
//rasterPos.y= y + font->getTextHandler()->LineHeight(renderText.c_str());
rasterPos.y= y;
//printf("text [%s] x = %f, y = %f rasterPos [%s]\n",text.c_str(),x,y,rasterPos.getString().c_str());
}
}
else {