summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-03-02 10:55:55 +0100
committerkrzys-h <krzys_h@interia.pl>2014-03-02 10:55:55 +0100
commitfef338da247869884a2b78c648f19a57244c95f8 (patch)
tree7a94c266f6aa6e74a971de1aacc2bfb4bade357f
parent14709427c46897a37991a35beecb351428265a7f (diff)
parente9960f53730f84c299147cb996fb656da48dfa66 (diff)
downloadcolobot-fef338da247869884a2b78c648f19a57244c95f8.tar.gz
colobot-fef338da247869884a2b78c648f19a57244c95f8.tar.bz2
colobot-fef338da247869884a2b78c648f19a57244c95f8.zip
Merge pull request #284 from andreymal/dev
GetStringWidth fix
-rw-r--r--src/graphics/engine/text.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp
index ffd2eb2..581ff01 100644
--- a/src/graphics/engine/text.cpp
+++ b/src/graphics/engine/text.cpp
@@ -333,7 +333,7 @@ float CText::GetStringWidth(std::string text, FontType font, float size)
// Skip special chars
for (char& c : text)
{
- if (c < 32)
+ if (c < 32 && c >= 0)
c = ':';
}
@@ -351,7 +351,7 @@ float CText::GetCharWidth(UTF8Char ch, FontType font, float size, float offset)
if (font == FONT_BUTTON) return 0.0f;
int width = 1;
- if (ch.c1 < 32)
+ if (ch.c1 < 32 && ch.c1 >= 0)
{
if (ch.c1 == '\t')
width = m_tabSize;