haxeui / haxeui-openfl

The OpenFL backend of the HaxeUI framework -
http://haxeui.org
MIT License
42 stars 14 forks source link

Chinese characters cannot be displayed by default on windows #67

Closed tabris17 closed 6 months ago

tabris17 commented 6 months ago

system: Chinese windows 10 haxe: [4.3.3] openfl: [9.3.2] haxeui-core: [1.6.0] haxeui-openfl: [1.6.0]

It seems that the app cannot use the system's Chinese font to render Chinese characters. if I use NME backend, the same code can display Chinese characters correctly.

If I package a Chinese font in my app and specify to use that font, the Chinese characters can be displayed correctly

<assets path="assets/fonts" rename="fonts" />

<style>
    .button {
        font-size: 12px;
        font-name: "fonts/a-chinese-font.otf";
    }
</style>
tabris17 commented 6 months ago

using the system Chinese font on Windows with the following code

openfl.text.Font.registerFont(openfl.text.Font.fromFile(lime.system.System.fontsDirectory + "\\simhei.ttf"));
<style>
.button { font-name: SimHei; }
</style>

But there are still a few issues that remain unresolved: