Font fallback best practices?
Hi,
I am working on a project that allows users to submit content. This content can be in any language and so I want to have fallbacks for all languages that we localize to. So far this is including Russian characters, Chinese characters, and Persian to name a few. Currently I handle fallbacks like this, when the font family is set to the default.
Do I need to include these fallbacks for every font family resource definition I add? If I want to switch to a monospace font for instance, I understand that I might want a monospace font in these other languages but, for most font families I can't find equivalents. Is there a way to set fallbacks globally?
I know there's an option in Unity for loading platform fonts but, to explicitly have fallbacks like this what is the best practice?
Thanks,
David
I am working on a project that allows users to submit content. This content can be in any language and so I want to have fallbacks for all languages that we localize to. So far this is including Russian characters, Chinese characters, and Persian to name a few. Currently I handle fallbacks like this, when the font family is set to the default.
Code: Select all
<FontFamily x:Key="Font.Family.Default">
./../../Fonts/RedHat/#Red Hat Display,
./../../Fonts/NotoSans/#Noto Sans,
./../../Fonts/Rubik/#Rubik,
./../../Fonts/LXGW/#LXGW WenKai TC
</FontFamily>
I know there's an option in Unity for loading platform fonts but, to explicitly have fallbacks like this what is the best practice?
Thanks,
David
Re: Font fallback best practices?
There is a default font fallback list that can be set using Noesis.GUI.SetFontFallbacks(). However, a default setup of system fonts is already configured using that API in SetDefaultFont() in Unity (if platform fonts are enabled). I think we should allow this list to be extended in the settings panel. If you disable system fonts, you could use that API for your own purposes.
If not, your approach of setting the fallbacks in XAML (probably as a globally shared resource) at the root of the XAML is fine.
If not, your approach of setting the fallbacks in XAML (probably as a globally shared resource) at the root of the XAML is fine.
Code: Select all
<Page ... FontFamily="{StaticResource TheFont}">
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests