From ac0ba277536a69adaf12a6e23e81b86e8047b376 Mon Sep 17 00:00:00 2001 From: Nathan Bowhay Date: Thu, 29 Jan 2015 15:18:00 -0800 Subject: [PATCH] Fixed degree symbol not displaying Fixed bug with degree symbol not displaying correctly in torque thanks to the forums: http://www.garagegames.com/community/forums/viewthread/125190/1#comment-804996 --- Engine/source/gfx/gFont.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Engine/source/gfx/gFont.cpp b/Engine/source/gfx/gFont.cpp index 7c838915d..4d6478541 100644 --- a/Engine/source/gfx/gFont.cpp +++ b/Engine/source/gfx/gFont.cpp @@ -568,6 +568,7 @@ void GFont::wrapString(const UTF8 *txt, U32 lineWidth, Vector &startLineOff for (U32 i = 0; i < len;) { + U32 wide = 0; startLine = i; startLineOffset.push_back(startLine); @@ -584,6 +585,10 @@ void GFont::wrapString(const UTF8 *txt, U32 lineWidth, Vector &startLineOff else if(isValidChar(txt[i])) { lineStrWidth += getCharInfo(txt[i]).xIncrement; + if(txt[i] < 0) // symbols which code > 127 + { + wide++; i++; + } if( lineStrWidth > lineWidth ) { needsNewLine = true; @@ -595,7 +600,7 @@ void GFont::wrapString(const UTF8 *txt, U32 lineWidth, Vector &startLineOff if (!needsNewLine) { // we are done! - lineLen.push_back(i - startLine); + lineLen.push_back(i - startLine - wide); return; } @@ -628,7 +633,7 @@ void GFont::wrapString(const UTF8 *txt, U32 lineWidth, Vector &startLineOff } } - lineLen.push_back(j - startLine); + lineLen.push_back(j - startLine - wide); i = j; // Now we need to increment through any space characters at the