Table of Contents

Struct FontMetrics

Namespace
Xui.Core.Canvas
Assembly
Core.dll

Represents font-defined metrics used for vertical alignment and em box sizing. These values are constant for a given font and size.

public readonly struct FontMetrics
Inherited Members

Constructors

FontMetrics(NFloat, NFloat, NFloat, NFloat, NFloat, NFloat, NFloat, NFloat)

Initializes a new FontMetrics instance.

public FontMetrics(NFloat fontAscent, NFloat fontDescent, NFloat emAscent, NFloat emDescent, NFloat alphabeticBaseline, NFloat hangingBaseline, NFloat ideographicBaseline, NFloat lineHeight)

Parameters

fontAscent NFloat

Maximum vertical extent above the baseline from the font’s bounding box.

fontDescent NFloat

Maximum vertical extent below the baseline from the font’s bounding box.

emAscent NFloat

Ascent to the top of the em square.

emDescent NFloat

Descent to the bottom of the em square.

alphabeticBaseline NFloat

Position of the alphabetic baseline (typically 0).

hangingBaseline NFloat

Position of the hanging baseline for scripts that use it.

ideographicBaseline NFloat

Position of the ideographic baseline for CJK layout.

lineHeight NFloat

Total line height to be used for layout spacing, including any extra leading or padding.

Fields

AlphabeticBaseline

Position of the alphabetic baseline (typically 0, used for alignment).

public readonly NFloat AlphabeticBaseline

Field Value

NFloat

EmHeightAscent

Height from baseline to top of the em square.

public readonly NFloat EmHeightAscent

Field Value

NFloat

EmHeightDescent

Height from baseline to bottom of the em square.

public readonly NFloat EmHeightDescent

Field Value

NFloat

FontBoundingBoxAscent

Maximum ascent defined by the font (not necessarily used glyphs).

public readonly NFloat FontBoundingBoxAscent

Field Value

NFloat

FontBoundingBoxDescent

Maximum descent defined by the font.

public readonly NFloat FontBoundingBoxDescent

Field Value

NFloat

HangingBaseline

Vertical position of the hanging baseline (used in scripts like Devanagari).

public readonly NFloat HangingBaseline

Field Value

NFloat

IdeographicBaseline

Vertical position of the ideographic baseline (used in CJK layout).

public readonly NFloat IdeographicBaseline

Field Value

NFloat

LineHeight

Total line height used for layout purposes, typically equal to or greater than the font's em height. This value reflects the line spacing set by the user or framework, not derived from glyph bounds.

public readonly NFloat LineHeight

Field Value

NFloat

Properties

EmHeight

Total height of the em box.

public NFloat EmHeight { get; }

Property Value

NFloat

FontBoundingBoxHeight

Total height of the font bounding box.

public NFloat FontBoundingBoxHeight { get; }

Property Value

NFloat