Skip to content

Commit a2dd9e1

Browse files
committed
[css-text-decor] Add more explanations to undefinedness of text decoration positions.
1 parent 9b6006c commit a2dd9e1

6 files changed

Lines changed: 148 additions & 56 deletions

File tree

css-text-decor/Overview.html

Lines changed: 90 additions & 40 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-06-10 name=dcterms.date>
13+
<meta content=2013-07-10 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=20130610>10 June
33+
class=dt-updated><span class=value-title title=20130710>10 July
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-20130610/">http://www.w3.org/TR/2013/WD-css-text-decor-3-20130610/</a></dd>
39+
<dd><a class="u-url" href="http://www.w3.org/TR/2013/WD-css-text-decor-3-20130710/">http://www.w3.org/TR/2013/WD-css-text-decor-3-20130710/</a></dd>
4040
-->
4141

4242
<dd><a class=u-url
@@ -870,7 +870,7 @@ <h3 id=text-underline-position-property><span class=secno>2.6. </span> Text
870870
<tr>
871871
<th><a href="#values">Value</a>:
872872

873-
<td>auto | alphabetic | [ under || [ left | right ] ]
873+
<td>auto | [ under || [ left | right ] ]
874874

875875
<tr>
876876
<th>Initial:
@@ -933,30 +933,22 @@ <h3 id=text-underline-position-property><span class=secno>2.6. </span> Text
933933

934934
<dd>The user agent may use any algorithm to determine the underline's
935935
position; however it must be placed at or under the alphabetic baseline.
936-
<p class=note>It is suggested that the underline position be ‘<code
937-
class=css>alphabetic</code>’ unless it crosses either subscripted (or
938-
otherwise lowered) text, or it affects characters from Asian scripts
939-
such as Han or Tibetan, for which an alphabetic underline is too high:
940-
in such cases, aligning to the em box edge as described for ‘<code
941-
class=css>under</code>’ is more appropriate.
942-
943-
<p class=issue>See also
944-
http://lists.w3.org/Archives/Public/www-style/2010Dec/0409.html
945-
946-
<dt><dfn id=underline-alphabetic
947-
title="text-underline-position: alphabetic"><code
948-
class=css>alphabetic</code></dfn>
949-
950-
<dd>The underline is positioned relative to the alphabetic baseline. In
951-
this case the underline is likely to cross some descenders.
936+
<p class=note>It is suggested that the default underline position be
937+
close to the alphabetic baseline, unless that would either cross
938+
subscripted (or otherwise lowered) text or draw over glyphs from Asian
939+
scripts such as Han or Tibetan for which an alphabetic underline is too
940+
high: in such cases, shifting the underline lower or aligning to the em
941+
box edge as described for ‘<code class=css>under</code>’ may be more
942+
appropriate.
943+
952944
<div class=figure>
953945
<p><img
954946
alt="In a typical Latin font, the underline is positioned slightly below the alphabetic baseline, leaving a gap between the line and the bottom of most Latin letters, but crossing through descenders such as the stem of a 'p'."
955947
src=underline-position-alphabetic.png
956948
title="text-underline-position: alphabetic">
957949

958-
<p class=caption><a href="#underline-alphabetic"><code
959-
class=css>text-underline-position: alphabetic</code></a>
950+
<p class=caption>A typical “alphabetic” underline is positioned just
951+
below the alphabetic baseline
960952
</div>
961953

962954
<dt><dfn id=underline-under
@@ -965,8 +957,8 @@ <h3 id=text-underline-position-property><span class=secno>2.6. </span> Text
965957

966958
<dd>The underline is positioned <i>under</i> the element's text content.
967959
In this case the underline usually does not cross the descenders. (This
968-
is sometimes called "accounting" underline.) This value can be combined
969-
with ‘<code class=css>left</code>’ or ‘<code
960+
is sometimes called accounting underline.) This value can be
961+
combined with ‘<code class=css>left</code>’ or ‘<code
970962
class=css>right</code>’ if a particular side is preferred in vertical
971963
writing modes.
972964
<div class=figure>
@@ -1040,9 +1032,67 @@ <h3 id=text-underline-position-property><span class=secno>2.6. </span> Text
10401032
</div>
10411033

