W3C home > Mailing lists > Public > www-style@w3.org > August 2012

[css3-text] Behavior of text-decoration with differing font sizes, subscript, superscript, etc.

From: Aryeh Gregor <ayg@aryeh.name>
Date: Mon, 13 Aug 2012 15:08:17 +0300
Message-ID: <CAKA+Axm4o1r_LN0Q7v_XM8WQsMNEsdsES2r6K1Lp6rzH=vHC9A@mail.gmail.com>
To: www-style@w3.org
Cc: Ehsan Akhgari <ehsan@mozilla.com>
Mozilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=778796

Test-case 1: data:text/html,<!doctype html><s>foo<font size=7>bar</font>baz</s>


* In IE10 Developer Preview and Chrome 22 dev, as well as LibreOffice, the line breaks into three pieces: low lines through "foo"
and "baz", and a higher line through "bar".  (I include LibreOffice
for comparison because user expectations for rich-text markup will be
strongly influenced by how word processors work, so it's worth
checking them out.)
* In Firefox 17.0a1 and Opera Next 12.00 alpha, the line is of a
consistent height and thickness throughout, so it runs through the
bottom of "bar" instead of the middle.

Test-case 2: <u>foo<sup>bar</sup>baz</u>


* In IE10 Developer Preview, Firefox 17.0a1, and Opera Next 12.00
alpha, as well as LibreOffice, the line is of consistent
height and thickness.
* In Chrome 22 dev, the underline is in three pieces, jumping up for "bar".

Test-case 3: <u>foo<sub>bar</sub>baz</u>


* In IE10 Developer Preview and Chrome 22 dev, as well as LibreOffice, the line is in three pieces, at a lower height for "bar".
* In Firefox 17.0a1 and Opera Next 12.00 alpha, the line is of
consistent height and thickness, so it overlaps "bar".

The spec currently requires the line to be of consistent height and
thickness in all three cases:

In determining the position and thickness of text decoration lines,
user agents may consider the font sizes and dominant baselines of
descendants, but for a given element's decoration must use the same
position and thickness throughout each line box.

I would like this reconsidered.  As fantasai points out on the linked
bug, the requirement here usually makes sense with underline, because
Western scripts are aligned along their baselines, which is where we
put underlines.  But for line-through and overline, you can't put the
line in a place that makes sense for both 12pt text and 36pt text.  If
font sizes vary, you have to break up the line.  Also, even for
underline, it makes sense to lower it for subscripts.

I suggest one of the following two changes:

* Mandate the behavior of IE and LibreOffice in my test-cases above.
For a given element's decoration, an underline must remain at a
consistent position and thickness throughout each continuous run of
text in a single line box that has a consistent baseline.  (But if the
baseline varies, the underline may be broken up.)  However,
line-through and overline should be drawn at a height appropriate to
the text and may differ in height or thickness within a line box.
(Except maybe overlines should align for 'vertical-align: top',
although it's a corner case.  Line-through is normally not drawn at
the 50% mark, so we probably can't require line-throughs align for
'vertical-align: middle'.)
* Remove the requirement entirely, so behavior is undefined.  I like
undefined behavior a lot less, but we might have to do that if anyone
thinks their behavior is better than IE's, or if it's too annoying to
define (accounting for vertical-align, etc.).

Basically, I think IE's behavior here should at least be legal, even
if it's not mandated.  The Firefox/Opera behavior in the first
test-case is clearly wrong, IMO, but it's what the spec currently
requires.  IE's(/LibreOffice's) behavior makes the most sense to me.
Received on Monday, 13 August 2012 12:09:07 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:02 UTC