mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
fix: improve font string processing in SetFonts method (#1092)
This commit is contained in:
parent
519bdf1ddc
commit
b9b684a83d
1 changed files with 25 additions and 0 deletions
|
@ -181,6 +181,9 @@ namespace SourceGit
|
||||||
app._fontsOverrides = null;
|
app._fontsOverrides = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultFont = ProcessFontString(defaultFont);
|
||||||
|
monospaceFont = ProcessFontString(monospaceFont);
|
||||||
|
|
||||||
var resDic = new ResourceDictionary();
|
var resDic = new ResourceDictionary();
|
||||||
if (!string.IsNullOrEmpty(defaultFont))
|
if (!string.IsNullOrEmpty(defaultFont))
|
||||||
resDic.Add("Fonts.Default", new FontFamily(defaultFont));
|
resDic.Add("Fonts.Default", new FontFamily(defaultFont));
|
||||||
|
@ -437,6 +440,28 @@ namespace SourceGit
|
||||||
return true;
|
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)
|
private bool TryLaunchAsCoreEditor(IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
{
|
{
|
||||||
var args = desktop.Args;
|
var args = desktop.Args;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue