Skip to content

Commit

Permalink
Merge branch 'refs/heads/font' into action/deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbitism committed Jul 11, 2024
2 parents a88d7f1 + 6028f10 commit f026d4c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
Binary file not shown.
16 changes: 16 additions & 0 deletions demo/Ursa.Demo.Browser/AvaloniaAppBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Avalonia;
using Avalonia.Media;

namespace Ursa.Demo.Browser;

public static class AvaloniaAppBuilderExtensions
{
private static string DefaultFontFamily => "avares://Ursa.Demo.Browser/Assets#Source Han Sans CN";

public static AppBuilder WithSourceHanSansCNFont(this AppBuilder builder) =>
builder.With(new FontManagerOptions
{
DefaultFamilyName = DefaultFontFamily,
FontFallbacks = new[] { new FontFallback { FontFamily = new FontFamily(DefaultFontFamily) } }
});
}
1 change: 1 addition & 0 deletions demo/Ursa.Demo.Browser/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Ursa.Demo.Browser;
internal sealed partial class Program
{
private static Task Main(string[] args) => BuildAvaloniaApp()
.WithSourceHanSansCNFont()
.StartBrowserAppAsync("out");

public static AppBuilder BuildAvaloniaApp()
Expand Down
1 change: 1 addition & 0 deletions demo/Ursa.Demo.Browser/Ursa.Demo.Browser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</ItemGroup>

<ItemGroup>
<AvaloniaResource Include="Assets\**"/>
<TrimmerRootDescriptor Include="linker.xml"/>
</ItemGroup>
</Project>
9 changes: 5 additions & 4 deletions demo/Ursa.Demo/Views/SingleView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
mc:Ignorable="d" d:DesignWidth="800"
d:DesignHeight="450"
x:Class="Ursa.Demo.Views.SingleView">
<Panel>
<views:MainView/>
<u:OverlayDialogHost/>
</Panel>
<Grid RowDefinitions="Auto, *">
<u:ThemeToggleButton Grid.Row="0" HorizontalAlignment="Right" Margin="8"></u:ThemeToggleButton>
<views:MainView Grid.Row="1"/>
<u:OverlayDialogHost Grid.Row="0" Grid.RowSpan="2"/>
</Grid>
</UserControl>

0 comments on commit f026d4c

Please sign in to comment.