diff options
author | Niklas Wenzel <dev@nikwen.de> | 2022-03-10 20:53:05 +0100 |
---|---|---|
committer | Niklas Wenzel <dev@nikwen.de> | 2022-03-11 21:25:01 +0100 |
commit | b83fc8aafae72327951c178b3b42ac7bc0d8cefa (patch) | |
tree | 0c250e517d6b88e4b8c04da4daf1d39ca532d766 /src | |
parent | cb65e4182fafcbb70e1351656f44eb4e9d8d6351 (diff) |
GDI: Fix style name detection if font has no typographic subfamily name
This fixes the detection of font style names for the fonts "Bahnschrift"
and "Alef Bold" as described in Microsoft's documentation:
https://docs.microsoft.com/en-us/typography/opentype/spec/name
Fixes: QTBUG-101609
Fixes: QTBUG-101610
Pick-to: 6.3
Change-Id: I5bd2b72817c07195f1e98d1d924c6f673d9e24e0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/windows/qwindowsfontdatabase.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/text/windows/qwindowsfontdatabase.cpp b/src/gui/text/windows/qwindowsfontdatabase.cpp index da196880f8..4fb8d2dce3 100644 --- a/src/gui/text/windows/qwindowsfontdatabase.cpp +++ b/src/gui/text/windows/qwindowsfontdatabase.cpp @@ -558,7 +558,13 @@ static bool addFontToDatabase(QString familyName, subFamilyStyle = styleName; faceName = familyName; // Remember the original name for later lookups familyName = canonicalNames.preferredName; - styleName = canonicalNames.preferredStyle; + // Preferred style / typographic subfamily name: + // "If it is absent, then name ID 2 is considered to be the typographic subfamily name." + // From: https://docs.microsoft.com/en-us/windows/win32/directwrite/opentype-variable-fonts + // Name ID 2 is already stored in the styleName variable. Furthermore, for variable fonts, + // styleName holds the variation instance name, which should be used over name ID 2. + if (!canonicalNames.preferredStyle.isEmpty()) + styleName = canonicalNames.preferredStyle; } QSupportedWritingSystems writingSystems; |