Skip to content

[css-ruby-1] ruby overhang control #4492

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

Closed
stantonma opened this issue Nov 7, 2019 · 16 comments
Closed

[css-ruby-1] ruby overhang control #4492

stantonma opened this issue Nov 7, 2019 · 16 comments
Labels
Closed Accepted by CSSWG Resolution css-ruby-1 Current Work i18n-jlreq Japanese language enablement i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. Needs Testcase (WPT)

Comments

@stantonma
Copy link

We (Kindle) have received feedback from publishers that overhanging ruby can confuse younger readers since the annotation/pronunciation is no longer directly above the base character. We'd like to give publishers the option to disable ruby overhang for certain content types like children's books.

This could also let us define the JLREQ default overhang of one ruby text character length as the default.

Proposed addition would be:

Name ruby-overhang-limit
Value <length>
Initial 1em

Sets the maximum allowable overhang of ruby over allowable base characters. Length is relative to the ruby text font size.

@stantonma stantonma added the css-ruby-1 Current Work label Nov 7, 2019
@frivoal
Copy link
Collaborator

frivoal commented Nov 7, 2019

The current spec leaves the limit undefined and up to the UA. Which means implementations could possibly set it to 0 to disallow all overhang, and this seem to be what Firefox does.

Interestingly, disallowing overhand altogether is the recommendation of Professor Kobayashi as a good enough solution for general use (see list item number 4 in https://w3c.github.io/jlreq/docs/simple-ruby/#placement-of-mono-ruby-0 for mono-ruby, list item number 4 in https://w3c.github.io/jlreq/docs/simple-ruby/#placement-of-group-ruby-0 for group ruby, and list item number 4 in https://w3c.github.io/jlreq/docs/simple-ruby/#placement-of-jukugo-ruby-0 for jukugo ruby).

If disallowing overhand always is not acceptable, and we do introduce a property, I would therefore suggest that the initial value be auto (i.e. up to the UA, possibly 0) or 0 rather than 1em.

@himorin himorin added i18n-jlreq Japanese language enablement i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. labels Nov 7, 2019
@upsuper
Copy link
Member

upsuper commented Nov 13, 2019

Overhanging control is something tricky actually. It's not just a single limit, but a bunch of rules.

For example, WebKit allows overhanging up to 1/2 (or something close) character of the ruby text regardless of surrounding characters, which is fine. Another possible rule is to overhang up to one whole ruby text, but only over certain kinds of characters (kanas & punctuations IIRC). But you should never hang a whole ruby annotation on a kanji before or after. These rules cannot really be covered by a single distance.

@frivoal
Copy link
Collaborator

frivoal commented Nov 13, 2019

ruby-overhang: auto | none is probably a safe minimal subset. Whether we can eventually express different kinds of non-none behavior, with or without numeric parameters, is a separate question, but unless we're comfortable banning overhand always (which I don't think we are), having the ability to opt out of overhand seems useful (as evidenced by the reqests Amazon has been getting).

@upsuper
Copy link
Member

upsuper commented Nov 13, 2019

That sounds like a reasonable proposal.

@stantonma
Copy link
Author

Sounds reasonable to me as well, and would cover our use cases

@macnmm
Copy link

macnmm commented Nov 20, 2019

I am surprised at the example of jukugo ruby where overhang of Kanji is allowed so as to preserve base text spacing. I would think this is an optional behavior but the default is to prevent overhang on Kanji, and only allow on kana and aki. I think having these rules as part of the minimum requirements is desirable.

@stantonma
Copy link
Author

If we don't allow overhang within a Jukugo, then there would be no difference between if the author used a series of mono/group ruby right?

I'd prefer to leave that decision up to the UA by default (Kindle's implementation does allow it).

Though that does bring up if the property should apply to overhang within a Jukugo as well. I don't have any concern with saying it affects both cases.

@hftf
Copy link

hftf commented Nov 23, 2019

See also #3498.

@stantonma
Copy link
Author

Summarizing the comments above, I think we have this:

Name ruby-overhang
Values auto | none
Initial auto

Controls the overhang of the ruby annotation box on adjacent text to its corresponding ruby base box.

'auto'

  • The UA determines whether to overhang the ruby annotation box

'none'

  • The ruby annotation box must not overhang any adjacent boxes to its corresponding ruby base box.

This way the 'none' value covers overhang for mono/group as well as overhang within a jukugo ruby.

@macnmm is the JLTF ok to move forward with this? Kindle is ready to implement.

@macnmm
Copy link

macnmm commented Dec 18, 2019

@w3c/jlreq-editors ^^ see above question to me

