From fbaa6d3ca6fc2693c5c8a1cd8e565803adc97730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 10 Mar 2014 15:03:36 +0100 Subject: Don't populate font families using localized family names on OS X/iOS The font database and QFont should have normalized font family names, so using CTFontDescriptorCopyLocalizedAttribute is not a good idea. If the feature of reporting the localized name of a font family or style is needed in for example the font selection dropdown or dialog, it should be exposed as an explicit property of the font. Change-Id: Iaa15ad861043f4c78a38080608b6fe4d99efee18 Reviewed-by: Simon Hausmann --- src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 0301c2e5a1..afee68ebed 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -204,8 +204,8 @@ void QCoreTextFontDatabase::populateFontDatabase() void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) { QString foundryName = QStringLiteral("CoreText"); - QCFString familyName = (CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontFamilyNameAttribute, NULL); - QCFString styleName = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute(font, kCTFontStyleNameAttribute, NULL); + QCFString familyName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); + QCFString styleName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute); QCFType styles = (CFDictionaryRef) CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute); QFont::Weight weight = QFont::Normal; QFont::Style style = QFont::StyleNormal; @@ -350,7 +350,7 @@ QFont::StyleHint styleHintFromNSString(NSString *style) static QString familyNameFromPostScriptName(NSString *psName) { QCFType fontDescriptor = (CTFontDescriptorRef) CTFontDescriptorCreateWithNameAndSize((CFStringRef)psName, 12.0); - QCFString familyName = (CFStringRef) CTFontDescriptorCopyLocalizedAttribute(fontDescriptor, kCTFontFamilyNameAttribute, 0); + QCFString familyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute); QString name = QCFString::toQString(familyName); if (name.isEmpty()) qWarning() << "QCoreTextFontDatabase: Failed to resolve family name for PostScript name " << QCFString::toQString((CFStringRef)psName); @@ -390,7 +390,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo const int numCascades = CFArrayGetCount(cascadeList); for (int i = 0; i < numCascades; ++i) { CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i); - QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyLocalizedAttribute(fontFallback, kCTFontFamilyNameAttribute, NULL); + QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute); fallbackList.append(QCFString::toQString(fallbackFamilyName)); } fallbackLists[family] = fallbackList; @@ -564,7 +564,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData for (int i = 0; i < numFonts; ++i) { CTFontDescriptorRef fontDescriptor = CTFontDescriptorRef(CFArrayGetValueAtIndex(fonts, i)); populateFromDescriptor(fontDescriptor); - QCFType familyName = CFStringRef(CTFontDescriptorCopyLocalizedAttribute(fontDescriptor, kCTFontFamilyNameAttribute, NULL)); + QCFType familyName = CFStringRef(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute)); families.append(QCFString(familyName)); } } -- cgit v1.2.3