css-ruby/Overview.src.html

Tue, 18 Jun 2013 23:40:26 +0900

author
kojiishi
date
Tue, 18 Jun 2013 23:40:26 +0900
changeset 8500
5243c39b9ab1
parent 8499
9979d267d8ed
child 8501
3d59611e6d44
permissions
-rw-r--r--

[css-ruby] fix broken char

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@8499 694 <p>
kojiishi@8499 695 One possible algorithm is described as Jukugo-ruby in [[JLREQ]].
kojiishi@8499 696 </p>
kojiishi@8499 697 <p>
kojiishi@8499 698 Another, more simplified algorithm of Jukugo-ruby is
kojiishi@8499 699 to render as Mono-ruby if all ruby annotation boxes fit within
kojiishi@8499 700 advances of their corresponding base boxes,
kojiishi@8499 701 and render as Group-ruby otherwise.
kojiishi@8499 702 </p>
kojiishi@8499 703 </dd>
kojiishi@8499 704 </dl>
kojiishi@8499 705
fantasai@8479 706 <h3 id="rubyalign">
fantasai@8479 707 Ruby alignment: the 'ruby-align' property</h3>
ishida@1665 708
kojiishi@8496 709 <table class="propdef">
kojiishi@8496 710 <tr>
kojiishi@8496 711 <th>Name:
kojiishi@8496 712 <td><dfn>ruby-align</dfn>
kojiishi@8496 713 <tr>
kojiishi@8496 714 <th><a href="#values">Value</a>:
kojiishi@8496 715 <td>auto | start | center |
kojiishi@8496 716 distribute-letter | distribute-space
kojiishi@8496 717 <tr>
kojiishi@8496 718 <th>Initial:
kojiishi@8496 719 <td>auto
kojiishi@8496 720 <tr>
kojiishi@8496 721 <th>Applies to:
kojiishi@8496 722 <td>all elements and generated content
kojiishi@8496 723 <tr>
kojiishi@8496 724 <th>Inherited:
kojiishi@8496 725 <td>yes
kojiishi@8496 726 <tr>
kojiishi@8496 727 <th>Percentages:
kojiishi@8496 728 <td>N/A
kojiishi@8496 729 <tr>
kojiishi@8496 730 <th>Media:
kojiishi@8496 731 <td>visual
kojiishi@8496 732 <tr>
kojiishi@8496 733 <th>Computed value:
kojiishi@8496 734 <td>specified value (except for initial and inherit)
kojiishi@8496 735 </table>
ishida@1665 736
kojiishi@8496 737 <p>This property can be used on any element to control the text alignment of
kojiishi@8496 738 the ruby text and ruby base contents relative to each other. It applies to all
kojiishi@8496 739 the rubys in the element. For simple ruby, the alignment is applied to the
kojiishi@8496 740 ruby child element whose content is shorter: either the <a
kojiishi@8496 741 href="http://www.w3.org/TR/ruby/#rb"><samp>rb</samp></a> element or the <a
kojiishi@8496 742 href="http://www.w3.org/TR/ruby/#rt"><samp>rt</samp></a> element [[RUBY]].
kojiishi@8496 743 For complex ruby, the alignment is also applied to the
kojiishi@8496 744 ruby child elements whose content is shorter: either the <samp>rb</samp>
kojiishi@8496 745 element and/or one or two <samp>rt</samp> elements for each related ruby text
kojiishi@8496 746 and ruby base element within the <samp>rtc</samp> and <samp>rbc</samp>
kojiishi@8496 747 element.</p>
ishida@1665 748
kojiishi@8496 749 <p>Possible values:</p>
kojiishi@8496 750 <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 751 <dl>
kojiishi@8496 752 <dt><dfn title="ruby-align:auto">''auto''</dfn></dt>
kojiishi@8496 753 <dd>
kojiishi@8496 754 <p>The user agent determines how the ruby contents are aligned.
kojiishi@8496 755 This is the initial value.
kojiishi@8496 756 The behavior recommended by [[JLREQ]] is for wide-cell ruby to be aligned in the 'distribute-space' mode:
kojiishi@8496 757 <div class="figure">
kojiishi@8496 758 <p><img width="145" height="91"
kojiishi@8496 759 alt="Diagram of glyph layout in auto aligned ruby when ruby text is shorter than base"
kojiishi@8496 760 src="images/ra-ds.gif" /><img width="145" height="91"
kojiishi@8496 761 alt="Diagram of glyph layout in auto aligned ruby when ruby text is longer than base"
kojiishi@8496 762 src="images/ra-ds-rb.gif" /></p>
kojiishi@8496 763 <p><b>Figure 4.2.1</b>: Wide-cell text in 'auto' ruby alignment is
kojiishi@8496 764 'distribute-space' justified</p>
kojiishi@8496 765 </div>
ishida@1665 766
kojiishi@8496 767 <p>The recommended behavior for narrow-cell glyph ruby is to be
kojiishi@8496 768 aligned in the 'center' mode.</p>
kojiishi@8496 769 <div class="figure">
kojiishi@8496 770 <p><img
kojiishi@8496 771 alt="Diagram of glyph layout in auto aligned ruby when halfwidth ruby text is shorter than base"
kojiishi@8496 772 width="145" height="91"
kojiishi@8496 773 src="images/ra-c-h.gif" /><img
kojiishi@8496 774 alt="Diagram of character layout in auto aligned ruby when ruby text is longer than narrow-width base"
kojiishi@8496 775 width="145" height="91"
kojiishi@8496 776 src="images/ra-c-rb-h.gif" /></p>
kojiishi@8496 777 <p><b>Figure 4.2.2</b>: Narrow-width ruby text in 'auto' ruby alignment
kojiishi@8496 778 is centered</p>
kojiishi@8496 779 </div>
kojiishi@8496 780 </dd>
ishida@1665 781
kojiishi@8496 782 <dt><dfn title="ruby-align:start">''start''</dfn></dt>
kojiishi@8496 783 <dd>The ruby text content is aligned with the start edge of the base.
kojiishi@8496 784 <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 785
kojiishi@8496 786 <div class="figure">
kojiishi@8496 787 <p><img
kojiishi@8496 788 alt="Diagram of glyph layout in left aligned ruby when ruby text is shorter than base"
kojiishi@8496 789 width="145" height="91" src="images/ra-l.gif" /><img
kojiishi@8496 790 width="145" height="91"
kojiishi@8496 791 alt="Diagram of glyph layout in left aligned ruby when ruby text is longer than base"
kojiishi@8496 792 src="images/ra-l-rb.gif" /></p>
kojiishi@8496 793 <p><b>Figure 4.2.3</b>: Start ruby alignment</p>
kojiishi@8496 794 </div>
kojiishi@8496 795 </dd>
kojiishi@8496 796
kojiishi@8496 797 <dt><dfn title="ruby-align:center">''center''</dfn></dt>
kojiishi@8496 798 <dd>The ruby text content is centered within the width of the base. If the
kojiishi@8496 799 length of the base is smaller than the length of the ruby text, then the
kojiishi@8496 800 base is centered within the width of the ruby text.
kojiishi@8496 801
kojiishi@8496 802 <div class="figure">
kojiishi@8496 803 <p><img width="145" height="91"
kojiishi@8496 804 alt="Diagram of glyph layout in center aligned ruby when ruby text is shorter than base"
kojiishi@8496 805 src="images/ra-c.gif" /><img width="145" height="91"
kojiishi@8496 806 alt="Diagram of glyph layout in center aligned ruby when ruby text is longer than base"
kojiishi@8496 807 src="images/ra-c-rb.gif" /></p>
kojiishi@8496 808 <p><b>Figure 4.2.4</b>: Center ruby alignment</p>
kojiishi@8496 809 </div>
kojiishi@8496 810 </dd>
kojiishi@8496 811
kojiishi@8496 812 <!--
ishida@1665 813 <dt><strong>right</strong></dt>
ishida@1665 814 <dd>The ruby text content is aligned with the end edge of the base.
ishida@3034 815 <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 816 <div class="figure">
ishida@1665 817 <p><img class="example" width="145" height="91"
ishida@1665 818 alt="Diagram of glyph layout in right aligned ruby when ruby text is shorter than base"
ishida@1666 819 src="images/ra-r.gif" /><img class="example" width="145" height="91"
ishida@1665 820 alt="Diagram of glyph layout in right aligned ruby when ruby text is longer than base"
ishida@1666 821 src="images/ra-r-rb.gif" /></p>
ishida@1665 822 <p><b>Figure 4.2.5</b>: End ruby alignment</p>
ishida@1665 823 </div>
ishida@1665 824 </dd>
kojiishi@8496 825 -->
ishida@1665 826
kojiishi@8496 827 <dt><dfn title="ruby-align:distribute-letter">''distribute-letter''</dfn></dt>
kojiishi@8496 828 <dd>If the width of the ruby text is smaller than that of the base, then
kojiishi@8496 829 the ruby text contents are evenly distributed across the width of the
kojiishi@8496 830 base, with the first and last ruby text glyphs lining up with the
kojiishi@8496 831 corresponding first and last base glyphs. If the width of the ruby text
kojiishi@8496 832 is at least the width of the base, then the letters of the base are
kojiishi@8496 833 evenly distributed across the width of the ruby text.
kojiishi@8496 834
kojiishi@8496 835 <div class="figure">
kojiishi@8496 836 <p><img width="145" height="91"
kojiishi@8496 837 alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is shorter than base"
kojiishi@8496 838 src="images/ra-dl.gif" /><img width="145" height="91"
kojiishi@8496 839 alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is longer than base"
kojiishi@8496 840 src="images/ra-dl-rb.gif" /></p>
kojiishi@8496 841 <p><b>Figure 4.2.6</b>: Distribute-letter ruby alignment</p>
kojiishi@8496 842 </div>
kojiishi@8496 843 </dd>
kojiishi@8496 844
kojiishi@8496 845 <dt><dfn title="ruby-align:distribute-space">''distribute-space''</dfn></dt>
kojiishi@8496 846 <dd>If the width of the ruby text is smaller than that of the base, then
kojiishi@8496 847 the ruby text contents are evenly distributed across the width of the
kojiishi@8496 848 base, with a certain amount of white space preceding the first and
kojiishi@8496 849 following the last character in the ruby text. That amount of white
kojiishi@8496 850 space is normally equal to half the amount of inter-character space of
kojiishi@8496 851 the ruby text. If the width of the ruby text is at least the width of
kojiishi@8496 852 the base, then the same type of space distribution applies to the base.
kojiishi@8496 853 In other words, if the base is shorter than the ruby text, the base is
kojiishi@8496 854 distribute-space aligned. This type of alignment
kojiishi@8496 855 is described by [[JLREQ]].
kojiishi@8496 856
kojiishi@8496 857 <div class="figure">
kojiishi@8496 858 <p><img width="145" height="91"
kojiishi@8496 859 alt="Diagram of glyph layout in distribute-space aligned ruby when ruby text is shorter than base"
kojiishi@8496 860 src="images/ra-ds.gif" /><img width="145" height="91"
kojiishi@8496 861 alt="Diagram of glyph layout in distribute-space aligned ruby when ruby text is longer than base"
kojiishi@8496 862 src="images/ra-ds-rb.gif" /></p>
kojiishi@8496 863 <p><b>Figure 4.2.7</b>: Distribute-space ruby alignment</p>
kojiishi@8496 864 </div>
kojiishi@8496 865 </dd>
kojiishi@8496 866
kojiishi@8496 867 <!--
ishida@1665 868 <dt><strong>line-edge</strong></dt>
ishida@1665 869 <dd>If the ruby text is not adjacent to a line edge, it is aligned as in
ishida@1665 870 'auto'. If it is adjacent to a line edge, then it is still aligned as in
ishida@1665 871 auto, but the side of the ruby text that touches the end of the line is
ishida@1665 872 lined up with the corresponding edge of the base. This type of alignment
fantasai@8479 873 is described by [[JLREQ]]. This type of alignment is
ishida@1665 874 relevant only to the scenario where the ruby text is longer than the
ishida@1665 875 ruby base. In the other scenarios, this is just 'auto'.
ishida@1665 876 <div class="figure">
ishida@1665 877 <p><img class="example" width="146" height="109"
ishida@1665 878 alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is shorter than base"
ishida@1666 879 src="images/ra-le-l.gif" /><img class="example" width="146"
ishida@1665 880 height="110"
ishida@1665 881 alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is longer than base"
ishida@1666 882 src="images/ra-le-r.gif" /></p>
ishida@1665 883 <p><b>Figure 4.2.8</b>: Line edge ruby alignment</p>
ishida@1665 884 </div>
ishida@1665 885 </dd>
kojiishi@8496 886 -->
kojiishi@8496 887 </dl>
ishida@1665 888
kojiishi@8496 889 <p>For a complex ruby with spanning elements, one additional consideration is
kojiishi@8496 890 required. If the spanning element spans multiple 'rows' (other rbc or rtc
kojiishi@8496 891 elements), and the ruby alignment requires space distribution among the
kojiishi@8496 892 'spanned' elements, a ratio must be determined among the 'columns' of spanned
kojiishi@8496 893 elements. This ratio is computed by taking into consideration the widest
kojiishi@8496 894 element within each column.</p>
ishida@1665 895
kojiishi@8496 896 <!--
fantasai@8479 897 <h3 id="rubyover">
fantasai@8479 898 Ruby overhanging: the 'ruby-overhang' property</h3>
ishida@1665 899
fantasai@8479 900 <table class="propdef">
fantasai@8479 901 <tr>
fantasai@8479 902 <th>Name:
fantasai@8479 903 <td><dfn>ruby-overhang</dfn>
fantasai@8479 904 <tr>
fantasai@8479 905 <th>Value:
fantasai@8479 906 <td>auto | start | end | none
fantasai@8479 907 <tr>
fantasai@8479 908 <th>Initial:
fantasai@8479 909 <td>none
fantasai@8479 910 <tr>
fantasai@8479 911 <th>Applies to:
fantasai@8479 912 <td>the parent of elements with display: ruby-text
fantasai@8479 913 <tr>
fantasai@8479 914 <th>Inherited:
fantasai@8479 915 <td>yes
fantasai@8479 916 <tr>
fantasai@8479 917 <th>Percentages:
fantasai@8479 918 <td>N/A
fantasai@8479 919 <tr>
fantasai@8479 920 <th>Media:
fantasai@8479 921 <td>visual
fantasai@8479 922 <tr>
fantasai@8479 923 <th>Computed value:
fantasai@8479 924 <td>specified value (except for initial and inherit)
fantasai@8479 925 </table>
ishida@1665 926
ishida@1665 927 <p>This property determines whether, and on which side, ruby text is allowed
ishida@1665 928 to partially overhang any adjacent text in addition to its own base, when the
ishida@1665 929 ruby text is wider than the ruby base. Note that ruby text is never allowed to
ishida@1665 930 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 931 a maximum amount by which ruby text may overhang adjacent text. The user agent may use
fantasai@8479 932 the [[JIS4051]] recommendation of using one ruby text character
fantasai@8479 933 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 934
ishida@1665 935 <p>Possible values:</p>
ishida@1665 936 <dl>
ishida@1665 937 <dt><strong>auto</strong></dt>
fantasai@8479 938 <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 939 ruby text can overhang. The user agent is free to follow those recommendations or specify its own classes of
ishida@1665 940 characters to overhang. This is the initial value.
ishida@1665 941 <div class="figure">
ishida@1665 942 <p><img class="example" width="177" height="91"
ishida@1666 943 alt="Diagram of glyph layout in overhanging ruby" src="images/ro-a.gif" /></p>
ishida@1665 944 <p><b>Figure 4.3.1</b>: Ruby overhanging adjacent text</p>
ishida@1665 945 </div>
ishida@1665 946 </dd>
ishida@1665 947 <dt><strong>start</strong></dt>
ishida@3034 948 <dd>The ruby text can only overhang the text that precedes it. That means, for
ishida@3034 949 example, that ruby cannot overhang text that is to the right of it in
ishida@3034 950 horizontal LTR layout, and it cannot overhang text that is below it in
ishida@1665 951 vertical-ideographic layout.
ishida@1665 952 <div class="figure">
ishida@1665 953 <p><img class="example" width="199" height="91"
ishida@1665 954 alt="Diagram of glyph layout when ruby overhangs the preceding glyphs only"
ishida@1666 955 src="images/ro-s.gif" /></p>
ishida@1665 956 <p><b>Figure 4.3.2</b>: Ruby overhanging preceding text only</p>
ishida@1665 957 </div>
ishida@1665 958 </dd>
ishida@1665 959 <dt><strong>end</strong></dt>
ishida@3034 960 <dd>The ruby text can only overhang the text that follows it. That means, for
ishida@3034 961 example, that ruby cannot overhang text that is to the left of it in
ishida@3034 962 horizontal LTR layout, and it cannot overhang text that is above it in
ishida@1665 963 vertical-ideographic layout.
ishida@1665 964 <div class="figure">
ishida@1665 965 <p><img class="example" width="198" height="91"
ishida@1665 966 alt="Diagram of glyph layout when ruby overhangs the following characters only"
ishida@1666 967 src="images/ro-e.gif" /></p>
ishida@1665 968 <p><b>Figure 4.3.3</b>: Ruby overhanging following text only</p>
ishida@1665 969 </div>
ishida@1665 970 </dd>
ishida@1665 971 <dt><strong>none</strong></dt>
ishida@1665 972 <dd>The ruby text cannot overhang any text adjacent to its base, only its
ishida@1665 973 own base.
ishida@1665 974
ishida@1665 975 <div class="figure">
ishida@1665 976 <p><img class="example" width="220" height="91"
ishida@1665 977 alt="Diagram of glyph layout in non-overhanging ruby"
ishida@1666 978 src="images/ro-n.gif" /></p>
ishida@1665 979 <p><b>Figure 4.3.4</b>: Ruby not allowed to overhang adjacent text</p>
ishida@1665 980 </div>
ishida@1665 981 </dd>
ishida@1665 982 </dl>
ishida@1665 983
fantasai@8479 984 <h3 id="rubyspan">
fantasai@8479 985 Ruby annotation spanning: the 'ruby-span' property</h3>
ishida@1665 986
fantasai@8479 987 <table class="propdef">
fantasai@8479 988 <tr>
fantasai@8479 989 <th>Name:
fantasai@8479 990 <td><dfn>ruby-span</dfn>
fantasai@8479 991 <tr>
fantasai@8479 992 <th>Value:
fantasai@8479 993 <td>attr(x) | none
fantasai@8479 994 <tr>
fantasai@8479 995 <th>Initial:
fantasai@8479 996 <td>none
fantasai@8479 997 <tr>
fantasai@8479 998 <th>Applies to:
fantasai@8479 999 <td>elements with display: ruby-text
fantasai@8479 1000 <tr>
fantasai@8479 1001 <th>Inherited:
fantasai@8479 1002 <td>no
fantasai@8479 1003 <tr>
fantasai@8479 1004 <th>Percentages:
fantasai@8479 1005 <td>N/A
fantasai@8479 1006 <tr>
fantasai@8479 1007 <th>Media:
fantasai@8479 1008 <td>visual
fantasai@8479 1009 <tr>
fantasai@8479 1010 <th>Computed value:
fantasai@8479 1011 <td>&lt;number&gt;
fantasai@8479 1012 </table>
ishida@1665 1013
ishida@1665 1014 <p>This property controls the spanning behavior of annotation elements. </p>
ishida@1665 1015
ishida@1665 1016 <p class="note"><span class="note-label">Note:</span> A XHTML user agent may also use the <samp>rbspan</samp>
ishida@1665 1017 attribute to get the same effect.</p>
ishida@1665 1018
ishida@1665 1019 <p>Possible values:</p>
ishida@1665 1020
ishida@1665 1021 <dl>
ishida@1665 1022 <dt><strong>attr(x)</strong></dt>
ishida@1665 1023 <dd>The value of attribute 'x' as a string value. The string value is
ishida@1665 1024 evaluated as a &lt;number&gt; to determine the number of ruby base elements to be
ishida@1665 1025 spanned by the annotation element. If the &lt;number&gt; is &#39;0&#39;, it is replaced by
ishida@1665 1026 &#39;1&#39;.The &lt;number&gt; is the computed value. </dd>
ishida@1665 1027 <dt>none</dt>
ishida@1665 1028 <dd>No spanning. The computed value is &#39;1&#39;.</dd>
ishida@1665 1029 </dl>
ishida@1665 1030
ishida@1665 1031 <p>The following example shows an XML example using the 'display' property
ishida@1665 1032 values associated with the 'ruby structure and the 'ruby-span' property</p>
ishida@3034 1033 <pre class="xml">myruby { display: ruby; }
ishida@1665 1034 myrbc { display: ruby-base-container; }
ishida@1665 1035 myrb { display: ruby-base; }
ishida@1665 1036 myrtc.before { display: ruby-text-container; ruby-position: before}
ishida@1665 1037 myrtc.after { display: ruby-text-container; ruby-position: after}
ishida@1665 1038 myrt { display: ruby-text; ruby-span: attr(rbspan); }
ishida@1665 1039 ...
ishida@1665 1040 &lt;myruby&gt;
ishida@1665 1041 &lt;myrbc&gt;
ishida@1665 1042 &lt;myrb&gt;10&lt;/myrb&gt;
ishida@1665 1043 &lt;myrb&gt;31&lt;/myrb&gt;
ishida@1665 1044 &lt;myrb&gt;2002&lt;/myrb&gt;
ishida@1665 1045 &lt;/myrbc&gt;
ishida@1665 1046 &lt;myrtc class=&quot;before&quot;&gt;
ishida@1665 1047 &lt;myrt&gt;Month&lt;/myrt&gt;
ishida@1665 1048 &lt;myrt&gt;Day&lt;/myrt&gt;
ishida@1665 1049 &lt;myrt&gt;Year&lt;/myrt&gt;
ishida@1665 1050 &lt;/myrtc&gt;
ishida@1665 1051 &lt;myrtc class=&quot;after&quot;&gt;
ishida@1665 1052 &lt;myrt rbspan=&quot;3&quot;&gt;Expiration Date&lt;/myrt&gt;
ishida@1665 1053 &lt;/myrtc&gt;
ishida@1665 1054 &lt;/myruby&gt;</pre>
kojiishi@8496 1055 -->
ishida@1665 1056
fantasai@8497 1057 <h2 id="default-stylesheet" class="no-num">
fantasai@8497 1058 Appendix A: Default Style Sheet</h2>
ishida@1665 1059
fantasai@8497 1060 <p><em>This section is informative.</em>
ishida@1665 1061
fantasai@8497 1062 <h3 id="default-ua-ruby" class="no-num">
fantasai@8497 1063 <span class="secno">A.1</span> Supporting Ruby Layout</h3>
ishida@1665 1064
fantasai@8497 1065 <p>The following represents a default UA style sheet
fantasai@8497 1066 for rendering HTML and XHTML ruby markup as ruby layout:
ishida@1665 1067
fantasai@8497 1068 <pre>
fantasai@8497 1069 <!-- -->ruby { display: ruby; }
fantasai@8497 1070 <!-- -->rb { display: ruby-base; white-space: nowrap; }
fantasai@8497 1071 <!-- -->rt { display: ruby-text; white-space: nowrap; font-size: 50%; }
fantasai@8497 1072 <!-- -->rbc { display: ruby-base-container; }
fantasai@8497 1073 <!-- -->rtc { display: ruby-text-container; }</pre>
fantasai@8497 1074
fantasai@8497 1075 <p>Additional rules for UAs supporting the relevant features of [[CSS3-TEXT-DECOR]] and [[CSS3-FONTS]]:
fantasai@8497 1076 <pre>rt { font-variant-east-asian: ruby; text-emphasis: none; }</pre>
fantasai@8497 1077
fantasai@8497 1078 <p class="note">Authors should not use the above rules;
fantasai@8497 1079 a UA that supports ruby layout should provide these by default.
fantasai@8497 1080
fantasai@8497 1081 <h3 id="default-inline" class="no-num">
fantasai@8497 1082 <span class="secno">A.2</span> Inlining Ruby Annotations</h3>
fantasai@8497 1083
fantasai@8497 1084 <p>The following represents a sample style sheet
fantasai@8497 1085 for rendering HTML and XHTML ruby markup as inline annotations:
fantasai@8497 1086
fantasai@8497 1087 <pre>ruby, rb, rt, rbc, rtc, rp {
fantasai@8497 1088 <!-- --> display: inline; white-space: inherit;
fantasai@8497 1089 <!-- --> font-variant-east-asian: inherit; text-emphasis: inherit; }</pre>
fantasai@8497 1090
fantasai@8497 1091 <h3 id="default-parens" class="no-num">
fantasai@8497 1092 <span class="secno">A.3</span> Generating Parentheses</h3>
fantasai@8497 1093
fantasai@8497 1094 <p>Unfortunately, because Selectors cannot match against text nodes,
fantasai@8497 1095 it's not possible with CSS to express rules that will automatically and correctly
fantasai@8497 1096 add parentheses to unparenthesized ruby annotations in HTML.
fantasai@8498 1097 (This is because HTML ruby allows implying the <i>ruby base</i> from raw text, without a corresponding element.)
fantasai@8498 1098 However, these rules will handle cases where either <code>&lt;rb&gt;</code>
fantasai@8498 1099 or <code>&lt;rtc&gt;</code> is used rigorously.
fantasai@8498 1100
fantasai@8497 1101 <pre>
fantasai@8498 1102 <!-- -->/* Parens around &lt;rtc> */
fantasai@8497 1103 <!-- -->rtc::before { content: "("; }
fantasai@8498 1104 <!-- -->rtc::after { content: ")"; }
fantasai@8497 1105
fantasai@8498 1106 <!-- -->/* Parens before first &lt;rt> not inside &lt;rtc> */
fantasai@8498 1107 <!-- -->rb + rt::before,
fantasai@8498 1108 <!-- -->rtc + rt::before { content: "("; }
fantasai@8497 1109
fantasai@8498 1110 <!-- -->/* Parens after &lt;rt> not inside &lt;rtc> */
fantasai@8498 1111 <!-- -->rb ~ rt:last-child::after,
fantasai@8498 1112 <!-- -->rt + rb::before { content: ")"; }
fantasai@8498 1113 <!-- -->rt + rtc::before { content: ")("; }</pre>
ishida@1665 1114
fantasai@8479 1115 <h2 id="glossary">
fantasai@8479 1116 Glossary</h2>
ishida@1665 1117 <dl>
ishida@1665 1118 <dt><a id="g-bopomofo"><strong><span
ishida@1665 1119 lang="zh">Bopomofo</span></strong></a></dt>
ishida@1665 1120 <dd>37 characters and 4 tone markings used as phonetics in Chinese,
ishida@1665 1121 especially standard Mandarin.</dd>
ishida@1665 1122 <dt><a id="g-hanja"><strong><span
ishida@1665 1123 lang="ko">Hanja</span></strong></a></dt>
ishida@1665 1124 <dd>Subset of the Korean writing system that utilizes ideographic
ishida@1665 1125 characters borrowed or adapted from the Chinese writing system. Also see
ishida@1665 1126 <a href="#g-kanji"><span lang="ja">Kanji</span></a>.</dd>
ishida@1665 1127 <dt><a id="g-hiragana"><strong><span
ishida@1665 1128 lang="ja">Hiragana</span></strong></a></dt>
ishida@1665 1129 <dd>Japanese syllabic script, or character of that script. Rounded and
ishida@1665 1130 cursive in appearance. Subset of the Japanese writing system, used together
ishida@1665 1131 with kanji and katakana. In recent times, mostly used to write Japanese
ishida@1665 1132 words when kanji are not available or appropriate, and word endings and
ishida@1665 1133 particles. Also see <a
ishida@1665 1134 href="#g-katakana"><span lang="ja">Katakana</span></a>.</dd>
ishida@1665 1135 <dt><a id="g-ideogram"><strong>Ideograph</strong></a></dt>
ishida@1665 1136 <dd>A character that is used to represent an idea, word, or word component,
ishida@1665 1137 in contrast to a character from an alphabetic or syllabic script. The most
ishida@1665 1138 well-known ideographic script is used (with some variation) in East Asia
ishida@1665 1139 (China, Japan, Korea,...).</dd>
ishida@1665 1140 <dt><a id="g-kana"><strong><span lang="ja">Kana</span></strong></a></dt>
ishida@1665 1141 <dd>Collective term for hiragana and katakana.</dd>
ishida@1665 1142 <dt><a id="g-kanji"><strong>Kanji</strong></a></dt>
ishida@1665 1143 <dd>Japanese term for ideographs; ideographs used in Japanese. Subset of the
ishida@1665 1144 Japanese writing system, used together with hiragana and katakana. Also see <a
ishida@1665 1145 href="#g-hanja"><span lang="ko">Hanja</span></a>.</dd>
ishida@1665 1146 <dt><a id="g-katakana"><strong><span
ishida@1665 1147 lang="ja">Katakana</span></strong></a></dt>
ishida@1665 1148 <dd>Japanese syllabic script, or character of that script. Angular in
ishida@1665 1149 appearance. Subset of the Japanese writing system,&nbsp; used together with
ishida@1665 1150 kanji and hiragana. In recent times, mainly used to write foreign words. Also see <a
ishida@1665 1151 href="#g-hiragana"><span lang="ja">Hiragana</span></a>.</dd>
ishida@1665 1152 <dt><a id="g-monoruby" name="g-monoruby"><strong>Mono-ruby</strong></a></dt>
ishida@1665 1153 <dd>In Japanese typography: Ruby associated with a single character of
ishida@1665 1154 the base text.</dd>
ishida@1665 1155 <dt><a id="g-ruby"><strong>Ruby</strong></a></dt>
ishida@1665 1156 <dd>A run of text that appears in the vicinity of another run of text and
ishida@1665 1157 serves as an annotation or a pronunciation guide for that text.</dd>
ishida@1665 1158 </dl>
ishida@1665 1159
fantasai@8479 1160 <h2 id="conformance">
fantasai@8479 1161 Conformance</h2>
fantasai@8479 1162
fantasai@8479 1163 <h3 id="conventions">
fantasai@8479 1164 Document conventions</h3>
fantasai@8479 1165
fantasai@8479 1166 <p>Conformance requirements are expressed with a combination of
fantasai@8479 1167 descriptive assertions and RFC 2119 terminology. The key words “MUST”,
fantasai@8479 1168 “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
fantasai@8479 1169 “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
fantasai@8479 1170 document are to be interpreted as described in RFC 2119.
fantasai@8479 1171 However, for readability, these words do not appear in all uppercase
fantasai@8479 1172 letters in this specification.
fantasai@8479 1173
fantasai@8479 1174 <p>All of the text of this specification is normative except sections
fantasai@8479 1175 explicitly marked as non-normative, examples, and notes. [[!RFC2119]]</p>
fantasai@8479 1176
fantasai@8479 1177 <p>Examples in this specification are introduced with the words “for example”
fantasai@8479 1178 or are set apart from the normative text with <code>class="example"</code>,
fantasai@8479 1179 like this:
fantasai@8479 1180
fantasai@8479 1181 <div class="example">
fantasai@8479 1182 <p>This is an example of an informative example.</p>
fantasai@8479 1183 </div>
fantasai@8479 1184
fantasai@8479 1185 <p>Informative notes begin with the word “Note” and are set apart from the
fantasai@8479 1186 normative text with <code>class="note"</code>, like this:
fantasai@8479 1187
fantasai@8479 1188 <p class="note">Note, this is an informative note.</p>
fantasai@8479 1189
fantasai@8479 1190 <h3 id="conformance-classes">
fantasai@8479 1191 Conformance classes</h3>
fantasai@8479 1192
fantasai@8479 1193 <p>Conformance to CSS Ruby Module
fantasai@8479 1194 is defined for three conformance classes:
fantasai@8479 1195 <dl>
fantasai@8479 1196 <dt><dfn title="style sheet!!as conformance class">style sheet</dfn>
fantasai@8479 1197 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
fantasai@8479 1198 style sheet</a>.
fantasai@8479 1199 <dt><dfn>renderer</dfn></dt>
fantasai@8479 1200 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
fantasai@8479 1201 that interprets the semantics of a style sheet and renders
fantasai@8479 1202 documents that use them.
fantasai@8479 1203 <dt><dfn id="authoring-tool">authoring tool</dfn></dt>
fantasai@8479 1204 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
fantasai@8479 1205 that writes a style sheet.
fantasai@8479 1206 </dl>
fantasai@8479 1207
fantasai@8479 1208 <p>A style sheet is conformant to CSS Ruby Module
fantasai@8479 1209 if all of its statements that use syntax defined in this module are valid
fantasai@8479 1210 according to the generic CSS grammar and the individual grammars of each
fantasai@8479 1211 feature defined in this module.
fantasai@8479 1212
fantasai@8479 1213 <p>A renderer is conformant to CSS Ruby Module
fantasai@8479 1214 if, in addition to interpreting the style sheet as defined by the
fantasai@8479 1215 appropriate specifications, it supports all the features defined
fantasai@8479 1216 by CSS Ruby Module by parsing them correctly
fantasai@8479 1217 and rendering the document accordingly. However, the inability of a
fantasai@8479 1218 UA to correctly render a document due to limitations of the device
fantasai@8479 1219 does not make the UA non-conformant. (For example, a UA is not
fantasai@8479 1220 required to render color on a monochrome monitor.)
fantasai@8479 1221
fantasai@8479 1222 <p>An authoring tool is conformant to CSS Ruby Module
fantasai@8479 1223 if it writes style sheets that are syntactically correct according to the
fantasai@8479 1224 generic CSS grammar and the individual grammars of each feature in
fantasai@8479 1225 this module, and meet all other conformance requirements of style sheets
fantasai@8479 1226 as described in this module.
fantasai@8479 1227
fantasai@8479 1228 <h3 id="partial">
fantasai@8479 1229 Partial implementations</h3>
fantasai@8479 1230
fantasai@8479 1231 <p>So that authors can exploit the forward-compatible parsing rules to
fantasai@8479 1232 assign fallback values, CSS renderers <strong>must</strong>
fantasai@8479 1233 treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore
fantasai@8479 1234 as appropriate</a>) any at-rules, properties, property values, keywords,
fantasai@8479 1235 and other syntactic constructs for which they have no usable level of
fantasai@8479 1236 support. In particular, user agents <strong>must not</strong> selectively
fantasai@8479 1237 ignore unsupported component values and honor supported values in a single
fantasai@8479 1238 multi-value property declaration: if any value is considered invalid
fantasai@8479 1239 (as unsupported values must be), CSS requires that the entire declaration
fantasai@8479 1240 be ignored.</p>
fantasai@8479 1241
fantasai@8479 1242 <h3 id="experimental">
fantasai@8479 1243 Experimental implementations</h3>
fantasai@8479 1244
fantasai@8479 1245 <p>To avoid clashes with future CSS features, the CSS2.1 specification
fantasai@8479 1246 reserves a <a href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
fantasai@8479 1247 syntax</a> for proprietary and experimental extensions to CSS.
fantasai@8479 1248
fantasai@8479 1249 <p>Prior to a specification reaching the Candidate Recommendation stage
fantasai@8479 1250 in the W3C process, all implementations of a CSS feature are considered
fantasai@8479 1251 experimental. The CSS Working Group recommends that implementations
fantasai@8479 1252 use a vendor-prefixed syntax for such features, including those in
fantasai@8479 1253 W3C Working Drafts. This avoids incompatibilities with future changes
fantasai@8479 1254 in the draft.
fantasai@8479 1255 </p>
fantasai@8479 1256
fantasai@8479 1257 <h3 id="testing">
fantasai@8479 1258 Non-experimental implementations</h3>
fantasai@8479 1259
fantasai@8479 1260 <p>Once a specification reaches the Candidate Recommendation stage,
fantasai@8479 1261 non-experimental implementations are possible, and implementors should
fantasai@8479 1262 release an unprefixed implementation of any CR-level feature they
fantasai@8479 1263 can demonstrate to be correctly implemented according to spec.
fantasai@8479 1264
fantasai@8479 1265 <p>To establish and maintain the interoperability of CSS across
fantasai@8479 1266 implementations, the CSS Working Group requests that non-experimental
fantasai@8479 1267 CSS renderers submit an implementation report (and, if necessary, the
fantasai@8479 1268 testcases used for that implementation report) to the W3C before
fantasai@8479 1269 releasing an unprefixed implementation of any CSS features. Testcases
fantasai@8479 1270 submitted to W3C are subject to review and correction by the CSS
fantasai@8479 1271 Working Group.
fantasai@8479 1272
fantasai@8479 1273 <p>Further information on submitting testcases and implementation reports
fantasai@8479 1274 can be found from on the CSS Working Group's website at
fantasai@8479 1275 <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
fantasai@8479 1276 Questions should be directed to the
fantasai@8479 1277 <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
fantasai@8479 1278 mailing list.
fantasai@8479 1279
fantasai@8479 1280 <h2 class=no-num id="acknowledgments">
fantasai@8479 1281 Acknowledgments</h2>
ishida@1665 1282
ishida@1665 1283 <p>This specification would not have been possible without the help from:</p>
ishida@1665 1284
fantasai@8479 1285 <p>Stephen Deach, Martin Dürst,  Hideki Hiura(<span lang="ja">樋浦 秀樹</span>), Masayasu Ishikawa(<span lang="ja">石川
ishida@1665 1286 雅康</span>), Chris
fantasai@8479 1287 Pratley, Takao Suzuki(<span lang="ja">鈴木 孝雄</span>), Frank Yung-Fong Tang, Chris Thrasher, Masafumi Yabe<span lang="ja">家辺
ishida@1665 1288 勝文</span>), Steve Zilles.</p>
ishida@1665 1289
fantasai@8479 1290 <h2 class=no-num id="references">
fantasai@8479 1291 References</h2>
ishida@1665 1292
fantasai@8479 1293 <h3 class="no-num" id="normative-references">
fantasai@8479 1294 Normative references</h3>
fantasai@8479 1295 <!--normative-->
ishida@1665 1296
fantasai@8479 1297 <h3 class="no-num" id="other-references">
fantasai@8479 1298 Other references</h3>
fantasai@8479 1299 <!--informative-->
ishida@1665 1300
fantasai@8479 1301 <h2 class="no-num" id="index">
fantasai@8479 1302 Index</h2>
fantasai@8479 1303 <!--index-->
ishida@1665 1304
fantasai@8479 1305 <h2 class="no-num" id="property-index">
fantasai@8479 1306 Property index</h2>
fantasai@8479 1307 <!-- properties -->
ishida@1665 1308
ishida@1665 1309 </body>
ishida@1665 1310 </html>
ishida@1665 1311 <!-- Keep this comment at the end of the file
ishida@1665 1312 Local variables:
ishida@1665 1313 mode: sgml
fantasai@8479 1314 sgml-declaration:"~/SGML/HTML4.decl"
ishida@1665 1315 sgml-default-doctype-name:"html"
ishida@1665 1316 sgml-minimize-attributes:t
ishida@1665 1317 sgml-nofill-elements:("pre" "style" "br")
fantasai@8479 1318 sgml-live-element-indicator:t
fantasai@8479 1319 sgml-omittag:nil
fantasai@8479 1320 sgml-shorttag:nil
fantasai@8479 1321 sgml-namecase-general:t
fantasai@8479 1322 sgml-general-insert-case:lower
fantasai@8479 1323 sgml-always-quote-attributes:t
fantasai@8479 1324 sgml-indent-step:nil
fantasai@8479 1325 sgml-indent-data:t
fantasai@8479 1326 sgml-parent-document:nil
fantasai@8479 1327 sgml-exposed-tags:nil
fantasai@8479 1328 sgml-local-catalogs:nil
fantasai@8479 1329 sgml-local-ecat-files:nil
ishida@1665 1330 End:
ishida@1665 1331 -->
fantasai@8479 1332

mercurial