Thursday, 29 August 2019

Use Apple's Japanese System font for Japanese text

I'm trying to design an interface for a Japanese iOS app using Interface Builder.

Since I need to use Japanese text for the labels and other UI elements, a Japanese font must be used. In the case of iOS, the provided Japanese font is Hiragino Sans.

Using the system font for iOS interfaces simplifies a lot of stuff. You can use, for instance, TextStyles, which will handle all the Dynamic Type and other accessibility features such as Bold Text automatically for you. The code needed to fully support these features using a custom font, even if it's included in the system like Hiragino, is not trivial (but it can be done if there's no alternative).

Thankfully, UIKit is smart and automatically uses Hiragino Sans for Japanese characters on labels and other elements.

However, this automatic replacement apparently occurs on a per-character basis instead of on the whole UILabel / element.

You can notice this in the following screenshots. There are two labels, the first using the System Font, and the second one explicitly using Hiragino. The first screenshot is from Interface Builder, where San Francisco is used even for the Japanese characters. The second screenshot is from the simulator, which replaces the system font's Japanese characters with hiragino. You can notice these subtle changes especially in the following characters: ※, 角, ロ, and the latin text for Hiragino.

First screenshot, from Interface Builder Second screenshot, from the Simulator

What I would like to know is whether setting the System font and forgetting about these details is how I'm supposed to design the interface, and the expected behavior for Japanese users, or whether I should try to use Hiragino on the whole UI element. (I'm leaning towards this second option here, especially because of how the ※ character is handled).

In this second case, is there something I'm missing where I can tell UIKit that all my UI elements should use Hiragino even for the non-Japanese characters? Is there a way to tell it to just use Hiragino when a system font is concerned? Or is setting Hiragino explicitly the only option here, with all the extra code using a custom font entails in order to support dynamic type and other accessibility features?

Thanks!



from Use Apple's Japanese System font for Japanese text

No comments:

Post a Comment