w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.43k stars 656 forks source link

[css-ruby] Alignment of bopomofo #1907

Open upsuper opened 6 years ago

upsuper commented 6 years ago

In an early email, I raised that the default value of ruby-align is not desirable for bopomofo:

In the current spec, ruby-align has a default value "space-around". This value is the usual behavior for Japanese, and is fine for pinyin since it is just like Latin words. But this value is not fine for bopomofo.

There are justification opportunities between bopomofo characters, just like other Chinese/Japanese characters. But if we have "ruby-align: space-around" on them, we will get an undesirable result, because bopomofo is generally centered when in annotations.

Hence I propose that we add an "auto" value to ruby-align, and make it default. UA may choose a proper value for it. It may behave as "center" in Chinese locales, and "space-around" otherwise.

Or alternatively, I guess we can solve it as a rule in the default style sheet like: ruby:lang(zh) { ruby-align: center; }

From the minutes of 2015 Sydney meeting, the group somehow resolved to:

fantasai: 1) Change initial value to center. Reset it for Japanese to be space-around in the UA stylesheet. fantasai: 2) Keep it as space-around, reset it for Chinese to center. fantasai: 3) Have a value that does custom justifications - auto - which justifies between Han and Kana, and not between bopomofo. ... RESOLVED: Either option 1 or 3 for ruby-position, at editor's discretion.

This doesn't seem to match what the spec is currently saying, actually. The current spec has space-around as the default value of ruby-align, and use default style sheet to set it to center for Chinese element, and I failed to figure out how do we actually get here.

In a later reply from @kojiishi, he said:

So, not 1 please.

I think the question is how to justify Bopomofo, rather than the default value of ruby-align.

This real-world page[2] indicates that Bopomofo is a space-delimited scripts, so I'm guessing we do not want justify between Bopomofo, similar to Korean, where Hanja justifies between letters while Hangul does not.

I would love to see if there were any real example of justified Bopomofo, but IIUC Richard has been trying that without success, even for single example.

which sounds like another solution to this problem is that, we make bopomofo not justifiable, so that we don't need any additional rule for ruby-align on Chinese, and all languages would just work fine with the default value space-around of ruby-align.

upsuper commented 6 years ago

(This may not an issue for current spec, but I file this issue to track whether the alternative solution may make more sense.)

patrickdark commented 6 years ago

Seems easiest to fix this through a UA stylesheet with CSS4 Selectors :lang pseudo-classes:

rtc:lang("*-bopo"),
rtc:lang("*-hani"),
rtc:lang("*-hans"),
rtc:lang("*-hant"),
rt:lang("*-bopo"),
rt:lang("*-hani"):not(:lang("ja")),
rt:lang("*-hans"):not(:lang("ja")),
rt:lang("*-hant"):not(:lang("ja")) {
    ruby-align: center;
} 
rtc:lang("*-hira"),
rtc:lang("*-hrkt"),
rtc:lang("*-jpan"),
rtc:lang("*-kana"),
rtc:lang("ja-hani"),
rtc:lang("ja-hans"),
rtc:lang("ja-hant"),
rt:lang("*-hira"),
rt:lang("*-hrkt"),
rt:lang("*-jpan"),
rt:lang("*-kana"),
rt:lang("ja-hani"),
rt:lang("ja-hans"),
rt:lang("ja-hant") {
    ruby-align: space-around;
}

Of course, you only need one of these depending on what the default keyword turns out to be. center seems to be the best default if one is looking at ruby as a script-agnostic feature.

upsuper commented 6 years ago

The spec has been using this approach. The question is whether this is what we really want.

Koji pointed out that we may not want to insert justification opportunities between bopomofo, in which case we would not need the UA stylesheet rule at all.

patrickdark commented 6 years ago

Ah, I see. "Justification opportunities" is a Ruby spec key term.

The spacing of many of the ruby annotations at https://choyce.tw/momguide/ seem to approximate space-between. I think there should be justification opportunities since the spacing looks slightly nicer, but there won't be much of a difference from center at ordinary font sizes.

