Fix buggy text width calculation

This commit is contained in:
Tamás Bálint Misius 2020-11-30 14:45:15 +01:00
parent 091764533d
commit a631ef78e9
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -539,7 +539,7 @@ int Graphics::textwidth(String str)
String::value_type const *s = str.c_str(); String::value_type const *s = str.c_str();
for (; *s; s++) for (; *s; s++)
{ {
if(((char)*s)=='\b') if(*s=='\b')
{ {
if(!s[1]) break; if(!s[1]) break;
s++; s++;
@ -567,7 +567,7 @@ int Graphics::textnwidth(String str, int n)
{ {
if (!n) if (!n)
break; break;
if(((char)*s)=='\b') if(*s=='\b')
{ {
if(!s[1]) break; if(!s[1]) break;
s++; s++;
@ -624,7 +624,7 @@ int Graphics::textwidthx(String str, int w)
String::value_type const *s = str.c_str(); String::value_type const *s = str.c_str();
for (; *s; s++) for (; *s; s++)
{ {
if((char)*s == '\b') if(*s == '\b')
{ {
if(!s[1]) break; if(!s[1]) break;
s++; s++;