[csswg-drafts] [css-ruby-1] Propose to treat rtc with orthogonal writing-mode to be inter-character rather than using ruby-position

upsuper has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-ruby-1] Propose to treat rtc with orthogonal writing-mode to be inter-character rather than using ruby-position ==
## Difficulties from Current Spec

In current spec, inter-character ruby is handled via `ruby-position: inter-character`, which would make the writing mode of ruby annotation container (rtc) vertical.

As discussed before, there are some difficulties for this mechanism from some kind of circular dependencies between properties. Specifically, `display` property depends on `writing-mode` of the specific element and its parent for blockification, while this mechanism would make `writing-mode` depend on `display` and `ruby-position`. Although in this specific case, the circular dependency can be resolved if we defined the handling steps clearly, it seems to be a broken approach in general.

There is another difficulty that, `writing-mode` is a property needs to be locked at very early stage of style calculation, because font metrics depends on this property, and font metrics may be used in various properties (e.g. for `ch`, `ex` units), which means the fixup of this property need to be done before other properties get computed. This would add unnecessary complexity to style cascading, at least for Gecko (especially our new style engine, Stylo), because we generally do all the style fixup after cascading all properties.

## The Proposal

I propose that we use a different approach to implement inter-character: when the ruby annotation container has an orthogonal writing mode [wm1] to that of its base container [wm2], the annotation container is put at the wm2 inline-end of the base container, and layout in wm1 direction, so it looks like inter-character when it has only a single ruby annotation inside. Then we can remove `inter-character` value from `ruby-position` property.

It would require author to write something like
```html
<style> rtc { writing-mode: vertical-rl; } </style>
<ruby>我<rtc>ㄨㄛˇ</rtc>起<rtc>ㄑㄧˇ</rtc>來<rtc>ㄌㄞˊ</rtc>了<rtc>˙ㄌㄜ</rtc></ruby>
```

This would avoid the difficulties for handling style fixup described above. There is a side benefit of this approach that, it would allow horizontal-in-vertical style inter-character ruby, although we don't see many usecases for that, it removes the special case that `inter-character` only takes effect in horizontal writing mode, and it only generates `vertical-rl` writing mode, so I think this approach looks more elegant in general.

The using of `<rtc>` is unfortunate for this kind of solution. But if we want to have `<rt>` work as well in this case, we can specify that the anonymous ruby annotation container inherits from its ruby annotation box children somehow. Since anonymous boxes are created after style cascading, I think this should be easier to do than resolving the style dependency.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1773 using your GitHub account

Received on Friday, 1 September 2017 00:11:17 UTC