diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2014-08-06 15:06:40 -0400 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-08-21 17:35:31 +0200 |
commit | f62031b895a6e4fdc0a39f5f2fd9af03f2f23c69 (patch) | |
tree | 425960cb336da0090ec1253a0b5617e93ae280a7 | |
parent | bba01750226745d6666d587cabe57c321fde0875 (diff) |
qt: fix unicode character display on osx when building with 10.7 sdk
Conflicts:
src/qt/bitcoin.cpp
Rebased-From: 292cc072
-rw-r--r-- | doc/release-notes.md | 1 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 3 | ||||
-rw-r--r-- | src/qt/guiutil.cpp | 27 | ||||
-rw-r--r-- | src/qt/guiutil.h | 4 |
4 files changed, 35 insertions, 0 deletions
diff --git a/doc/release-notes.md b/doc/release-notes.md index 8f76b2d3a4..be9c7d5ae7 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -61,6 +61,7 @@ Wallet: GUI: - fix 'opens in testnet mode when presented with a BIP-72 link with no fallback' - AvailableCoins: acquire cs_main mutex +- Fix unicode character display on MacOSX Miscellaneous: - key.cpp: fail with a friendlier message on missing ssl EC support diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 45d7a52889..08fe3e71dc 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -475,6 +475,9 @@ int main(int argc, char *argv[]) #endif Q_INIT_RESOURCE(bitcoin); + + GUIUtil::SubstituteFonts(); + BitcoinApplication app(argc, argv); #if QT_VERSION > 0x050100 // Generate high-dpi pixmaps diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 183fcac4a0..004befe3cc 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -61,6 +61,13 @@ static boost::filesystem::detail::utf8_codecvt_facet utf8; #endif +#if defined(Q_OS_MAC) +extern double NSAppKitVersionNumber; +#if !defined(NSAppKitVersionNumber10_9) +#define NSAppKitVersionNumber10_9 1265 +#endif +#endif + namespace GUIUtil { QString dateTimeStr(const QDateTime &date) @@ -372,6 +379,26 @@ ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *pa } +void SubstituteFonts() +{ +#if defined(Q_OS_MAC) +// Background: +// OSX's default font changed in 10.9 and QT is unable to find it with its +// usual fallback methods when building against the 10.7 sdk or lower. +// The 10.8 SDK added a function to let it find the correct fallback font. +// If this fallback is not properly loaded, some characters may fail to +// render correctly. +// +// 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"); +#endif +#endif +} + bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt) { if(evt->type() == QEvent::ToolTipChange) diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 4f9416d1af..847633a752 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -106,6 +106,10 @@ namespace GUIUtil representation if needed. This assures that Qt can word-wrap long tooltip messages. Tooltips longer than the provided size threshold (in characters) are wrapped. */ + + // Replace invalid default fonts with known good ones + void SubstituteFonts(); + class ToolTipToRichTextFilter : public QObject { Q_OBJECT |