forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverview.html
More file actions
2192 lines (1731 loc) · 90.6 KB
/
Overview.html
File metadata and controls
2192 lines (1731 loc) · 90.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang=en>
<head>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Ruby Module Level 1</title>
<!--
<link href="http://purl.org/dc/terms/" rel="schema.dcterms">
<link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" rel="dcterms.rights">
-->
<meta content="CSS Ruby Module Level 1" name=dcterms.title>
<meta content=text name=dcterms.type>
<meta content=2013-06-18 name=dcterms.date>
<meta content="Elika J. Etemad" name=dcterms.creator>
<meta content="Koji Ishii" name=dcterms.creator>
<meta content="Richard Ishida" name=dcterms.creator>
<meta content=W3C name=dcterms.publisher>
<meta content="http://dev.w3.org/csswg/css3-ruby/" name=dcterms.identifier>
<link href="#contents" rel=contents>
<link href="#index" rel=index>
<link href="../default.css" rel=stylesheet type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<body class=h-entry>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1 class=p-name>CSS Ruby Module Level 1</h1>
<h2 class="no-num no-toc" id=longstatus-date->Editor's Draft <time
class=dt-updated datetime=20130618>18 June 2013</time>
<!-- for HTML4 doctype: <span class="value-title" title="20130618">18 June 2013</span></span> --></h2>
<dl>
<dt>This version:
<dd><a class=u-url
href="http://dev.w3.org/csswg/css3-ruby/">http://dev.w3.org/csswg/css3-ruby/</a>
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-ruby/">http://www.w3.org/TR/css3-ruby/</a>
<dt>Editor's draft:
<dd><a
href="http://dev.w3.org/csswg/css3-ruby/">http://dev.w3.org/csswg/css3-ruby/</a>
(<a
href="https://dvcs.w3.org/hg/csswg/log/tip/css3-ruby/Overview.src.html">change
log</a>)
<dt>Previous version:
<dd><a href="http://www.w3.org/TR/2011/WD-css3-ruby-20110630/">
http://www.w3.org/TR/2011/WD-css3-ruby-20110630/</a>
<dt>Issue Tracking:
<dd><a href="http://www.w3.org/Style/CSS/Tracker/products/FIXME"
rel=issues>http://www.w3.org/Style/CSS/Tracker/products/FIXME</a>
<dt>Feedback:
<dd><a
href="mailto:www-style@w3.org?subject=%5BSHORTNAME%5D%20feedback">www-style@w3.org</a>
with subject line “<kbd>[css3-ruby] <var>… message topic
…</var></kbd>” (<a
href="http://lists.w3.org/Archives/Public/www-style/"
rel=discussion>archives</a>)
<dt>Editors:
<dd class="p-author h-card vcard"> <a class="p-name fn u-url url"
href="http://fantasai.inkedblade.net/contact" rel=author>Elika J.
Etemad</a>, <a class="p-org org h-org"
href="http://www.mozilla.org/">Mozilla</a>
<dd class="p-author h-card vcard"> <a class="p-name fn u-url url"
href="mailto:koji.a.ishii@mail.rakuten.com" rel=author>Koji Ishii</a>,
<span class="p-org org">Rakuten, Inc.</span>
<dd class="p-author h-card vcard"> <a class="p-name fn u-url url"
href="mailto:ishida@w3.org" rel=author>Richard Ishida</a>, <span
class="p-org org">W3C</span>
<dt>Former editors:
<dd>Michel Suignard, Microsoft
<dd>Marcin Sawicki, Microsoft
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2013 <a href="http://www.w3.org/"><abbr
title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><abbr
title="Massachusetts Institute of Technology">MIT</abbr></a>, <a
href="http://www.ercim.eu/"><abbr
title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
<a href="http://www.keio.ac.jp/">Keio</a>, <a
href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<p> <span class=p-summary> “Ruby” are short runs of text alongside the
base text, typically used in East Asian documents to indicate
pronunciation or to provide a short annotation. This module describes the
rendering model and formatting controls related to displaying ruby
annotations in CSS. </span> <a href="http://www.w3.org/TR/CSS/">CSS</a> is
a language for describing the rendering of structured documents (such as
HTML and XML) on screen, on paper, in speech, etc.
<h2 class="no-num no-toc" id=status>Status of this document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
discussion only and may change at any moment. Its publication here does
not imply endorsement of its contents by W3C. Don't cite this document
other than as work in progress.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a
href="mailto:www-style@w3.org?Subject=%5Bcss3-ruby%5D%20PUT%20SUBJECT%20HERE">
www-style@w3.org</a> (see <a
href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
discussion of this specification. When sending e-mail, please put the text
“css3-ruby” in the subject, preferably like this:
“[<!---->css3-ruby<!---->] <em>…summary of comment…</em>”
<p>This document was produced by the <a
href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of
the <a href="http://www.w3.org/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
2004 W3C Patent Policy</a>. W3C maintains a <a
href="http://www.w3.org/2004/01/pp-impl/32061/status"
rel=disclosure>public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also includes
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
6 of the W3C Patent Policy</a>.</p>
<!--end-status-->
<p>The following features are at risk: …
<h2 class="no-num no-toc" id=contents> Table of Contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#intro"><span class=secno>1. </span> Introduction</a>
<ul class=toc>
<li><a href="#placement"><span class=secno>1.1. </span> Module
interactions</a>
<li><a href="#values"><span class=secno>1.2. </span> Values</a>
<li><a href="#conventions"><span class=secno>1.3. </span> Document
conventions</a>
<li><a href="#ruby-def"><span class=secno>1.4. </span> What is ruby?</a>
</ul>
<li><a href="#ruby-model"><span class=secno>2. </span> Ruby Formatting
Model</a>
<ul class=toc>
<li><a href="#ruby-display"><span class=secno>2.1. </span> Ruby-specific
‘<code class=property>display</code>’ property values</a>
<li><a href="#box-fixup"><span class=secno>2.2. </span> Anonymous Ruby
Box Generation</a>
<li><a href="#pairing"><span class=secno>2.3. </span> Ruby Pairing and
Annotation Levels</a>
<ul class=toc>
<li><a href="#nested-pairing"><span class=secno>2.3.1. </span> Nested
Ruby</a>
</ul>
<li><a href="#box-model"><span class=secno>2.4. </span> Generating Ruby
Structure</a>
<li><a href="#box-model"><span class=secno>2.5. </span> Ruby box
model</a>
<li><a href="#ruby-line-height"><span class=secno>2.6. </span> Ruby box
and line stacking</a>
<li><a href="#ruby-line-breaking"><span class=secno>2.7. </span> Ruby
box and line breaking</a>
</ul>
<li><a href="#ruby-props"><span class=secno>3. </span> Ruby Properties</a>
<ul class=toc>
<li><a href="#rubypos"><span class=secno>3.1. </span> Ruby positioning:
the ‘<code class=property>ruby-position</code>’ property</a>
<li><a href="#rubymerge"><span class=secno>3.2. </span>Ruby merge: the
‘<code class=property>ruby-merge</code>’ property</a>
<li><a href="#rubyalign"><span class=secno>3.3. </span> Ruby alignment:
the ‘<code class=property>ruby-align</code>’ property</a>
</ul>
<li><a href="#rubyover"><span class=secno>4. </span> Ruby Overhang and
Edge Effects</a>
<li class=no-num><a href="#default-stylesheet"> Appendix A: Default Style
Sheet</a>
<ul class=toc>
<li class=no-num><a href="#default-ua-ruby"> Supporting Ruby Layout</a>
<li class=no-num><a href="#default-inline"> Inlining Ruby
Annotations</a>
<li class=no-num><a href="#default-parens"> Generating Parentheses</a>
</ul>
<li><a href="#glossary"><span class=secno>5. </span> Glossary</a>
<li><a href="#conformance"><span class=secno>6. </span> Conformance</a>
<ul class=toc>
<li><a href="#conventions"><span class=secno>6.1. </span> Document
conventions</a>
<li><a href="#conformance-classes"><span class=secno>6.2. </span>
Conformance classes</a>
<li><a href="#partial"><span class=secno>6.3. </span> Partial
implementations</a>
<li><a href="#experimental"><span class=secno>6.4. </span> Experimental
implementations</a>
<li><a href="#testing"><span class=secno>6.5. </span> Non-experimental
implementations</a>
</ul>
<li class=no-num><a href="#acknowledgments"> Acknowledgments</a>
<li class=no-num><a href="#references"> References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references"> Normative
references</a>
<li class=no-num><a href="#other-references"> Other references</a>
</ul>
<li class=no-num><a href="#index"> Index</a>
<li class=no-num><a href="#property-index"> Property index</a>
</ul>
<!--end-toc-->
<h2 id=intro><span class=secno>1. </span> Introduction</h2>
<p><em>This section is not normative.</em>
<h3 id=placement><span class=secno>1.1. </span> Module interactions</h3>
<p>This module extends the inline box model of CSS Level 2 <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> to support ruby.
<p>None of the properties in this module apply to the
<code>::first-line</code> or <code>::first-letter</code> pseudo-elements.
<h3 id=values><span class=secno>1.2. </span> Values</h3>
<p>This specification follows the <a
href="http://www.w3.org/TR/CSS21/about.html#property-defs">CSS property
definition conventions</a> from <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Value types not defined in
this specification are defined in CSS Level 2 Revision 1 <a
href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Other CSS
modules may expand the definitions of these value types: for example <a
href="#CSS3VAL" rel=biblioentry>[CSS3VAL]<!--{{CSS3VAL}}--></a>, when
combined with this module, expands the definition of the
<var><length></var> value type as used in this specification.
<p>In addition to the property-specific values listed in their definitions,
all properties defined in this specification also accept the <a
href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">inherit</a>
keyword as their property value. For readability it has not been repeated
explicitly.
<h3 id=conventions><span class=secno>1.3. </span> Document conventions</h3>
<p>Many typographical conventions in East Asian typography depend on
whether the character rendered is wide (CJK) or narrow (non-CJK). There
are a number of illustrations in this document for which the following
legend is used:
<dl>
<dt><img alt="Symbolic wide-cell glyph representation" height=39
src="images/fullwidth.gif" width=39>
<dd>Wide-cell glyph (e.g. Han) that is the <var>n</var>th character in the
text run. They are typically sized to 50% when used as annotations.
<dt><img alt="Symbolic narrow-cell glyph representation" height=39
src="images/halfwidth.gif" width=19>
<dd>Narrow-cell glyph (e.g. Roman) which is the <var>n</var>th glyph in
the text run.
<p>The orientation which the above symbols assume in the diagrams
corresponds to the orientation that the glyphs they represent are
intended to assume when rendered by the user agent. Spacing between
these characters in the diagrams is incidental, unless intentionally
changed to make a point.
<h3 id=ruby-def><span class=secno>1.4. </span> What is ruby?</h3>
<p><dfn id=ruby>Ruby</dfn> is the commonly-used name for a run of text
that appears alongside another run of text (referred to as the
“base”) and serves as an annotation or a pronunciation guide
associated with that run of text.
<p>The following figures show two examples of Ruby, a simple case and one
with more complicated structure.
<div class=example>
<p>In this first example, a single annotation is used to annotate the
base text.
<div class=figure>
<p><img alt="Example of ruby applied on top of a Japanese expression"
src="images/licence.png">
<p class=caption>Example of ruby used in Japanese (simple case)
</div>
<p>In Japanese typography, this case is sometimes called <i
lang=ja>taigo</i> ruby or group-ruby (per-word ruby), because the
annotation as a whole is associated with multi-character word (as a
whole).
</div>
<div class=example>
<p>In this second example, two levels of annotations are attached to a
base sequence: the hiragana characters on top refer to the
pronunciation of each of the base kanji characters, while the words
“Keio” and “University” on the bottom are annotations
describing the English translation.
<div class=figure>
<p><img
alt="Example showing complex ruby with annotation text over and under the base characters"
src="images/ruby-univ.gif">
<p class=caption>Complex ruby with annotation text over and under the
base characters
</div>
<p>
<p>Notice that to allow correct association between the hiragana
characters and their corresponding Kanji base characters, the spacing
between these Kanji characters is adjusted. (This happens around the
fourth Kanji character in the figure above.) To avoid variable spacing
between the Kanji characters in the example above the hiragana
annotations can be styled as a <i>collapsed annotation</i>, which will
look more like the group-ruby example earlier. However because the
base-annotation pairings are recorded in the ruby structure, if the
text breaks across lines, the annotation characters will stay correctly
paired with their respective base characters.
</div>
<a href="#ruby"><i>Ruby</i></a> formatting as used in Japanese is
described in JIS X-4051 <a href="#JIS4051"
rel=biblioentry>[JIS4051]<!--{{JIS4051}}--></a> (in Japanese) and in
Requirements for Japanese Text Layout <a href="#JLREQ"
rel=biblioentry>[JLREQ]<!--{{JLREQ}}--></a> (in English and Japanese)].
In HTML, ruby structure and markup to represent it is described in the
Ruby Markup Extension specification. This module describes the CSS
rendering model and formatting controls relevant to ruby layout of such
markup.
<h2 id=ruby-model><span class=secno>2. </span> Ruby Formatting Model</h2>
<p>The CSS ruby model is based on the <a
href="http://darobin.github.io/html-ruby/">HTML Ruby Markup
Extension</a> and <a href="http://www.w3.org/TR/ruby/">XHTML Ruby
Annotation Recommendation</a> <a href="#RUBY"
rel=biblioentry>[RUBY]<!--{{RUBY}}--></a>. In this model, a ruby
structure consists of one or more <dfn id=ruby-base>ruby base</dfn>
elements representing the base (annotated) text, associated with one or
more levels of <dfn id=ruby-annotation>ruby annotation</dfn> elements
representing the annotations. The structure of ruby is similar to that
of a table: there are “rows” (the base text level, each annotation
level) and “columns” (each <a href="#ruby-base-box"><i>ruby
base</i></a> and its corresponding <a
href="#ruby-annotation-box"><i>ruby annotations</i></a>).
<p>Consecutive bases and annotations are grouped together into <dfn
id=ruby-segments>ruby segments</dfn>. Within a <i>ruby segment</i>, a <a
href="#ruby-annotation-box"><i>ruby annotation</i></a> may span multiple
<a href="#ruby-base-box"><i>ruby bases<i>. </i></i></a>
<p class=note>In HTML, a single <code><ruby></code> element may
contain multiple <a href="#ruby-segments"><i>ruby segments</i></a>. (In
the XHTML Ruby model, a single <code><ruby></code> element can
only contain one <i>ruby segment</i>.)
<h3 id=ruby-display><span class=secno>2.1. </span> Ruby-specific ‘<code
class=property>display</code>’ property values</h3>
<p>For document languages (such as XML applications) that do not have
pre-defined ruby elements, authors must map document language elements
to ruby elements; this is done with the ‘<code
class=property>display</code>’ property.
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td>display
<tr>
<th><a href="#values">New Values</a>:
<td>ruby | ruby-base | ruby-text | ruby-base-container |
ruby-text-container
</table>
<p>The following new ‘<code class=property>display</code>’ values
assign ruby layout roles to an arbitrary element:
<dl>
<dt>‘<a href="#ruby"><code class=css>ruby</code></a>’
<dd>Specifies that an element generates a <dfn id=ruby-container-box
title="ruby container | ruby container box">ruby container box</dfn>.
(Corresponds to HTML/XHTML <code><ruby></code> elements.)
<dt>‘<code class=css>ruby-base</code>’
<dd>Specifies that an element generates a <dfn id=ruby-base-box
title="ruby base box | ruby base">ruby base box</dfn>. (Corresponds to
HTML/XHTML <code><rb></code> elements.)
<dt>‘<code class=css>ruby-text</code>’
<dd>Specifies that an element generates a <dfn id=ruby-annotation-box
title="ruby annotation box | ruby annotation">ruby annotation
box</dfn>. (Corresponds to HTML/XHTML <code><rt></code>
elements.)
<dt>‘<code class=css>ruby-base-container</code>’
<dd>Specifies that an element generates a <dfn
id=ruby-base-container-box
title="ruby base container box | ruby base container">ruby base
container box</dfn>. (Corresponds to XHTML <code><rbc></code>
elements; always implied in HTML.)
<dt>‘<code class=css>ruby-text-container</code>’
<dd>Specifies that an element generates a <dfn
id=ruby-annotation-container-box
title="ruby annotation container box | ruby annotation container">ruby
annotation container box</dfn>. (Corresponds to HTML/XHTML
<code><ruby></code> elements.)
</dl>
<h3 id=box-fixup><span class=secno>2.2. </span> Anonymous Ruby Box
Generation</h3>
<p>The CSS model does not require that the document language include
elements that correspond to each of these components. Missing parts of
the structure are implied through the anonymous box generation rules <a
href="http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes">similar to
those used to normalize tables</a>. <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>
<ol>
<li>Any in-flow block-level boxes directly contained by a <a
href="#ruby-container-box"><i>ruby container</i></a>, <a
href="#ruby-base-container-box"><i>ruby base container</i></a>, <a
href="#ruby-annotation-container-box"><i>ruby annotation
container</i></a>, <a href="#ruby-base-box"><i>ruby base box</i></a>,
or <a href="#ruby-annotation-box"><i>ruby annotation box</i></a> are
forced to be inline-level boxes, and their ‘<code
class=property>display</code>’ value computed accordingly. For
example, the ‘<code class=property>display</code>’ property of an
in-flow element with ‘<code class=css>display: block</code>’
parented by an element with ‘<code class=css>display:
ruby-text</code>’ computes to ‘<code
class=css>inline-block</code>’. This computation occurs after any
intermediary anonymous-box fixup (such as that required by internal
table elements).
<li>Any consecutive sequence of <a href="#ruby-base-box"><i>ruby
bases</i></a> not parented by a <a
href="#ruby-base-container-box"><i>ruby base container</i></a> is
wrapped in an anonymous <a href="#ruby-base-container-box"><i>ruby base
container</i></a>. Similarly, any consecutive sequence of <a
href="#ruby-annotation-box"><i>ruby annotations</i></a> not parented by
a <a href="#ruby-annotation-container-box"><i>ruby annotation
container</i></a> is wrapped in an anonymous <a
href="#ruby-annotation-container-box"><i>ruby annotation
container</i></a>.
<li>Within each <a href="#ruby-base-container-box"><i>ruby base
container</i></a>, each sequence of inline-level boxes is wrapped in an
anonymous <a href="#ruby-base-box"><i>ruby base box</i></a>. Similarly,
within each <a href="#ruby-annotation-container-box"><i>ruby annotation
container</i></a>, each sequence of inline-level boxes is wrapped in an
anonymous <a href="#ruby-annotation-box"><i>ruby annotation
box</i></a>.
<li>A sequence of <a href="#ruby-base-container-box"><i>ruby base
containers</i></a> and/or <a
href="#ruby-annotation-container-box"><i>ruby annotation
containers</i></a> not parented by a <a
href="#ruby-container-box"><i>ruby container</i></a> is wrapped in an
anonymous <a href="#ruby-container-box"><i>ruby container</i></a>.
</ol>
<p>At this point, all ruby layout structures are properly parented, and
the UA can start to associate bases with their annotations.
<p class=note> Note that the UA is not required to create any of these
anonymous boxes in its internal structures, as long as pairing and
layout behaves as if they existed.
<h3 id=pairing><span class=secno>2.3. </span> Ruby Pairing and Annotation
Levels</h3>
<p>Within a ruby structure, each <a href="#ruby-base-box"><i>ruby
bases</i></a> are associated with <a href="#ruby-annotation-box"><i>ruby
annotations</i></a> and vice versa. A <a href="#ruby-base-box"><i>ruby
base</i></a> can be associated with at most one <a
href="#ruby-annotation-box"><i>ruby annotation</i></a> per annotation
level. If there are multiple annotation levels, it can therefore be
associated with multiple <a href="#ruby-annotation-box"><i>ruby
annotations</i></a>. A <a href="#ruby-annotation-box"><i>ruby
annotation</i></a> is associated with one or more <a
href="#ruby-base-box"><i>ruby bases</i></a>; annotations can span
multiple bases.
<p><dfn id=annotation-pairing>Annotation pairing</dfn> is the process of
associating <a href="#ruby-annotation-box"><i>ruby annotations</i></a>
with <a href="#ruby-base-box"><i>ruby bases</i></a>.
<ol>
<li>
<p>First, the ruby structure is divided into <a
href="#ruby-segments"><i>ruby segments</i></a>, each consisting of a
single <a href="#ruby-base-container-box"><i>ruby base
container</i></a> followed by one or more <a
href="#ruby-annotation-container-box"><i>ruby annotation
containers</i></a>. If the first child of a <a
href="#ruby-container-box"><i>ruby container</i></a> is a <a
href="#ruby-annotation-container-box"><i>ruby annotation
container</i></a>, an anonymous, empty <a
href="#ruby-base-container-box"><i>ruby base container</i></a> is
assumed to exist before it. Similarly, if the <a
href="#ruby-container-box"><i>ruby container</i></a> contains
consecutive <a href="#ruby-base-container-box"><i>ruby base
containers</i></a>, anonymous, empty <a
href="#ruby-annotation-container-box"><i>ruby annotation
containers</i></a> are assumed to exist between them. The <a
href="#ruby-base-container-box"><i>ruby base container</i></a> in each
segment is thus associated with each of the <a
href="#ruby-annotation-container-box"><i>ruby annotation
containers</i></a> in that segment.
<p>Each <a href="#ruby-annotation-container-box"><i>ruby annotation
containers</i></a> in a <i>ruby segment</i> represents one <dfn
id=level title="annotation level | level">level</dfn> of annotation:
the first one represents the first level of annotation, the second one
represents the second level of annotation, and so on.
<li>Within each <i>ruby segment</i>, each <a
href="#ruby-base-box"><i>ruby base box</i></a> in the <a
href="#ruby-base-container-box"><i>ruby base container</i></a> is
paired with one <a href="#ruby-annotation-box"><i>ruby annotation
box</i></a> from each <a href="#ruby-annotation-container-box"><i>ruby
annotation container</i></a> in its <i>ruby segment</i>. If there are
not enough <a href="#ruby-annotation-box"><i>ruby annotations</i></a>
in a <a href="#ruby-annotation-container-box"><i>ruby annotation
container</i></a>, the last one is associated with any excess <a
href="#ruby-base-box"><i>ruby bases</i></a>. (If there are not any in
the <a href="#ruby-annotation-container-box"><i>ruby annotation
container</i></a>, an anonymous empty one is assumed to exist.) If
there are not enough <a href="#ruby-base-box"><i>ruby bases</i></a>,
any remaining <a href="#ruby-annotation-box"><i>ruby
annotations</i></a> are assumed to be associated with empty, anonymous
bases inserted at the end of the <a
href="#ruby-base-container-box"><i>ruby base container</i></a>.
</ol>
<p>A this point, ruby “columns” are defined, each represented by a
single <a href="#ruby-base-box"><i>ruby base</i></a> and associated with
one <a href="#ruby-annotation-box"><i>ruby annotation</i></a> (possibly
an empty, anonymous one) from each <a href="#level"><i>annotation
level</i></a>.
<h4 id=nested-pairing><span class=secno>2.3.1. </span> Nested Ruby</h4>
<p>When <a href="#ruby-container-box"><i>ruby containers</i></a> are
nested, pairing begins with the deepest <a
href="#ruby-container-box"><i>ruby container</i></a>, then expands out,
treating each <a href="#ruby-container-box"><i>ruby container</i></a>
nested within another <a href="#ruby-container-box"><i>ruby
container</i></a> as a <a href="#ruby-base-box"><i>ruby base</i></a>,
and associating each <a href="#ruby-annotation-box"><i>ruby
annotation</i></a> associated with the nested <a
href="#ruby-container-box"><i>ruby container</i></a> as being associated
with (spanning) all of its <a href="#ruby-base-box"><i>ruby
bases</i></a>.
<p>Using nested <a href="#ruby-container-box"><i>ruby containers</i></a>
thus allows the representation of complex spanning relationships.
<p class=issue>This shouldn't belong in Level 1. But HTML5 allows it, so
we have to handle it. Yay HTML5.
<h3 id=box-model><span class=secno>2.4. </span> Generating Ruby Structure</h3>
<p>
<h3 id=box-model><span class=secno>2.5. </span> Ruby box model</h3>
<p>In the following description, the elements specified by Ruby
Annotation <a href="#RUBY" rel=biblioentry>[RUBY]<!--{{RUBY}}--></a> are
used to describe the box model. As mentioned earlier, a user agent can
obtain the same results by using the Ruby specific ‘<code
class=property>display</code>’ property values.
<p>For a user agent that supports the ruby markup, the ruby structure
consists of three or more boxes. The outermost container is the <a
href="http://www.w3.org/TR/ruby/#ruby"><samp>ruby</samp></a> element
itself. In the simple case, it is a container for two non-overlapping
boxes: the ruby text box (<a
href="http://www.w3.org/TR/ruby/#rt"><samp>rt</samp></a> element) and
the ruby base box (<a
href="http://www.w3.org/TR/ruby/#rb"><samp>rb</samp></a> element). The
positioning of these two boxes relative to each other is controlled by
the <a href="#rubypos">‘<code
class=property>ruby-position</code>’</a> property.
<div class=figure> <img
alt="Diagram of the ruby box model consisting of two boxes, one on top of the other, enclosed within a third box representing the ruby element"
class=example height=93 src="images/r-box-t.gif" width=223>
<p><b>Figure 3.2.1</b>: Ruby box model (simple case)
</div>
<p>In the case of complex ruby, the ruby element is a container for two
or three non-overlapping boxes: one ruby base collection (<a
href="http://www.w3.org/TR/ruby/#rbc"><samp>rbc</samp></a> element), and
one or two ruby text collections (<a
href="http://www.w3.org/TR/ruby/#rtc"><samp>rtc</samp></a> element). The
<samp>rbc</samp> element is itself a container for one or several ruby
base box (<samp>rb</samp> element), while each <samp>rtc</samp> element
is a container for one or several ruby text box (rt element). The
position of the <samp>rtc</samp> element in relation to the related
<samp>rbc</samp> element is controlled by the <a
href="#rubypos">‘<code class=property>ruby-position</code>’</a>
property. The two following figures show examples of these complex ruby.
<div class=figure> <img
alt="Diagram of a group ruby with a full ruby text above and partial ruby text below"
height=170 src="images/r-box-g.gif" width=408>
<p><b>Figure 3.2.2</b>: Ruby box model (complex ruby with an empty rt
element after)
</div>
<p>In the example above, the ruby text after (below) the ruby bases
contains two <samp>rt</samp> elements with the first one being empty,
the empty <samp>rt</samp> element corresponds to the first part of the
ruby base collection (the first part is identified by the first
<samp>rb</samp> element within the <samp> rbc</samp> element).
<div class=figure> <img
alt="Diagram of a group ruby with a spanning ruby text above and partial ruby text below"
height=173 src="images/r-box-h.gif" width=400>
<p><b>Figure 3.2.3</b>: Ruby box model (complex ruby with a spanning
ruby text element)
</div>
<p>In the example above, the ruby text before (above) the ruby bases
spans the whole ruby base collection. The ruby text after (below) the
ruby bases still contain two <samp>rt</samp> elements, one of which is
empty. The spanning behavior of <samp>rt</samp> text elements is
controlled by the <a
href="http://www.w3.org/TR/ruby/#ruby"><samp>rbspan</samp></a> attribute
in a way similar to the <samp>colspan</samp> attribute used for table
column.
<p class=issue><span class=issuehead>Issue: </span> The examples above
contain the term ‘<code class=css>group ruby</code>’, which is not
used elsewhere in this specification. It appears to be used in a way
that is different to the use of the term in JLREQ. I propose to replace
it with just ‘<a href="#ruby"><code class=property>ruby</code></a>’.
<p class=note><span class=note-label>Note:</span> The visual description
of the ruby elements does not refer necessarily to the logical orders of
the elements
<p>The width of the ruby box is by default determined by its widest child
element, whose width in turn is determined by its content. The width of
all direct children of the <a href="#ruby"><samp>ruby</samp></a> element
is the width of the widest children. In this respect, the ruby box is
much like a two or three row <samp>table</samp> element, with the
following exceptions:
<ul>
<li>the ruby box is an inline element, like an image, even though it
itself, like a table, is a container of other boxes
<li>the equivalent of the cells: the <samp>rb</samp> element and the
<samp>rt</samp> text element can only contain inline-level elements.
<li>the content of each ‘<code class=property>cell</code>’ is always
measured at its maximum width
<li>unlike a table, a ruby element doesn't have to fit in a line, the
ruby box may be split into several boxes at line boundary, depending of
the spanning of the ruby texts. This is however only possible for the
complex ruby and can only happen at the boundary of non spanning
elements.
<li>both the ruby text and the ruby base boxes may overlap with adjacent
text (outside of the ruby element) if an appropriate <a
href="#rubyover">‘<code class=property>ruby-overhang</code>’</a>
parameter is set via CSS. Note however that the actual content of the
ruby base cannot overlap with that adjacent text. The distribution of
the content of the ruby base within the ruby base box is controlled by
the <a href="#rubyalign">‘<code
class=property>ruby-align</code>’</a> property.
</ul>
<p>If the ruby text is not allowed to overhang, then the ruby behaves
like a traditional box, i.e. only its contents are rendered within its
boundaries and adjacent elements do not cross the box boundary:
<div class=figure>
<p><img
alt="Diagram showing the ruby boxes interacting with adjacent text"
class=example height=91 src="images/ro-n.gif" width=220>
<p><b>Figure 3.2.4</b>: Simple ruby whose text is not allowed to
overhang adjacent text
</div>
<p>However, if ruby text is allowed to overhang adjacent elements and it
happens to be wider than its base, then the adjacent content is
partially rendered within the area of the ruby base box, while the ruby
text may be partially overlapping with the upper blank parts of the
adjacent content:
<div class=figure>
<p><img
alt="Diagram showing the ruby boxes interacting with adjacent text"
class=example height=91 src="images/ro-a.gif" width=177>
<p><b>Figure 3.2.5</b>: Simple ruby whose text is allowed to overhang
adjacent text
</div>
<p>The ruby text related to a ruby base can never overhang another ruby
base.
<p>The alignment of the contents of the base or the ruby text is not
affected by the overhanging behavior. The alignment is achieved the same
way regardless of the overhang behavior setting and it is computed
before the space available for overlap is determined. It is controlled
by the <a href="#rubyalign">‘<code
class=property>ruby-align</code>’</a> property.
<p>The exact circumstances in which the ruby text will overhang other
elements, and to what degree it will do so, will be controlled by the <a
href="#rubyover">‘<code class=property>ruby-overhang</code>’</a>
property.
<p>This entire logic applies the same way in vertical ideographic layout,
only the dimension in which it works in such a layout is vertical,
instead of horizontal.
<p class=note><span class=note-label>Note:</span> Because the purpose of
the XHTML <samp>rp</samp> element <a href="#RUBY"
rel=biblioentry>[RUBY]<!--{{RUBY}}--></a> is to allow pre-existing user
agents to parenthesize ruby text content, an XHTML user agent should use
a styling rule for these elements that avoids rendering them such as
<samp>rp {display: none}</samp>.
<h3 id=ruby-line-height><span class=secno>2.6. </span> Ruby box and line
stacking</h3>
<p>The interaction of the ruby box and line stacking is controlled by the
‘<code class=property>line-stacking-ruby</code>’ property described
in the CSS3 Line Module. That property takes two values: ‘<code
class=property>include-ruby</code>’ and ‘<code
class=css>exclude-ruby. Depending on the property value, the ruby box is
considered or excluded for line stacking. Even if the ruby box is
considered for line stacking, some values of the
</code>’line-stacking-strategy' property (also described in the CSS3
Line module) can still create occurrences where a the ruby box will
eventually be ignored (e.g. case where the ‘<code
class=property>line-stacking-strategy</code>’ value is ‘<code
class=property>block-line-height</code>’).
<p>In the following figure, each line box is shown with leading space
distributed before and after the two text segments (‘<code
class=css>Previous line</code>’ and ‘<a href="#ruby-base-box"><code
class=css>Ruby base</code></a>’); the dotted lines show the line box
for each line. The ‘<code class=property>line-stacking-ruby</code>’
property is set to ‘<code class=property>exclude-ruby</code>’. The
achieved effect is that the ruby box does not affect the line to line
spacing. It is however the responsibility of the style author to avoid
‘<code class=property>bleeding</code>’ effects between the ruby text
and the surrounding text of images.
<div class=figure>
<p> <img alt="Diagram showing the ruby text using 2 half leading"
class=example height=138 src="images/rlh-a.gif" width=210>
<p><b>Figure 3.3.1</b>: Excluded Ruby text
</div>
<p>In the following figure, the line boxes have no extra leading space.
The ‘<code class=property>line-stacking-ruby</code>’ property is set
to ‘<code class=property>include-ruby</code>’ and the ‘<code
class=property>line-stacking-strategy</code>’ property is set to a
value where inline boxes are considered for line stacking. In this case,
the line box with the ruby text is affected and has its ‘<code
class=property>stack-height</code>’ increased by the amount necessary
to fit the ruby text.
<div class=figure>
<p> <img alt="Diagram showing the ruby text expanding above base text"
class=example height=111 src="images/rlh-b.gif" width=210>
<p><b>Figure 3.3.2</b>: Ruby text increasing line height
</div>
<p>This mechanism allows rendering of evenly spaced lines of text within
a block-level element, whether a line contains ruby or not. The authors
need only to set for the block-level element a line height value larger
than the computed line-height of the largest ruby element within the
block.
<h3 id=ruby-line-breaking><span class=secno>2.7. </span> Ruby box and
line breaking</h3>
<p>When a ruby falls at the end of a line where there is not sufficient
room for the entire ruby to fit on the line, the complex ruby may be
broken at locations where boxes of the ruby container align. Some
examples are provided below to provide more clarity.
<p> <img
alt="Diagram showing the line breaking opportunity in a complex ruby"
class=example height=201 src="images/r-break-a.gif" width=408>
<p><b>Figure 3.4.1</b>: Complex ruby line breaking opportunity
<p> <img
alt="Diagram showing the line breaking opportunity in a "Bopomofo" ruby"
class=example height=90 src="images/r-break-b.gif" width=300>
<p><b>Figure 3.4.1</b>: "Bopomofo" ruby line breaking opportunity
<p class=issue><span class=issuehead>Issue: </span> Line breaks should
only be allowed within ruby if the ruby base text can be broken at that
point. E.g. if complex Ruby is used to annotate the two morphemes of
"butterfly", the fact that we have added ruby annotations
should not cause a line breaking opportunity to be present between
"butter" and "fly"
<h2 id=ruby-props><span class=secno>3. </span> Ruby Properties</h2>
<h3 id=rubypos><span class=secno>3.1. </span> Ruby positioning: the ‘<a
href="#ruby-position"><code class=property>ruby-position</code></a>’
property</h3>
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=ruby-position>ruby-position</dfn>
<tr>
<th><a href="#values">Value</a>:
<td>[ over | under | inter-character ] && [ right | left ]
<tr>
<th>Initial:
<td>over right
<tr>
<th>Applies to:
<td>the parent of elements with display: ruby-text.
<tr>
<th>Inherited:
<td>yes
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>specified value (except for initial and inherit)
<tr>
<th>Animatable:
<td>no
<tr>
<th>Canonical order:
<td><abbr title="follows order of property value definition">per
grammar</abbr>
</table>
<p class=issue><span class=issuehead>Issue: </span> We replaced ‘<code
class=property>right</code>’ with ‘<code
class=property>inter-character</code>’, since that was its original
intended purpose and such removes potential ambiguity with ‘<code
class=property>inline</code>’ or ‘<code
class=property>before</code>’. Bopomofo ruby needs special handling by
the implementation, if ruby is to always appear to the right. (Note that
the user may also choose to position bopomofo ruby before the base, in
which case they would use the normal ‘<code
class=property>before</code>’ setting.)
<p>This property is used by the parent of elements with display:
ruby-text to control the position of the ruby text with respect to its
base. Such parents are typically either the <a
href="#ruby"><samp>ruby</samp></a> element itself (simple ruby) or the
<samp>rtc</samp> element (complex ruby). This assures that all parts of
a <samp>rtc</samp> element will be displayed in the same position.
Possible values:
<p class=issue><span class=issuehead>Issue-107: </span> Roland Steiner
has requested the addition of an auto value as default. See <a
href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&hdr-1-name=subject&hdr-1-query=ruby-position%3A+undesirable+default+value+%27before%27+for+complex+ruby&hdr-2-name=from&hdr-2-query=&hdr-3-name=message-id&hdr-3-query=&period_month=&period_year=&index-grp=Public__FULL&index-type=t&type-index=www-style&resultsperpage=20&sortby=date">this
thread</a> and <a
href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&hdr-1-name=subject&hdr-1-query=Styling+of+complex+Ruby&hdr-2-name=from&hdr-2-query=&hdr-3-name=message-id&hdr-3-query=&period_month=&period_year=&index-grp=Public__FULL&index-type=t&type-index=public-i18n-core&resultsperpage=20&sortby=date">this
one</a>.
<dl>
<dt><dfn id=over title="ruby-position:over">‘<code
class=css>over</code>’</dfn>
<dd>The ruby text appears over the base in horizontal text. This is the
most common setting used in ideographic East Asian writing systems.
This is the initial value.
<div class=figure>
<p> <img
alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing above the base"
height=33 src="images/shinkansen-top.gif" width=140>
<p><b>Figure 4.1.1</b>: Top ruby in horizontal layout applied to
Japanese text
</div>
<dt><dfn id=right title="ruby-position:right">‘<code
class=css>right</code>’</dfn>
<dd>The ruby text appears on the right side of the base in vertical
text.
<div class=figure>
<p> <img
alt="Diagram of ruby glyph layout in vertical mode with ruby text apearing vertically on the right of the base"
height=141 src="images/shinkansen-right.gif" width=33>