diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2010-12-10 15:07:25 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-03-24 15:11:46 (GMT) |
commit | f49490a13b664eb00207b2d3d6354071ae81f161 (patch) | |
tree | 5eadb3c7280dec4538dc01d7b7598e4b9e94165c /src/gui/text | |
parent | fda299f55dd5aeb2d075f6f5c842f75c9f559f9c (diff) | |
download | Qt-f49490a13b664eb00207b2d3d6354071ae81f161.zip Qt-f49490a13b664eb00207b2d3d6354071ae81f161.tar.gz Qt-f49490a13b664eb00207b2d3d6354071ae81f161.tar.bz2 |
Make sure num_glyphs pass to HarfBuzz is large enough
(Backport from master)
Currently we only pass the num_glyphs for the run to
HB_ShapeItem, but it can be less then the string length
for this run because of Unicode surrogates. Thus, we need
to pass at least the length of that run as num_glyphs to
HB (given that we have enough space allocated because for
the entire string), if that's still not enough, we will
do ensureSpace again according to the num_glyphs returned
by HB and move remaining glyphs backwards.
Task-number: QTBUG-15679
Reviewed-by: Lars Knoll
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index b511b5a..4378c62 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1233,6 +1233,8 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const shaper_item.num_glyphs -= itemBoundaries[k + 1]; } shaper_item.initialGlyphCount = shaper_item.num_glyphs; + if (shaper_item.num_glyphs < shaper_item.item.length) + shaper_item.num_glyphs = shaper_item.item.length; QFontEngine *actualFontEngine = font; uint engineIdx = 0; @@ -1257,7 +1259,8 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const } const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos); - moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); + if (shaper_item.num_glyphs > shaper_item.item.length) + moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); shaper_item.glyphs = g.glyphs; shaper_item.attributes = g.attributes; |