slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.94k stars 568 forks source link

Android: default-font-family not work #5143

Closed heng30 closed 3 months ago

heng30 commented 4 months ago

export global Theme { in-out property default-font-size: 20px; in-out property default-font-family: "SourceHanSerifCN"; }

export component AppWindow inherits Window { default-font-size: Theme.default-font-size; default-font-family: Theme.default-font-family; }

ogoffart commented 3 months ago

Thanks for filling a bug.

default-font-family works for me on android. (I did not tried with that specific font, but I confirmed that it worked with the Plaster from the slide_puzzle demo) I can't think of any reason why it wouldn't work. Do you have more details on why it is not working? Is there any log that could be helpful to debug the issue?

heng30 commented 3 months ago

I try the Plaster font and it work fine. So I think the promble is from the font name. I use the fc-scan tool to extract the font information and find that I set the postscriptname for the slint-ui font-family . This wrong setting work fine on linux, but no for android. After I set the correct font-family, the problem has been solved.

tronical commented 3 months ago

Do I understand correctly that when using the correct font name it works for you now on Linux as well as Android?

heng30 commented 3 months ago

Do I understand correctly that when using the correct font name it works for you now on Linux as well as Android?

Yes

tronical commented 3 months ago

Thanks for confirming :)