Table of Contents

Class TextMetrics

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The TextMetrics interface represents the dimensions of a piece of text in the canvas; a TextMetrics instance can be retrieved using the CanvasRenderingContext2D.MeasureText method.

[Value("TextMetrics")]
public class TextMetrics
Inheritance
TextMetrics
Inherited Members

Remarks

-Creator method in CanvasRenderingContext2D
-The {{HTMLElement("canvas")}} element and its associated interface, HTMLCanvasElement

See also on MDN

Constructors

TextMetrics()

public TextMetrics()

Properties

ActualBoundingBoxAscent

The read-only actualBoundingBoxAscent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.TextBaseline attribute to the top of the bounding rectangle used to render the text, in CSS pixels.

[Value("actualBoundingBoxAscent")]
public Number ActualBoundingBoxAscent { get; }

Property Value

Number

Remarks

ActualBoundingBoxDescent

The read-only actualBoundingBoxDescent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.TextBaseline attribute to the bottom of the bounding rectangle used to render the text, in CSS pixels.

[Value("actualBoundingBoxDescent")]
public Number ActualBoundingBoxDescent { get; }

Property Value

Number

Remarks

ActualBoundingBoxLeft

The read-only actualBoundingBoxLeft property of the TextMetrics interface is a double giving the distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.TextAlign property to the left side of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating a distance going left from the given alignment point.

[Value("actualBoundingBoxLeft")]
public Number ActualBoundingBoxLeft { get; }

Property Value

Number

Remarks

ActualBoundingBoxRight

The read-only actualBoundingBoxRight property of the TextMetrics interface is a double giving the distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.TextAlign property to the right side of the bounding rectangle of the given text, in CSS pixels.

[Value("actualBoundingBoxRight")]
public Number ActualBoundingBoxRight { get; }

Property Value

Number

Remarks

AlphabeticBaseline

The read-only alphabeticBaseline property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.TextBaseline property to the alphabetic baseline of the line box, in CSS pixels.

[Value("alphabeticBaseline")]
public Number AlphabeticBaseline { get; }

Property Value

Number

Remarks

EmHeightAscent

The read-only emHeightAscent property of the TextMetrics interface returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.TextBaseline property to the top of the em square in the line box, in CSS pixels.

[Value("emHeightAscent")]
public Number EmHeightAscent { get; }

Property Value

Number

A number, in CSS pixels.

Remarks

EmHeightDescent

The read-only emHeightDescent property of the TextMetrics interface returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.TextBaseline property to the bottom of the em square in the line box, in CSS pixels.

[Value("emHeightDescent")]
public Number EmHeightDescent { get; }

Property Value

Number

A number, in CSS pixels.

Remarks

FontBoundingBoxAscent

The read-only fontBoundingBoxAscent property of the TextMetrics interface returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.TextBaseline attribute, to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels.

[Value("fontBoundingBoxAscent")]
public Number FontBoundingBoxAscent { get; }

Property Value

Number

A number, in CSS pixels.

Remarks

FontBoundingBoxDescent

The read-only fontBoundingBoxDescent property of the TextMetrics interface returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.TextBaseline attribute to the bottom of the bounding rectangle of all the fonts used to render the text, in CSS pixels.

[Value("fontBoundingBoxDescent")]
public Number FontBoundingBoxDescent { get; }

Property Value

Number

A number, in CSS pixels.

Remarks

HangingBaseline

The read-only hangingBaseline property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.TextBaseline property to the hanging baseline of the line box, in CSS pixels.

[Value("hangingBaseline")]
public Number HangingBaseline { get; }

Property Value

Number

Remarks

IdeographicBaseline

The read-only ideographicBaseline property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.TextBaseline property to the ideographic baseline of the line box, in CSS pixels.

[Value("ideographicBaseline")]
public Number IdeographicBaseline { get; }

Property Value

Number

Remarks

Width

The read-only width property of the TextMetrics interface contains the text's advance width (the width of that inline box) in CSS pixels.

[Value("width")]
public Number Width { get; }

Property Value

Number

Remarks