Merge pull request #284 from andreymal/dev

GetStringWidth fix
dev-ui
krzys-h 2014-03-02 10:55:55 +01:00
commit fef338da24
1 changed files with 2 additions and 2 deletions

View File

@ -333,7 +333,7 @@ float CText::GetStringWidth(std::string text, FontType font, float size)
// Skip special chars // Skip special chars
for (char& c : text) for (char& c : text)
{ {
if (c < 32) if (c < 32 && c >= 0)
c = ':'; c = ':';
} }
@ -351,7 +351,7 @@ float CText::GetCharWidth(UTF8Char ch, FontType font, float size, float offset)
if (font == FONT_BUTTON) return 0.0f; if (font == FONT_BUTTON) return 0.0f;
int width = 1; int width = 1;
if (ch.c1 < 32) if (ch.c1 < 32 && ch.c1 >= 0)
{ {
if (ch.c1 == '\t') if (ch.c1 == '\t')
width = m_tabSize; width = m_tabSize;