Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Fix CoreText performance note on OS X 10.9 (Mavericks).
Browse files Browse the repository at this point in the history
  • Loading branch information
ariya committed Jan 4, 2014
1 parent 7468e38 commit bd43603
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/qt/src/gui/text/qfont.cpp
Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions src/qt/src/gui/text/qfontdatabase_mac.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit bd43603

Please sign in to comment.