diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 2b9e928266..3588948133 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -615,7 +615,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo return fallbackLists[styleLookupKey.arg(styleHint)]; } -static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName = QString()) +CFArrayRef QCoreTextFontDatabase::createDescriptorArrayForFont(CTFontRef font, const QString &fileName) { CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); QCFType descriptor = CTFontCopyFontDescriptor(font); @@ -625,7 +625,7 @@ static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fi // The physical font source URL (usually a local file or Qt resource) is only required for // FreeType, when using non-system fonts, and needs some hackery to attach in a format // agreeable to OSX. - if (!fileName.isEmpty()) { + if (m_useFreeType && !fileName.isEmpty()) { QCFType fontURL; if (fileName.startsWith(QLatin1String(":/"))) { @@ -662,11 +662,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData if (cgFont) { if (CTFontManagerRegisterGraphicsFont(cgFont, &error)) { QCFType font = CTFontCreateWithGraphicsFont(cgFont, 0.0, NULL, NULL); - fonts = createDescriptorArrayForFont(font -#ifndef QT_NO_FREETYPE - , m_useFreeType ? fileName : QString() -#endif - ); + fonts = createDescriptorArrayForFont(font, fileName); m_applicationFonts.append(QVariant::fromValue(QCFType::constructFromGet(cgFont))); } } diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 3b1be2e6a1..c093d903af 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -93,6 +93,7 @@ public: private: void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString()); + CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName); #ifndef QT_NO_FREETYPE bool m_useFreeType;