mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
refactor: add Avalonia.Fonts.Inter
as built-in default font (#447)
This commit is contained in:
parent
6688319714
commit
17dd32456b
4 changed files with 17 additions and 13 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@ using System.IO;
|
|||
using System.Runtime.Versioning;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace SourceGit.Native
|
||||
{
|
||||
|
@ -37,12 +36,6 @@ namespace SourceGit.Native
|
|||
|
||||
public void SetupApp(AppBuilder builder)
|
||||
{
|
||||
// Fix issue https://github.com/sourcegit-scm/sourcegit/issues/447
|
||||
builder.With(new FontManagerOptions()
|
||||
{
|
||||
DefaultFamilyName = "fonts:SourceGit#JetBrains Mono",
|
||||
});
|
||||
|
||||
builder.With(new X11PlatformOptions()
|
||||
{
|
||||
EnableIme = true,
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
<SolidColorBrush x:Key="Brush.Diff.DeletedHighlight" Color="{DynamicResource Color.Diff.DeletedHighlight}"/>
|
||||
<SolidColorBrush x:Key="Brush.Link" Color="{DynamicResource Color.Link}"/>
|
||||
|
||||
<FontFamily x:Key="Fonts.Default">$Default</FontFamily>
|
||||
<FontFamily x:Key="Fonts.Default">fonts:Inter#Inter, $Default</FontFamily>
|
||||
<FontFamily x:Key="Fonts.Monospace">fonts:SourceGit#JetBrains Mono</FontFamily>
|
||||
<FontFamily x:Key="Fonts.Primary">fonts:SourceGit#JetBrains Mono</FontFamily>
|
||||
</ResourceDictionary>
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.1.3" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.1.3" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.3" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.3" />
|
||||
<PackageReference Include="Avalonia.Diagnostics" Version="11.1.3" Condition="'$(Configuration)' == 'Debug'" />
|
||||
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.1.0" />
|
||||
|
|
Loading…
Reference in a new issue