Skip to content
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

[Bug] Crash before launching with Exception System.InvalidOperationException: Default font family name can't be null or empty #2

Closed
BiDuang opened this issue Oct 10, 2023 · 4 comments

Comments

@BiDuang
Copy link
Owner

BiDuang commented Oct 10, 2023

Waiting Avalonia fix this issue.

@timunie
Copy link

timunie commented Nov 15, 2023

can you test using latest nightly Avalonia version? I'd be interested if the recent workarounds help you in any way.

@BiDuang
Copy link
Owner Author

BiDuang commented Nov 15, 2023

can you test using latest nightly Avalonia version? I'd be interested if the recent workarounds help you in any way.

It won't crash now, but if I try to load the font from a local resource, all the text disappears.

public static AppBuilder BuildAvaloniaApp()
    {
        IconProvider.Current.Register<FontAwesomeIconProvider>();
        return AppBuilder.Configure<App>()
            .UsePlatformDetect()
            //.WithInterFont()        If I don't want to use interfont
            .With(new FontManagerOptions
            {
                FontFallbacks = new[]
                {
                    new FontFallback
                    {
                        FontFamily = new FontFamily("avares://Chief/Assets/MicrosoftYaHei.ttf#Microsoft YaHei")
                    }
                }
            })
            .LogToTrace()
            .UseReactiveUI();
    }

图片

But if we add interfont support, everything will work fine.

图片

Hope these information could help you!

@timunie
Copy link

timunie commented Nov 16, 2023

FontFamily = new FontFamily("avares://Chief/Assets/MicrosoftYaHei.ttf#Microsoft YaHei")

I have the feeling that this line is wrong somehow. You may need to load the font file itself from the assets before. Please scan GH discussions for reference.

@timunie
Copy link

timunie commented Nov 16, 2023

example: AvaloniaUI/Avalonia#12555 (reply in thread)

@BiDuang BiDuang closed this as completed Nov 21, 2023
BiDuang added a commit that referenced this issue Nov 28, 2023
feat: build ModuleInstall page;
refactor: detach ModuleManage and Config page's column definition and row definition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants