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

Font Fallbacks not working and Not able to load custom font either #12099

Closed
TheMulhima opened this issue Jul 8, 2023 · 5 comments
Closed

Font Fallbacks not working and Not able to load custom font either #12099

TheMulhima opened this issue Jul 8, 2023 · 5 comments
Labels

Comments

@TheMulhima
Copy link

TheMulhima commented Jul 8, 2023

Describe the bug
I'm trying to add Chinese font compatibility in my app but I'm not able to get it to work.
Initially there was a font problem and this was added which changed the default font and also add fall backs.
How it was done can be found here

https://github.com/TheMulhima/Scarab/blob/3821c180b9e838bc68e0cc8b288664e952098495/Scarab/Program.cs#L184-L213

However, if the user doesn't have the primary font installed, the app just crashes instead of trying a fall back font which does exist.

See TheMulhima/Lumafly#53

This is one of the issues I'm having with fonts

The other issue is I tried to add Noto Sans SC as a embedded font in my app (and set it as the primary font family) but whenever I open the app I get the error could not create glyph Typeface. I added the font as avalonia resource and in the configure fonts extension on app builder I added the font but it doesn't work. The code trying to add that is here
TheMulhima/Lumafly@ec4c6cd

Fixing either one of these issues would fix the underlying problem that is Chinese font isn't working. Thanks

Expected behavior

  • Specifying fallback fonts would use the fallback fonts when primary font is not found.
  • Embedding the primary font in the app similar to how Avalonia.Fonts.Inter does it should help resolve the couldn't create the Glyph Typeface error

Desktop (please complete the following information):

  • OS: Windows 11
  • Version 11.0.0.rc-2.2
@TheMulhima TheMulhima added the bug label Jul 8, 2023
@TheMulhima TheMulhima changed the title Custom Fonts, and Font Fallbacks Font Fallbacks not working and Not able to load custom font either Jul 8, 2023
@Gillibald
Copy link
Contributor

Where do you reference fonts:Noto Sans SC?

@TheMulhima
Copy link
Author

TheMulhima commented Jul 8, 2023

After the builder is created, I call this function if the current culture is Chinese. Which then sets the font family to this (whose primary font is noto sans SC) using this code

I hope that makes sense

Should I be using a different way to set default font?

@Gillibald
Copy link
Contributor

FontFamily="fonts:Noto Sans SC#Noto Sans SC"

@TheMulhima
Copy link
Author

TheMulhima commented Jul 8, 2023

I'm sorry I'm not sure where to put that. Should that be added as a replacement to this or put that here or put it in the embedded font collection Uri or somewhere else?

@TheMulhima
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants