Open xfq opened 6 months ago
Note, the preferred position of emphasis marks depends on the language. In Japanese for example, the preferred position is over right. In Chinese, on the other hand, the preferred position is under right.
The specification looks like it's already specified, so it seems to be a bug in the Chrome implementation.
This is in a note (non-normative text), and IMO is for the author rather than the implementer.
So maybe the default UA stylesheet should include something like:
:lang(zh) { text-emphasis-position: under; }
Another option would be to define an auto
value that behaves in a language-dependent manner without requiring an explicit :lang
selector.
Alternatively, this is the responsibility of authors; the spec is just mentioning it for information.
Fwiw, i created an interactive test for this at https://github.com/w3c/character_phrase_tests/issues/67
I think this should probably happen by default – ie. not be the responsibility of authors, because otherwise they'd have to remember to add special styling for every document they produce with emphasis in it. Seems an unnecessary imposition.
Agreed that it should be specified, but I feel odd if we need to specify the default behavior for a specific language in a CSS spec. CSS specs should be more general.
Maybe clreq (https://www.w3.org/TR/clreq/#interlinear_annotations) is a better place?
So maybe the default UA stylesheet should include something like: ...
Appendix B: Default UA Stylesheet https://www.w3.org/TR/css-text-decor-4/#default-stylesheet has:
/* set language-appropriate default emphasis mark position */
:root:lang(zh), [lang|=zh] { text-emphasis-position: under right; }
[lang|=ja], [lang|=ko] { text-emphasis-position: over right; }
I haven't checked whether Blink has implemented this or not, sorry, but if not, this looks like an implementation issue.
Another option would be to define an auto value that behaves in a language-dependent manner without requiring an explicit :lang selector.
This seems like the better way to go.
Both clreq and the Appendix B of css-text-decor are non-normative. I still think normatively specifying the behavior would be useful, since it will affect conformance and will be covered by tests in wpt, so that the expected behaviour can be promoted.
We should probably make Appendix B normative, to the extent that it is Web-compatible. @kojiishi do you have any concerns with any of the rules, or should we propose this change?
Do we know which rules are web compatible and which are not?
@kojiishi, the following rules in Appendix B are already in the HTML spec's UA stylesheet:
s, strike, del {
text-decoration: line-through;
}
u, ins, :link, :visited {
text-decoration: underline;
}
abbr[title], acronym[title] {
text-decoration: dotted underline;
}
So those should be totally safe.
The rest is:
blink {
text-decoration-line: blink;
}
/* disable inheritance of text-emphasis marks to ruby text:
emphasis marks should only apply to base text */
rt { text-emphasis: none; }
/* set language-appropriate default emphasis mark position */
:root:lang(zh), [lang|=zh] { text-emphasis-position: under right; }
[lang|=ja], [lang|=ko] { text-emphasis-position: over right; }
/* set language-appropriate default underline position */
:root:lang(ja), [lang|=ja],
:root:lang(mn), [lang|=mn],
:root:lang(ko), [lang|=ko] { text-underline-position: right; }
:root:lang(zh), [lang|=zh] { text-underline-position: left; }
/* auto is chosen (implied) above instead of under
due to content-compatibility concerns */
This all seems likely to be safe to me, but I don't have data to back it up.
the following rules in Appendix B are already in the HTML spec's UA stylesheet
Nice, thank you for finding this. Then how about linking to it instead of duplicating?
For the rest, probably we shouldn't include blink
to sync with the HTML spec, but others look good to me.
For blink
, I don't really see an issue. Yes, it is considered obsolete by HTML, but HTML does occasionally include things in the UA stylesheet for obsolete elements (for example <xmp>
is obsolete too, but has rules in the UA stylesheet)
https://www.w3.org/TR/css-text-decor-4/#text-emphasis-position-property
The expectation is that for horizontal text browsers will, by default (ie. when
text-emphasis-position
is not set), position emphasis marks above Japanese text, but below Chinese text. Currently, this is not the case. See some tests.Not sure this should be specified in the CSS spec or the CSS user agent style sheet, so filing an issue here.