From 1eedfd0e66c7afd682f682a659cda2942485cd08 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 28 Jul 2017 08:58:42 +0200 Subject: [PATCH] Windows: Stop considering Calibri as bitmap font This reverts 2bc619c30ef08c9b5e2aaa3370d184670acd73ad, which tried to fix an unspecified problem by regarding all fonts with EBDT tables as potential bitmap fonts. The change log does not have any reference to a bug report or a problematic font. It also singled out Windows and GDI as the only font engine where this was necessary, which caused difference in behavior between different platforms, and even a difference in behavior on Windows when setting the hinting preference or turning on high-DPI scaling. The fact is that any font may have an EBDT table, and Microsoft has this for the smaller pixel sizes of many of their default fonts, e.g. Calibri. The result was that Qt would detect these as bitmap fonts and refuse to use distance field rendering for them. If there are fonts where it is a real problem that some glyphs only exist as bitmaps, we first need to know about them. Then we need to find some other solution than a blanket blacklist of all fonts with EBDT tables. For instance, we could separate the bitmap glyphs into their own QGlyphRuns and use native rendering only for those specific glyphs. [ChangeLog][Windows][Fonts] Some key fonts, such as Calibri, were being detected as bitmap fonts and not rendered correctly in Qt Quick. This has now been fixed. Task-number: QTBUG-62176 Change-Id: If892390cc74f180c5df9ef80484ba2eb0319f987 Reviewed-by: Lars Knoll --- .../fontdatabases/windows/qwindowsfontengine.cpp | 16 +--------------- .../fontdatabases/windows/qwindowsfontengine_p.h | 2 -- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp index 6e95fb5a05..4be2182188 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp @@ -130,20 +130,6 @@ bool QWindowsFontEngine::hasCMapTable() const return GetFontData(hdc, MAKE_LITTLE_ENDIAN_TAG('c', 'm', 'a', 'p'), 0, 0, 0) != GDI_ERROR; } -bool QWindowsFontEngine::hasGlyfTable() const -{ - HDC hdc = m_fontEngineData->hdc; - SelectObject(hdc, hfont); - return GetFontData(hdc, MAKE_LITTLE_ENDIAN_TAG('g', 'l', 'y', 'f'), 0, 0, 0) != GDI_ERROR; -} - -bool QWindowsFontEngine::hasEbdtTable() const -{ - HDC hdc = m_fontEngineData->hdc; - SelectObject(hdc, hfont); - return GetFontData(hdc, MAKE_LITTLE_ENDIAN_TAG('E', 'B', 'D', 'T'), 0, 0, 0) != GDI_ERROR; -} - static inline QString stringFromOutLineTextMetric(const OUTLINETEXTMETRIC *otm, PSTR offset) { const uchar *p = reinterpret_cast(otm) + quintptr(offset); @@ -274,7 +260,7 @@ QWindowsFontEngine::QWindowsFontEngine(const QString &name, userData.insert(QStringLiteral("trueType"), QVariant(bool(ttf))); setUserData(userData); - hasUnreliableOutline = hasGlyfTable() && hasEbdtTable(); + hasUnreliableOutline = (tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) == 0; } QWindowsFontEngine::~QWindowsFontEngine() diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h index 5119adc0eb..76b45d7a7b 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h @@ -138,8 +138,6 @@ private: QImage::Format mask_format); bool hasCFFTable() const; bool hasCMapTable() const; - bool hasGlyfTable() const; - bool hasEbdtTable() const; const QSharedPointer m_fontEngineData;