index.html
61.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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>CSS3 Ruby Module</title>
<style type="text/css">
dt {font-weight: normal}
/*.issue, .note {font-style: italic}*/
.figure {font-size: smaller;}
span.note-label {font-weight: bolder;}
/* Stolen from CSS2 Recommendation */
DIV.propdef TH {
text-align: right;
}
A.propdef-title {
background: yellow;
}
DIV.propdef {margin: 1.2em 0}
A.noxref:link, A.noxref:visited {color: black; /*color: inherit*/}
</style>
<style media="print" type="text/css">
img#edge { width: 80%; height: 70%;}dt.label { display: run-in; }
</style>
<link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css" />
<style type="text/css">
ins {
background-color: #99FF99;
text-decoration: none;
}
del {
display: inline;
color: silver;
}
.issue { color: #F00; }
.issuehead { background-color:#FF9; padding:2px 4px; border: 1px solid red; }
</style>
</head>
<body>
<div class="head">
<p><a href="http://www.w3.org/"><img alt="W3C" src="http://www.w3.org/Icons/w3c_home" height="48" width="72" /></a></p>
<h1>CSS3 Ruby Module</h1>
<h2 class="no-num no-toc" id="w3c-working">W3C Working Draft 30 June 2011</h2>
<dl>
<dt>This version:</dt>
<dd><a
href="http://www.w3.org/TR/2011/WD-css3-ruby-20110630/">http://www.w3.org/TR/2011/WD-css3-ruby-20110630/</a></dd>
<dt>Latest version:</dt>
<dd><a
href="http://www.w3.org/TR/css3-ruby/">http://www.w3.org/TR/css3-ruby/</a></dd>
<dt>Previous version:</dt>
<dd><a
href="http://www.w3.org/TR/2003/CR-css3-ruby-20030514">http://www.w3.org/TR/2003/CR-css3-ruby-20030514</a></dd>
<dt>Editor:</dt>
<dd>Richard Ishida (W3C)</dd>
<dt>Former editors:</dt>
<dd>Paul Nelson (Microsoft)</dd>
<dd>Michel Suignard (Microsoft)</dd>
<dd>Marcin Sawicki (Microsoft)</dd>
</dl>
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2011 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</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></div>
<hr />
<h2><a id="Abstract">Abstract</a></h2>
<p>"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 document proposes a set of CSS properties
associated with the 'Ruby' elements. They can be used in combination
with the Ruby elements of HTML.</p>
<h2><a id="Status">Status of This Document</a></h2>
<p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em></p>
<p>Publication as a Working Draft does not imply endorsement by the W3C
Membership. This is a draft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to cite
this document as other than work in progress.</p>
<p>The set of CSS properties proposed in this document can be used in combination
with the ruby elements of HTML to produce the stylistic effects needed to display ruby text appropriately relative to base text.</p>
<p>The (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
public mailing list <a href="mailto:www-style@w3.org">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>
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).</p>
<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 rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/32061/status">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>
<p>Text marked as an <span class="issue"><span class="issuehead">Issue</span></span> indicates proposals that are currently awaiting or under discussion. All such text will be subject to modification or removal.</p>
<p>See <a href="http://www.w3.org/Style/CSS/Tracker/products/25"> open issues in
Tracker.</a></p>
<!--end-status-->
<p>The comments that the CSS WG received during the previous Last Call review,
together with responses and resulting changes are listed in the <a
href="/Style/2003/css3-ruby-last-call">disposition of comments.</a></p>
<p>For the most up-to-date version of the specification, see the <a href="http://dev.w3.org/csswg/css3-ruby/">latest editor's copy</a> of this specification.</p>
<div class="subtoc">
<h2><a id="Contents">Table of Contents</a></h2>
<ul class="toc">
<li class="tocline2"><a href="#dependencies" class="tocxref">1. Dependencies</a></li>
<li class="tocline2"><a href="#introduction" class="tocxref">2. Introduction</a>
<ul class="toc">
<li class="tocline3"><a href="#conventions" class="tocxref">2.1 Document conventions</a></li>
<li class="tocline3"><a href="#ruby-def" class="tocxref">2.2 What is ruby?</a></li>
</ul>
</li>
<li class="tocline2"><a href="#css-model" class="tocxref">3. The CSS ruby model</a>
<ul class="toc">
<li class="tocline3"><a href="#display" class="tocxref">3.1 Ruby specific 'display' property values</a></li>
<li class="tocline3"><a href="#box-model" class="tocxref">3.2 Ruby box model</a></li>
<li class="tocline3"><a href="#ruby-line-height" class="tocxref">3.3 Ruby box and line
stacking</a></li>
<li class="tocline3"><a href="#ruby-line-breaking" class="tocxref">3.4 Ruby box and line
breaking</a></li>
</ul>
</li>
<li class="tocline2"><a href="#ruby-props" class="tocxref">4. Ruby Properties</a>
<ul class="toc">
<li class="tocline3"><a href="#rubypos" class="tocxref">4.1 Ruby
positioning: the 'ruby-position' property</a></li>
<li class="tocline3"><a href="#rubyalign" class="tocxref">4.2 Ruby
alignment: the 'ruby-align' property</a></li>
<li class="tocline3"><a href="#rubyover" class="tocxref">4.3 Ruby
overhanging: the 'ruby-overhang' property</a></li>
<li class="tocline3"><a href="#rubyspan" class="tocxref">4.4 Ruby
annotation spanning: the 'ruby-span' property</a></li>
</ul>
</li>
<li class="tocline2"><a href="#properties" class="tocxref">5. Properties index</a></li>
<li class="tocline2"><a href="#profiles" class="tocxref">6. Profiles</a></li>
<li class="tocline2"><a href="#glossary" class="tocxref">Glossary</a></li>
<li class="tocline2"><a href="#ack" class="tocxref">Acknowledgements</a></li>
<li class="tocline2"><a href="#references" class="tocxref">References</a></li>
</ul>
</div>
<hr />
<h2><a id="dependencies">1. Dependencies on other modules</a></h2>
<p>This CSS3 module depends on the following other CSS3 modules:</p>
<ul>
<li>Text</li>
<li>Line</li>
<li>Syntax</li>
<li>Values and units</li>
</ul>
<p class="issue"><span class="issuehead">Issue </span> Check these dependencies are correct.</p>
<h2><a id="introduction">2. Introduction</a></h2>
<h3><a id="conventions">2.1 Document conventions</a></h3>
<p>There are a number of illustrations in this document for which the following
legend is used:</p>
<p><img alt="Symbolic wide-cell glyph representation" class="example"
width="39" height="39" src="images/fullwidth.gif" /> - wide-cell glyph (e.g. Han)
which is the <i>n</i>-th character in the text run, they may also appear as
half size boxes when used as annotations.<br />
<img alt="Symbolic narrow-cell glyph representation" class="example"
width="19" height="39" src="images/halfwidth.gif" /> - narrow-cell glyph (e.g. Roman)
which is the <i>n</i>-th glyph in the text run.<br />
</p>
<p>Many typographical properties in East Asian typography depend on the fact
that a character is typically rendered as either a wide or narrow character. All
characters described by the Unicode Standard <a href="#UNICODE">[UNICODE]</a> can be categorized by a
width property. This is covered by the Unicode Standard Annex
<a href="#UAX11">[UAX#11]</a>. </p>
<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
usually symbolic, unless intentionally changed to make a point.</p>
<p>Finally, in this document, requirements are expressed using the key words
"MUST", "MUST NOT", "REQUIRED", "SHALL" and "SHALL NOT". Recommendations are
expressed using the key words "SHOULD", "SHOULD NOT" and "RECOMMENDED". "MAY"
and "OPTIONAL" are used to indicate optional features or behavior. These
keywords are used in accordance with <a href="#rfc2119">[RFC 2119]</a>. For
legibility these keywords are used in lowercase form.</p>
<h3><a id="ruby-def">2.2 What is ruby?</a></h3>
<p>"Ruby" is the commonly used name for a run of text that appears in the
immediate vicinity of another run of text, referred to as the "base", and
serves as an annotation or a pronunciation guide associated with that run of
text. Ruby, as used in Japanese, is described in JIS X-4051 [<a
href="#jis4051">JIS4051</a>] (in Japanese) and in Requirements for Japanese Text Layout [<a href="#jlreq">JLREQ</a>] (in English and Japanese)]. The ruby structure and the XHTML markup to represent it
is described in the Ruby Annotation [<a href="#ruby">RUBY</a>] specification. This
section describes the CSS properties relevant to ruby. The following figures
show two examples of Ruby.</p>
<div class="figure">
<p>
<img alt="Example of ruby applied on top of a Japanese expression"
class="example" src="images/licence.png" /></p>
<p><b>Figure 2.2.1</b>: Example of ruby used in Japanese (simple case)</p>
</div>
<div class="figure">
<p>
<img
alt="Example showing complex ruby with annotation text before and after
the base characters"
class="example" src="images/ruby-univ.gif" width="277" height="108" /></p>
<p><strong>Figure 2.2.2</strong>: Complex ruby with annotation text before and after
the base characters</p>
</div>
<p>In the first example, a single annotation is used to annotate the base
sequence. In Japanese typography, this simple case is sometimes called "<span lang="ja">taigo</span> ruby" or group-ruby (per-word ruby).</p>
<p>In the second example, multiple annotations are attached to a base
sequence, the hiragana characters on top refer to the pronunciation of each of the
base Kanji characters (annotated in a <a href="#g-monoruby">mono-ruby</a> fashion), while the words 'Keio'
and 'University' on the bottom are
annotations describing the English translation of respectively the first four
and the last two Kanji characters
of the base. To allow correct association between the hiragana characters and
their corresponding Kanji base characters, the spacing between these Kanji
characters may be adjusted (this happens around the fourth Kanji character in the
figure 2.2.2 above).</p>
<p class="Note"><span class="note-label">Note:</span> To avoid variable spacing between the Kanji
characters in the example above the hiragana annotations can also be created as
a simple annotation ruby.</p>
<p>The two examples correspond respectively to two types of ruby: simple ruby using simple ruby markup and complex ruby using complex ruby
markup.</p>
<h2><a id="css-model">3. The CSS ruby model</a></h2>
<h3 id="display">3.1 Ruby specific 'display' property values</h3>
<p>The CSS ruby model is based on the W3C Ruby Annotation Recommendation
[<a href="#ruby">RUBY</a>], which is consistent with the XHTML Modularization
Framework [<a href="#xhtml-mod">XHTMLMOD</a>]. The Recommendation specifies the ruby structure in a way
to closely parallel
the visual layout of the ruby element. In this model, a ruby consists of one
or more base elements associated with one or more annotation elements.</p>
<p>The CSS model does not require that the document language include elements
that correspond to each of these components. 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 'display'
property. The following 'display' values assign ruby semantics to an arbitrary
element:</p>
<dl>
<dt><strong>ruby</strong> (in XHTML: ruby)</dt>
<dd>Specifies that an element defines a ruby structure.</dd>
<dt><strong>ruby-base</strong> (in XHTML: rb)</dt>
<dd>Specifies that an element defines a ruby base.</dd>
<dt><strong>ruby-text</strong> (in XHTML: rt)</dt>
<dd>Specifies that an element defines a ruby text.</dd>
<dt><strong>ruby-base-container</strong> (in XHTML: rbc)</dt>
<dd>Specifies that an element contains one or more ruby base.</dd>
<dt><strong>ruby-text-container</strong> (in XHTML: rtc)</dt>
<dd>Specifies that an element contains one or more ruby text.</dd>
</dl>
<p class="issue"><span class="issuehead">Issue</span> I18n WG proposes that there should be a display value rp also, to allow XML-based formats to associate rp behaviour with elements. See <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&hdr-1-name=subject&hdr-1-query=[CSS3+Ruby]%20display:+rp+value&hdr-2-name=from&hdr-2-query=&hdr-3-name=message-id&hdr-3-query=&index-grp=Member__FULL+Public__FULL&index-type=t&type-index=public-i18n-core%40w3.org&resultsperpage=20&sortby=date">thread</a>.</p>
<p>The <a
href="http://www.w3.org/TR/ruby/#ruby"><samp>rbspan</samp></a> attribute should
also be used by XML applications to allow annotation spanning; but in addition, the
'<a href="#ruby-span">ruby-span</a>' property must be used by those applications to indicate to the user agent the number of
ruby base elements to be spanned.</p>
<h3><a id="box-model">3.2 Ruby box model</a></h3>
<p class="issue"><span class="issuehead">Issue</span> The spec needs to address anonymous box generation rules (and to make them compatible with HTML5 ruby markup).</p>
<p>In the following description, the elements specified by Ruby
Annotation [<a href="#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 'display'
property values. </p>
<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">'ruby-position'</a> property.</p>
<div class="figure">
<img class="example" width="223" height="93"
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"
src="images/r-box-t.gif" />
<p><b>Figure 3.2.1</b>: Ruby box model (simple case)</p>
</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">'ruby-position'</a> property. The two
following figures show examples of these complex ruby.</p>
<div class="figure">
<img src="images/r-box-g.gif"
alt="Diagram of a group ruby with a full ruby text above and partial ruby text below" width="408" height="170" />
<p><b>Figure 3.2.2</b>: Ruby box model (complex ruby with an empty rt element
after)</p>
</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).</p>
<div class="figure">
<img src="images/r-box-h.gif"
alt="Diagram of a group ruby with a spanning ruby text above and partial ruby text below" width="400" height="173" />
<p><b>Figure 3.2.3</b>: Ruby box model (complex ruby with a spanning ruby text
element)</p>
</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>
<p class="issue"><span class="issuehead">Issue</span> The examples above contain the term 'group ruby', 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 'ruby'.</p>
<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>
<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 <samp>ruby</samp> 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:</p>
<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>
<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>
<li>the content of each 'cell' is always measured at its maximum width</li>
<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>
<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">'ruby-overhang'</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">'ruby-align'</a>
property.</li>
</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:</p>
<div class="figure">
<p><img class="example" width="220" height="91"
alt="Diagram showing the ruby boxes interacting with adjacent text"
src="images/ro-n.gif" /></p>
<p><b>Figure 3.2.4</b>: Simple ruby whose text is not allowed to overhang
adjacent text</p>
</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:</p>
<div class="figure">
<p><img class="example" width="177" height="91"
alt="Diagram showing the ruby boxes interacting with adjacent text"
src="images/ro-a.gif" /></p>
<p><b>Figure 3.2.5</b>: Simple ruby whose text is allowed to overhang adjacent
text</p>
</div>
<p>The ruby text related to a ruby base can never overhang another ruby
base.</p>
<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">'ruby-align'</a> property.</p>
<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">'ruby-overhang'</a> property.</p>
<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>
<p class="note"><span class="note-label">Note:</span> Because the purpose of the XHTML <samp>rp</samp> element [<a
href="#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>.</p>
<h3><a id="ruby-line-height">3.3 Ruby box and line stacking</a></h3>
<p>The interaction of the ruby box and line stacking is controlled by the
'line-stacking-ruby' property described in the CSS3 Line Module. That property
takes two values: 'include-ruby' and '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
'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 'line-stacking-strategy' value is 'block-line-height').</p>
<p>In the following figure, each line box is shown with leading space
distributed before and after the two text segments ('Previous line' and 'Ruby
base'); the dotted lines show the line box for each line. The
'line-stacking-ruby' property is set to 'exclude-ruby'. 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 'bleeding' effects between the ruby
text and the surrounding text of images.</p>
<div class="figure">
<p>
<img class="example"
alt="Diagram showing the ruby text using 2 half leading"
src="images/rlh-a.gif" width="210" height="138" /></p>
<p><b>Figure 3.3.1</b>: Excluded Ruby text</p>
</div>
<p>In the following figure, the line boxes have no extra leading space. The
'line-stacking-ruby' property is set to 'include-ruby' and the
'line-stacking-strategy' 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 'stack-height' increased by the amount
necessary to fit the ruby text.</p>
<div class="figure">
<p>
<img class="example"
alt="Diagram showing the ruby text expanding above base text"
src="images/rlh-b.gif" width="210" height="111" /></p>
<p><b>Figure 3.3.2</b>: Ruby text increasing line height</p>
</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.</p>
<h3><a id="ruby-line-breaking">3.4 Ruby box and line breaking</a></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>
<p>
<img class="example"
alt="Diagram showing the line breaking opportunity in a complex ruby"
src="images/r-break-a.gif" width="408" height="201" /></p>
<p><b>Figure 3.4.1</b>: Complex ruby line breaking opportunity</p>
<p>
<img class="example"
alt='Diagram showing the line breaking opportunity in a "Bopomofo" ruby'
src="images/r-break-b.gif" width="300" height="90" /></p>
<p><b>Figure 3.4.1</b>: "Bopomofo" ruby line breaking opportunity</p>
<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" </p>
<h2><a id="ruby-props">4. Ruby Properties</a></h2>
<p>All properties, in addition to the noted values, take 'initial' and
'inherit'. These values are not repeated in each of the property value
enumeration. </p>
<h3><a id="rubypos"></a>4.1 Ruby positioning: the <a href="#ruby-position">'ruby-position'</a> property</h3>
<table class="propdef" cellspacing="0" cellpadding="0">
<tbody>
<tr align="left"><th>Name:</th><th id="ruby-position">ruby-position</th></tr>
<tr>
<td><em>Value:</em></td>
<td>before | after | inter-character | inline</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td>before</td>
</tr>
<tr>
<td><em>Applies to:</em></td>
<td>the parent of elements with display: ruby-text.</td>
</tr>
<tr>
<td><em>Inherited:</em></td>
<td>yes</td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>N/A</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual</td>
</tr>
<tr>
<td><em>Computed value: </em></td>
<td>specified value (except for initial and inherit)</td>
</tr>
</tbody>
</table>
<p class="issue"><span class="issuehead">Issue</span> We replaced 'right' with 'inter-character', since that was its original intended purpose and such removes potential ambiguity with 'inline' or 'before'. 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 'before' setting.)</p>
<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 <samp>ruby</samp> 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>
<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>.</p>
<dl>
<dt><strong>before</strong></dt>
<dd>The ruby text appears before the base. 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"
class="example" src="images/shinkansen-top.gif" width="140" height="33" /></p>
<p><b>Figure 4.1.1</b>: Top ruby in horizontal layout applied to
Japanese text</p>
</div>
<p>If the base appears in a vertical-ideographic layout mode, the ruby
appears on the right side of the base and is rendered in the same layout
mode as the base (i.e. vertical-ideographic).</p>
<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"
class="example" src="images/shinkansen-right.gif" width="33" height="141" /></p>
<p><b>Figure 4.1.2</b>: Top ruby in vertical ideographic layout applied
to Japanese text</p>
</div>
</dd>
<dt><strong>after</strong></dt>
<dd>The ruby text appears after the base. This is a relatively rare
setting used in ideographic East Asian writing systems, most easily
found in educational text.
<div class="figure">
<p>
<img
alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing below the base"
class="example" src="images/shinkansen-bottom.gif" width="142" height="36" /></p>
<p><b>Figure 4.1.3</b>: Bottom ruby in horizontal layout applied to
Japanese text</p>
</div>
<p>If the base appears in a vertical ideographic mode, the bottom ruby
appears on the left side of the base and is rendered in the same layout
mode as the base (i.e. vertical).</p>
<div class="figure">
<p>
<img
alt="Diagram of ruby glyph layout in vertical mode with ruby text apearing vertically on the left of the base"
class="example" src="images/shinkansen-left.gif" width="37" height="141" /></p>
<p><b>Figure 4.1.4</b>: Bottom ruby in vertical ideographic layout applied
to Japanese text</p>
</div>
</dd>
<dt><strong>inter-character</strong></dt>
<dd>
<p class="issue"><span class="issuehead">Issue</span> We replaced 'right' with 'inter-character', since that was its original intended purpose and such removes potential ambiguity with 'inline' or 'before'. 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 'before' setting.) See <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&hdr-1-name=subject&hdr-1-query=[CSS3+Ruby]%20Vertical+layout+not+enough+for+bopomofo&hdr-2-name=from&hdr-2-query=&hdr-3-name=message-id&hdr-3-query=&index-grp=Member__FULL+Public__FULL&index-type=t&type-index=public-i18n-core%40w3.org&resultsperpage=20&sortby=date">this thread</a> following a request from the i18n WG.</p>
<p>The ruby text appears on the right of the base. Unlike 'before' and
'after', this value is visual and is not relative to the text flow direction.</p>
<p>This value is provided for the special case of traditional Chinese as used especially in
Taiwan: ruby (made of <a href="#g-bopomofo"><span
lang="zh">bopomofo</span></a> glyphs) in that context appears vertically along
the right side of the base glyph, whether the layout of the base characters is vertical or horizontal:</p>
<div class="figure">
<p><img alt="Example of Taiwanese-style ruby" class="example"
width="138" height="42" src="images/bopomofo.gif" /></p>
<p><b>Figure 4.1.5</b>: "<span lang="zh">Bopomofo</span>" ruby in
traditional Chinese (ruby text shown in blue for clarity) in horizontal
layout</p>
</div>
<p class="note"><span class="note-label">Note:</span> The bopomofo
transcription is written in the normal way as part of the ruby text.
The user agent is responsible for ensuring the correct relative alignment
and positioning of the glyphs, including those corresponding to the
tone marks, when displaying. Tone marks are spacing characters that occur in memory at the end of the ruby text for each base character. They are usually displayed in a separate column to the right of the bopomofo characters, and the height of the tone mark depends on the number of characters in the syllable. One tone mark, however, is placed above the bopomofo, not to the right of it.</p>
<p class="note"><span class="note-label">Note:</span> To make bopomofo annotations appear before or after the base text, like annotations for most other East Asian writing systems, use the 'before' and 'after' values of ruby-position.</p>
<p>It is not defined how a user-agent should handle ruby text that is not bopomofo when the value of ruby-position is set to 'right'.</p>
</dd>
<dt><strong>inline</strong></dt>
<dd>
<p>Ruby text follows the ruby base with no special styling. The value can be used to disable ruby text positioning.</p>
<p>If the author has used the XHTML <samp>rp</samp> element [<a href="#ruby">RUBY</a>] they should set the <samp>display</samp> value for that element to <samp>inline</samp>, so that the ruby text is distinguishable from the base text. If no <samp>rp</samp> element has been used, the author can use the <samp>content</samp> property with the <samp>:before</samp> and <samp>:after</samp> pseudo-elements to set off the ruby text. </p>
<p class="issue"><span class="issuehead">Issue</span> Here is a <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&hdr-1-name=subject&hdr-1-query=[CSS3+Ruby]%20inline+value+description+missing&hdr-2-name=from&hdr-2-query=&hdr-3-name=message-id&hdr-3-query=&index-grp=Member__FULL+Public__FULL&index-type=t&type-index=public-i18n-core%40w3.org&resultsperpage=20&sortby=date">request </a>for this section to be added, from the i18n WG..</p>
</dd>
</dl>
<p>If two rtc elements are set with the same ruby-position value, (for example
both 'before'), the relative position of the two elements is undefined. This
setting should not be used.</p>
<h3>4<a id="rubyalign">.2 Ruby alignment: the 'ruby-align' property</a></h3>
<table class="propdef" cellspacing="0" cellpadding="0">
<tbody>
<tr align="left"><th>Name:</th><th id="ruby-align">ruby-align</th></tr>
<tr>
<td><em>Value:</em></td>
<td>auto | start | left | center | end | right | distribute-letter |
distribute-space | line-edge</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td>auto</td>
</tr>
<tr>
<td><em>Applies to:</em></td>
<td>all elements and generated content</td>
</tr>
<tr>
<td><em>Inherited:</em></td>
<td>yes</td>
</tr>
<tr>
<td><em>Percentages: </em></td>
<td>N/A</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual</td>
</tr>
<tr>
<td><em>Computed value: </em></td>
<td>specified value (except for initial and inherit)</td>
</tr>
</tbody>
</table>
<p>This property can be used on any element to control the text alignment of
the ruby text and ruby base contents relative to each other. It applies to all
the rubys in the element. For simple ruby, the alignment is applied to the
ruby child element whose content is shorter: either the <a
href="http://www.w3.org/TR/ruby/#rb"><samp>rb</samp></a> element or the <a
href="http://www.w3.org/TR/ruby/#rt"><samp>rt</samp></a> element [<a
href="#ruby">RUBY</a>]. For complex ruby, the alignment is also applied to the
ruby child elements whose content is shorter: either the <samp>rb</samp>
element and/or one or two <samp>rt</samp> elements for each related ruby text
and ruby base element within the <samp>rtc</samp> and <samp>rbc</samp>
element.</p>
<p>Possible values:</p>
<p class="issue"><span class="issuehead">Issue</span> Tony Graham has <a href="http://www.w3.org/Style/XSL/Group/FO/wiki/Ruby#Treat_CSS3_.22ruby-align.22_As_Shorthand.3F">suggested </a>that distribute-letter and distribute-space be values of a ruby-group-distribution property, and line-edge be moved to a ruby-alignment-edge property, and that the rest be gathered under a ruby-alignment property. And that ruby-align become a shorthand.</p>
<dl>
<dt><strong>auto</strong></dt>
<dd>The user agent determines how the ruby contents are aligned. This is
the initial value. The behavior recommended by [<a href="#jlreq">JLREQ</a>] is for wide-cell ruby to be aligned in the 'distribute-space' mode:
<div class="figure">
<p><img class="example" width="145" height="91"
alt="Diagram of glyph layout in auto aligned ruby when ruby text is shorter than base"
src="images/ra-ds.gif" /><img class="example" width="145" height="91"
alt="Diagram of glyph layout in auto aligned ruby when ruby text is longer than base"
src="images/ra-ds-rb.gif" /></p>
<p><b>Figure 4.2.1</b>: Wide-cell text in 'auto' ruby alignment is
'distribute-space' justified</p>
</div>
<p>The recommended behavior for narrow-cell glyph ruby is to be
aligned in the 'center' mode.</p>
<div class="figure">
<p><img
alt="Diagram of glyph layout in auto aligned ruby when halfwidth ruby text is shorter than base"
class="example" width="145" height="91"
src="images/ra-c-h.gif" /><img
alt="Diagram of character layout in auto aligned ruby when ruby text is longer than narrow-width base"
class="example" width="145" height="91"
src="images/ra-c-rb-h.gif" /></p>
<p><b>Figure 4.2.2</b>: Narrow-width ruby text in 'auto' ruby alignment
is centered</p>
</div>
</dd>
<dt><strong>left</strong></dt>
<dd>The ruby text content is aligned with the start edge of the base.
<p class="issue"><span class="issuehead">Issue</span> The i18n WG feels that start and left should not be synonymous, and proposed to drop left (there is no left/right in overhang)? See <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&hdr-1-name=subject&hdr-1-query=[CSS3+Ruby]%20left/start+and+right/end&hdr-2-name=from&hdr-2-query=&hdr-3-name=message-id&hdr-3-query=&index-grp=Member__FULL+Public__FULL&index-type=t&type-index=public-i18n-core%40w3.org&resultsperpage=20&sortby=date">this thread</a>.</p>
<div class="figure">
<p><img
alt="Diagram of glyph layout in left aligned ruby when ruby text is shorter than base"
class="example" width="145" height="91" src="images/ra-l.gif" /><img
class="example" width="145" height="91"
alt="Diagram of glyph layout in left aligned ruby when ruby text is longer than base"
src="images/ra-l-rb.gif" /></p>
<p><b>Figure 4.2.3</b>: Start ruby alignment</p>
</div>
</dd>
<dt><strong>center</strong></dt>
<dd>The ruby text content is centered within the width of the base. If the
length of the base is smaller than the length of the ruby text, then the
base is centered within the width of the ruby text.
<div class="figure">
<p><img class="example" width="145" height="91"
alt="Diagram of glyph layout in center aligned ruby when ruby text is shorter than base"
src="images/ra-c.gif" /><img class="example" width="145" height="91"
alt="Diagram of glyph layout in center aligned ruby when ruby text is longer than base"
src="images/ra-c-rb.gif" /></p>
<p><b>Figure 4.2.4</b>: Center ruby alignment</p>
</div>
</dd>
<dt><strong>right</strong></dt>
<dd>The ruby text content is aligned with the end edge of the base.
<p class="issue"><span class="issuehead">Issue</span> The i18n WG feels that end and right should not be synonymous, and proposed to drop right (there is no left/right in overhang)? See <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&hdr-1-name=subject&hdr-1-query=[CSS3+Ruby]%20left/start+and+right/end&hdr-2-name=from&hdr-2-query=&hdr-3-name=message-id&hdr-3-query=&index-grp=Member__FULL+Public__FULL&index-type=t&type-index=public-i18n-core%40w3.org&resultsperpage=20&sortby=date">this thread</a>.</p>
<div class="figure">
<p><img class="example" width="145" height="91"
alt="Diagram of glyph layout in right aligned ruby when ruby text is shorter than base"
src="images/ra-r.gif" /><img class="example" width="145" height="91"
alt="Diagram of glyph layout in right aligned ruby when ruby text is longer than base"
src="images/ra-r-rb.gif" /></p>
<p><b>Figure 4.2.5</b>: End ruby alignment</p>
</div>
</dd>
<dt><strong>distribute-letter</strong></dt>
<dd>If the width of the ruby text is smaller than that of the base, then
the ruby text contents are evenly distributed across the width of the
base, with the first and last ruby text glyphs lining up with the
corresponding first and last base glyphs. If the width of the ruby text
is at least the width of the base, then the letters of the base are
evenly distributed across the width of the ruby text.
<div class="figure">
<p><img class="example" width="145" height="91"
alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is shorter than base"
src="images/ra-dl.gif" /><img class="example" width="145" height="91"
alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is longer than base"
src="images/ra-dl-rb.gif" /></p>
<p><b>Figure 4.2.6</b>: Distribute-letter ruby alignment</p>
</div>
</dd>
<dt><strong>distribute-space</strong></dt>
<dd>If the width of the ruby text is smaller than that of the base, then
the ruby text contents are evenly distributed across the width of the
base, with a certain amount of white space preceding the first and
following the last character in the ruby text. That amount of white
space is normally equal to half the amount of inter-character space of
the ruby text. If the width of the ruby text is at least the width of
the base, then the same type of space distribution applies to the base.
In other words, if the base is shorter than the ruby text, the base is
distribute-space aligned. This type of alignment
is described by [<a href="#jlreq">JLREQ</a>].
<div class="figure">
<p><img class="example" width="145" height="91"
alt="Diagram of glyph layout in distribute-space aligned ruby when ruby text is shorter than base"
src="images/ra-ds.gif" /><img class="example" width="145" height="91"
alt="Diagram of glyph layout in distribute-space aligned ruby when ruby text is longer than base"
src="images/ra-ds-rb.gif" /></p>
<p><b>Figure 4.2.7</b>: Distribute-space ruby alignment</p>
</div>
</dd>
<dt><strong>line-edge</strong></dt>
<dd>If the ruby text is not adjacent to a line edge, it is aligned as in
'auto'. If it is adjacent to a line edge, then it is still aligned as in
auto, but the side of the ruby text that touches the end of the line is
lined up with the corresponding edge of the base. This type of alignment
is described by [<a href="#jlreq">JLREQ</a>]. This type of alignment is
relevant only to the scenario where the ruby text is longer than the
ruby base. In the other scenarios, this is just 'auto'.
<div class="figure">
<p><img class="example" width="146" height="109"
alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is shorter than base"
src="images/ra-le-l.gif" /><img class="example" width="146"
height="110"
alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is longer than base"
src="images/ra-le-r.gif" /></p>
<p><b>Figure 4.2.8</b>: Line edge ruby alignment</p>
</div>
</dd>
</dl>
<p>For a complex ruby with spanning elements, one additional consideration is
required. If the spanning element spans multiple 'rows' (other rbc or rtc
elements), and the ruby alignment requires space distribution among the
'spanned' elements, a ratio must be determined among the 'columns' of spanned
elements. This ratio is computed by taking into consideration the widest
element within each column.</p>
<p>In the context of this property, the 'left' and 'right' values are
synonymous with the 'start' and 'end' values respectively, i.e. their meaning
is relative according to the text layout flow. Most of the other CSS
properties interpret 'left' and 'right' on an 'absolute' term.</p>
<h3>4<a id="rubyover">.3 Ruby overhanging: the 'ruby-overhang' property</a></h3>
<table class="propdef" cellspacing="0" cellpadding="0">
<tbody>
<tr align="left"><th>Name:</th><th id="ruby-overhang">ruby-overhang</th></tr>
<tr>
<td><em>Value:</em></td>
<td>auto | start | end | none</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td>none</td>
</tr>
<tr>
<td><em>Applies to:</em></td>
<td>the parent of elements with display: ruby-text</td>
</tr>
<tr>
<td><em>Inherited:</em></td>
<td>yes</td>
</tr>
<tr>
<td><em>Percentages: </em></td>
<td>N/A</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual</td>
</tr>
<tr>
<td><em>Computed value: </em></td>
<td>specified value (except for initial and inherit)</td>
</tr>
</tbody>
</table>
<p>This property determines whether, and on which side, ruby text is allowed
to partially overhang any adjacent text in addition to its own base, when the
ruby text is wider than the ruby base. Note that ruby text is never allowed to
overhang glyphs belonging to another ruby base. <span class="issue"><span class="issuehead">Issue</span> This rule must be broken if we are to allow support for jukugo ruby.</span> Also the user agent is free to assume
a maximum amount by which ruby text may overhang adjacent text. The user agent may use
the [<a href="#jis4051">JIS4051</a>] recommendation of using one ruby text character
length as the maximum overhang length. Detailed rules for how ruby text can overhang adjacent characters for Japanese are described by [<a href="#jlreq">JLREQ</a>].</p>
<p>Possible values:</p>
<dl>
<dt><strong>auto</strong></dt>
<dd>The ruby text can overhang text adjacent to the base on either side. [<a href="#jlreq">JLREQ</a>] and [<a href="#jis4051">JIS4051</a>] specify the categories of characters that
ruby text can overhang. The user agent is free to follow those recommendations or specify its own classes of
characters to overhang. This is the initial value.
<div class="figure">
<p><img class="example" width="177" height="91"
alt="Diagram of glyph layout in overhanging ruby" src="images/ro-a.gif" /></p>
<p><b>Figure 4.3.1</b>: Ruby overhanging adjacent text</p>
</div>
</dd>
<dt><strong>start</strong></dt>
<dd>The ruby text can only overhang the text that precedes it. That means, for
example, that ruby cannot overhang text that is to the right of it in
horizontal LTR layout, and it cannot overhang text that is below it in
vertical-ideographic layout.
<div class="figure">
<p><img class="example" width="199" height="91"
alt="Diagram of glyph layout when ruby overhangs the preceding glyphs only"
src="images/ro-s.gif" /></p>
<p><b>Figure 4.3.2</b>: Ruby overhanging preceding text only</p>
</div>
</dd>
<dt><strong>end</strong></dt>
<dd>The ruby text can only overhang the text that follows it. That means, for
example, that ruby cannot overhang text that is to the left of it in
horizontal LTR layout, and it cannot overhang text that is above it in
vertical-ideographic layout.
<div class="figure">
<p><img class="example" width="198" height="91"
alt="Diagram of glyph layout when ruby overhangs the following characters only"
src="images/ro-e.gif" /></p>
<p><b>Figure 4.3.3</b>: Ruby overhanging following text only</p>
</div>
</dd>
<dt><strong>none</strong></dt>
<dd>The ruby text cannot overhang any text adjacent to its base, only its
own base.
<div class="figure">
<p><img class="example" width="220" height="91"
alt="Diagram of glyph layout in non-overhanging ruby"
src="images/ro-n.gif" /></p>
<p><b>Figure 4.3.4</b>: Ruby not allowed to overhang adjacent text</p>
</div>
</dd>
</dl>
<h3>4<a id="rubyspan">.4 Ruby annotation spanning: the 'ruby-span' property</a></h3>
<table class="propdef" cellspacing="0" cellpadding="0">
<tbody>
<tr align="left"><th>Name:</th><th id="ruby-span">ruby-span</th></tr>
<tr>
<td><em>Value:</em></td>
<td>attr(x) | none</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td>none</td>
</tr>
<tr>
<td><em>Applies to:</em></td>
<td>elements with display: ruby-text</td>
</tr>
<tr>
<td><em>Inherited:</em></td>
<td>no</td>
</tr>
<tr>
<td><em>Percentages: </em></td>
<td>N/A</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual</td>
</tr>
<tr>
<td><em>Computed value: </em></td>
<td><number></td>
</tr>
</tbody>
</table>
<p>This property controls the spanning behavior of annotation elements. </p>
<p class="note"><span class="note-label">Note:</span> A XHTML user agent may also use the <samp>rbspan</samp>
attribute to get the same effect.</p>
<p>Possible values:</p>
<dl>
<dt><strong>attr(x)</strong></dt>
<dd>The value of attribute 'x' as a string value. The string value is
evaluated as a <number> to determine the number of ruby base elements to be
spanned by the annotation element. If the <number> is '0', it is replaced by
'1'.The <number> is the computed value. </dd>
<dt>none</dt>
<dd>No spanning. The computed value is '1'.</dd>
</dl>
<p>The following example shows an XML example using the 'display' property
values associated with the 'ruby structure and the 'ruby-span' property</p>
<pre class="xml">myruby { display: ruby; }
myrbc { display: ruby-base-container; }
myrb { display: ruby-base; }
myrtc.before { display: ruby-text-container; ruby-position: before}
myrtc.after { display: ruby-text-container; ruby-position: after}
myrt { display: ruby-text; ruby-span: attr(rbspan); }
...
<myruby>
<myrbc>
<myrb>10</myrb>
<myrb>31</myrb>
<myrb>2002</myrb>
</myrbc>
<myrtc class="before">
<myrt>Month</myrt>
<myrt>Day</myrt>
<myrt>Year</myrt>
</myrtc>
<myrtc class="after">
<myrt rbspan="3">Expiration Date</myrt>
</myrtc>
</myruby></pre>
<hr />
<h2><a id="properties">5. Properties index</a></h2>
<p id="properties0">In addition to the specified values, all properties take the
'inherit' and 'initial' values.</p>
<table class="proptable" border='1'>
<thead>
<tr align='center'>
<th>Name</th>
<th>Values</th>
<th>Initial</th>
<th>Applies to </th>
<th>Inh.</th>
<th>Percentages </th>
<th>Media groups<br />
</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#rubyalign">'ruby-align'</a></td>
<td>auto | start | left | center | end | right | distribute-letter |
distribute-space | line-edge</td>
<td>auto</td>
<td> all elements and generated content</td>
<td>yes</td>
<td>N/A </td>
<td>visual</td>
</tr>
<tr>
<td><a href="#rubyover">'ruby-overhang'</a></td>
<td>auto | start | end | none</td>
<td>none</td>
<td>the parent of elements with display: ruby-text</td>
<td>yes</td>
<td> N/A</td>
<td>visual</td>
</tr>
<tr>
<td><a href="#rubypos">'ruby-position'</a></td>
<td>before | after | right | inline</td>
<td>see individual properties</td>
<td>the parent of elements with display: ruby-text</td>
<td>yes</td>
<td> N/A</td>
<td>visual</td>
</tr>
<tr>
<td><a href="#rubyspan">'ruby-span'</a></td>
<td>attr(x) | none</td>
<td>none</td>
<td>elements with display: ruby-text</td>
<td>no</td>
<td>N/A</td>
<td>visual</td>
</tr>
</tbody>
</table>
<p class="issue"><span class="issuehead">Issue</span> The i18n WG has requested the addition of a sample user agent default style sheet, as promised by Ruby Annotation section 3.4. See <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&hdr-1-name=subject&hdr-1-query=[CSS3+Ruby]%20Default+stylesheet&hdr-2-name=from&hdr-2-query=&hdr-3-name=message-id&hdr-3-query=&index-grp=Member__FULL+Public__FULL&index-type=t&type-index=public-i18n-core%40w3.org&resultsperpage=20&sortby=date">this thread</a>.</p>
<h2><a id="profiles">6. Profiles</a></h2>
<p>There are two modules defined by this module:</p>
<p>CSS3 Simple Ruby model</p>
<p>CSS3 Complex Ruby model.</p>
<p>They both contain all the properties specified by this CSS chapter, i.e. <a
href="#rubyalign">'ruby-align'</a>, <a href="#rubyover">'ruby-overhang'</a>, <a href="#rubypos">'ruby-position'</a>
and <a href="#rubyspan">'ruby-span'</a>. They differ by the required
'display' property values. The Simple Ruby model requires the values: 'ruby',
'ruby-base' and 'ruby-text'. The Complex Ruby model requires in addition the
values: 'ruby-base-container' and 'ruby-text-container'.</p>
<h2><a id="glossary">Glossary</a></h2>
<dl>
<dt><a id="g-bopomofo"><strong><span
lang="zh">Bopomofo</span></strong></a></dt>
<dd>37 characters and 4 tone markings used as phonetics in Chinese,
especially standard Mandarin.</dd>
<dt><a id="g-hanja"><strong><span
lang="ko">Hanja</span></strong></a></dt>
<dd>Subset of the Korean writing system that utilizes ideographic
characters borrowed or adapted from the Chinese writing system. Also see
<a href="#g-kanji"><span lang="ja">Kanji</span></a>.</dd>
<dt><a id="g-hiragana"><strong><span
lang="ja">Hiragana</span></strong></a></dt>
<dd>Japanese syllabic script, or character of that script. Rounded and
cursive in appearance. Subset of the Japanese writing system, used together
with kanji and katakana. In recent times, mostly used to write Japanese
words when kanji are not available or appropriate, and word endings and
particles. Also see <a
href="#g-katakana"><span lang="ja">Katakana</span></a>.</dd>
<dt><a id="g-ideogram"><strong>Ideograph</strong></a></dt>
<dd>A character that is used to represent an idea, word, or word component,
in contrast to a character from an alphabetic or syllabic script. The most
well-known ideographic script is used (with some variation) in East Asia
(China, Japan, Korea,...).</dd>
<dt><a id="g-kana"><strong><span lang="ja">Kana</span></strong></a></dt>
<dd>Collective term for hiragana and katakana.</dd>
<dt><a id="g-kanji"><strong>Kanji</strong></a></dt>
<dd>Japanese term for ideographs; ideographs used in Japanese. Subset of the
Japanese writing system, used together with hiragana and katakana. Also see <a
href="#g-hanja"><span lang="ko">Hanja</span></a>.</dd>
<dt><a id="g-katakana"><strong><span
lang="ja">Katakana</span></strong></a></dt>
<dd>Japanese syllabic script, or character of that script. Angular in
appearance. Subset of the Japanese writing system, used together with
kanji and hiragana. In recent times, mainly used to write foreign words. Also see <a
href="#g-hiragana"><span lang="ja">Hiragana</span></a>.</dd>
<dt><a id="g-monoruby" name="g-monoruby"><strong>Mono-ruby</strong></a></dt>
<dd>In Japanese typography: Ruby associated with a single character of
the base text.</dd>
<dt><a id="g-ruby"><strong>Ruby</strong></a></dt>
<dd>A run of text that appears in the vicinity of another run of text and
serves as an annotation or a pronunciation guide for that text.</dd>
</dl>
<hr />
<h2><a id="ack">Acknowledgements</a></h2>
<p>This specification would not have been possible without the help from:</p>
<p>Stephen Deach, Martin Dürst, Hideki Hiura(<span lang="ja">樋浦 秀樹</span>), Masayasu Ishikawa(<span lang="ja">石川
雅康</span>), Chris
Pratley, Takao Suzuki(<span lang="ja">鈴木 孝雄</span>), Frank Yung-Fong Tang, Chris Thrasher, Masafumi Yabe<span lang="ja">家辺
勝文</span>), Steve Zilles.</p>
<hr />
<h2><a id="references">References</a></h2>
<dl>
<dt>[<a id="jis4051">JIS4051</a>]<span class="issue"> <span class="issuehead">Issue</span> Change this to the 2004 version of the spec.</span></dt>
<dd><em>Line composition rules for Japanese documents </em>(<span lang="ja">日本語文書の行組版方法</span>)</dd>
<dd>JIS X 4051-1995, Japanese Standards Association, 1995 (in
Japanese)</dd>
<dt>[<a id="jis4052">JIS4052</a>] </dt>
<dd><em>"<cite>Exchange format for Japanese documents with composition markup</cite>"</em>
(<span lang="ja">日本語文書の組版指定交換形式</span>) </dd>
<dd>JIS X 4052:2000, Japanese Standards Association, 2000 (in Japanese)</dd>
<dt>[<a id="jlreq">JLREQ</a>]</dt>
<dd><em>"<cite>Requirements for Japanese Text Layout, W3C WG Note</cite>"</em>
(<span lang="ja">日本語組版処理の要件(日本語版)</span>)</dd>
<dd>Yasuhiro Anan (阿南 康宏), Hiroyuki Chiba (千葉 弘幸), Junsaburo Edamoto (枝本 順三郎), Richard Ishida, Keiichiro Ishino (石野 恵一郎), Tatsuo Kobayashi (小林 龍生), Toshi Kobayashi (小林 敏), Kenzou Onozawa (小野澤 賢三), Felix Sasaki, 4 June 2009,<br />
Available at: <a href="http://www.w3.org/TR/jlreq/">http://www.w3.org/TR/jlreq/</a>, and <a href="http://www.w3.org/TR/2009/NOTE-jlreq-20090604/ja/">in Japanese</a></dd>
<dt>[<a id="rfc2119">RFC 2119</a>]</dt>
<dd> Scott Bradner, <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words
for use in RFCs to Indicate Requirement Levels</cite></a>, IETF RFC 2119.<br />
(See
<a href="http://www.ietf.org/rfc/rfc2119.txt">
http://www.ietf.org/rfc/rfc2119.txt</a>.)</dd>
<dt>[<a id="ruby">RUBY</a>]</dt>
<dd><em>Ruby Annotation, W3C Recommendation</em></dd>
<dd>Marcin Sawicki, Michel Suignard, Masayasu Ishikawa, Martin Dürst and
Tex Texin, 31 May 2001,<br />
Available at: <a
href="http://www.w3.org/TR/2001/REC-ruby-20010531/">http://www.w3.org/TR/2001/REC-ruby-20010531</a></dd>
<dt id="UNICODE">[UNICODE]</dt>
<dd>The Unicode Consortium. <cite>The Unicode Standard, Version 6.0.0</cite>, (Mountain View, CA: The Unicode Consortium, 2011. ISBN 978-1-936213-01-6) Available at: <a href="http://www.unicode.org/versions/Unicode6.0.0/">http://www.unicode.org/versions/Unicode6.0.0/</a>
<!---->
<br />
For more information, consult the Unicode Consortium's home page at
<a href="http://www.unicode.org/">http://www.unicode.org/</a></dd>
<dt id="UAX11">[UAX#11]</dt>
<dd>Asmus Freytag. <cite>East Asian Width.</cite> 15 March 2002. Unicode
Standard Annex #11. URL:<br />
<a href="http://www.unicode.org/reports/tr11/">http://www.unicode.org/reports/tr11/</a></dd>
<!---->
<dt>
[<a id="xhtml-mod">XHTMLMOD</a>]</dt>
<dd><em>Modularization of XHTML, W3C Recommendation</em></dd>
<dd>Murray Altheim, Shane McCarron, et al., 10 April 2001<br />
Available at:
<a href="http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/">
http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/</a></dd></dl>
</body>
</html>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-declaration:"~/SGML/HTML4.dcl"
sgml-default-doctype-name:"html"
sgml-minimize-attributes:t
sgml-nofill-elements:("pre" "style" "br")
sgml-validate-command: "SP_BCTF=utf-8 nsgmls -s %s %s"
End:
-->