summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontdatabase.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-04-02 15:33:16 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-04-04 10:24:57 +0000
commitbcd2fa484a4fe93e77743195d7f72cce9e580d43 (patch)
treecbe6501545af10348913756c98b4b2fa8b6cbae3 /src/gui/text/qfontdatabase.cpp
parente2fdd7a9cbc6293c07b7c316b9ea3e9f4d6faf29 (diff)
Fix font matching of typographic families on Windows
9204b8c31ea1b5f0c05870c5b5d74c33b1a4f622 broke font matching on Windows. After this change, if you request a specific face of a family, such as "Arial Black", and Qt detects that its typographic/preferred name is "Arial", then it will be added as the single style of the Arial family, which will in turn be set as populated=true. So if you later request a regular font of "Arial" family, then it will see that the family has already been populated, skip this step, and then see that there is only one style available, i.e. "Arial Black". To work around this, we need to make sure the typographic family is properly populated the first time it is registered. [ChangeLog][Windows][Fonts] Fixed a bug where it would be impossible to request different faces of a font family after a specific type face has been in use. Task-number: QTBUG-74748 Change-Id: Ia0caace2b88a32e6114ff23ad10ee1ea8f5a3e03 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/text/qfontdatabase.cpp')
-rw-r--r--src/gui/text/qfontdatabase.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index fa9573441a..a307539800 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -804,6 +804,13 @@ QString qt_resolveFontFamilyAlias(const QString &alias)
return alias;
}
+bool qt_isFontFamilyPopulated(const QString &familyName)
+{
+ QFontDatabasePrivate *d = privateDb();
+ QtFontFamily *f = d->family(familyName, QFontDatabasePrivate::RequestFamily);
+ return f != nullptr && f->populated;
+}
+
/*!
Returns a list of alternative fonts for the specified \a family and
\a style and \a script using the \a styleHint given.