css-ruby/Overview.src.html

Fri, 21 Jun 2013 23:18:37 -0700

author
fantasai <fantasai.cvs@inkedblade.net>
date
Fri, 21 Jun 2013 23:18:37 -0700
changeset 8534
db340cae813c
parent 8533
e9426bf43628
child 8547
04b962156bd3
permissions
-rw-r--r--

[css-ruby] Specify white space handling

     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="white-space">
   385 White Space</h3>
   387 	<p class="issue">I'm unsure exactly where space should be trimmed. :/
   388 	But pretty sure we need to keep spaces between things,
   389 	otherwise ruby only works for CJK.
   391 	<p><i>Collapsible</i> white space within a ruby structure is discarded
   392 	at the beginning and end of a <i>ruby container</i>,
   393 	and 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.
   394 	Between <i>ruby segments</i>, between <i>ruby bases</i>, and between <i>ruby annotations</i>, however,
   395 	white space is not discarded.
   396 	If such white space is <i>collapsible</i>, it will collapse
   397 	following the standard <a href="http://www.w3.org/TR/css3-text/#white-space-rules">white space processing rules</a>. [[!CSS3-TEXT]]
   398 	Between <i>ruby segments</i>, however,
   399 	the contextual text for determining collapsing behavior is given by the <i>ruby bases</i> on either side,
   400 	not the text on either side of the white space in the source document.
   402 	<div class="note">
   403 		<p>Note that the white space processing rules
   404 		cause a white space sequence containing a <i>segment break</i> (such as a line feed)
   405 		to <a href="http://www.w3.org/TR/css3-text/#line-break-transform">collapse to nothing</a> between CJK characters.
   406 		This means that CJK ruby can safely use white space for indentation of the ruby markup.
   407 		For example, the following markup will display without any spaces:
   408 		<pre>
   409 <!--		-->&lt;ruby>
   410 <!--		-->  &lt;rb>東&lt;/rb>&lt;rb>京&lt;/rb>
   411 <!--		-->  &lt;rt>とう&lt;/rt>&lt;rt>きょう&lt;/rt>
   412 <!--		-->&lt;/ruby></pre>
   413 		<p>However, this markup will:
   414 <!--		-->&lt;ruby>
   415 <!--		-->  &lt;rb>東&lt;/rb>	&lt;rb>京&lt;/rb>
   416 <!--		-->  &lt;rt>とう&lt;/rt>	&lt;rt>きょう&lt;/rt>
   417 <!--		-->&lt;/ruby></pre>
   418 	</div>
   420 	<p>Any preserved white space is then wrapped in an anonymous box belonging to
   421 	the <i>ruby base container</i> (if between <i>ruby bases</i>),
   422 	<i>ruby annotation container</i> (if between <i>ruby annotations</i>),
   423 	or <i>ruby container</i> (if between <i>ruby segments</i>).
   424 	In the latter case, the text is considered part of the <i>base level</i>.
   425 	This box does not take part in pairing.
   426 	It merely ensures separation between adjacent bases/annotations.
   428 	<div class="example">
   429 		<p>These rules allow ruby to be used with space-separated scripts such as Latin.
   430 		For example,
   431 		<pre>
   432 <!--		-->&lt;ruby>
   433 <!--		-->  &lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>
   434 <!--		-->  &lt;rt>World&lt;/rt> &lt;rt>Wide&lt;/rt> &lt;rt>Web&lt;/rt>
   435 <!--		-->&lt;/ruby></pre>
   436 		<p>They also ensure that annotated white space is preserved. For example,
   437 		<pre>
   438 <!--		-->&lt;ruby>
   439 <!--		-->  &lt;rb>Aerith&lt;/rb>&lt;rb> &lt;/rb>&lt;rb>Gainsboro&lt;/rb>
   440 <!--		-->  &lt;rt>エアリス&lt;/rt>&lt;rt>・&lt;/rt>&lt;rt>ゲインズブール&lt;/rt>
   441 <!--		-->&lt;/ruby></pre>
   442 	</div>
   444 	<p class="issue">Specify how this impacts layout, or not.
   446 <h3 id="line-breaking">
   447 Ruby box and line breaking</h3>
   449 	<p>When there is not enough space for an entire <i>ruby container</i> to fit on the line,
   450 	the ruby may be broken wherever all levels allow a break.
   451 	In typical cases, line breaks are forbidden within each <i>ruby base</i> and <i>ruby annotation</i>,
   452 	so the <i>ruby container</i> can only break between adjacent <i>ruby bases</i>,
   453 	and only if no <i>ruby annotations</i> span those <i>ruby bases</i>.
   454 	Whenever ruby breaks across lines, <i>ruby annotations</i>
   455 	<em>must</i> stay with their respective bases.
   457 	<div class="figure">
   458 		<p><img src="images/r-break-a.gif"
   459 		     alt="Diagram showing the line breaking opportunity in a complex ruby">
   460 		<p class="caption">Ruby line breaking opportunity
   461 	</div>
   463 	<p>Whether ruby can break between two adjacent <i>ruby bases</i>
   464 	is controlled by normal line-breaking rules for the affected text,
   465 	exactly as if the <i>ruby bases</i> were regular <i>inline</i> boxes.
   467 	<div class="example">
   468 		<p>For example, if two adjacent ruby bases are “蝴” and “蝶”,
   469 		the line may break between them,
   470 		because lines are normally allowed to break between two Han characters.
   471 		However, if 'word-break' is ''keep-all'', that line break is forbidden.
   472 	</div>
   474 	<p>Inter-base white space is significant for evaluating line break opportunities between <i>ruby bases</i>.
   475 	As with white space between inlines, it collapses when the line breaks there.
   477 	<div class="example">
   478 		<p>For example, given the following markup:
   479 		<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>
   480 		<p>Due to the space, the line may break between “one” and “two“.
   481 		If the line breaks there, that space disappears,
   482 		in accordance with standard CSS white space processing rules. [[CSS3-TEXT]]
   483 	</div>
   485 	<p>The line <em>must not</em> break between a <i>ruby base</i> and its annotations.
   487 	<div class="figure">
   488 		<img src="images/r-break-b.gif"
   489 		     alt='Diagram showing the line breaking opportunity in a "Bopomofo" ruby'>
   490 		<p class="caption">''inter-character'' ruby line breaking opportunity
   491 	</div>
   493 <!-- <h3 id="ruby-line-height">
   494 Ruby box and line stacking</h3>
   496 <div class="figure">
   497 <p>
   498 <img class="example" 
   499 alt="Diagram showing the ruby text using 2 half leading"
   500 src="images/rlh-a.gif" width="210" height="138" /></p>
   502 <p><b>Figure 3.3.1</b>: Excluded Ruby text</p>
   503 </div>
   504 -->
   506 <h2 id="ruby-props">
   507 Ruby Properties</h2>
   509 	<p>The following properties are introduced to control ruby positioning and alignment.
   511 <h3 id="rubypos">
   512 Ruby positioning: the 'ruby-position' property</h3>
   514 	<table class="propdef">
   515 		<tr>
   516 			<th>Name:
   517 			<td><dfn>ruby-position</dfn>
   518 		<tr>
   519 			<th><a href="#values">Value</a>:
   520 			<td>[ over | under | inter-character ] && [ right | left ]
   521 		<tr>
   522 			<th>Initial:
   523 			<td>over right
   524 		<tr>
   525 			<th>Applies to:
   526 			<td>ruby annotation containers
   527 		<tr>
   528 			<th>Inherited:
   529 			<td>yes
   530 		<tr>
   531 			<th>Percentages:
   532 			<td>N/A
   533 		<tr>
   534 			<th>Media:
   535 			<td>visual
   536 		<tr>
   537 			<th>Computed value:
   538 			<td>specified value
   539 		<tr>
   540 			<th>Animatable:
   541 			<td>no
   542 		<tr>
   543 			<th>Canonical order:
   544 			<td><abbr title="follows order of property value definition">per grammar</abbr>
   545 	</table>
   547 	<p>This property controls position of the ruby text with respect to its base.
   548 	Values have the following meanings:
   550 	<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>
   551 	<dl>
   552 		<dt><dfn title="ruby-position:over">''over''</dfn>
   553 		<dd>The ruby text appears <i>over</i> the base in horizontal text.
   555 			<div class="figure">
   556 				<p><img src="images/shinkansen-top.gif"
   557 				        alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing above the base">
   558 				<p class="caption">Ruby over Japanese base text in horizontal layout
   559 			</div>
   560 		</dd>
   562 		<dt><dfn title="ruby-position:right">''right''</dfn>
   563 		<dd>The ruby text appears on the right side of the base in vertical text.
   564 			<div class="figure">
   565 				<p><img src="images/shinkansen-right.gif" width="33"
   566 				        alt="Diagram of ruby glyph layout in vertical mode with ruby text apearing vertically on the right of the base">
   567 				<p class="caption">Ruby to the right of Japanese base text in vertical layout
   568 			</div>
   569 		</dd>
   571 		<dt><dfn title="ruby-position:under">''under''</dfn>
   572 		<dd>The ruby text appears under the base in horizontal text.
   573 			This is a relatively rare setting used in ideographic East Asian writing systems,
   574 			most easily found in educational text.
   576 			<div class="figure">
   577 				<p><img src="images/shinkansen-bottom.gif"
   578 				        alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing below the base">
   579 				<p class="caption">Ruby under Japanese base text in horizontal layout
   580 			</div>
   581 		</dd>
   583 		<dt><dfn title="ruby-position:left">''left''</dfn>
   584 		<dd>The ruby text appears on the left side of the base in vertical text.
   586 			<div class="figure">
   587 				<p><img src="images/shinkansen-left.gif"
   588 				        alt="Diagram of ruby glyph layout in vertical mode with ruby text apearing vertically on the left of the base">
   589 				<p class="caption">Ruby to the left of Japanese base text in vertical layout
   590 			</div>
   591 		</dd>
   593 		<dt><dfn title="ruby-position:inter-character">''inter-character''</dfn></dt>
   594 		<dd>
   595 			<p>The ruby text appears on the right of the base in horizontal text.
   596 			This value forces the 'writing-mode' of the <i>ruby annotation</i> to be vertical.
   598 			<p>This value is provided for the special case of traditional Chinese
   599 			as used especially in Taiwan:
   600 			ruby (made of <a href="#g-bopomofo">bopomofo</a> glyphs) in that context
   601 			appears vertically along the right side of the base glyph,
   602 			even when the layout of the base characters is horizontal:
   604 				<div class="figure">
   605 					<p><img src="images/bopomofo.gif"
   606 					        alt="Example of Taiwanese-style ruby">
   607 					<p class="caption">“Bopomofo” ruby in traditional Chinese
   608 					(ruby text shown in blue for clarity) in horizontal layout
   609 				</div>
   610 			<p class="note">
   611 				Note that the user agent is responsible for ensuring the correct relative alignment and positioning of the glyphs,
   612 				including those corresponding to the tone marks, when displaying.
   613 				Tone marks are spacing characters that occur (in memory) at the end of the ruby text for each base character.
   614 				They are usually displayed in a separate column to the right of the bopomofo characters,
   615 				and the height of the tone mark depends on the number of characters in the syllable.
   616 				One tone mark, however, is placed above the bopomofo, not to the right of it.
   617 			<!-- See Taiwanese requirements doc for EPUB at http://epub-revision.googlecode.com/files/EGLS_TW_eng.ppt -->
   618 		</dd>
   619 	</dl>
   621 	<p>If multiple <i>ruby annotation containers</i> have the same 'ruby-position',
   622 	they stack along the block axis,
   623 	with lower levels of annotation closer to the base text.
   625 <h3 id="collapsed-ruby">
   626 Collapsed Ruby Annotations: the 'ruby-merge' property</h3>
   628 	<table class="propdef">
   629 		<tr>
   630 			<th>Name:
   631 			<td><dfn>ruby-merge</dfn>
   632 		<tr>
   633 			<th><a href="#values">Value</a>:
   634 			<td>separate | collapse | auto
   635 		<tr>
   636 			<th>Initial:
   637 			<td>separate
   638 		<tr>
   639 			<th>Applies to:
   640 			<td>ruby annotation containers
   641 		<tr>
   642 			<th>Inherited:
   643 			<td>yes
   644 		<tr>
   645 			<th>Percentages:
   646 			<td>N/A
   647 		<tr>
   648 			<th>Media:
   649 			<td>visual
   650 		<tr>
   651 			<th>Computed value:
   652 			<td>specified value
   653 		<tr>
   654 			<th>Animatable:
   655 			<td>no
   656 		<tr>
   657 			<th>Canonical order:
   658 			<td><abbr title="follows order of property value definition">per grammar</abbr>
   659 	</table>
   661 	<p>
   662 		This property controls how ruby annotation boxes should be rendered
   663 		when there are more than one in a ruby container box.
   665 	<p>Possible values:</p>
   666 	<dl>
   667 		<dt><dfn title="ruby-merge:separate">''separate''</dfn>
   668 		<dd>
   669 			<p>
   670 				Each ruby annotation box is rendered in the same column(s) as its corresponding base box(es).
   671 				This style is called “mono ruby” in [[JLREQ]].
   673 			<div class="example">
   674 				<p>For example, the following two markups render the same:
   675 				<pre>&lt;ruby&gt;無&lt;rt&gt;む&lt;/ruby&gt;&lt;ruby&gt;常&lt;rt&gt;じょう&lt;/ruby&gt;</pre>
   676 				<p>and:
   677 				<pre>&lt;ruby style="ruby-merge:separate"&gt;&lt;rb&gt;無&lt;rb&gt;常&lt;rt&gt;む&lt;rt&gt;じょう&lt;/ruby&gt;</pre>
   678 			</div>
   679 		</dd>
   681 		<dt><dfn title="ruby-merge:collapse">''collapse''</dfn>
   682 		<dd>
   683 			<p>
   684 				All <i>ruby annotation boxes</i> within the same <i>ruby segment</i> on the same line are concatenated,
   685 				and laid out as if their contents belonged to a single <i>ruby annotation box</i>
   686 				spanning all their associated <i>ruby base boxes.
   687 				This style renders similar to “group ruby” in [[JLREQ]],
   688 				except that <i>ruby annotations</i> are kept together with their respective <i>ruby bases</i> when breaking lines.
   689 			</p>
   691 			<div class="example">
   692 				<p>The following two markups render the same both characters fit on one line:
   693 				<pre>&lt;ruby&gt;無常&lt;rt&gt;むじょう&lt;/ruby&gt;</pre>
   694 				<p>and:
   695 				<pre>&lt;ruby style="ruby-merge:collapse"&gt;&lt;rb&gt;無&lt;rb&gt;常&lt;rt&gt;む&lt;rt&gt;じょう&lt;/ruby&gt;</pre>
   696 				<p>However, the second one renders the same as ''ruby-position: separate''
   697 				when the two bases are split across lines.
   698 			</div>
   699 		</dd>
   701 		<dt><dfn title="ruby-merge:auto">''auto''</dfn></dt>
   702 		<dd>
   703 			<p>
   704 				The user agent may use any algorithm to determine how each ruby annotation box
   705 				is rendered to its corresponding base box.
   706 			<div class="example">
   707 			<p>
   708 				One possible algorithm is described as Jukugo-ruby in [[JLREQ]].
   709 			<p>
   710 				Another, more simplified algorithm of Jukugo-ruby is
   711 				to render as Mono-ruby if all ruby annotation boxes fit within
   712 				advances of their corresponding base boxes,
   713 				and render as Group-ruby otherwise.
   714 			</p>
   715 			</div>
   716 		</dd>
   717 	</dl>
   719 <h3 id="rubyalign">
   720 Ruby Text Distribution: the 'ruby-align' property</h3>
   722 	<table class="propdef">
   723 		<tr>
   724 			<th>Name:
   725 			<td><dfn>ruby-align</dfn>
   726 		<tr>
   727 			<th><a href="#values">Value</a>:
   728 			<td>auto | start | center |
   729 				distribute-letter | distribute-space
   730 		<tr>
   731 			<th>Initial:
   732 			<td>auto
   733 		<tr>
   734 			<th>Applies to:
   735 			<td>ruby bases, ruby annotations, ruby base containers, ruby annotation containers
   736 		<tr>
   737 			<th>Inherited:
   738 			<td>yes
   739 		<tr>
   740 			<th>Percentages:
   741 			<td>N/A
   742 		<tr>
   743 			<th>Media:
   744 			<td>visual
   745 		<tr>
   746 			<th>Computed value:
   747 			<td>specified value (except for initial and inherit)
   748 	</table>
   750 	<p>This property specifies how text is distributed within the various ruby boxes
   751 		when their text contents exactly fill their respective boxes.
   753 	<p>Values have the following meanings:
   754 	<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>
   755 	<dl>
   756 		<dt><dfn title="ruby-align:auto">''auto''</dfn></dt>
   757 		<dd>
   758 			<p>The user agent determines how the ruby contents are aligned.
   759 				This is the initial value.
   760 				The behavior recommended by [[JLREQ]] is for  wide-cell ruby  to be aligned in the 'distribute-space' mode:
   761 				<div class="figure">
   762 					<p><img width="145" height="91"
   763 					alt="Diagram of glyph layout in auto aligned ruby when ruby text is shorter than base"
   764 					src="images/ra-ds.gif" /><img width="145" height="91"
   765 					alt="Diagram of glyph layout in auto aligned ruby when ruby text is longer than base"
   766 					src="images/ra-ds-rb.gif" /></p>
   767 					<p><b>Figure 4.2.1</b>: Wide-cell text in 'auto' ruby alignment is
   768 					'distribute-space' justified</p>
   769 				</div>
   771 			<p>The recommended behavior for  narrow-cell glyph ruby is to be
   772 				aligned in the 'center' mode.</p>
   773 				<div class="figure">
   774 					<p><img
   775 					alt="Diagram of glyph layout in auto aligned ruby when halfwidth ruby text is shorter than base"
   776 					width="145" height="91"
   777 					src="images/ra-c-h.gif" /><img
   778 					alt="Diagram of character layout in auto aligned ruby when ruby text is longer than narrow-width base"
   779 					width="145" height="91"
   780 					src="images/ra-c-rb-h.gif" /></p>
   781 					<p><b>Figure 4.2.2</b>: Narrow-width ruby text in 'auto' ruby alignment
   782 					is centered</p>
   783 				</div>
   784 		</dd>
   786 		<dt><dfn title="ruby-align:start">''start''</dfn></dt>
   787 		<dd>The ruby annotation content is aligned with the start edge of the base.
   788 			<div class="figure">
   789 				<p><img
   790 					alt="Diagram of glyph layout in left aligned ruby when ruby text is shorter than base"
   791 					width="145" height="91" src="images/ra-l.gif" /><img
   792 					width="145" height="91"
   793 					alt="Diagram of glyph layout in left aligned ruby when ruby text is longer than base"
   794 					src="images/ra-l-rb.gif" /></p>
   795 				<p><b>Figure 4.2.3</b>: Start ruby alignment</p>
   796 			</div>
   797 		</dd>
   799 		<dt><dfn title="ruby-align:center">''center''</dfn></dt>
   800 		<dd>The ruby text content is centered within the width of the base. If the
   801 			length of the base is smaller than the length of the ruby text, then the
   802 			base is centered within the width of the ruby text.
   804 			<div class="figure">
   805 				<p><img width="145" height="91"
   806 					alt="Diagram of glyph layout in center aligned ruby when ruby text is shorter than base"
   807 					src="images/ra-c.gif" /><img width="145" height="91"
   808 					alt="Diagram of glyph layout in center aligned ruby when ruby text is longer than base"
   809 					src="images/ra-c-rb.gif" /></p>
   810 				<p><b>Figure 4.2.4</b>: Center ruby alignment</p>
   811 			</div>
   812 		</dd>
   814 		<!--
   815   <dt><strong>right</strong></dt>
   816     <dd>The ruby text content is aligned with the end edge of the base.
   817     	<p class="issue"><span class="issuehead">Issue:&nbsp;</span> The i18n WG feels that end and right should not be synonymous, and proposed to drop right (there is no left/right in overhang)? See <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&amp;hdr-1-name=subject&amp;hdr-1-query=[CSS3+Ruby]%20left/start+and+right/end&amp;hdr-2-name=from&amp;hdr-2-query=&amp;hdr-3-name=message-id&amp;hdr-3-query=&amp;index-grp=Member__FULL+Public__FULL&amp;index-type=t&amp;type-index=public-i18n-core%40w3.org&amp;resultsperpage=20&amp;sortby=date">this thread</a>.</p>
   818 <div class="figure">
   819 	<p><img class="example" width="145" height="91"
   820       alt="Diagram of glyph layout in right aligned ruby when ruby text is shorter than base"
   821       src="images/ra-r.gif" /><img class="example" width="145" height="91"
   822       alt="Diagram of glyph layout in right aligned ruby when ruby text is longer than base"
   823       src="images/ra-r-rb.gif" /></p>
   824 	<p><b>Figure 4.2.5</b>: End ruby alignment</p>
   825 </div>
   826     </dd>
   827 		-->
   829 		<dt><dfn title="ruby-align:distribute-letter">''distribute-letter''</dfn></dt>
   830 		<dd>If the width of the ruby text is smaller than that of the base, then
   831 			the ruby text contents are evenly distributed across the width of the
   832 			base, with the first and last ruby text glyphs lining up with the
   833 			corresponding first and last base glyphs. If the width of the ruby text
   834 			is at least the width of the base, then the letters of the base are
   835 			evenly distributed across the width of the ruby text.
   837 			<div class="figure">
   838 				<p><img width="145" height="91"
   839 				alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is shorter than base"
   840 				src="images/ra-dl.gif" /><img width="145" height="91"
   841 				alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is longer than base"
   842 				src="images/ra-dl-rb.gif" /></p>
   843 				<p><b>Figure 4.2.6</b>: Distribute-letter ruby alignment</p>
   844 			</div>
   845 		</dd>
   847 		<dt><dfn title="ruby-align:distribute-space">''distribute-space''</dfn></dt>
   848 		<dd>If the width of the ruby text is smaller than that of the base, then
   849 			the ruby text contents are evenly distributed across the width of the
   850 			base, with a certain amount of white space preceding the first and
   851 			following the last character in the ruby text. That amount of white
   852 			space is normally equal to half the amount of inter-character space of
   853 			the ruby text. If the width of the ruby text is at least the width of
   854 			the base, then the same type of space distribution applies to the base.
   855 			In other words, if the base is shorter than the ruby text, the base is
   856 			distribute-space aligned. This type of alignment
   857 			is described by [[JLREQ]].
   859 			<div class="figure">
   860 				<p><img width="145" height="91"
   861 					alt="Diagram of glyph layout in distribute-space aligned ruby when ruby text is shorter than base"
   862 					src="images/ra-ds.gif" /><img width="145" height="91"
   863 					alt="Diagram of glyph layout in distribute-space aligned ruby when ruby text is longer than base"
   864 					src="images/ra-ds-rb.gif" /></p>
   865 				<p><b>Figure 4.2.7</b>: Distribute-space ruby alignment</p>
   866 			</div>
   867 		</dd>
   869 		<!--
   870   <dt><strong>line-edge</strong></dt>
   871     <dd>If the ruby text is not adjacent to a line edge, it is aligned as in
   872       'auto'. If it is adjacent to a line edge, then it is still aligned as in
   873       auto, but the side of the ruby text that touches the end of the line is
   874       lined up with the corresponding edge of the base. This type of alignment
   875       is described by [[JLREQ]]. This type of alignment is
   876       relevant only to the scenario where the ruby text is longer than the
   877       ruby base. In the other scenarios, this is just 'auto'.
   878 		<div class="figure">
   879       <p><img class="example" width="146" height="109"
   880       alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is shorter than base"
   881       src="images/ra-le-l.gif" /><img class="example" width="146"
   882       height="110"
   883       alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is longer than base"
   884       src="images/ra-le-r.gif" /></p>
   885       <p><b>Figure 4.2.8</b>: Line edge ruby alignment</p>
   886       </div>
   887     </dd>
   888 		-->
   889 	</dl>
   891 	<p>For a complex ruby with spanning elements, one additional consideration is
   892 		required. If the spanning element spans multiple 'rows' (other rbc or rtc
   893 		elements), and the ruby alignment requires space distribution among the
   894 		'spanned' elements, a ratio must be determined among the 'columns' of spanned
   895 		elements. This ratio is computed by taking into consideration the widest
   896 		element within each column.</p>
   898 <h2 id="edge-effects">
   899 Edge Effects</h2>
   901 <h3 id="ruby-overhang">
   902 Overhanging Ruby</h3>
   904 	<p>
   905 		When <i>ruby annotation box</i> is longer than its corresponding <i>ruby base box</i>,
   906 		the <i>ruby annotation box</i> may partially overhang adjacent boxes.
   907 	</p>
   908 	<p>
   909 		This level of the specification does not define
   910 		how much the overhang may be allowed, and under what conditions.
   911 	</p>
   913 	<p>If the ruby text is not allowed to overhang,
   914 	then the ruby behaves like a traditional inline box,
   915 	i.e. only its own contents are rendered within its boundaries
   916 	and adjacent elements do not cross the box boundary:
   918 	<div class="figure">
   919 		<p><img src="images/ro-n.gif"
   920 		        alt="Diagram showing the ruby boxes interacting with adjacent text">
   921 		<p class="caption">Simple ruby whose text is not allowed to overhang adjacent text
   922 	</div>
   924 	<p>However, if <i>ruby annotation</i> content is allowed to overhang adjacent elements
   925 	and it happens to be wider than its base,
   926 	then the adjacent content is partially rendered within the area of the <i>ruby container box</i>,
   927 	while the <i>ruby annotation</i> may partially overlap the upper blank parts of the adjacent content:
   929 	<div class="figure">
   930 	<p><img src="images/ro-a.gif"
   931 		      alt="Diagram showing the ruby boxes interacting with adjacent text">
   932 	<p class="caption">Simple ruby whose text is allowed to overhang adjacent text
   933 	</div>
   935 	<p>The <i>ruby annotations</i> related to a <i>ruby base</i>
   936 	must never overhang another <i>ruby base</i>.
   938 	<p>The alignment of the contents of the base or the ruby text
   939 	is not affected by overhanging behavior.
   940 	The alignment is achieved the same way regardless of the overhang behavior setting
   941 	and it is computed before the space available for overlap is determined.
   942 	It is controlled by the 'ruby-align' property.
   944 	<p>This entire logic applies the same way in vertical ideographic layout,
   945 	only the dimension in which it works in such a layout is vertical,
   946 	instead of horizontal.
   948 	<div class="example">
   949 	<p>
   950 		The user agent may use [[JIS4051]] recommendation of
   951 		using one ruby text character length as the maximum overhang length.
   952 		Detailed rules for how ruby text can overhang adjacent characters for Japanese are described by [[JLREQ]].
   953 	</p>
   954 	</div>
   956 <h3 id="line-edge">
   957 Line-edge Alignment</h3>
   959 	<p>
   960 		When a <i>ruby annotation box</i> that is longer than its <i>ruby base</i>
   961 		is at the start or end edge of a line,
   962 		the user agent <em>may</em> force the side of the <i>ruby annotation</i> that touches the edge of the line
   963 		to align to the corresponding edge of the base.
   964 		This type of alignment is described by [[JLREQ]].
   965 	</p>
   966 	<p>
   967 		This level of the specification does not provide a mechanism to control this behavior.
   968 	</p>
   969 	<div class="figure">
   970 		<p><img src="images/ra-le-l.gif"
   971 			alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is shorter than base">
   972 			<img src="images/ra-le-r.gif"
   973 			alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is longer than base">
   974 		<p class="caption">Line-edge alignment
   975 	</div>
   977 	<!--
   978 <h3 id="rubyover">
   979 Ruby overhanging: the 'ruby-overhang' property</h3>
   981   <table class="propdef">
   982     <tr>
   983       <th>Name:
   984       <td><dfn>ruby-overhang</dfn>
   985     <tr>
   986       <th>Value:
   987       <td>auto | start | end | none
   988     <tr>
   989       <th>Initial:
   990       <td>none
   991     <tr>
   992       <th>Applies to:
   993       <td>the parent of elements with display: ruby-text
   994     <tr>
   995       <th>Inherited:
   996       <td>yes
   997     <tr>
   998       <th>Percentages:
   999       <td>N/A
  1000     <tr>
  1001       <th>Media:
  1002       <td>visual
  1003     <tr>
  1004       <th>Computed value:
  1005       <td>specified value (except for initial and inherit)
  1006   </table>
  1008 <p>This property determines whether, and on which side, ruby text is allowed
  1009 to partially overhang any adjacent text in addition to its own base, when the
  1010 ruby text is wider than the ruby base. Note that ruby text is never allowed to
  1011 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
  1012 a maximum amount by which ruby text may overhang adjacent text. The user agent may use
  1013 the [[JIS4051]] recommendation of using one ruby text character
  1014 length as the maximum overhang length. Detailed rules for how ruby text can overhang adjacent characters for Japanese are described by [[JLREQ]].</p>
  1016 <p>Possible values:</p>
  1017 <dl>
  1018   <dt><strong>auto</strong></dt>
  1019     <dd>The ruby text can overhang text adjacent to the base on either side.   	  [[JLREQ]] and [[JIS4051]] specify the categories of characters that
  1020       ruby text can overhang. The user agent is free to follow those recommendations or specify its own classes of
  1021       characters to overhang. This is the initial value.
  1022 		<div class="figure">
  1023       <p><img class="example" width="177" height="91"
  1024       alt="Diagram of glyph layout in overhanging ruby" src="images/ro-a.gif" /></p>
  1025       <p><b>Figure 4.3.1</b>: Ruby overhanging adjacent text</p>
  1026       </div>
  1027     </dd>
  1028   <dt><strong>start</strong></dt>
  1029     <dd>The ruby text can only overhang the text that precedes it. That means, for
  1030       example, that ruby cannot overhang text that is to the right of it in
  1031       horizontal LTR layout, and it cannot overhang text that is below it in
  1032       vertical-ideographic layout.
  1033 		<div class="figure">
  1034       <p><img class="example" width="199" height="91"
  1035       alt="Diagram of glyph layout when ruby overhangs the preceding glyphs only"
  1036       src="images/ro-s.gif" /></p>
  1037       <p><b>Figure 4.3.2</b>: Ruby overhanging preceding text only</p>
  1038       </div>
  1039     </dd>
  1040   <dt><strong>end</strong></dt>
  1041     <dd>The ruby text can only overhang the text that follows it. That means, for
  1042       example, that ruby cannot overhang text that is to the left of it in
  1043       horizontal LTR layout, and it cannot overhang text that is above it in
  1044       vertical-ideographic layout.
  1045 		<div class="figure">
  1046       <p><img class="example" width="198" height="91"
  1047       alt="Diagram of glyph layout when ruby overhangs the following characters only"
  1048       src="images/ro-e.gif" /></p>
  1049       <p><b>Figure 4.3.3</b>: Ruby overhanging following text only</p>
  1050       </div>
  1051     </dd>
  1052   <dt><strong>none</strong></dt>
  1053     <dd>The ruby text cannot overhang any text adjacent to its base, only its
  1054       own base.
  1056       <div class="figure">
  1057       <p><img class="example" width="220" height="91"
  1058       alt="Diagram of glyph layout in non-overhanging ruby"
  1059       src="images/ro-n.gif" /></p>
  1060       <p><b>Figure 4.3.4</b>: Ruby not allowed to overhang adjacent text</p>
  1061       </div>
  1062     </dd>
  1063 </dl>
  1065 <h3 id="rubyspan">
  1066 Ruby annotation spanning: the 'ruby-span' property</h3>
  1068   <table class="propdef">
  1069     <tr>
  1070       <th>Name:
  1071       <td><dfn>ruby-span</dfn>
  1072     <tr>
  1073       <th>Value:
  1074       <td>attr(x) |  none
  1075     <tr>
  1076       <th>Initial:
  1077       <td>none
  1078     <tr>
  1079       <th>Applies to:
  1080       <td>elements with display: ruby-text
  1081     <tr>
  1082       <th>Inherited:
  1083       <td>no
  1084     <tr>
  1085       <th>Percentages:
  1086       <td>N/A
  1087     <tr>
  1088       <th>Media:
  1089       <td>visual
  1090     <tr>
  1091       <th>Computed value:
  1092       <td>&lt;number&gt;
  1093   </table>
  1095 <p>This property controls the spanning behavior of annotation elements. </p>
  1097 <p class="note"><span class="note-label">Note:</span> A XHTML user agent may also use the <samp>rbspan</samp> 
  1098 attribute to get the same effect.</p>
  1100 <p>Possible values:</p>
  1102 <dl>
  1103   <dt><strong>attr(x)</strong></dt>
  1104     <dd>The value of attribute 'x' as a string value. The string value is 
  1105     evaluated as a &lt;number&gt; to determine the number of ruby base elements to be 
  1106     spanned by the annotation element. If the &lt;number&gt; is &#39;0&#39;, it is replaced by 
  1107     &#39;1&#39;.The &lt;number&gt; is the computed value. </dd>
  1108   <dt>none</dt>
  1109   <dd>No spanning. The computed value is &#39;1&#39;.</dd>
  1110 </dl>
  1112 <p>The following example shows an XML example using the 'display' property 
  1113 values associated with the 'ruby structure and the 'ruby-span' property</p>
  1114 <pre class="xml">myruby       { display: ruby; }
  1115 myrbc        { display: ruby-base-container; }
  1116 myrb         { display: ruby-base; }
  1117 myrtc.before { display: ruby-text-container; ruby-position: before}
  1118 myrtc.after  { display: ruby-text-container; ruby-position: after}
  1119 myrt         { display: ruby-text; ruby-span: attr(rbspan); }
  1120 ...
  1121 &lt;myruby&gt;
  1122   &lt;myrbc&gt;
  1123     &lt;myrb&gt;10&lt;/myrb&gt;
  1124     &lt;myrb&gt;31&lt;/myrb&gt;
  1125     &lt;myrb&gt;2002&lt;/myrb&gt;
  1126   &lt;/myrbc&gt;
  1127   &lt;myrtc class=&quot;before&quot;&gt;
  1128     &lt;myrt&gt;Month&lt;/myrt&gt;
  1129     &lt;myrt&gt;Day&lt;/myrt&gt;
  1130     &lt;myrt&gt;Year&lt;/myrt&gt;
  1131   &lt;/myrtc&gt;
  1132   &lt;myrtc class=&quot;after&quot;&gt;
  1133     &lt;myrt rbspan=&quot;3&quot;&gt;Expiration Date&lt;/myrt&gt;
  1134   &lt;/myrtc&gt;
  1135 &lt;/myruby&gt;</pre>
  1136 	-->
  1138 <h2 id="default-stylesheet" class="no-num">
  1139 Appendix A: Default Style Sheet</h2>
  1141 	<p><em>This section is informative.</em>
  1143 <h3 id="default-ua-ruby" class="no-num">
  1144 <span class="secno">A.1</span> Supporting Ruby Layout</h3>
  1146 	<p>The following represents a default UA style sheet
  1147 	for rendering HTML and XHTML ruby markup as ruby layout:
  1149 	<pre>
  1150 <!--	-->ruby { display: ruby; }
  1151 <!--	-->rb   { display: ruby-base; white-space: nowrap; }
  1152 <!--	-->rt   { display: ruby-text; white-space: nowrap; font-size: 50%; }
  1153 <!--	-->rbc  { display: ruby-base-container; }
  1154 <!--	-->rtc  { display: ruby-text-container; }</pre>
  1156 	<p>Additional rules for UAs supporting the relevant features of [[CSS3-TEXT-DECOR]] and [[CSS3-FONTS]]:
  1157 	<pre>rt { font-variant-east-asian: ruby; text-emphasis: none; }</pre>
  1159 	<p class="note">Authors should not use the above rules;
  1160 	a UA that supports ruby layout should provide these by default.
  1162 <h3 id="default-inline" class="no-num">
  1163 <span class="secno">A.2</span> Inlining Ruby Annotations</h3>
  1165 	<p>The following represents a sample style sheet
  1166 	for rendering HTML and XHTML ruby markup as inline annotations:
  1168 	<pre>ruby, rb, rt, rbc, rtc, rp {
  1169 <!--	-->  display: inline; white-space: inherit;
  1170 <!--	-->  font-variant-east-asian: inherit; text-emphasis: inherit; }</pre>
  1172 <h3 id="default-parens" class="no-num">
  1173 <span class="secno">A.3</span> Generating Parentheses</h3>
  1175 	<p>Unfortunately, because Selectors cannot match against text nodes,
  1176 	it's not possible with CSS to express rules that will automatically and correctly
  1177 	add parentheses to unparenthesized ruby annotations in HTML.
  1178 	(This is because HTML ruby allows implying the <i>ruby base</i> from raw text, without a corresponding element.)
  1179 	However, these rules will handle cases where either <code>&lt;rb&gt;</code>
  1180 	or <code>&lt;rtc&gt;</code> is used rigorously.
  1182 	<pre>
  1183 <!--	-->/* Parens around &lt;rtc> */
  1184 <!--	-->rtc::before { content: "("; }
  1185 <!--	-->rtc::after  { content: ")"; }
  1187 <!--	-->/* Parens before first &lt;rt> not inside &lt;rtc> */
  1188 <!--	-->rb  + rt::before,
  1189 <!--	-->rtc + rt::before { content: "("; }
  1191 <!--	-->/* Parens after &lt;rt> not inside &lt;rtc> */
  1192 <!--	-->rb ~ rt:last-child::after,
  1193 <!--	-->rt + rb::before  { content: ")"; }
  1194 <!--	-->rt + rtc::before { content: ")("; }</pre>
  1196 <h2 id="glossary">
  1197 Glossary</h2>
  1198 <dl>
  1199   <dt><a id="g-bopomofo"><strong><span
  1200   lang="zh">Bopomofo</span></strong></a></dt>
  1201     <dd>37 characters and 4 tone markings used as phonetics in Chinese,
  1202       especially standard Mandarin.</dd>
  1203   <dt><a id="g-hanja"><strong><span
  1204   lang="ko">Hanja</span></strong></a></dt>
  1205     <dd>Subset of the Korean writing system that utilizes ideographic
  1206       characters borrowed or adapted from the Chinese writing system. Also see
  1207       <a href="#g-kanji"><span lang="ja">Kanji</span></a>.</dd>
  1208   <dt><a id="g-hiragana"><strong><span
  1209   lang="ja">Hiragana</span></strong></a></dt>
  1210     <dd>Japanese syllabic script, or character of that script. Rounded and 
  1211     cursive in appearance. Subset of the Japanese writing system, used together 
  1212     with kanji and katakana. In recent times, mostly used to write Japanese 
  1213     words when kanji are not available or appropriate, and word endings and 
  1214     particles. Also see <a
  1215       href="#g-katakana"><span lang="ja">Katakana</span></a>.</dd>
  1216   <dt><a id="g-ideogram"><strong>Ideograph</strong></a></dt>
  1217     <dd>A character that is used to represent an idea, word, or word component, 
  1218     in contrast to a character from an alphabetic or syllabic script. The most 
  1219     well-known ideographic script is used (with some variation) in East Asia 
  1220     (China, Japan, Korea,...).</dd>
  1221   <dt><a id="g-kana"><strong><span lang="ja">Kana</span></strong></a></dt>
  1222     <dd>Collective term for hiragana and katakana.</dd>
  1223   <dt><a id="g-kanji"><strong>Kanji</strong></a></dt>
  1224     <dd>Japanese term for ideographs; ideographs used in Japanese. Subset of the 
  1225     Japanese writing system, used together with hiragana and katakana. Also see <a
  1226       href="#g-hanja"><span lang="ko">Hanja</span></a>.</dd>
  1227   <dt><a id="g-katakana"><strong><span
  1228   lang="ja">Katakana</span></strong></a></dt>
  1229     <dd>Japanese syllabic script, or character of that script. Angular in 
  1230     appearance. Subset of the Japanese writing system,&nbsp; used together with 
  1231     kanji and hiragana. In recent times, mainly used to write foreign words. Also see <a
  1232       href="#g-hiragana"><span lang="ja">Hiragana</span></a>.</dd>
  1233   <dt><a id="g-monoruby" name="g-monoruby"><strong>Mono-ruby</strong></a></dt>
  1234     <dd>In Japanese typography: Ruby associated with a single character of
  1235       the base text.</dd>
  1236   <dt><a id="g-ruby"><strong>Ruby</strong></a></dt>
  1237     <dd>A run of text that appears in the vicinity of another run of text and
  1238       serves as an annotation or a pronunciation guide for that text.</dd>
  1239 </dl>
  1241 <h2 id="conformance">
  1242 Conformance</h2>
  1244 <h3 id="conventions">
  1245 Document conventions</h3>
  1247   <p>Conformance requirements are expressed with a combination of
  1248   descriptive assertions and RFC 2119 terminology. The key words “MUST”,
  1249   “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
  1250   “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
  1251   document are to be interpreted as described in RFC 2119.
  1252   However, for readability, these words do not appear in all uppercase
  1253   letters in this specification.
  1255   <p>All of the text of this specification is normative except sections
  1256   explicitly marked as non-normative, examples, and notes. [[!RFC2119]]</p>
  1258   <p>Examples in this specification are introduced with the words “for example”
  1259   or are set apart from the normative text with <code>class="example"</code>,
  1260   like this:
  1262   <div class="example">
  1263     <p>This is an example of an informative example.</p>
  1264   </div>
  1266   <p>Informative notes begin with the word “Note” and are set apart from the
  1267   normative text with <code>class="note"</code>, like this:
  1269   <p class="note">Note, this is an informative note.</p>
  1271 <h3 id="conformance-classes">
  1272 Conformance classes</h3>
  1274   <p>Conformance to CSS Ruby Module
  1275   is defined for three conformance classes:
  1276   <dl>
  1277     <dt><dfn title="style sheet!!as conformance class">style sheet</dfn>
  1278       <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
  1279       style sheet</a>.
  1280     <dt><dfn>renderer</dfn></dt>
  1281       <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  1282       that interprets the semantics of a style sheet and renders
  1283       documents that use them.
  1284     <dt><dfn id="authoring-tool">authoring tool</dfn></dt>
  1285       <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
  1286       that writes a style sheet.
  1287   </dl>
  1289   <p>A style sheet is conformant to CSS Ruby Module
  1290   if all of its statements that use syntax defined in this module are valid
  1291   according to the generic CSS grammar and the individual grammars of each
  1292   feature defined in this module.
  1294   <p>A renderer is conformant to CSS Ruby Module
  1295   if, in addition to interpreting the style sheet as defined by the
  1296   appropriate specifications, it supports all the features defined
  1297   by CSS Ruby Module by parsing them correctly
  1298   and rendering the document accordingly. However, the inability of a
  1299   UA to correctly render a document due to limitations of the device
  1300   does not make the UA non-conformant. (For example, a UA is not
  1301   required to render color on a monochrome monitor.)
  1303   <p>An authoring tool is conformant to CSS Ruby Module
  1304   if it writes style sheets that are syntactically correct according to the
  1305   generic CSS grammar and the individual grammars of each feature in
  1306   this module, and meet all other conformance requirements of style sheets
  1307   as described in this module.
  1309 <h3 id="partial">
  1310 Partial implementations</h3>
  1312   <p>So that authors can exploit the forward-compatible parsing rules to
  1313   assign fallback values, CSS renderers <strong>must</strong>
  1314   treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore
  1315   as appropriate</a>) any at-rules, properties, property values, keywords,
  1316   and other syntactic constructs for which they have no usable level of
  1317   support. In particular, user agents <strong>must not</strong> selectively
  1318   ignore unsupported component values and honor supported values in a single
  1319   multi-value property declaration: if any value is considered invalid
  1320   (as unsupported values must be), CSS requires that the entire declaration
  1321   be ignored.</p>
  1323 <h3 id="experimental">
  1324 Experimental implementations</h3>
  1326   <p>To avoid clashes with future CSS features, the CSS2.1 specification
  1327   reserves a <a href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
  1328   syntax</a> for proprietary and experimental extensions to CSS.
  1330   <p>Prior to a specification reaching the Candidate Recommendation stage
  1331   in the W3C process, all implementations of a CSS feature are considered
  1332   experimental. The CSS Working Group recommends that implementations
  1333   use a vendor-prefixed syntax for such features, including those in
  1334   W3C Working Drafts. This avoids incompatibilities with future changes
  1335   in the draft.
  1336   </p>
  1338 <h3 id="testing">
  1339 Non-experimental implementations</h3>
  1341   <p>Once a specification reaches the Candidate Recommendation stage,
  1342   non-experimental implementations are possible, and implementors should
  1343   release an unprefixed implementation of any CR-level feature they
  1344   can demonstrate to be correctly implemented according to spec.
  1346   <p>To establish and maintain the interoperability of CSS across
  1347   implementations, the CSS Working Group requests that non-experimental
  1348   CSS renderers submit an implementation report (and, if necessary, the
  1349   testcases used for that implementation report) to the W3C before
  1350   releasing an unprefixed implementation of any CSS features. Testcases
  1351   submitted to W3C are subject to review and correction by the CSS
  1352   Working Group.
  1354   <p>Further information on submitting testcases and implementation reports
  1355   can be found from on the CSS Working Group's website at
  1356   <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
  1357   Questions should be directed to the
  1358   <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
  1359   mailing list.
  1361 <h2 class=no-num id="acknowledgments">
  1362 Acknowledgments</h2>
  1364 <p>This specification would not have been possible without the help from:</p>
  1366 <p>Stephen Deach, Martin Dürst,  Hideki Hiura(<span lang="ja">樋浦 秀樹</span>), Masayasu Ishikawa(<span lang="ja">石川
  1367 雅康</span>), Chris
  1368 Pratley, Takao Suzuki(<span lang="ja">鈴木 孝雄</span>), Frank Yung-Fong Tang, Chris Thrasher, Masafumi Yabe<span lang="ja">家辺
  1369 勝文</span>), Steve Zilles.</p>
  1371 <h2 class="no-num" id="changes">
  1372 Changes</h2>
  1374 	<p>The following major changes have been made since the previous Working Draft:
  1375 	<dl>
  1376 		<dt>Remove 'ruby-span' and mentions of <code>rbspan</code>.
  1377 		<dd>
  1378 			Explicit spanning is not used in HTML ruby in favor of implicit spanning.
  1379 			This can't handle some pathological double-sided spanning cases,
  1380 			but there seems to be no requirement for these at the moment.
  1381 			(For implementations that support full complex XHTML Ruby,
  1382 			they can imply spanning from the markup the same magic way
  1383 			that we handle cell spanning from tables. It doesn't seem
  1384 			necessary to include controls this in Level 1.)
  1386 		<dt>Defer 'ruby-overhang' and ''ruby-align: line-end'' to Level 2.
  1387 		<dd>
  1388 			It's somewhat complicated, advanced feature.
  1389 			Proposal is to make this behavior UA-defined
  1390 			and provide some examples of acceptable options.
  1392 		<dt>Close issue requesting 'display: rp': use ''display: none''.
  1393 		<dd>
  1394 			The i18nwg added an issue requesting a display value for &lt;rp> elements.
  1395 			They're supposed to be hidden when &tl;ruby> is displayed as ruby.
  1396 			But this is easily accomplished already with ''display: none''.
  1398 		<dt>Change 'ruby-position' values to match 'text-emphasis-position'.
  1399 		<dd>
  1400 			Other than ''inter-character'', which we need to keep,
  1401 			it makes more sense to align ruby positions with 'text-emphasis-position',
  1402 			which can correctly handle various combinations of horizontal/vertical preferences.
  1404 		<dt>Remove unused values of 'ruby-align'.
  1405 		<dd>
  1406 			'left', 'right', and 'end' are not needed.
  1408 		<dt>Added 'ruby-merge' property to control jukugo rendering.
  1409 		<dd>
  1410 			This is a stylistic effect, not a structural one;
  1411 			the previous model assumed that it was structural and suggested handling it by changing markup. :(
  1413 		<dt>Remove ''inline'' from 'ruby-position'.
  1414 		<dd>
  1415 			This is do-able via ''display: inline'' on all the ruby-related elements,
  1416 			see <a href="#default-inline">Appendix A</a>
  1418 		<dt>Added <a href="#default-style">Default Style</a> rules
  1419 		<dd>
  1420 			As requested by i18nwg.
  1422 		<dt>Wrote anonymous box generation rules
  1423 		<dd>
  1424 			And defined pairing of bases and annotations.
  1425 			Should now handle all the crazy proposed permutations of HTML ruby markup.
  1426 	</dl>
  1428 <h2 class=no-num id="references">
  1429 References</h2>
  1431 <h3 class="no-num" id="normative-references">
  1432 Normative references</h3>
  1433 <!--normative-->
  1435 <h3 class="no-num" id="other-references">
  1436 Other references</h3>
  1437 <!--informative-->
  1439 <h2 class="no-num" id="index">
  1440 Index</h2>
  1441 <!--index-->
  1443 <h2 class="no-num" id="property-index">
  1444 Property index</h2>
  1445 <!-- properties -->
  1447 </body>
  1448 </html>
  1449 <!-- Keep this comment at the end of the file
  1450 Local variables:
  1451 mode: sgml
  1452 sgml-declaration:"~/SGML/HTML4.decl"
  1453 sgml-default-doctype-name:"html"
  1454 sgml-minimize-attributes:t
  1455 sgml-nofill-elements:("pre" "style" "br")
  1456 sgml-live-element-indicator:t
  1457 sgml-omittag:nil
  1458 sgml-shorttag:nil
  1459 sgml-namecase-general:t
  1460 sgml-general-insert-case:lower
  1461 sgml-always-quote-attributes:t
  1462 sgml-indent-step:nil
  1463 sgml-indent-data:t
  1464 sgml-parent-document:nil
  1465 sgml-exposed-tags:nil
  1466 sgml-local-catalogs:nil
  1467 sgml-local-ecat-files:nil
  1468 End:
  1469 -->

mercurial