mitsuba-renderer / nanogui

Minimalistic C++/Python GUI library for OpenGL, GLES2/3, Metal, and WebAssembly/WebGL
Other
1.56k stars 196 forks source link

How can I let nanogui support Chinese characters? #162

Open jhyvictory opened 6 months ago

jhyvictory commented 6 months ago

I changed the button's text to Chinese characters, such as "按钮". However the button appeared with no characters on it. Then I copied some font ttf files to the the resource folder of nanogui, rebuilt it, the button still had no characters on it. How can I let nanogui support Chinese characters?

jhyvictory commented 6 months ago

Seem no one cares about what is happening here. I inherit the Theme class to MyTheme, and read a new font file through nvgCreateFont function. Then apply MyTheme to the Window. Finally I can show a label with Chinese font by defining it with the font parameter. However, other widgets like Button don't have that parameter and the font used is fixed in code of drawing a button. I changed the fixed font of drawing a button while I really dont want to. It seems that nanogui cannot support Chinese font in a pretty way without reproduce its code...a pity! image