A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
1.1 KiB

namespace Avalonia.Media
{
public class GlyphRunDrawing : Drawing
{
public static readonly StyledProperty<IBrush?> ForegroundProperty =
AvaloniaProperty.Register<GlyphRunDrawing, IBrush?>(nameof(Foreground));
public static readonly StyledProperty<GlyphRun?> GlyphRunProperty =
AvaloniaProperty.Register<GlyphRunDrawing, GlyphRun?>(nameof(GlyphRun));
public IBrush? Foreground
{
get => GetValue(ForegroundProperty);
set => SetValue(ForegroundProperty, value);
}
public GlyphRun? GlyphRun
{
get => GetValue(GlyphRunProperty);
set => SetValue(GlyphRunProperty, value);
}
public override void Draw(DrawingContext context)
{
if (GlyphRun == null)
{
return;
}
context.DrawGlyphRun(Foreground, GlyphRun);
}
public override Rect GetBounds()
{
return GlyphRun != null ? new Rect(GlyphRun.Size) : default;
}
}
}