summaryrefslogtreecommitdiff
path: root/src/graphics/Graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/Graphics.cpp')
-rw-r--r--src/graphics/Graphics.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp
index 09da936..0b7e502 100644
--- a/src/graphics/Graphics.cpp
+++ b/src/graphics/Graphics.cpp
@@ -573,7 +573,19 @@ int Graphics::textwidth(const char *s)
{
int x = 0;
for (; *s; s++)
+ {
+ if(((char)*s)=='\b')
+ {
+ if(!s[1]) break;
+ s++;
+ continue;
+ } else if(*s == '\x0F') {
+ if(!s[1] || !s[2] || !s[3]) break;
+ s+=3;
+ continue;
+ }
x += font_data[font_ptrs[(int)(*(unsigned char *)s)]];
+ }
return x-1;
}