- patch from Nebososo for 2 byte characters and font widths

This commit is contained in:
Mark Vejvoda 2011-01-11 19:03:41 +00:00
parent a7f6a592ff
commit 9acbfb9d19

View File

@ -47,8 +47,15 @@ float FontMetrics::getTextWidth(const string &str) const{
string sError = "str[i] >= Font::charCount, [" + str + "] i = " + intToStr(i);
throw runtime_error(sError);
}
//Treat 2 byte characters as spaces
if(str[i] < 0) {
width+= widths[32];
i++;
}
else {
width+= widths[str[i]];
}
}
return width;
}