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 <eskil.abrahamsen-blomfeldt@nokia.com>
bb10
Jiang Jiang 2012-01-19 16:30:03 +01:00 committed by Qt by Nokia
parent fc366046b4
commit 91fa4b7043
1 changed files with 5 additions and 2 deletions

View File

@ -2228,9 +2228,12 @@ QList<QGlyphRun> 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];