Struct FontMetrics
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
NFloatMaximum vertical extent above the baseline from the font’s bounding box.
fontDescent
NFloatMaximum vertical extent below the baseline from the font’s bounding box.
emAscent
NFloatAscent to the top of the em square.
emDescent
NFloatDescent to the bottom of the em square.
alphabeticBaseline
NFloatPosition of the alphabetic baseline (typically 0).
hangingBaseline
NFloatPosition of the hanging baseline for scripts that use it.
ideographicBaseline
NFloatPosition of the ideographic baseline for CJK layout.
lineHeight
NFloatTotal 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
EmHeightAscent
Height from baseline to top of the em square.
public readonly NFloat EmHeightAscent
Field Value
EmHeightDescent
Height from baseline to bottom of the em square.
public readonly NFloat EmHeightDescent
Field Value
FontBoundingBoxAscent
Maximum ascent defined by the font (not necessarily used glyphs).
public readonly NFloat FontBoundingBoxAscent
Field Value
FontBoundingBoxDescent
Maximum descent defined by the font.
public readonly NFloat FontBoundingBoxDescent
Field Value
HangingBaseline
Vertical position of the hanging baseline (used in scripts like Devanagari).
public readonly NFloat HangingBaseline
Field Value
IdeographicBaseline
Vertical position of the ideographic baseline (used in CJK layout).
public readonly NFloat IdeographicBaseline
Field Value
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
Properties
EmHeight
Total height of the em box.
public NFloat EmHeight { get; }
Property Value
FontBoundingBoxHeight
Total height of the font bounding box.
public NFloat FontBoundingBoxHeight { get; }