@murata2makoto
Copy link

murata2makoto commented Jan 4, 2020

I recently read the editors' manual for magnified textbooks for low-vision. First, the font size for ruby appears to be 70%. Although 50% is used for junior high school textbooks, I doubt that the use of such small ruby is due to the cost and weight of magnified textbooks. Second, ruby-overhand is not used. But space between base characters is expanded.

If you can read Japanese, the editors' manual is very interesting. Even if you cannot, please have a look at examples in this page. The first figure shows a page of a usual textbook while the second shows the same page in a magnified textbook.

@frivoal
Copy link
Collaborator

frivoal commented Jan 7, 2020

@stantonma I think we should still allow overhang over ruby bases of a same ruby segment with ruby-overhang: none in the case where ruby-merge is a value other than separate. Other than that, I agree.

@murata2makoto good to see actual examples confirming that no-overhand is desired. As for spacing between the base characters, this can be done with rb { ruby-align: space-around; }.

@stantonma
Copy link
Author

stantonma commented Jan 11, 2020

@frivoal sounds reasonable, seems there's a bit of overlap here with ruby-merge actually. If we can say that ruby-merge: separate is equivalent to no overhang within a <ruby> we could switch the definition to only control the overhang on items adjacent to the <ruby> block.

If we want to keep overhang control within the <ruby> block, then I'd want keep control during ruby-merge:auto as well as separate.

@stantonma
Copy link
Author

Since it seems like ruby-merge does handle all cases of overhang between ruby bases, I think this property should only affect overhang outside of the ruby container box (as opposed to ruby base box). So with that the value for 'none' would be something like:

'none'

  • The ruby annotation box must remain entirely in the bounds of it's ruby container box

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-ruby-1] ruby overhang control, and agreed to the following:

  • RESOLVED: ruby-overhang auto | none on ruby container
The full IRC log of that discussion <Rossen__> Topic: [css-ruby-1] ruby overhang control
<Rossen__> github: https://github.com//issues/4492
<skk> I see https://github.com//issues/4419 on Text part 1 and Text part 2. Is this intentional?
<faceless> stanton: I'll introduce this
<Rossen__> s/stanton/stantonm/
<faceless> stanton: bit of background - in japanese text, in normal text all the characters are solid text - there is no space between the characters. Ruby allows this to change - if the ruby is longer than the base text, it can push spaces between the text.
<faceless> stanton: we've had feedback from authors that they don't always want to allow for this overhang. The overhang can cause confusion. We had feedback from JL task force and from younger users
<myles> q+
<faceless> stanton: proposal is to add a new property to disallow overhang. default we be auto which is the current behaviour. New value would be none which would disallow overhang outside the containing box?
<koji> -q
<Rossen__> ack koji
<Rossen__> ack myles
<faceless> myles: question - which element do you apply this property to?
<faceless> stanton: you could apply to document root but the one it would take effect on is the ruby tag
<faceless> myles: the proposal give the value a length?
<florian> q+
<faceless> stanton: the initial proposal was to be a bit more firm in the value of the value of overjang JLREQ and JIS recommend a value of 1, but none of the browsers actually do this
<faceless> stanton: the suggestion of auto was to allow more flxibility
<faceless> myles: a length seems to fine grained. florian suggests auto with none, I agree. Second best option maybe large/small. Third best is multiple of font-size. All better than a length
<faceless> stanton: auto and none fits the user cases we see from authors
<faceless> fantasai: agrees with myles. auto vs none. length would resolve against the root elements length
<Rossen__> ack florian
<faceless> florian: we may well have different approaches later, maybe clarify this later but for now, auto
<fantasai> s/clarify this/clarify this or add more values/
<faceless> rossen: so we are comfortable with auto and not-auto? any objections? NOne? Result.
<faceless> s/NOne/None/
<faceless> RESOLVED: ruby-overhang auto | none on ruby container

@fantasai
Copy link
Collaborator

Alright, I've committed changes to define ruby-overhang: auto | none. See https://drafts.csswg.org/css-ruby-1/#ruby-overhang

The exact rules for overhanging are left entirely to the UA.

Note that in the current model, the annotations don't leak out of the ruby container: the adjacent content is allowed to leak into the ruby container. (This ensures that no part of the ruby extends past the paragraph edges, and also ensures that any background on the ruby container extends behind all of its content.) If there's concerns about that, or any other details, please open a new issue.

JTensai pushed a commit to JTensai/csswg-drafts that referenced this issue May 13, 2020
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 i18n-jlreq Japanese language enablement i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. Needs Testcase (WPT)
Projects
None yet
Development

No branches or pull requests

10 participants