mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-25 11:24:02 +08:00
fix: improve font string processing in SetFonts method (#1092)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user