Wed, 19 Jun 2013 15:45:39 +0900
[css-ruby] Add changes section
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 <title>CSS Ruby Module Level 1</title>
6 <link rel=contents href="#contents">
7 <link rel=index href="#index">
8 <link rel="stylesheet" type="text/css" href="../default.css">
9 <link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
10 <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css">
11 </head>
13 <body class="h-entry">
15 <div class="head">
16 <!--logo-->
18 <h1 class="p-name">CSS Ruby Module Level 1</h1>
20 <h2 class="no-num no-toc">[LONGSTATUS] <time class="dt-updated" datetime="[CDATE]">[DATE]</time> <!-- for HTML4 doctype: <span class="value-title" title="[CDATE]">[DATE]</span></span> --> </h2>
21 <dl>
22 <dt>This version:
23 <dd><a class="u-url" href="[VERSION]">[VERSION]</a>
25 <dt>Latest version:
26 <dd><a href="http://www.w3.org/TR/[SHORTNAME]/">http://www.w3.org/TR/css3-ruby/</a>
28 <dt>Editor's draft:
29 <dd><a href="http://dev.w3.org/csswg/[SHORTNAME]/">http://dev.w3.org/csswg/[SHORTNAME]/</a>
30 (<a href="https://dvcs.w3.org/hg/csswg/log/tip/[SHORTNAME]/Overview.src.html">change log</a>)
32 <dt>Previous version:
33 <dd><a href="http://www.w3.org/TR/2011/WD-css3-ruby-20110630/">
34 http://www.w3.org/TR/2011/WD-css3-ruby-20110630/</a>
36 <dt>Issue Tracking:</dt>
37 <dd><a rel="issues" href="http://www.w3.org/Style/CSS/Tracker/products/FIXME">http://www.w3.org/Style/CSS/Tracker/products/FIXME</a>
39 <dt>Feedback:</dt>
40 <dd><a href="mailto:www-style@w3.org?subject=%5BSHORTNAME%5D%20feedback"
41 >www-style@w3.org</a>
42 with subject line “<kbd>[[SHORTNAME]]
43 <var>… message topic …</var></kbd>”
44 (<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
45 >archives</a>)
47 <dt>Editors:
48 <dd class="p-author h-card vcard">
49 <a class="p-name fn u-url url" rel="author"
50 href="http://fantasai.inkedblade.net/contact">Elika J. Etemad</a>,
51 <a class="p-org org h-org" href="http://www.mozilla.org/">Mozilla</a>
52 <dd class="p-author h-card vcard">
53 <a class="p-name fn u-url url" rel="author"
54 href="mailto:koji.a.ishii@mail.rakuten.com">Koji Ishii</a>,
55 <span class="p-org org">Rakuten, Inc.</span>
56 <dd class="p-author h-card vcard">
57 <a class="p-name fn u-url url" rel="author"
58 href="mailto:ishida@w3.org">Richard Ishida</a>,
59 <span class="p-org org">W3C</span>
61 <dt>Former editors:
62 <dd>Michel Suignard, Microsoft
63 <dd>Marcin Sawicki, Microsoft
64 </dl>
66 <!--copyright-->
68 <hr title="Separator for header">
69 </div>
71 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
73 <p>
74 <span class="p-summary">
75 “Ruby” are short runs of text alongside the base text,
76 typically used in East Asian documents to indicate pronunciation
77 or to provide a short annotation.
78 This module describes the rendering model and formatting controls
79 related to displaying ruby annotations in CSS.
80 </span>
82 <a href="http://www.w3.org/TR/CSS/">CSS</a> is a language for describing
83 the rendering of structured documents (such as HTML and XML) on screen, on
84 paper, in speech, etc.
86 <h2 class="no-num no-toc" id="status">Status of this document</h2>
88 <!--status-->
90 <p>The following features are at risk: …
92 <h2 class="no-num no-toc" id="contents">
93 Table of Contents</h2>
95 <!--toc-->
97 <h2 id="intro">
98 Introduction</h2>
100 <p><em>This section is not normative.</em>
102 <h3 id="placement">
103 Module interactions</h3>
105 <p>This module extends the inline box model of CSS Level 2 [[!CSS21]]
106 to support ruby.
108 <p>None of the properties in this module apply to the <code>::first-line</code> or
109 <code>::first-letter</code> pseudo-elements.
111 <h3 id="values">
112 Values</h3>
114 <p>This specification follows the
115 <a href="http://www.w3.org/TR/CSS21/about.html#property-defs">CSS property
116 definition conventions</a> from [[!CSS21]]. Value types not defined in
117 this specification are defined in CSS Level 2 Revision 1 [[!CSS21]].
118 Other CSS modules may expand the definitions of these value types: for
119 example [[CSS3VAL]], when combined with this module, expands the
120 definition of the <var><length></var> value type as used in this specification.</p>
122 <p>In addition to the property-specific values listed in their definitions,
123 all properties defined in this specification also accept the
124 <a href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">inherit</a>
125 keyword as their property value. For readability it has not been repeated
126 explicitly.
128 <h3 id="conventions">
129 Document conventions</h3>
131 <p>Many typographical conventions in East Asian typography depend
132 on whether the character rendered is wide (CJK) or narrow (non-CJK).
133 There are a number of illustrations in this document
134 for which the following legend is used:
136 <dl>
137 <dt><img alt="Symbolic wide-cell glyph representation" width="39" height="39" src="images/fullwidth.gif">
138 <dd>Wide-cell glyph (e.g. Han) that is the <var>n</var>th character in the text run.
139 They are typically sized to 50% when used as annotations.
140 <dt><img alt="Symbolic narrow-cell glyph representation" width="19" height="39" src="images/halfwidth.gif">
141 <dd>Narrow-cell glyph (e.g. Roman) which is the <var>n</var>th glyph in the text run.
143 <p>The orientation which the above symbols assume in the diagrams
144 corresponds to the orientation that the glyphs they represent
145 are intended to assume when rendered by the user agent.
146 Spacing between these characters in the diagrams is incidental,
147 unless intentionally changed to make a point.
149 <h3 id="ruby-def">
150 What is ruby?</h3>
152 <p><dfn>Ruby</dfn> is the commonly-used name for a run of text
153 that appears alongside another run of text (referred to as the “base”)
154 and serves as an annotation or a pronunciation guide associated with that run of text.
156 <p>The following figures show two examples of Ruby,
157 a simple case and one with more complicated structure.
159 <div class="example">
160 <p>In this first example, a single annotation is used to annotate the base text.
161 <div class="figure">
162 <p><img src="images/licence.png"
163 alt="Example of ruby applied on top of a Japanese expression">
164 <p class="caption">Example of ruby used in Japanese (simple case)
165 </div>
166 <p>In Japanese typography, this case is sometimes called
167 <i lang="ja">taigo</i> ruby or group-ruby (per-word ruby),
168 because the annotation as a whole is associated
169 with multi-character word (as a whole).
170 </div>
172 <div class="example">
173 <p>In this second example,
174 two levels of annotations are attached to a base sequence:
175 the hiragana characters on top refer to the pronunciation of each of the base kanji characters,
176 while the words “Keio” and “University” on the bottom are annotations describing the English translation.
177 <div class="figure">
178 <p><img src="images/ruby-univ.gif"
179 alt="Example showing complex ruby with annotation text over and under the base characters">
180 <p class="caption">Complex ruby with annotation text over and under the base characters
181 </div>
182 <p>
183 <p>Notice that to allow correct association between the hiragana characters and
184 their corresponding Kanji base characters,
185 the spacing between these Kanji characters is adjusted.
186 (This happens around the fourth Kanji character in the figure above.)
187 To avoid variable spacing between the Kanji characters in the example above
188 the hiragana annotations can be styled as a <i>collapsed annotation</i>,
189 which will look more like the group-ruby example earlier.
190 However because the base-annotation pairings are recorded in the ruby structure,
191 if the text breaks across lines, the annotation characters will stay
192 correctly paired with their respective base characters.
193 </div>
195 <i>Ruby</i> formatting as used in Japanese is described in JIS X-4051 [[JIS4051]] (in Japanese)
196 and in Requirements for Japanese Text Layout [[JLREQ]] (in English and Japanese)].
197 In HTML, ruby structure and markup to represent it is described
198 in the Ruby Markup Extension specification.
199 This module describes the CSS rendering model
200 and formatting controls relevant to ruby layout of such markup.
202 <h2 id="ruby-model">
203 Ruby Formatting Model</h2>
205 <p>The CSS ruby model is based on
206 the <a href="http://darobin.github.io/html-ruby/">HTML Ruby Markup Extension</a>
207 and <a href="http://www.w3.org/TR/ruby/">XHTML Ruby Annotation Recommendation</a> [[RUBY]].
208 In this model, a ruby structure consists of
209 one or more <dfn>ruby base</dfn> elements representing the base (annotated) text,
210 associated with one or more levels of <dfn>ruby annotation</dfn> elements representing the annotations.
211 The structure of ruby is similar to that of a table:
212 there are “rows” (the base text level, each annotation level)
213 and “columns” (each <i>ruby base</i> and its corresponding <i>ruby annotations</i>).
215 <p>Consecutive bases and annotations are grouped together into <dfn>ruby segments</dfn>.
216 Within a <i>ruby segment</i>, a <i>ruby annotation</i> may span multiple <i>ruby bases<i>.
218 <p class="note">In HTML, a single <code><ruby></code> element may contain multiple <i>ruby segments</i>.
219 (In the XHTML Ruby model, a single <code><ruby></code> element can only contain one <i>ruby segment</i>.)
221 <h3 id="ruby-display">
222 Ruby-specific 'display' property values</h3>
224 <p>For document languages (such as XML applications) that do not have pre-defined ruby elements,
225 authors must map document language elements to ruby elements;
226 this is done with the 'display' property.
228 <table class="propdef">
229 <tr>
230 <th>Name:
231 <td>display
232 <tr>
233 <th><a href="#values">New Values</a>:
234 <td>ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container
235 </table>
237 <p>The following new 'display' values assign ruby layout roles to an arbitrary element:
239 <dl>
240 <dt>''ruby''
241 <dd>Specifies that an element generates a <dfn title="ruby container | ruby container box">ruby container box</dfn>.
242 (Corresponds to HTML/XHTML <code><ruby></code> elements.)
243 <dt>''ruby-base''
244 <dd>Specifies that an element generates a <dfn title="ruby base box | ruby base">ruby base box</dfn>.
245 (Corresponds to HTML/XHTML <code><rb></code> elements.)
246 <dt>''ruby-text''
247 <dd>Specifies that an element generates a <dfn title="ruby annotation box | ruby annotation">ruby annotation box</dfn>.
248 (Corresponds to HTML/XHTML <code><rt></code> elements.)
249 <dt>''ruby-base-container''
250 <dd>Specifies that an element generates a <dfn title="ruby base container box | ruby base container">ruby base container box</dfn>.
251 (Corresponds to XHTML <code><rbc></code> elements; always implied in HTML.)
252 <dt>''ruby-text-container''
253 <dd>Specifies that an element generates a <dfn title="ruby annotation container box | ruby annotation container">ruby annotation container box</dfn>.
254 (Corresponds to HTML/XHTML <code><ruby></code> elements.)
255 </dl>
257 <h3 id="box-fixup">
258 Anonymous Ruby Box Generation</h3>
260 <p>The CSS model does not require that the document language
261 include elements that correspond to each of these components.
262 Missing parts of the structure are implied through the anonymous box generation rules
263 <a href="http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes">similar to those used to normalize tables</a>. [[!CSS21]]
265 <ol>
266 <li>Any in-flow block-level boxes directly contained by a
267 <i>ruby container</i>,
268 <i>ruby base container</i>,
269 <i>ruby annotation container</i>,
270 <i>ruby base box</i>,
271 or <i>ruby annotation box</i>
272 are forced to be inline-level boxes,
273 and their 'display' value computed accordingly.
274 For example,
275 the 'display' property of an in-flow element with ''display: block''
276 parented by an element with ''display: ruby-text''
277 computes to ''inline-block''.
278 This computation occurs after any intermediary anonymous-box fixup
279 (such as that required by internal table elements).
281 <li>Any consecutive sequence of <i>ruby bases</i> not parented by a <i>ruby base container</i>
282 is wrapped in an anonymous <i>ruby base container</i>.
283 Similarly, any consecutive sequence of <i>ruby annotations</i> not parented by a <i>ruby annotation container</i>
284 is wrapped in an anonymous <i>ruby annotation container</i>.
286 <li>Within each <i>ruby base container</i>,
287 each sequence of inline-level boxes is wrapped in an anonymous <i>ruby base box</i>.
288 Similarly, within each <i>ruby annotation container</i>,
289 each sequence of inline-level boxes is wrapped in an anonymous <i>ruby annotation box</i>.
291 <li>A sequence of <i>ruby base containers</i> and/or <i>ruby annotation containers</i>
292 not parented by a <i>ruby container</i>
293 is wrapped in an anonymous <i>ruby container</i>.
294 </ol>
296 <p>At this point, all ruby layout structures are properly parented,
297 and the UA can start to associate bases with their annotations.
299 <p class="note">
300 Note that the UA is not required to create any of these anonymous boxes in its internal structures,
301 as long as pairing and layout behaves as if they existed.
303 <h3 id="pairing">
304 Ruby Pairing and Annotation Levels</h3>
306 <p>Within a ruby structure,
307 each <i>ruby bases</i> are associated with <i>ruby annotations</i>
308 and vice versa.
309 A <i>ruby base</i> can be associated with at most one <i>ruby annotation</i> per annotation level.
310 If there are multiple annotation levels, it can therefore be associated with multiple <i>ruby annotations</i>.
311 A <i>ruby annotation</i> is associated with one or more <i>ruby bases</i>;
312 annotations can span multiple bases.
314 <p><dfn>Annotation pairing</dfn> is the process of associating
315 <i>ruby annotations</i> with <i>ruby bases</i>.
317 <ol>
318 <li>
319 <p>First, the ruby structure is divided into <i>ruby segments</i>,
320 each consisting of a single <i>ruby base container</i>
321 followed by one or more <i>ruby annotation containers</i>.
322 If the first child of a <i>ruby container</i> is a <i>ruby annotation container</i>,
323 an anonymous, empty <i>ruby base container</i> is assumed to exist before it.
324 Similarly, if the <i>ruby container</i> contains consecutive <i>ruby base containers</i>,
325 anonymous, empty <i>ruby annotation containers</i> are assumed to exist between them.
326 The <i>ruby base container</i> in each segment is thus associated
327 with each of the <i>ruby annotation containers</i> in that segment.
329 <p>Each <i>ruby annotation containers</i> in a <i>ruby segment</i>
330 represents one <dfn title="annotation level | level">level</dfn> of annotation:
331 the first one represents the first level of annotation,
332 the second one represents the second level of annotation,
333 and so on.
335 <li>Within each <i>ruby segment</i>,
336 each <i>ruby base box</i> in the <i>ruby base container</i>
337 is paired with one <i>ruby annotation box</i>
338 from each <i>ruby annotation container</i> in its <i>ruby segment</i>.
339 If there are not enough <i>ruby annotations</i> in a <i>ruby annotation container</i>,
340 the last one is associated with any excess <i>ruby bases</i>.
341 (If there are not any in the <i>ruby annotation container</i>, an anonymous empty one is assumed to exist.)
342 If there are not enough <i>ruby bases</i>,
343 any remaining <i>ruby annotations</i> are assumed to be associated
344 with empty, anonymous bases inserted at the end of the <i>ruby base container</i>.
346 <p>If an implementation supports ruby markup with explicit spanning
347 (e.g. XHTML Complex Ruby Annotations),
348 it must adjust the pairing rules to pair spanning annotations to multiple bases
349 appropriately.
350 </ol>
352 <p>A this point, ruby “columns” are defined,
353 each represented by a single <i>ruby base</i>
354 and associated with one <i>ruby annotation</i> (possibly an empty, anonymous one)
355 from each <i>annotation level</i>.
357 <h4 id="nested-pairing">
358 Nested Ruby</h4>
360 <p>When <i>ruby containers</i> are nested,
361 pairing begins with the deepest <i>ruby container</i>,
362 then expands out,
363 treating each <i>ruby container</i> nested within another <i>ruby container</i>
364 as a <i>ruby base</i>,
365 and associating each <i>ruby annotation</i>
366 associated with the nested <i>ruby container</i>
367 as being associated with (spanning) all of its <i>ruby bases</i>.
369 <p>Using nested <i>ruby containers</i> thus allows the representation
370 of complex spanning relationships.
372 <p class="issue">This shouldn't belong in Level 1. But HTML5 allows it, so we have to handle it. Yay HTML5.
374 <h3 id="box-model">
375 Generating Ruby Structure</h3>
377 <p>
379 <h3 id="box-model">
380 Ruby box model</h3>
382 <p>In the following description, the elements specified by Ruby
383 Annotation [[RUBY]] are used to describe the box model. As mentioned
384 earlier, a user agent can obtain the same results by using the Ruby specific 'display'
385 property values. </p>
387 <p>For a user agent that supports the ruby markup, the ruby structure consists of three or more
388 boxes. The outermost container is the <a
389 href="http://www.w3.org/TR/ruby/#ruby"><samp>ruby</samp></a> element itself.
390 In the simple case, it is a container for two non-overlapping boxes: the ruby
391 text box (<a href="http://www.w3.org/TR/ruby/#rt"><samp>rt</samp></a> element)
392 and the ruby base box (<a
393 href="http://www.w3.org/TR/ruby/#rb"><samp>rb</samp></a> element). The
394 positioning of these two boxes relative to each other is controlled by the <a
395 href="#rubypos">'ruby-position'</a> property.</p>
397 <div class="figure">
398 <img class="example" width="223" height="93"
399 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"
400 src="images/r-box-t.gif" />
402 <p><b>Figure 3.2.1</b>: Ruby box model (simple case)</p>
403 </div>
405 <p>In the case of complex ruby, the ruby element is a container for two or
406 three non-overlapping boxes: one ruby base collection (<a
407 href="http://www.w3.org/TR/ruby/#rbc"><samp>rbc</samp></a> element), and one
408 or two ruby text collections (<a
409 href="http://www.w3.org/TR/ruby/#rtc"><samp>rtc</samp></a> element). The
410 <samp>rbc</samp> element is itself a container for one or several ruby base
411 box (<samp>rb</samp> element), while each <samp>rtc</samp> element is a
412 container for one or several ruby text box (rt element). The position of the
413 <samp>rtc</samp> element in relation to the related <samp>rbc</samp> element
414 is controlled by the <a href="#rubypos">'ruby-position'</a> property. The two
415 following figures show examples of these complex ruby.</p>
417 <div class="figure">
418 <img src="images/r-box-g.gif"
419 alt="Diagram of a group ruby with a full ruby text above and partial ruby text below" width="408" height="170" />
421 <p><b>Figure 3.2.2</b>: Ruby box model (complex ruby with an empty rt element
422 after)</p>
423 </div>
425 <p>In the example above, the ruby text after (below) the ruby bases contains two <samp>rt</samp> elements with the first one
426 being empty, the empty <samp>rt</samp> element corresponds to the first part
427 of the ruby base collection (the first part is identified by the first <samp>rb</samp> element
428 within the <samp> rbc</samp> element).</p>
430 <div class="figure">
431 <img src="images/r-box-h.gif"
432 alt="Diagram of a group ruby with a spanning ruby text above and partial ruby text below" width="400" height="173" />
434 <p><b>Figure 3.2.3</b>: Ruby box model (complex ruby with a spanning ruby text
435 element)</p>
436 </div>
438 <p>In the example above, the ruby text before (above) the ruby bases spans the whole ruby base collection. The
439 ruby text after (below) the ruby bases still contain two <samp>rt</samp> elements, one of
440 which is empty. The spanning behavior of <samp>rt</samp> text elements is
441 controlled by the <a
442 href="http://www.w3.org/TR/ruby/#ruby"><samp>rbspan</samp></a> attribute in a
443 way similar to the <samp>colspan</samp> attribute used for table column.</p>
445 <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>
446 <p class="note"><span class="note-label">Note:</span> The visual description of the ruby elements does not refer
447 necessarily to the logical orders of the elements</p>
449 <p>The width of the ruby box is by default determined by its widest child
450 element, whose width in turn is determined by its content. The width of all direct
451 children of the <samp>ruby</samp> element is the width of the widest children. In this respect, the ruby
452 box is much like a two or three row <samp>table</samp> element, with the
453 following exceptions:</p>
454 <ul>
455 <li>the ruby box is an inline element, like an image, even though it itself,
456 like a table, is a container of other boxes</li>
457 <li>the equivalent of the cells: the <samp>rb</samp> element and the
458 <samp>rt</samp> text element can only contain inline-level elements.</li>
459 <li>the content of each 'cell' is always measured at its maximum width</li>
460 <li>unlike a table, a ruby element doesn't have to fit in a line, the ruby
461 box may be split into several boxes at line boundary, depending of the
462 spanning of the ruby texts. This is however only possible for the complex
463 ruby and can only happen at the boundary of non spanning elements.</li>
464 <li>both the ruby text and the ruby base boxes may overlap with adjacent
465 text (outside of the ruby element) if an appropriate <a
466 href="#rubyover">'ruby-overhang'</a> parameter is set via CSS. Note
467 however that the actual content of the ruby base cannot overlap with that
468 adjacent text. The distribution of the content of the ruby base within the
469 ruby base box is controlled by the <a href="#rubyalign">'ruby-align'</a>
470 property.</li>
471 </ul>
473 <p>If the ruby text is not allowed to overhang, then the ruby behaves like a
474 traditional box, i.e. only its contents are rendered within its boundaries and
475 adjacent elements do not cross the box boundary:</p>
477 <div class="figure">
478 <p><img class="example" width="220" height="91"
479 alt="Diagram showing the ruby boxes interacting with adjacent text"
480 src="images/ro-n.gif" /></p>
482 <p><b>Figure 3.2.4</b>: Simple ruby whose text is not allowed to overhang
483 adjacent text</p>
484 </div>
486 <p>However, if ruby text is allowed to overhang adjacent elements and it
487 happens to be wider than its base, then the adjacent content is partially
488 rendered within the area of the ruby base box, while the ruby text may be
489 partially overlapping with the upper blank parts of the adjacent content:</p>
491 <div class="figure">
492 <p><img class="example" width="177" height="91"
493 alt="Diagram showing the ruby boxes interacting with adjacent text"
494 src="images/ro-a.gif" /></p>
496 <p><b>Figure 3.2.5</b>: Simple ruby whose text is allowed to overhang adjacent
497 text</p>
498 </div>
500 <p>The ruby text related to a ruby base can never overhang another ruby
501 base.</p>
503 <p>The alignment of the contents of the base or the ruby text is not affected
504 by the overhanging behavior. The alignment is achieved the same way regardless
505 of the overhang behavior setting and it is computed before the space available
506 for overlap is determined. It is controlled by the <a
507 href="#rubyalign">'ruby-align'</a> property.</p>
509 <p>The exact circumstances in which the ruby text will overhang other
510 elements, and to what degree it will do so, will be controlled by the <a
511 href="#rubyover">'ruby-overhang'</a> property.</p>
513 <p>This entire logic applies the same way in vertical ideographic layout, only
514 the dimension in which it works in such a layout is vertical, instead of
515 horizontal.</p>
517 <p class="note"><span class="note-label">Note:</span> Because the purpose of the XHTML <samp>rp</samp> element
518 [[RUBY]] is to allow pre-existing user agents
519 to parenthesize ruby text content, an XHTML user agent should use a styling rule
520 for these elements that avoids rendering them such as <samp>rp {display:
521 none}</samp>.</p>
523 <h3 id="ruby-line-height">
524 Ruby box and line stacking</h3>
526 <p>The interaction of the ruby box and line stacking is controlled by the
527 'line-stacking-ruby' property described in the CSS3 Line Module. That property
528 takes two values: 'include-ruby' and 'exclude-ruby. Depending on the property
529 value, the ruby box is considered or excluded for line stacking. Even if the
530 ruby box is considered for line stacking, some values of the
531 'line-stacking-strategy' property (also described in the CSS3 Line module) can
532 still create occurrences where a the ruby box will eventually be ignored (e.g.
533 case where the 'line-stacking-strategy' value is 'block-line-height').</p>
535 <p>In the following figure, each line box is shown with leading space
536 distributed before and after the two text segments ('Previous line' and 'Ruby
537 base'); the dotted lines show the line box for each line. The
538 'line-stacking-ruby' property is set to 'exclude-ruby'. The achieved effect is
539 that the ruby box does not affect the line to line spacing. It is however the
540 responsibility of the style author to avoid 'bleeding' effects between the ruby
541 text and the surrounding text of images.</p>
543 <div class="figure">
544 <p>
545 <img class="example"
546 alt="Diagram showing the ruby text using 2 half leading"
547 src="images/rlh-a.gif" width="210" height="138" /></p>
549 <p><b>Figure 3.3.1</b>: Excluded Ruby text</p>
550 </div>
553 <p>In the following figure, the line boxes have no extra leading space. The
554 'line-stacking-ruby' property is set to 'include-ruby' and the
555 'line-stacking-strategy' property is set to a value where inline boxes are
556 considered for line stacking. In this case, the line box with
557 the ruby text is affected and has its 'stack-height' increased by the amount
558 necessary to fit the ruby text.</p>
560 <div class="figure">
561 <p>
562 <img class="example"
563 alt="Diagram showing the ruby text expanding above base text"
564 src="images/rlh-b.gif" width="210" height="111" /></p>
566 <p><b>Figure 3.3.2</b>: Ruby text increasing line height</p>
567 </div>
568 <p>This mechanism allows rendering of evenly spaced lines of text within a
569 block-level element, whether a line contains ruby or not. The authors need
570 only to set for the block-level element a line height value larger than the
571 computed line-height of the largest ruby element within the block.</p>
573 <h3 id="ruby-line-breaking">
574 Ruby box and line breaking</h3>
576 <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>
578 <p>
579 <img class="example"
580 alt="Diagram showing the line breaking opportunity in a complex ruby"
581 src="images/r-break-a.gif" width="408" height="201" /></p>
583 <p><b>Figure 3.4.1</b>: Complex ruby line breaking opportunity</p>
585 <p>
586 <img class="example"
587 alt='Diagram showing the line breaking opportunity in a "Bopomofo" ruby'
588 src="images/r-break-b.gif" width="300" height="90" /></p>
590 <p><b>Figure 3.4.1</b>: "Bopomofo" ruby line breaking opportunity</p>
591 <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>
592 <h2 id="ruby-props">
593 Ruby Properties</h2>
595 <h3 id="rubypos">
596 Ruby positioning: the 'ruby-position' property</h3>
598 <table class="propdef">
599 <tr>
600 <th>Name:
601 <td><dfn>ruby-position</dfn>
602 <tr>
603 <th><a href="#values">Value</a>:
604 <td>[ over | under | inter-character ] && [ right | left ]
605 <tr>
606 <th>Initial:
607 <td>over right
608 <tr>
609 <th>Applies to:
610 <td>the parent of elements with display: ruby-text.
611 <tr>
612 <th>Inherited:
613 <td>yes
614 <tr>
615 <th>Percentages:
616 <td>N/A
617 <tr>
618 <th>Media:
619 <td>visual
620 <tr>
621 <th>Computed value:
622 <td>specified value (except for initial and inherit)
623 <tr>
624 <th>Animatable:
625 <td>no
626 <tr>
627 <th>Canonical order:
628 <td><abbr title="follows order of property value definition">per grammar</abbr>
629 </table>
630 <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>
631 <p>This property is used by the parent of elements with display: ruby-text to
632 control the position of the ruby text with respect to its base. Such parents
633 are typically either the <samp>ruby</samp> element itself (simple ruby) or the
634 <samp>rtc</samp> element (complex ruby). This assures that all parts of a <samp>rtc</samp>
635 element will be displayed in the same position. Possible values:</p>
636 <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>
637 <dl>
638 <dt><dfn title="ruby-position:over">''over''</dfn></dt>
639 <dd>The ruby text appears over the base in horizontal text.
640 This is the most common setting used in ideographic East Asian writing systems.
641 This is the initial value.
643 <div class="figure">
644 <p>
645 <img
646 alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing above the base"
647 src="images/shinkansen-top.gif" width="140" height="33" /></p>
648 <p><b>Figure 4.1.1</b>: Top ruby in horizontal layout applied to
649 Japanese text</p>
650 </div>
651 </dd>
653 <dt><dfn title="ruby-position:right">''right''</dfn></dt>
654 <dd>The ruby text appears on the right side of the base in vertical text.
656 <div class="figure">
657 <p>
658 <img
659 alt="Diagram of ruby glyph layout in vertical mode with ruby text apearing vertically on the right of the base"
660 src="images/shinkansen-right.gif" width="33" height="141" /></p>
661 <p><b>Figure 4.1.2</b>: Top ruby in vertical ideographic layout applied
662 to Japanese text</p>
663 </div>
664 </dd>
666 <dt><dfn title="ruby-position:under">''under''</dfn></dt>
667 <dd>The ruby text appears under the base in horizontal text.
668 This is a relatively rare setting used in ideographic East Asian writing systems,
669 most easily found in educational text.
671 <div class="figure">
672 <p>
673 <img
674 alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing below the base"
675 src="images/shinkansen-bottom.gif" width="142" height="36" /></p>
676 <p><b>Figure 4.1.3</b>: Bottom ruby in horizontal layout applied to Japanese text</p>
677 </div>
678 </dd>
680 <dt><dfn title="ruby-position:left">''left''</dfn></dt>
681 <dd>The ruby text appears on the left side of the base in vertical text.
683 <div class="figure">
684 <p>
685 <img
686 alt="Diagram of ruby glyph layout in vertical mode with ruby text apearing vertically on the left of the base"
687 src="images/shinkansen-left.gif" width="37" height="141" /></p>
688 <p><b>Figure 4.1.4</b>: Bottom ruby in vertical ideographic layout applied to Japanese text</p>
689 </div>
690 </dd>
692 <dt><dfn title="ruby-position:inter-character">''inter-character''</dfn></dt>
693 <dd>
694 <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>
695 <p>The ruby text appears on the right of the base in horizontal text.
697 <p>This value is provided for the special case of traditional Chinese as used especially in
698 Taiwan: ruby (made of <a href="#g-bopomofo"><span
699 lang="zh">bopomofo</span></a> glyphs) in that context appears vertically along
700 the right side of the base glyph,
701 even when the layout of the base characters is horizontal:</p>
703 <div class="figure">
704 <p><img alt="Example of Taiwanese-style ruby"
705 width="138" height="42" src="images/bopomofo.gif" /></p>
706 <p><b>Figure 4.1.5</b>: "<span lang="zh">Bopomofo</span>" ruby in
707 traditional Chinese (ruby text shown in blue for clarity) in horizontal
708 layout</p>
709 </div>
710 <p class="note"><span class="note-label">Note:</span> The bopomofo
711 transcription is written in the normal way as part of the ruby text.
712 The user agent is responsible for ensuring the correct relative alignment
713 and positioning of the glyphs, including those corresponding to the
714 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>
715 <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>
716 <p>It is not defined how a user-agent should handle ruby text that is not bopomofo
717 when the value of ruby-position is set to 'inter-character'.</p>
718 <!-- See Taiwanese requirements doc for EPUB at http://epub-revision.googlecode.com/files/EGLS_TW_eng.ppt -->
719 </dd>
721 <!--
722 <dt><strong>inline</strong></dt>
723 <dd>
724 <p>Ruby text follows the ruby base with no special styling. The value can be used to disable ruby text positioning.</p>
725 <p>If the author has used the XHTML <samp>rp</samp> element [[RUBY]] 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>
726 <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>
727 </dd>
728 -->
729 </dl>
731 <p>If two rtc elements are set with the same ruby-position value, (for example
732 both 'before'), the relative position of the two elements is undefined. This
733 setting should not be used.</p>
735 <h3 id="rubymerge">Ruby merge: the 'ruby-merge' property</h3>
737 <table class="propdef">
738 <tr>
739 <th>Name:
740 <td><dfn>ruby-merge</dfn>
741 <tr>
742 <th><a href="#values">Value</a>:
743 <td>separate | collapse | auto
744 <tr>
745 <th>Initial:
746 <td>separate
747 <tr>
748 <th>Applies to:
749 <td>all elements and generated content
750 <tr>
751 <th>Inherited:
752 <td>yes
753 <tr>
754 <th>Percentages:
755 <td>N/A
756 <tr>
757 <th>Media:
758 <td>visual
759 <tr>
760 <th>Computed value:
761 <td>specified value (except for initial and inherit)
762 </table>
764 <p>
765 This property controls how ruby annotation boxes should be rendered
766 when there are more than one in a ruby container box.
767 </p>
769 <p>Possible values:</p>
770 <dl>
771 <dt><dfn title="ruby-merge:separate">''separate''</dfn></dt>
772 <dd>
773 <p>
774 Each ruby annotation box is rendered in the same column as its corresponding base box.
775 This style is called Mono-ruby in [[JLREQ]].
776 </p>
778 <div class="example">
779 <p>The following two markups render the same:</p>
780 <pre><ruby>無<rt>む</ruby><ruby>常<rt>じょう</ruby></pre>
781 <p>and:</p>
782 <pre><ruby style="ruby-merge:separate"><rb>無<rb>常<rt>む<rt>じょう</ruby></pre>
783 </div>
784 </dd>
786 <dt><dfn title="ruby-merge:collapse">''collapse''</dfn></dt>
787 <dd>
788 <p>
789 All ruby annotation boxes are concatenated,
790 and rendered to the concatenated ruby base boxes.
791 This style renders similar to Group-ruby in [[JLREQ]],
792 except that it allows line break between annotation pairs.
793 </p>
795 <div class="example">
796 <p>The following two markups render the same if fit in a line:</p>
797 <pre><ruby>無常<rt>むじょう</ruby></pre>
798 <p>and:</p>
799 <pre><ruby style="ruby-merge:collapse"><rb>無<rb>常<rt>む<rt>じょう</ruby></pre>
800 </div>
801 </dd>
803 <dt><dfn title="ruby-merge:auto">''auto''</dfn></dt>
804 <dd>
805 <p>
806 The user agent may use any algorithm to determine how each ruby annotation box
807 is rendered to its corresponding base box.
808 </p>
809 <div class="example">
810 <p>
811 One possible algorithm is described as Jukugo-ruby in [[JLREQ]].
812 </p>
813 <p>
814 Another, more simplified algorithm of Jukugo-ruby is
815 to render as Mono-ruby if all ruby annotation boxes fit within
816 advances of their corresponding base boxes,
817 and render as Group-ruby otherwise.
818 </p>
819 </div>
820 </dd>
821 </dl>
823 <h3 id="rubyalign">
824 Ruby alignment: the 'ruby-align' property</h3>
826 <table class="propdef">
827 <tr>
828 <th>Name:
829 <td><dfn>ruby-align</dfn>
830 <tr>
831 <th><a href="#values">Value</a>:
832 <td>auto | start | center |
833 distribute-letter | distribute-space
834 <tr>
835 <th>Initial:
836 <td>auto
837 <tr>
838 <th>Applies to:
839 <td>all elements and generated content
840 <tr>
841 <th>Inherited:
842 <td>yes
843 <tr>
844 <th>Percentages:
845 <td>N/A
846 <tr>
847 <th>Media:
848 <td>visual
849 <tr>
850 <th>Computed value:
851 <td>specified value (except for initial and inherit)
852 </table>
854 <p>This property can be used on any element to control the text alignment of
855 the ruby text and ruby base contents relative to each other. It applies to all
856 the rubys in the element. For simple ruby, the alignment is applied to the
857 ruby child element whose content is shorter: either the <a
858 href="http://www.w3.org/TR/ruby/#rb"><samp>rb</samp></a> element or the <a
859 href="http://www.w3.org/TR/ruby/#rt"><samp>rt</samp></a> element [[RUBY]].
860 For complex ruby, the alignment is also applied to the
861 ruby child elements whose content is shorter: either the <samp>rb</samp>
862 element and/or one or two <samp>rt</samp> elements for each related ruby text
863 and ruby base element within the <samp>rtc</samp> and <samp>rbc</samp>
864 element.</p>
866 <p>Possible values:</p>
867 <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>
868 <dl>
869 <dt><dfn title="ruby-align:auto">''auto''</dfn></dt>
870 <dd>
871 <p>The user agent determines how the ruby contents are aligned.
872 This is the initial value.
873 The behavior recommended by [[JLREQ]] is for wide-cell ruby to be aligned in the 'distribute-space' mode:
874 <div class="figure">
875 <p><img width="145" height="91"
876 alt="Diagram of glyph layout in auto aligned ruby when ruby text is shorter than base"
877 src="images/ra-ds.gif" /><img width="145" height="91"
878 alt="Diagram of glyph layout in auto aligned ruby when ruby text is longer than base"
879 src="images/ra-ds-rb.gif" /></p>
880 <p><b>Figure 4.2.1</b>: Wide-cell text in 'auto' ruby alignment is
881 'distribute-space' justified</p>
882 </div>
884 <p>The recommended behavior for narrow-cell glyph ruby is to be
885 aligned in the 'center' mode.</p>
886 <div class="figure">
887 <p><img
888 alt="Diagram of glyph layout in auto aligned ruby when halfwidth ruby text is shorter than base"
889 width="145" height="91"
890 src="images/ra-c-h.gif" /><img
891 alt="Diagram of character layout in auto aligned ruby when ruby text is longer than narrow-width base"
892 width="145" height="91"
893 src="images/ra-c-rb-h.gif" /></p>
894 <p><b>Figure 4.2.2</b>: Narrow-width ruby text in 'auto' ruby alignment
895 is centered</p>
896 </div>
897 </dd>
899 <dt><dfn title="ruby-align:start">''start''</dfn></dt>
900 <dd>The ruby text content is aligned with the start edge of the base.
901 <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>
903 <div class="figure">
904 <p><img
905 alt="Diagram of glyph layout in left aligned ruby when ruby text is shorter than base"
906 width="145" height="91" src="images/ra-l.gif" /><img
907 width="145" height="91"
908 alt="Diagram of glyph layout in left aligned ruby when ruby text is longer than base"
909 src="images/ra-l-rb.gif" /></p>
910 <p><b>Figure 4.2.3</b>: Start ruby alignment</p>
911 </div>
912 </dd>
914 <dt><dfn title="ruby-align:center">''center''</dfn></dt>
915 <dd>The ruby text content is centered within the width of the base. If the
916 length of the base is smaller than the length of the ruby text, then the
917 base is centered within the width of the ruby text.
919 <div class="figure">
920 <p><img width="145" height="91"
921 alt="Diagram of glyph layout in center aligned ruby when ruby text is shorter than base"
922 src="images/ra-c.gif" /><img width="145" height="91"
923 alt="Diagram of glyph layout in center aligned ruby when ruby text is longer than base"
924 src="images/ra-c-rb.gif" /></p>
925 <p><b>Figure 4.2.4</b>: Center ruby alignment</p>
926 </div>
927 </dd>
929 <!--
930 <dt><strong>right</strong></dt>
931 <dd>The ruby text content is aligned with the end edge of the base.
932 <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>
933 <div class="figure">
934 <p><img class="example" width="145" height="91"
935 alt="Diagram of glyph layout in right aligned ruby when ruby text is shorter than base"
936 src="images/ra-r.gif" /><img class="example" width="145" height="91"
937 alt="Diagram of glyph layout in right aligned ruby when ruby text is longer than base"
938 src="images/ra-r-rb.gif" /></p>
939 <p><b>Figure 4.2.5</b>: End ruby alignment</p>
940 </div>
941 </dd>
942 -->
944 <dt><dfn title="ruby-align:distribute-letter">''distribute-letter''</dfn></dt>
945 <dd>If the width of the ruby text is smaller than that of the base, then
946 the ruby text contents are evenly distributed across the width of the
947 base, with the first and last ruby text glyphs lining up with the
948 corresponding first and last base glyphs. If the width of the ruby text
949 is at least the width of the base, then the letters of the base are
950 evenly distributed across the width of the ruby text.
952 <div class="figure">
953 <p><img width="145" height="91"
954 alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is shorter than base"
955 src="images/ra-dl.gif" /><img width="145" height="91"
956 alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is longer than base"
957 src="images/ra-dl-rb.gif" /></p>
958 <p><b>Figure 4.2.6</b>: Distribute-letter ruby alignment</p>
959 </div>
960 </dd>
962 <dt><dfn title="ruby-align:distribute-space">''distribute-space''</dfn></dt>
963 <dd>If the width of the ruby text is smaller than that of the base, then
964 the ruby text contents are evenly distributed across the width of the
965 base, with a certain amount of white space preceding the first and
966 following the last character in the ruby text. That amount of white
967 space is normally equal to half the amount of inter-character space of
968 the ruby text. If the width of the ruby text is at least the width of
969 the base, then the same type of space distribution applies to the base.
970 In other words, if the base is shorter than the ruby text, the base is
971 distribute-space aligned. This type of alignment
972 is described by [[JLREQ]].
974 <div class="figure">
975 <p><img width="145" height="91"
976 alt="Diagram of glyph layout in distribute-space aligned ruby when ruby text is shorter than base"
977 src="images/ra-ds.gif" /><img width="145" height="91"
978 alt="Diagram of glyph layout in distribute-space aligned ruby when ruby text is longer than base"
979 src="images/ra-ds-rb.gif" /></p>
980 <p><b>Figure 4.2.7</b>: Distribute-space ruby alignment</p>
981 </div>
982 </dd>
984 <!--
985 <dt><strong>line-edge</strong></dt>
986 <dd>If the ruby text is not adjacent to a line edge, it is aligned as in
987 'auto'. If it is adjacent to a line edge, then it is still aligned as in
988 auto, but the side of the ruby text that touches the end of the line is
989 lined up with the corresponding edge of the base. This type of alignment
990 is described by [[JLREQ]]. This type of alignment is
991 relevant only to the scenario where the ruby text is longer than the
992 ruby base. In the other scenarios, this is just 'auto'.
993 <div class="figure">
994 <p><img class="example" width="146" height="109"
995 alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is shorter than base"
996 src="images/ra-le-l.gif" /><img class="example" width="146"
997 height="110"
998 alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is longer than base"
999 src="images/ra-le-r.gif" /></p>
1000 <p><b>Figure 4.2.8</b>: Line edge ruby alignment</p>
1001 </div>
1002 </dd>
1003 -->
1004 </dl>
1006 <p>For a complex ruby with spanning elements, one additional consideration is
1007 required. If the spanning element spans multiple 'rows' (other rbc or rtc
1008 elements), and the ruby alignment requires space distribution among the
1009 'spanned' elements, a ratio must be determined among the 'columns' of spanned
1010 elements. This ratio is computed by taking into consideration the widest
1011 element within each column.</p>
1013 <h2 id="rubyover">
1014 Ruby Overhang and Edge Effects</h2>
1016 <p>
1017 When <i>ruby annotation box</i> is longer than its corresponding <i>ruby base box</i>,
1018 the <i>ruby annotation box</i> may partially overhang adjacent boxes.
1019 </p>
1020 <p>
1021 This level of the specificaiton does not define
1022 how much the overhang may be allowed, and under what conditions.
1023 </p>
1024 <div class="example">
1025 <p>
1026 The user agent may use [[JIS4051]] recommendation of
1027 using one ruby text character length as the maximum overhang length.
1028 Detailed rules for how ruby text can overhang adjacent characters for Japanese are described by [[JLREQ]].
1029 </p>
1030 </div>
1032 <p>
1033 When such <i>ruby annotation box</i> is at the start or end edge of a line,
1034 user agent may align the side of the ruby text that touches the edge of the line
1035 to the corresponding edge of the base.
1036 This type of alignment is described by [[JLREQ]].
1037 </p>
1038 <p>
1039 This level of the specificaiton does not provide a mechanism to control this behavior.
1040 </p>
1041 <div class="figure">
1042 <p><img width="146" height="109"
1043 alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is shorter than base"
1044 src="images/ra-le-l.gif" /><img width="146"
1045 height="110"
1046 alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is longer than base"
1047 src="images/ra-le-r.gif" /></p>
1048 <p><b>Figure 4.2.8</b>: Line edge ruby alignment</p>
1049 </div>
1051 <!--
1052 <h3 id="rubyover">
1053 Ruby overhanging: the 'ruby-overhang' property</h3>
1055 <table class="propdef">
1056 <tr>
1057 <th>Name:
1058 <td><dfn>ruby-overhang</dfn>
1059 <tr>
1060 <th>Value:
1061 <td>auto | start | end | none
1062 <tr>
1063 <th>Initial:
1064 <td>none
1065 <tr>
1066 <th>Applies to:
1067 <td>the parent of elements with display: ruby-text
1068 <tr>
1069 <th>Inherited:
1070 <td>yes
1071 <tr>
1072 <th>Percentages:
1073 <td>N/A
1074 <tr>
1075 <th>Media:
1076 <td>visual
1077 <tr>
1078 <th>Computed value:
1079 <td>specified value (except for initial and inherit)
1080 </table>
1082 <p>This property determines whether, and on which side, ruby text is allowed
1083 to partially overhang any adjacent text in addition to its own base, when the
1084 ruby text is wider than the ruby base. Note that ruby text is never allowed to
1085 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
1086 a maximum amount by which ruby text may overhang adjacent text. The user agent may use
1087 the [[JIS4051]] recommendation of using one ruby text character
1088 length as the maximum overhang length. Detailed rules for how ruby text can overhang adjacent characters for Japanese are described by [[JLREQ]].</p>
1090 <p>Possible values:</p>
1091 <dl>
1092 <dt><strong>auto</strong></dt>
1093 <dd>The ruby text can overhang text adjacent to the base on either side. [[JLREQ]] and [[JIS4051]] specify the categories of characters that
1094 ruby text can overhang. The user agent is free to follow those recommendations or specify its own classes of
1095 characters to overhang. This is the initial value.
1096 <div class="figure">
1097 <p><img class="example" width="177" height="91"
1098 alt="Diagram of glyph layout in overhanging ruby" src="images/ro-a.gif" /></p>
1099 <p><b>Figure 4.3.1</b>: Ruby overhanging adjacent text</p>
1100 </div>
1101 </dd>
1102 <dt><strong>start</strong></dt>
1103 <dd>The ruby text can only overhang the text that precedes it. That means, for
1104 example, that ruby cannot overhang text that is to the right of it in
1105 horizontal LTR layout, and it cannot overhang text that is below it in
1106 vertical-ideographic layout.
1107 <div class="figure">
1108 <p><img class="example" width="199" height="91"
1109 alt="Diagram of glyph layout when ruby overhangs the preceding glyphs only"
1110 src="images/ro-s.gif" /></p>
1111 <p><b>Figure 4.3.2</b>: Ruby overhanging preceding text only</p>
1112 </div>
1113 </dd>
1114 <dt><strong>end</strong></dt>
1115 <dd>The ruby text can only overhang the text that follows it. That means, for
1116 example, that ruby cannot overhang text that is to the left of it in
1117 horizontal LTR layout, and it cannot overhang text that is above it in
1118 vertical-ideographic layout.
1119 <div class="figure">
1120 <p><img class="example" width="198" height="91"
1121 alt="Diagram of glyph layout when ruby overhangs the following characters only"
1122 src="images/ro-e.gif" /></p>
1123 <p><b>Figure 4.3.3</b>: Ruby overhanging following text only</p>
1124 </div>
1125 </dd>
1126 <dt><strong>none</strong></dt>
1127 <dd>The ruby text cannot overhang any text adjacent to its base, only its
1128 own base.
1130 <div class="figure">
1131 <p><img class="example" width="220" height="91"
1132 alt="Diagram of glyph layout in non-overhanging ruby"
1133 src="images/ro-n.gif" /></p>
1134 <p><b>Figure 4.3.4</b>: Ruby not allowed to overhang adjacent text</p>
1135 </div>
1136 </dd>
1137 </dl>
1139 <h3 id="rubyspan">
1140 Ruby annotation spanning: the 'ruby-span' property</h3>
1142 <table class="propdef">
1143 <tr>
1144 <th>Name:
1145 <td><dfn>ruby-span</dfn>
1146 <tr>
1147 <th>Value:
1148 <td>attr(x) | none
1149 <tr>
1150 <th>Initial:
1151 <td>none
1152 <tr>
1153 <th>Applies to:
1154 <td>elements with display: ruby-text
1155 <tr>
1156 <th>Inherited:
1157 <td>no
1158 <tr>
1159 <th>Percentages:
1160 <td>N/A
1161 <tr>
1162 <th>Media:
1163 <td>visual
1164 <tr>
1165 <th>Computed value:
1166 <td><number>
1167 </table>
1169 <p>This property controls the spanning behavior of annotation elements. </p>
1171 <p class="note"><span class="note-label">Note:</span> A XHTML user agent may also use the <samp>rbspan</samp>
1172 attribute to get the same effect.</p>
1174 <p>Possible values:</p>
1176 <dl>
1177 <dt><strong>attr(x)</strong></dt>
1178 <dd>The value of attribute 'x' as a string value. The string value is
1179 evaluated as a <number> to determine the number of ruby base elements to be
1180 spanned by the annotation element. If the <number> is '0', it is replaced by
1181 '1'.The <number> is the computed value. </dd>
1182 <dt>none</dt>
1183 <dd>No spanning. The computed value is '1'.</dd>
1184 </dl>
1186 <p>The following example shows an XML example using the 'display' property
1187 values associated with the 'ruby structure and the 'ruby-span' property</p>
1188 <pre class="xml">myruby { display: ruby; }
1189 myrbc { display: ruby-base-container; }
1190 myrb { display: ruby-base; }
1191 myrtc.before { display: ruby-text-container; ruby-position: before}
1192 myrtc.after { display: ruby-text-container; ruby-position: after}
1193 myrt { display: ruby-text; ruby-span: attr(rbspan); }
1194 ...
1195 <myruby>
1196 <myrbc>
1197 <myrb>10</myrb>
1198 <myrb>31</myrb>
1199 <myrb>2002</myrb>
1200 </myrbc>
1201 <myrtc class="before">
1202 <myrt>Month</myrt>
1203 <myrt>Day</myrt>
1204 <myrt>Year</myrt>
1205 </myrtc>
1206 <myrtc class="after">
1207 <myrt rbspan="3">Expiration Date</myrt>
1208 </myrtc>
1209 </myruby></pre>
1210 -->
1212 <h2 id="default-stylesheet" class="no-num">
1213 Appendix A: Default Style Sheet</h2>
1215 <p><em>This section is informative.</em>
1217 <h3 id="default-ua-ruby" class="no-num">
1218 <span class="secno">A.1</span> Supporting Ruby Layout</h3>
1220 <p>The following represents a default UA style sheet
1221 for rendering HTML and XHTML ruby markup as ruby layout:
1223 <pre>
1224 <!-- -->ruby { display: ruby; }
1225 <!-- -->rb { display: ruby-base; white-space: nowrap; }
1226 <!-- -->rt { display: ruby-text; white-space: nowrap; font-size: 50%; }
1227 <!-- -->rbc { display: ruby-base-container; }
1228 <!-- -->rtc { display: ruby-text-container; }</pre>
1230 <p>Additional rules for UAs supporting the relevant features of [[CSS3-TEXT-DECOR]] and [[CSS3-FONTS]]:
1231 <pre>rt { font-variant-east-asian: ruby; text-emphasis: none; }</pre>
1233 <p class="note">Authors should not use the above rules;
1234 a UA that supports ruby layout should provide these by default.
1236 <h3 id="default-inline" class="no-num">
1237 <span class="secno">A.2</span> Inlining Ruby Annotations</h3>
1239 <p>The following represents a sample style sheet
1240 for rendering HTML and XHTML ruby markup as inline annotations:
1242 <pre>ruby, rb, rt, rbc, rtc, rp {
1243 <!-- --> display: inline; white-space: inherit;
1244 <!-- --> font-variant-east-asian: inherit; text-emphasis: inherit; }</pre>
1246 <h3 id="default-parens" class="no-num">
1247 <span class="secno">A.3</span> Generating Parentheses</h3>
1249 <p>Unfortunately, because Selectors cannot match against text nodes,
1250 it's not possible with CSS to express rules that will automatically and correctly
1251 add parentheses to unparenthesized ruby annotations in HTML.
1252 (This is because HTML ruby allows implying the <i>ruby base</i> from raw text, without a corresponding element.)
1253 However, these rules will handle cases where either <code><rb></code>
1254 or <code><rtc></code> is used rigorously.
1256 <pre>
1257 <!-- -->/* Parens around <rtc> */
1258 <!-- -->rtc::before { content: "("; }
1259 <!-- -->rtc::after { content: ")"; }
1261 <!-- -->/* Parens before first <rt> not inside <rtc> */
1262 <!-- -->rb + rt::before,
1263 <!-- -->rtc + rt::before { content: "("; }
1265 <!-- -->/* Parens after <rt> not inside <rtc> */
1266 <!-- -->rb ~ rt:last-child::after,
1267 <!-- -->rt + rb::before { content: ")"; }
1268 <!-- -->rt + rtc::before { content: ")("; }</pre>
1270 <h2 id="glossary">
1271 Glossary</h2>
1272 <dl>
1273 <dt><a id="g-bopomofo"><strong><span
1274 lang="zh">Bopomofo</span></strong></a></dt>
1275 <dd>37 characters and 4 tone markings used as phonetics in Chinese,
1276 especially standard Mandarin.</dd>
1277 <dt><a id="g-hanja"><strong><span
1278 lang="ko">Hanja</span></strong></a></dt>
1279 <dd>Subset of the Korean writing system that utilizes ideographic
1280 characters borrowed or adapted from the Chinese writing system. Also see
1281 <a href="#g-kanji"><span lang="ja">Kanji</span></a>.</dd>
1282 <dt><a id="g-hiragana"><strong><span
1283 lang="ja">Hiragana</span></strong></a></dt>
1284 <dd>Japanese syllabic script, or character of that script. Rounded and
1285 cursive in appearance. Subset of the Japanese writing system, used together
1286 with kanji and katakana. In recent times, mostly used to write Japanese
1287 words when kanji are not available or appropriate, and word endings and
1288 particles. Also see <a
1289 href="#g-katakana"><span lang="ja">Katakana</span></a>.</dd>
1290 <dt><a id="g-ideogram"><strong>Ideograph</strong></a></dt>
1291 <dd>A character that is used to represent an idea, word, or word component,
1292 in contrast to a character from an alphabetic or syllabic script. The most
1293 well-known ideographic script is used (with some variation) in East Asia
1294 (China, Japan, Korea,...).</dd>
1295 <dt><a id="g-kana"><strong><span lang="ja">Kana</span></strong></a></dt>
1296 <dd>Collective term for hiragana and katakana.</dd>
1297 <dt><a id="g-kanji"><strong>Kanji</strong></a></dt>
1298 <dd>Japanese term for ideographs; ideographs used in Japanese. Subset of the
1299 Japanese writing system, used together with hiragana and katakana. Also see <a
1300 href="#g-hanja"><span lang="ko">Hanja</span></a>.</dd>
1301 <dt><a id="g-katakana"><strong><span
1302 lang="ja">Katakana</span></strong></a></dt>
1303 <dd>Japanese syllabic script, or character of that script. Angular in
1304 appearance. Subset of the Japanese writing system, used together with
1305 kanji and hiragana. In recent times, mainly used to write foreign words. Also see <a
1306 href="#g-hiragana"><span lang="ja">Hiragana</span></a>.</dd>
1307 <dt><a id="g-monoruby" name="g-monoruby"><strong>Mono-ruby</strong></a></dt>
1308 <dd>In Japanese typography: Ruby associated with a single character of
1309 the base text.</dd>
1310 <dt><a id="g-ruby"><strong>Ruby</strong></a></dt>
1311 <dd>A run of text that appears in the vicinity of another run of text and
1312 serves as an annotation or a pronunciation guide for that text.</dd>
1313 </dl>
1315 <h2 id="conformance">
1316 Conformance</h2>
1318 <h3 id="conventions">
1319 Document conventions</h3>
1321 <p>Conformance requirements are expressed with a combination of
1322 descriptive assertions and RFC 2119 terminology. The key words “MUST”,
1323 “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
1324 “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
1325 document are to be interpreted as described in RFC 2119.
1326 However, for readability, these words do not appear in all uppercase
1327 letters in this specification.
1329 <p>All of the text of this specification is normative except sections
1330 explicitly marked as non-normative, examples, and notes. [[!RFC2119]]</p>
1332 <p>Examples in this specification are introduced with the words “for example”
1333 or are set apart from the normative text with <code>class="example"</code>,
1334 like this:
1336 <div class="example">
1337 <p>This is an example of an informative example.</p>
1338 </div>
1340 <p>Informative notes begin with the word “Note” and are set apart from the
1341 normative text with <code>class="note"</code>, like this:
1343 <p class="note">Note, this is an informative note.</p>
1345 <h3 id="conformance-classes">
1346 Conformance classes</h3>
1348 <p>Conformance to CSS Ruby Module
1349 is defined for three conformance classes:
1350 <dl>
1351 <dt><dfn title="style sheet!!as conformance class">style sheet</dfn>
1352 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
1353 style sheet</a>.
1354 <dt><dfn>renderer</dfn></dt>
1355 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
1356 that interprets the semantics of a style sheet and renders
1357 documents that use them.
1358 <dt><dfn id="authoring-tool">authoring tool</dfn></dt>
1359 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
1360 that writes a style sheet.
1361 </dl>
1363 <p>A style sheet is conformant to CSS Ruby Module
1364 if all of its statements that use syntax defined in this module are valid
1365 according to the generic CSS grammar and the individual grammars of each
1366 feature defined in this module.
1368 <p>A renderer is conformant to CSS Ruby Module
1369 if, in addition to interpreting the style sheet as defined by the
1370 appropriate specifications, it supports all the features defined
1371 by CSS Ruby Module by parsing them correctly
1372 and rendering the document accordingly. However, the inability of a
1373 UA to correctly render a document due to limitations of the device
1374 does not make the UA non-conformant. (For example, a UA is not
1375 required to render color on a monochrome monitor.)
1377 <p>An authoring tool is conformant to CSS Ruby Module
1378 if it writes style sheets that are syntactically correct according to the
1379 generic CSS grammar and the individual grammars of each feature in
1380 this module, and meet all other conformance requirements of style sheets
1381 as described in this module.
1383 <h3 id="partial">
1384 Partial implementations</h3>
1386 <p>So that authors can exploit the forward-compatible parsing rules to
1387 assign fallback values, CSS renderers <strong>must</strong>
1388 treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore
1389 as appropriate</a>) any at-rules, properties, property values, keywords,
1390 and other syntactic constructs for which they have no usable level of
1391 support. In particular, user agents <strong>must not</strong> selectively
1392 ignore unsupported component values and honor supported values in a single
1393 multi-value property declaration: if any value is considered invalid
1394 (as unsupported values must be), CSS requires that the entire declaration
1395 be ignored.</p>
1397 <h3 id="experimental">
1398 Experimental implementations</h3>
1400 <p>To avoid clashes with future CSS features, the CSS2.1 specification
1401 reserves a <a href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
1402 syntax</a> for proprietary and experimental extensions to CSS.
1404 <p>Prior to a specification reaching the Candidate Recommendation stage
1405 in the W3C process, all implementations of a CSS feature are considered
1406 experimental. The CSS Working Group recommends that implementations
1407 use a vendor-prefixed syntax for such features, including those in
1408 W3C Working Drafts. This avoids incompatibilities with future changes
1409 in the draft.
1410 </p>
1412 <h3 id="testing">
1413 Non-experimental implementations</h3>
1415 <p>Once a specification reaches the Candidate Recommendation stage,
1416 non-experimental implementations are possible, and implementors should
1417 release an unprefixed implementation of any CR-level feature they
1418 can demonstrate to be correctly implemented according to spec.
1420 <p>To establish and maintain the interoperability of CSS across
1421 implementations, the CSS Working Group requests that non-experimental
1422 CSS renderers submit an implementation report (and, if necessary, the
1423 testcases used for that implementation report) to the W3C before
1424 releasing an unprefixed implementation of any CSS features. Testcases
1425 submitted to W3C are subject to review and correction by the CSS
1426 Working Group.
1428 <p>Further information on submitting testcases and implementation reports
1429 can be found from on the CSS Working Group's website at
1430 <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
1431 Questions should be directed to the
1432 <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
1433 mailing list.
1435 <h2 class=no-num id="acknowledgments">
1436 Acknowledgments</h2>
1438 <p>This specification would not have been possible without the help from:</p>
1440 <p>Stephen Deach, Martin Dürst, Hideki Hiura(<span lang="ja">樋浦 秀樹</span>), Masayasu Ishikawa(<span lang="ja">石川
1441 雅康</span>), Chris
1442 Pratley, Takao Suzuki(<span lang="ja">鈴木 孝雄</span>), Frank Yung-Fong Tang, Chris Thrasher, Masafumi Yabe<span lang="ja">家辺
1443 勝文</span>), Steve Zilles.</p>
1445 <h2 class="no-num" id="changes">
1446 Changes</h2>
1448 <p>The following major changes have been made since the previous Working Draft:
1449 <dl>
1450 <dt>Remove 'ruby-span' and mentions of <code>rbspan</code>.
1451 <dd>
1452 Explicit spanning is not used in HTML ruby in favor of implicit spanning.
1453 This can't handle some pathological double-sided spanning cases,
1454 but there seems to be no requirement for these at the moment.
1455 (For implementations that support full complex XHTML Ruby,
1456 they can imply spanning from the markup the same magic way
1457 that we handle cell spanning from tables. It doesn't seem
1458 necessary to include controls this in Level 1.)
1460 <dt>Defer 'ruby-overhang' and ''ruby-align: line-end'' to Level 2.
1461 <dd>
1462 It's somewhat complicated, advanced feature.
1463 Proposal is to make this behavior UA-defined
1464 and provide some examples of acceptable options.
1466 <dt>Close issue requesting 'display: rp': use ''display: none''.
1467 <dd>
1468 The i18nwg added an issue requesting a display value for <rp> elements.
1469 They're supposed to be hidden when &tl;ruby> is displayed as ruby.
1470 But this is easily accomplished already with ''display: none''.
1472 <dt>Change 'ruby-position' values to match 'text-emphasis-position'.
1473 <dd>
1474 Other than ''inter-character'', which we need to keep,
1475 it makes more sense to align ruby positions with 'text-emphasis-position',
1476 which can correctly handle various combinations of horizontal/vertical preferences.
1478 <dt>Remove unused values of 'ruby-align'.
1479 <dd>
1480 'left', 'right', and 'end' are not needed.
1482 <dt>Added 'ruby-merge' property to control jukugo rendering.
1483 <dd>
1484 This is a stylistic effect, not a structural one;
1485 the previous model assumed that it was structural and suggested handling it by changing markup. :(
1487 <dt>Remove ''inline'' from 'ruby-position'.
1488 <dd>
1489 This is do-able via ''display: inline'' on all the ruby-related elements,
1490 see <a href="#default-inline">Appendix A</a>
1492 <dt>Added <a href="#default-style">Default Style</a> rules
1493 <dd>
1494 As requested by i18nwg.
1496 <dt>Wrote anonymous box generation rules
1497 <dd>
1498 And defined pairing of bases and annotations.
1499 Should now handle all the crazy proposed permutations of HTML ruby markup.
1500 </dl>
1502 <h2 class=no-num id="references">
1503 References</h2>
1505 <h3 class="no-num" id="normative-references">
1506 Normative references</h3>
1507 <!--normative-->
1509 <h3 class="no-num" id="other-references">
1510 Other references</h3>
1511 <!--informative-->
1513 <h2 class="no-num" id="index">
1514 Index</h2>
1515 <!--index-->
1517 <h2 class="no-num" id="property-index">
1518 Property index</h2>
1519 <!-- properties -->
1521 </body>
1522 </html>
1523 <!-- Keep this comment at the end of the file
1524 Local variables:
1525 mode: sgml
1526 sgml-declaration:"~/SGML/HTML4.decl"
1527 sgml-default-doctype-name:"html"
1528 sgml-minimize-attributes:t
1529 sgml-nofill-elements:("pre" "style" "br")
1530 sgml-live-element-indicator:t
1531 sgml-omittag:nil
1532 sgml-shorttag:nil
1533 sgml-namecase-general:t
1534 sgml-general-insert-case:lower
1535 sgml-always-quote-attributes:t
1536 sgml-indent-step:nil
1537 sgml-indent-data:t
1538 sgml-parent-document:nil
1539 sgml-exposed-tags:nil
1540 sgml-local-catalogs:nil
1541 sgml-local-ecat-files:nil
1542 End:
1543 -->