- fixed font spacing in chat text

This commit is contained in:
Mark Vejvoda
2010-11-04 06:27:25 +00:00
parent 6312c0ec60
commit 7c47a51718

View File

@@ -864,6 +864,13 @@ void Renderer::RenderConsoleLine(int lineIndex, int xPosition, const ConsoleLine
//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,
CoreData::getInstance().getConsoleFont(),
@@ -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 {