Revert "Don't do font merging for PUA characters"

This reverts commit fc33fea999.

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ø <tor.arne.vestbo@qt.io>
bb10
Eskil Abrahamsen Blomfeldt 2024-03-18 07:57:40 +01:00
parent 886eb76aea
commit 4913511d3b
2 changed files with 1 additions and 41 deletions

View File

@ -1866,8 +1866,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
&& ucs4 != QChar::LineFeed
&& ucs4 != QChar::CarriageReturn
&& ucs4 != QChar::ParagraphSeparator
&& QChar::category(ucs4) != QChar::Other_Control
&& 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) {

View File

@ -56,9 +56,6 @@ private slots:
void shapingDisabledDevanagari();
void shapingDisabledLatin();
void privateUseArea();
private:
bool haveTestFonts;
};
@ -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"