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-ruby-1] Treatment of multiple Latin words in space-between & space-around #771

Closed
r12a opened this issue Nov 29, 2016 · 13 comments
Closed
Labels
Closed Accepted by CSSWG Resolution css-ruby-1 Current Work css-text-4 i18n-clreq Chinese language enablement i18n-jlreq Japanese language enablement i18n-needs-resolution Issue the Internationalization Group has raised and looks for a response on. Needs Testcase (WPT)

Comments

@r12a
Copy link
Contributor

r12a commented Nov 29, 2016

https://drafts.csswg.org/css-ruby-1/#valdef-ruby-align-space-between

I think it would be useful to have some text, and perhaps another illustration, showing what would happen if you have more than one word in narrow-cell annotations. For space-between, my assumption is that if you have a two word annotation in Latin script over a longer base, the left edge of the word on the left would be flush with the left edge of the base, and the rightmost character of the other word would be flush with the right edge of the longer item.

The question is what happens between the two words. That could leave a good sized gap in the middle, which is what Firefox does, or cause the browser to stretch the inter-character spacing in order to reduce the gap between the words, which is what Edge does. There is a test for this at:
https://www.w3.org/International/tests/repo/run?base=css-ruby-1&batch=css-ruby&test=ruby-align-property/ruby-align-space-between-104.html

Are either of those correct, or is just one appropriate, or is it specifically undefined? Either way, i think the spec should say something.

@r12a r12a added css-ruby-1 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. labels Nov 29, 2016
@upsuper
Copy link
Member

upsuper commented Dec 2, 2016

I think Edge's behavior looks better, but I have no idea how that can be speced.

@fantasai
Copy link
Collaborator

fantasai commented Dec 7, 2016

It's controlled by text-justify, so if the author or UA prefers inter-character spacing instead of inter-word, that can be specified.

@r12a r12a added i18n-needs-resolution Issue the Internationalization Group has raised and looks for a response on. and removed i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. labels Dec 8, 2016
@r12a
Copy link
Contributor Author

r12a commented Feb 25, 2020

For space-between, my assumption is that if you have a two word annotation in Latin script over a longer base, the left edge of the word on the left would be flush with the left edge of the base, and the rightmost character of the other word would be flush with the right edge of the longer item.

I'm starting to think that this assumption derived from the spec text is incorrect, and that multiple word annotations in Latin text would simply be centred just like single word annotations.

My previous assumption arose because of the mention of justification being applied. However, i'm inclined to think that justification is not appropriate if the annotation contains narrow characters (pinyin, english,... ) including spaces – the approach is simply to centre the text. That way, a space would not send two words to opposite sides of the annotation space.

Note that space-around is the default value for ruby-align, so i think this divergent behaviour needs to be specified as standard for this value.

Note that Firefox already does this by default if the language of the ruby element is zh-hans/t.

I guess it would be helpful to ask the jlreq & clreq folks to confirm the expected behaviour.

@r12a r12a added i18n-clreq Chinese language enablement i18n-jlreq Japanese language enablement labels Feb 25, 2020
@r12a
Copy link
Contributor Author

r12a commented Feb 25, 2020

I guess it would be helpful to ask the jlreq & clreq folks to confirm the expected behaviour.

For Chinese, the answer appears to be no justification is expected for multiple word annotations in narrow character text. See w3c/clreq#125

@fantasai
Copy link
Collaborator

fantasai commented Feb 2, 2021

I think we might want to specify explicitly that text-justify: auto, when applied in the context of a ruby annotation, does not offer a justification opportunity on space characters. This would get us the right behavior, and the author could opt into either inter-character or inter-word spacing explicitly if that was wanted.

For base text, though, I think it does need to be spaced out if the annotation is really long.

@r12a
Copy link
Contributor Author

r12a commented Feb 5, 2021

For base text, though, I think it does need to be spaced out if the annotation is really long.

Yes. This is only about ruby text.

@himorin
Copy link
Contributor

himorin commented Feb 15, 2021

