mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-24 05:35:00 +00:00
refactor: change the way loading custom fonts
This commit is contained in:
parent
636096c713
commit
f834af10a2
31 changed files with 136 additions and 183 deletions
|
@ -17,14 +17,6 @@ namespace SourceGit.Views {
|
|||
new GradientStops() { new GradientStop(Colors.Tomato, 0), new GradientStop(Color.FromRgb(252, 165, 150), 1) },
|
||||
];
|
||||
|
||||
public static readonly StyledProperty<FontFamily> FallbackFontFamilyProperty =
|
||||
AvaloniaProperty.Register<Avatar, FontFamily>(nameof(FallbackFontFamily));
|
||||
|
||||
public FontFamily FallbackFontFamily {
|
||||
get => GetValue(FallbackFontFamilyProperty);
|
||||
set => SetValue(FallbackFontFamilyProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<Models.User> UserProperty =
|
||||
AvaloniaProperty.Register<Avatar, Models.User>(nameof(User));
|
||||
|
||||
|
@ -34,7 +26,6 @@ namespace SourceGit.Views {
|
|||
}
|
||||
|
||||
static Avatar() {
|
||||
AffectsRender<Avatar>(FallbackFontFamilyProperty);
|
||||
UserProperty.Changed.AddClassHandler<Avatar>(OnUserPropertyChanged);
|
||||
}
|
||||
|
||||
|
@ -106,7 +97,7 @@ namespace SourceGit.Views {
|
|||
EndPoint = new RelativePoint(0, 1, RelativeUnit.Relative),
|
||||
};
|
||||
|
||||
var typeface = avatar.FallbackFontFamily == null ? Typeface.Default : new Typeface(avatar.FallbackFontFamily);
|
||||
var typeface = new Typeface("fonts:SourceGit#JetBrains Mono");
|
||||
|
||||
avatar._fallbackLabel = new FormattedText(
|
||||
placeholder,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue