Don't return a visual glyph for ignorable characters

When Harfbuzz returns zero glyphs, this will typically be because
the character is ignored. We currently have no way to differentiate
this from actual error cases, so to avoid return the error glyph
for cases which are not really errors, we set the dontPrint flag
for this.

When we add a way to differentiate between error cases and non-error
cases later, we should revert this for the actual errors.

Pick-to: 6.4
Task-number: QTBUG-108799
Change-Id: I2a910d951b71c705fb4dd761fcfe3a942b3afa7c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2022-11-28 13:21:11 +01:00
parent eb63f2eb05
commit 0dcd640a1f
2 changed files with 2 additions and 3 deletions

View File

@ -1528,6 +1528,7 @@ void QTextEngine::shapeText(int item) const
QGlyphLayout g = availableGlyphs(&si);
g.glyphs[0] = 0;
g.attributes[0].clusterStart = true;
g.attributes[0].dontPrint = true;
ushort *log_clusters = logClusters(&si);
for (int i = 0; i < itemLength; ++i)

View File

@ -616,9 +616,7 @@ void tst_QGlyphRun::defaultIgnorables()
layout.endLayout();
QList<QGlyphRun> runs = layout.glyphRuns();
QCOMPARE(runs.size(), 1);
QCOMPARE(runs.at(0).glyphIndexes().size(), 1);
QCOMPARE(runs.at(0).glyphIndexes()[0], uint(0));
QCOMPARE(runs.size(), 0);
}
void tst_QGlyphRun::stringIndexes()