From 752d489b265120115d5e0bc4f100a72f66e98bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enner=20P=C3=A9rez?= Date: Sun, 26 Jul 2026 22:44:58 -0500 Subject: [PATCH] feat: Font Selector --- src/ViewModels/Preferences.cs | 4 ++++ src/Views/Preferences.axaml | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs index 25bbb431f..d27f8f28c 100644 --- a/src/ViewModels/Preferences.cs +++ b/src/ViewModels/Preferences.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading.Tasks; using Avalonia.Collections; +using Avalonia.Media; using CommunityToolkit.Mvvm.ComponentModel; namespace SourceGit.ViewModels @@ -61,6 +63,8 @@ public string ThemeOverrides } } + public IEnumerable Fonts => FontManager.Current.SystemFonts.Select(f => f.FamilyNames.FirstOrDefault()); + public string DefaultFontFamily { get => _defaultFontFamily; diff --git a/src/Views/Preferences.axaml b/src/Views/Preferences.axaml index b0a4753bb..5bad18123 100644 --- a/src/Views/Preferences.axaml +++ b/src/Views/Preferences.axaml @@ -210,19 +210,25 @@ Text="{DynamicResource Text.Preferences.Appearance.DefaultFont}" HorizontalAlignment="Right" Margin="0,0,16,0"/> - + - + ItemsSource="{Binding Fonts, Mode=OneWay}" + SelectedItem="{Binding MonospaceFontFamily, Mode=TwoWay}"/>