Skip to content

Commit

Permalink
Don't return a visual glyph for ignorable characters
Browse files Browse the repository at this point in the history
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ø <[email protected]>
  • Loading branch information
eskilblomfeldt committed Dec 5, 2022
1 parent eb63f2e commit 0dcd640
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/gui/text/qtextengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0dcd640

Please sign in to comment.