From ded2dc39ee8027fa3bcd5f46e59ae7a6e4b9a341 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 3 Jul 2015 10:54:24 -0300 Subject: [PATCH] Fixed Font:getWidth and Font:getWrap to use kerning information. --- src/modules/graphics/opengl/Font.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/Font.cpp b/src/modules/graphics/opengl/Font.cpp index 4d13d1f46..5f6c8f2c2 100644 --- a/src/modules/graphics/opengl/Font.cpp +++ b/src/modules/graphics/opengl/Font.cpp @@ -636,13 +636,17 @@ int Font::getWidth(const std::string &str) int width = 0; try { + uint32 prevglyph = 0; + utf8::iterator i(line.begin(), line.begin(), line.end()); utf8::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)