Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: default-font-family not work #5143

Closed
heng30 opened this issue Apr 28, 2024 · 5 comments
Closed

Android: default-font-family not work #5143

heng30 opened this issue Apr 28, 2024 · 5 comments
Labels
a:platform-android Android platform integration (mO,bS) a:text Text rendering, fonts, Text input (mS,bF) needs info Further information from the reporter is requested

Comments

@heng30
Copy link

heng30 commented Apr 28, 2024

  • platform: Android
  • Android target sdk version: 32
  • language: Rust
  • slint version: v1.5.1
  • style: material
  • code snippets. It works on Linux, but not works on Android
import "./fonts/SourceHanSerifCN.ttf";

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

export component AppWindow inherits Window {
    default-font-size: Theme.default-font-size;
    default-font-family: Theme.default-font-family;
}
@hunger hunger added the a:platform-android Android platform integration (mO,bS) label May 2, 2024
@ogoffart ogoffart added a:text Text rendering, fonts, Text input (mS,bF) needs info Further information from the reporter is requested labels Jun 3, 2024
@ogoffart
Copy link
Member

ogoffart commented Jun 3, 2024

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
Copy link
Author

heng30 commented Jun 4, 2024

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
Copy link
Member

tronical commented Jun 4, 2024

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

@heng30
Copy link
Author

heng30 commented Jun 4, 2024

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

Yes

@tronical
Copy link
Member

tronical commented Jun 4, 2024

Thanks for confirming :)

@tronical tronical closed this as completed Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:platform-android Android platform integration (mO,bS) a:text Text rendering, fonts, Text input (mS,bF) needs info Further information from the reporter is requested
Projects
None yet
Development

No branches or pull requests

4 participants