From d433d4a174f49ea936c9bcf1e9bc13d09495022f Mon Sep 17 00:00:00 2001 From: JieXu Date: Mon, 17 Nov 2025 20:35:44 +0800 Subject: [PATCH] Update AppBuilderExtension.cs --- .../v2rayN.Desktop/Common/AppBuilderExtension.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs index 4fa45508..1d0058ef 100644 --- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using Avalonia; using Avalonia.Media; namespace v2rayN.Desktop.Common; @@ -24,7 +25,7 @@ public static class AppBuilderExtension var fallbacks = new List(); - string? zhFamily = RunFcMatchFamily("sans:lang=zh-cn"); + var zhFamily = RunFcFamily("sans:lang=zh-cn"); if (!string.IsNullOrWhiteSpace(zhFamily)) { fallbacks.Add(new FontFallback @@ -33,7 +34,7 @@ public static class AppBuilderExtension }); } - string? emojiFamily = RunFcMatchFamily("emoji"); + var emojiFamily = RunFcFamily("emoji"); if (!string.IsNullOrWhiteSpace(emojiFamily)) { fallbacks.Add(new FontFallback @@ -54,20 +55,16 @@ public static class AppBuilderExtension }); } - private static string? RunFcMatchFamily(string pattern) + private static string? RunFcFamily(string pattern) { try { var psi = new ProcessStartInfo { FileName = "/bin/bash", - ArgumentList = - { - "-c", - $"fc-match -f \"%{{family[0]}}\\n\" \"{pattern}\" | head -n 1" - }, + ArgumentList = { "-c", $"fc-match -f \"%{{family}}\\n\" \"{pattern}\" | head -n 1" }, RedirectStandardOutput = true, - RedirectStandardError = false, + RedirectStandardError = true, UseShellExecute = false };