diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2012-01-19 16:30:03 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-20 14:19:59 +0100 |
commit | 91fa4b7043f85e6eb0a665f42fddccbf1d48689c (patch) | |
tree | 1e33c4ee61c9a594e3d7dfd49fed2a6c95924a2b /src/gui/text/qtextlayout.cpp | |
parent | fc366046b42e4aa9f10efa81b978c89cfb7206a2 (diff) |
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>
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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<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]; |