Skip to content

Commit

Permalink
Revert "Don't do font merging for PUA characters"
Browse files Browse the repository at this point in the history
This reverts commit fc33fea.

The change caused issues with system-wide PUA fallbacks on
platforms where this is supported. It needs to be replaced by
an approach which still falls back, but only for fonts which
are explicitly categorized as PUA fallbacks.

Pick-to: 6.5 6.6 6.7
Task-number: QTBUG-110502
Change-Id: I985a1f8076645593c50e81759872b4227d0fcd0d
Reviewed-by: Tor Arne Vestbø <[email protected]>
(cherry picked from commit 4913511)
  • Loading branch information
eskilblomfeldt authored and zhaojz2308 committed Oct 31, 2024
1 parent d1a0b76 commit c6bc738
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 40 deletions.
2 changes: 1 addition & 1 deletion src/gui/text/qfontengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
&& ucs4 != QChar::LineFeed
&& ucs4 != QChar::CarriageReturn
&& ucs4 != QChar::ParagraphSeparator
&& QChar::category(ucs4) != QChar::Other_PrivateUse) {
&& QChar::category(ucs4) != QChar::Other_Control) {
if (!m_fallbackFamiliesQueried)
const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
Expand Down
39 changes: 0 additions & 39 deletions tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ private slots:

void shapingDisabledDevanagari();
void shapingDisabledLatin();

void privateUseArea();

private:
bool haveTestFonts;
};
Expand Down Expand Up @@ -1316,41 +1313,5 @@ void tst_QTextScriptEngine::shapingDisabledDevanagari()
QCOMPARE(noShapingRuns.first().glyphIndexes().size(), normalRuns.first().glyphIndexes().size());
}

void tst_QTextScriptEngine::privateUseArea()
{
QString privateUseAreaString = QString::fromUtf8("");

QFont font;
QList<QGlyphRun> withFontMerging;
{
QTextLayout layout;
layout.setText(privateUseAreaString);
layout.setFont(font);
layout.beginLayout();
layout.createLine();
layout.endLayout();

withFontMerging = layout.glyphRuns();
}

font.setStyleStrategy(QFont::NoFontMerging);
QList<QGlyphRun> withoutFontMerging;
{
QTextLayout layout;
layout.setText(privateUseAreaString);
layout.setFont(font);
layout.beginLayout();
layout.createLine();
layout.endLayout();

withoutFontMerging = layout.glyphRuns();
}

QCOMPARE(withFontMerging.size(), withoutFontMerging.size());

for (int i = 0; i < withFontMerging.size(); ++i)
QCOMPARE(withFontMerging.at(i).glyphIndexes(), withoutFontMerging.at(i).glyphIndexes());
}

QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"

0 comments on commit c6bc738

Please sign in to comment.