RE: [CSS3 Text] Text Decoration Section Drafted

The rules for underline, strikethrough and overline are clearly
understood that there is a possibility of one of each type of line. For
each category it must position the same location on the line and be the
same thickness for the length of the line.

 

We use the font metrics to determine the values. TrueType and OpenType
fonts and the OS/2 and post tables that have the associated values
listed below.

 


The CSS standard defines behavior as a line of text having one position
for underline, one position for line-through and one position for
overline. The CSS standard does not prevent two lines from having
different positions based on font size of the line.

 


 


1.1.            Underline


1.1.1.    Underline position


1.1.1.1.      The position of the underline for the line of text is the
lowest of all run underline values for the line.


1.1.1.1.1.1.   Run underline position comes from post.underlinePosition
for the font that is used to render text for the run.


1.1.1.1.1.2.   If the font of the run does not have outline text metrics
(the font is a bitmap font), the underline position will the bottom row
of pixels of the text height.


1.1.2.    Underline thickness


1.1.2.1.      The thickness of the underline for the line of text is the
median underline thickness of all run values for the line.


1.1.2.1.1.1.   Run underline thickness comes from
post.underlineThickness for the font that is used to render text for the
run.


1.1.2.1.1.2.   If the font of the run does not have outline text metrics
(the font is a bitmap font), the underline thickness will be 1/10 of the
ascent size to the nearest pixel, but at least 1 pixel.


1.1.2.1.1.3.   The minimal thickness of the underline is 1 pixel.


1.2.            Line-through


1.2.1.    Line-through position


1.2.1.1.      The position of the line-through for the line of text is
the median of all run line-through values for the line.


1.2.1.1.1.1.   Run underline position comes from OS/2.yStrikeoutPosition
for the font that is used to render text for the run.


1.2.1.1.1.2.   If the font of the run does not have outline text metrics
(the font is a bitmap font), the line-through position will be half way
between the top of the text line and baseline.


1.2.2.    Line-through thickness


1.2.2.1.      The thickness of the underline for the line of text is the
median underline thickness of all run values for the line.


1.2.2.1.1.1.   Run underline thickness comes from OS/2.yStrikeoutSize
for the font that is used to render text for the run.


1.2.2.1.1.2.   If the font of the run does not have outline text metrics
(the font is a bitmap font), the underline thickness will be 1/10 of the
ascent size to the nearest pixel, but at least 1 pixel.


1.2.2.1.1.3.   The minimal thickness of the line-through is 1 pixel.


1.3.            Overline


1.3.1.    Overline position


1.3.1.1.      The position of the overline for the line of text is the
highest of all run overline values for the line.


1.3.1.1.1.1.   Run overline position is at the top of the text line box.


1.3.2.    Overline thickness


1.3.2.1.      The thickness of the overline for the line of text is the
median underline thickness of all run values for the line. [NOTICE: Yes,
the overline uses the width of the underline. This is by design and is
not a mistake.]


1.3.2.1.1.1.   Run underline thickness comes from
post.underlineThickness for the font that is used to render text for the
run.


1.3.2.1.1.2.   If the font of the run does not have outline text metrics
(the font is a bitmap font), the underline thickness will be 1/10 of the
ascent size to the nearest pixel, but at least 1 pixel.


1.3.2.1.1.3.   The minimal thickness of the overline is 1 pixel.


1.4.            Superscript and subscript handling


1.4.1.    When superscript and subscript styles are applied the form
will be obtained by glyph substitution or algorithm (scaling font and
shifting baseline). The position and thickness are to be calculated by
using the font information before the font is scaled algorithmically. In
the case of glyph substitution for subscript and superscript the normal
font size will be used.


1.5.            Impact of zoom on underline, line-through and overline


1.5.1.    When zoom factors are applied to text the underline,
line-through and overline are determined by the results of the metrics
for the font after it has been scaled and selected. The values should
normally result from calling for metrics in the same way as when the
text is not zoomed.


 

 

Regards,

 

Paul Nelson

 

-----Original Message-----
From: www-style-request@w3.org [mailto:www-style-request@w3.org] On
Behalf Of Mikko Rantalainen
Sent: Tuesday, November 13, 2007 5:56 PM
To: www-style@w3.org
Subject: Re: [CSS3 Text] Text Decoration Section Drafted

 

Grant, Melinda wrote:

> fantasai said:

>> Just finished drafting the new text-decoration

>> (underline/overline/strike-through) section:

>>    http://dev.w3.org/csswg/css3-text/#line-decoration

>> 

>> Comments welcome.

> 

> http://dev.w3.org/csswg/css3-text/#line-decoration says that the UA 

> "must use the same baseline and thickness on each line."

> 

> I would think the thickness could vary within one line (as the example


> below illustrates.)  Maybe you want "text fragment" or some such...?

 

Perhaps the text is trying to say that in case the parent specifies a
line (e.g. underlining) and child has different font size and its own
declaration for the line (underlining), then there should not be two
different underlinings (one for the parent and one for the child) but
instead UA should decide between the two. I'm not sure which one should
be used.

 

I agree that the wording should be changed to be more exact.

 

--

Mikko

 

Received on Tuesday, 13 November 2007 22:04:11 UTC