From 7c47a517188042aca0f32657bc86322a3a81b471 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 4 Nov 2010 06:27:25 +0000 Subject: [PATCH] - fixed font spacing in chat text --- source/glest_game/graphics/renderer.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 803a4949d..1b12e1803 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -862,7 +862,14 @@ void Renderer::RenderConsoleLine(int lineIndex, int xPosition, const ConsoleLine //printf("playerName [%s], line [%s]\n",playerName.c_str(),line.c_str()); //string headerLine = "*" + playerName + ":"; - string headerLine = playerName + ":"; + string headerLine = playerName + ": "; + + const Metrics &metrics= Metrics::getInstance(); + const FontMetrics *fontMetrics= CoreData::getInstance().getConsoleFont()->getMetrics(); + + if(fontMetrics == NULL) { + throw runtime_error("fontMetrics == NULL"); + } renderTextShadow( headerLine, @@ -871,7 +878,9 @@ void Renderer::RenderConsoleLine(int lineIndex, int xPosition, const ConsoleLine xPosition, lineIndex * 20 + 20); fontColor = defaultFontColor; - xPosition += (8 * (playerName.length() + 2)); + //xPosition += (8 * (playerName.length() + 2)); + // Proper font spacing after username portion of chat text rendering + xPosition += (metrics.toVirtualX(fontMetrics->getTextWidth(headerLine))); } } else {