ReactUnity / core

React and HTML framework for Unity UI & UIToolkit
https://reactunity.github.io/
MIT License
733 stars 42 forks source link

Chinese didn't render in ReactUnity canvas #87

Closed lwyj123 closed 1 year ago

lwyj123 commented 1 year ago

Problem

ReactUnity canvas can't render non-latin character like chinese image image

After checking the samples and tests I found a way to use @font-face but it doesn't work.

image

image

KurtGokhan commented 1 year ago

ReactUnity uses TextMeshPro, so your font must be converted to a font atlas. You can use Font Asset Creator of TMPro.

image

I don't know the nuances of Chinese fonts, but this should work. You may have to consult a more experienced person for this though.

The character list I used is this, but you can add more characters:

0D,20-7E,A0,F6,130-131,200B,2026,4E00-9FFF

Also you may want to change Atlas Resolution if characters seem low resolution.

Let me know if this works.

KurtGokhan commented 1 year ago

There is now a docs page for a small guide to add custom fonts. https://reactunity.github.io/learn/howto/fonts