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.

Task-number: QTBUG-108799
Change-Id: I2a910d951b71c705fb4dd761fcfe3a942b3afa7c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0dcd640a1faa9943645ab0e15ebfdbe263058529)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2022-11-28 13:21:11 +01:00 committed by Qt Cherry-pick Bot
parent 5e8048f966
commit 658ded34c7
2 changed files with 2 additions and 3 deletions

View File

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

View File

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