Skip to content

Commit fc97130

Browse files
committed
Clarifications to alignment-related side-effects of unicode-bidi: plaintext.
--HG-- extra : rebase_source : da17abf7b6a074ae0b91ffb215162aed5537cc49
1 parent 53fb3b5 commit fc97130

2 files changed

Lines changed: 108 additions & 34 deletions

File tree

css3-text/Overview.html

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232

3333
<h1>CSS Text Level 3</h1>
3434

35-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 24 April 2012</h2>
35+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 25 April 2012</h2>
3636

3737
<dl>
3838
<dt>This version:
3939

4040
<dd><a href="http://dev.w3.org/csswg/css3-text/">$Date$ (CVS
4141
$Revision$)</a> <!--
42-
<dd><a href="http://www.w3.org/TR/2012/WD-css3-text-20120424/">http://www.w3.org/TR/2012/WD-css3-text-20120424/</a></dd>
42+
<dd><a href="http://www.w3.org/TR/2012/WD-css3-text-20120425/">http://www.w3.org/TR/2012/WD-css3-text-20120425/</a></dd>
4343
-->
4444

4545

@@ -261,7 +261,10 @@ <h2 class="no-num no-toc" id=contents> Table of Contents</h2>
261261
<li><a href="#text-align"><span class=secno>7.1. </span> Text Alignment:
262262
the &lsquo;<code class=property>text-align</code>&rsquo; property</a>
263263
<ul class=toc>
264-
<li><a href="#character-alignment"><span class=secno>7.1.1.
264+
<li><a href="#bidi-linebox"><span class=secno>7.1.1. </span>
265+
Bidirectionality and Line Boxes</a>
266+
267+
<li><a href="#character-alignment"><span class=secno>7.1.2.
265268
</span>Character-based Alignment in a Table Column</a>
266269
</ul>
267270

@@ -1994,19 +1997,23 @@ <h3 id=text-align><span class=secno>7.1. </span> Text Alignment: the
19941997
href="http://dev.w3.org/csswg/css3-text/#white-space-rules">white space
19951998
processing rules</a>.
19961999

2000+
<h4 id=bidi-linebox><span class=secno>7.1.1. </span> Bidirectionality and
2001+
Line Boxes</h4>
2002+
19972003
<p>The start and end edges of a line box are determined by the inline base
1998-
direction of the "bidi paragraph" to which it belongs. In most cases, this
1999-
means using the containing block's computed &lsquo;<code
2000-
class=property>direction</code>&rsquo;. However if containing block has
2001-
&lsquo;<code class=css>unicode-bidi: plaintext</code>&rsquo; <a
2002-
href="#CSS3-WRITING-MODES"
2004+
direction of the line box. In most cases, this is given by its containing
2005+
block's computed &lsquo;<code class=property>direction</code>&rsquo;.
2006+
However if the containing block has &lsquo;<code class=css>unicode-bidi:
2007+
plaintext</code>&rsquo; <a href="#CSS3-WRITING-MODES"
20032008
rel=biblioentry>[CSS3-WRITING-MODES]<!--{{!CSS3-WRITING-MODES}}--></a>,
2004-
the inline base direction of its line boxes will be determined by the bidi
2005-
paragraphs it immediately contains. In the case of an empty bidi
2006-
paragraph, the direction used is that of the previous bidi paragraph in
2007-
the containing block, or, if this is the first bidi paragraph in the
2008-
containing block, then the &lsquo;<code
2009-
class=property>direction</code>&rsquo; property is used.
2009+
the inline base direction must be determined by the bidi paragraphs to
2010+
which it belongs: that is, the bidi paragraph that is immediately
2011+
contained by the line box's containing block and for which the line box
2012+
holds content. An empty line box (i.e. one that contains no atomic inlines
2013+
or characters other than the line-breaking character, if any), takes its
2014+
inline base direction from the previous line box (if any), or, if this is
2015+
the first line box in the containing block, then from the &lsquo;<code
2016+
class=property>direction</code>&rsquo; property of the containing block.
20102017

20112018
<div class=example>
20122019
<p>In the following example, every other line is right-aligned:</p>
@@ -2021,7 +2028,12 @@ <h3 id=text-align><span class=secno>7.1. </span> Text Alignment: the
20212028
<!-- -->&lt;/pre&gt;</pre>
20222029
</div>
20232030

