mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 07:31:21 +02:00
- fixed debug output font position --> just for you james!
This commit is contained in:
@@ -141,10 +141,11 @@ float FontMetrics::getTextWidth(const string &str) {
|
||||
}
|
||||
}
|
||||
|
||||
float FontMetrics::getHeight() const {
|
||||
float FontMetrics::getHeight(const string &str) const {
|
||||
if(textHandler != NULL) {
|
||||
//printf("(textHandler->LineHeight(" ") = %f Font::scaleFontValue = %f\n",textHandler->LineHeight(" "),Font::scaleFontValue);
|
||||
return (textHandler->LineHeight(" ") * Font::scaleFontValue);
|
||||
//return (textHandler->LineHeight(str.c_str()) * Font::scaleFontValue);
|
||||
return (textHandler->LineHeight(str.c_str()));
|
||||
}
|
||||
else {
|
||||
return height;
|
||||
|
@@ -88,7 +88,7 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere
|
||||
metrics= font->getMetrics();
|
||||
if(centered) {
|
||||
rasterPos.x= x-metrics->getTextWidth(renderText)/2.f;
|
||||
rasterPos.y= y+metrics->getHeight()/2.f;
|
||||
rasterPos.y= y + metrics->getHeight(renderText)/2.f;
|
||||
}
|
||||
else {
|
||||
rasterPos= Vec2f(static_cast<float>(x), static_cast<float>(y));
|
||||
@@ -328,7 +328,7 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere
|
||||
break;
|
||||
case '\n':
|
||||
line++;
|
||||
rasterPos= Vec2f(static_cast<float>(x), y-(metrics->getHeight()*2.f)*line);
|
||||
rasterPos= Vec2f(static_cast<float>(x), y-(metrics->getHeight("W")*2.f)*line);
|
||||
glRasterPos2f(rasterPos.x, rasterPos.y);
|
||||
break;
|
||||
default:
|
||||
@@ -511,7 +511,7 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
|
||||
if(centered) {
|
||||
//glTranslatef(x-scale*metrics->getTextWidth(text)/2.f, y-scale*metrics->getHeight()/2.f, 0);
|
||||
translatePos.x = x-scale*metrics->getTextWidth(renderText)/2.f;
|
||||
translatePos.y = y-scale*metrics->getHeight()/2.f;
|
||||
translatePos.y = y-scale*metrics->getHeight(renderText)/2.f;
|
||||
translatePos.z = 0;
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user