diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-06-26 22:47:34 +0300 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2014-07-08 09:40:24 +0200 |
commit | e26660c004f8a68dbf6b262139f568d0b5efe663 (patch) | |
tree | b9dd0968de3668c7b11cd5b7cfbefe50231ef36c | |
parent | df7ecb68022c1c24c962d2766ac8fc29846cf3e0 (diff) |
Don't assert when HB-old is unable to deal with surrogates
Since we have no interest in fixing HB-old to properly support surrogates,
here is a simple workaround for the case when surrogate parts gets
treated like two separate glyphs in log_clusters but a single character.
And since it's a known issue that HB-old doesn't really support surrogates,
it's better to draw some garbage/boxes rather than to assert, IMO.
Task-number: QTBUG-39875
Change-Id: I95ff43e821ae989d7a6f792f71f157dcea92dd16
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
-rw-r--r-- | src/gui/text/qtextengine.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 67dedca760..a3059008be 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1298,8 +1298,12 @@ int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *stri attrs.justification = hbAttrs.justification; } - for (quint32 i = 0; i < shaper_item.item.length; ++i) + for (quint32 i = 0; i < shaper_item.item.length; ++i) { + // Workaround wrong log_clusters for surrogates (i.e. QTBUG-39875) + if (shaper_item.log_clusters[i] >= shaper_item.num_glyphs) + shaper_item.log_clusters[i] = shaper_item.num_glyphs - 1; shaper_item.log_clusters[i] += glyph_pos; + } if (kerningEnabled && !shaper_item.kerning_applied) actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0)); |