Skip to content

Commit 6f2e422

Browse files
committed
[css-text] Move bidi of line boxes section to Edge Effects, where it's less in-the-way. Fix some markup errors.
1 parent c3c4b40 commit 6f2e422

2 files changed

Lines changed: 224 additions & 205 deletions

File tree

css-text/Overview.html

Lines changed: 119 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,6 @@ <h2 class="no-num no-toc" id=contents> Table of Contents</h2>
283283
<ul class=toc>
284284
<li><a href="#text-align"><span class=secno>7.1. </span> Text Alignment:
285285
the ‘<code class=property>text-align</code>’ property</a>
286-
<ul class=toc>
287-
<li><a href="#bidi-linebox"><span class=secno>7.1.1. </span>
288-
Bidirectionality and Line Boxes</a>
289-
</ul>
290286

291287
<li><a href="#text-align-last"><span class=secno>7.2. </span> Last Line
292288
Alignment: the ‘<code class=property>text-align-last</code>
@@ -314,6 +310,9 @@ <h2 class="no-num no-toc" id=contents> Table of Contents</h2>
314310
<li><a href="#hanging-punctuation"><span class=secno>9.2. </span>
315311
Hanging Punctuation: the ‘<code
316312
class=property>hanging-punctuation</code>’ property</a>
313+
314+
<li><a href="#bidi-linebox"><span class=secno>9.3. </span>
315+
Bidirectionality and Line Boxes</a>
317316
</ul>
318317

319318
<li><a href="#conformance"><span class=secno>10. </span> Conformance</a>
@@ -1450,11 +1449,13 @@ <h3 id=word-break><span class=secno>5.3. </span> Breaking Rules for
14501449
allowed to break between any two letters, rather than only at spaces or
14511450
hyphenation points; this can be enabled with ‘<a
14521451
href="#break-all"><code class=css>word-break:break-all</code></a>’.
1453-
<figure> <img
1452+
1453+
<div class=figure> <img
14541454
alt="A snippet of Japanese text with English in it. The word 'caption' is broken into 'capt' and 'ion' across two lines."
1455-
src=break-all.png> <figcaption>An example of English text embedded in
1456-
Japanese being broken at an arbitrary point in the word.</figcaption>
1457-
</figure>
1455+
src=break-all.png>
1456+
<p class=caption>An example of English text embedded in Japanese being
1457+
broken at an arbitrary point in the word.
1458+
</div>
14581459

14591460
<p>As another example, Korean has two styles of line-breaking: between any
14601461
two Korean syllables (‘<code class=css>word-break: normal</code>’)
@@ -1827,12 +1828,14 @@ <h3 id=text-align><span class=secno>7.1. </span> Text Alignment: the ‘<a
18271828
<dt><dfn id=start title="text-align:start"><code
18281829
class=css>start</code></dfn>
18291830

1830-
<dd>Inline-level content is aligned to the start edge of the line box.
1831+
<dd>Inline-level content is aligned to the <i>start</i> edge of the line
1832+
box.
18311833

18321834
<dt><dfn id=end title="text-align:end"><code
18331835
class=css>end</code></dfn>
18341836

1835-
<dd>Inline-level content is aligned to the end edge of the line box.
1837+
<dd>Inline-level content is aligned to the <i>end</i> edge of the line
1838+
box.
18361839

18371840
<dt><dfn id=left title="text-align:left"><code
18381841
class=css>left</code></dfn>
@@ -1919,105 +1922,16 @@ <h3 id=text-align><span class=secno>7.1. </span> Text Alignment: the ‘<a
19191922
href="#white-space-rules">white space processing rules</a>.
19201923