2024-
<h4 id=character-alignment><span class=secno>7.1.1. </span>Character-based
2031+
<p class=note>Note, this definition also affects &lsquo;<a
2032+
href="#text-indent0"><code class=property>text-indent</code></a>&rsquo;
2033+
and &lsquo;<a href="#hanging-punctuation0"><code
2034+
class=property>hanging-punctuation</code></a>&rsquo;.
2035+
2036+
<h4 id=character-alignment><span class=secno>7.1.2. </span>Character-based
20252037
Alignment in a Table Column</h4>
20262038

20272039
<p>When multiple cells in a column have an <a
@@ -2174,12 +2186,13 @@ <h3 id=text-align-last><span class=secno>7.2. </span> Last Line Alignment:
21742186
&lsquo;<a href="#text-align0"><code
21752187
class=property>text-align</code></a>&rsquo;.
21762188

2177-
<p>If &lsquo;<code class=css>auto</code>&rsquo; is specified, content on
2178-
the affected line is aligned per &lsquo;<a href="#text-align0"><code
2179-
class=property>text-align</code></a>&rsquo; unless &lsquo;<a
2180-
href="#text-align0"><code class=property>text-align</code></a>&rsquo; is
2181-
set to &lsquo;<code class=css>justify</code>&rsquo;. In this case, content
2182-
is justified if &lsquo;<a href="#text-justify0"><code
2189+
<p>If <dfn id=auto1>&lsquo;<code class=css>auto</code>&rsquo;</dfn> is
2190+
specified, content on the affected line is aligned per &lsquo;<a
2191+
href="#text-align0"><code class=property>text-align</code></a>&rsquo;
2192+
unless &lsquo;<a href="#text-align0"><code
2193+
class=property>text-align</code></a>&rsquo; is set to &lsquo;<code
2194+
class=css>justify</code>&rsquo;. In this case, content is justified if
2195+
&lsquo;<a href="#text-justify0"><code
21832196
class=property>text-justify</code></a>&rsquo; is &lsquo;<code
21842197
class=css>distribute</code>&rsquo; and start-aligned otherwise. All other
21852198
values have the same meanings as in &lsquo;<a href="#text-align0"><code
@@ -2242,7 +2255,7 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
22422255
to) also support it on inline elements. It takes the following values:
22432256

22442257
<dl>
2245-
<dt><dfn id=auto1 title="text-justify:auto">&lsquo;<code
2258+
<dt><dfn id=auto2 title="text-justify:auto">&lsquo;<code
22462259
class=css>auto</code>&rsquo;</dfn>
22472260

22482261
<dd>The UA determines the justification algorithm to follow, based on a
@@ -3774,7 +3787,7 @@ <h4 id=text-underline-position><span class=secno>10.1.6. </span> Text
37743787
Values have the following meanings:
37753788

37763789
<dl>
3777-
<dt><dfn id=auto2>&lsquo;<code class=css>auto</code>&rsquo;</dfn>
3790+
<dt><dfn id=auto3>&lsquo;<code class=css>auto</code>&rsquo;</dfn>
37783791

37793792
<dd>The user agent may use any algorithm to determine the underline's
37803793
position; however it must be placed at or below the alphabetic baseline.

css3-text/Overview.src.html

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,16 +1395,24 @@ <h3 id="text-align">
13951395
<a href="http://dev.w3.org/csswg/css3-text/#white-space-rules">white
13961396
space processing rules</a>.
13971397

1398-
<p>The start and end edges of a line box are determined by the inline base
1399-
direction of the "bidi paragraph" to which it belongs. In most cases,
1400-
this means using the containing block's computed 'direction'. However if
1401-
containing block has ''unicode-bidi: plaintext'' [[!CSS3-WRITING-MODES]],
1402-
the inline base direction of its line boxes will be determined by the bidi
1403-
paragraphs it immediately contains.
1404-
In the case of an empty bidi paragraph, the direction used is that of the
1405-
previous bidi paragraph in the containing block, or, if this is the first
1406-
bidi paragraph in the containing block, then the 'direction' property is
1407-
used.
1398+
<h4 id=bidi-linebox>
1399+
Bidirectionality and Line Boxes</h4>
1400+
1401+
<p>The start and end edges of a line box are determined by
1402+
the inline base direction of the line box.
1403+
In most cases, this is given by its containing block's computed 'direction'.
1404+
However if the containing block has ''unicode-bidi: plaintext'' [[!CSS3-WRITING-MODES]],
1405+
the inline base direction must be determined
1406+
by the bidi paragraphs to which it belongs:
1407+
that is, the bidi paragraph that is immediately contained by
1408+
the line box's containing block
1409+
and for which the line box holds content.
1410+
An empty line box
1411+
(i.e. one that contains no atomic inlines or
1412+
characters other than the line-breaking character, if any),
1413+
takes its inline base direction from the previous line box (if any), or,
1414+
if this is the first line box in the containing block,
1415+
then from the 'direction' property of the containing block.
14081416

