TextMetrics: emHeightDescent property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Note: This feature is available in Web Workers.

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

A number, in CSS pixels.

Examples

js
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
const text = ctx.measureText("foo"); // returns TextMetrics object

text.emHeightDescent; // -2.40234375;

Specifications

Specification
HTML
# dom-textmetrics-emheightdescent-dev

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
emHeightDescent
Chrome – No support
Chrome 77 (Release date: 2019-09-10)
disabled
disabled From version 77 users must explicitly set the #enable-experimental-web-platform-features preference. To change preferences in Chrome, visit chrome://flags.
Edge – No support
Edge 79 (Release date: 2020-01-15)
disabled
disabled From version 79 users must explicitly set the #enable-experimental-web-platform-features preference. To change preferences in Edge, visit about:flags.
Firefox – Full support
Firefox 118 (Release date: 2023-09-26)
footnote Full support
Opera – No support
Opera 64 (Release date: 2019-10-07)
disabled
disabled From version 64 users must explicitly set the #enable-experimental-web-platform-features preference. To change preferences in Opera, visit opera://flags.
Safari – Full support
Safari 11.1 (Release date: 2018-04-12)
footnote Full support
Chrome Android – No support
Chrome Android 77 (Release date: 2019-09-10)
disabled
disabled From version 77 users must explicitly set the #enable-experimental-web-platform-features preference. To change preferences in Chrome Android, visit chrome://flags.
Firefox for Android – Full support
Firefox for Android 118 (Release date: 2023-09-26)
footnote Full support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 11.3 (Release date: 2018-03-29)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 11.3 (Release date: 2018-03-29)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
User must explicitly enable this feature.

See also