css-ruby/Overview.src.html

Wed, 19 Jun 2013 00:17:07 +0900

author
kojiishi
date
Wed, 19 Jun 2013 00:17:07 +0900
changeset 8502
b928e51898ae
parent 8501
3d59611e6d44
child 8503
2763a62e9a48
permissions
-rw-r--r--

[css-ruby] Ruby Overhang and Edge Effects

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

mercurial