10421034
<p>The exact position and thickness of line decorations is UA-defined in
1043-
this level. However, the UA must use a single thickness and position on
1044-
each line for the decorations deriving from a single <a
1045-
href="#decorating-box"><i>decorating box</i></a>. <!--
1035+
this level. However, for underlines and overlines the UA must use a single
1036+
thickness and position on each line for the decorations deriving from a
1037+
single <a href="#decorating-box"><i>decorating box</i></a>.
1038+
1039+
<div class=figure>
1040+
<p><img
1041+
alt="A single underline drawn under varying font sizes and vertical positions must be a single line."
1042+
src=underline-single.png> vs. <img
1043+
alt="Drawing multiple line segments, each with the position and thickness appropriate to the decorated text, is incorrect."
1044+
src=underline-broken.png>
1045+
1046+
<p class=caption>Correct and incorrect rendering of
1047+
<code>&lt;u>A&lt;sup>B&lt;/sup>&lt;big>C&lt;/big>D&lt;/u></code>
1048+
</div>
1049+
1050+
<div class=note>
1051+
<p>Note, since line decorations can span elements with varying font sizes
1052+
and vertical alignments, the best position for a line decoration is not
1053+
necessarily the ideal position dictated by the <a
1054+
href="#decorating-box"><i>decorating box</i></a>. For example, an
1055+
overline positioned to a small font will effectively become a
1056+
line-through if the element contains text in a significantly larger
1057+
font-size. Even for underlines, if the text is not aligned to the
1058+
alphabetic baseline (for example, in vertical typesetting styles, text is
1059+
aligned to the central baseline by default) an underline will cut through
1060+
descendant text of a larger font-size.
1061+
1062+
<div class=figure>
1063+
<p><img alt="" src=leftline-cross.png>
1064+
</div>
1065+
</div>
1066+
1067+
<p>UAs <em>must</em> adjust line positions to match the shifted metrics of
1068+
<a href="#decorating-box"><i>decorating boxes</i></a> positioned with
1069+
<code class=property>vertical-align</code><a href="#CSS21"
1070+
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> or subscripted/superscripted
1071+
via ‘<code class=property>font-variant-position</code><a
1072+
href="#CSS3-FONTS" rel=biblioentry>[CSS3-FONTS]<!--{{!CSS3-FONTS}}--></a>,
1073+
but <em>must not</em> adjust the line position or thickness in response to
1074+
descendants of a <a href="#decorating-box"><i>decorating box</i></a> that
1075+
are so styled. This allows superscripts and subscripts to be properly
1076+
decorated (underlined, struck through, etc.) but prevents them from
1077+
distorting or breaking the positioning of such decorations on their
1078+
ancestors.
1079+
1080+
<div class=figure>
1081+
<p><img
1082+
alt="An underline for just the superscript 'st' in '1st' is drawn just below the superscript, whereas an underline for the entire text is drawn at the appropriate position for full-size text."
1083+
src=underline-superscript.png>
1084+
1085+
<p class=caption>Example of underline applied to superscripted text vs.
1086+
underline applied to text containing a superscript
1087+
<!-- illustration code, for future alterations
1088+
<!DOCTYPE html>
1089+
<style>html { font: 2em Sawasdee; } big { font-size: 2em; }</style>
1090+
<u><span>A<sup>B</sup><big>C</big>D</span></u>
1091+
<u>A</u><sup><u>B</u></sup><big><u>C</u></big><u>D</u>
1092+
<u style='font-weight: bold'>1<sup><u>st</u></sup></u>
1093+
-->
1094+
</div>
1095+
<!--
10461096
<h3 id="line-position">
10471097
Determining the Position and Thickness of Line Decorations</h3>
10481098
@@ -1136,9 +1186,9 @@ <h3 id="line-position">
11361186
-->
11371187

11381188
<p>Some font formats (such as OpenType) can offer information about the
1139-
appropriate position of an underline. The UA should use such information
1140-
(such as the underline thickness, or appropriate alphabetic alignment)
1141-
from the font wherever appropriate. The same applies to line throughs.
1189+
appropriate position of a line decoration. The UA should use such
1190+
information (such as the underline thickness, or appropriate alphabetic
1191+
alignment) from the font wherever appropriate.
11421192

11431193
<p class=note>Typically, OpenType font metrics give the position of an
11441194
<code class=css>alphabetic</code>’ underline; in some cases
@@ -1955,6 +2005,16 @@ <h3 class=no-num id=normative-ref>Normative references</h3>
19552005
</dd>
19562006
<!---->
19572007

2008+
<dt id=CSS3-FONTS>[CSS3-FONTS]
2009+
2010+
<dd>John Daggett. <a
2011+
href="http://www.w3.org/TR/2013/WD-css3-fonts-20130212/"><cite>CSS Fonts
2012+
Module Level 3.</cite></a> 12 February 2013. W3C Working Draft. (Work in
2013+
progress.) URL: <a
2014+
href="http://www.w3.org/TR/2013/WD-css3-fonts-20130212/">http://www.w3.org/TR/2013/WD-css3-fonts-20130212/</a>
2015+
</dd>
2016+
<!---->
2017+
19582018
<dt id=CSS3-WRITING-MODES>[CSS3-WRITING-MODES]
19592019

19602020
<dd>Elika J. Etemad; Koji Ishii. <a
@@ -2014,16 +2074,6 @@ <h3 class=no-num id=informative-ref>Informative references</h3>
20142074
</dd>
20152075
<!---->
20162076

2017-
<dt id=CSS3-FONTS>[CSS3-FONTS]
2018-
2019-
<dd>John Daggett. <a
2020-
href="http://www.w3.org/TR/2013/WD-css3-fonts-20130212/"><cite>CSS Fonts
2021-
Module Level 3.</cite></a> 12 February 2013. W3C Working Draft. (Work in
2022-
progress.) URL: <a
2023-
href="http://www.w3.org/TR/2013/WD-css3-fonts-20130212/">http://www.w3.org/TR/2013/WD-css3-fonts-20130212/</a>
2024-
</dd>
2025-
<!---->
2026-
20272077
<dt id=CSS3COLOR>[CSS3COLOR]
20282078

20292079
<dd>Tantek Çelik; Chris Lilley; L. David Baron. <a

css-text-decor/Overview.src.html

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ <h3 id="text-underline-position-property">
552552
<td><dfn>text-underline-position</dfn>
553553
<tr>
554554
<th><a href="#values">Value</a>:
555-
<td>auto | alphabetic | [ under || [ left | right ] ]
555+
<td>auto | [ under || [ left | right ] ]
556556

557557
<tr>
558558
<th>Initial:
@@ -598,16 +598,14 @@ <h3 id="text-underline-position-property">
598598
<dd>The user agent may use any algorithm to determine the
599599
underline's position; however it must be placed at or under
600600
the alphabetic baseline.
601-
<p class="note">It is suggested that the underline position
602-
be ''alphabetic'' unless it crosses either subscripted (or
603-
otherwise lowered) text, or it affects characters from Asian
604-
scripts such as Han or Tibetan, for which an alphabetic
605-
underline is too high: in such cases, aligning to the em box
606-
edge as described for ''under'' is more appropriate.
607-
<p class="issue">See also http://lists.w3.org/Archives/Public/www-style/2010Dec/0409.html
608-
<dt><dfn id="underline-alphabetic" title="text-underline-position: alphabetic">''alphabetic''</dfn></dt>
609-
<dd>The underline is positioned relative to the alphabetic baseline. In
610-
this case the underline is likely to cross some descenders.
601+
<p class="note">It is suggested that the default underline position
602+
be close to the alphabetic baseline,
603+
unless that would either cross subscripted (or otherwise lowered) text
604+
or draw over glyphs from Asian scripts such as Han or Tibetan
605+
for which an alphabetic underline is too high:
606+
in such cases, shifting the underline lower
607+
or aligning to the em box edge as described for ''under''
608+
may be more appropriate.
611609
<div class="figure">
612610
<p><img title="text-underline-position: alphabetic"
613611
alt="In a typical Latin font, the underline is positioned slightly
@@ -616,12 +614,12 @@ <h3 id="text-underline-position-property">
616614
descenders such as the stem of a 'p'."
617615
src="underline-position-alphabetic.png"
618616
>
619-
<p class="caption">''text-underline-position: alphabetic''</p>
617+
<p class="caption">A typical “alphabetic” underline is positioned just below the alphabetic baseline
620618
</div>
621619
<dt><dfn id="underline-under" title="text-underline-position: under">''under''</dfn></dt>
622620
<dd>The underline is positioned <i>under</i> the element's text content.
623621
In this case the underline usually does not cross the descenders.
624-
(This is sometimes called "accounting" underline.)
622+
(This is sometimes called accounting underline.)
625623
This value can be combined with ''left'' or ''right''
626624
if a particular side is preferred in vertical writing modes.
627625
<div class="figure">
@@ -683,9 +681,54 @@ <h3 id="text-underline-position-property">
683681
</div>
684682

