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

@ -63,22 +63,14 @@ namespace SourceGit.Views {
set => SetValue(ChangeProperty, value);
}
public static readonly StyledProperty<FontFamily> IconFontFamilyProperty =
AvaloniaProperty.Register<Avatar, FontFamily>(nameof(IconFontFamily));
public FontFamily IconFontFamily {
get => GetValue(IconFontFamilyProperty);
set => SetValue(IconFontFamilyProperty, value);
}
static ChangeStatusIcon() {
AffectsRender<ChangeStatusIcon>(IsWorkingCopyChangeProperty, ChangeProperty, IconFontFamilyProperty);
AffectsRender<ChangeStatusIcon>(IsWorkingCopyChangeProperty, ChangeProperty);
}
public override void Render(DrawingContext context) {
if (Change == null || Bounds.Width <= 0) return;
var typeface = IconFontFamily == null ? Typeface.Default : new Typeface(IconFontFamily);
var typeface = new Typeface("fonts:SourceGit#JetBrains Mono");
IBrush background = null;
string indicator;