Skip to content

Commit bf626d9

Browse files
committed
[css-text-decor] Attempt to clarify underline position calculations.
--HG-- extra : rebase_source : 235927c0c811bf9ec78a9f90e93499177439b2e9
1 parent 7e6bd98 commit bf626d9

4 files changed

Lines changed: 104 additions & 96 deletions

File tree

css-text-decor/Overview.html

Lines changed: 70 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
rel=dcterms.rights>
1111
<meta content="CSS Text Decoration Module Level 3" name=dcterms.title>
1212
<meta content=text name=dcterms.type>
13-
<meta content=2013-04-18 name=dcterms.date>
13+
<meta content=2013-05-07 name=dcterms.date>
1414
<meta content="Elika J. Etemad" name=dcterms.creator>
1515
<meta content="Koji Ishii" name=dcterms.creator>
1616
<meta content=W3C name=dcterms.publisher>
@@ -30,13 +30,13 @@
3030
<h1 class=p-name>CSS Text Decoration Module Level 3</h1>
3131

3232
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft <span
33-
class=dt-updated><span class=value-title title=20130418>18 April
33+
class=dt-updated><span class=value-title title=20130507> 7 May
3434
2013</span></span></h2>
3535

3636
<dl>
3737
<dt>This version:</dt>
3838
<!--
39-
<dd><a class="u-url" href="http://www.w3.org/TR/2013/WD-css-text-decor-3-20130418/">http://www.w3.org/TR/2013/WD-css-text-decor-3-20130418/</a></dd>
39+
<dd><a class="u-url" href="http://www.w3.org/TR/2013/WD-css-text-decor-3-20130507/">http://www.w3.org/TR/2013/WD-css-text-decor-3-20130507/</a></dd>
4040
-->
4141

4242
<dd><a class=u-url
@@ -478,27 +478,25 @@ <h3 id=text-decoration-line-property><span class=secno>2.1. </span> Text
478478
Values have the following meanings:
479479

480480
<dl>
481-
<dt><dfn id=lsquononersquo title="text-decoration-line:none"><code
481+
<dt><dfn id=none title="text-decoration-line:none"><code
482482
class=css>none</code></dfn>
483483

484484
<dd>Neither produces nor inhibits text decoration.
485485

486-
<dt><dfn id=lsquounderlinersquo><code
487-
class=css>underline</code></dfn>
486+
<dt><dfn id=underline><code class=css>underline</code></dfn>
488487

489488
<dd>Each line of text is underlined.
490489

491-
<dt><dfn id=lsquooverlinersquo><code class=css>overline</code></dfn>
490+
<dt><dfn id=overline><code class=css>overline</code></dfn>
492491

493492
<dd>Each line of text has a line over it (i.e. on the opposite side from
494493
an underline).
495494

496-
<dt><dfn id=lsquoline-throughrsquo><code
497-
class=css>line-through</code></dfn>
495+
<dt><dfn id=line-through><code class=css>line-through</code></dfn>
498496

499497
<dd>Each line of text has a line through the middle.
500498

501-
<dt><dfn id=lsquoblinkrsquo><code class=css>blink</code></dfn>
499+
<dt><dfn id=blink><code class=css>blink</code></dfn>
502500

503501
<dd> The text blinks (alternates between visible and invisible).
504502
Conforming user agents may simply not blink the text. Note that not
@@ -780,20 +778,19 @@ <h3 id=text-decoration-skip-property><span class=secno>2.5. </span> Text
780778
drawn by its ancestors. Values have the following meanings:
781779

782780
<dl>
783-
<dt><dfn id=lsquononersquo0 title="text-decoration-skip:none"><code
781+
<dt><dfn id=none0 title="text-decoration-skip:none"><code
784782
class=css>none</code></dfn>
785783

786784
<dd>Skip nothing: text-decoration is drawn for all text content and across
787785
atomic inline-level boxes.
788786

789-
<dt><dfn id=lsquoobjectsrsquo
790-
title="text-decoration-skip:objects"><code
787+
<dt><dfn id=objects title="text-decoration-skip:objects"><code
791788
class=css>objects</code></dfn>
792789

793790
<dd>Skip this element (its entire margin box) if it is an atomic inline
794791
(such as an image or inline-block).
795792

796-
<dt><dfn id=lsquospacesrsquo title="text-decoration-skip:spaces"><code
793+
<dt><dfn id=spaces title="text-decoration-skip:spaces"><code
797794
class=css>spaces</code></dfn>
798795

799796
<dd>Skip all spacing, i.e. all <a href="#character"><i>characters</i></a>
@@ -802,7 +799,7 @@ <h3 id=text-decoration-skip-property><span class=secno>2.5. </span> Text
802799
characters</i>, plus any adjacent letter-spacing or word-spacing <a
803800
href="#CSS3TEXT" rel=biblioentry>[CSS3TEXT]<!--{{!CSS3TEXT}}--></a>.
804801

805-
<dt><dfn id=lsquoinkrsquo title="text-decoration-skip:ink"><code
802+
<dt><dfn id=ink title="text-decoration-skip:ink"><code
806803
class=css>ink</code></dfn>
807804

808805
<dd>Skip over where glyphs are drawn: interrupt the decoration line to let
@@ -817,7 +814,7 @@ <h3 id=text-decoration-skip-property><span class=secno>2.5. </span> Text
817814
<p class=caption><code class=css>text-decoration-skip: ink</code>
818815
</div>
819816

820-
<dt><dfn id=lsquoedgesrsquo title="text-decoration-skip:edges"><code
817+
<dt><dfn id=edges title="text-decoration-skip:edges"><code
821818
class=css>edges</code></dfn>
822819

823820
<dd>The UA should place the start and end of the line inwards slightly
@@ -835,7 +832,7 @@ <h3 id=text-decoration-skip-property><span class=secno>2.5. </span> Text
835832
<code>&lt;u>石井&lt;/u>&lt;u>艾俐俐&lt;/u></code>
836833
</div>
837834

838-
<dt><dfn id=lsquobox-decorationrsquo
835+
<dt><dfn id=box-decoration
839836
title="text-decoration-skip:box-decoration"><code
840837
class=css>box-decoration</code></dfn>
841838

@@ -1041,11 +1038,17 @@ <h3 id=text-underline-position-property><span class=secno>2.6. </span> Text
10411038
<h3 id=line-position><span class=secno>2.7. </span> Determining the
10421039
Position and Thickness of Line Decorations</h3>
10431040

1044-
<p>In determining the position of text decoration lines, user agents must
1045-
consider, per line box, the "ideal" positions of all fragments of in-flow
1046-
inline descendants of the <a href="#decorating-box"><i>decorating
1047-
box</i></a> on that line as follows (treating <a
1048-
href="#underline-left"><i>over</i>-positioned underlines</a> as
1041+
<p>Since line decorations can span elements with varying font sizes and
1042+
vertical alignments, the best position for a line decoration is not
1043+
necessarily the ideal position dictated by the decorating element. In
1044+
determining the position of text decoration lines, user agents must
1045+
consider, per line box, the “ideal” positions of such line decorations
1046+
per fragment of the <a href="#decorating-box"><i>decorating
1047+
box</i></a>—or its in-flow inline descendant—that draws the text
1048+
decoration.
1049+
1050+
<p> The line decoration positions are then calculated as follows (treating
1051+
<a href="#underline-left"><i>over</i>-positioned underlines</a> as
10491052
<i>over</i> lines and <a href="#underline-left"><i>under</i>-positioned
10501053
overlines</a> as <i>under</i> lines):
10511054

@@ -1061,14 +1064,16 @@ <h3 id=line-position><span class=secno>2.7. </span> Determining the
10611064

10621065
<dt><a href="#underline-alphabetic"><i>alphabetic</i></a> underlines
10631066

1064-
<dd> Calculate an average of the ideal underlining offsets (from their
1065-
respective alphabetic baselines) of the considered fragments, assigning
1066-
any inline with non-initial ‘<code
1067-
class=property>vertical-align</code>’ the ideal offset of its parent.
1068-
Align the line decoration to the lowest alphabetic baseline considered,
1069-
with that calculated offset. (Alphabetic baselines can differ between
1070-
<code class=css>baseline</code>’-aligned boxes if the dominant
1071-
baseline is non-alphabetic.)
1067+
<dd>
1068+
<p>The alphabetic underline position is calculated by taking the ideal
1069+
offset (from the alphabetic baseline) of each considered fragment,
1070+
averaging those, and then using the lowest alphabetic baseline to
1071+
actually position the line. (Alphabetic baselines can differ between
1072+
<code class=css>baseline</code>’-aligned boxes if the dominant
1073+
baseline is non-alphabetic.) To prevent superscripts and subscripts from
1074+
throwing this position off-kilter, an inline with a non-initial computed
1075+
<code class=property>vertical-align</code>’ is treated as having
1076+
the ideal underline position of their parent.
10721077

10731078
<dt>non-alphabetic <a
10741079
href="http://dev.w3.org/csswg/css3-writing-modes/#under"><i>under</i></a>
@@ -1081,17 +1086,17 @@ <h3 id=line-position><span class=secno>2.7. </span> Determining the
10811086

10821087
<dt>line-throughs
10831088

1084-
<dd> For each set of considered fragments with the same ‘<code
1089+
<dd> Line-throughs essentially use the same sort of averaging as for
1090+
alphabetic underlines, but recompute the position when drawing across a
1091+
descendant with a different computed ‘<code
1092+
class=property>font-size</code>’. (This ensures that the text remains
1093+
effectively “crossed out” despite any font size changes.) For each
1094+
set of considered fragments with the same ‘<code
10851095
class=property>font-size</code>’, compute an ideal position averaged
1086-
from their direct contents and font metrics, assigning any fragment with
1096+
from their direct contents and font metrics (assigning any fragment with
10871097
non-initial ‘<code class=property>vertical-align</code>’ the ideal
1088-
position of its parent. Position the portion of the line across each
1089-
decorated fragment at that fragment's ideal position. (Essentially, this
1090-
performs the same sort of averaging as for alphabetic underlines, but
1091-
recomputes the position when drawing across a descendant with a different
1092-
computed ‘<code class=property>font-size</code>’. This ensures that
1093-
the text remains effectively "crossed out" despite any font size
1094-
changes.)
1098+
position of its parent). Position the portion of the line across each
1099+
decorated fragment at that position.
10951100
</dl>
10961101

