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
24.82k stars 2.15k forks source link

Issue using multiple styles of an embedded font on Linux #12292

Open 13xforever opened 1 year ago

13xforever commented 1 year ago

Describe the bug If I want to use multiple versions of Font Awesome, I need to differentiate between the styles/font files. On Windows FontFamily.Name includes the font file style, so there's no issue specifying what font file to use for an element. However, on Linux font style is not part of the FontFamily.Name, so all styles of the same font are merged into one embedded FontFamily.

To Reproduce Steps to reproduce the behavior:

  1. Add at least two font files with the same family, but different styles
  2. Try to use different styles for different elements Sample repro that runs fine on Windows, but fails to start on Linux

Expected behavior FontFamily grouping and naming is consistent between different platforms

Screenshots image

Desktop (please complete the following information):

Additional context The issue was raised in #10855, but was closed as you can kinda workaround the issue if you only need one font file. However I couldn't figure out how to make it work with multiple font files.

emmauss commented 1 year ago

@Gillibald

Gillibald commented 1 year ago

You are trying tonuse different fonts so everything works as expected. Regular and solid are different families.

13xforever commented 1 year ago

On Windows both fonts are parsed with different family names (Font Awesome 6 Free and Font Awesome 6 Free Solid). On Linux both fonts are parsed with the same name (Font Awesome 6 Free), so you can't use both.