Table of Contents

Interface ITextDrawingContext

Namespace
Xui.Core.Canvas
Assembly
Xui.Core.dll

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

TextAlign

TextBaseline

Sets the vertical alignment of the text relative to the given baseline.

TextBaseline TextBaseline { set; }

Property Value

TextBaseline

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

text ReadOnlySpan<char>

The text characters to render.

pos Point

The 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

text string

The text string to render.

pos Point

The position at which to start rendering the text.

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

handler FillTextInterpolatedStringHandler

The interpolated string handler that formats into a stack buffer.

pos Point

The position at which to start rendering the text.