Skip to content

Commit 9d6d9fa

Browse files
committed
[css-text-decor-4] Update text-underline-position/text-underline-offset per #3118 (comment)
1 parent 5ee2cf9 commit 9d6d9fa

File tree

1 file changed

+47
-35
lines changed

1 file changed

+47
-35
lines changed

css-text-decor-4/Overview.bs

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -467,17 +467,16 @@ Text Underline Position: the 'text-underline-position' property</h3>
467467

468468
<pre class="propdef">
469469
Name: text-underline-position
470-
Value: auto | [ under || [ left | right ] ]
470+
Value: auto | [ from-font | under ] || [ left | right ]
471471
Initial: auto
472472
Inherited: yes
473473
Computed value: specified keyword(s)
474474
Animation type: discrete
475475
</pre>
476476

477-
This property sets the position of an underline with respect to the element.
478-
(It does not affect underlines specified by ancestor elements.)
479-
The exact position of the underline can be further adjusted
480-
with 'text-underline-position'.
477+
This property sets the position of an underline with respect to the element,
478+
and sets its [=zero position=] for further adjustment by 'text-underline-offset'.
479+
It does not affect underlines specified by ancestor elements.
481480

482481
<div class="example">
483482
The following example styles modern Chinese, Japanese, and Korean
@@ -519,6 +518,13 @@ Text Underline Position: the 'text-underline-position' property</h3>
519518
<p class="caption">A typical “alphabetic” underline is positioned just below the alphabetic baseline
520519
</div>
521520

521+
<dt><dfn>from-font</dfn>
522+
<dd>
523+
If the <a>first available font</a> has
524+
metrics indicating a preferred underline offset,
525+
use that offset,
526+
otherwise behaves as ''text-underline-offset/auto''.
527+
522528
<dt><dfn id="underline-under">under</dfn>
523529
<dd>
524530
The underline is positioned <i>under</i> the element's text content.
@@ -596,7 +602,7 @@ Text Underline Offset: the 'text-underline-offset' property</h3>
596602

597603
<pre class="propdef">
598604
Name: text-underline-offset
599-
Value: auto | from-font | <<length>>
605+
Value: auto | <<length>>
600606
Initial: auto
601607
Applies to: all elements
602608
Inherited: yes
@@ -606,29 +612,28 @@ Text Underline Offset: the 'text-underline-offset' property</h3>
606612
</pre>
607613

608614
This property, which is <em>not</em> a <a>sub-property</a> of the 'text-decoration' shorthand,
609-
sets the offset of underlines from their initial position.
615+
sets the offset of underlines from their [=zero position=].
616+
Positive offsets represent distances outward from the text;
617+
negative offsets inward.
610618

611619
Values have the following meanings:
612620

613621
<dl dfn-for=text-underline-offset dfn-type=value>
614622
<dt><dfn>auto</dfn>
615623
<dd>
616-
The UA chooses an appropriate offset for underlines.
624+
<p>The UA chooses an appropriate offset for underlines.
617625

618-
<dt><dfn>from-font</dfn>
619-
<dd>
620-
If the <a>first available font</a> has
621-
metrics indicating a preferred underline offset,
622-
use that offset,
623-
otherwise behaves as ''text-underline-offset/auto''.
626+
However, this offset must be zero
627+
if ''text-underline-position/from-font'' was specified
628+
and the UA was able to extract an appropriate metric to use
629+
from the font.
624630

625631
<dt><dfn><<length>>
626632
<dd>
627-
Specifies the offset of underlines as a length.
628-
This replaces any information in the font
629-
or derived from glyph shapes / character ranges.
630-
Authors are strongly encouraged to use ''em'' units
631-
so that the offset scales with the font.
633+
<p>Specifies the offset of underlines as a fixed length.
634+
635+
Note: A length will inherit as a fixed value,
636+
and will not scale with the font.
632637
</dl>
633638
634639
When the value of the 'text-decoration-line' property is either
@@ -638,40 +643,45 @@ Text Underline Offset: the 'text-underline-offset' property</h3>
638643
<h4 id="line-offset-zero">
639644
Underline Offset Origin (Zero Position)</h4>
640645
641-
The initial position of the underline depends on the value of 'text-underline-position'
646+
The <dfn lt="underline zero position" local-lt="zero position">zero position</dfn> of the underline
647+
depends on the value of 'text-underline-position'
642648
as detailed below.
643649

644650
<table class="data">
645651
<caption>Interaction of 'text-underline-position' and 'text-underline-offset'
646652
<thead>
647653
<tr>
648654
<th>'text-underline-position'
649-
<th>Initial Position
655+
<th>Zero Position
650656
<th>Positive Direction
651657
<tbody>
652658
<tr>
653659
<td>''text-underline-position/auto''
654660
<td>alphabetic baseline
655-
<td><a>over</a>
661+
<td><a>under</a>
662+
<tr>
663+
<td>''text-underline-position/from-font''
664+
<td>position specified by the font metrics, falling back to alphabetic baseline
665+
<td><a>under</a>
656666
<tr>
657667
<td>''text-underline-position/under''
658668
<td>text-under edge
659-
<td><a>over</a>
669+
<td><a>under</a>
660670
<tr>
661-
<td>''text-underline-position/over''
662-
<td>text-over edge
671+
<td>''text-underline-position/left''
672+
<td>text-under (left) edge
663673
<td><a>under</a>
674+
<tr>
675+
<td>''text-underline-position/right''
676+
<td>text-over (right) edge
677+
<td><a>over</a>
664678
</table>
665679

666-
<ul>
667-
<li>The line is aligned to the outside of the specified position.
668-
(Below for ''text-underline-position/under''/''text-underline-position/auto'' positions,
669-
above for ''text-underline-position/over''.)
670-
<li>Positive lengths represent inward distances; negative lengths outward.
671-
<li>Automatic adjustments made to accommodate descendant content are maintained;
672-
the 'text-underline-offset' is in addition to those.
673-
<span class="issue">Should this be removed?</span>
674-
</ul>
680+
The underline is aligned to the outside of the specified position
681+
(extending its thickness in the positive direction only).
682+
683+
Any automatic adjustments made to accommodate descendant content are maintained;
684+
the 'text-underline-offset' is in addition to those.
675685

676686
<h4 id="line-auto-offset">
677687
Using Font Metrics for Automatic Positioning</h4>
@@ -680,7 +690,9 @@ Using Font Metrics for Automatic Positioning</h4>
680690
about the appropriate position of a line decoration.
681691
The UA should use such font-based information
682692
in its choice of ''text-underline-offset/auto'' offset
683-
wherever appropriate.
693+
wherever appropriate,
694+
and must use such information
695+
when ''text-underline-position/from-font'' is specified for 'text-underline-position'.
684696

685697
Note: Typically, OpenType font metrics give the position
686698
of an ''text-underline-position/alphabetic'' underline;

0 commit comments

Comments
 (0)