extsmichalak
Topic Author
Posts: 23
Joined: 08 Feb 2021, 19:55

Font Fallbacks limits / mix of different characters

08 Aug 2024, 18:25

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
 
User avatar
jsantos
Site Admin
Posts: 4063
Joined: 20 Jan 2012, 17:18
Contact:

Re: Font Fallbacks limits / mix of different characters

09 Aug 2024, 10:55

Do you have any hints how to overcome this? Have you encountered such issue before?
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.

As a workaround, you can edit the font to remove any unnecessary ranges.

Please let me know your thoughts on this approach.
 
extsmichalak
Topic Author
Posts: 23
Joined: 08 Feb 2021, 19:55

Re: Font Fallbacks limits / mix of different characters

09 Aug 2024, 16:14

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.
 
User avatar
jsantos
Site Admin
Posts: 4063
Joined: 20 Jan 2012, 17:18
Contact:

Re: Font Fallbacks limits / mix of different characters

09 Aug 2024, 18:08

Glad to know that worked for you! :)

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 14 guests