refactor: change the way loading custom fonts

This commit is contained in:
leo 2024-03-05 15:53:38 +08:00
parent 636096c713
commit f834af10a2
31 changed files with 136 additions and 183 deletions

View file

@ -9,14 +9,6 @@ using System.Globalization;
namespace SourceGit.Views {
public class Chart : Control {
public static readonly StyledProperty<FontFamily> FontFamilyProperty =
AvaloniaProperty.Register<Chart, FontFamily>(nameof(FontFamily));
public FontFamily FontFamily {
get => GetValue(FontFamilyProperty);
set => SetValue(FontFamilyProperty, value);
}
public static readonly StyledProperty<IBrush> LineBrushProperty =
AvaloniaProperty.Register<Chart, IBrush>(nameof(LineBrush), Brushes.Gray);
@ -74,7 +66,7 @@ namespace SourceGit.Views {
maxV = (int)Math.Ceiling(maxV / 500.0) * 500;
}
var typeface = new Typeface(FontFamily);
var typeface = new Typeface("fonts:SourceGit#JetBrains Mono");
var pen = new Pen(LineBrush, 1);
var width = Bounds.Width;
var height = Bounds.Height;