AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.16k stars 2.27k forks source link

Character lookup anomalies caused by font ordering #17168

Open kerams opened 2 months ago

kerams commented 2 months ago

Describe the bug

Try to render kğżȯgda in a TextBlock using combinations of Noto Sans Hebrew and Open Sans.

Noto Sans Hebrew does not contain Latin characters, so kğż are looked up in the Open Sans fallback. However, ȯ (a precomposed character rather than o with a combining dot) does not exist in Open Sans either, so it should use system font fallback, or be interpreted as o with a combining dot, which Open Sans can handle.

On Android

qemu-system-x86_64_v7lLZiIQvh

On Windows

ConsoleApp1_TWiBO1CZVZ

To Reproduce

https://github.com/kerams/font3, run TstFs.Android in emulator, ConsoleApp1 is the desktop version.

Expected behavior

The first 2 lines should be rendered in their entirety with Open Sans.

Avalonia version

11.2.999-cibuild0051894-alpha

OS

Windows, Android

Additional context

No response

Gillibald commented 2 months ago

The text is shaped with [OpenSans|Default|OpenSans] because OpenSans isn't mapping any glyph to ȯ I don't see any issue here.

kerams commented 2 months ago

That's just one of 3 different issues described

Gillibald commented 2 months ago

You specify a fallback sequence for the first two and the first matching font is used. Why should the result any different when the only font that has a matching glyph is OpenSans?

kerams commented 2 months ago

That's exactly my question. Why does the result change with different ordering? Not only that, why is the behavior not consistent between Android and Windows?

Gillibald commented 2 months ago

I do not see any differences on Windows we might need to add a unit test

kerams commented 2 months ago

Using my repro project lines 1 and 2 look the same on your Windows PC?

Gillibald commented 2 months ago

I can repro the issue