From a9dfd3853be1ccd79ef667def103f62c3751add1 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 28 Jun 2011 07:52:05 +0000 Subject: [PATCH] - corrections for y co-ord placement of font --- source/glest_game/graphics/renderer.cpp | 2 +- source/shared_lib/sources/graphics/font.cpp | 4 ++-- source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 377495c27..4d4244688 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -1450,7 +1450,7 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i if(lineHeight < h) { //pos.y += ((float)h / 2.f); //pos.y -= ((float(h) / 2.f) - (lineHeight / 2.f)); - pos.y += (lineHeight / 2.f); + pos.y += (lineHeight / 2.f) + 2; //pos.y -= h; //printf("Center text [%s] h = %d, lineHeight = %f, pos.y = %f\n",text.c_str(),h,lineHeight,pos.y); diff --git a/source/shared_lib/sources/graphics/font.cpp b/source/shared_lib/sources/graphics/font.cpp index ba10a3fdb..52b6e3bfa 100644 --- a/source/shared_lib/sources/graphics/font.cpp +++ b/source/shared_lib/sources/graphics/font.cpp @@ -79,7 +79,7 @@ Text * FontMetrics::getTextHandler() { float FontMetrics::getTextWidth(const string &str) { if(textHandler != NULL) { - return textHandler->Advance(str.c_str()); + return (textHandler->Advance(str.c_str()) * Font::scaleFontValue); } else { float width= 0.f; @@ -103,7 +103,7 @@ float FontMetrics::getTextWidth(const string &str) { float FontMetrics::getHeight() const { if(textHandler != NULL) { - return textHandler->LineHeight(" "); + return (textHandler->LineHeight(" ") * Font::scaleFontValue); } else { return height; diff --git a/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp b/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp index fbe7cd339..c421f697a 100644 --- a/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp @@ -470,7 +470,7 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo translatePos.x = x - (font->getTextHandler()->Advance(renderText.c_str()) / 2.f); //assertGl(); //translatePos.y = y - (font->getTextHandler()->LineHeight(text.c_str()) / font->getYOffsetFactor()); - translatePos.y = y - (font->getTextHandler()->LineHeight(renderText.c_str()) / 2.f); + translatePos.y = y - ((font->getTextHandler()->LineHeight(renderText.c_str()) * Font::scaleFontValue) / 2.f); //assertGl(); translatePos.z = 0;