-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.InvalidOperationException: Default font family name can't be null or empty #4427
Comments
@Gillibald As Dan suggested I've put an issue on this here. |
Just tried swapping to the Fluent theme, same error. |
You most likely need to install libfontconfig |
|
How does your fonts.conf look like? |
Running |
What does |
|
That looks okay. Next, we have to try out what could be failing on the Skia side. What do these yield for you? |
yields
|
So the font manager doesn't work at all |
You could try out this custom implementation. You need to adjust it to your needs. Make sure you include the fonts as Then override this:https://github.com/AvaloniaUI/Avalonia/blob/master/src/Skia/Avalonia.Skia/SkiaPlatform.cs#L23 Will figure out what we can do about the font manager issue. Probably need some debug build. |
You are free to use my project to try and find the cause if you want to. Not sure if it can be reproduced on anything but a raspberry pi though
|
I started trying, but unfortunately it's more than I have time to get working right now. Tried to get it to force load the Roboto font that seems to be bundled with the Fluent theme. |
I installed |
Thanks for taking the time to look at it |
I wonder what exactly gets installed. Skia should not require specific fonts to be able to match any font. |
Unfortunately all I can give you right now is in Swedish, but I'll post the install log here for you :)
|
All that package contains are fonts and licenses, and the fonts installed are as follows:
After further testing it looks like something in the font management chain really likes Verdana font for whatever reason, and if Verdana (all of its variants) goes missing it tries to look for any available variants of the Arial font, furthermore - when Arial is removed the previously mentioned |
Ciao guys |
This issue is also happening when the system language is set to Korean or Japanese and probably any other language with non-Latin characters as well. (tested on a fresh Ubuntu 20.10 VM x86_64) I can fix this font loading issue by launching my app with a modified locale environment variable:
|
Apparently also happens with Chinese locale. |
If someone would like to fix it we'd offer a 0.03 BTC bounty. |
There is a temporary workaround. You can register a custom font manager in your AppBuilder https://github.com/AvaloniaUI/Avalonia/blob/master/tests/Avalonia.Skia.UnitTests/Media/CustomFontManagerImpl.cs That font manager defines an embedded font as the default. |
I also have this problem on a computer with Galaxy Kylin operating system arm architecture. I solved this problem in the following way.
Through the above three steps, I have solved this problem, I hope to help you. |
Finally I've got this problem resolved by installing the ubuntu-restricted-extra package. Hope this hint would help you guys |
Hey, |
I've had this issue on Arch and Solus OS and installing just the DejaVu fonts (ttf-dejavu on Arch, dejavu-fonts-ttf on Solus) fixed it. |
Since 11.0.0 changed access level of Avalonia.Skia.GlyphTypefaceImpl, from public to internal, none of the sample codes above of implementing Avalonia.Platform.IFontManagerImpl is available now. Sadly. |
@Gillibald Program.cs:
Thanks for the help. We really appreciate it. |
Avalonia11 can not use it |
The winner of the Bitcoin bounty is @mihnea-radulescu: #12817 (comment) 🚀 |
Technically the issue isn't fixed because the system's default font is still not used. The above PR just prevents the crash and defines an existing font as the default to make the application work. The real fix is to avoid Skia entirely for font matching and instead use FontConfig directly. |
Avalonia 11.0.4 still have this issue. Environment is Ubuntu 22.04.1 LTS Arm64. |
This also causes musescore/MuseScore#15423 |
@ChihHao-Su how? I see the error log in the ticket, but not a single Avalonia file in the source? Can you point me to that failing file? Also please let us know which Avalonia version used. |
@timunie the MuseScore error is related to Muse Hub, which is a separate application for downloading, installing, and updating MuseScore. The Muse Hub project does not appear to be open source (at least it's not on GitHub and the project page doesn't link to the code.) https://musehub.zendesk.com/ |
looks like latest nightly helps here: BiDuang/Chief#2 (comment) I don't know if the font fallback is done correctly. |
I also encountered this issue while using Raspberry Pi 4B, an unhandled exception. System.InvalidOperationException: Default font family name can't be null or empty. |
Can confirm this is still an issue and causing crash on Ubuntu 24.04 |
Issue was fixed for me |
Just caught this issue in my WSL linux with git credentials manager . BTW never had - I don't know what happened. Is it possible to know which font is missing? I have installed |
In a Japanese environment on Linux, I encountered the same issue. However, I found a workaround by changing the LANG environment variable from jp_JP.utf-8 to en_US.utf8. |
You guys should check which version you are using |
Version: 0.10-preview2
I upgraded project IPOCS.JMRI.CONTROL, located at https://github.com/GMJS/ipocs.jmri, to preview2 (not committed and pushed yet) and made a build for
linux-arm
usingdotnet publish IPOCS.JMRI.CONTROL -c Release -r linux-arm
. Upon trying to run this on a raspberry pi I'm getting the exception:The text was updated successfully, but these errors were encountered: