diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs
index c5386097..d4389645 100644
--- a/v2rayN/ServiceLib/Global.cs
+++ b/v2rayN/ServiceLib/Global.cs
@@ -473,7 +473,7 @@ public class Global
"zh-Hans",
"zh-Hant",
"en",
- "fa-Ir",
+ "fa",
"fr",
"ru",
"hu"
diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa.resx
similarity index 99%
rename from v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
rename to v2rayN/ServiceLib/Resx/ResUI.fa.resx
index 246417a6..7bebb881 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.fa.resx
@@ -1746,4 +1746,4 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
New Update
-
\ No newline at end of file
+
diff --git a/v2rayN/ServiceLib/ServiceLib.csproj b/v2rayN/ServiceLib/ServiceLib.csproj
index 5b0b8072..d80d1ec8 100644
--- a/v2rayN/ServiceLib/ServiceLib.csproj
+++ b/v2rayN/ServiceLib/ServiceLib.csproj
@@ -57,7 +57,7 @@
True
True
-
+
Designer
PublicResXFileCodeGenerator
diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs
index 4266b91f..6bfd9e01 100644
--- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs
+++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs
@@ -2,24 +2,48 @@ namespace v2rayN.Desktop.Common;
public static class AppBuilderExtension
{
+ private static readonly string DefaultFontFamilyName =
+ Path.Combine(Global.AvaAssets, "Fonts#Noto Sans SC");
+
public static AppBuilder WithFontByDefault(this AppBuilder appBuilder)
{
var fallbacks = new List();
- var notoSansSc = new FontFamily(Path.Combine(Global.AvaAssets, "Fonts#Noto Sans SC"));
- fallbacks.Add(new FontFallback { FontFamily = notoSansSc });
+ var notoSansSc = new FontFamily(DefaultFontFamilyName);
- if (OperatingSystem.IsLinux())
+ fallbacks.Add(new FontFallback
{
- fallbacks.Add(new FontFallback
- {
- FontFamily = new FontFamily("Noto Color Emoji")
- });
+ FontFamily = notoSansSc
+ });
+
+ if (OperatingSystem.IsWindows())
+ {
+ AddFontFallback(fallbacks, "Segoe UI Symbol");
+ AddFontFallback(fallbacks, "Segoe UI Emoji");
+ }
+ else if (OperatingSystem.IsMacOS())
+ {
+ AddFontFallback(fallbacks, "Apple Symbols");
+ AddFontFallback(fallbacks, "Apple Color Emoji");
+ }
+ else if (OperatingSystem.IsLinux())
+ {
+ AddFontFallback(fallbacks, "Noto Sans Symbols");
+ AddFontFallback(fallbacks, "Noto Color Emoji");
}
return appBuilder.With(new FontManagerOptions
{
+ DefaultFamilyName = DefaultFontFamilyName,
FontFallbacks = fallbacks.ToArray()
});
}
+
+ private static void AddFontFallback(List fallbacks, string fontFamilyName)
+ {
+ fallbacks.Add(new FontFallback
+ {
+ FontFamily = new FontFamily(fontFamilyName)
+ });
+ }
}
diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
index 812e9a47..b994f33b 100644
--- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
+++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
@@ -1,3 +1,4 @@
+using Avalonia.Media;
using v2rayN.Desktop.Base;
using v2rayN.Desktop.Common;
@@ -88,7 +89,6 @@ public partial class OptionSettingWindow : WindowBase
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
- //this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.Hide2TrayWhenClose, v => v.togHide2TrayWhenClose.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.MacOSShowInDock, v => v.togMacOSShowInDock.IsChecked).DisposeWith(disposables);
@@ -166,9 +166,10 @@ public partial class OptionSettingWindow : WindowBase
var lstFonts = new List();
try
{
- var lst = Avalonia.Media.FontManager.Current.SystemFonts
+ var lst = FontManager.Current.SystemFonts
.Select(t => t.Name)
- .Where(t => t.IsNotEmpty())
+ .Append(GetDefaultFontFamilyName())
+ .Where(IsInstalledFontFamilyName)
.Distinct(StringComparer.OrdinalIgnoreCase)
.OrderBy(t => t)
.ToList();
@@ -181,6 +182,20 @@ public partial class OptionSettingWindow : WindowBase
return lstFonts;
}
+ private static string GetDefaultFontFamilyName() => "Noto Sans SC";
+
+ private static bool IsInstalledFontFamilyName(string fontFamilyName)
+ {
+ return fontFamilyName.IsNotEmpty()
+ && !IsCssFontFamilyAlias(fontFamilyName);
+ }
+
+ private static bool IsCssFontFamilyAlias(string fontFamilyName)
+ {
+ return fontFamilyName.StartsWith("-", StringComparison.Ordinal)
+ || fontFamilyName.Equals("BlinkMacSystemFont", StringComparison.OrdinalIgnoreCase);
+ }
+
private void ClbdestOverride_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
if (ViewModel != null)