14091417
<div class="example">
14101418
<p>In the following example, every other line is right-aligned:</p>
@@ -1418,6 +1426,59 @@ <h3 id="text-align">
14181426
<!-- -->&lt;/pre&gt;</pre>
14191427
</div>
14201428

1429+
<p class="note">Note that the inline base direction determined here
1430+
applies to the line box itself, and not to its contents.
1431+
It affects 'text-align', 'text-align-last', 'text-indent', and 'hanging-punctuation',
1432+
i.e. the position and alignment of its contents with respect to its edges.
1433+
It does not affect the formatting or ordering of its content.
1434+
1435+
<div class="example">
1436+
<pre>
1437+
<!-- -->&lt;para style="direction: rtl; unicode-bidi:plaintext">
1438+
<!-- -->&lt;quote style="unicode-bidi:plaintext">שלום!&lt;/quote>", he said.
1439+
<!-- -->&lt;/para&gt;</pre>
1440+
1441+
<p>The result should be a left-aligned line looking like this:
1442+
<pre>"!&#1513;&#1500;&#1493;&#1501;", he said.</pre>
1443+
1444+
<p>The line is left-aligned
1445+
(despite the containing block having ''direction: rtl'')
1446+
because the containing block (the <code>&lt;para></code>) has ''unicode-bidi:plaintext'',
1447+
and the line box displays belongs to a bidi paragraph that is LTR.
1448+
This is because that paragraph's first character with a strong direction
1449+
is the LTR "h" from "he". The RTL "שלום!" does precede the "he",
1450+
but it sits in its own bidi-isolated paragraph that is <em>not</em>
1451+
immediately contained by the <code>&lt;para&gt;</code>,
1452+
and is thus irrelevent to the line box's alignment.
1453+
From from the standpoint of the bidi paragraph immediately contained
1454+
by the <code>&lt;para&gt;</code> containing block,
1455+
the <code>&lt;quote&gt;</code>'s bidi-isolated paragraph inside it is,
1456+
by definition, just a neutral U+FFFC character,
1457+
so the immediately-contained paragraph becomes LTR by virtue
1458+
of the "he" following it.
1459+
</div>
1460+
1461+
<div class="example">
1462+
<pre>
1463+
<!-- -->&lt;fieldset style="direction: rtl">
1464+
<!-- -->&lt;textarea style="unicode-bidi:plaintext">
1465+
<!-- -->
1466+
<!-- -->Hello!
1467+
<!-- -->
1468+
<!-- -->&lt;/textarea>
1469+
<!-- -->&lt;/fieldset></pre>
1470+
1471+
<p>As expected, the "Hello!" should be displayed LTR
1472+
(i.e. with the exclamation mark on the right end,
1473+
despite the <code>&lt;textarea></code>'s ''direction:rtl'')
1474+
and left-aligned.
1475+
This makes the empty line following it left-aligned as well,
1476+
which means that the caret on that line should appear at its
1477+
left edge. The first empty line, on the other hand, should
1478+
be right-aligned, due to the RTL direction of its containing
1479+
paragraph, the <code>&lt;textarea></code>.
1480+
</div>
1481+
14211482
<h4 id="character-alignment">Character-based Alignment in a Table Column</h4>
14221483

14231484
<p>When multiple cells in a column have an <i>alignment character</i> specified,
@@ -1551,7 +1612,7 @@ <h3 id="text-align-last">
15511612
alignment (via ''start end''), 'text-align-last' takes precedence
15521613
over 'text-align'.
15531614

1554-
<p>If ''auto'' is specified, content on the affected line is aligned
1615+
<p>If <dfn>''auto''</dfn> is specified, content on the affected line is aligned
15551616
per 'text-align' unless 'text-align' is set to ''justify''. In
15561617
this case, content is justified if 'text-justify' is ''distribute''
15571618
and start-aligned otherwise.

0 commit comments

Comments
 (0)