mirror of
https://github.com/glest/glest-source.git
synced 2025-02-25 12:12:25 +01:00
got ftgl raster fonts working when ini setting is:
Enable3DFontRendering=false and NOT running legacy font mode
This commit is contained in:
parent
3dfd316484
commit
bcc97704b6
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user