Re: [csswg-drafts] [css-text-decor-4] Rethinking text-underline-offset

> `text-underline-offset` is defined to set “the offset of underlines from their initial position” where the “initial position” is defined in the [table below the propdef](https://drafts.csswg.org/css-text-decor-4/#underline-offset). It is not up to the UA, that is what the `auto` value means. Zero sets the underline at exactly that position.

Ah, I see. You're right, I didn't realize that this length refers to an offset *from the baseline* instead of an offset *from the browser's `auto` placement*. So `0` would be a terrible value that no one should ever use.

In that case, I guess my complaint is really about the name. Perhaps `text-underline-position` would be better, but that's already taken 😕

> 
> > What does it mean if both text-underline-offset: from-font and text-underline-position: under are applied to the same element? Such a formulation seems fairly meaningless.
> 
> Good question. `from-font` should maybe resolve to zero in this case. Or maybe calculate the distance from the alphabetic baseline to the font's preferred position, and then use that distance as the offset from the zero-offset `under` position.

Applying the font's distance to under-underlines is never what you want. Picking 0 would be better than that.

On the other hand, if you move the value to `text-underline-position`, you can mechanically forbid this from happening, which seems better.

> 
> > Add another value to text-underline-position named something like standard.
> 
> I'm not convinced this is necessary if we address your other issues... but open to hearing your arguments. :)

As above, I was just confused about this part. I retract this part of the proposal.

> 
> > Move the from-font value from text-underline-offset to text-underline-position.
> 
> `text-underline-position` is more fundamental positioning--it can swap which side of the text the underline is on, etc.; `from-font` is really about just adjusting the offset, so I think it really does belong here.

I don't quite understand the difference between "fundamental positioning" vs "non-fundamental positioning". They both are about positioning.

Perhaps an even better solution would be to join the two properties into one, so you could say something like

- `text-underline-position: under 2px` to mean "2px beyond the under-underline".
- `text-underline-position: from-font 12.5%` to mean "bump up the displacement from the font file by font-size / 8"
- `text-underline-position: baseline 6.25%` is the formula I mentioned above about "standard" placement
- `text-underline-position: left baseline 6.25%` is the same thing, but specifies that underlines go on the left in vertical writing mode
- `text-underline-position: under from-font` is a syntax error

> 
> > While we're at it, text-underline-offset should be able to take a percentage, which gets multiplied by the font size.
> 
> This is a severe oversight and we should definitely fix it. We should maybe try to be consistent about this across this property, `letter-spacing` and `word-spacing` (#2165), and ideally, `line-height`... Maybe in a separate issue, though?

https://github.com/w3c/csswg-drafts/issues/3121


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

Received on Sunday, 16 September 2018 20:32:49 UTC