Skip to content

Commit 549036c

Browse files
committed
[css-ruby] Various fixes to sizing, white space:
1. Remove UA-dependent font-size nonsense. 2. Add lang-specific rule for bopomofo ruby (selector needs refinement later w/ script subtags, checks against other Chinese locales, etc.). 3. Fix white-space handling errors raised by bzbarsky, sbowen, xidorn. 4. Shift bopomofo note from inter-character definition to bopomofo definition, since it's a script issue not a ruby issue.
1 parent 1796eb4 commit 549036c

File tree

2 files changed

+1294
-1391
lines changed

2 files changed

+1294
-1391
lines changed

css-ruby/Overview.bs

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,6 @@ Anonymous Ruby Box Generation</h3>
318318
This computation occurs after any intermediary anonymous-box fixup
319319
(such as that required by internal table elements).
320320

321-
<li id="anony-gen-trim-space"><strong>Trim leading/trailing white space:</strong>
322-
Any white space within a ruby structure is discarded
323-
at the beginning and end of
324-
a <i>ruby container</i>, <i>ruby annotation container</i>, or <i>ruby base container</i>.
325-
326321
<li id="anon-gen-bare-inlines"><strong>Wrap misparented inline-level content:</strong>
327322
Any consecutive sequence of text and inline-level boxes
328323
directly parented by a <i>ruby container</i> or <i>ruby base container</i>
@@ -333,10 +328,17 @@ Anonymous Ruby Box Generation</h3>
333328

334329
However, if an anonymous box so constructed contains only <i>white space</i>,
335330
it is considered <dfn>intra-ruby white space</dfn>
336-
and is either discarded as <i>inter-level white space</i>
337-
or preserved as <i>intra-level white space</i>
331+
and is either discarded
332+
or preserved
338333
as described below.
339334

335+
<li id="anony-gen-trim-space"><strong>Trim leading/trailing white space:</strong>
336+
Any <i>intra-ruby white space</i>
337+
that is not the sole child of its parent
338+
and occurs at the beginning or end of
339+
a <i>ruby container</i>, <i>ruby annotation container</i>, or <i>ruby base container</i>
340+
is removed, as if it had ''display: none''
341+
340342
<li id="anon-gen-discard-space"><strong>Remove inter-level white space:</strong>
341343
Any <i>intra-ruby white space</i>
342344
whose immediately adjacent siblings match one of the patterns below
@@ -391,7 +393,7 @@ Anonymous Ruby Box Generation</h3>
391393
<tr><td><i>ruby base</i> or <i>ruby base container</i>
392394
<td><i>ruby base container</i>
393395
<tr><td><i>ruby base container</i>
394-
<td><i>ruby base container</i>
396+
<td><i>ruby base</i> or <i>ruby base container</i>
395397
</table>
396398
The <dfn>intra-level white space</dfn> boxes defined above are
397399
treated specially for pairing and layout. See below.
@@ -516,7 +518,7 @@ Unit Pairing and Spanning Annotations</h4>
516518
<h4 id="nested-pairing">
517519
Complex Spanning with Nested Ruby</h4>
518520

519-
<p><dfn lt="nested ruby"></dfn>When <i>ruby containers</i> are nested,
521+
<p>When <i>ruby containers</i> are <dfn lt="nested ruby">nested</dfn>,
520522
pairing begins with the deepest <i>ruby container</i>,
521523
then expands out.
522524
From the pairing perspective of the outer <i>ruby container</i>,
@@ -898,14 +900,6 @@ Line Spacing</h3>
898900
Note, it is currently in the process of being rewritten;
899901
the current drafts should not be relied upon.
900902

901-
<h3 id="ruby-size">Ruby Annotation Font Size</h3>
902-
<p>The <i>ruby annotations</i> are usually the half size of the <i>ruby base</i> as described in [[!JLREQ]].
903-
However, UA may increase the font size when the it is too small to read,
904-
or decrease if the text is too large to avoid ruby annotation being too large.
905-
Also, the 'ruby-position: inter-character' usually require different font size such as 25% or 33%.
906-
<p>This level of the specification does not define any additional mechanism to automatically compute
907-
the <i>ruby annotation</i> font size according to properties of <i>ruby container</i> or <i>ruby base</i>.
908-
909903
<h2 id="ruby-props">
910904
Ruby Formatting Properties</h2>
911905