19211924
<p>If (after justification, if any) the inline contents of a line box are
1922-
too long to fit within it, then the contents are start-aligned: any
1923-
content that doesn't fit overflows the line box's end edge.
1924-
1925-
<h4 id=bidi-linebox><span class=secno>7.1.1. </span> Bidirectionality and
1926-
Line Boxes</h4>
1927-
1928-
<p>The start and end edges of a line box are determined by the inline base
1929-
direction of the line box. In most cases, this is given by its containing
1930-
block's computed ‘<code class=property>direction</code>’. However if
1931-
its containing block has ‘<code class=css>unicode-bidi:
1932-
plaintext</code><a href="#CSS3-WRITING-MODES"
1933-
rel=biblioentry>[CSS3-WRITING-MODES]<!--{{!CSS3-WRITING-MODES}}--></a>,
1934-
the inline base direction the line box must be determined by the base
1935-
direction of the bidi paragraph to which it belongs: that is, the bidi
1936-
paragraph for which the line box holds content. An empty line box (i.e.
1937-
one that contains no atomic inlines or characters other than the
1938-
line-breaking character, if any), takes its inline base direction from the
1939-
preceding line box (if any), or, if this is the first line box in the
1940-
containing block, then from the ‘<code
1941-
class=property>direction</code>’ property of the containing block.
1942-
1943-
<div class=example>
1944-
<p>In the following example, assuming the <code>&lt;block&gt;</code> is a
1945-
preformatted block (‘<code class=css>display: block; white-space:
1946-
pre</code>’) inheriting ‘<code class=css>text-align: start</code>’,
1947-
every other line is right-aligned:
1948-
1949-
<pre>&lt;block style="unicode-bidi: plaintext"&gt;
1950-
<!-- --> Latin
1951-
<!-- --> و·کمی
1952-
<!-- --> Latin
1953-
<!-- --> و·کمی
1954-
<!-- --> Latin
1955-
<!-- --> و·کمی
1956-
<!-- -->&lt;/block&gt;</pre>
1957-
</div>
1958-
1959-
<p class=note>Note that the inline base direction determined here applies
1960-
to the line box itself, and not to its contents. It affects ‘<a
1961-
href="#text-align0"><code class=property>text-align</code></a>’, ‘<a
1962-
href="#text-align-last0"><code
1963-
class=property>text-align-last</code></a>’, ‘<a
1964-
href="#text-indent0"><code class=property>text-indent</code></a>’, and
1965-
<a href="#hanging-punctuation0"><code
1966-
class=property>hanging-punctuation</code></a>’, i.e. the position and
1967-
alignment of its contents with respect to its edges. It does not affect
1968-
the formatting or ordering of its content.
1969-
1970-
<div class=example>
1971-
<p>In the following example:
1972-
1973-
<pre>
1974-
<!-- -->&lt;para style="display: block; direction: rtl; unicode-bidi:plaintext">
1975-
<!-- -->&lt;quote style="unicode-bidi:plaintext">שלום!&lt;/quote>", he said.
1976-
<!-- -->&lt;/para&gt;</pre>
1977-
1978-
<p>The result should be a left-aligned line looking like this:
1979-
1980-
<pre>"!שלום", he said.</pre>
1981-
1982-
<p>The line is left-aligned (despite the containing block having ‘<code
1983-
class=css>direction: rtl</code>’) because the containing block (the
1984-
<code>&lt;para></code>) has ‘<code
1985-
class=css>unicode-bidi:plaintext</code>’, and the line box belongs to a
1986-
bidi paragraph that is LTR. This is because that paragraph's first
1987-
character with a strong direction is the LTR "h" from "he". The RTL
1988-
"שלום!" does precede the "he", but it sits in its own bidi-isolated
1989-
paragraph that is <em>not</em> immediately contained by the
1990-
<code>&lt;para&gt;</code>, and is thus irrelevent to the line box's
1991-
alignment. From from the standpoint of the bidi paragraph immediately
1992-
contained by the <code>&lt;para&gt;</code> containing block, the
1993-
<code>&lt;quote&gt;</code>’s bidi-isolated paragraph inside it is, by
1994-
definition, just a neutral U+FFFC character, so the immediately-contained
1995-
paragraph becomes LTR by virtue of the "he" following it.
1996-
</div>
1925+
too long to fit within it, then the contents are <i>start</i>-aligned: any
1926+
content that doesn't fit overflows the line box's <i>end</i> edge.
19971927

1998-
<div class=example>
1999-
<pre>
2000-
<!-- -->&lt;fieldset style="direction: rtl">
2001-
<!-- -->&lt;textarea style="unicode-bidi:plaintext">
2002-
<!-- -->
2003-
<!-- -->Hello!
2004-
<!-- -->
2005-
<!-- -->&lt;/textarea>
2006-
<!-- -->&lt;/fieldset></pre>
2007-
2008-
<p>As expected, the "Hello!" should be displayed LTR (i.e. with the
2009-
exclamation mark on the right end, despite the
2010-
<code>&lt;textarea></code><code class=css>s </code>’‘<code
2011-
class=css>direction:rtl</code>’‘<code class=css>) and left-aligned.
2012-
This makes the empty line following it left-aligned as well, which means
2013-
that the caret on that line should appear at its left edge. The first
2014-
empty line, on the other hand, should be right-aligned, due to the RTL
2015-
direction of its containing paragraph, the <code>&lt;textarea></code>.
2016-
</code>
2017-
</div>
1928+
<p>See <a href="#bidi-linebox">Bidirectionality and line boxes</a> for
1929+
details on how to determine the <i>start</i> and <i>end</i> edges of a
1930+
line box.
20181931

20191932
<h3 id=text-align-last><span class=secno>7.2. </span> Last Line Alignment:
2020-
the ’text-align-last' property</h3>
1933+
the ‘<a href="#text-align-last0"><code
1934+
class=property>text-align-last</code></a>’ property</h3>
20211935

20221936
<table class=propdef>
20231937
<tbody>
@@ -3192,6 +3106,104 @@ <h3 id=hanging-punctuation><span class=secno>9.2. </span> Hanging
31923106
is pushed outside the line.
31933107
</div>
31943108

3109+
<h3 id=bidi-linebox><span class=secno>9.3. </span> Bidirectionality and
3110+
Line Boxes</h3>
3111+
3112+
<p>The <a
3113+
href="http://www.w3.org/TR/css3-writing-modes/#start"><i>start</i></a> and
3114+
<a href="http://www.w3.org/TR/css3-writing-modes/#end"><i>end</i></a>
3115+
edges of a line box are determined by the <i>inline base direction</i> of
3116+
the line box. In most cases, this is given by its containing block's
3117+
computed ‘<code class=property>direction</code>’.
3118+
3119+
<p>However if its containing block has ‘<code class=css>unicode-bidi:
3120+
plaintext</code><a href="#CSS3-WRITING-MODES"
3121+
rel=biblioentry>[CSS3-WRITING-MODES]<!--{{!CSS3-WRITING-MODES}}--></a>,
3122+
the line box's <i>inline base direction</i> must be determined by the
3123+
<i>base direction</i> of the <i>bidi paragraph</i> to which it belongs:
3124+
that is, the <i>bidi paragraph</i> for which the line box holds content.
3125+
An empty line box (i.e. one that contains no atomic inlines or characters
3126+
other than the line-breaking character, if any), takes its <i>inline base
3127+
direction</i> from the preceding line box (if any), or, if this is the
3128+
first line box in the containing block, then from the ‘<code
3129+
class=property>direction</code>’ property of the containing block.
3130+
3131+
<div class=example>
3132+
<p>In the following example, assuming the <code>&lt;block&gt;</code> is a
3133+
preformatted block (‘<code class=css>display: block; white-space:
3134+
pre</code>’) inheriting ‘<code class=css>text-align: start</code>’,
3135+
every other line is right-aligned:
3136+
3137+
<pre>&lt;block style="unicode-bidi: plaintext"&gt;
3138+
<!-- --> Latin
3139+
<!-- --> و·کمی
3140+
<!-- --> Latin
3141+
<!-- --> و·کمی
3142+
<!-- --> Latin
3143+
<!-- --> و·کمی
3144+
<!-- -->&lt;/block&gt;</pre>
3145+
</div>
3146+
3147+
<p class=note>Note that the inline base direction determined here applies
3148+
to the line box itself, and not to its contents. It affects ‘<a
3149+
href="#text-align0"><code class=property>text-align</code></a>’, ‘<a
3150+
href="#text-align-last0"><code
3151+
class=property>text-align-last</code></a>’, ‘<a
3152+
href="#text-indent0"><code class=property>text-indent</code></a>’, and
3153+
<a href="#hanging-punctuation0"><code
3154+
class=property>hanging-punctuation</code></a>’, i.e. the position and
3155+
alignment of its contents with respect to its edges. It does not affect
3156+
the formatting or ordering of its content.
3157+
3158+
<div class=example>
3159+
<p>In the following example:
3160+
3161+
<pre>
3162+
<!-- -->&lt;para style="display: block; direction: rtl; unicode-bidi:plaintext">
3163+
<!-- -->&lt;quote style="unicode-bidi:plaintext">שלום!&lt;/quote>", he said.
3164+
<!-- -->&lt;/para&gt;</pre>
3165+
3166+
<p>The result should be a left-aligned line looking like this:
3167+
3168+
<pre>"!שלום", he said.</pre>
3169+
3170+
<p>The line is left-aligned (despite the containing block having ‘<code
3171+
class=css>direction: rtl</code>’) because the containing block (the
3172+
<code>&lt;para></code>) has ‘<code
3173+
class=css>unicode-bidi:plaintext</code>’, and the line box belongs to a
3174+
bidi paragraph that is LTR. This is because that paragraph's first
3175+
character with a strong direction is the LTR "h" from "he". The RTL
3176+
"שלום!" does precede the "he", but it sits in its own bidi-isolated
3177+
paragraph that is <em>not</em> immediately contained by the
3178+
<code>&lt;para&gt;</code>, and is thus irrelevent to the line box's
3179+
alignment. From from the standpoint of the bidi paragraph immediately
3180+
contained by the <code>&lt;para&gt;</code> containing block, the
3181+
<code>&lt;quote&gt;</code>’s bidi-isolated paragraph inside it is, by
3182+
definition, just a neutral U+FFFC character, so the immediately-contained
3183+
paragraph becomes LTR by virtue of the "he" following it.
3184+
</div>
3185+
3186+
<div class=example>
3187+
<pre>
3188+
<!-- -->&lt;fieldset style="direction: rtl">
3189+
<!-- -->&lt;textarea style="unicode-bidi:plaintext">
3190+
<!-- -->
3191+
<!-- -->Hello!
3192+
<!-- -->
3193+
<!-- -->&lt;/textarea>
3194+
<!-- -->&lt;/fieldset></pre>
3195+
3196+
<p>As expected, the "Hello!" should be displayed LTR (i.e. with the
3197+
exclamation mark on the right end, despite the
3198+
<code>&lt;textarea></code><code class=css>s </code>’‘<code
3199+
class=css>direction:rtl</code>’‘<code class=css>) and left-aligned.
3200+
This makes the empty line following it left-aligned as well, which means
3201+
that the caret on that line should appear at its left edge. The first
3202+
empty line, on the other hand, should be right-aligned, due to the RTL
3203+
direction of its containing paragraph, the <code>&lt;textarea></code>.
3204+
</code>
3205+
</div>
3206+
31953207
<h2 id=conformance><span class=secno>10. </span> Conformance</h2>
31963208

31973209
<h3 id=conventions><span class=secno>10.1. </span> Document Conventions</h3>
@@ -3309,7 +3321,7 @@ <h3 id=testing><span class=secno>10.5. </span>Non-Experimental
33093321
W3C are subject to review and correction by the CSS Working Group.
33103322

33113323
<p>Further information on submitting testcases and implementation reports
3312-
can be found from on the CSS Working Group's website at <a
3324+
can be found from on the CSS Working Groups website at <a
33133325
href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
33143326
Questions should be directed to the <a
33153327
href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>

0 commit comments

Comments
 (0)