Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-text-decor] The emphasis marks should appear under horizontal Chinese text #10167

Open
xfq opened this issue Apr 2, 2024 · 13 comments
Open
Labels
css-text-decor-3 Current Work css-text-decor-4 i18n-clreq Chinese language enablement i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.

Comments

@xfq
Copy link
Member

xfq commented Apr 2, 2024

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.

@xfq xfq added css-text-decor-3 Current Work css-text-decor-4 i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. i18n-clreq Chinese language enablement labels Apr 2, 2024
@yisibl
Copy link
Contributor

yisibl commented Apr 2, 2024

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.

https://drafts.csswg.org/css-text-decor/#text-emphasis-position-property:~:text=Note%2C%20the%20preferred%20position

The specification looks like it's already specified, so it seems to be a bug in the Chrome implementation.

@xfq
Copy link
Member Author

xfq commented Apr 2, 2024

This is in a note (non-normative text), and IMO is for the author rather than the implementer.

@jfkthame
Copy link
Contributor

jfkthame commented Apr 2, 2024

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.

@r12a
Copy link
Contributor

r12a commented Apr 2, 2024

Fwiw, i created an interactive test for this at w3c/character_phrase_tests#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.

@xiaochengh
Copy link
Contributor

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?

@kojiishi
Copy link
Contributor

kojiishi commented Apr 8, 2024

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.

@yisibl
Copy link
Contributor

yisibl commented Apr 10, 2024

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.

@xfq
Copy link
Member Author

xfq commented Apr 11, 2024

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.

@fantasai
Copy link
Collaborator

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?

@kojiishi
Copy link
Contributor

Do we know which rules are web compatible and which are not?

@frivoal
Copy link
Collaborator

frivoal commented Apr 17, 2024

@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.

@kojiishi
Copy link
Contributor

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.

@frivoal
Copy link
Collaborator

frivoal commented Apr 18, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-text-decor-3 Current Work css-text-decor-4 i18n-clreq Chinese language enablement i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.
Projects
None yet
Development

No branches or pull requests

8 participants