Merge branch '2dust:master' into master

This commit is contained in:
fonaix 2024-11-06 15:19:38 +08:00 committed by GitHub
commit 42cb3a6408
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 2 deletions

View file

@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>7.0.6</Version> <Version>7.0.7</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -0,0 +1,19 @@
using Avalonia;
using Avalonia.Media;
using System.Reflection;
namespace v2rayN.Desktop.Common
{
public static class AppBuilderExtension
{
public static AppBuilder WithFontByDefault(this AppBuilder appBuilder)
{
var uri = $"avares://{Assembly.GetExecutingAssembly().GetName().Name}/Assets/Fonts#Noto Sans SC";
return appBuilder.With(new FontManagerOptions()
{
DefaultFamilyName = uri,
FontFallbacks = new[] { new FontFallback { FontFamily = new FontFamily(uri) } }
});
}
}
}

View file

@ -1,5 +1,6 @@
using Avalonia; using Avalonia;
using Avalonia.ReactiveUI; using Avalonia.ReactiveUI;
using v2rayN.Desktop.Common;
namespace v2rayN.Desktop; namespace v2rayN.Desktop;
@ -48,7 +49,8 @@ internal class Program
public static AppBuilder BuildAvaloniaApp() public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>() => AppBuilder.Configure<App>()
.UsePlatformDetect() .UsePlatformDetect()
.WithInterFont() //.WithInterFont()
.WithFontByDefault()
.LogToTrace() .LogToTrace()
.UseReactiveUI(); .UseReactiveUI();
} }