Fixed Font:getWidth and Font:getWrap to use kerning information.

This commit is contained in:
Alex Szpakowski
2015-07-03 10:54:24 -03:00
parent 8656797c5c
commit ded2dc39ee
+5 -1
View File
@@ -636,13 +636,17 @@ int Font::getWidth(const std::string &str)
int width = 0;
try
{
uint32 prevglyph = 0;
utf8::iterator<std::string::const_iterator> i(line.begin(), line.begin(), line.end());
utf8::iterator<std::string::const_iterator> end(line.end(), line.begin(), line.end());
while (i != end)
{
uint32 c = *i++;
const Glyph &g = findGlyph(c);
width += g.spacing;
width += g.spacing + getKerning(prevglyph, c);
prevglyph = c;
}
}
catch(utf8::exception &e)