Windows: Fix Adobe/Mozilla format color fonts after Windows update

After the Anniversary update of Windows 10 (update 1607), color fonts
using the Adobe/Mozilla format with embedded SVGs are detected as
color fonts by DirectWrite, but they do not contain any colored layers.
The result of this was that we would no longer draw these fonts using
the pen color, but we would also not support the colored glyphs in the
fonts. In order to still support using these fonts as regular
monochromatic fonts, we check if there is actually a palette in the
font file before registering it as a color font.

[ChangeLog][QtGui][Windows] Fixed rendering Adobe/Mozilla format
color fonts with other colors than black after Windows 10 Anniversary
update.

Task-number: QTBUG-55097
Change-Id: I8d74787e49530d1167b9f2533ffdf7ab814c3358
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2016-08-05 15:55:30 +02:00 committed by Tim Jenssen
parent 7f66289f9d
commit 121b7b7a3c

View File

@ -1810,7 +1810,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request,
if (SUCCEEDED(directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2),
reinterpret_cast<void **>(&directWriteFontFace2)))) {
if (directWriteFontFace2->IsColorFont())
isColorFont = true;
isColorFont = directWriteFontFace2->GetPaletteEntryCount() > 0;
}
#endif
const QFont::HintingPreference hintingPreference =