diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs index cf577181..07e5aae0 100644 --- a/v2rayN/ServiceLib/Common/Utils.cs +++ b/v2rayN/ServiceLib/Common/Utils.cs @@ -818,6 +818,13 @@ namespace ServiceLib.Common return await GetCliWrapOutput("/bin/bash", arg); } + public static async Task GetLinuxFontFamily(string lang) + { + // var arg = new List() { "-c", $"fc-list :lang={lang} family" }; + var arg = new List() { "-c", $"fc-list : family" }; + return await GetCliWrapOutput("/bin/bash", arg); + } + #endregion Platform } } \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index fdbef241..c0d3f60e 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -2860,6 +2860,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Install the font to the system and restart the settings 的本地化字符串。 + /// + public static string TbSettingsCurrentFontFamilyLinuxTip { + get { + return ResourceManager.GetString("TbSettingsCurrentFontFamilyLinuxTip", resourceCulture); + } + } + /// /// 查找类似 Copy the font TTF/TTC file to the directory guiFonts, restart the settings 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 9eeaac0c..93b3bcdb 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1360,4 +1360,7 @@ Please do not use the insecure HTTP protocol subscription address + + Install the font to the system and restart the settings + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index a4f565e9..318e1239 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1357,4 +1357,7 @@ 请不要使用不安全的HTTP协议订阅地址 + + 安装字体到系统中,重启设置 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index ebc9be17..f677ea4c 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -1237,4 +1237,7 @@ 請不要使用不安全的HTTP協定訂閱位址 + + 安裝字體到系統中,重新啟動設定 + \ No newline at end of file diff --git a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs index d960cee0..ac0bc136 100644 --- a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs @@ -1,5 +1,7 @@ using Avalonia; using Avalonia.Controls; +using Avalonia.Controls.Primitives; +using Avalonia.Media; using Avalonia.Styling; using ReactiveUI; using ReactiveUI.Fody.Helpers; @@ -9,14 +11,11 @@ namespace v2rayN.Desktop.ViewModels { public class ThemeSettingViewModel : MyReactiveObject { - [Reactive] - public bool ColorModeDark { get; set; } + [Reactive] public bool ColorModeDark { get; set; } - [Reactive] - public int CurrentFontSize { get; set; } + [Reactive] public int CurrentFontSize { get; set; } - [Reactive] - public string CurrentLanguage { get; set; } + [Reactive] public string CurrentLanguage { get; set; } public ThemeSettingViewModel() { @@ -29,6 +28,7 @@ namespace v2rayN.Desktop.ViewModels private void RestoreUI() { ModifyTheme(_config.UiItem.ColorModeDark); + ModifyFontFamily(); } private void BindingUI() @@ -38,34 +38,34 @@ namespace v2rayN.Desktop.ViewModels CurrentLanguage = _config.UiItem.CurrentLanguage; this.WhenAnyValue(x => x.ColorModeDark) - .Subscribe(c => - { - if (_config.UiItem.ColorModeDark != ColorModeDark) - { - _config.UiItem.ColorModeDark = ColorModeDark; - ModifyTheme(ColorModeDark); - ConfigHandler.SaveConfig(_config); - } - }); + .Subscribe(c => + { + if (_config.UiItem.ColorModeDark != ColorModeDark) + { + _config.UiItem.ColorModeDark = ColorModeDark; + ModifyTheme(ColorModeDark); + ConfigHandler.SaveConfig(_config); + } + }); this.WhenAnyValue( - x => x.CurrentFontSize, - y => y > 0) - .Subscribe(c => - { - if (CurrentFontSize >= Global.MinFontSize) - { - _config.UiItem.CurrentFontSize = CurrentFontSize; - double size = CurrentFontSize; - ModifyFontSize(size); + x => x.CurrentFontSize, + y => y > 0) + .Subscribe(c => + { + if (CurrentFontSize >= Global.MinFontSize) + { + _config.UiItem.CurrentFontSize = CurrentFontSize; + double size = CurrentFontSize; + ModifyFontSize(size); - ConfigHandler.SaveConfig(_config); - } - }); + ConfigHandler.SaveConfig(_config); + } + }); this.WhenAnyValue( - x => x.CurrentLanguage, - y => y != null && !y.IsNullOrEmpty()) + x => x.CurrentLanguage, + y => y != null && !y.IsNullOrEmpty()) .Subscribe(c => { if (Utils.IsNotEmpty(CurrentLanguage) && _config.UiItem.CurrentLanguage != CurrentLanguage) @@ -89,53 +89,51 @@ namespace v2rayN.Desktop.ViewModels private void ModifyFontSize(double size) { - Style buttonStyle = new(x => x.OfType