diff --git a/source/shared_lib/sources/graphics/font.cpp b/source/shared_lib/sources/graphics/font.cpp index ff470b78..86de6259 100644 --- a/source/shared_lib/sources/graphics/font.cpp +++ b/source/shared_lib/sources/graphics/font.cpp @@ -3,9 +3,9 @@ // // Copyright (C) 2001-2007 Martio Figueroa // -// You can redistribute this code and/or modify it under -// the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the +// You can redistribute this code and/or modify it under +// the terms of the GNU General Public License as published +// by the Free Software Foundation; either version 2 of the // License, or (at your option) any later version // ============================================================== @@ -26,28 +26,35 @@ std::string Font::fontTypeName = "Times New Roman"; // class FontMetrics // ===================================================== -FontMetrics::FontMetrics(){ +FontMetrics::FontMetrics() { widths= new float[Font::charCount]; height= 0; - for(int i=0; i= Font::charCount) { string sError = "str[i] >= Font::charCount, [" + str + "] i = " + intToStr(i); throw runtime_error(sError); } - width+= widths[str[i]]; + //Treat 2 byte characters as spaces + if(str[i] < 0) { + width+= widths[32]; + i++; + } + else { + width+= widths[str[i]]; + } } return width; }