summaryrefslogtreecommitdiffstats
path: root/src/graphics/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/engine')
-rw-r--r--src/graphics/engine/text.cpp5
-rw-r--r--src/graphics/engine/text.h8
2 files changed, 7 insertions, 6 deletions
diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp
index 6355aed..66c73a9 100644
--- a/src/graphics/engine/text.cpp
+++ b/src/graphics/engine/text.cpp
@@ -407,10 +407,10 @@ int CText::Justify(const std::string &text, FontType font, float size, float wid
if (len >= 3)
ch.c3 = text[index+2];
- index += len;
-
if (ch.c1 == '\n')
+ {
return index+1;
+ }
if (ch.c1 == ' ' )
cut = index+1;
@@ -421,6 +421,7 @@ int CText::Justify(const std::string &text, FontType font, float size, float wid
if (cut == 0) return index;
else return cut;
}
+ index += len;
}
return index;
diff --git a/src/graphics/engine/text.h b/src/graphics/engine/text.h
index 4575c37..57fad43 100644
--- a/src/graphics/engine/text.h
+++ b/src/graphics/engine/text.h
@@ -227,7 +227,7 @@ class CText
{
public:
CText(CInstanceManager *iMan, CEngine* engine);
- ~CText();
+ virtual ~CText();
//! Sets the device to be used
void SetDevice(CDevice *device);
@@ -269,12 +269,12 @@ public:
float GetHeight(FontType font, float size);
//! Returns width of string (multi-format)
- float GetStringWidth(const std::string &text,
+ TEST_VIRTUAL float GetStringWidth(const std::string &text,
std::map<unsigned int, FontMetaChar> &format, float size);
//! Returns width of string (single font)
- float GetStringWidth(const std::string &text, FontType font, float size);
+ TEST_VIRTUAL float GetStringWidth(const std::string &text, FontType font, float size);
//! Returns width of single character
- float GetCharWidth(UTF8Char ch, FontType font, float size, float offset);
+ TEST_VIRTUAL float GetCharWidth(UTF8Char ch, FontType font, float size, float offset);
//! Justifies a line of text (multi-format)
int Justify(const std::string &text, std::map<unsigned int, FontMetaChar> &format,