fix: failed get default font on some Linux distro (#447)

This commit is contained in:
leo 2024-09-08 18:29:05 +08:00
parent 2a59cdbe92
commit 6688319714
No known key found for this signature in database
3 changed files with 10 additions and 3 deletions

View file

@ -75,7 +75,7 @@ namespace SourceGit
AvaloniaXamlLoader.Load(this);
var pref = ViewModels.Preference.Instance;
pref.PropertyChanged += (_1, _2) => pref.Save();
pref.PropertyChanged += (_, _) => pref.Save();
SetLocale(pref.Locale);
SetTheme(pref.Theme, pref.ThemeOverrides);

View file

@ -5,6 +5,7 @@ using System.IO;
using System.Runtime.Versioning;
using Avalonia;
using Avalonia.Media;
namespace SourceGit.Native
{
@ -36,6 +37,12 @@ namespace SourceGit.Native
public void SetupApp(AppBuilder builder)
{
// Fix issue https://github.com/sourcegit-scm/sourcegit/issues/447
builder.With(new FontManagerOptions()
{
DefaultFamilyName = "fonts:SourceGit#JetBrains Mono",
});
builder.With(new X11PlatformOptions()
{
EnableIme = true,

View file

@ -99,6 +99,6 @@
<SolidColorBrush x:Key="Brush.Link" Color="{DynamicResource Color.Link}"/>
<FontFamily x:Key="Fonts.Default">$Default</FontFamily>
<FontFamily x:Key="Fonts.Monospace">fonts:SourceGit#JetBrains Mono,$Default</FontFamily>
<FontFamily x:Key="Fonts.Primary">fonts:SourceGit#JetBrains Mono,$Default</FontFamily>
<FontFamily x:Key="Fonts.Monospace">fonts:SourceGit#JetBrains Mono</FontFamily>
<FontFamily x:Key="Fonts.Primary">fonts:SourceGit#JetBrains Mono</FontFamily>
</ResourceDictionary>