Compare commits

...

4 commits

Author SHA1 Message Date
JieXu
39a53ae0e6
Merge 77abecb80e into 2ebd2b28a8 2025-11-19 02:41:20 +08:00
JieXu
77abecb80e
Update AppBuilderExtension.cs 2025-11-19 00:00:07 +08:00
JieXu
ece4b6af05
Withdraw 2025-11-18 23:46:40 +08:00
JieXu
f57cc41058
Update AppBuilderExtension.cs 2025-11-18 22:06:28 +08:00

View file

@ -1,3 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using Avalonia; using Avalonia;
using Avalonia.Media; using Avalonia.Media;
@ -8,22 +10,22 @@ public static class AppBuilderExtension
{ {
public static AppBuilder WithFontByDefault(this AppBuilder appBuilder) public static AppBuilder WithFontByDefault(this AppBuilder appBuilder)
{ {
var fallbacks = new List<FontFallback>();
var notoSansSc = new FontFamily(Path.Combine(Global.AvaAssets, "Fonts#Noto Sans SC")); 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 }, fallbacks.Add(new FontFallback
{
OperatingSystem.IsLinux() FontFamily = new FontFamily("Noto Color Emoji")
? new FontFallback { FontFamily = new FontFamily("Noto Color Emoji") } });
: null }
};
var validFallbacks = fallbacks.Where(f => f is not null).ToArray()!;
return appBuilder.With(new FontManagerOptions return appBuilder.With(new FontManagerOptions
{ {
FontFallbacks = validFallbacks FontFallbacks = fallbacks.ToArray()
}); });
} }
} }