Permalink
Browse files

Merge pull request #1989 from pieh/italics_end

guilib: fix italic text being chopped off on the end
  • Loading branch information...
2 parents 1715fda + 66919a6 commit 7d8c737c8e2ebf5d6fb3e412e2953e6100366236 @jmarshallnz jmarshallnz committed Dec 26, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 xbmc/guilib/GUIFontTTF.cpp
@@ -423,7 +423,16 @@ float CGUIFontTTFBase::GetTextWidthInternal(vecText::const_iterator start, vecTe
while (start != end)
{
Character *c = GetCharacter(*start++);
- if (c) width += c->advance;
+ if (c)
+ {
+ // If last character in line, we want to add render width
+ // and not advance distance - this makes sure that italic text isn't
+ // choped on the end (as render width is larger than advance then).
+ if (start == end)
+ width += max(c->right - c->left + c->offsetX, c->advance);
+ else
+ width += c->advance;
+ }
}
return width;
}

0 comments on commit 7d8c737

Please sign in to comment.