W3C home > Mailing lists > Public > www-style@w3.org > December 2016

Re: [css-text-decor] Doesn't example 3 in text-underline-position break current UA behavior?

From: fantasai <fantasai.lists@inkedblade.net>
Date: Fri, 23 Dec 2016 00:17:58 +0330
To: "Myles C. Maxfield" <mmaxfield@apple.com>, Masayuki Nakano <masayuki@d-toybox.com>
Cc: www-style list <www-style@w3.org>
Message-ID: <9a0da0af-7056-94e4-e348-d7b962365d57@inkedblade.net>
On 06/17/2015 10:11 PM, Myles C. Maxfield wrote:
> Hello,
>
> Using the “under” value in horizontal CJK text is not incorrect. In particular,
> many CJK glyphs (correctly) lie below the alphabetic baseline, which means that
> an underline which lies on the alphabetic baseline crashes into the glyphs.
> However, you are correct that using an “under” underline in common latin prose
> is unnatural.
>
> Browsers shouldn't set one type of underline for an entire page based solely on
> the language of its root element or an ancestor element which happens to have a
> language attribute. You mentioned one case where this falls down: a CJK document
> which includes a latin blockquote. However, browsers should be free to solve
> this problem in the best way possible. In particular, the best underline position
> for one run of text may be different than for some other run, and those runs
> might be in the same HTML element. It's not possible to express default underline
> position logic that handles cases like this in the UA stylesheet.

Actually, this is very easy to express.

   [lang]:not([lang|=zh],[lang|=ja]) { text-underline-position: auto; }

and you are right that we should include such a rule to overturn the CJK rules
in nested non-CJK content. Checked in a fix.

> It would be better to move the default underline position logic into
> text-underline-position: auto. This simplifies the UA stylesheet rules and allows
> the maximum freedom to improve default UA behavior in the future. However, the
> availability of a simple “under” value is still valuable for certain typographical
> situations which warrant it.

This is more-or-less already the case--that's why we no longer have an 'alphabetic'
value, and have 'auto' instead. See e.g discussion in this thread:
   https://www.w3.org/mid/51884CBD.7020501@inkedblade.net
   https://lists.w3.org/Archives/Public/www-style/2013Jul/0105.html

The only thing that 'auto' doesn't currently allow is swapping sides of the line,
because that is handled via UA stylesheet, which is adequate for expressing language
dependencies. Note that this aspect really needs to be predictable and not UA-dependent,
so there shouldn't be any extra heuristics or UA-specific "magic" involved.

[... it occurs to me this value should probably be 'normal' rather than 'auto',
to avoid invoking too much expectation of automagic. ]

> As for vertical text, the decision about whether to place the decoration on the
> left or the right is a decision best left to authors. In addition, that decision
> is orthogonal from the decision about the distance the underline lies from the
> text.

I agree that the author should have control over left vs. right, however
I think it is reasonable for the UA to set a reasonable default when one
is well-established, as it is for CJK vs non-CJK.

> However, authors should not be able to specify both “left” and “right” at once.

This is already handled by the current syntactic constraints. :)

~fantasai
Received on Thursday, 22 December 2016 21:14:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:05 UTC