From 1ff2793122788adfbeb658a4a43f6667db6508ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 24 Mar 2022 13:18:17 +0100 Subject: [PATCH] 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 --- src/gui/text/coretext/qcoretextfontdatabase.mm | 7 +------ src/gui/text/coretext/qcoretextfontdatabase_p.h | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/gui/text/coretext/qcoretextfontdatabase.mm b/src/gui/text/coretext/qcoretextfontdatabase.mm index 8665faca83..fe7500b7f8 100644 --- a/src/gui/text/coretext/qcoretextfontdatabase.mm +++ b/src/gui/text/coretext/qcoretextfontdatabase.mm @@ -863,12 +863,7 @@ QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const QFont QCoreTextFontDatabase::defaultFont() const { - if (defaultFontName.isEmpty()) { - QCFType systemFont = descriptorForFontType(kCTFontUIFontSystem); - defaultFontName = QCFString(CTFontDescriptorCopyAttribute(systemFont, kCTFontFamilyNameAttribute)); - } - - return QFont(defaultFontName); + return QFont(*themeFont(QPlatformTheme::SystemFont)); } bool QCoreTextFontDatabase::fontsAlwaysScalable() const diff --git a/src/gui/text/coretext/qcoretextfontdatabase_p.h b/src/gui/text/coretext/qcoretextfontdatabase_p.h index 12f55bd8ad..4e847dc32f 100644 --- a/src/gui/text/coretext/qcoretextfontdatabase_p.h +++ b/src/gui/text/coretext/qcoretextfontdatabase_p.h @@ -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 m_themeFonts; QHash>> m_systemFontDescriptors;