mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-14 08:24:59 +03:00
Update AppBuilderExtension.cs && Fix Bug (#9483)
* Update AppBuilderExtension.cs * Update OptionSettingWindow.axaml.cs * Update OptionSettingWindow.axaml.cs * Update Global.cs * Rename ResUI.fa-Ir.resx to ResUI.fa.resx * Update ServiceLib.csproj
This commit is contained in:
@@ -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<FontFallback>();
|
||||
|
||||
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<FontFallback> fallbacks, string fontFamilyName)
|
||||
{
|
||||
fallbacks.Add(new FontFallback
|
||||
{
|
||||
FontFamily = new FontFamily(fontFamilyName)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user