685683
<p>The exact position and thickness of line decorations is UA-defined in this level.
686-
However, the UA must use a single thickness and position on each line
684+
However, for underlines and overlines
685+
the UA must use a single thickness and position on each line
687686
for the decorations deriving from a single <i>decorating box</i>.
688687

688+
<div class="figure">
689+
<p><img src="underline-single.png"
690+
alt="A single underline drawn under varying font sizes and vertical positions must be a single line.">
691+
vs.
692+
<img src="underline-broken.png"
693+
alt="Drawing multiple line segments, each with the position and thickness appropriate to the decorated text, is incorrect.">
694+
<p class="caption">Correct and incorrect rendering of <code>&lt;u>A&lt;sup>B&lt;/sup>&lt;big>C&lt;/big>D&lt;/u></code>
695+
</div>
696+
697+
<div class="note">
698+
<p>Note, since line decorations can span elements with varying font sizes and
699+
vertical alignments, the best position for a line decoration is not
700+
necessarily the ideal position dictated by the <i>decorating box</i>.
701+
For example, an overline positioned to a small font
702+
will effectively become a line-through if the element contains text in a significantly larger font-size.
703+
Even for underlines, if the text is not aligned to the alphabetic baseline
704+
(for example, in vertical typesetting styles, text is aligned to the central baseline by default)
705+
an underline will cut through descendant text of a larger font-size.
706+
<div class="figure">
707+
<p><img src="leftline-cross.png" alt="">
708+
</div>
709+
</div>
710+
711+
<p>UAs <em>must</em> adjust line positions to match the shifted metrics of <i>decorating boxes</i> positioned with 'vertical-align' [[!CSS21]]
712+
or subscripted/superscripted via 'font-variant-position' [[!CSS3-FONTS]],
713+
but <em>must not</em> adjust the line position or thickness in response to descendants of a <i>decorating box</i> that are so styled.
714+
This allows superscripts and subscripts to be properly decorated
715+
(underlined, struck through, etc.)
716+
but prevents them from distorting or breaking the positioning of such decorations on their ancestors.
717+
718+
<div class="figure">
719+
<p><img src="underline-superscript.png"
720+
alt="An underline for just the superscript 'st' in '1st' is drawn just below the superscript,
721+
whereas an underline for the entire text is drawn at the appropriate position for full-size text.">
722+
<p class="caption">Example of underline applied to superscripted text vs. underline applied to text containing a superscript
723+
<!-- illustration code, for future alterations
724+
<!DOCTYPE html>
725+
<style>html { font: 2em Sawasdee; } big { font-size: 2em; }</style>
726+
<u><span>A<sup>B</sup><big>C</big>D</span></u>
727+
<u>A</u><sup><u>B</u></sup><big><u>C</u></big><u>D</u>
728+
<u style='font-weight: bold'>1<sup><u>st</u></sup></u>
729+
-->
730+
</div>
731+
689732
<!--
690733
<h3 id="line-position">
691734
Determining the Position and Thickness of Line Decorations</h3>
@@ -779,10 +822,9 @@ <h3 id="line-position">
779822
</div>
780823
-->
781824
<p>Some font formats (such as OpenType) can offer information
782-
about the appropriate position of an underline.
825+
about the appropriate position of a line decoration.
783826
The UA should use such information (such as the underline thickness,
784827
or appropriate alphabetic alignment) from the font wherever appropriate.
785-
The same applies to line throughs.
786828

787829
<p class="note">Typically, OpenType font metrics give the position of an ''alphabetic'' underline;
788830
in some cases (especially in CJK fonts), it gives the position of a ''under left'' underline.

css-text-decor/leftline-cross.png

1.96 KB
Loading
2.81 KB
Loading
2.81 KB
Loading
699 Bytes
Loading

0 commit comments

Comments
 (0)