diff --git a/src/App.axaml b/src/App.axaml index b9124294..83cbf2cb 100644 --- a/src/App.axaml +++ b/src/App.axaml @@ -6,7 +6,6 @@ - diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 96276fb9..98425fc3 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -4,6 +4,7 @@ using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Data.Core.Plugins; using Avalonia.Markup.Xaml; using Avalonia.Media; +using Avalonia.Media.Fonts; using Avalonia.Styling; using System; using System.IO; @@ -41,15 +42,23 @@ namespace SourceGit { public static AppBuilder BuildAvaloniaApp() { var builder = AppBuilder.Configure(); builder.UsePlatformDetect(); + builder.ConfigureFonts(manager => { + var monospace = new EmbeddedFontCollection( + new Uri("fonts:SourceGit", UriKind.Absolute), + new Uri("avares://SourceGit/Resources/Fonts", UriKind.Absolute)); + manager.AddFontCollection(monospace); + }); if (OperatingSystem.IsWindows()) { builder.With(new FontManagerOptions() { + DefaultFamilyName = "Microsoft YaHei UI", FontFallbacks = [ new FontFallback { FontFamily = new FontFamily("Microsoft YaHei UI") } ] }); } else if (OperatingSystem.IsMacOS()) { builder.With(new FontManagerOptions() { + DefaultFamilyName = "PingFang SC", FontFallbacks = [ new FontFallback { FontFamily = new FontFamily("PingFang SC") } ] diff --git a/src/Resources/Fonts.axaml b/src/Resources/Fonts.axaml deleted file mode 100644 index 29681db5..00000000 --- a/src/Resources/Fonts.axaml +++ /dev/null @@ -1,6 +0,0 @@ - - avares://SourceGit/Resources/Fonts/JetBrainsMono-Regular.ttf#JetBrains Mono - avares://SourceGit/Resources/Fonts/JetBrainsMono-Bold.ttf#JetBrains Mono - avares://SourceGit/Resources/Fonts/JetBrainsMono-Italic.ttf#JetBrains Mono - diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index c5ed0ebf..2ce2628b 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -68,13 +68,7 @@ - -