css-ruby/Overview.src.html

Fri, 21 Jun 2013 16:19:24 -0700

author
fantasai <fantasai.cvs@inkedblade.net>
date
Fri, 21 Jun 2013 16:19:24 -0700
changeset 8533
e9426bf43628
parent 8527
47abcae337d2
child 8534
db340cae813c
permissions
-rw-r--r--

[css-ruby] Define line-breaking. Delete old text wrt line-stacking.

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

mercurial