From 1d2442d58ab32f1eb087c143c70390640562326d Mon Sep 17 00:00:00 2001 From: JieXu Date: Thu, 28 May 2026 15:31:06 +0800 Subject: [PATCH] Fix the problem of font select (#9405) * Update OptionSettingWindow.axaml.cs * Update OptionSettingWindow.axaml.cs --- .../Views/OptionSettingWindow.axaml.cs | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs index a1ee5cbe..254cf24b 100644 --- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs @@ -161,29 +161,18 @@ public partial class OptionSettingWindow : WindowBase private async Task> GetFonts() { + await Task.CompletedTask; + var lstFonts = new List(); try { - if (Utils.IsWindows()) - { - return lstFonts; - } - else if (Utils.IsNonWindows()) - { - var result = await Utils.GetLinuxFontFamily("zh"); - if (result.IsNullOrEmpty()) - { - return lstFonts; - } - - var lst = result.Split(Environment.NewLine) - .Where(t => t.IsNotEmpty()) - .ToList() - .Select(t => t.Split(",").FirstOrDefault() ?? "") - .OrderBy(t => t) - .ToList(); - return lst; - } + var lst = Avalonia.Media.FontManager.Current.SystemFonts + .Select(t => t.Name) + .Where(t => t.IsNotEmpty()) + .Distinct(StringComparer.OrdinalIgnoreCase) + .OrderBy(t => t) + .ToList(); + return lst; } catch (Exception ex) {