Skip to content

Commit 149e9f1

Browse files
jfkthamefantasai
authored andcommitted
Add note re scripts to text-decoration-skip-ink
Given that there is not a single canonical algorithm for determining the boundaries of script runs in arbitrary text, and given that some implementor want to retain the freedom to make adjustments based on user feedback, I don't think we can or should currently specify precise, normative requirements for how `text-decoration-skip-ink` behaves down to the level of every individual character. However, the spec could usefully include a (non-normative) note to offer guidance to implementors. Here is some proposed text for consideration by the editors.
1 parent b708fef commit 149e9f1

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

css-text-decor-4/Overview.bs

+52-1
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,9 @@ Skipping Glyphs: the 'text-decoration-skip-ink' property</h4>
11031103
UAs <em>may</em> interrupt underlines and overlines
11041104
where the line would cross glyph ink
11051105
and to some distance to either side of the glyph outline.
1106+
UAs <em>should</em> consider the script of the text (see note below)
1107+
when determining whether to apply ink-skipping behavior to a given
1108+
range of content.
11061109

11071110
<dt><dfn value for="text-decoration-skip-ink">all</dfn></dt>
11081111
<dd>
@@ -1112,10 +1115,58 @@ Skipping Glyphs: the 'text-decoration-skip-ink' property</h4>
11121115

11131116
<dt><dfn value for="text-decoration-skip-ink">none</dfn></dt>
11141117
<dd>
1115-
UA must draw continuous underlines and overlines,
1118+
UA <em>must</em> draw continuous underlines and overlines,
11161119
without interruptions when they cross over a glyph.
11171120
</dl>
11181121

1122+
<div class="note">
1123+
Note: Implementation experience shows that ink-skipping behavior often
1124+
produces undesirable results when underlined text includes ideographic characters,
1125+
as the underline position (depending on the font and user agent involved)
1126+
often clashes with almost all the glyphs,
1127+
such that only occasional fragments of the line remain to be rendered.
1128+
1129+
In principle, this could be resolved by authors using
1130+
''text-underline-position: under'' (or possibly 'text-underline-offset')
1131+
to move the underline to a lower position that does not clash with the glyphs,
1132+
but this is not always feasible, even if the user agent supports these properties
1133+
and the author is aware of their potential.
1134+
In particular, when a page contains arbitrary user-generated content,
1135+
the author responsible for the design may not know whether CJK content will be present.
1136+
And with mixed-script content,
1137+
an underline position designed to work well for CJK content
1138+
may look bad if the majority of the text is non-CJK.
1139+
1140+
Therefore, when ''text-decoration-skip-ink/auto'' is in effect,
1141+
a UA that implements ink-skipping <em>should</em> refrain from doing so in CJK contexts.
1142+
(Authors who <em>do</em> want ink-skipping applied to CJK content can use
1143+
the ''text-decoration-skip-ink/always'' value to explicitly request this.)
1144+
1145+
Primarily, this means <em>not</em> applying ink-skipping for characters whose
1146+
Unicode <a href="http://unicode.org/Public/UCD/latest/ucd/Scripts.txt">Script property</a>
1147+
is any of the CJK scripts Han, Hiragana, Katakana, Bopomofo, or Hangul,
1148+
or for characters whose Script property is Inherited or Common,
1149+
and whose <a href="http://unicode.org/Public/UCD/latest/ucd/ScriptExtensions.txt">ScriptExtensions property</a>
1150+
includes one or more of the CJK scripts.
1151+
1152+
In addition, characters with a Unicode script property of Common and Inherited
1153+
(primarily generic punctuation and symbols) need to be considered,
1154+
as these may be used as part of a run of CJK-script content,
1155+
and it is desirable to treat all text within a given script run in a consistent way.
1156+
Therefore, the UA <em>should</em> resolve the text into script runs
1157+
as described in the <a href="https://www.unicode.org/reports/tr24/#Usage_Model">“Implementation Notes”</a>
1158+
of [[!UAX24]] “Unicode Script Property”, in particular subsections 5.1 and 5.2.
1159+
After applying the heuristics described there (or a similar analysis of scripts),
1160+
the UA <em>should</em> disable ink-skipping for all ranges of text
1161+
that are determined to be in a CJK script.
1162+
1163+
Issue: Are there other (non-CJK) scripts where it would be preferable
1164+
to disable ink-skipping by default
1165+
(when ''text-decoration-skip-ink/auto'' is in effect)?
1166+
Perhaps Yi? Arabic?
1167+
(See also discussion in <a href="https://github.com/w3c/csswg-drafts/issues/1288">Issue 1288</a>.)
1168+
</div>
1169+
11191170
<h4 id="ink-skip-shape">
11201171
Shaping Interruptions</h4>
11211172

0 commit comments

Comments
 (0)