Revert "Mac: fix bugs for font selection in QFontDialog"
This reverts commit3c09f6bc9a
. Afterfbaa6d3ca6
, 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>
This commit is contained in:
parent
55e430a3b3
commit
b619c35d85
@ -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]));
|
||||
|
||||
newFont = QFontDatabase().font(family, style, pSize);
|
||||
int hyphenPos = typeface.indexOf(QLatin1Char('-'));
|
||||
if (hyphenPos != -1) {
|
||||
typeface.remove(0, hyphenPos + 1);
|
||||
} else {
|
||||
typeface = QLatin1String("Normal");
|
||||
}
|
||||
|
||||
newFont = QFontDatabase().font(family, typeface, pSize);
|
||||
newFont.setUnderline(resolveFont.underline());
|
||||
newFont.setStrikeOut(resolveFont.strikeOut());
|
||||
|
||||
CFRelease(font);
|
||||
}
|
||||
return newFont;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user