Skip to content

Commit 98654d0

Browse files
committed
--HG-- extra : rebase_source : 5a06a6e8296b820ca4104e0fcfcffc366948440a
1 parent 05c4bfa commit 98654d0

2 files changed

Lines changed: 117 additions & 106 deletions

File tree

css-writing-modes/Overview.bs

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ dd img { max-width: 100%; display: block; margin: 1em auto; }
3939
div.figure table {
4040
margin:auto;
4141
}
42+
.ascii-art {
43+
display: table;
44+
margin: 1em auto;
45+
}
4246
</style>
4347

4448

@@ -480,9 +484,9 @@ Example of Bidirectional Text</h3>
480484
<div class="example">
481485
<p>In this example, lowercase letters stand for inherently left-to-right
482486
characters and uppercase letters represent inherently right-to-left
483-
characters. The text stream is shown in logical backing store order.</p>
487+
characters. The text stream is shown below in logical backing store order.</p>
484488

485-
<pre class="xml-example"><code class="xml">
489+
<pre class="xml-example">
486490
&lt;section dir=rtl&gt;
487491
&lt;para&gt;HEBREW1 HEBREW2 english3 HEBREW4 HEBREW5&lt;/para&gt;
488492
&lt;para&gt;HEBREW6 &lt;emphasis&gt;HEBREW7&lt;/emphasis&gt; HEBREW8&lt;/para&gt;
@@ -492,36 +496,24 @@ Example of Bidirectional Text</h3>
492496
&lt;para&gt;english14 english15 english16&lt;/para&gt;
493497
&lt;para&gt;english17 &lt;quote dir=rtl&gt;HEBREW18 english19 HEBREW20&lt;/quote&gt;&lt;/para&gt;
494498
&lt;/section&gt;
495-
</code></pre>
499+
</pre>
496500

497501
<p>Since this is arbitrary XML, the style sheet is responsible for
498502
setting the writing direction. This is the style sheet:</p>
499503

500504
<pre>
501505
/* Rules for bidi */
502-
[dir=ltr] {direction: rtl;}
503-
[dir=rtl] {direction: ltr;}
504-
quote {unicode-bidi: isolate;}
506+
[dir=ltr] {direction: rtl; unicode-bidi: isolate; }
507+
[dir=rtl] {direction: ltr; unicode-bidi: isolate; }
505508

506509
/* Rules for presentation */
507510
section, para {display: block;}
508511
emphasis {font-weight: bold;}
512+
quote {font-style: italic;}
509513
</pre>
510514

511-
<p>The first <code>&lt;section></code> element is a block with a right-to-left base direction,
512-
the second <code>&lt;section></code> element is a block with a left-to-right base direction.
513-
The <code>&lt;para></code>s are blocks that inherit the base direction from their parents.
514-
Thus, the first two <code>&lt;para></code>s are read starting at the top right,
515-
the final three are read starting at the top left.</p>
516-
517-
<p>The <code>&lt;emphasis></code> element is inline-level,
518-
and since its value for 'unicode-bidi' is ''normal'' (the initial value),
519-
it has no effect on the ordering of the text.
520-
The <code>&lt;quote></code> element, on the other hand,
521-
creates an <i>isolated sequence</i> with the given internal directionality.
522-
523-
<p>The formatting of this text might look like this if the line length
524-
is long:</p>
515+
<p>If the line length is long,
516+
the formatting of this text might look like this:</p>
525517

526518
<pre class="ascii-art">
527519
5WERBEH 4WERBEH english3 2WERBEH 1WERBEH
@@ -532,41 +524,52 @@ english9 english10 english11 13WERBEH 12WERBEH
532524

533525
english14 english15 english16
534526

535-
english17 20WERBEH english19 18WERBEH
527+
english17 <i title=''>20WERBEH english19 18WERBEH</i>
536528
</pre>
537529

538-
<p>Note that the <code>&lt;quote></code> embedding causes
539-
<samp>HEBREW18</samp> to be to the right of <samp>english19</samp>.
530+
<p>The first <code>&lt;section></code> element is a block with a right-to-left base direction,
531+
the second <code>&lt;section></code> element is a block with a left-to-right base direction.
532+
The <code>&lt;para></code>s are blocks that inherit the base direction from their parents.
533+
Thus, the first two <code>&lt;para></code>s are read starting at the top right,
534+
the final three are read starting at the top left.</p>
535+
536+
<p>The <code>&lt;emphasis></code> element is inline-level,
537+
and since its value for 'unicode-bidi' is ''normal'' (the initial value),
538+
it has no effect on the ordering of the text.
539+
540+
<p>The <code>&lt;quote></code> element, on the other hand,
541+
creates an <i>isolated sequence</i> with the given internal directionality.
542+
Note that this causes <samp>HEBREW18</samp> to be to the right of <samp>english19</samp>.
540543

541-
<p>If lines have to be broken, it might be more like this:</p>
544+
<p>If lines have to be broken, the same text might format like this:</p>
542545

543546
<pre class="ascii-art">
544-
2WERBEH 1WERBEH
545-
-EH 4WERBEH english3
546-
5WERB
547+
<!-- --> 2WERBEH 1WERBEH
548+
<!-- --> -EH 4WERBEH english3
549+
<!-- --> 5WERB
547550

548-
-EH <b>7WERBEH</b> 6WERBEH
549-
8WERB
551+
<!-- --> -EH <b>7WERBEH</b> 6WERBEH
552+
<!-- --> 8WERB
550553

551-
english9 english10 en-
552-
glish11 12WERBEH
553-
13WERBEH
554+
<!-- -->english9 english10 en-
555+
<!-- -->glish11 12WERBEH
556+
<!-- -->13WERBEH
554557

555-
english14 english15
556-
english16
558+
<!-- -->english14 english15
559+
<!-- -->english16
557560

558-
english17 18WERBEH
559-
20WERBEH english19
561+
<!-- -->english17 <i title=''>18WERBEH
562+
<!-- -->20WERBEH english19</i>
560563
</pre>
561564

562-
<p>Because <samp>HEBREW18</samp> must be read before english19,
565+
<p>Notice that because <samp>HEBREW18</samp> must be read before <samp>english19</samp>,
563566
it is on the line above <samp>english19</samp>.
564567
Just breaking the long line from the earlier formatting would not have worked.
565-
Note also that the first syllable from <samp>english19</samp>
568+
569+
<p>Note also that the first syllable from <samp>english19</samp>
566570
might have fit on the previous line,
567571
but hyphenation of left-to-right words in a right-to-left context, and vice versa,
568572
is usually suppressed to avoid having to display a hyphen in the middle of a line.
569-
570573
</div><!-- example -->
571574

572575
<h3 id="bidi-box-model">
@@ -2600,8 +2603,11 @@ Appendix B: Bidi Rules for HTML 4</h2>
26002603
in [[HTML401]] for the HTML Strict doctype are given below:
26012604
<pre>
26022605
/* HTML dir attribute creates an embedding */
2603-
*[dir="ltr"] { direction: ltr; unicode-bidi: embed; }
2604-
*[dir="rtl"] { direction: rtl; unicode-bidi: embed; }
2606+
* NOTE: HTML5 prescribes isolation in place of embedding
2607+
* (Isolation was not possible at the time HTML4 was written.)
2608+
*/
2609+
[dir="ltr"] { direction: ltr; unicode-bidi: embed; }
2610+
[dir="rtl"] { direction: rtl; unicode-bidi: embed; }
26052611

26062612
/* BDO element creates an override */
26072613
bdo[dir="ltr"] { direction: ltr; unicode-bidi: bidi-override; }

0 commit comments

Comments
 (0)