From 91fa4b7043f85e6eb0a665f42fddccbf1d48689c Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 19 Jan 2012 16:30:03 +0100 Subject: Fix glyphsEnd range check For a character generating more than one glyphs, glyphsRun() needs to check the next glyph index after the requested range. If that glyph index is more than one larger than the glyphsEnd we currently get from logClusters, then glyphsEnd need to be set to the next glyph index minus one. Change-Id: I795c595d349418ba755b088d6fe6ff24a6e7dd15 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextlayout.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 1e8cb9e478..15ae57da65 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2228,9 +2228,12 @@ QList QTextLine::glyphRuns(int from, int length) const int glyphsEnd = (relativeTo == eng->length(&si)) ? si.num_glyphs - 1 : logClusters[relativeTo]; + // the glyph index right next to the requested range + int nextGlyphIndex = relativeTo < eng->length(&si) - 1 ? logClusters[relativeTo + 1] : si.num_glyphs; + if (nextGlyphIndex - 1 > glyphsEnd) + glyphsEnd = nextGlyphIndex - 1; bool startsInsideLigature = relativeFrom > 0 && logClusters[relativeFrom - 1] == glyphsStart; - bool endsInsideLigature = relativeTo < eng->length(&si) - 1 - && logClusters[relativeTo + 1] == glyphsEnd; + bool endsInsideLigature = nextGlyphIndex == glyphsEnd; int itemGlyphsStart = logClusters[iterator.itemStart - si.position]; int itemGlyphsEnd = logClusters[iterator.itemEnd - 1 - si.position]; -- cgit v1.2.3