From 668831971482d7203db8c978d9b1cf4229ad7ca4 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 8 Sep 2024 18:29:05 +0800 Subject: [PATCH] fix: failed get default font on some Linux distro (#447) --- src/App.axaml.cs | 2 +- src/Native/Linux.cs | 7 +++++++ src/Resources/Themes.axaml | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index b64e65c0..cd00517f 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -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); diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs index 1b33cc5d..59193e44 100644 --- a/src/Native/Linux.cs +++ b/src/Native/Linux.cs @@ -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, diff --git a/src/Resources/Themes.axaml b/src/Resources/Themes.axaml index 05cb9b50..2714c33e 100644 --- a/src/Resources/Themes.axaml +++ b/src/Resources/Themes.axaml @@ -99,6 +99,6 @@ $Default - fonts:SourceGit#JetBrains Mono,$Default - fonts:SourceGit#JetBrains Mono,$Default + fonts:SourceGit#JetBrains Mono + fonts:SourceGit#JetBrains Mono