Ariya Hidayat 2014-01-03 18:38:33 -08:00
parent 9b0132712b
commit b67866b612
2 changed files with 10 additions and 2 deletions

View File

@ -1968,6 +1968,8 @@ static void initFontSubst()
"times new roman", "times",
"courier new", "courier",
"sans serif", "helvetica",
#elif defined(Q_WS_MAC)
".lucida grande ui", "lucida grande",
#elif defined(Q_WS_WIN)
"times", "times new roman",
"courier", "courier new",

View File

@ -325,9 +325,15 @@ static QFontEngine *loadFromDatabase(QFontDef &req, const QFontPrivate *d)
for (int i = 0; i < family_list.size(); ++i) {
for (int k = 0; k < db->count; ++k) {
if (db->families[k]->name.compare(family_list.at(i), Qt::CaseInsensitive) == 0) {
QByteArray family_name = db->families[k]->name.toUtf8();
#if defined(QT_MAC_USE_COCOA)
QCFType<CTFontRef> ctFont = CTFontCreateWithName(QCFString(db->families[k]->name), 12, NULL);
CFStringRef familyName = QCFString::toCFStringRef(db->families[k]->name);
QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithAttributes(
QCFType<CFDictionaryRef>(CFDictionaryCreate(kCFAllocatorDefault,
(const void**)&kCTFontFamilyNameAttribute,
(const void**)&familyName, 1,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)));
CFRelease(familyName);
QCFType<CTFontRef> ctFont = CTFontCreateWithFontDescriptor(descriptor, 0, NULL);
if (ctFont) {
fontName = CTFontCopyFullName(ctFont);
goto found;