Skip to content

Commit 7f22e91

Browse files
committed
[css-ruby] Organize ruby overhang information together
1 parent 6391884 commit 7f22e91

2 files changed

Lines changed: 123 additions & 326 deletions

File tree

css-ruby/Overview.html

Lines changed: 68 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,14 @@ <h2 class="no-num no-toc" id=contents> Table of Contents</h2>
232232
property</a>
233233
</ul>
234234

235-
<li><a href="#rubyover"><span class=secno>4. </span> Ruby Overhang and
236-
Edge Effects</a>
235+
<li><a href="#edge-effects"><span class=secno>4. </span> Edge Effects</a>
236+
<ul class=toc>
237+
<li><a href="#ruby-overhang"><span class=secno>4.1. </span> Overhanging
238+
Ruby</a>
239+
240+
<li><a href="#line-edge"><span class=secno>4.2. </span> Line-edge
241+
Alignment</a>
242+
</ul>
237243

238244
<li class=no-num><a href="#default-stylesheet"> Appendix A: Default Style
239245
Sheet</a>
@@ -652,165 +658,6 @@ <h3 id=box-model><span class=secno>2.4. </span> Generating Ruby Structure</h3>
652658

653659
<h3 id=box-model><span class=secno>2.5. </span> Ruby box model</h3>
654660

655-
<p>In the following description, the elements specified by Ruby Annotation
656-
<a href="#RUBY" rel=biblioentry>[RUBY]<!--{{RUBY}}--></a> are used to
657-
describe the box model. As mentioned earlier, a user agent can obtain the
658-
same results by using the Ruby specific ‘<code
659-
class=property>display</code>’ property values.
660-
661-
<p>For a user agent that supports the ruby markup, the ruby structure
662-
consists of three or more boxes. The outermost container is the <a
663-
href="http://www.w3.org/TR/ruby/#ruby"><samp>ruby</samp></a> element
664-
itself. In the simple case, it is a container for two non-overlapping
665-
boxes: the ruby text box (<a
666-
href="http://www.w3.org/TR/ruby/#rt"><samp>rt</samp></a> element) and the
667-
ruby base box (<a href="http://www.w3.org/TR/ruby/#rb"><samp>rb</samp></a>
668-
element). The positioning of these two boxes relative to each other is
669-
controlled by the <a href="#rubypos"><code
670-
class=property>ruby-position</code></a> property.
671-
672-
<div class=figure> <img
673-
alt="Diagram of the ruby box model consisting of two boxes, one on top of the other, enclosed within a third box representing the ruby element"
674-
class=example height=93 src="images/r-box-t.gif" width=223>
675-
<p><b>Figure 3.2.1</b>: Ruby box model (simple case)
676-
</div>
677-
678-
<p>In the case of complex ruby, the ruby element is a container for two or
679-
three non-overlapping boxes: one ruby base collection (<a
680-
href="http://www.w3.org/TR/ruby/#rbc"><samp>rbc</samp></a> element), and
681-
one or two ruby text collections (<a
682-
href="http://www.w3.org/TR/ruby/#rtc"><samp>rtc</samp></a> element). The
683-
<samp>rbc</samp> element is itself a container for one or several ruby
684-
base box (<samp>rb</samp> element), while each <samp>rtc</samp> element is
685-
a container for one or several ruby text box (rt element). The position of
686-
the <samp>rtc</samp> element in relation to the related <samp>rbc</samp>
687-
element is controlled by the <a href="#rubypos"><code
688-
class=property>ruby-position</code></a> property. The two following
689-
figures show examples of these complex ruby.
690-
691-
<div class=figure> <img
692-
alt="Diagram of a group ruby with a full ruby text above and partial ruby text below"
693-
height=170 src="images/r-box-g.gif" width=408>
694-
<p><b>Figure 3.2.2</b>: Ruby box model (complex ruby with an empty rt
695-
element after)
696-
</div>
697-
698-
<p>In the example above, the ruby text after (below) the ruby bases
699-
contains two <samp>rt</samp> elements with the first one being empty, the
700-
empty <samp>rt</samp> element corresponds to the first part of the ruby
701-
base collection (the first part is identified by the first <samp>rb</samp>
702-
element within the <samp> rbc</samp> element).
703-
704-
<div class=figure> <img
705-
alt="Diagram of a group ruby with a spanning ruby text above and partial ruby text below"
706-
height=173 src="images/r-box-h.gif" width=400>
707-
<p><b>Figure 3.2.3</b>: Ruby box model (complex ruby with a spanning ruby
708-
text element)
709-
</div>
710-
711-
<p>In the example above, the ruby text before (above) the ruby bases spans
712-
the whole ruby base collection. The ruby text after (below) the ruby bases
713-
still contain two <samp>rt</samp> elements, one of which is empty. The
714-
spanning behavior of <samp>rt</samp> text elements is controlled by the <a
715-
href="http://www.w3.org/TR/ruby/#ruby"><samp>rbspan</samp></a> attribute
716-
in a way similar to the <samp>colspan</samp> attribute used for table
717-
column.
718-
719-
<p class=issue><span class=issuehead>Issue: </span> The examples above
720-
contain the term ‘<code class=css>group ruby</code>’, which is not
721-
used elsewhere in this specification. It appears to be used in a way that
722-
is different to the use of the term in JLREQ. I propose to replace it with
723-
just ‘<a href="#ruby"><code class=property>ruby</code></a>’.
724-
725-
<p class=note><span class=note-label>Note:</span> The visual description of
726-
the ruby elements does not refer necessarily to the logical orders of the
727-
elements
728-
729-
<p>The width of the ruby box is by default determined by its widest child
730-
element, whose width in turn is determined by its content. The width of
731-
all direct children of the <a href="#ruby"><samp>ruby</samp></a> element
732-
is the width of the widest children. In this respect, the ruby box is much
733-
like a two or three row <samp>table</samp> element, with the following
734-
exceptions:
735-
736-
<ul>
737-
<li>the ruby box is an inline element, like an image, even though it
738-
itself, like a table, is a container of other boxes
739-
740-
<li>the equivalent of the cells: the <samp>rb</samp> element and the
741-
<samp>rt</samp> text element can only contain inline-level elements.
742-
743-
<li>the content of each ‘<code class=property>cell</code>’ is always
744-
measured at its maximum width
745-
746-
<li>unlike a table, a ruby element doesn't have to fit in a line, the ruby
747-
box may be split into several boxes at line boundary, depending of the
748-
spanning of the ruby texts. This is however only possible for the complex
749-
ruby and can only happen at the boundary of non spanning elements.
750-
751-
<li>both the ruby text and the ruby base boxes may overlap with adjacent
752-
text (outside of the ruby element) if an appropriate <a
753-
href="#rubyover"><code class=property>ruby-overhang</code></a>
754-
parameter is set via CSS. Note however that the actual content of the
755-
ruby base cannot overlap with that adjacent text. The distribution of the
756-
content of the ruby base within the ruby base box is controlled by the <a
757-
href="#rubyalign"><code class=property>ruby-align</code></a>
758-
property.
759-
</ul>
760-
761-
<p>If the ruby text is not allowed to overhang, then the ruby behaves like
762-
a traditional box, i.e. only its contents are rendered within its
763-
boundaries and adjacent elements do not cross the box boundary:
764-
765-
<div class=figure>
766-
<p><img
767-
alt="Diagram showing the ruby boxes interacting with adjacent text"
768-
class=example height=91 src="images/ro-n.gif" width=220>
769-
770-
<p><b>Figure 3.2.4</b>: Simple ruby whose text is not allowed to overhang
771-
adjacent text
772-
</div>
773-
774-
<p>However, if ruby text is allowed to overhang adjacent elements and it
775-
happens to be wider than its base, then the adjacent content is partially
776-
rendered within the area of the ruby base box, while the ruby text may be
777-
partially overlapping with the upper blank parts of the adjacent content:
778-
779-
<div class=figure>
780-
<p><img
781-
alt="Diagram showing the ruby boxes interacting with adjacent text"
782-
class=example height=91 src="images/ro-a.gif" width=177>
783-
784-
<p><b>Figure 3.2.5</b>: Simple ruby whose text is allowed to overhang
785-
adjacent text
786-
</div>
787-
788-
<p>The ruby text related to a ruby base can never overhang another ruby
789-
base.
790-
791-
<p>The alignment of the contents of the base or the ruby text is not
792-
affected by the overhanging behavior. The alignment is achieved the same
793-
way regardless of the overhang behavior setting and it is computed before
794-
the space available for overlap is determined. It is controlled by the <a
795-
href="#rubyalign"><code class=property>ruby-align</code></a>
796-
property.
797-
798-
<p>The exact circumstances in which the ruby text will overhang other
799-
elements, and to what degree it will do so, will be controlled by the <a
800-
href="#rubyover"><code class=property>ruby-overhang</code></a>
801-
property.
802-
803-
<p>This entire logic applies the same way in vertical ideographic layout,
804-
only the dimension in which it works in such a layout is vertical, instead
805-
of horizontal.
806-
807-
<p class=note><span class=note-label>Note:</span> Because the purpose of
808-
the XHTML <samp>rp</samp> element <a href="#RUBY"
809-
rel=biblioentry>[RUBY]<!--{{RUBY}}--></a> is to allow pre-existing user
810-
agents to parenthesize ruby text content, an XHTML user agent should use a
811-
styling rule for these elements that avoids rendering them such as 
812-
<samp>rp {display: none}</samp>.
813-
814661
<h3 id=ruby-line-height><span class=secno>2.6. </span> Ruby box and line
815662
stacking</h3>
816663

@@ -1401,16 +1248,62 @@ <h3 id=rubyalign><span class=secno>3.3. </span> Ruby Text Distribution: the
14011248
This ratio is computed by taking into consideration the widest element
14021249
within each column.
14031250

1404-
<h2 id=rubyover><span class=secno>4. </span> Ruby Overhang and Edge Effects</h2>
1251+
<h2 id=edge-effects><span class=secno>4. </span> Edge Effects</h2>
1252+
1253+
<h3 id=ruby-overhang><span class=secno>4.1. </span> Overhanging Ruby</h3>
14051254

14061255
<p> When <a href="#ruby-annotation-box"><i>ruby annotation box</i></a> is
14071256
longer than its corresponding <a href="#ruby-base-box"><i>ruby base
14081257
box</i></a>, the <a href="#ruby-annotation-box"><i>ruby annotation
14091258
box</i></a> may partially overhang adjacent boxes.
14101259

1411-
<p> This level of the specificaiton does not define how much the overhang
1260+
<p> This level of the specification does not define how much the overhang
14121261
may be allowed, and under what conditions.
14131262

1263+
<p>If the ruby text is not allowed to overhang, then the ruby behaves like
1264+
a traditional inline box, i.e. only its own contents are rendered within
1265+
its boundaries and adjacent elements do not cross the box boundary:
1266+
1267+
<div class=figure>
1268+
<p><img
1269+
alt="Diagram showing the ruby boxes interacting with adjacent text"
1270+
src="images/ro-n.gif">
1271+
1272+
<p class=caption>Simple ruby whose text is not allowed to overhang
1273+
adjacent text
1274+
</div>
1275+
1276+
<p>However, if <a href="#ruby-annotation-box"><i>ruby annotation</i></a>
1277+
content is allowed to overhang adjacent elements and it happens to be
1278+
wider than its base, then the adjacent content is partially rendered
1279+
within the area of the <a href="#ruby-container-box"><i>ruby container
1280+
box</i></a>, while the <a href="#ruby-annotation-box"><i>ruby
1281+
annotation</i></a> may partially overlap the upper blank parts of the
1282+
adjacent content:
1283+
1284+
<div class=figure>
1285+
<p><img
1286+
alt="Diagram showing the ruby boxes interacting with adjacent text"
1287+
src="images/ro-a.gif">
1288+
1289+
<p class=caption>Simple ruby whose text is allowed to overhang adjacent
1290+
text
1291+
</div>
1292+
1293+
<p>The <a href="#ruby-annotation-box"><i>ruby annotations</i></a> related
1294+
to a <a href="#ruby-base-box"><i>ruby base</i></a> must never overhang
1295+
another <a href="#ruby-base-box"><i>ruby base</i></a>.
1296+
1297+
<p>The alignment of the contents of the base or the ruby text is not
1298+
affected by overhanging behavior. The alignment is achieved the same way
1299+
regardless of the overhang behavior setting and it is computed before the
1300+
space available for overlap is determined. It is controlled by the ‘<a
1301+
href="#ruby-align"><code class=property>ruby-align</code></a>’ property.
1302+
1303+
<p>This entire logic applies the same way in vertical ideographic layout,
1304+
only the dimension in which it works in such a layout is vertical, instead
1305+
of horizontal.
1306+
14141307
<div class=example>
14151308
<p> The user agent may use <a href="#JIS4051"
14161309
rel=biblioentry>[JIS4051]<!--{{JIS4051}}--></a> recommendation of using
@@ -1420,23 +1313,27 @@ <h2 id=rubyover><span class=secno>4. </span> Ruby Overhang and Edge Effects</h2>
14201313
rel=biblioentry>[JLREQ]<!--{{JLREQ}}--></a>.
14211314
</div>
14221315

1423-
<p> When such <a href="#ruby-annotation-box"><i>ruby annotation box</i></a>
1424-
is at the start or end edge of a line, user agent may align the side of
1425-
the ruby text that touches the edge of the line to the corresponding edge
1426-
of the base. This type of alignment is described by <a href="#JLREQ"
1316+
<h3 id=line-edge><span class=secno>4.2. </span> Line-edge Alignment</h3>
1317+
1318+
<p> When a <a href="#ruby-annotation-box"><i>ruby annotation box</i></a>
1319+
that is longer than its <a href="#ruby-base-box"><i>ruby base</i></a> is
1320+
at the start or end edge of a line, the user agent <em>may</em> force the
1321+
side of the <a href="#ruby-annotation-box"><i>ruby annotation</i></a> that
1322+
touches the edge of the line to align to the corresponding edge of the
1323+
base. This type of alignment is described by <a href="#JLREQ"
14271324
rel=biblioentry>[JLREQ]<!--{{JLREQ}}--></a>.
14281325

1429-
<p> This level of the specificaiton does not provide a mechanism to control
1326+
<p> This level of the specification does not provide a mechanism to control
14301327
this behavior.
14311328

14321329
<div class=figure>
14331330
<p><img
14341331
alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is shorter than base"
1435-
height=109 src="images/ra-le-l.gif" width=146><img
1332+
src="images/ra-le-l.gif"> <img
14361333
alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is longer than base"
1437-
height=110 src="images/ra-le-r.gif" width=146>
1334+
src="images/ra-le-r.gif">
14381335

1439-
<p><b>Figure 4.2.8</b>: Line edge ruby alignment
1336+
<p class=caption>Line-edge alignment
14401337
</div>
14411338
<!--
14421339
<h3 id="rubyover">

0 commit comments

Comments
 (0)