CoreText: Resolve default font by asking for the QPlatformTheme::SystemFont

We want to go through the themeFont() code path so that we resolve all
variants of the font, and so that the descriptors we get are preserved
until we can populate them later on.

Pick-to: 6.2 6.3
Change-Id: Idbf44062078a0722bbe71c91083285f0eb9a9e09
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2022-03-24 13:18:17 +01:00
parent 3b6aba6598
commit 1ff2793122
2 changed files with 1 additions and 8 deletions

View File

@ -863,12 +863,7 @@ QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const
QFont QCoreTextFontDatabase::defaultFont() const
{
if (defaultFontName.isEmpty()) {
QCFType<CTFontDescriptorRef> systemFont = descriptorForFontType(kCTFontUIFontSystem);
defaultFontName = QCFString(CTFontDescriptorCopyAttribute(systemFont, kCTFontFamilyNameAttribute));
}
return QFont(defaultFontName);
return QFont(*themeFont(QPlatformTheme::SystemFont));
}
bool QCoreTextFontDatabase::fontsAlwaysScalable() const

View File

@ -91,8 +91,6 @@ private:
void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString(), QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr);
static CFArrayRef fallbacksForFamily(const QString &family);
mutable QString defaultFontName;
QHash<QPlatformTheme::Font, QFont *> m_themeFonts;
QHash<QString, QList<QCFType<CTFontDescriptorRef>>> m_systemFontDescriptors;