diff options
-rw-r--r-- | xbmc/guilib/GUIFontTTF.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp index ff11db14f8..f9f0eec2a3 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp @@ -512,13 +512,13 @@ void CGUIFontTTF::DrawTextInternal(CGraphicContext& context, if (!c) continue; - float nextWidth; + float nextWidth = textWidth; if ((ch & 0xffff) == static_cast<character_t>('\t')) - nextWidth = GetTabSpaceLength(); + nextWidth += GetTabSpaceLength(); else - nextWidth = textWidth + c->m_advance; + nextWidth += c->m_advance; - if (nextWidth > maxPixelWidth) + if (maxPixelWidth > 0 && nextWidth > maxPixelWidth) { // Start rendering from the glyph that does not exceed the maximum width startPosGlyph = std::distance(itRGlyph, glyphs.crend()); @@ -540,13 +540,13 @@ void CGUIFontTTF::DrawTextInternal(CGraphicContext& context, if (!c) continue; - float nextWidth; + float nextWidth = textWidth; if ((ch & 0xffff) == static_cast<character_t>('\t')) - nextWidth = GetTabSpaceLength(); + nextWidth += GetTabSpaceLength(); else - nextWidth = textWidth + c->m_advance; + nextWidth += c->m_advance; - if (nextWidth > maxPixelWidth) + if (maxPixelWidth > 0 && nextWidth > maxPixelWidth) break; textWidth = nextWidth; |