Reference textDescent()

textDescent()

Returns the descent of the text.

The textDescent() function calculates the distance from the baseline to the lowest point of the current font. This value represents the descent, which, when combined with the ascent (from textAscent()), determines the overall vertical span of the text. If a text string is provided as an argument, the descent is calculated based on that specific string; otherwise, the descent of the current font is returned.

Examples

Syntax

textDescent([txt])

Parameters

txt
String: (Optional) The text string for which to calculate the descent. If omitted, the function returns the descent for the current font.

Returns

Number: The descent value in pixels.
Notice any errors or typos? Please let us know. Please feel free to edit src/type/textCore.js and open a pull request!

Related References