diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs index d1e13f38..da33cf2b 100644 --- a/src/ViewModels/Preferences.cs +++ b/src/ViewModels/Preferences.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; using Avalonia.Collections; @@ -381,6 +382,10 @@ namespace SourceGit.ViewModels set => SetProperty(ref _lastCheckUpdateTime, value); } + public List Fonts { get; private set; } = [string.Empty, ..systemFonts.Value]; + + public List MonoFonts { get; private set; } = [string.Empty, ..systemFonts.Value]; + public void SetCanModify() { _isReadonly = false; @@ -695,5 +700,9 @@ namespace SourceGit.ViewModels private string _externalMergeToolPath = string.Empty; private uint _statisticsSampleColor = 0xFF00FF00; + + private static readonly Lazy> systemFonts = new( + () => [..Avalonia.Media.FontManager.Current.SystemFonts.Select(e => e.Name).OrderBy(e => e)], + System.Threading.LazyThreadSafetyMode.PublicationOnly); } } diff --git a/src/Views/Preferences.axaml b/src/Views/Preferences.axaml index 6742bcfc..ba973ea9 100644 --- a/src/Views/Preferences.axaml +++ b/src/Views/Preferences.axaml @@ -175,19 +175,38 @@ Text="{DynamicResource Text.Preferences.Appearance.DefaultFont}" HorizontalAlignment="Right" Margin="0,0,16,0"/> - + + + + + + + + - + + + + + + +