Re: [csswg-drafts] [css-inline-3] Tight vs loose fit into a line box (#5239)

>  dauwhe: I'd be willing to take the risk of some ink overlap to preserve the regularity of my line spacing
> ... in the case shown here I wouldn't have many problems unless stuff goes over the font descent
>... if you know the font you're using then it seems worth the risk

...

>  fantasai: I'm fine with collisions as long as authors are explicit, and the new line layout model allows that via negative margin

We've had a go at implementing `text-edge` as it's currently specified and I'm not sure that negative margin is going to solve this.

I've put an example at https://jsbin.com/lecudab/edit?html,output. The way this renders with `text-edge: ex` is:

![image](https://user-images.githubusercontent.com/989243/165268114-3e6da873-3259-41b7-87c4-0ff41e9919f5.png)

I chose `ex` as it makes the least contribution to the linebox of all the values currently specified, but even this value pushes the linebox out to the text-bottom edge. The vertical rhythm is still going to be broken with a subscript.

As suggested, I then put a negative margin on the super/subscript. First, this feels quite awkward as I must also set `text-edge` to something other than the default of `leading` to make it apply:
```css
sub {
    text-edge: ex
    margin-bottom: -1em
}
```
This made no difference: the margin is applied to the `sub` but not the replaced content within it, which still contributes to the line-height (although I'm prepared for the reply "you're misinterpreting https://drafts.csswg.org/css-inline-3/#inline-height" on this point).

Even assuming it does apply, I'd chosen an arbitrary "-1em" to try and ensure the margin disappears above the main alphabetic baseline, but with `text-edge: ex` this pushes the layout bounds under-edge _above_ the over-edge for the subscripted text. The best I can do here is`margin-bottom: -1ex` to set the under and over edge of the subscripted text to the "ex" baseline.

But where even the "ex" baseline is outside the default bounds of the line-box (say for very large baseline-shifts, or nested super/subscripts) I'd have to further adjust both the top and bottom margins to ensure they're still within the default bounds of the line box and prevent them from changing the rhythm. It's starting to get very complicated at this point and not at all intuitive.

If all I want is to preserve line rhythm at all costs and in all cases, a value like `text-edge: none` which means "do not contribute _at all_ to the line height" for this would be a lot simpler.




-- 
GitHub Notification of comment by faceless2
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5239#issuecomment-1109643351 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 26 April 2022 10:46:54 UTC