[css-inline-3] make text of leading-trim interoperable? · Issue #3978 · w3c/csswg-drafts (original) (raw)

Unfortunately all impls compute different positions for text-top, and that the leading-trim: text value using it doesn't make this property interoperable. I would like the property to provide at least one value that is interoperable across platforms (browsers/OS).

I discussed with @litherum on this before. IIUC we would like to have two text-top/bottom metrics; one which is interoperable, another which is compatible with the current layout engine of the platform.

How about something like:

Value Description
platform-text Use the text-top/bottom metric. This value matches to metric used by the layout, but may vary by platform.
typo-text Use the text-top/bottom metric using sTypoAscender/sTypoDescender from os/2 table in OpenType fonts, or the tightest metrics on other font systems that can provide multiple text metrics.
em-height Use the text-top/bottom metrics using the synthesized em-height metrics. The em-height metrics is computed by normalizing the typo-text metrics to 1em. For example, the text-top em-height for OpenType is computed by sTypoAscender / (sTypoAscender + sTypoDescender) * font-size.

The em-height is a metric invented by Gecko, @jfkthame explained here.

@fantasai