Repository navigation
Description
As detailed in https://www.w3.org/TR/clreq/#positioning_of_zhuyin, the way bopomofo characters are expected to be arranged inside ruby is different from the normal inline text layout, and there are some very specific placement rules.
CSS ruby seems to assume that this will happen, but doesn't explicitly trigger that behavior, nor references any other means by which it would be triggered. There seems to be some kind of unstated assumption that if the ruby annotation is made of bopomofo characters, and if the ruby annotation is ruby-position is inter-character, and/or maybe if the ruby container is vertical, it will somehow happen, but there's nothing explicit.
The CSS Spec is quite precise about what happens to the positioning of the ruby annotation box that contains the bopomofo annotation, but not about what happens inside that box.
(Neither https://www.w3.org/TR/clreq/ nor css-ruby is super clear as to whether that kind of layout is also expected for horizontal bopomofo ruby. Example 15 seems to suggest that it is not expected, since it talks about aligning / spacing bopomofo characters in ways that are not that, but it does so without acknowledging the departure from special bopomofo placement.)
I think we need to specificy:
- what exactly triggers this behavior. is it always on given some circumstances? Opt it? Opt out?
- what the behavior actually is. CLREQ gives a good starting point for the happy path where everything is set up properly, but what if there's more than the max 3 characters + 1 tone mark that it expects? What if some aren't the same font-size? what if there's some non-bopommofo in there as well? What about…
A related key is whether this is primarily something handled at the font / text-shaping level, or at the layout engine level.
My read of the current css-ruby spec is that it probably does expect fonts / text-shaping to handle the this on their own. If so, the spec should probably call it out (and we should probably work with the relevant people to make sure it happens), and even then, there may be some work left to do for the css specs and layout engine in terms of placement: if you go by CLREQ, this isn't quite centered, and how does that interact with ruby-align (when text-justify is not ruby) anyway?
But as far as I can tell, fonts don't handle this currently (neither the placing of the tone mark, nor the spacing between the letters), so it may well be fully up to the css layout engine to handle this.
Should this just always happen whenever a ruby annotation contains up to 3 bopomofo letters + 1 tone mark, possibly restricted to inter-character ruby and ruby on vertical containers? Should this tied to an additional value of ruby-align (bopomofo?), possible together with an initial auto value if we want to make it opt-out rather than opt-in and possibly depend on the writing mode?
cc: @bobbytung, @fantasai, @upsuper
Activity
bobbytung commentedon Feb 20, 2026
a quick reply:
Ideally, when base texts in horizontal writing, bopomofo ruby should be in inter-character position. That's the most frequent usage in print books and textbooks. So better opt-out.
I've tried to find a solution to adjust tone marks' position by font feature. The feature will be turned on when glyphs set to upright (ˋˊ˙ˇ those code points are not R / Tr in UTR#50). So ideally, all glyphs inside the box should be set to upright.
About alignment, the only reference here. It's not centered but better than justified.
r12a commentedon Feb 22, 2026
We have been over this time and again, so it seems we do need to work on the spec text...
It's already pretty clear that the inter-character value is not just some general positioning mechanism, but is specifically intended for bopomofo right-side layout, which doesn't introduce non-bopomofo text, and which has very specific placement requirements, especially for the tone marks.
However, I think this initial sentence needs to be dropped or rewritten:
Sure, it puts stuff on the right side of a character in verticallly set text, but It's not the same effect as 'over' because
I did push for some clarity about the expected internal positioning here in the early stages, but it was resisted. As for how to do it: Bobby has been experimenting with font-based rendering of the inter-character bopomofo elements. Lot's of people have tried to think of it as embedded writing-mode direction changes — which has been pointed out numerous times to be a non-starter, given the precise relative positioning required for the internal elements. And in the early days Dave ... proposed that Webkit could just get the browser to use script to position the internal elements — which i think would probably be the simplest solution — but nothing happened.
Use of the inter-character value, only. And the expectation should be that only bopomofo characters and associated tone marks occur as the annotation.
This is specifically for the bopoofo right-side rendering. So there won't be more than 3 character + 1 tone mark. They will all be of the appropriate size. There will not be non-bopomofo content. There won't be any internal markup or CSS value changes — the layout is clearly specified by the document Bobby points to. Bottom line: this is not intended to be for positioning general content to the right of a character; it is expressly and specifically aimed at rendering standard bopomofo annotations in their normal right-of-base-character position.
frivoal commentedon Feb 23, 2026
I completely agree that that's the intent, but here's the problem: HTML allows arbitrary content in the
<rt>element. There is no way to force the markup to be limited to "up to 3 bopomofo charters and one tone mark". So even if it isn't meant to be used that way, we still must answer the question of what happens the markup contains other stuff, and css tries to apply that value.Again, it should not be used with more than 3 characters+1 tone mark, but given how HTML works, it can. It's bad to use it this way, but we cannot prevent that, so we need to know what happens if someone does that.
No disagreement as to the intent. Just saying: css applies to arbitrary HTML, so the behavior must be defined for arbitrary content. We do not have to go out of our way to make something "useful" outside of the recognized use-case, but the user agent will need to do something, and we should be clear on what that is.
r12a commentedon Feb 23, 2026
So perhaps we can add text to the spec to say that behaviour is undefined and discouraged if people use things other than bopomofo characters and the appropriate tone marks.
But we also, i believe, need to do something about that initial paragraph that seems to equate inter-character with over in vertical.
frivoal commentedon Feb 23, 2026
I'd rather specify a simple-even if-not-necessarily-useful behavior than undefined behavior. Otherwise we run the risk that some popular web page(s) uses it wrong, depends on whatever currently popular browser happens to implement (which may or may not be simple, since it's undefined), forcing everyone else to reverse engineer that behavior, and us having to spec it later.
If it's handled at the font level, that kind of falls out of how that gets implemented.
If it's handled in CSS, maybe the simple-even-if-not-necessarily-useful behavior could simply be that if you have anything more than 3 bopomofo characters and a tone mark, the special layout mode is not invoked, and you get normal vertical layout within the ruby annotation (which is still placed inter-character in horizontal text, since you did ask for that).
+1
frivoal commentedon Feb 23, 2026
One extra question: is the layout logic described in CLREQ The One True layout logic used everywhere, or is that a simplified or compromise solution synthetized by the i18n group? I am asking not because I have any reason not to follow it, but because multiple sources (if they exist) could be informative about error case / corner case handling.
r12a commentedon Feb 23, 2026
The information in CLReq is taken from The Reference published by the Taiwanese government that Bobby pointed to at https://language.moe.gov.tw/001/Upload/files/site_content/M0001/juyin/index.html.
xfq commentedon Mar 18, 2026
https://www.w3.org/TR/clreq/#positioning_of_zhuyin mentions horizontal writing mode in many places. I'm not sure which specific parts you found unclear. We can certainly make some improvements.
I can discuss this issue with the Chinese Layout Task Force.
There are some discussions related to font implementation. You can check them out here: w3c/clreq#241
As I understand it, the content within clreq largely describes ideal typographic scenarios. In practice, you may encounter layouts that deviate from these guidelines. However, this does not necessarily imply that the behavior in clreq is incorrect. If you want further reference materials, we would be happy to look some up.