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 9b01327 commit b67866b
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

3 comments on commit b67866b

@MikeMcQuaid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ariya Any chance of this and b70ff89 being back-ported to the 1.9 branch? It's annoyingly abrasive on 10.9 how many warnings are emitted.

@ariya
Copy link
Owner Author

@ariya ariya commented on b67866b Jan 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already in 1.9 branch: bd43603.

@MikeMcQuaid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake; seems this commit already was.

Please sign in to comment.