aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2015-01-14 15:26:40 -0500
committerCory Fields <cory-nospam-@coryfields.com>2015-01-17 03:31:27 -0500
commit52954e6efd373c14736237c4c79769bf00f5dfb8 (patch)
tree20e9b71b88bb85c2c223a17dcc83da5b688fe710
parentf5ad78b34af8f50e12fab63b331768b96ec2c779 (diff)
qt: fix broken unicode chars on osx 10.10
The default font changed again. The real fix is to compile qt against a >= 10.8 sdk, but this is simple enough to backport to 0.10 to avoid having to do that there. Note: NSAppKitVersionNumber is a double and there's no official value for NSAppKitVersionNumber10_10. Since == isn't reliable for doubles, use Apple's guidelines for testing versions here: https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKit/ Chinese and Japanese fonts have been hard-coded as well, otherwise they fail to show up at all.
-rw-r--r--src/qt/guiutil.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index b57025857e..8ad9b30624 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -67,6 +67,9 @@ static boost::filesystem::detail::utf8_codecvt_facet utf8;
#if defined(Q_OS_MAC)
extern double NSAppKitVersionNumber;
+#if !defined(NSAppKitVersionNumber10_8)
+#define NSAppKitVersionNumber10_8 1187
+#endif
#if !defined(NSAppKitVersionNumber10_9)
#define NSAppKitVersionNumber10_9 1265
#endif
@@ -393,12 +396,28 @@ void SubstituteFonts(const QString& language)
// If this fallback is not properly loaded, some characters may fail to
// render correctly.
//
+// The same thing happened with 10.10. .Helvetica Neue DeskInterface is now default.
+//
// Solution: If building with the 10.7 SDK or lower and the user's platform
// is 10.9 or higher at runtime, substitute the correct font. This needs to
// happen before the QApplication is created.
#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
- if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_9)
- QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
+ if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_8)
+ {
+ if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_9)
+ /* On a 10.9 - 10.9.x system */
+ QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
+ else
+ {
+ /* 10.10 or later system */
+ if (language == "zh_CN" || language == "zh_TW" || language == "zh_HK") // traditional or simplified Chinese
+ QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Heiti SC");
+ else if (language == "ja") // Japanesee
+ QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Songti SC");
+ else
+ QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Lucida Grande");
+ }
+ }
#endif
#endif
}