mirror of
https://github.com/2dust/v2rayN.git
synced 2025-11-29 03:02:53 +00:00
Update AppBuilderExtension.cs
This commit is contained in:
parent
faac943049
commit
d433d4a174
1 changed files with 6 additions and 9 deletions
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Avalonia;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
|
||||||
namespace v2rayN.Desktop.Common;
|
namespace v2rayN.Desktop.Common;
|
||||||
|
|
@ -24,7 +25,7 @@ public static class AppBuilderExtension
|
||||||
|
|
||||||
var fallbacks = new List<FontFallback>();
|
var fallbacks = new List<FontFallback>();
|
||||||
|
|
||||||
string? zhFamily = RunFcMatchFamily("sans:lang=zh-cn");
|
var zhFamily = RunFcFamily("sans:lang=zh-cn");
|
||||||
if (!string.IsNullOrWhiteSpace(zhFamily))
|
if (!string.IsNullOrWhiteSpace(zhFamily))
|
||||||
{
|
{
|
||||||
fallbacks.Add(new FontFallback
|
fallbacks.Add(new FontFallback
|
||||||
|
|
@ -33,7 +34,7 @@ public static class AppBuilderExtension
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
string? emojiFamily = RunFcMatchFamily("emoji");
|
var emojiFamily = RunFcFamily("emoji");
|
||||||
if (!string.IsNullOrWhiteSpace(emojiFamily))
|
if (!string.IsNullOrWhiteSpace(emojiFamily))
|
||||||
{
|
{
|
||||||
fallbacks.Add(new FontFallback
|
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
|
try
|
||||||
{
|
{
|
||||||
var psi = new ProcessStartInfo
|
var psi = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "/bin/bash",
|
FileName = "/bin/bash",
|
||||||
ArgumentList =
|
ArgumentList = { "-c", $"fc-match -f \"%{{family}}\\n\" \"{pattern}\" | head -n 1" },
|
||||||
{
|
|
||||||
"-c",
|
|
||||||
$"fc-match -f \"%{{family[0]}}\\n\" \"{pattern}\" | head -n 1"
|
|
||||||
},
|
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
RedirectStandardError = false,
|
RedirectStandardError = true,
|
||||||
UseShellExecute = false
|
UseShellExecute = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue