css-ruby/Overview.src.html

Fri, 13 Sep 2013 15:24:38 -0700

author
fantasai <fantasai.cvs@inkedblade.net>
date
Fri, 13 Sep 2013 15:24:38 -0700
changeset 9177
dbc00077efcc
parent 9174
d0cb61f45f33
child 13469
86d51f1d4fa6
permissions
-rw-r--r--

[css-ruby] Remove issue text that's not particularly helpful...

     1 <!DOCTYPE html>
     2 <!--
     4 Issues:
     5 	bidi
     6 	box layout/sizing
     7 	clean up inter-character vs. parallel layout requirements
     9 Redo all examples with consistent font. (M+ 2p?)
    11 -->
    12 <html lang="en">
    13 <head>
    14 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    15 	<title>CSS Ruby Module Level 1</title>
    16 	<link rel=contents href="#contents">
    17 	<link rel=index href="#index">
    18 	<link rel="stylesheet" type="text/css" href="../default.css">
    19 	<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
    20 	<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css">
    21 </head>
    23 <body class="h-entry">
    25 <div class="head">
    26 <!--logo-->
    28 <h1 class="p-name">CSS Ruby Module Level 1</h1>
    30 <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>
    31 <dl>
    32 	<dt>This version:
    33 		<dd><a class="u-url" href="[VERSION]">[VERSION]</a>
    35 	<dt>Latest version:
    36 		<dd><a href="http://www.w3.org/TR/[SHORTNAME]/">http://www.w3.org/TR/css3-ruby/</a>
    38 	<dt>Editor's draft:
    39 		<dd><a href="http://dev.w3.org/csswg/[SHORTNAME]/">http://dev.w3.org/csswg/[SHORTNAME]/</a>
    40 		(<a href="https://dvcs.w3.org/hg/csswg/log/tip/[SHORTNAME]/Overview.src.html">change log</a>)
    42 	<dt>Previous version:
    43 		<dd><a href="http://www.w3.org/TR/2011/WD-css3-ruby-20110630/">
    44 		http://www.w3.org/TR/2011/WD-css3-ruby-20110630/</a>
    46 	<dt>Issue Tracking:</dt>
    47 		<dd><a rel="issues" href="http://www.w3.org/Style/CSS/Tracker/products/FIXME">http://www.w3.org/Style/CSS/Tracker/products/FIXME</a>
    49 	<dt>Feedback:</dt>
    50 		<dd><a href="mailto:www-style@w3.org?subject=%5BSHORTNAME%5D%20feedback"
    51 				 >www-style@w3.org</a> 
    52 				 with subject line &ldquo;<kbd>[[SHORTNAME]] 
    53 				 <var>&hellip; message topic &hellip;</var></kbd>&rdquo;
    54 				 (<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
    55 					 >archives</a>)
    57 	<dt>Editors:
    58 		<dd class="p-author h-card vcard">
    59 			<a class="p-name fn u-url url" rel="author"
    60 				 href="http://fantasai.inkedblade.net/contact">Elika J. Etemad</a>,
    61 			<a class="p-org org h-org" href="http://www.mozilla.org/">Mozilla</a>
    62 		<dd class="p-author h-card vcard">
    63 			<a class="p-name fn u-url url" rel="author"
    64 				 href="mailto:koji.a.ishii@mail.rakuten.com">Koji Ishii</a>,
    65 			<span class="p-org org">Rakuten, Inc.</span>
    66 		<dd class="p-author h-card vcard">
    67 			<a class="p-name fn u-url url" rel="author"
    68 				 href="mailto:ishida@w3.org">Richard Ishida</a>,
    69 			<span class="p-org org">W3C</span>
    71 	<dt>Former editors:
    72 		<dd>Michel Suignard, Microsoft
    73 		<dd>Marcin Sawicki, Microsoft
    74 </dl>
    76 <!--copyright-->
    78 <hr title="Separator for header">
    79 </div>
    81 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
    83 	<p>
    84 	<span class="p-summary">
    85 		“Ruby” are short runs of text alongside the base text,
    86 		typically used in East Asian documents to indicate pronunciation
    87 		or to provide a short annotation.
    88 		This module describes the rendering model and formatting controls
    89 		related to displaying ruby annotations in CSS.
    90 	</span>
    92 	<a href="http://www.w3.org/TR/CSS/">CSS</a> is a language for describing
    93 	the rendering of structured documents (such as HTML and XML) on screen, on
    94 	paper, in speech, etc.
    96 <h2 class="no-num no-toc" id="status">Status of this document</h2>
    98 <!--status-->
   100 <p>The following features are at risk: &hellip;
   102 <h2 class="no-num no-toc" id="contents">
   103 Table of Contents</h2>
   105 <!--toc-->
   107 <h2 id="intro">
   108 Introduction</h2>
   110 	<p><em>This section is not normative.</em>
   112 <h3 id="placement">
   113 Module interactions</h3>
   115 	<p>This module extends the inline box model of CSS Level 2 [[!CSS21]]
   116 	to support ruby.
   118 	<p>None of the properties in this module apply to the <code>::first-line</code> or
   119 	<code>::first-letter</code> pseudo-elements.
   121 <h3 id="values">
   122 Values</h3>
   124 	<p>This specification follows the
   125 	<a href="http://www.w3.org/TR/CSS21/about.html#property-defs">CSS property
   126 	definition conventions</a> from [[!CSS21]]. Value types not defined in
   127 	this specification are defined in CSS Level 2 Revision 1 [[!CSS21]].
   128 	Other CSS modules may expand the definitions of these value types: for
   129 	example [[CSS3VAL]], when combined with this module, expands the
   130 	definition of the <var>&lt;length&gt;</var> value type as used in this specification.</p>
   132 	<p>In addition to the property-specific values listed in their definitions,
   133 	all properties defined in this specification also accept the
   134 	<a href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">inherit</a>
   135 	keyword as their property value. For readability it has not been repeated
   136 	explicitly.
   138 <h3 id="diagram-conventions">
   139 Diagram conventions</h3>
   141 	<p>Many typographical conventions in East Asian typography depend
   142 	on whether the character rendered is wide (CJK) or narrow (non-CJK).
   143 	There are a number of illustrations in this document
   144 	for which the following legend is used:
   146 	<dl>
   147 		<dt><img alt="Symbolic wide-cell glyph representation" width="39" height="39" src="images/fullwidth.gif">
   148 		<dd>Wide-cell glyph (e.g. Han) that is the <var>n</var>th character in the text run.
   149 		They are typically sized to 50% when used as annotations.
   150 		<dt><img alt="Symbolic narrow-cell glyph representation" width="19" height="39" src="images/halfwidth.gif">
   151 		<dd>Narrow-cell glyph (e.g. Roman) which is the <var>n</var>th glyph in the text run.
   152 	</dl>
   154 	<p>The orientation which the above symbols assume in the diagrams
   155 	corresponds to the orientation that the glyphs they represent
   156 	are intended to assume when rendered by the user agent.
   157 	Spacing between these characters in the diagrams is incidental,
   158 	unless intentionally changed to make a point.
   160 <h3 id="ruby-def">
   161 What is ruby?</h3>
   163 	<p><dfn>Ruby</dfn> is the commonly-used name for a run of text
   164 	that appears alongside another run of text (referred to as the “base”)
   165 	and serves as an annotation or a pronunciation guide associated with that run of text.
   167 	<p>The following figures show two examples of Ruby,
   168 	a simple case and one with more complicated structure.
   170 	<div class="example">
   171 		<p>In this first example, a single annotation is used to annotate the base text.
   172 		<div class="figure">
   173 			<p><img src="images/licence.png"
   174 			        alt="Example of ruby applied on top of a Japanese expression">
   175 			<p class="caption">Example of ruby used in Japanese (simple case)
   176 		</div>
   177 		<p>In Japanese typography, this case is sometimes called
   178 		<i lang="ja">taigo</i> ruby or group-ruby (per-word ruby),
   179 		because the annotation as a whole is associated
   180 		with multi-character word (as a whole).
   181 	</div>
   183 	<div class="example">
   184 		<p>In this second example,
   185 		two levels of annotations are attached to a base sequence:
   186 		the hiragana characters on top refer to the pronunciation of each of the base kanji characters,
   187 		while the words “Keio” and “University” on the bottom are annotations describing the English translation.
   188 		<div class="figure">
   189 			<p><img src="images/ruby-univ.gif"
   190 			        alt="Example showing complex ruby with annotation text over and under the base characters">
   191 			<p class="caption">Complex ruby with annotation text over and under the base characters
   192 		</div>
   193 		<p>
   194 		<p>Notice that to allow correct association between the hiragana characters and 
   195 		their corresponding Kanji base characters,
   196 		the spacing between these Kanji characters is adjusted.
   197 		(This happens around the fourth Kanji character in the figure above.)
   198 		To avoid variable spacing between the Kanji characters in the example above
   199 		the hiragana annotations can be styled as a <i>collapsed annotation</i>,
   200 		which will look more like the group-ruby example earlier.
   201 		However because the base-annotation pairings are recorded in the ruby structure,
   202 		if the text breaks across lines, the annotation characters will stay
   203 		correctly paired with their respective base characters.
   204 	</div>
   206 	<p><i>Ruby</i> formatting as used in Japanese is described in JIS X-4051 [[JIS4051]] (in Japanese)
   207 	and in Requirements for Japanese Text Layout [[JLREQ]] (in English and Japanese)].
   208 	In HTML, ruby structure and markup to represent it is described
   209 	in the Ruby Markup Extension specification.
   210 	This module describes the CSS rendering model
   211 	and formatting controls relevant to ruby layout of such markup.
   213 <h2 id="ruby-model">
   214 Ruby Formatting Model</h2>
   216 	<p>The CSS ruby model is based on
   217 	the <a href="http://darobin.github.io/html-ruby/">HTML Ruby Markup Extension</a>
   218 	and <a href="http://www.w3.org/TR/ruby/">XHTML Ruby Annotation Recommendation</a> [[RUBY]].
   219 	In this model, a ruby structure consists of
   220 	one or more <dfn>ruby base</dfn> elements representing the base (annotated) text,
   221 	associated with one or more levels of <dfn>ruby annotation</dfn> elements representing the annotations.
   222 	The structure of ruby is similar to that of a table:
   223 	there are “rows” (the base text level, each annotation level)
   224 	and “columns” (each <i>ruby base</i> and its corresponding <i>ruby annotations</i>).
   226 	<p>Consecutive bases and annotations are grouped together into <dfn>ruby segments</dfn>.
   227 	Within a <i>ruby segment</i>, a <i>ruby annotation</i> may span multiple <i>ruby bases</i>.
   229 	<p class="note">In HTML, a single <code>&lt;ruby&gt;</code> element may contain multiple <i>ruby segments</i>.
   230 	(In the XHTML Ruby model, a single <code>&lt;ruby&gt;</code> element can only contain one <i>ruby segment</i>.)
   232 <h3 id="ruby-display">
   233 Ruby-specific 'display' property values</h3>
   235 	<p>For document languages (such as XML applications) that do not have pre-defined ruby elements,
   236 	authors must map document language elements to ruby elements;
   237 	this is done with the 'display' property.
   239 	<table class="propdef">
   240 		<tr>
   241 			<th>Name:
   242 			<td>display
   243 		<tr>
   244 			<th><a href="#values">New Values</a>:
   245 			<td>ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container
   246 	</table>
   248 	<p>The following new 'display' values assign ruby layout roles to an arbitrary element:
   250 	<dl>
   251 		<dt>''ruby''
   252 			<dd>Specifies that an element generates a <dfn title="ruby container | ruby container box">ruby container box</dfn>.
   253 			(Corresponds to HTML/XHTML <code>&lt;ruby&gt;</code> elements.)
   254 		<dt>''ruby-base''
   255 			<dd>Specifies that an element generates a <dfn title="ruby base box | ruby base">ruby base box</dfn>.
   256 			(Corresponds to HTML/XHTML <code>&lt;rb&gt;</code> elements.)
   257 		<dt>''ruby-text''
   258 			<dd>Specifies that an element generates a <dfn title="ruby annotation box | ruby annotation">ruby annotation box</dfn>.
   259 			(Corresponds to HTML/XHTML <code>&lt;rt&gt;</code> elements.)
   260 		<dt>''ruby-base-container''
   261 			<dd>Specifies that an element generates a <dfn title="ruby base container box | ruby base container">ruby base container box</dfn>.
   262 			(Corresponds to XHTML <code>&lt;rbc&gt;</code> elements; always implied in HTML.)
   263 		<dt>''ruby-text-container''
   264 			<dd>Specifies that an element generates a <dfn title="ruby annotation container box | ruby annotation container">ruby annotation container box</dfn>.
   265 			(Corresponds to HTML/XHTML <code>&lt;ruby&gt;</code> elements.)
   266 	</dl>
   268 <h3 id="box-fixup">
   269 Anonymous Ruby Box Generation</h3>
   271 	<p>The CSS model does not require that the document language
   272 	include elements that correspond to each of these components.
   273 	Missing parts of the structure are implied through the anonymous box generation rules
   274 	<a href="http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes">similar to those used to normalize tables</a>. [[!CSS21]]
   276 	<ol>
   277 		<li>Any in-flow block-level boxes directly contained by a
   278 		<i>ruby container</i>,
   279 		<i>ruby base container</i>,
   280 		<i>ruby annotation container</i>,
   281 		<i>ruby base box</i>,
   282 		or <i>ruby annotation box</i>
   283 		are forced to be inline-level boxes,
   284 		and their 'display' value computed accordingly.
   285 		For example,
   286 		the 'display' property of an in-flow element with ''display: block''
   287 		parented by an element with ''display: ruby-text''
   288 		computes to ''inline-block''.
   289 		This computation occurs after any intermediary anonymous-box fixup
   290 		(such as that required by internal table elements).
   292 		<li>Any consecutive sequence of <i>ruby bases</i> not parented by a <i>ruby base container</i>
   293 		is wrapped in an anonymous <i>ruby base container</i>.
   294 		Similarly, any consecutive sequence of <i>ruby annotations</i> not parented by a <i>ruby annotation container</i>
   295 		is wrapped in an anonymous <i>ruby annotation container</i>.
   297 		<li>Within each <i>ruby base container</i>,
   298 		each sequence of inline-level boxes is wrapped in an anonymous <i>ruby base box</i>.
   299 		Similarly, within each <i>ruby annotation container</i>,
   300 		each sequence of inline-level boxes is wrapped in an anonymous <i>ruby annotation box</i>.
   302 		<li>A sequence of <i>ruby base containers</i> and/or <i>ruby annotation containers</i>
   303 		not parented by a <i>ruby container</i>
   304 		is wrapped in an anonymous <i>ruby container</i>.
   305 	</ol>
   307 	<p>At this point, all ruby layout structures are properly parented,
   308 	and the UA can start to associate bases with their annotations.
   310 	<p class="note">
   311 	Note that the UA is not required to create any of these anonymous boxes in its internal structures,
   312 	as long as pairing and layout behaves as if they existed.
   314 <h3 id="pairing">
   315 Ruby Pairing and Annotation Levels</h3>
   317 	<p>Within a ruby structure,
   318 	each <i>ruby base</i> is associated with <i>ruby annotations</i>
   319 	and vice versa.
   320 	A <i>ruby base</i> can be associated with at most one <i>ruby annotation</i> per annotation level.
   321 	If there are multiple annotation levels, it can therefore be associated with multiple <i>ruby annotations</i>.
   322 	A <i>ruby annotation</i> is associated with one or more <i>ruby bases</i>;
   323 	annotations can span multiple bases.
   325 	<p><dfn>Annotation pairing</dfn> is the process of associating
   326 	<i>ruby annotations</i> with <i>ruby bases</i>.
   328 	<ol>
   329 		<li>
   330 		<p>First, the ruby structure is divided into <i>ruby segments</i>,
   331 		each consisting of a single <i>ruby base container</i>
   332 		followed by one or more <i>ruby annotation containers</i>.
   333 		If the first child of a <i>ruby container</i> is a <i>ruby annotation container</i>,
   334 		an anonymous, empty <i>ruby base container</i> is assumed to exist before it.
   335 		Similarly, if the <i>ruby container</i> contains consecutive <i>ruby base containers</i>,
   336 		anonymous, empty <i>ruby annotation containers</i> are assumed to exist between them.
   337 		The <i>ruby base container</i> in each segment is thus associated
   338 		with each of the <i>ruby annotation containers</i> in that segment.
   340 		<p>Each <i>ruby annotation containers</i> in a <i>ruby segment</i>
   341 		represents one <dfn title="annotation level | level">level</dfn> of annotation:
   342 		the first one represents the first level of annotation,
   343 		the second one represents the second level of annotation,
   344 		and so on.
   346 		<li>Within each <i>ruby segment</i>,
   347 		each <i>ruby base box</i> in the <i>ruby base container</i>
   348 		is paired with one <i>ruby annotation box</i>
   349 		from each <i>ruby annotation container</i> in its <i>ruby segment</i>.
   350 		If there are not enough <i>ruby annotations</i> in a <i>ruby annotation container</i>,
   351 		the last one is associated with any excess <i>ruby bases</i>.
   352 		(If there are not any in the <i>ruby annotation container</i>, an anonymous empty one is assumed to exist.)
   353 		If there are not enough <i>ruby bases</i>,
   354 		any remaining <i>ruby annotations</i> are assumed to be associated
   355 		with empty, anonymous bases inserted at the end of the <i>ruby base container</i>.
   357 		<p>If an implementation supports ruby markup with explicit spanning
   358 		(e.g. XHTML Complex Ruby Annotations),
   359 		it must adjust the pairing rules to pair spanning annotations to multiple bases
   360 		appropriately.
   361 	</ol>
   363 	<p>A this point, ruby “columns” are defined,
   364 	each represented by a single <i>ruby base</i>
   365 	and associated with one <i>ruby annotation</i> (possibly an empty, anonymous one)
   366 	from each <i>annotation level</i>.
   368 <h4 id="nested-pairing">
   369 Nested Ruby</h4>
   371 	<p>When <i>ruby containers</i> are nested,
   372 	pairing begins with the deepest <i>ruby container</i>,
   373 	then expands out,
   374 	treating each <i>ruby container</i> nested within another <i>ruby container</i>
   375 	essentially as a single <i>ruby base</i> in the outer <i>ruby container</i>,
   376 	and associating each <i>ruby annotation</i>
   377 	paired with the nested <i>ruby container</i>
   378 	as being associated with (spanning) all of its <i>ruby bases</i>.
   380 	<p>Using nested <i>ruby containers</i> thus allows the representation
   381 	of complex spanning relationships.
   383 	<p class="issue">This has to be Level 1 because HTML5 allows it, so we have to handle it. Yay HTML5.
   385 <h3 id="autohide">
   386 Autohiding Annotations</h3>
   388 	<p>If a <i>ruby annotation</i> has the exact same text content as its base,
   389 	it is <dfn title="hidden ruby annotation | hidden annotation">hidden</dfn>.
   390 	Hiding a <i>ruby annotation</i> does not affect annotation pairing
   391 	or the block-axis positioning of boxes in other <i>levels</i>.
   392 	However the <i>hidden annotation</i> is not visible,
   393 	and it has no impact on layout
   394 	other than to separate adjacent sequences of <i>ruby annotation boxes</i> within its level,
   395 	as if they belonged to separate segments
   396 	and the <i>hidden annotation</i>’s base were not a <i>ruby base</i> but an intervening inline.
   398 	<div class="example">
   399 		<p>This is to allow correct inlined display of annotations
   400 		for Japanese words that are a mix of kanji and hirangana.
   401 		For example, the word <i>振り仮名</i> should be inlined as
   402 		<p class="figure">振り仮名(ふりがな)
   403 		<p>and therefore marked up as
   404 		<pre>
   405 <!--		-->&lt;ruby>
   406 <!--		-->  &lt;rb>振&lt;/rb>&lt;rb>り&lt;/rb>&lt;rb>仮&lt;/rb>&lt;rb>名&lt;/rb>
   407 <!--		-->  &lt;rp>(&lt;/rp>&lt;rt>ふ&lt;/rt>&lt;rt>り&lt;/rt>&lt;rt>が&lt;/rt>&lt;rt>な&lt;/rt>&lt;rp>)&lt;/rp>
   408 <!--		-->&lt;ruby></pre>
   409 		<p>However, when displayed as ruby, the “り” should be hidden
   410 		<div class="figure">
   411 			<p><img src="images/furigana-separate.png"
   412 			        alt="Hiragana annotations for 振り仮名 appear, each above its base character.">
   413 			<p class="caption">Hiragana ruby for 振り仮名
   414 		</div>
   415 	</div>
   417 	<p class="note">
   418 		Future levels of CSS Ruby may add controls for this,
   419 		but in this level it is always forced.
   421 	<p>The content comparison for this auto-hiding behavior
   422 	takes place prior to white space collapsing
   423 	and ignores elements (considers only the <code>textContent</code> of the boxes).
   424 	<p class="issue">Is before or after white space collapsing easier? We should do whatever is easier, as it really doesn't matter much which way to go.
   426 <h3 id="white-space">
   427 White Space</h3>
   429 	<p><i>Collapsible</i> white space within a ruby structure is discarded
   430 	<ul>
   431 		<li>at the beginning and end of a <i>ruby container</i>, <i>ruby annotation container</i>, or <i>ruby base container</i>,
   432 		<li>at the beginning/end of a <i>ruby annotation box</i> or <i>ruby base box</i> if white space is not its only contents,
   433 		<li>between a <i>ruby base container</i> and its following <i>ruby annotation container</i>,
   434 		<li>between <i>ruby annotation containers</i>.
   435 	</ul>
   437 	<p>Between <i>ruby segments</i>, between <i>ruby bases</i>, and between <i>ruby annotations</i>, however,
   438 	white space is not discarded.
   440 	<p>Where undiscarded white space is <i>collapsible</i>, it will collapse
   441 	following the standard <a href="http://www.w3.org/TR/css3-text/#white-space-rules">white space processing rules</a>. [[!CSS3TEXT]]
   442 	For <i>collapsible</i> white space between <i>ruby segments</i>, however,
   443 	the contextual text for determining collapsing behavior is given by the <i>ruby bases</i> on either side,
   444 	not the text on either side of the white space in the source document.
   446 	<div class="note">
   447 		<p>Note that the white space processing rules
   448 		cause a white space sequence containing a <i>segment break</i> (such as a line feed)
   449 		to <a href="http://www.w3.org/TR/css3-text/#line-break-transform">collapse to nothing</a> between CJK characters.
   450 		This means that CJK ruby can safely use white space for indentation of the ruby markup.
   451 		For example, the following markup will display without any spaces:
   452 		<pre>
   453 <!--		-->&lt;ruby>
   454 <!--		-->  &lt;rb>東&lt;/rb>&lt;rb>京&lt;/rb>
   455 <!--		-->  &lt;rt>とう&lt;/rt>&lt;rt>きょう&lt;/rt>
   456 <!--		-->&lt;/ruby></pre>
   457 		<p>However, white space that does not contain a <i>segment break</i> does not collapse completely away,
   458 		so this markup will display with a space between the first and second ruby pairs:
   459 		<pre>
   460 <!--		-->&lt;ruby>
   461 <!--		-->  &lt;rb>東&lt;/rb>	&lt;rb>京&lt;/rb>
   462 <!--		-->  &lt;rt>とう&lt;/rt>	&lt;rt>きょう&lt;/rt>
   463 <!--		-->&lt;/ruby></pre>
   464 	</div>
   466 	<p>Any preserved white space is then wrapped in an anonymous box belonging to
   467 	the <i>ruby base container</i> (if between <i>ruby bases</i>),
   468 	<i>ruby annotation container</i> (if between <i>ruby annotations</i>),
   469 	or <i>ruby container</i> (if between <i>ruby segments</i>).
   470 	In the latter case, the text is considered part of the <i>base level</i>.
   471 	Such anonynmous boxes do not take part in pairing.
   472 	They merely ensure separation between adjacent bases/annotations.
   474 	<p class="issue">Specify how these anonymous white space boxes impact layout.
   476 	<div class="example">
   477 		<p>These rules allow ruby to be used with space-separated scripts such as Latin.
   478 		For example,
   479 		<pre>
   480 <!--		-->&lt;ruby>
   481 <!--		-->  &lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>
   482 <!--		-->  &lt;rt>World&lt;/rt> &lt;rt>Wide&lt;/rt> &lt;rt>Web&lt;/rt>
   483 <!--		-->&lt;/ruby></pre>
   484 		<p>They also ensure that annotated white space is preserved. For example,
   485 		<pre>
   486 <!--		-->&lt;ruby>
   487 <!--		-->  &lt;rb>Aerith&lt;/rb>&lt;rb> &lt;/rb>&lt;rb>Gainsboro&lt;/rb>
   488 <!--		-->  &lt;rt>エアリス&lt;/rt>&lt;rt>・&lt;/rt>&lt;rt>ゲインズブール&lt;/rt>
   489 <!--		-->&lt;/ruby></pre>
   490 	</div>
   492 <h3 id="ruby-layout">
   493 Ruby layout</h3>
   495 	<p>When a ruby structure is laid out,
   496 	its base level is laid out on the line,
   497 	aligned according to its 'vertical-align' property
   498 	exactly as if its <i>bases</i> were a regular sequence of <i>inline</i> boxes.
   499 	Each <i>ruby base container</i> is sized and positioned
   500 	to contain exactly the full height of its <i>ruby bases</i>.
   502 	<p><i>Ruby annotations</i> associated with the base level
   503 	are then positioned with respect to their <i>ruby base boxes</i>
   504 	according to the applicable 'ruby-position' values.
   505 	<i>Ruby annotations</i> within a level (within a single <i>ruby container</i>)
   506 	are aligned to each other as if they were inline boxes
   507 	participating in the same inline formatting context.
   508 	Each <i>ruby annotation container</i> is sized and positioned
   509 	to contain exactly the full height of its <i>ruby annotations</i>.
   511 	<p>A ruby container (or fragment thereof)
   512 	measures as wide as the content of its widest level.
   513 	Similarly, <i>ruby base boxes</i> and <i>ruby annotation boxes</i>
   514 	within a ruby “column” have the measure of the widest content in that “column”.
   515 	In the case of spanning <i>annotations</i>
   516 	(whether actually spanning or pretending to span per 'ruby-collapse'),
   517 	the measures of the <i>ruby annotation box</i> and
   518 	the sum of its associated <i>ruby base boxes</i> must match.
   520 	<p>How the extra space is distributed
   521 	when ruby content is narrower than the measure of its box
   522 	is specified by the 'ruby-align' property.
   524 <h4 id="inter-character-layout">
   525 Inter-character ruby layout</h4>
   527 	<p>Inter-character annotations have special layout.
   528 	When 'ruby-position' indicates ''inter-character'' annotations,
   529 	the affected <i>annotation boxes</i>
   530 	are spliced into and measured as part of the layout of the base level.
   531 	The <i>ruby base container</i> must be sized to include both the <i>base boxes</i>
   532 	as well as the ''inter-character'' <i>annotation boxes</i>.
   533 	The affected <i>ruby annotation container</i> is similarly sized
   534 	so that its content box coincides with that of the <i>ruby base container</i>.
   536 	<p>For the purpose of laying out other levels of annotations,
   537 	an ''inter-character'' annotation effectively becomes part of its base.
   538 	<span class="issue">Or should it become a quasi-base between two bases?</span>
   539 	A spanning ''inter-character'' annotation is placed after
   540 	all the bases that it spans.
   542 <h3 id="box-style">
   543 Styling Ruby Boxes</h3>
   545 	<p>In most respects, ruby boxes can be styled similar to inline boxes.
   546 	However, the UA is not required to support
   547 	any of the box properties (borders, margins, padding),
   548 	any of the background properties or outline properties,
   549 	or any other property that illustrates the bounds of the box
   550 	on <i>ruby base container boxes</i>, <i>ruby annotation container boxes</i>,
   551 	or <a href="#nested-pairing">ruby-internal <i>ruby container boxes</i></a>.
   552 	The UA may implement these boxes simply as abstractions for inheritance
   553 	and control over the layout of their contents.
   555 <h3 id="line-breaks">
   556 Ruby box and line breaking</h3>
   558 	<p>When there is not enough space for an entire <i>ruby container</i> to fit on the line,
   559 	the ruby may be broken wherever all levels simultaneously allow a break.
   560 	Ruby most often breaks between base-annotation sets,
   561 	but if the line-breaking rules allow it, can also break within a <i>ruby base</i>
   562 	(and, in parallel, its associated <i>annotation boxes</i>).
   564 	<p>Whenever ruby breaks across lines, <i>ruby annotations</i> must stay
   565 	with their respective <i>bases</i>.
   566 	The line <em>must not</em> break between a <i>ruby base</i> and its <i>annotations</i>,
   567 	even in the case of ''inter-character'' <i>annotations</i>.
   569 	<div class="figure">
   570 		<img src="images/r-break-b.gif"
   571 		     alt='Diagram showing the line breaking opportunity in a "Bopomofo" ruby'>
   572 		<p class="caption">''inter-character'' ruby line breaking opportunity
   573 	</div>
   575 <h4 id="break-between">
   576 Breaking between bases</h4>
   578 	<p>In typical cases, <i>ruby base boxes</i> and <i>ruby annotation boxes</i>
   579 	are styled to forbid internal line wrapping and do not contain forced breaks.
   580 	(See <a href="#default-stylesheet">Appendix A</a>.)
   581 	In such cases the <i>ruby container</i> can only break between adjacent <i>ruby bases</i>,
   582 	and only if no <i>ruby annotations</i> span those <i>ruby bases</i>.
   584 	<div class="figure">
   585 		<p><img src="images/r-break-a.gif"
   586 		     alt="Diagram showing the line breaking opportunity in a complex ruby">
   587 		<p class="caption">Ruby line breaking opportunity
   588 	</div>
   590 	<p>Whether ruby can break between two adjacent <i>ruby bases</i>
   591 	is controlled by normal line-breaking rules for the base text,
   592 	exactly as if the <i>ruby bases</i> were adjacent <i>inline</i> boxes.
   593 	(The annotations are ignored when determining soft wrap opportunities for the base level.)
   595 	<div class="example">
   596 		<p>For example, if two adjacent ruby bases are “蝴” and “蝶”,
   597 		the line may break between them,
   598 		because lines are normally allowed to break between two Han characters.
   599 		However, if 'word-break' is ''keep-all'', that line break is forbidden.
   600 		<pre>&lt;ruby>蝴&lt;rt>hú&lt;/rt>蝶&lt;rt>dié&lt;/rt></pre>
   601 	</div>
   603 	<p>Inter-base white space is significant for evaluating line break opportunities between <i>ruby bases</i>.
   604 	As with white space between inlines, it collapses when the line breaks there.
   605 	Similarly, annotation white space is also trimmed at a line break.
   607 	<div class="example">
   608 		<p>For example, given the following markup:
   609 		<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>
   610 		<p>Due to the space, the line may break between “one” and “two“.
   611 		If the line breaks there, that space&mdash;and the space between “1” and “2”&mdash;disappears,
   612 		in accordance with standard CSS white space processing rules. [[CSS3TEXT]]
   613 	</div>
   615 <h4 id="break-within">
   616 Breaking within bases</h4>
   618 	<p>For longer base texts, it is sometimes appropriate to allow breaking within a base-annotation pair.
   619 	For example, if an English sentence is annotated with its Japanese translation,
   620 	allowing the text to wrap allows for reasonable line breaking behavior in the paragraph.
   622 	<p class="issue">
   623 	Insert scanned example so people don't think this is just the ramblings of an insane spec-writer.
   625 	<p>Line-breaking within a <i>ruby base</i> is only allowed if the 'white-space' property
   626 	of the <i>ruby base</i> and all its parallel <i>annotations</i> allow it,
   627 	and there exists a <i>soft wrap opportunity</i> <em>within</em> (i.e. not at the start or end)
   628 	the content of each base/annotation box.
   629 	Since there is no structural correspondance between fragments of content
   630 	within <i>ruby bases</i> and <i>annotations</i>,
   631 	the UA may break at any set of opportunities;
   632 	but it is recommended that the UA attempt to proportionally balance
   633 	the amount of content inside each fragment.
   635 	<p>There are no line breaking opportunities within ''inter-character'' <i>annotations</i>.
   637 	<p>Ruby alignment takes place within each fragment, after line-breaking.
   639 <h3 id="ruby-bidi">
   640 Bidi Reordering</h3>
   642 	<p class="issue">
   643 	Constraints:
   644 	Text within a ruby base must remain contiguous,
   645 	and bases belonging to a single annotation must remain contiguous.
   646 	Still figuring out exactly to enforce these limitations in a sensible manner.
   648 <!--
   650 	<p>The Unicode bidirectional algorithm orders logically-stored text for visual presentation
   651 	when characters from scripts of opposing directionalities are mixed
   652 	within a single paragraph.
   653 	(See [[CSS3-WRITING-MODES]] for a more in-depth discussion of bidirectional text in CSS.)
   654 	Bidi reordering of ruby-annotation pairs is controlled by the ordering of the base text, as follows:
   656 <h4 id="bidi-B">Proposal A</h4>
   658 	<p class="note">This proposal is simpler, but will require more frequent tagging of mixed-directionality content.
   660 	<p>To avoid the interference of the <i>annotations</i> in the ordering of base text,
   661 	all annotations are ignored for the purpose of resolving neutral characters in the base level.
   663 	<p>To preserve the correspondance of <i>ruby annotations</i>
   664 	to their respective <i>ruby bases</i>,
   665 	a few restrictions are imposed:
   666 	<ul>
   667 		<li>The contents of a <i>ruby base</i> or <i>ruby annotation</i> must remain contiguous.
   668 			To this end, the contents of each <i>ruby base</i> and <i>ruby annotation</i> are treated as if within a <i>bidi isolation</i>.
   669 		<li>For the purpose of ordering <i>ruby bases</i> within a <i>ruby container</i>,
   670 			each <i>ruby base</i> is treated as a strong character of its specified 'direction'.
   671 			(<i>Ruby annotations</i> are positioned with respect to their <i>bases</i>,
   672 			so are affected by reordering, but do not themselves participate in reordering.)
   673 		<li>All <i>bases</i> spanned by a single <i>annotation</i> must remain contiguous.
   674 			To this end, the embedding level of all bases spanned by a spanning <i>annotation</i>
   675 			is increased by two prior to reordering.
   676 	</ul>
   678 <h4 id="bidi-B">Proposal B</h4>
   680 	<p class="note">This preserves some aspects of implicit bidi.
   681 	For example, annotating each half of "first-second" would not cause the word to reverse itself to "second-first" within an opposite-order paragraph.
   683 	<p>To avoid the interference of the <i>annotations</i> in the ordering of the base text,
   684 	all annotations are ignored for the purpose of resolving neutral characters in the base text;
   685 	and the base text is resolved exactly as if each <i>ruby base</i> were
   686 	just a normal <i>inline box</i> embedded in the <i>ruby container</i>'s inline formatting context.
   688 	<p>Furthermore, to preserve the correspondance of <i>ruby annotations</i>
   689 	to their respective <i>ruby bases</i>,
   690 	a few restrictions are imposed:
   691 	<ul>
   692 		<li>The contents of a <i>ruby base</i> must remain contiguous.
   693 		<li>All <i>bases</i> spanned by a single <i>annotation</i> must remain contiguous.
   694 	</ul>
   695 	<p>To this end, the text of <i>ruby base</i> boxes that are not <i>bidi-isolated</i>
   696 	must have its embedding level increased by two;
   697 	and if an <i>annotation</i> spans more than one <i>ruby base</i>,
   698 	the spanned text's embedding level
   699 	(or the embedding level assigned to the isolation, if the <i>ruby base</i> is <i>bidi-isolated</i>)
   700 	is further increased by two.
   702 -->
   704 <h3 id="line-height">
   705 Ruby box and line stacking</h3>
   707 	<p>The 'line-height' property controls spacing between lines in CSS.
   708 	When inline content on line is shorter than the 'line-height',
   709 	half-leading is added on either side of the content,
   710 	as specificed in <a href="http://www.w3.org/TR/CSS21/visudet.html#line-height">CSS2.1&sect;10.8</a>. [[!CSS21]]
   712 	<p>In order to ensure consistent spacing of lines,
   713 	documents with ruby typically ensure that the 'line-height' is large enough
   714 	to accommodate ruby between lines of text.
   715 	Therefore, ordinarily, <i>ruby annotation containers</i> and <i>ruby annotation boxes</i>
   716 	do not contribute to the measured height of a line's inline contents;
   717 	any alignment (see 'vertical-align') and line-height calculations
   718 	are performed using only the <i>ruby base container</i>,
   719 	exactly as if it were a normal inline.
   721 	<p>However, if the 'line-height' specified on the <i>ruby container</i>
   722 	is less than the distance between
   723 	the top of the top <i>ruby annotation container</i>
   724 	and the bottom of the bottom <i>ruby annotation container</i>,
   725 	then additional leading is added
   726 	on the appropriate side of the <i>ruby base container</i>
   727 	such that if a block consisted of three lines
   728 	each containing ruby identical to this,
   729 	none of the <i>ruby containers</i> would overlap.
   731 	<p class="note">Note that this does not ensure that the <i>ruby annotations</i> remain within the line box.
   732 	It merely ensures that <em>if all lines had equal spacing</em>
   733 	and equivalent amounts and positioning of <i>ruby annotations</i>,
   734 	there would be enough room to avoid overlap.
   736 	<p>Authors should ensure appropriate 'line-height' and 'padding' to accommodate ruby,
   737 	and be particularly careful at the beginning or end of a block
   738 	and when a line contains inline-level content
   739 	(such as images, inline blocks, or elements shifted with 'vertical-align')
   740 	taller than the paragraph's default font size.
   742 	<div class="figure">
   743 		<p><img src="images/rlh-a.gif"
   744 		        alt="The content of each line sits in the middle of its line height;
   745 		             the additional space on each side is called half-leading.
   746 		             Ruby fits between lines if it is smaller than twice the half-leading,
   747 		             but this means that it occupies space belonging to the half-leading of the previous line.">
   748 		<p class="caption">Ruby annotations will often overflow the line;
   749 		authors should ensure content over/under a ruby-annotated line
   750 		is adequately spaced to leave room for the ruby.
   751 	</div>
   753 	<p class="note">More control over how ruby affects alignment and line layout
   754 	will be part of the CSS Line Layout Module Level 3.
   755 	Note, it is currently in the process of being rewritten;
   756 	the current drafts should not be relied upon.
   758 <h2 id="ruby-props">
   759 Ruby Properties</h2>
   761 	<p>The following properties are introduced to control ruby positioning and alignment.
   763 <h3 id="rubypos">
   764 Ruby positioning: the 'ruby-position' property</h3>
   766 	<table class="propdef">
   767 		<tr>
   768 			<th>Name:
   769 			<td><dfn>ruby-position</dfn>
   770 		<tr>
   771 			<th><a href="#values">Value</a>:
   772 			<td>[ over | under | inter-character ] && [ right | left ]
   773 		<tr>
   774 			<th>Initial:
   775 			<td>over right
   776 		<tr>
   777 			<th>Applies to:
   778 			<td>ruby annotation containers
   779 		<tr>
   780 			<th>Inherited:
   781 			<td>yes
   782 		<tr>
   783 			<th>Percentages:
   784 			<td>N/A
   785 		<tr>
   786 			<th>Media:
   787 			<td>visual
   788 		<tr>
   789 			<th>Computed value:
   790 			<td>specified value
   791 		<tr>
   792 			<th>Animatable:
   793 			<td>no
   794 		<tr>
   795 			<th>Canonical order:
   796 			<td><abbr title="follows order of property value definition">per grammar</abbr>
   797 	</table>
   799 	<p>This property controls position of the ruby text with respect to its base.
   800 	Values have the following meanings:
   802 	<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>
   803 	<dl>
   804 		<dt><dfn title="ruby-position:over">''over''</dfn>
   805 		<dd>The ruby text appears <i>over</i> the base in horizontal text.
   807 			<div class="figure">
   808 				<p><img src="images/shinkansen-top.gif"
   809 				        alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing above the base">
   810 				<p class="caption">Ruby over Japanese base text in horizontal layout
   811 			</div>
   812 		</dd>
   814 		<dt><dfn title="ruby-position:right">''right''</dfn>
   815 		<dd>The ruby text appears on the right side of the base in vertical text.
   816 			<div class="figure">
   817 				<p><img src="images/shinkansen-right.gif" width="33"
   818 				        alt="Diagram of ruby glyph layout in vertical mode with ruby text apearing vertically on the right of the base">
   819 				<p class="caption">Ruby to the right of Japanese base text in vertical layout
   820 			</div>
   821 		</dd>
   823 		<dt><dfn title="ruby-position:under">''under''</dfn>
   824 		<dd>The ruby text appears under the base in horizontal text.
   825 			This is a relatively rare setting used in ideographic East Asian writing systems,
   826 			most easily found in educational text.
   828 			<div class="figure">
   829 				<p><img src="images/shinkansen-bottom.gif"
   830 				        alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing below the base">
   831 				<p class="caption">Ruby under Japanese base text in horizontal layout
   832 			</div>
   833 		</dd>
   835 		<dt><dfn title="ruby-position:left">''left''</dfn>
   836 		<dd>The ruby text appears on the left side of the base in vertical text.
   838 			<div class="figure">
   839 				<p><img src="images/shinkansen-left.gif"
   840 				        alt="Diagram of ruby glyph layout in vertical mode with ruby text apearing vertically on the left of the base">
   841 				<p class="caption">Ruby to the left of Japanese base text in vertical layout
   842 			</div>
   843 		</dd>
   845 		<dt><dfn title="ruby-position:inter-character">''inter-character''</dfn></dt>
   846 		<dd>
   847 			<p>The ruby text appears on the right of the base in horizontal text.
   848 			This value forces the 'writing-mode' of the <i>ruby annotation</i> to be vertical.
   850 			<p>This value is provided for the special case of traditional Chinese
   851 			as used especially in Taiwan:
   852 			ruby (made of <a href="#g-bopomofo">bopomofo</a> glyphs) in that context
   853 			appears vertically along the right side of the base glyph,
   854 			even when the layout of the base characters is horizontal:
   856 				<div class="figure">
   857 					<p><img src="images/bopomofo.gif"
   858 					        alt="Example of Taiwanese-style ruby">
   859 					<p class="caption">“Bopomofo” ruby in traditional Chinese
   860 					(ruby text shown in blue for clarity) in horizontal layout
   861 				</div>
   862 			<p class="note">
   863 				Note that the user agent is responsible for ensuring the correct relative alignment and positioning of the glyphs,
   864 				including those corresponding to the tone marks, when displaying.
   865 				Tone marks are spacing characters that occur (in memory) at the end of the ruby text for each base character.
   866 				They are usually displayed in a separate column to the right of the bopomofo characters,
   867 				and the height of the tone mark depends on the number of characters in the syllable.
   868 				One tone mark, however, is placed above the bopomofo, not to the right of it.
   869 			<!-- See Taiwanese requirements doc for EPUB at http://epub-revision.googlecode.com/files/EGLS_TW_eng.ppt -->
   870 		</dd>
   871 	</dl>
   873 	<p>If multiple <i>ruby annotation containers</i> have the same 'ruby-position',
   874 	they stack along the block axis,
   875 	with lower levels of annotation closer to the base text.
   877 <h3 id="collapsed-ruby">
   878 Collapsed Ruby Annotations: the 'ruby-merge' property</h3>
   880 	<table class="propdef">
   881 		<tr>
   882 			<th>Name:
   883 			<td><dfn>ruby-merge</dfn>
   884 		<tr>
   885 			<th><a href="#values">Value</a>:
   886 			<td>separate | collapse | auto
   887 		<tr>
   888 			<th>Initial:
   889 			<td>separate
   890 		<tr>
   891 			<th>Applies to:
   892 			<td>ruby annotation containers
   893 		<tr>
   894 			<th>Inherited:
   895 			<td>yes
   896 		<tr>
   897 			<th>Percentages:
   898 			<td>N/A
   899 		<tr>
   900 			<th>Media:
   901 			<td>visual
   902 		<tr>
   903 			<th>Computed value:
   904 			<td>specified value
   905 		<tr>
   906 			<th>Animatable:
   907 			<td>no
   908 		<tr>
   909 			<th>Canonical order:
   910 			<td><abbr title="follows order of property value definition">per grammar</abbr>
   911 	</table>
   913 	<p>
   914 		This property controls how ruby annotation boxes should be rendered
   915 		when there are more than one in a ruby container box.
   917 	<p>Possible values:</p>
   918 	<dl>
   919 		<dt><dfn title="ruby-merge:separate">''separate''</dfn>
   920 		<dd>
   921 			<p>
   922 				Each ruby annotation box is rendered in the same column(s) as its corresponding base box(es).
   923 				This style is called “mono ruby” in [[JLREQ]].
   925 			<div class="example">
   926 				<p>For example, the following two markups render the same:
   927 				<pre>&lt;ruby&gt;無&lt;rt&gt;む&lt;/ruby&gt;&lt;ruby&gt;常&lt;rt&gt;じょう&lt;/ruby&gt;</pre>
   928 				<p>and:
   929 				<pre>&lt;ruby style="ruby-merge:separate"&gt;&lt;rb&gt;無&lt;rb&gt;常&lt;rt&gt;む&lt;rt&gt;じょう&lt;/ruby&gt;</pre>
   930 			</div>
   931 		</dd>
   933 		<dt><dfn title="ruby-merge:collapse">''collapse''</dfn>
   934 		<dd>
   935 			<p>
   936 				All <i>ruby annotation boxes</i> within the same <i>ruby segment</i> on the same line are concatenated,
   937 				and laid out as if their contents belonged to a single <i>ruby annotation box</i>
   938 				spanning all their associated <i>ruby base boxes</i>.
   939 				This style renders similar to “group ruby” in [[JLREQ]],
   940 				except that <i>ruby annotations</i> are kept together with their respective <i>ruby bases</i> when breaking lines.
   941 			</p>
   943 			<div class="example">
   944 				<p>The following two markups render the same both characters fit on one line:
   945 				<pre>&lt;ruby&gt;無常&lt;rt&gt;むじょう&lt;/ruby&gt;</pre>
   946 				<p>and:
   947 				<pre>&lt;ruby style="ruby-merge:collapse"&gt;&lt;rb&gt;無&lt;rb&gt;常&lt;rt&gt;む&lt;rt&gt;じょう&lt;/ruby&gt;</pre>
   948 				<p>However, the second one renders the same as ''ruby-position: separate''
   949 				when the two bases are split across lines.
   950 			</div>
   951 		</dd>
   953 		<dt><dfn title="ruby-merge:auto">''auto''</dfn></dt>
   954 		<dd>
   955 			<p>
   956 				The user agent may use any algorithm to determine how each ruby annotation box
   957 				is rendered to its corresponding base box,
   958 				with the intention that if all annotations fit over their respective bases,
   959 				the result is identical to “mono ruby”,
   960 				but if some annotations are wider than their bases
   961 				the space is shared in some way
   962 				to avoid forcing space between bases.
   963 			<div class="example">
   964 			<p>
   965 				One possible algorithm is described as “jukugo ruby” in [[JLREQ]].
   966 			<p>
   967 				Another, more simplified algorithm of “jukugo ruby” is
   968 				to render as ''separate'' if all ruby annotation boxes fit
   969 				within the advances of their corresponding base boxes,
   970 				and render as ''collapse'' otherwise.
   971 			</p>
   972 			</div>
   973 		</dd>
   974 	</dl>
   976 <h3 id="ruby-align-property"><a id="rubyalign"></a>
   977 Ruby Text Distribution: the 'ruby-align' property</h3>
   979 	<table class="propdef">
   980 		<tr>
   981 			<th>Name:
   982 			<td><dfn>ruby-align</dfn>
   983 		<tr>
   984 			<th><a href="#values">Value</a>:
   985 			<td>start | center | space-between | space-around
   986 		<tr>
   987 			<th>Initial:
   988 			<td>space-around
   989 		<tr>
   990 			<th>Applies to:
   991 			<td>ruby bases, ruby annotations, ruby base containers, ruby annotation containers
   992 		<tr>
   993 			<th>Inherited:
   994 			<td>yes
   995 		<tr>
   996 			<th>Percentages:
   997 			<td>N/A
   998 		<tr>
   999 			<th>Media:
  1000 			<td>visual
  1001 		<tr>
  1002 			<th>Computed value:
  1003 			<td>specified value (except for initial and inherit)
  1004 	</table>
  1006 	<p>This property specifies how text is distributed within the various ruby boxes
  1007 	when their contents do not exactly fill their respective boxes.
  1008 	Note that space distributed by 'ruby-align' is unrelated to, and independent of,
  1009 	any space distributed due to justification.
  1011 	<p>Values have the following meanings:
  1012 	<dl>
  1013 		<dt><dfn title="ruby-align:start">''start''</dfn></dt>
  1014 		<dd>The ruby content is aligned with the start edge of its box.
  1015 			<div class="figure">
  1016 				<p><img
  1017 					alt="Diagram of glyph layout in left aligned ruby when ruby text is shorter than base"
  1018 					width="145" height="91" src="images/ra-l.gif" /><img
  1019 					width="145" height="91"
  1020 					alt="Diagram of glyph layout in left aligned ruby when ruby text is longer than base"
  1021 					src="images/ra-l-rb.gif" />
  1022 				<p class="caption">''start'' ruby distribution
  1023 			</div>
  1024 		</dd>
  1026 		<dt><dfn title="ruby-align:center">''center''</dfn></dt>
  1027 		<dd>The ruby content is centered within its box.
  1028 			<div class="figure">
  1029 				<p><img width="145" height="91"
  1030 					alt="Diagram of glyph layout in center aligned ruby when ruby text is shorter than base"
  1031 					src="images/ra-c.gif" /><img width="145" height="91"
  1032 					alt="Diagram of glyph layout in center aligned ruby when ruby text is longer than base"
  1033 					src="images/ra-c-rb.gif" />
  1034 				<p class="caption">''center'' ruby distribution
  1035 			</div>
  1036 		</dd>
  1038 		<dt><dfn title="ruby-align:space-between">''space-between''</dfn></dt>
  1039 		<dd>
  1040 			<p>The ruby content expands as defined for normal text justification
  1041 				(as defined by 'text-justify'),
  1042 				except that if there are no <a href="http://www.w3.org/TR/css3-text/#expansion-opportunity"><i>expansion opportunities</i></a>
  1043 				the content is centered.
  1044 			<div class="figure">
  1045 				<p><img width="145" height="91"
  1046 				alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is shorter than base"
  1047 				src="images/ra-dl.gif" /><img width="145" height="91"
  1048 				alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is longer than base"
  1049 				src="images/ra-dl-rb.gif" />
  1050 				<p class="caption">''space-between'' ruby distribution
  1051 			</div>
  1052 		</dd>
  1054 		<dt><dfn title="ruby-align:space-around">''space-around''</dfn></dt>
  1055 		<dd>
  1056 			<p>As for ''space-between''
  1057 			except that there exists an extra <a href="http://www.w3.org/TR/css3-text/#expansion-opportunity"><i>expansion opportunity</i></a>
  1058 			whose space is distributed half before and half after the ruby content.
  1059 			<div class="example">
  1060 				<p>Since a typical implementation will by default define <i>expansion opportunities</i>
  1061 					between every adjacent pair of CJK <i>characters</i>
  1062 					and not between adjacent pairs of Latin <i>characters</i>,
  1063 					this should result in the behavior recommended by [[JLREQ]]:
  1064 					for wide-cell ruby content to be distributed...
  1065 				<div class="figure">
  1066 					<p><img width="145" height="91"
  1067 					alt="Diagram of glyph layout in auto aligned ruby when ruby text is shorter than base"
  1068 					src="images/ra-ds.gif" /><img width="145" height="91"
  1069 					alt="Diagram of glyph layout in auto aligned ruby when ruby text is longer than base"
  1070 					src="images/ra-ds-rb.gif" />
  1071 					<p class="caption">Wide-cell text in ''space-around'' ruby distribution is spaced apart
  1072 				</div>
  1073 				<p>... and narrow-cell glyph ruby to be centered.
  1074 				<div class="figure">
  1075 					<p><img
  1076 					alt="Diagram of glyph layout in auto aligned ruby when halfwidth ruby text is shorter than base"
  1077 					width="145" height="91"
  1078 					src="images/ra-c-h.gif" /><img
  1079 					alt="Diagram of character layout in auto aligned ruby when ruby text is longer than narrow-width base"
  1080 					width="145" height="91"
  1081 					src="images/ra-c-rb-h.gif" />
  1082 					<p class="caption">Narrow-width ruby text in ''space-around'' ruby distribution is centered
  1083 				</div>
  1084 			</div>
  1085 		</dd>
  1086 	</dl>
  1088 	<p class="issue">Add a paragraph explaining how to distribute space in situations with spanning annotations.
  1089 <!--
  1090 	<p>For a complex ruby with spanning elements, one additional consideration is
  1091 		required. If the spanning element spans multiple 'rows' (other rbc or rtc
  1092 		elements), and the ruby alignment requires space distribution among the
  1093 		'spanned' elements, a ratio must be determined among the 'columns' of spanned
  1094 		elements. This ratio is computed by taking into consideration the widest
  1095 		element within each column.</p>
  1096 -->
  1097 <h2 id="edge-effects">
  1098 Edge Effects</h2>
  1100 <h3 id="ruby-overhang">
  1101 Overhanging Ruby</h3>
  1103 	<p>
  1104 		When <i>ruby annotation box</i> is longer than its corresponding <i>ruby base box</i>,
  1105 		the <i>ruby annotation box</i> may partially overhang adjacent boxes.
  1106 	</p>
  1107 	<p>
  1108 		This level of the specification does not define
  1109 		how much the overhang may be allowed, and under what conditions.
  1110 	</p>
  1112 	<p>If the ruby text is not allowed to overhang,
  1113 	then the ruby behaves like a traditional inline box,
  1114 	i.e. only its own contents are rendered within its boundaries
  1115 	and adjacent elements do not cross the box boundary:
  1117 	<div class="figure">
  1118 		<p><img src="images/ro-n.gif"
  1119 		        alt="Diagram showing the ruby boxes interacting with adjacent text">
  1120 		<p class="caption">Simple ruby whose text is not allowed to overhang adjacent text
  1121 	</div>
  1123 	<p>However, if <i>ruby annotation</i> content is allowed to overhang adjacent elements
  1124 	and it happens to be wider than its base,
  1125 	then the adjacent content is partially rendered within the area of the <i>ruby container box</i>,
  1126 	while the <i>ruby annotation</i> may partially overlap the upper blank parts of the adjacent content:
  1128 	<div class="figure">
  1129 	<p><img src="images/ro-a.gif"
  1130 		      alt="Diagram showing the ruby boxes interacting with adjacent text">
  1131 	<p class="caption">Simple ruby whose text is allowed to overhang adjacent text
  1132 	</div>
  1134 	<p>The <i>ruby annotations</i> related to a <i>ruby base</i>
  1135 	must never overhang another <i>ruby base</i>.
  1137 	<p>The alignment of the contents of the base or the ruby text
  1138 	is not affected by overhanging behavior.
  1139 	The alignment is achieved the same way regardless of the overhang behavior setting
  1140 	and it is computed before the space available for overlap is determined.
  1141 	It is controlled by the 'ruby-align' property.
  1143 	<p class="issue">
  1144 		I suspect overhanging interacts with alignment in some cases;
  1145 		might need to look into this later.
  1147 	<p>This entire logic applies the same way in vertical ideographic layout,
  1148 	only the dimension in which it works in such a layout is vertical,
  1149 	instead of horizontal.
  1151 	<div class="example">
  1152 	<p>
  1153 		The user agent may use [[JIS4051]] recommendation of
  1154 		using one ruby text character length as the maximum overhang length.
  1155 		Detailed rules for how ruby text can overhang adjacent characters for Japanese are described by [[JLREQ]].
  1156 	</p>
  1157 	</div>
  1159 <h3 id="line-edge">
  1160 Line-edge Alignment</h3>
  1162 	<p>
  1163 		When a <i>ruby annotation box</i> that is longer than its <i>ruby base</i>
  1164 		is at the start or end edge of a line,
  1165 		the user agent <em>may</em> force the side of the <i>ruby annotation</i> that touches the edge of the line
  1166 		to align to the corresponding edge of the base.
  1167 		This type of alignment is described by [[JLREQ]].
  1168 	</p>
  1169 	<p>
  1170 		This level of the specification does not provide a mechanism to control this behavior.
  1171 	</p>
  1172 	<div class="figure">
  1173 		<p><img src="images/ra-le-l.gif"
  1174 			alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is shorter than base">
  1175 			<img src="images/ra-le-r.gif"
  1176 			alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is longer than base">
  1177 		<p class="caption">Line-edge alignment
  1178 	</div>
  1180 	<!--
  1181 <h3 id="rubyover">
  1182 Ruby overhanging: the 'ruby-overhang' property</h3>
  1184   <table class="propdef">
  1185     <tr>
  1186       <th>Name:
  1187       <td><dfn>ruby-overhang</dfn>
  1188     <tr>
  1189       <th>Value:
  1190       <td>auto | start | end | none
  1191     <tr>
  1192       <th>Initial:
  1193       <td>none
  1194     <tr>
  1195       <th>Applies to:
  1196       <td>the parent of elements with display: ruby-text
  1197     <tr>
  1198       <th>Inherited:
  1199       <td>yes
  1200     <tr>
  1201       <th>Percentages:
  1202       <td>N/A
  1203     <tr>
  1204       <th>Media:
  1205       <td>visual
  1206     <tr>
  1207       <th>Computed value:
  1208       <td>specified value (except for initial and inherit)
  1209   </table>
  1211 <p>This property determines whether, and on which side, ruby text is allowed
  1212 to partially overhang any adjacent text in addition to its own base, when the
  1213 ruby text is wider than the ruby base. Note that ruby text is never allowed to
  1214 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
  1215 a maximum amount by which ruby text may overhang adjacent text. The user agent may use
  1216 the [[JIS4051]] recommendation of using one ruby text character
  1217 length as the maximum overhang length. Detailed rules for how ruby text can overhang adjacent characters for Japanese are described by [[JLREQ]].</p>
  1219 <p>Possible values:</p>
  1220 <dl>
  1221   <dt><strong>auto</strong></dt>
  1222     <dd>The ruby text can overhang text adjacent to the base on either side.   	  [[JLREQ]] and [[JIS4051]] specify the categories of characters that
  1223       ruby text can overhang. The user agent is free to follow those recommendations or specify its own classes of
  1224       characters to overhang. This is the initial value.
  1225 		<div class="figure">
  1226       <p><img class="example" width="177" height="91"
  1227       alt="Diagram of glyph layout in overhanging ruby" src="images/ro-a.gif" /></p>
  1228       <p><b>Figure 4.3.1</b>: Ruby overhanging adjacent text</p>
  1229       </div>
  1230     </dd>
  1231   <dt><strong>start</strong></dt>
  1232     <dd>The ruby text can only overhang the text that precedes it. That means, for
  1233       example, that ruby cannot overhang text that is to the right of it in
  1234       horizontal LTR layout, and it cannot overhang text that is below it in
  1235       vertical-ideographic layout.
  1236 		<div class="figure">
  1237       <p><img class="example" width="199" height="91"
  1238       alt="Diagram of glyph layout when ruby overhangs the preceding glyphs only"
  1239       src="images/ro-s.gif" /></p>
  1240       <p><b>Figure 4.3.2</b>: Ruby overhanging preceding text only</p>
  1241       </div>
  1242     </dd>
  1243   <dt><strong>end</strong></dt>
  1244     <dd>The ruby text can only overhang the text that follows it. That means, for
  1245       example, that ruby cannot overhang text that is to the left of it in
  1246       horizontal LTR layout, and it cannot overhang text that is above it in
  1247       vertical-ideographic layout.
  1248 		<div class="figure">
  1249       <p><img class="example" width="198" height="91"
  1250       alt="Diagram of glyph layout when ruby overhangs the following characters only"
  1251       src="images/ro-e.gif" /></p>
  1252       <p><b>Figure 4.3.3</b>: Ruby overhanging following text only</p>
  1253       </div>
  1254     </dd>
  1255   <dt><strong>none</strong></dt>
  1256     <dd>The ruby text cannot overhang any text adjacent to its base, only its
  1257       own base.
  1259       <div class="figure">
  1260       <p><img class="example" width="220" height="91"
  1261       alt="Diagram of glyph layout in non-overhanging ruby"
  1262       src="images/ro-n.gif" /></p>
  1263       <p><b>Figure 4.3.4</b>: Ruby not allowed to overhang adjacent text</p>
  1264       </div>
  1265     </dd>
  1266 </dl>
  1268 <h3 id="rubyspan">
  1269 Ruby annotation spanning: the 'ruby-span' property</h3>
  1271   <table class="propdef">
  1272     <tr>
  1273       <th>Name:
  1274       <td><dfn>ruby-span</dfn>
  1275     <tr>
  1276       <th>Value:
  1277       <td>attr(x) |  none
  1278     <tr>
  1279       <th>Initial:
  1280       <td>none
  1281     <tr>
  1282       <th>Applies to:
  1283       <td>elements with display: ruby-text
  1284     <tr>
  1285       <th>Inherited:
  1286       <td>no
  1287     <tr>
  1288       <th>Percentages:
  1289       <td>N/A
  1290     <tr>
  1291       <th>Media:
  1292       <td>visual
  1293     <tr>
  1294       <th>Computed value:
  1295       <td>&lt;number&gt;
  1296   </table>
  1298 <p>This property controls the spanning behavior of annotation elements. </p>
  1300 <p class="note"><span class="note-label">Note:</span> A XHTML user agent may also use the <samp>rbspan</samp> 
  1301 attribute to get the same effect.</p>
  1303 <p>Possible values:</p>
  1305 <dl>
  1306   <dt><strong>attr(x)</strong></dt>
  1307     <dd>The value of attribute 'x' as a string value. The string value is 
  1308     evaluated as a &lt;number&gt; to determine the number of ruby base elements to be 
  1309     spanned by the annotation element. If the &lt;number&gt; is &#39;0&#39;, it is replaced by 
  1310     &#39;1&#39;.The &lt;number&gt; is the computed value. </dd>
  1311   <dt>none</dt>
  1312   <dd>No spanning. The computed value is &#39;1&#39;.</dd>
  1313 </dl>
  1315 <p>The following example shows an XML example using the 'display' property 
  1316 values associated with the 'ruby structure and the 'ruby-span' property</p>
  1317 <pre class="xml">myruby       { display: ruby; }
  1318 myrbc        { display: ruby-base-container; }
  1319 myrb         { display: ruby-base; }
  1320 myrtc.before { display: ruby-text-container; ruby-position: before}
  1321 myrtc.after  { display: ruby-text-container; ruby-position: after}
  1322 myrt         { display: ruby-text; ruby-span: attr(rbspan); }
  1323 ...
  1324 &lt;myruby&gt;
  1325   &lt;myrbc&gt;
  1326     &lt;myrb&gt;10&lt;/myrb&gt;
  1327     &lt;myrb&gt;31&lt;/myrb&gt;
  1328     &lt;myrb&gt;2002&lt;/myrb&gt;
  1329   &lt;/myrbc&gt;
  1330   &lt;myrtc class=&quot;before&quot;&gt;
  1331     &lt;myrt&gt;Month&lt;/myrt&gt;
  1332     &lt;myrt&gt;Day&lt;/myrt&gt;
  1333     &lt;myrt&gt;Year&lt;/myrt&gt;
  1334   &lt;/myrtc&gt;
  1335   &lt;myrtc class=&quot;after&quot;&gt;
  1336     &lt;myrt rbspan=&quot;3&quot;&gt;Expiration Date&lt;/myrt&gt;
  1337   &lt;/myrtc&gt;
  1338 &lt;/myruby&gt;</pre>
  1339 	-->
  1341 <h2 id="default-stylesheet" class="no-num">
  1342 Appendix A: Default Style Sheet</h2>
  1344 	<p><em>This section is informative.</em>
  1346 <h3 id="default-ua-ruby" class="no-num">
  1347 <span class="secno">A.1</span> Supporting Ruby Layout</h3>
  1349 	<p>The following represents a default UA style sheet
  1350 	for rendering HTML and XHTML ruby markup as ruby layout:
  1352 	<pre>
  1353 <!--	-->ruby { display: ruby; }
  1354 <!--	-->rb   { display: ruby-base; white-space: nowrap; }
  1355 <!--	-->rt   { display: ruby-text; white-space: nowrap; font-size: 50%; }
  1356 <!--	-->rbc  { display: ruby-base-container; }
  1357 <!--	-->rtc  { display: ruby-text-container; }
  1358 <!--	-->ruby, rb, rt, rbc, rtc { unicode-bidi: isolate; }</pre>
  1360 	<p>Additional rules for UAs supporting the relevant features of [[CSS3-TEXT-DECOR]] and [[CSS3-FONTS]]:
  1361 	<pre>rt { font-variant-east-asian: ruby; text-emphasis: none; }</pre>
  1363 	<p class="note">Authors should not use the above rules;
  1364 	a UA that supports ruby layout should provide these by default.
  1366 <h3 id="default-inline" class="no-num">
  1367 <span class="secno">A.2</span> Inlining Ruby Annotations</h3>
  1369 	<p>The following represents a sample style sheet
  1370 	for rendering HTML and XHTML ruby markup as inline annotations:
  1372 	<pre>ruby, rb, rt, rbc, rtc, rp {
  1373 <!--	-->  display: inline; white-space: inherit;
  1374 <!--	-->  font-variant-east-asian: inherit; text-emphasis: inherit; }</pre>
  1376 <h3 id="default-parens" class="no-num">
  1377 <span class="secno">A.3</span> Generating Parentheses</h3>
  1379 	<p>Unfortunately, because Selectors cannot match against text nodes,
  1380 	it's not possible with CSS to express rules that will automatically and correctly
  1381 	add parentheses to unparenthesized ruby annotations in HTML.
  1382 	(This is because HTML ruby allows implying the <i>ruby base</i> from raw text, without a corresponding element.)
  1383 	However, these rules will handle cases where either <code>&lt;rb&gt;</code>
  1384 	or <code>&lt;rtc&gt;</code> is used rigorously.
  1386 	<pre>
  1387 <!--	-->/* Parens around &lt;rtc> */
  1388 <!--	-->rtc::before { content: "("; }
  1389 <!--	-->rtc::after  { content: ")"; }
  1391 <!--	-->/* Parens before first &lt;rt> not inside &lt;rtc> */
  1392 <!--	-->rb  + rt::before,
  1393 <!--	-->rtc + rt::before { content: "("; }
  1395 <!--	-->/* Parens after &lt;rt> not inside &lt;rtc> */
  1396 <!--	-->rb ~ rt:last-child::after,
  1397 <!--	-->rt + rb::before  { content: ")"; }
  1398 <!--	-->rt + rtc::before { content: ")("; }</pre>
  1400 <h2 id="glossary">
  1401 Glossary</h2>
  1402 <dl>
  1403   <dt><a id="g-bopomofo"><strong><span
  1404   lang="zh">Bopomofo</span></strong></a></dt>
  1405     <dd>37 characters and 4 tone markings used as phonetics in Chinese,
  1406       especially standard Mandarin.</dd>
  1407   <dt><a id="g-hanja"><strong><span
  1408   lang="ko">Hanja</span></strong></a></dt>
  1409     <dd>Subset of the Korean writing system that utilizes ideographic
  1410       characters borrowed or adapted from the Chinese writing system. Also see
  1411       <a href="#g-kanji"><span lang="ja">Kanji</span></a>.</dd>
  1412   <dt><a id="g-hiragana"><strong><span
  1413   lang="ja">Hiragana</span></strong></a></dt>
  1414     <dd>Japanese syllabic script, or character of that script. Rounded and 
  1415     cursive in appearance. Subset of the Japanese writing system, used together 
  1416     with kanji and katakana. In recent times, mostly used to write Japanese 
  1417     words when kanji are not available or appropriate, and word endings and 
  1418     particles. Also see <a
  1419       href="#g-katakana"><span lang="ja">Katakana</span></a>.</dd>
  1420   <dt><a id="g-ideogram"><strong>Ideograph</strong></a></dt>
  1421     <dd>A character that is used to represent an idea, word, or word component, 
  1422     in contrast to a character from an alphabetic or syllabic script. The most 
  1423     well-known ideographic script is used (with some variation) in East Asia 
  1424     (China, Japan, Korea,...).</dd>
  1425   <dt><a id="g-kana"><strong><span lang="ja">Kana</span></strong></a></dt>
  1426     <dd>Collective term for hiragana and katakana.</dd>
  1427   <dt><a id="g-kanji"><strong>Kanji</strong></a></dt>
  1428     <dd>Japanese term for ideographs; ideographs used in Japanese. Subset of the 
  1429     Japanese writing system, used together with hiragana and katakana. Also see <a
  1430       href="#g-hanja"><span lang="ko">Hanja</span></a>.</dd>
  1431   <dt><a id="g-katakana"><strong><span
  1432   lang="ja">Katakana</span></strong></a></dt>
  1433     <dd>Japanese syllabic script, or character of that script. Angular in 
  1434     appearance. Subset of the Japanese writing system,&nbsp; used together with 
  1435     kanji and hiragana. In recent times, mainly used to write foreign words. Also see <a
  1436       href="#g-hiragana"><span lang="ja">Hiragana</span></a>.</dd>
  1437 </dl>
  1439 <h2 id="conformance">
  1440 Conformance</h2>
  1442 <h3 id="conventions">
  1443 Document conventions</h3>
  1445   <p>Conformance requirements are expressed with a combination of
  1446   descriptive assertions and RFC 2119 terminology. The key words “MUST”,
  1447   “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
  1448   “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
  1449   document are to be interpreted as described in RFC 2119.
  1450   However, for readability, these words do not appear in all uppercase
  1451   letters in this specification.
  1453   <p>All of the text of this specification is normative except sections
  1454   explicitly marked as non-normative, examples, and notes. [[!RFC2119]]</p>
  1456   <p>Examples in this specification are introduced with the words “for example”
  1457   or are set apart from the normative text with <code>class="example"</code>,
  1458   like this:
  1460   <div class="example">
  1461     <p>This is an example of an informative example.</p>
  1462   </div>
  1464   <p>Informative notes begin with the word “Note” and are set apart from the
  1465   normative text with <code>class="note"</code>, like this:
  1467   <p class="note">Note, this is an informative note.</p>
  1469 <h3 id="conformance-classes">
  1470 Conformance classes</h3>
  1472   <p>Conformance to CSS Ruby Module
  1473   is defined for three conformance classes:
  1474   <dl>
  1475     <dt><dfn title="style sheet!!as conformance class">style sheet</dfn>
  1476       <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
  1477       style sheet</a>.
  1478     <dt><dfn>renderer</dfn></dt>
  1479       <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  1480       that interprets the semantics of a style sheet and renders
  1481       documents that use them.
  1482     <dt><dfn id="authoring-tool">authoring tool</dfn></dt>
  1483       <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  1484       that writes a style sheet.
  1485   </dl>
  1487   <p>A style sheet is conformant to CSS Ruby Module
  1488   if all of its statements that use syntax defined in this module are valid
  1489   according to the generic CSS grammar and the individual grammars of each
  1490   feature defined in this module.
  1492   <p>A renderer is conformant to CSS Ruby Module
  1493   if, in addition to interpreting the style sheet as defined by the
  1494   appropriate specifications, it supports all the features defined
  1495   by CSS Ruby Module by parsing them correctly
  1496   and rendering the document accordingly. However, the inability of a
  1497   UA to correctly render a document due to limitations of the device
  1498   does not make the UA non-conformant. (For example, a UA is not
  1499   required to render color on a monochrome monitor.)
  1501   <p>An authoring tool is conformant to CSS Ruby Module
  1502   if it writes style sheets that are syntactically correct according to the
  1503   generic CSS grammar and the individual grammars of each feature in
  1504   this module, and meet all other conformance requirements of style sheets
  1505   as described in this module.
  1507 <h3 id="partial">
  1508 Partial implementations</h3>
  1510   <p>So that authors can exploit the forward-compatible parsing rules to
  1511   assign fallback values, CSS renderers <strong>must</strong>
  1512   treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore
  1513   as appropriate</a>) any at-rules, properties, property values, keywords,
  1514   and other syntactic constructs for which they have no usable level of
  1515   support. In particular, user agents <strong>must not</strong> selectively
  1516   ignore unsupported component values and honor supported values in a single
  1517   multi-value property declaration: if any value is considered invalid
  1518   (as unsupported values must be), CSS requires that the entire declaration
  1519   be ignored.</p>
  1521 <h3 id="experimental">
  1522 Experimental implementations</h3>
  1524   <p>To avoid clashes with future CSS features, the CSS2.1 specification
  1525   reserves a <a href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
  1526   syntax</a> for proprietary and experimental extensions to CSS.
  1528   <p>Prior to a specification reaching the Candidate Recommendation stage
  1529   in the W3C process, all implementations of a CSS feature are considered
  1530   experimental. The CSS Working Group recommends that implementations
  1531   use a vendor-prefixed syntax for such features, including those in
  1532   W3C Working Drafts. This avoids incompatibilities with future changes
  1533   in the draft.
  1534   </p>
  1536 <h3 id="testing">
  1537 Non-experimental implementations</h3>
  1539   <p>Once a specification reaches the Candidate Recommendation stage,
  1540   non-experimental implementations are possible, and implementors should
  1541   release an unprefixed implementation of any CR-level feature they
  1542   can demonstrate to be correctly implemented according to spec.
  1544   <p>To establish and maintain the interoperability of CSS across
  1545   implementations, the CSS Working Group requests that non-experimental
  1546   CSS renderers submit an implementation report (and, if necessary, the
  1547   testcases used for that implementation report) to the W3C before
  1548   releasing an unprefixed implementation of any CSS features. Testcases
  1549   submitted to W3C are subject to review and correction by the CSS
  1550   Working Group.
  1552   <p>Further information on submitting testcases and implementation reports
  1553   can be found from on the CSS Working Group's website at
  1554   <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
  1555   Questions should be directed to the
  1556   <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
  1557   mailing list.
  1559 <h2 class=no-num id="acknowledgments">
  1560 Acknowledgments</h2>
  1562 <p>This specification would not have been possible without the help from:</p>
  1564 <p>Stephen Deach, Martin Dürst,  Hideki Hiura(<span lang="ja">樋浦 秀樹</span>), Masayasu Ishikawa(<span lang="ja">石川
  1565 雅康</span>), Chris
  1566 Pratley, Takao Suzuki(<span lang="ja">鈴木 孝雄</span>), Frank Yung-Fong Tang, Chris Thrasher, Masafumi Yabe<span lang="ja">家辺
  1567 勝文</span>), Steve Zilles.</p>
  1569 <h2 class="no-num" id="changes">
  1570 Changes</h2>
  1572 	<p>The following major changes have been made since the previous Working Draft:
  1573 	<dl>
  1574 		<dt>Remove 'ruby-span' and mentions of <code>rbspan</code>.
  1575 		<dd>
  1576 			Explicit spanning is not used in HTML ruby in favor of implicit spanning.
  1577 			This can't handle some pathological double-sided spanning cases,
  1578 			but there seems to be no requirement for these at the moment.
  1579 			(For implementations that support full complex XHTML Ruby,
  1580 			they can imply spanning from the markup the same magic way
  1581 			that we handle cell spanning from tables. It doesn't seem
  1582 			necessary to include controls this in Level 1.)
  1584 		<dt>Defer 'ruby-overhang' and ''ruby-align: line-end'' to Level 2.
  1585 		<dd>
  1586 			It's somewhat complicated, advanced feature.
  1587 			Proposal is to make this behavior UA-defined
  1588 			and provide some examples of acceptable options.
  1590 		<dt>Close issue requesting 'display: rp': use ''display: none''.
  1591 		<dd>
  1592 			The Internationalization WG added an issue requesting a display value for &lt;rp> elements.
  1593 			They're supposed to be hidden when &lt;ruby> is displayed as ruby.
  1594 			But this is easily accomplished already with ''display: none''.
  1596 		<dt>Change 'ruby-position' values to match 'text-emphasis-position'.
  1597 		<dd>
  1598 			Other than ''inter-character'', which we need to keep,
  1599 			it makes more sense to align ruby positions with 'text-emphasis-position',
  1600 			which can correctly handle various combinations of horizontal/vertical preferences.
  1602 		<dt>Remove unused values of 'ruby-align'.
  1603 		<dd>
  1604 			''left'', ''right'', and ''end'' are not needed.
  1606 		<dt>Replace ''auto'', ''distribute-letter'', and ''distribute-space'' from 'ruby-align' with ''space-between'' and ''space-around''.
  1607 		<dd>
  1608 			The ''auto'' value relied on inspecting content to determine behavior;
  1609 			this can be avoided by just using ''space-around'' with standard justification rules
  1610 			(which allow spacing between CJK but not between Latin).
  1611 			Replaced ''distribute-letter'' and ''distribute-space'' with
  1612 			''space-between'' and ''space-around'' for consistency with distribution keywords
  1613 			in [[CSS3-FLEXBOX]] and [[CSS3-ALIGN]]
  1614 			and to avoid any links to the definition of ''text-justify: distribute''.
  1616 		<dt>Added 'ruby-merge' property to control jukugo rendering.
  1617 		<dd>
  1618 			This is a stylistic effect, not a structural one;
  1619 			the previous model assumed that it was structural and suggested handling it by changing markup. :(
  1621 		<dt>Remove ''inline'' from 'ruby-position'.
  1622 		<dd>
  1623 			This is do-able via ''display: inline'' on all the ruby-related elements,
  1624 			see <a href="#default-inline">Appendix A</a>
  1626 		<dt>Added <a href="#default-style">Default Style</a> rules
  1627 		<dd>
  1628 			As requested by Internationalization WG.
  1630 		<dt>Wrote anonymous box generation rules
  1631 		<dd>
  1632 			And defined pairing of bases and annotations.
  1633 			Should now handle all the crazy proposed permutations of HTML ruby markup.
  1635 		<dt>Defined layout of ruby
  1636 		<dd>
  1637 			Defined in detail space distribution, white space handling, line breaking, line stacking, etc.
  1638 			Open issue left for bidi.
  1639 	</dl>
  1641 <h2 class=no-num id="references">
  1642 References</h2>
  1644 <h3 class="no-num" id="normative-references">
  1645 Normative references</h3>
  1646 <!--normative-->
  1648 <h3 class="no-num" id="other-references">
  1649 Other references</h3>
  1650 <!--informative-->
  1652 <h2 class="no-num" id="index">
  1653 Index</h2>
  1654 <!--index-->
  1656 <h2 class="no-num" id="property-index">
  1657 Property index</h2>
  1658 <!-- properties -->
  1660 </body>
  1661 </html>
  1662 <!-- Keep this comment at the end of the file
  1663 Local variables:
  1664 mode: sgml
  1665 sgml-declaration:"~/SGML/HTML4.decl"
  1666 sgml-default-doctype-name:"html"
  1667 sgml-minimize-attributes:t
  1668 sgml-nofill-elements:("pre" "style" "br")
  1669 sgml-live-element-indicator:t
  1670 sgml-omittag:nil
  1671 sgml-shorttag:nil
  1672 sgml-namecase-general:t
  1673 sgml-general-insert-case:lower
  1674 sgml-always-quote-attributes:t
  1675 sgml-indent-step:nil
  1676 sgml-indent-data:t
  1677 sgml-parent-document:nil
  1678 sgml-exposed-tags:nil
  1679 sgml-local-catalogs:nil
  1680 sgml-local-ecat-files:nil
  1681 End:
  1682 -->

mercurial