mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-10 22:45:00 +03:00
Fix the problem of font select (#9405)
* Update OptionSettingWindow.axaml.cs * Update OptionSettingWindow.axaml.cs
This commit is contained in:
@@ -161,29 +161,18 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||
|
||||
private async Task<List<string>> GetFonts()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
|
||||
var lstFonts = new List<string>();
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user