@@ -1004,14 +998,6 @@ Ruby Positioning: the 'ruby-position' property</h3>
1004998
<p class="caption">“Bopomofo” ruby in traditional Chinese
1005999
(ruby text shown in blue for clarity) in horizontal layout
10061000
</div>
1007-
<p class="note">
1008-
Note that the user agent is responsible for ensuring the correct relative alignment and positioning of the glyphs,
1009-
including those corresponding to the tone marks, when displaying.
1010-
Tone marks are spacing characters that occur (in memory) at the end of the ruby text for each base character.
1011-
They are usually displayed in a separate column to the right of the bopomofo characters,
1012-
and the height of the tone mark depends on the number of characters in the syllable.
1013-
One tone mark, however, is placed above the bopomofo, not to the right of it.
1014-
<!-- See Taiwanese requirements doc for EPUB at http://epub-revision.googlecode.com/files/EGLS_TW_eng.ppt -->
10151001
</dd>
10161002
</dl>
10171003

@@ -1505,18 +1491,17 @@ Appendix A: Default Style Sheet</h2>
15051491
<!-- -->rbc { display: ruby-base-container; }
15061492
<!-- -->rtc { display: ruby-text-container; }
15071493
<!-- -->rtc, rt { white-space: nowrap; font-size: 50%; line-height: 1; }
1494+
<!-- -->rtc:lang(zh-TW), rt:lang(zh-TW) { font-size: 30%; } /* bopomofo */
15081495
<!-- -->rtc > rt { font-size: inherit; }
1496+
<!-- -->rtc:lang(zh), rt:lang(zh) { ruby-align: center; }
15091497
<!-- -->ruby, rb, rt, rbc, rtc { unicode-bidi: isolate; }</pre>
15101498

15111499
<p>Additional rules for UAs supporting the relevant features of [[CSS3-TEXT-DECOR]] and [[CSS3-FONTS]]:
15121500
<pre>rtc, rt { font-variant-east-asian: ruby; text-emphasis: none; }</pre>
15131501

1514-
<p class="note">Authors should not use the above rules;
1502+
<p class="note">Authors should not use the above rules:
15151503
a UA that supports ruby layout should provide these by default.
15161504

1517-
<p class="note">For the use of the 'font-size' property,
1518-
please refer to <a href="#ruby-size">Ruby Annotation Font Size</a>.
1519-
15201505
<h3 id="default-inline" class="no-num">
15211506
<span class="secno">A.2</span> Inlining Ruby Annotations</h3>
15221507

@@ -1556,7 +1541,16 @@ Glossary</h2>
15561541
<dl>
15571542
<dt id="g-bopomofo" lang="zh">Bopomofo
15581543
<dd>37 characters and 4 tone markings used as phonetics in Chinese,
1559-
especially standard Mandarin.</dd>
1544+
especially standard Mandarin.
1545+
<p class="note">
1546+
Note that the user agent is responsible for ensuring the correct relative alignment and positioning of the glyphs,
1547+
including bopomofo tone marks, when displaying text,
1548+
whether it occurs in ruby annotations or as normal inline text.
1549+
Bopomofo Tone marks are spacing characters that occur (in memory) at the end of the ruby text for each base character.
1550+
They are usually displayed in a separate column to the right of or above the bopomofo characters,
1551+
and the position of the tone mark depends on the number of characters in the syllable.
1552+
One tone mark, however, is placed before the bopomofo, not over it.
1553+
<!-- See Taiwanese requirements doc for EPUB at http://epub-revision.googlecode.com/files/EGLS_TW_eng.ppt -->
15601554
<dt id="g-hanja" lang="ko">Hanja
15611555
<dd>Subset of the Korean writing system that utilizes ideographic
15621556
characters borrowed or adapted from the Chinese writing system. Also see

0 commit comments

Comments
 (0)