Fix assert in certain cases of missing glyph in a string
If a substring for a fallback engine spanned multiple characters, we would only assign the first of the characters to a glyph in log clusters. This could cause the log clusters array to become non-monotonic (you could get an array like [0, 1, 2, 0, 3, 4]). In turn, this would confuse the text layout algorithm which depends on the indexes always increasing, and we would sometimes hit an assert in addNextCluster() if we were unlucky. To rectify this, make sure all characters in the substring are mapped to the same cluster. Fixes: QTBUG-131731 Pick-to: 6.5 5.15 Change-Id: I93415a58351349ead6eb7a016b32b09f274e6fe4 Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 40e364172f001ce7dd6e4e72716e9c17c9d29b9e)
This commit is contained in:
parent
1fe4271af0
commit
f2b7d064b0
@ -1747,7 +1747,8 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
|
||||
g.offsets[0].y = QFixed{};
|
||||
g.attributes[0].clusterStart = true;
|
||||
g.attributes[0].dontPrint = true;
|
||||
log_clusters[0] = glyphs_shaped;
|
||||
for (uint str_pos = 0; str_pos < item_length; ++str_pos)
|
||||
log_clusters[str_pos] = glyphs_shaped;
|
||||
}
|
||||
|
||||
if (Q_UNLIKELY(engineIdx != 0)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user