diff options
author | Liang Qi <liang.qi@digia.com> | 2014-04-28 11:45:44 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-28 19:52:11 +0200 |
commit | b619c35d8507eee3ad9b456128f811b561513727 (patch) | |
tree | e6eb81d7080bea40acf090f544fa842a8511f12e /src | |
parent | 55e430a3b3f4f225da6b7192773f082b5411741b (diff) |
Revert "Mac: fix bugs for font selection in QFontDialog"
This reverts commit 3c09f6bc9aee0c97427fe8da6efdc73b4ac473aa.
After fbaa6d3ca6fc2693c5c8a1cd8e565803adc97730, OS X/iOS no longer
uses localized font names.
Task-number: QTBUG-38548
Conflicts:
src/gui/text/qfontdatabase.cpp
Change-Id: Id7f7e1976e4ffc30c5c18cf57e2acb3aebafc301
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index dc22da0983..a18f721e04 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -92,16 +92,20 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) QFont newFont; if (cocoaFont) { int pSize = qRound([cocoaFont pointSize]); - CTFontDescriptorRef font = CTFontCopyFontDescriptor((CTFontRef)cocoaFont); - // QCoreTextFontDatabase::populateFontDatabase() is using localized names - QString family = QCFString::toQString((CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontFamilyNameAttribute, NULL)); - QString style = QCFString::toQString((CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontStyleNameAttribute, NULL)); + QString family(QCFString::toQString([cocoaFont familyName])); + QString typeface(QCFString::toQString([cocoaFont fontName])); + + int hyphenPos = typeface.indexOf(QLatin1Char('-')); + if (hyphenPos != -1) { + typeface.remove(0, hyphenPos + 1); + } else { + typeface = QLatin1String("Normal"); + } - newFont = QFontDatabase().font(family, style, pSize); + newFont = QFontDatabase().font(family, typeface, pSize); newFont.setUnderline(resolveFont.underline()); newFont.setStrikeOut(resolveFont.strikeOut()); - CFRelease(font); } return newFont; } |