Skip to content
Search

TextMetrics

lastmod 2026-11-10created 2023-02-212 edits

TextMetrics is the interface returned by measureText() of the HTML Canvas 2D context, and it holds size information for the text to be drawn. Besides the most commonly used width, it provides top, bottom, left, and right boundary values relative to the baseline, such as actualBoundingBoxLeft, actualBoundingBoxAscent, and fontBoundingBoxDescent. It is useful when centering text on a canvas or drawing a background box behind text at the exact size.

See also

Favorite site

author Zer0, MCPBot sitemap