10971102
<p> CSS does not define the thickness of line decorations. In determining
@@ -1120,18 +1125,18 @@ <h3 id=line-position><span class=secno>2.7. </span> Determining the
11201125
shift, has no effect on the position of the line.
11211126
</div>
11221127

1123-
<div class=note>
1124-
<p>In some cases (such as in OpenType) the font format can offer
1125-
information about the appropriate position of an underline. Typically
1126-
this information gives the position of an ‘<code
1127-
class=css>alphabetic</code>’ underline; in some cases (especially in
1128-
CJK fonts), it gives the position of a ‘<code class=css>under
1129-
left</code>’ underline. (In this case, the font's underline metrics
1130-
typically touch the bottom edge of the em box). The UA is encouraged to
1131-
use information (such as the underline thickness, or appropriate
1132-
alphabetic alignment) from the font wherever appropriate. The same
1133-
applies to line throughs.
1134-
</div>
1128+
<p>Some font formats (such as OpenType) can offer information about the
1129+
appropriate position of an underline. The UA is encouraged to use
1130+
information (such as the underline thickness, or appropriate alphabetic
1131+
alignment) from the font wherever appropriate. The same applies to line
1132+
throughs.
1133+
1134+
<p class=note>Typically, OpenType font metrics give the position of an
1135+
<code class=css>alphabetic</code>’ underline; in some cases
1136+
(especially in CJK fonts), it gives the position of a ‘<code
1137+
class=css>under left</code>’ underline. (In this case, the font's
1138+
underline metrics typically touch the bottom edge of the em box). The UA
1139+
may but is not required to correct for incorrect font metrics.
11351140

11361141
<h2 id=emphasis-marks><span class=secno>3. </span> Emphasis Marks</h2>
11371142

@@ -1206,58 +1211,57 @@ <h3 id=text-emphasis-style-property><span class=secno>3.1. </span> Emphasis
12061211
the following meanings:
12071212

12081213
<dl>
1209-
<dt><dfn id=lsquononersquo1 title="text-emphasis:none"><code
1214+
<dt><dfn id=none1 title="text-emphasis:none"><code
12101215
class=css>none</code></dfn>
12111216

12121217
<dd>No emphasis marks.
12131218

1214-
<dt><dfn id=lsquofilledrsquo title="text-emphasis:filled"><code
1219+
<dt><dfn id=filled title="text-emphasis:filled"><code
12151220
class=css>filled</code></dfn>
12161221

12171222
<dd>The shape is filled with solid color.
12181223

1219-
<dt><dfn id=lsquoopenrsquo title="text-emphasis:open"><code
1224+
<dt><dfn id=open title="text-emphasis:open"><code
12201225
class=css>open</code></dfn>
12211226

12221227
<dd>The shape is hollow.
12231228

