csswg-drafts icon indicating copy to clipboard operation
csswg-drafts copied to clipboard

[css-ruby-1] Treatment of multiple Latin words in space-between & space-around

Open r12a opened this issue 8 years ago • 12 comments

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 avatar Nov 29 '16 17:11 r12a

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

upsuper avatar Dec 02 '16 01:12 upsuper

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

fantasai avatar Dec 07 '16 03:12 fantasai

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 avatar Feb 25 '20 15:02 r12a

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 https://github.com/w3c/clreq/issues/125

r12a avatar Feb 25 '20 15:02 r12a

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.

fantasai avatar Feb 02 '21 06:02 fantasai

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.

r12a avatar Feb 05 '21 17:02 r12a

For JLReq side:

  • There was one missing Note in English version of simple-ruby (filed as https://github.com/w3c/simple-ruby/issues/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 https://github.com/w3c/simple-ruby/issues/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.

himorin avatar Feb 15 '21 07:02 himorin

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?

fantasai avatar Jul 12 '22 19:07 fantasai

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

himorin avatar Jul 20 '22 09:07 himorin

Do you think this would solve the problem?

Seems good to me. Thanks.

r12a avatar Jul 20 '22 11:07 r12a

Additional notes from https://github.com/w3c/csswg-drafts/issues/779:

  • Also remove justification opportunities from bopomofo.

fantasai avatar Sep 13 '22 18:09 fantasai

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/w3c/csswg-drafts/issues/771#issuecomment-1182339573
<fantasai> https://github.com/w3c/csswg-drafts/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

css-meeting-bot avatar Oct 12 '22 16:10 css-meeting-bot

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

frivoal avatar Dec 28 '22 05:12 frivoal