summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiostheme.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/ios/qiostheme.mm')
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm
index e7093185aa..e51e97bd5a 100644
--- a/src/plugins/platforms/ios/qiostheme.mm
+++ b/src/plugins/platforms/ios/qiostheme.mm
@@ -46,6 +46,10 @@
#include <QtGui/QFont>
+#include <QtPlatformSupport/private/qcoretextfontdatabase_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+
#include <UIKit/UIFont.h>
#include <UIKit/UIInterface.h>
@@ -75,19 +79,8 @@ QVariant QIOSTheme::themeHint(ThemeHint hint) const
const QFont *QIOSTheme::font(Font type) const
{
if (m_fonts.isEmpty()) {
- // The real system font on iOS is '.Helvetica Neue UI', as returned by both [UIFont systemFontOfSize]
- // and CTFontCreateUIFontForLanguage(kCTFontSystemFontType, ...), but this font is not included when
- // populating the available fonts in QCoreTextFontDatabase::populateFontDatabase(), since the font
- // is internal to iOS and not supposed to be used by applications. We could potentially add this
- // font to the font-database, but it would then show up when enumerating user fonts from Qt
- // applications since we don't have a flag in Qt to mark a font as a private system font.
- // For now we hard-code the font to Helvetica, which should be very close to the actual
- // system font.
- QLatin1String systemFontFamilyName("Helvetica");
- m_fonts.insert(QPlatformTheme::SystemFont, new QFont(systemFontFamilyName, [UIFont systemFontSize]));
- m_fonts.insert(QPlatformTheme::SmallFont, new QFont(systemFontFamilyName, [UIFont smallSystemFontSize]));
- m_fonts.insert(QPlatformTheme::LabelFont, new QFont(systemFontFamilyName, [UIFont labelFontSize]));
- m_fonts.insert(QPlatformTheme::PushButtonFont, new QFont(systemFontFamilyName, [UIFont buttonFontSize]));
+ QCoreTextFontDatabase *ctfd = static_cast<QCoreTextFontDatabase *>(QGuiApplicationPrivate::platformIntegration()->fontDatabase());
+ m_fonts = ctfd->themeFonts();
}
return m_fonts.value(type, 0);