diff --git a/v2rayN/v2rayN.Desktop/Assets/Fonts/NotoSansSC-Regular.ttf b/v2rayN/v2rayN.Desktop/Assets/Fonts/NotoSansSC-Regular.ttf new file mode 100644 index 00000000..7056f5e9 Binary files /dev/null and b/v2rayN/v2rayN.Desktop/Assets/Fonts/NotoSansSC-Regular.ttf differ diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs new file mode 100644 index 00000000..e841ccf3 --- /dev/null +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -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) } } + }); + } + } +} \ No newline at end of file diff --git a/v2rayN/v2rayN.Desktop/Program.cs b/v2rayN/v2rayN.Desktop/Program.cs index a5eefe42..8d863192 100644 --- a/v2rayN/v2rayN.Desktop/Program.cs +++ b/v2rayN/v2rayN.Desktop/Program.cs @@ -1,5 +1,6 @@ using Avalonia; using Avalonia.ReactiveUI; +using v2rayN.Desktop.Common; namespace v2rayN.Desktop; @@ -48,7 +49,8 @@ internal class Program public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() - .WithInterFont() + //.WithInterFont() + .WithFontByDefault() .LogToTrace() .UseReactiveUI(); } \ No newline at end of file