For JLReq side:

  • There was one missing Note in English version of simple-ruby (filed as Add note "グループ ルビと欧文用間隔" into English version also simple-ruby#53), which states 'base or annotation with Western word space' (nearly equal to multi-word text) is out of scope.
  • In JIS X 4051, rule of justification between base text and annotation does not use Western word space as adjustment (see issue Add note "グループ ルビと欧文用間隔" into English version also simple-ruby#53).
  • Seems no definition in JLReq.
  • In JLReq, one note mentions a case of using far shorter annotation than base text, and a way to set maximum size of leading and trailing spacing as half of base character could be taken for preventing misleading appearance (to tell a correct range of ruby base). See attached figure also.
  • In certain case of Japanese digital publishing (list of demands item 155; only in Japanese; see background etc. in cover page), expanding Western word space for justification between base and annotation is included. (similar to one upper item, use Western word space characters for 1-2-1 spacing)
  • In discussion within JLReq TF, no strong desire was pointed, but could be similar tendency to CLReq one.
  • There are multiple difficult open questions, such as which ones (spaces between words or intercharacter points) to use for adjustment, to align leading and trailing between base and annotation (or to have spacing up to half of width of base character, etc.), and we'd keep out of scope.

fantasai added a commit that referenced this issue Feb 16, 2021
@fantasai
Copy link
Collaborator

Proposal:

  • Explicitly specify that text-justify: auto, in the context of a ruby annotation, does not offer a justification opportunity on space characters.
  • Authors can opt into either inter-character or inter-word spacing explicitly if that was wanted.
  • This does not apply to ruby base text.

@r12a @himorin Do you think this would solve the problem?

@himorin
Copy link
Contributor

himorin commented Jul 20, 2022

I believe text-justify: auto with no opportunity on space characters for multiple Latin words matches to demands of JL-TF, and also opt-in model matches with demands from digital publishing. So, I agree that proposal would solve the problem (and presented demands).

@r12a
Copy link
Contributor Author

r12a commented Jul 20, 2022

Do you think this would solve the problem?

Seems good to me. Thanks.

@fantasai
Copy link
Collaborator

fantasai commented Sep 13, 2022

Additional notes from #779:

  • Also remove justification opportunities from bopomofo.

@SebastianZ SebastianZ changed the title [css-ruby-1] Treament of multiple Latin words in space-between & space-around [css-ruby-1] Treatment of multiple Latin words in space-between & space-around Sep 14, 2022
@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed default alignment of ruby text, and agreed to the following:

  • RESOLVED: Add text-justify:ruby, which is like 'auto' but disables justification oppo on spaces and bopomofo.
  • RESOLVED: `rt, rtc { text-justify: ruby; }` to UA stylesheet
The full IRC log of that discussion <TabAtkins> Topic: default alignment of ruby text
<TabAtkins> github: https://github.com//issues/771#issuecomment-1182339573
<fantasai> https://github.com//issues/779
<TabAtkins> fantasai: ruby text, when you put it on base text, it has different default alignment. latin text and bopomofo is centered, but cjk ruby, if the annotation is smaller than base, it'll be justified
<TabAtkins> fantasai: Straightforward way to handle this is to say that ruby annotations are justified by default, and to adjust the jsutification opportunities
<TabAtkins> fantasai: In nromal text we allow spaces to stretch, and inter-character for CJK
<TabAtkins> fantasai: So if we create a justification method where sapces don't expand, but CJK still does, we'll get the intended behavior
<TabAtkins> fantasai: And then people who want a different behavior can use text-justify: inter-word or inter-character if they want it
<TabAtkins> fantasai: So proposal is to create this new jsutification mode
<TabAtkins> fantasai: One, we could say text-justify:auto on ruby annotation has special behavior,
<TabAtkins> fantasai: Two, we could introduce a new text-justify:ruby keyword, and use that in the UA stylesheet
<TabAtkins> fantasai: Probably introducing a new keyword is a little more straightforward for impls
<TabAtkins> Sounds reasonable to me, but I'm not a text ipmlementor. Also lean slightly toward new keyword.
<TabAtkins> florian: I agree
<TabAtkins> Rossen_: Can we have a res with a path forward, not open options?
<TabAtkins> fantasai: Yes, one or the other
<TabAtkins> Rossen_: So proposal to add new text-justify mode as a keyword
<TabAtkins> fantasai: Yes, add text-justify:ruby. It disables justification opportunities on spaces and bopomofo, but otherwise is like 'auto'
<TabAtkins> RESOLVED: Add text-justify:ruby, which is like 'auto' but disables justification oppo on spaces and bopomofo.
<TabAtkins> fantasai: Also need a reoslution to apply it to rt and rtc in UA stylesheet
<TabAtkins> Rossen_: Objections?
<TabAtkins> RESOLVED: `rt, rtc { text-justify: ruby; }` to UA stylesheet

@frivoal
Copy link
Collaborator

frivoal commented Dec 28, 2022

@r12a This has now been edited it. Review appreciated.

jakearchibald pushed a commit to jakearchibald/csswg-drafts that referenced this issue Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted by CSSWG Resolution css-ruby-1 Current Work css-text-4 i18n-clreq Chinese language enablement i18n-jlreq Japanese language enablement i18n-needs-resolution Issue the Internationalization Group has raised and looks for a response on. Needs Testcase (WPT)
Projects
None yet
Development

No branches or pull requests

7 participants