Fix color fonts with DirectWrite backend

The logic to detect color fonts in the GDI font database was never
implemented in the DirectWrite database, causing emojis to look
monochrome. The patch moves this into the font engine itself instead,
along with the other initialization code.

Fixes: QTBUG-122168
Change-Id: I6f5dad579bd987149e613b8071821aaf70a89bc2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6bd85d4a27ba2e934fa76a430f2e1d55c08d379d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2024-02-26 09:29:00 +01:00 committed by Qt Cherry-pick Bot
parent 233ce5b018
commit 84bbfd9c62
2 changed files with 4 additions and 3 deletions

View File

@ -1256,9 +1256,6 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q
QFontDef fontDef = request;
fontDef.families = QStringList(QString::fromWCharArray(n));
if (isColorFont)
fedw->glyphFormat = QFontEngine::Format_ARGB;
fedw->initFontInfo(fontDef, dpi);
fe = fedw;
}

View File

@ -1030,6 +1030,10 @@ void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request,
names->Release();
}
// Color font
if (face3->GetPaletteEntryCount() > 0)
glyphFormat = QFontEngine::Format_ARGB;
face3->Release();
}
#endif