Skip to content

Instantly share code, notes, and snippets.

@mhemeryck
Created November 15, 2013 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhemeryck/7487365 to your computer and use it in GitHub Desktop.
Save mhemeryck/7487365 to your computer and use it in GitHub Desktop.
Change I04e1471d: Return the correct system font on OS X Mavericks. (https://codereview.qt-project.org/#change,62261)
From 7c4c43afb36449c9fb2d281327423df8eb916d64 Mon Sep 17 00:00:00 2001
From: Jake Petroules <jake.petroules@petroules.com>
Date: Mon, 5 Aug 2013 09:55:35 -0400
Subject: [PATCH] Return the correct system font on OS X Mavericks.
Also prints a warning if other private system fonts are encountered.
Task-number: QTBUG-32789
Change-Id: I04e1471d25119caddb587972561e98defb1ffda1
---
src/gui/kernel/qt_mac.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/gui/kernel/qt_mac.cpp b/src/gui/kernel/qt_mac.cpp
index 5d9c03e..ef0df5f 100644
--- a/src/gui/kernel/qt_mac.cpp
+++ b/src/gui/kernel/qt_mac.cpp
@@ -67,6 +67,13 @@ QFont qfontForThemeFont(ThemeFontID themeID)
#else
QCFType<CTFontRef> ctfont = CopyCTThemeFont(themeID);
QString familyName = QCFString(CTFontCopyFamilyName(ctfont));
+
+ // Fix for the new private UI font on Mavericks
+ if (familyName == QLatin1String(".Lucida Grande UI"))
+ familyName = QLatin1String("Lucida Grande");
+ else if (familyName.startsWith(QLatin1String(".")))
+ qWarning("Qt: qfontForThemeFont: encountered unknown private system font: %s", familyName.toLatin1().constData());
+
QCFType<CFDictionaryRef> dict = CTFontCopyTraits(ctfont);
CFNumberRef num = static_cast<CFNumberRef>(CFDictionaryGetValue(dict, kCTFontWeightTrait));
float fW;
--
1.8.3.4 (Apple Git-47)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment