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.09k stars 2.26k forks source link

linux Font Error #13462

Open liufei134 opened 1 year ago

liufei134 commented 1 year ago

title

When I run the program under Linux, the following exception occurs: OS: linux 5.4.18 err msg:

Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory at SkiaSharp.SkiaApi.sk_colortype_get_default_8888() at SkiaSharp.SKImageInfo..cctor() --- End of inner exception stack trace --- at Avalonia.Skia.PlatformRenderInterface..ctor(Nullable1 maxResourceBytes) at Avalonia.Skia.SkiaPlatform.Initialize(SkiaOptions options) at Avalonia.SkiaApplicationExtensions.<>c.b__0_0() at Avalonia.AppBuilder.SetupUnsafe() at Avalonia.AppBuilder.Setup() at Avalonia.AppBuilder.SetupWithLifetime(IApplicationLifetime lifetime) at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode) at FAControlsGallery.Desktop.Program.Main(String[] args) in

`

but

After obtaining the source code and debugging, I found that ,After passing in the font name, but the name of the returned object is different from the passed in name The code is as follows: image

So it leads to a failure to obtain the font, resulting in a failure to display the interface

timunie commented 1 year ago

Please provide a minimal sample to repdroduce if possible.

Also: Which Avalonia version are you using?

Gillibald commented 1 year ago

I do not understand the issue here. There is some custom SkiaSharp code that is failing because this native Skia library could not be loaded.

programClown commented 1 year ago

Maybe no CESI_FS_GB13000 font be found on linux, it seems like a Windows OS font.

liufei134 commented 1 year ago

Maybe no CESI_FS_GB13000 font be found on linux, it seems like a Windows OS font.

This font does exist

liufei134 commented 1 year ago

I do not understand the issue here. There is some custom SkiaSharp code that is failing because this native Skia library could not be loaded.

This error caused the UI to not display, Because the following code will block if(!_fontManager.PlatformImpl.TryCreateGlyphTypeface(familyName, style, weight, stretch, out glyphTypeface) || !glyphTypeface.FamilyName.Contains(familyName)) **_// look here_** { //Try to find nearest match if possible TryGetNearestMatch(glyphTypefaces, key, out glyphTypeface); }

liufei134 commented 1 year ago

Please provide a minimal sample to repdroduce if possible.

Also: Which Avalonia version are you using?

11.1.999-cibuild0041478-beta

timunie commented 1 year ago

@liufei134 do you have a minimal sample to reproduce?

liufei134 commented 1 year ago

CESI_FS_GB13000 AvaloniaApplication1.zip

The attachment is the sample code

image

timunie commented 1 year ago

@liufei134 please check #13585 if that would solve your issue as well.