Bopomofo is only used for single characters and, if you look at examples like https://books.google.com/books?id=AMVoCgAAQBAJ&printsec=frontcover, how much space can space-between add in there really? Not much. So leaving center or space-between as the default for everything shouldn't matter for this case.

r12a commented 5 years ago

First let me tease something apart here: bopomofo ruby can be used above the base in a similar way to furigana in Japanese, or (more commonly) it can be used vertically to the right of each character. The inter-character value of ruby-position was designed specifically for the latter.

This means that we can't assume that all ruby or even all bopomofo ruby in Taiwan is rendered in the same way.

The spacing of many of the ruby annotations at https://choyce.tw/momguide/ seem to approximate space-between. I think there should be justification opportunities since the spacing looks slightly nicer, but there won't be much of a difference from center at ordinary font sizes.

Inter-character bopomofo ruby is normally solid set and centred, with tone marks appearing to the right at varying heights, depending on the annotation itself. My links to the diagrams at the Ministry of Education in Taiwan don't seem to work any more, but you can see a summary at https://w3c.github.io/clreq/#h-examples_of_zhuyin_annotations (clreq).

Bopomofo is only used for single characters and, if you look at examples like https://books.google.com/books?id=AMVoCgAAQBAJ&printsec=frontcover, how much space can space-between add in there really? Not much. So leaving center or space-between as the default for everything shouldn't matter for this case.

Not sure how you came to your conclusion here. Bopomofo ruby is rarely a single character. It is typically 1-3 phonetic characters plus a tone mark.

I suggest reading https://r12a.github.io/scripts/bopomofo/ontheweb

So, to summarise, when ruby-position for bopomofo ruby is set to over, i don't have a specific recommendation, but i suspect that the annotation is usually centred, like pinyin. @bobbytung may provide some advice there.

When bopomofo ruby annotations are displayed vertically to the right of each character, using the inter-character value, i don't expect to see any justification or separation of the glyphs, but rather vertically centred phonetic symbols (and the positioning of the tone marks is special and isn't indicated by any ruby-align value).

patrickdark commented 5 years ago

@r12a:

Not sure how you came to your conclusion here.

I believe that when I wrote "Bopomofo is only used for single characters…", I was referring to single base characters.

I think the point I was trying to make (last year) was that the default doesn't matter much because (A) a UA stylesheet can address the issue with CSS4 Selectors support and (B) there will normally be a negligible difference between space-between and center—with the biggest difference applying to the allocation of space of a two‐character bopomofo annotation applied to a single base character—unless the base character is unusually large.

I don't feel strongly about this issue though. I think I was mostly interested in chiming in because I saw “ruby:lang(zh)” proposed, which I think is the wrong approach since it lacks a script string (i.e., bopo) in the language selector. (See one of my preceding posts for a CSS approach that I felt was better.)

I suggest reading https://r12a.github.io/scripts/bopomofo/ontheweb

This was an interesting read. I'd suggest changing the text color from gray to a more legible black though to encourage more people to read it. (I manually changed the text color.)

For what it’s worth, I think a better approach to handling bopomofo tone mark rendering would be to create bopomofo-corner-tone-offset, bopomofo-dot-position, and bopomofo-word-separator CSS properties. Bopomofo isn't intrinsically tied to ruby as seen at http://dict.revised.moe.edu.tw/cgi-bin/cbdic/gsweb.cgi?o=dcbdic&searchid=Z00000153482, where bopomofo appears as tabular data, or at http://stroke-order.learningweb.moe.edu.tw/bopomofo.do, where bopomofo input element text field values cannot be marked with markup.

frivoal commented 3 years ago

which sounds like another solution to this problem is that, we make bopomofo not justifiable, so that we don't need any additional rule for ruby-align on Chinese, and all languages would just work fine with the default value space-around of ruby-align.

If we treat text-justify:auto on bopomofo as behaving as inter-word, it looks like this would get us the right behavior for the bopomofo ruby case. IIIRC text composed entirely of bopomofo is written with spaces between words, and that means that would be fine too. But this assumption correct? @bobbytung