Table of Contents

Struct TextMetrics

Namespace
Xui.Core.Canvas
Assembly
Core.dll

Composite structure combining string-specific and font-specific text metrics. Used for precise layout, alignment, and rendering across all platforms.

public readonly struct TextMetrics
Inherited Members

Constructors

TextMetrics(LineMetrics, FontMetrics)

Creates a new composite text metrics structure.

public TextMetrics(LineMetrics line, FontMetrics font)

Parameters

line LineMetrics
font FontMetrics

Fields

Font

Metrics derived from the current font and size, independent of input string.

public readonly FontMetrics Font

Field Value

FontMetrics

Line

Metrics specific to the given text string (shaping, kerning, bounding box).

public readonly LineMetrics Line

Field Value

LineMetrics

Properties

BoundingBox

Returns the visual bounding box of the text string, relative to the origin. X may be negative for glyphs that extend left of the starting point.

public Rect BoundingBox { get; }

Property Value

Rect

Size

public Size Size { get; }

Property Value

Size

Operators

implicit operator Size(TextMetrics)

Implicitly converts the text metrics to a Size, using the advance width and total height of the string. The width corresponds to how far the cursor should advance, not the visual width.

public static implicit operator Size(TextMetrics metrics)

Parameters

metrics TextMetrics

Returns

Size