From a0718fc4f86a72e9d287d0ccf364824c9518199e Mon Sep 17 00:00:00 2001 From: JieXu Date: Tue, 18 Nov 2025 19:11:35 +0800 Subject: [PATCH 1/8] Update AppBuilderExtension.cs --- .../Common/AppBuilderExtension.cs | 62 +++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs index c0702938..6e2e7b33 100644 --- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -1,14 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using Avalonia; +using Avalonia.Media; + namespace v2rayN.Desktop.Common; public static class AppBuilderExtension { public static AppBuilder WithFontByDefault(this AppBuilder appBuilder) { - var uri = Path.Combine(Global.AvaAssets, "Fonts#Noto Sans SC"); - return appBuilder.With(new FontManagerOptions() + var notoSansSc = new FontFamily(Path.Combine(Global.AvaAssets, "Fonts#Noto Sans SC")); + + var fallbacks = new List { - //DefaultFamilyName = uri, - FontFallbacks = new[] { new FontFallback { FontFamily = new FontFamily(uri) } } + new() { FontFamily = notoSansSc } + }; + + if (OperatingSystem.IsLinux()) + { + var emojiFamily = DetectLinuxEmojiFamily(); + if (!string.IsNullOrWhiteSpace(emojiFamily)) + { + fallbacks.Add(new FontFallback + { + FontFamily = new FontFamily(emojiFamily) + }); + } + } + + return appBuilder.With(new FontManagerOptions + { + FontFallbacks = fallbacks.ToArray() }); } + + private static string? DetectLinuxEmojiFamily() + { + try + { + var psi = new ProcessStartInfo + { + FileName = "/bin/bash", + ArgumentList = + { + "-c", + "fc-match -f \"%{family[0]}\\n\" \"emoji\" | head -n 1" + }, + RedirectStandardOutput = true, + RedirectStandardError = false, + UseShellExecute = false + }; + + using var p = Process.Start(psi); + if (p == null) + return null; + + var output = p.StandardOutput.ReadToEnd().Trim(); + return string.IsNullOrWhiteSpace(output) ? null : output; + } + catch + { + return null; + } + } } From 5c72ead51d0ce0c6f0bdad6fb84d4ff2020a1bd8 Mon Sep 17 00:00:00 2001 From: JieXu Date: Tue, 18 Nov 2025 19:13:03 +0800 Subject: [PATCH 2/8] Update package-rhel.sh --- package-rhel.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package-rhel.sh b/package-rhel.sh index 5ef75ab5..a3ea5406 100644 --- a/package-rhel.sh +++ b/package-rhel.sh @@ -631,13 +631,14 @@ ExclusiveArch: aarch64 x86_64 Source0: __PKGROOT__.tar.gz # Runtime dependencies (Avalonia / X11 / Fonts / GL) -Requires: freetype, cairo, pango, openssl, mesa-libEGL, mesa-libGL +Requires: cairo, pango, openssl, mesa-libEGL, mesa-libGL Requires: glibc >= 2.34 Requires: fontconfig >= 2.13.1 Requires: desktop-file-utils >= 0.26 Requires: xdg-utils >= 1.1.3 Requires: coreutils >= 8.32 Requires: bash >= 5.1 +Requires: freetype >= 2.10 %description v2rayN Linux for Red Hat Enterprise Linux From dadf29c925ea7a40b113cd7da053e22c587f7af0 Mon Sep 17 00:00:00 2001 From: JieXu Date: Tue, 18 Nov 2025 19:13:39 +0800 Subject: [PATCH 3/8] Update package-debian.sh --- package-debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-debian.sh b/package-debian.sh index 2c0ce9da..8b15bb06 100644 --- a/package-debian.sh +++ b/package-debian.sh @@ -28,7 +28,7 @@ Package: v2rayN Version: $Version Architecture: $Arch2 Maintainer: https://github.com/2dust/v2rayN -Depends: libc6 (>= 2.34), fontconfig (>= 2.13.1), desktop-file-utils (>= 0.26), xdg-utils (>= 1.1.3), coreutils (>= 8.32), bash (>= 5.1) +Depends: libc6 (>= 2.34), fontconfig (>= 2.13.1), desktop-file-utils (>= 0.26), xdg-utils (>= 1.1.3), coreutils (>= 8.32), bash (>= 5.1), libfreetype6 (>= 2.11) Description: A GUI client for Windows and Linux, support Xray core and sing-box-core and others EOF From 80720c74c65bf18f279914ce5ea2a9adff19babe Mon Sep 17 00:00:00 2001 From: JieXu Date: Tue, 18 Nov 2025 20:49:49 +0800 Subject: [PATCH 4/8] Update AppBuilderExtension.cs --- .../Common/AppBuilderExtension.cs | 72 ++++--------------- 1 file changed, 12 insertions(+), 60 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs index 6e2e7b33..1b0bd8fa 100644 --- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -1,68 +1,20 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using Avalonia; -using Avalonia.Media; - -namespace v2rayN.Desktop.Common; - -public static class AppBuilderExtension +public static AppBuilder WithFontByDefault(this AppBuilder appBuilder) { - 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 }); + + if (OperatingSystem.IsLinux()) { - var notoSansSc = new FontFamily(Path.Combine(Global.AvaAssets, "Fonts#Noto Sans SC")); - - var fallbacks = new List + fallbacks.Add(new FontFallback { - new() { FontFamily = notoSansSc } - }; - - if (OperatingSystem.IsLinux()) - { - var emojiFamily = DetectLinuxEmojiFamily(); - if (!string.IsNullOrWhiteSpace(emojiFamily)) - { - fallbacks.Add(new FontFallback - { - FontFamily = new FontFamily(emojiFamily) - }); - } - } - - return appBuilder.With(new FontManagerOptions - { - FontFallbacks = fallbacks.ToArray() + FontFamily = new FontFamily("Noto Color Emoji") }); } - private static string? DetectLinuxEmojiFamily() + return appBuilder.With(new FontManagerOptions { - try - { - var psi = new ProcessStartInfo - { - FileName = "/bin/bash", - ArgumentList = - { - "-c", - "fc-match -f \"%{family[0]}\\n\" \"emoji\" | head -n 1" - }, - RedirectStandardOutput = true, - RedirectStandardError = false, - UseShellExecute = false - }; - - using var p = Process.Start(psi); - if (p == null) - return null; - - var output = p.StandardOutput.ReadToEnd().Trim(); - return string.IsNullOrWhiteSpace(output) ? null : output; - } - catch - { - return null; - } - } + FontFallbacks = fallbacks.ToArray() + }); } From 2697cddfa622692e0b665161d75afa25fd2b0ab4 Mon Sep 17 00:00:00 2001 From: JieXu Date: Tue, 18 Nov 2025 20:58:52 +0800 Subject: [PATCH 5/8] Update AppBuilderExtension.cs --- .../Common/AppBuilderExtension.cs | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs index 1b0bd8fa..ba59adbb 100644 --- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -1,20 +1,29 @@ -public static AppBuilder WithFontByDefault(this AppBuilder appBuilder) +using System.IO; +using Avalonia; +using Avalonia.Media; + +namespace v2rayN.Desktop.Common; + +public static class AppBuilderExtension { - var fallbacks = new List(); - - var notoSansSc = new FontFamily(Path.Combine(Global.AvaAssets, "Fonts#Noto Sans SC")); - fallbacks.Add(new FontFallback { FontFamily = notoSansSc }); - - if (OperatingSystem.IsLinux()) + public static AppBuilder WithFontByDefault(this AppBuilder appBuilder) { - fallbacks.Add(new FontFallback + var notoSansSc = new FontFamily(Path.Combine(Global.AvaAssets, "Fonts#Noto Sans SC")); + + var fallbacks = new[] { - FontFamily = new FontFamily("Noto Color Emoji") + new FontFallback { FontFamily = notoSansSc }, + + OperatingSystem.IsLinux() + ? new FontFallback { FontFamily = new FontFamily("Noto Color Emoji") } + : null + }; + + var validFallbacks = fallbacks.Where(f => f is not null).ToArray()!; + + return appBuilder.With(new FontManagerOptions + { + FontFallbacks = validFallbacks }); } - - return appBuilder.With(new FontManagerOptions - { - FontFallbacks = fallbacks.ToArray() - }); } From f57cc410587d686e882d60b6189a5f5662cdd27b Mon Sep 17 00:00:00 2001 From: JieXu Date: Tue, 18 Nov 2025 22:06:28 +0800 Subject: [PATCH 6/8] Update AppBuilderExtension.cs --- .../Common/AppBuilderExtension.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs index ba59adbb..925be53b 100644 --- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.IO; using Avalonia; using Avalonia.Media; @@ -8,22 +9,22 @@ public static class AppBuilderExtension { 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 fallbacks = new[] + if (OperatingSystem.IsLinux()) { - new FontFallback { FontFamily = notoSansSc }, - - OperatingSystem.IsLinux() - ? new FontFallback { FontFamily = new FontFamily("Noto Color Emoji") } - : null - }; - - var validFallbacks = fallbacks.Where(f => f is not null).ToArray()!; + fallbacks.Add(new FontFallback + { + FontFamily = new FontFamily("Noto Color Emoji") + }); + } return appBuilder.With(new FontManagerOptions { - FontFallbacks = validFallbacks + FontFallbacks = fallbacks.ToArray() }); } } From ece4b6af0571511031576cbb283d2c440b444188 Mon Sep 17 00:00:00 2001 From: JieXu Date: Tue, 18 Nov 2025 23:46:40 +0800 Subject: [PATCH 7/8] Withdraw --- .../Common/AppBuilderExtension.cs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs index 925be53b..ba59adbb 100644 --- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.IO; using Avalonia; using Avalonia.Media; @@ -9,22 +8,22 @@ public static class AppBuilderExtension { 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 }); - if (OperatingSystem.IsLinux()) + var fallbacks = new[] { - fallbacks.Add(new FontFallback - { - FontFamily = new FontFamily("Noto Color Emoji") - }); - } + new FontFallback { FontFamily = notoSansSc }, + + OperatingSystem.IsLinux() + ? new FontFallback { FontFamily = new FontFamily("Noto Color Emoji") } + : null + }; + + var validFallbacks = fallbacks.Where(f => f is not null).ToArray()!; return appBuilder.With(new FontManagerOptions { - FontFallbacks = fallbacks.ToArray() + FontFallbacks = validFallbacks }); } } From 77abecb80ea187a4a62c053ecde2785ddd307bbf Mon Sep 17 00:00:00 2001 From: JieXu Date: Wed, 19 Nov 2025 00:00:07 +0800 Subject: [PATCH 8/8] Update AppBuilderExtension.cs --- .../Common/AppBuilderExtension.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs index ba59adbb..5a3fca95 100644 --- a/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs +++ b/v2rayN/v2rayN.Desktop/Common/AppBuilderExtension.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections.Generic; using System.IO; using Avalonia; using Avalonia.Media; @@ -8,22 +10,22 @@ public static class AppBuilderExtension { 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 fallbacks = new[] + if (OperatingSystem.IsLinux()) { - new FontFallback { FontFamily = notoSansSc }, - - OperatingSystem.IsLinux() - ? new FontFallback { FontFamily = new FontFamily("Noto Color Emoji") } - : null - }; - - var validFallbacks = fallbacks.Where(f => f is not null).ToArray()!; + fallbacks.Add(new FontFallback + { + FontFamily = new FontFamily("Noto Color Emoji") + }); + } return appBuilder.With(new FontManagerOptions { - FontFallbacks = validFallbacks + FontFallbacks = fallbacks.ToArray() }); } }