CJK Font Rendering Issues on Mac


#1

JUCE 5.3.2 + High Sierra here.
In a previous post I reported a Windows-specific bug where some CJK glyphs are not displayed when using a memory-loaded custom font. Having fixed that bug, I’m now working on a Mac port but it seems like the entire font rendering system is broken on CJK languages.
I am aware of bugs related to memory-based fonts on Mac, such as,



So I avoided any custom font and tested the program with a pre-installed pan-CJK font. Mac has this thing called Arial Unicode MS and also I installed Noto Sans CJK JP. These are known to work well on Linux and Windows. But on Mac, all except ASCII characters turn into mojibakes (although interestingly some tabs and titles are fine).
26%20PM
Not actually an Apple developer, I have little idea of how this is internally done (when it goes to the APIs). As for the JUCE part, I guess the titles and other texts are wrapped through different classes. There should be a way to fix this, although I’m quite lost right now and need some guidance to get started.
There also had been quite a few similar discussions on this forum but some are just too old that I’m not sure if they are still relevant.

(update)
It appears that only font displays using TextLayout work; all drawText calls result in mojibakes. Is it possible to hack the library so drawText can be implemented through TextLayout?


#2

Okay. Mystery solved. I loaded the fonts in another thread while the splash screen is shown. Although the main window isn’t created until the splash screen loading thread finishes, somehow this resulted in the default font being set only for part of the components. So this is a multithreading issue. Though on Linux and Windows it appears totally fine so far.