1224-
<dt><dfn id=lsquodotrsquo title="text-emphasis:dot"><code
1229+
<dt><dfn id=dot title="text-emphasis:dot"><code
12251230
class=css>dot</code></dfn>
12261231

12271232
<dd>Display small circles as marks. The filled dot is U+2022 ‘<code
12281233
class=css></code>’, and the open dot is U+25E6 ‘<code
12291234
class=css></code>’.
12301235

1231-
<dt><dfn id=lsquocirclersquo title="text-emphasis:circle"><code
1236+
<dt><dfn id=circle title="text-emphasis:circle"><code
12321237
class=css>circle</code></dfn>
12331238

12341239
<dd>Display large circles as marks. The filled circle is U+25CF ‘<code
12351240
class=css></code>’, and the open circle is U+25CB ‘<code
12361241
class=css></code>’.
12371242

1238-
<dt><dfn id=lsquodouble-circlersquo
1239-
title="text-emphasis:double-circle"><code
1243+
<dt><dfn id=double-circle title="text-emphasis:double-circle"><code
12401244
class=css>double-circle</code></dfn>
12411245

12421246
<dd>Display double circles as marks. The filled double-circle is U+25C9
12431247
<code class=css></code>’, and the open double-circle is U+25CE
12441248
<code class=css></code>’.
12451249

1246-
<dt><dfn id=lsquotrianglersquo title="text-emphasis:triangle"><code
1250+
<dt><dfn id=triangle title="text-emphasis:triangle"><code
12471251
class=css>triangle</code></dfn>
12481252

12491253
<dd>Display triangles as marks. The filled triangle is U+25B2 ‘<code
12501254
class=css></code>’, and the open triangle is U+25B3 ‘<code
12511255
class=css></code>’.
12521256

1253-
<dt><dfn id=lsquosesamersquo title="text-emphasis:sesame"><code
1257+
<dt><dfn id=sesame title="text-emphasis:sesame"><code
12541258
class=css>sesame</code></dfn>
12551259

12561260
<dd>Display sesames as marks. The filled sesame is U+FE45 ‘<code
12571261
class=css></code>’, and the open sesame is U+FE46 ‘<code
12581262
class=css></code>’.
12591263

1260-
<dt><dfn id=lsquoltstringgtrsquo title="text-emphasis:sesame"><code
1264+
<dt><dfn id=ltstringgt title="text-emphasis:sesame"><code
12611265
class=css><var>&lt;string&gt;</var></code></dfn>
12621266

12631267
<dd>Display the given string as marks. Authors should not specify more
@@ -1357,7 +1361,7 @@ <h3 id=text-emphasis-color-property><span class=secno>3.2. </span> Emphasis
13571361

13581362
<p>This property specifies the foreground color of the emphasis marks.
13591363

1360-
<p class=note> The <dfn id=lsquocurrentcolorrsquo><code
1364+
<p class=note> The <dfn id=currentcolor><code
13611365
class=css>currentcolor</code></dfn> keyword computes to itself and is
13621366
resolved to the value of ‘<code class=property>color</code>’ after
13631367
inheritance is performed. This means ‘<a
@@ -1490,22 +1494,22 @@ <h3 id=text-emphasis-position-property><span class=secno>3.4. </span>
14901494
have following meanings:
14911495

14921496
<dl>
1493-
<dt><dfn id=lsquooverrsquo title="text-emphasis:over"><code
1497+
<dt><dfn id=over title="text-emphasis:over"><code
14941498
class=css>over</code></dfn>
14951499

14961500
<dd>Draw marks over the text in horizontal writing mode.
14971501

1498-
<dt><dfn id=lsquounderrsquo title="text-emphasis:under"><code
1502+
<dt><dfn id=under title="text-emphasis:under"><code
14991503
class=css>under</code></dfn>
15001504

15011505
<dd>Draw marks under the text in horizontal writing mode.
15021506

1503-
<dt><dfn id=lsquorightrsquo title="text-emphasis:right"><code
1507+
<dt><dfn id=right title="text-emphasis:right"><code
15041508
class=css>right</code></dfn>
15051509

15061510
<dd>Draw marks to the right of the text in vertical writing mode.
15071511

1508-
<dt><dfn id=lsquoleftrsquo title="text-emphasis:left"><code
1512+
<dt><dfn id=left title="text-emphasis:left"><code
15091513
class=css>left</code></dfn>
15101514

15111515
<dd>Draw marks to the left of the text in vertical writing mode.

0 commit comments

Comments
 (0)