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>();
|
var builder = AppBuilder.Configure<App>();
|
||||||
builder.UsePlatformDetect();
|
builder.UsePlatformDetect();
|
||||||
builder.LogToTrace();
|
builder.LogToTrace();
|
||||||
|
builder.WithInterFont();
|
||||||
builder.ConfigureFonts(manager =>
|
builder.ConfigureFonts(manager =>
|
||||||
{
|
{
|
||||||
var monospace = new EmbeddedFontCollection(
|
var monospace = new EmbeddedFontCollection(
|
||||||
|
@ -219,9 +220,18 @@ namespace SourceGit
|
||||||
resDic.Add("Fonts.Monospace", new FontFamily(monospaceFont));
|
resDic.Add("Fonts.Monospace", new FontFamily(monospaceFont));
|
||||||
}
|
}
|
||||||
|
|
||||||
var primary = onlyUseMonospaceFontInEditor ? defaultFont : monospaceFont;
|
if (onlyUseMonospaceFontInEditor)
|
||||||
if (!string.IsNullOrEmpty(primary))
|
{
|
||||||
resDic.Add("Fonts.Primary", new FontFamily(primary));
|
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)
|
if (resDic.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,6 @@ using System.IO;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
namespace SourceGit.Native
|
namespace SourceGit.Native
|
||||||
{
|
{
|
||||||
|
@ -36,13 +35,7 @@ namespace SourceGit.Native
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupApp(AppBuilder builder)
|
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()
|
builder.With(new X11PlatformOptions()
|
||||||
{
|
{
|
||||||
EnableIme = true,
|
EnableIme = true,
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
<SolidColorBrush x:Key="Brush.Diff.DeletedHighlight" Color="{DynamicResource Color.Diff.DeletedHighlight}"/>
|
<SolidColorBrush x:Key="Brush.Diff.DeletedHighlight" Color="{DynamicResource Color.Diff.DeletedHighlight}"/>
|
||||||
<SolidColorBrush x:Key="Brush.Link" Color="{DynamicResource Color.Link}"/>
|
<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.Monospace">fonts:SourceGit#JetBrains Mono</FontFamily>
|
||||||
<FontFamily x:Key="Fonts.Primary">fonts:SourceGit#JetBrains Mono</FontFamily>
|
<FontFamily x:Key="Fonts.Primary">fonts:SourceGit#JetBrains Mono</FontFamily>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="11.1.3" />
|
<PackageReference Include="Avalonia" Version="11.1.3" />
|
||||||
<PackageReference Include="Avalonia.Desktop" 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.Themes.Fluent" Version="11.1.3" />
|
||||||
<PackageReference Include="Avalonia.Diagnostics" Version="11.1.3" Condition="'$(Configuration)' == 'Debug'" />
|
<PackageReference Include="Avalonia.Diagnostics" Version="11.1.3" Condition="'$(Configuration)' == 'Debug'" />
|
||||||
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.1.0" />
|
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.1.0" />
|
||||||
|
@ -55,6 +56,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
|
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
|
||||||
<LinkerArg Include="-mmacosx-version-min=11.0" Condition="'$(Configuration)' == 'Release'"/>
|
<LinkerArg Include="-mmacosx-version-min=11.0" Condition="'$(Configuration)' == 'Release'" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Reference in a new issue