Interface ITextDrawingContext
Defines methods for drawing text onto the canvas, including alignment and baseline options.
Mirrors the HTML5 Canvas 2D text API for fillText().
Also provides access to text measurement via ITextMeasureContext.
public interface ITextDrawingContext : ITextMeasureContext
- Inherited Members
Properties
TextAlign
Sets the horizontal alignment of the text relative to the given position.
TextAlign TextAlign { set; }
Property Value
TextBaseline
Sets the vertical alignment of the text relative to the given baseline.
TextBaseline TextBaseline { set; }
Property Value
Methods
FillText(ReadOnlySpan<char>, Point)
Draws filled text at the specified position without allocating a string.
Use with stackalloc and TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider) for zero-allocation rendering.
void FillText(ReadOnlySpan<char> text, Point pos)
Parameters
textReadOnlySpan<char>The text characters to render.
posPointThe position at which to start rendering the text.
FillText(string, Point)
Draws filled text at the specified position using the current fill style and font settings.
void FillText(string text, Point pos)
Parameters
FillText(FillTextInterpolatedStringHandler, Point)
Draws filled text from an interpolated string without heap-allocating the string. The compiler automatically prefers this overload for interpolated string arguments.
void FillText(FillTextInterpolatedStringHandler handler, Point pos)
Parameters
handlerFillTextInterpolatedStringHandlerThe interpolated string handler that formats into a stack buffer.
posPointThe position at which to start rendering the text.