- extsmichalak
- Posts: 23
- Joined:
Font Fallbacks limits / mix of different characters
Hey!
In our project we are registering font fallbacks by using "Noesis::GUI::SetFontFallbacks". We have some cases when text can have a mixture of characters from different languages, e.g. to support displaying Xbox Modern Gamertag (https://learn.microsoft.com/en-us/gamin ... s/xr/xr046):
- สริฐ众云нь컴퓨터
- आचुथाώঅঙぁゖァヺ
- нøÜsêþåЯЂў
Whenever we add a new font to support e.g. Bengali or Devanagari (using e.g. Noto Sans from Google Fonts: https://fonts.google.com/noto/specimen/ ... ns+Bengali), the order of the fallbacks seem to matter and we cannot get all of character working at the same time (i.e. either สริฐ or आचुथा is displayed correctly). Do you have any hints how to overcome this? Have you encountered such issue before?
At first I thought that maybe Noto Sans variants have the same font family name, which SystemFontProvider would just ignore, but they all have unique one.
Thanks,
Szymon
In our project we are registering font fallbacks by using "Noesis::GUI::SetFontFallbacks". We have some cases when text can have a mixture of characters from different languages, e.g. to support displaying Xbox Modern Gamertag (https://learn.microsoft.com/en-us/gamin ... s/xr/xr046):
- สริฐ众云нь컴퓨터
- आचुथाώঅঙぁゖァヺ
- нøÜsêþåЯЂў
Whenever we add a new font to support e.g. Bengali or Devanagari (using e.g. Noto Sans from Google Fonts: https://fonts.google.com/noto/specimen/ ... ns+Bengali), the order of the fallbacks seem to matter and we cannot get all of character working at the same time (i.e. either สริฐ or आचुथा is displayed correctly). Do you have any hints how to overcome this? Have you encountered such issue before?
At first I thought that maybe Noto Sans variants have the same font family name, which SystemFontProvider would just ignore, but they all have unique one.
Thanks,
Szymon
Re: Font Fallbacks limits / mix of different characters
Glyphs are searched through the list of fonts (both those specified in XAML and fallback fonts added via code) in the order they are listed. The first font that provides the glyph will be used, which can cause issues when font ranges overlap. There is an existing ticket on this issue (#2380), which suggests implementing CompositeFont as a potential solution. Additionally, we could consider adding an extra parameter to Noesis::GUI::SetFontFallbacks to specify a set of character ranges.Do you have any hints how to overcome this? Have you encountered such issue before?
As a workaround, you can edit the font to remove any unnecessary ranges.
Please let me know your thoughts on this approach.
- extsmichalak
- Posts: 23
- Joined:
Re: Font Fallbacks limits / mix of different characters
Thank you for that hint @jsantos! I decided to merge those font variants into one font file as they were from the same font family.
Re: Font Fallbacks limits / mix of different characters
Glad to know that worked for you! :)
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 14 guests