Skip to content

Commit 74885da

Browse files
Florian RivoalFlorian Rivoal
Florian Rivoal
authored and
Florian Rivoal
committed
[css-ruby] Adjust writing-mode computation on inter-character ruby
See w3c#1773
1 parent fcda2a7 commit 74885da

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

css-ruby-1/Overview.bs

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,11 @@ Ruby Positioning: the 'ruby-position' property</h3>
14231423

14241424
Otherwise, the ruby annotation becomes an <dfn dfn local-lt=inter-character>inter-character annotation</dfn>.
14251425
The annotation appears on the right of the base in horizontal text.
1426-
This forces the computed value of 'writing-mode' of the [=ruby annotation container=] to be ''vertical-rl''.
1426+
This forces the computed value of 'writing-mode' of the [=ruby annotation=] children of this [=ruby annotation container=] to be ''vertical-rl''.
1427+
1428+
Note: The computed value of 'writing-mode' on the [=ruby annotation container=] itself is not affected.
1429+
This is to avoid circular dependencies between computed values
1430+
on the 'writing-mode', 'display', and 'ruby-position' properties on the same element.
14271431

14281432
This value is provided for the special case of traditional Chinese
14291433
as used especially in Taiwan:
@@ -1437,6 +1441,39 @@ Ruby Positioning: the 'ruby-position' property</h3>
14371441
<p class="caption">“Bopomofo” ruby in traditional Chinese
14381442
(ruby annotation shown in blue for clarity) in horizontal layout
14391443
</div>
1444+
1445+
<div class=note>
1446+
Note: As inheritance works on the element tree without accounting for anonymous boxes created for ruby layout,
1447+
when using [=inter-character annotations=]
1448+
authors need to be careful to avoid markup patterns involving
1449+
an element-based [=ruby annotation container=],
1450+
an anonymous [=ruby annotation=],
1451+
and further descendant elements,
1452+
as those descendants would inherit their writing mode from the [=ruby annotation container=],
1453+
and not from the [=ruby annotation=] whose 'writing-mode' has been changed to ''vertical-rl''.
1454+
1455+
<div class=example>
1456+
<pre highlight=css>ruby { ruby-position: inter-character; }</pre>
1457+
<xmp highlight=html><ruby>base<rtc><em>problematic</em> annotation</ruby></xmp>
1458+
1459+
In the above markup, an anonymous [=ruby annotation=] box is created as a child of the <code>&lt;rtc></code> element
1460+
to wrap the whole “problematic annotation”.
1461+
Since it is a child of an [=annotation container=] whose 'ruby-position' is ''inter-character'',
1462+
its 'writing-mode' will be ''vertical-rl'', which is expected.
1463+
However, the <code>&lt;em></code> element inherits its 'writing-mode' directly from the <code>&lt;rtc></code> element,
1464+
which has not been forced to ''vertical-rl''.
1465+
1466+
In this example, the explicit [=ruby annotation container=] element was not necessary,
1467+
so using a [=ruby annotation=] element instead would avoid the problem:
1468+
1469+
<xmp highlight=html><ruby>base<rt><em>problematic</em> annotation</ruby></xmp>
1470+
1471+
If an explicit [=ruby annotation container=] element is needed,
1472+
then using a [=ruby annotation=] element as well would also address the problem:
1473+
<xmp highlight=html><ruby>base<rtc><rt><em>problematic</em> annotation</ruby></xmp>
1474+
</div>
1475+
</div>
1476+
14401477
</dd>
14411478
</dl>
14421479

@@ -2221,7 +2258,10 @@ Changes</h2>
22212258
<h3 id="changes-20211202">
22222259
Changes since the 2 December 2021 WD</h3>
22232260

2224-
None yet.
2261+
<ul>
2262+
<li>Made the computed-value adjustement of 'writing-mode' on [=inter-character annotations=]
2263+
apply to the [=ruby annotation box=] rather than the [=ruby annotation container box=].
2264+
</ul>
22252265

22262266
<h3 id="changes-20200429">
22272267
Changes since the 29 April 2020 WD</h3>

0 commit comments

Comments
 (0)