qt: fix broken unicode chars on osx 10.10 #5671

pull theuni wants to merge 3 commits into bitcoin:master from theuni:qt-font-fix changing 4 files +41 −15
  1. theuni commented at 10:55 PM on January 15, 2015: member

    Fixes #5657 and likely #5165.

    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/

  2. theuni commented at 3:19 AM on January 16, 2015: member

    Unfortunately this doesn't fix #5165. I spent most of the day chasing my tail on this and got nowhere. Unless someone else is interested in looking into this, we have 2 options for 0.10: busted Chinese for Yosemite, or building against the 10.8 sdk.

  3. jonasschnelli commented at 5:22 AM on January 16, 2015: contributor

    Will test this. Can I just gbuid master?

    Busted Chinese on Yosemite 10.10 sounds more sane than switching to 10.8 in rc4 IMO.

  4. theuni commented at 5:26 AM on January 16, 2015: member

    Uploading a binary, 2min.

  5. theuni commented at 5:35 AM on January 16, 2015: member
  6. jonasschnelli commented at 5:55 AM on January 16, 2015: contributor

    Tested. Fixes #5657 but leaves #5165 open.

    The problem of #5165 is, that the 'Lucia Grande' font does not support Chinese characters. We now substituting the system font by a non-Chinese-capable font.

    I think a quick fix could be to check within the 10.10 'if structur' if the users language is zh_CN (maybe there are others?) then substitute the font to "Henti TC" (OS X standard font for Chinese). A one or two-liner with low risks (only Chinese 10.10 users will see the change). Easy, sane, effective IMO.

  7. theuni commented at 6:06 AM on January 16, 2015: member

    @jonasschnelli I wasn't sure if we could do that, but since we require a restart to change fonts, that sounds good to me.

    It seems that all cjk fonts are broken in 10.10 due to the new aliasing system. Hard-coding for those 3 indeed sounds like a reasonable hack for 0.10.

  8. laanwj added the label GUI on Jan 16, 2015
  9. laanwj commented at 9:37 AM on January 16, 2015: member

    If #5165 only affects Chinese, then this + a Chinese-specific workaround for 0.10 is great. I hope other languages with non-latin characters aren't affected, tracking down the font for each locale would be a crazy scavenger hunt (just what unicode was supposed to fix in the first place :( ).

    And indeed, for master we shouldnt bother with this and switch the build SDK.

  10. laanwj added this to the milestone 0.10.0 on Jan 16, 2015
  11. jonasschnelli commented at 9:56 AM on January 16, 2015: contributor

    The current substitute font 'Lucida Grand' on osx 10.10 has only support for Greek, Hebrew, Cyrillic, Latin.

    So in general we should consider not giving substitutes for fonts because i assume the OS will care about switching fonts within a textflow or support extra fonts with mixed charsets.

    Currently the 'Lucida Grand' font has no support for: Hiragana, Birman, Arabic, Hangul, Thai, Traditional Chinese, Simple Chinese, Singhalen, Yi (maybe more) Do we support a language with one of these font script?

    ACK on this change to fix #5165 but longterm we should update to 10.8 as build os and remove font substitution.

    bildschirmfoto 2015-01-16 um 10 47 39

  12. theuni force-pushed on Jan 16, 2015
  13. qt: fonts: allow SubstituteFonts to filter based on user's language
    SubstituteFonts() has been moved to after app identification so that QSettings
    are accessible.
    f5ad78b34a
  14. theuni commented at 9:28 PM on January 16, 2015: member

    Well that took quite a bit of trial+error, but all good now. Fixes #5165. It's not optimal... Chinese font-names don't show in English (when you're in English and going to select Chinese/Japanese from the menu, those characters are blocks). After switching it works fine though.

    The last commit avoids the hard-coded use of Arial, which does not always work correctly with Chinese. Seems sane to me, but I'm not sure if there was a specific reason for its use.

    The substitutions are all wrapped up in ifdefs, so they're safe for master now and in the future. The only functional change for master (after we bump the sdk to 10.8) is the Arial change.

    Test binary here: https://bitcoincore.org/cfields/bitcoin-qt-10.6_quickfix3-437de97c As far as I'm concerned, ready for merge/backport.

  15. theuni commented at 9:33 PM on January 16, 2015: member

    If it wasn't clear, the Arial change wasn't arbitrary... the splash is all boxes in Chinese otherwise.

  16. in src/qt/guiutil.cpp:None in 437de97c3c outdated
     415 | +            if (language == "zh_CN" || language == "zh_TW" || language == "zh_HK") // traditional or simplified Chinese
     416 | +              QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Heiti SC");
     417 | +            else if (language == "ja") // Japanesee
     418 | +              QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Songti SC");
     419 | +            else
     420 | +              QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Helvetica");
    


    jonasschnelli commented at 7:47 AM on January 17, 2015:

    Why we substitute the default Font with Helvetica? Looks good but leads to new problems (see other comment).

    bildschirmfoto-2015-01-17-um-08 45 03

  17. jonasschnelli commented at 7:56 AM on January 17, 2015: contributor

    Still issues (see screens below). I would even say it's more broken then before this pull (with all respect of your highly a valued work).

    I only see one direction: -> build against 10.8 with a -min of 10.6. Im pretty sure QT won't use any methods not available in 10.6. The native osx implementation within the #ifdefs are sane because i did the most and i did always check during runtime if a method is available before calling it. Of course it's a hard admission in rc3 to change the building framework. But IMO it should be sane. I could also offer extensive testing in 10.6, 10.7, 10.8, 10.9 and 10.10.

    zh_CH: bildschirmfoto-2015-01-17-um-08 40 05

    de_DE: bildschirmfoto-2015-01-17-um-08 42 29

    ja: bildschirmfoto 2015-01-17 um 08 50 05

    Font mix in de_DE: bildschirmfoto 2015-01-17 um 08 40 41

  18. 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.
    52954e6efd
  19. qt: avoid hard-coding font names
    They may not contain all necessary characters for a language
    73cd4edb4f
  20. theuni force-pushed on Jan 17, 2015
  21. jonasschnelli commented at 8:39 AM on January 17, 2015: contributor

    Tested ACK. Still have minor issues in CN/JA. This will be fixed in the next release when we might upgrade to 10.9 as build os.

    Screens: bildschirmfoto 2015-01-17 um 09 36 19

    bildschirmfoto 2015-01-17 um 09 36 31

    bildschirmfoto 2015-01-17 um 09 36 34

    bildschirmfoto 2015-01-17 um 09 36 42

    bildschirmfoto 2015-01-17 um 09 36 53

    bildschirmfoto 2015-01-17 um 09 36 56

    bildschirmfoto 2015-01-17 um 09 37 06

    bildschirmfoto 2015-01-17 um 09 37 08

  22. theuni commented at 8:39 AM on January 17, 2015: member

    After some discussion on IRC, I believe @jonasschnelli and I have reached a compromise here. German is fixed up now, and Chinese and Japanese work with the exception of a few artifacts. We're willing to accept that for 0.10, with the understanding that they'll be fixed in the future by the bumped sdk.

  23. laanwj merged this on Jan 19, 2015
  24. laanwj closed this on Jan 19, 2015

  25. laanwj referenced this in commit e1aecae33a on Jan 19, 2015
  26. laanwj referenced this in commit 58259ad1ed on Jan 19, 2015
  27. laanwj commented at 11:38 AM on January 19, 2015: member

    Cherry-picked to 0.10 branch as 58259ad1edf14a4f514fe5f837ac7d1d99b58422

  28. wtogami referenced this in commit 09ca5a4eaf on Jan 23, 2015
  29. reddink referenced this in commit 60d7d8ad7a on May 27, 2020
  30. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me