diff --git a/src/gui/text/coretext/qcoretextfontdatabase.mm b/src/gui/text/coretext/qcoretextfontdatabase.mm index d17d1bb7018..70d405fc7b0 100644 --- a/src/gui/text/coretext/qcoretextfontdatabase.mm +++ b/src/gui/text/coretext/qcoretextfontdatabase.mm @@ -79,7 +79,7 @@ QCoreTextFontDatabase::QCoreTextFontDatabase() #if defined(Q_OS_MACOS) m_fontSetObserver = QMacNotificationObserver(nil, NSFontSetChangedNotification, [] { qCDebug(lcQpaFonts) << "Fonts have changed"; - handleAvailableFontsChanged(); + QPlatformFontDatabase::repopulateFontDatabase(); }); #endif } diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index eb54a4e5cb1..8fcdfc59882 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -600,13 +600,19 @@ void QPlatformFontDatabase::registerAliasToFontFamily(const QString &familyName, } /*! - Inform the Qt font database that the platform's available fonts have changed. + Requests that the platform font database should be repopulated. This will result in invalidating the entire font database. + The next time the font database is accessed it will be repopulated + via a call to QPlatformFontDatabase::populate(). + + Application fonts will not be removed, and will be automatically + populated when the font database is repopulated. + \since 6.4 */ -void QPlatformFontDatabase::handleAvailableFontsChanged() +void QPlatformFontDatabase::repopulateFontDatabase() { QFontDatabasePrivate::instance()->invalidate(); } diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h index ffb32d701cd..33828596729 100644 --- a/src/gui/text/qplatformfontdatabase.h +++ b/src/gui/text/qplatformfontdatabase.h @@ -103,7 +103,7 @@ public: static void registerFontFamily(const QString &familyName); static void registerAliasToFontFamily(const QString &familyName, const QString &alias); - static void handleAvailableFontsChanged(); + static void repopulateFontDatabase(); static bool isFamilyPopulated(const QString &familyName); }; diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm index 390ca2e351f..02143bd7a23 100644 --- a/src/plugins/platforms/ios/qiostheme.mm +++ b/src/plugins/platforms/ios/qiostheme.mm @@ -34,7 +34,7 @@ QIOSTheme::QIOSTheme() m_contentSizeCategoryObserver = QMacNotificationObserver(nil, UIContentSizeCategoryDidChangeNotification, [] { qCDebug(lcQpaFonts) << "Contents size category changed to" << UIApplication.sharedApplication.preferredContentSizeCategory; - QPlatformFontDatabase::handleAvailableFontsChanged(); + QPlatformFontDatabase::repopulateFontDatabase(); }); }