diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 25e32323..504981f7 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -181,6 +181,9 @@ namespace SourceGit app._fontsOverrides = null; } + defaultFont = ProcessFontString(defaultFont); + monospaceFont = ProcessFontString(monospaceFont); + var resDic = new ResourceDictionary(); if (!string.IsNullOrEmpty(defaultFont)) resDic.Add("Fonts.Default", new FontFamily(defaultFont)); @@ -437,6 +440,28 @@ namespace SourceGit return true; } + private static string ProcessFontString(string input) + { + if (string.IsNullOrEmpty(input)) return string.Empty; + + var parts = input.Split(','); + var result = new StringBuilder(); + var isFirst = true; + + foreach (var part in parts) + { + var trimmed = part.Trim(); + if (!string.IsNullOrEmpty(trimmed)) + { + if (!isFirst) result.Append(','); + result.Append(trimmed); + isFirst = false; + } + } + + return result.ToString(); + } + private bool TryLaunchAsCoreEditor(IClassicDesktopStyleApplicationLifetime desktop) { var args = desktop.Args;