TextMetrics Class

The measurements of a text (https://html.spec.whatwg.org/multipage/canvas.html#textmetrics), returned by measureText(): the distances are in CSS px, relative to the alignment point and to the baseline of the text attributes of the context.

public sealed class TextMetrics

Properties

NameDescription
ActualBoundingBoxAscentGets the distance from the baseline to the top of the bounding box of the glyphs (positive upwards).
ActualBoundingBoxDescentGets the distance from the baseline to the bottom of the bounding box of the glyphs (positive downwards).
ActualBoundingBoxLeftGets the distance from the alignment point to the left of the bounding box of the glyphs (positive to the left).
ActualBoundingBoxRightGets the distance from the alignment point to the right of the bounding box of the glyphs (positive to the right).
AlphabeticBaselineGets the distance from the baseline to the alphabetic baseline (positive when the baseline is below it).
EmHeightAscentGets the distance from the baseline to the top of the em square (positive when the baseline is below it).
EmHeightDescentGets the distance from the baseline to the bottom of the em square (positive when the baseline is above it).
FontBoundingBoxAscentGets the distance from the baseline to the ascent of the first available font (positive upwards).
FontBoundingBoxDescentGets the distance from the baseline to the descent of the first available font (positive downwards).
HangingBaselineGets the distance from the baseline to the hanging baseline (positive when the baseline is below it).
IdeographicBaselineGets the distance from the baseline to the ideographic-under baseline (positive when the baseline is below it).
WidthGets the advance width of the text.

Gets the distance from the baseline to the top of the bounding box of the glyphs (positive upwards).

public double ActualBoundingBoxAscent { get; }

ActualBoundingBoxDescent

CanvasRenderingContext2DBase.Text.cs

Gets the distance from the baseline to the bottom of the bounding box of the glyphs (positive downwards).

public double ActualBoundingBoxDescent { get; }

Gets the distance from the alignment point to the left of the bounding box of the glyphs (positive to the left).

public double ActualBoundingBoxLeft { get; }

Gets the distance from the alignment point to the right of the bounding box of the glyphs (positive to the right).

public double ActualBoundingBoxRight { get; }

Gets the distance from the baseline to the alphabetic baseline (positive when the baseline is below it).

public double AlphabeticBaseline { get; }

Gets the distance from the baseline to the top of the em square (positive when the baseline is below it).

public double EmHeightAscent { get; }

Gets the distance from the baseline to the bottom of the em square (positive when the baseline is above it).

public double EmHeightDescent { get; }

Gets the distance from the baseline to the ascent of the first available font (positive upwards).

public double FontBoundingBoxAscent { get; }

Gets the distance from the baseline to the descent of the first available font (positive downwards).

public double FontBoundingBoxDescent { get; }

Gets the distance from the baseline to the hanging baseline (positive when the baseline is below it).

public double HangingBaseline { get; }

Gets the distance from the baseline to the ideographic-under baseline (positive when the baseline is below it).

public double IdeographicBaseline { get; }

Gets the advance width of the text.

public double Width { get; }