Hello,
Our localization sample sets the fonts in the root of MainWindow.xaml:
FontFamily="./#Oxygen, ./#FontopoNIHONGO"
When specifying multiple fonts in a FontFamily, characters are rendered using the first font in the list that contains the corresponding glyph.
In this sample, when writing English/French, all latin characters can be fond inside Oxygen font. When writing Japanese, the characters are found inside FontopoNIHONGO font.
If your game wants to use different fonts for different parts of the UI you can set the FontFamily property as explained in our
Text tutorial. Is that what you need?
I've been specifying my fonts with fallbacks, like this:
<FontFamily x:Key="Font.Family.Tiller">
/Assets/UI/Fonts/#Tiller,
/Assets/UI/Fonts/#Noto Sans JP,
/Assets/UI/Fonts/#Noto Sans KR,
/Assets/UI/Fonts/#Noto Sans SC,
/Assets/UI/Fonts/#Noto Sans TC,
</FontFamily>
<FontFamily x:Key="Font.Family.Body">
/Assets/UI/Fonts/#Source Sans 3,
/Assets/UI/Fonts/#Noto Sans JP,
/Assets/UI/Fonts/#Noto Sans KR,
/Assets/UI/Fonts/#Noto Sans SC,
/Assets/UI/Fonts/#Noto Sans TC,
</FontFamily>
This has been working ok, but now I'm getting some bug reports that Chinese characters are being rendered with the Japanese or Korean font.
I hopped onto gemini and asked it what to do, and it said this:
This is a classic problem in typography and software localization known as Han Unification.
The issue is not necessarily with your fonts, but with how Unicode works. In Unicode, if a character has the same historical origin and meaning (like "Bone" 骨 or "Grass" 草), it is assigned the same Unicode code point (e.g., U+9AA8), even if it looks slightly different in Japanese, Traditional Chinese, and Simplified Chinese.
Because your XAML checks the Japanese font first, it finds U+9AA8, sees that the font supports it, and renders the Japanese style glyph. It never reaches the Chinese fonts down the list.
Is this accurate? I was hoping that I could just strip character ranges from the font, but if there are truly shared unicode characters across korean, japanese, and chinese, then that's not going to work..
What is the best way to accomplish this? Is there a way to change the precedence based on current locale of the user?
thanks,
sam