Open fantasai opened 4 years ago
I think the devil's in the details of how the text-edge-over/under: <metric>
are defined to work (metric of first available font vs all fonts, trim the layout bounds vs content box, etc), but the overall split into these two properties makes sense to me:
text-edge-over/under
is something you'd set broadly based on your language/typographic choices, while leading-trim
would be set more specifically on targeted elements<metric>
value in line sizing in addition to doing it for trimming, to better deal with slight variations in sizes when there's limited slack.Same as above, except now closed up. Basically I want a way to make this happen :)
The CSS Working Group just discussed [css-inline-3] Rethinking line-sizing and leading-trim
, and agreed to the following:
RESOLVED: Adopt new model described in the issue, continue working on it
Hi @fantasai @frivoal @dauwhe and everyone else.
I've never participated in any working groups, but I thought in this instance, you might be interested to check out a prototype I've made. It's using the negative-margin and translateY recipe to trim the bounding box and realign text to the baseline.
The 'compose' tab (top-right) is the interesting bit.
Edits made, and new draft posted.
Filed https://github.com/w3c/csswg-drafts/issues/5239 in response to some of the discussion raised by @dauwhe's diagrams.
Hi I was wondering if there is any update on the CSS leading trim.
I wanted to follow up on some thoughts:
line-sizing: normal
’s model working fine ifline-height
has significant slack, but not if it doesn't: the half-leading on the root element isn't enough to handle slight shifts in ascent/descent due to varying font-families, for example, if there's hardly any half-leading. See this video from ~11:37 - 12:30 (or just watch the whole thing if you prefer ;)leading-trim
leading-trim
to focus on whether or not to trim.Starting from some of dbaron's comments, I suspect reworking the relationship of these two features might solve a lot of these issues.
For example, what if instead of
line-sizing: legacy | normal
(inheritable) andleading-trim-over/under: normal | <metric>
(non-inheritable, applies to block containers, inline boxes) we had:text-edge-over/under: leading | normal | <metric>
(inheritable, applies to inline boxes except root inline)leading
inline box does the usual thing of contributing half-leadingnormal
inline box ignores 'line-height', contributes margin-box edge<metric>
is likenormal
, but also trims the content-height from ascent/descent down to specified metricleading-trim: normal | start | end | both
(non-inheritable, applies to block containers)normal
applies half-leading over/under the root inline box on all linesstart
trims outer half-leading of root inline box on first line, down totext-edge
metricend
trims outer half-leading of root inline box on last line, down totext-edge
metric