From 37f585ece17063a814598221c0cbb874c52d223f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 15 Jul 2010 10:05:11 +0200 Subject: Support glyphs that are wider than default width in texture glyph cache We need to reserve space for the widest possible glyph in the font Reviewed-by: Kim --- src/gui/painting/qtextureglyphcache.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 29cd82b..376219b 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -127,8 +127,12 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const rowHeight += margin * 2 + paddingDoubled; - if (m_w == 0) - m_w = QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; + if (m_w == 0) { + if (fontEngine->maxCharWidth() <= QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH) + m_w = QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; + else + m_w = qt_next_power_of_two(fontEngine->maxCharWidth()); + } // now actually use the coords and paint the wanted glyps into cache. QHash::iterator iter = listItemCoordinates.begin(); -- cgit v0.12