refactor: add Avalonia.Fonts.Inter as built-in default font (#447)

This commit is contained in:
leo 2024-09-09 10:01:41 +08:00
parent 6688319714
commit 17dd32456b
No known key found for this signature in database
4 changed files with 17 additions and 13 deletions

View file

@ -58,6 +58,7 @@ namespace SourceGit
var builder = AppBuilder.Configure<App>();
builder.UsePlatformDetect();
builder.LogToTrace();
builder.WithInterFont();
builder.ConfigureFonts(manager =>
{
var monospace = new EmbeddedFontCollection(
@ -219,9 +220,18 @@ namespace SourceGit
resDic.Add("Fonts.Monospace", new FontFamily(monospaceFont));
}
var primary = onlyUseMonospaceFontInEditor ? defaultFont : monospaceFont;
if (!string.IsNullOrEmpty(primary))
resDic.Add("Fonts.Primary", new FontFamily(primary));
if (onlyUseMonospaceFontInEditor)
{
if (string.IsNullOrEmpty(defaultFont))
resDic.Add("Fonts.Primary", new FontFamily("fonts:Inter#Inter, $Default"));
else
resDic.Add("Fonts.Primary", new FontFamily(defaultFont));
}
else
{
if (!string.IsNullOrEmpty(monospaceFont))
resDic.Add("Fonts.Primary", new FontFamily(monospaceFont));
}
if (resDic.Count > 0)
{