mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-06-07 18:38:17 +08:00
Integrate font management for Linux demo (#822)
* feat: integrate font management by adding Semi.Avalonia.Demo.Fonts project. * chore: test on ubuntu. * feat: add linux options. * feat: update theme settings and adjust window decorations. * feat: add font to DRM project. * misc: net8.0->net10.0
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Dialogs;
|
||||
using Avalonia.Media;
|
||||
using Semi.Avalonia.Demo.Fonts;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Desktop;
|
||||
#pragma warning disable CA1416, AVALONIA_X11_CSD, AVALONIA_X11_FORCE_CSD
|
||||
|
||||
sealed class Program
|
||||
{
|
||||
@@ -11,24 +13,28 @@ sealed class Program
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.With(new FontManagerOptions
|
||||
{
|
||||
FontFallbacks =
|
||||
[
|
||||
new FontFallback
|
||||
{
|
||||
FontFamily = new FontFamily("Microsoft YaHei")
|
||||
}
|
||||
]
|
||||
})
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var appBuilder = BuildAvaloniaApp();
|
||||
if (!OperatingSystem.IsLinux())
|
||||
appBuilder.With(new FontManagerOptions
|
||||
{
|
||||
FontFallbacks = [new FontFallback { FontFamily = new FontFamily("Microsoft YaHei") }]
|
||||
});
|
||||
|
||||
appBuilder.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
{
|
||||
var appBuilder = AppBuilder.Configure<App>()
|
||||
.UseManagedSystemDialogs()
|
||||
.UsePlatformDetect()
|
||||
.With(new Win32PlatformOptions())
|
||||
.With(new X11PlatformOptions { EnableDrawnDecorations = true })
|
||||
.LogToTrace();
|
||||
}
|
||||
if (OperatingSystem.IsLinux()) appBuilder.WithSourceHanSansCNFont();
|
||||
return appBuilder;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationIcon>..\Semi.Avalonia.Demo\Assets\irihi.ico</ApplicationIcon>
|
||||
@@ -28,5 +28,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj"/>
|
||||
<ProjectReference Include="..\Semi.Avalonia.Demo.Fonts\Semi.Avalonia.Demo.Fonts.csproj"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user