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>bb10
parent
df7ecb6802
commit
e26660c004
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue