Skip to content

Commit 2d57db1

Browse files
committed
[css-text] More details on expansion opportunities
1 parent b1d275c commit 2d57db1

2 files changed

Lines changed: 67 additions & 31 deletions

File tree

css-text/Overview.html

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ <h2 class="no-num no-toc" id=contents> Table of Contents</h2>
315315
<li><a href="#justify-cursive"><span class=secno>7.3.4. </span>
316316
Cursive Scripts</a>
317317

318-
<li><a href="#justify-alt"><span class=secno>7.3.5. </span> Possible
318+
<li><a href="#justify-algos"><span class=secno>7.3.5. </span> Possible
319319
Algorithms</a>
320320
</ul>
321321
</ul>
@@ -2207,13 +2207,36 @@ <h4 id=expanding-text><span class=secno>7.3.1. </span> Expanding and
22072207
<p>An <dfn id=expansion-opportunity>expansion opportunity</dfn> is a point
22082208
where the justification algorithm may alter spacing within the text. An
22092209
expansion opportunity can be provided by a single <a
2210-
href="#character"><i>character</i></a> (such as a <i>word separator
2211-
character</i>), or by the juxtaposition of two <a
2212-
href="#character"><i>characters</i></a>. The UA divides <a
2210+
href="#character"><i>character</i></a> (such as a <a
2211+
href="#word-separator"><i>word separator</i></a>), or by the juxtaposition
2212+
of two <a href="#character"><i>characters</i></a>. Space distributed by
2213+
justification is <em>in addition to</em> the optimal spacing defined by
2214+
the ‘<a href="#letter-spacing0"><code
2215+
class=property>letter-spacing</code></a>’ or ‘<a
2216+
href="#word-spacing0"><code class=property>word-spacing</code></a>
2217+
properties. However, when space is distributed to a <a
2218+
href="#word-separator"><i>word separator</i></a> <a
2219+
href="#expansion-opportunity"><i>expansion opportunity</i></a>, it is
2220+
applied under the same rules as for ‘<a href="#word-spacing0"><code
2221+
class=property>word-spacing</code></a>’. Similarly, when space is
2222+
distributed an <a href="#expansion-opportunity"><i>expansion
2223+
opportunity</i></a> between two <a
2224+
href="#character"><i>characters</i></a>, it is applied under the same
2225+
rules as for ‘<a href="#letter-spacing0"><code
2226+
class=property>letter-spacing</code></a>’.
2227+
2228+
<p>A justification algorithm may divide <a
22132229
href="#expansion-opportunity"><i>expansion opportunities</i></a> into
2214-
different priority levels: within a level, all <a
2215-
href="#expansion-opportunity"><i>expansion opportunities</i></a> are
2216-
expanded or compressed at the same priority.
2230+
different priority levels. All <a
2231+
href="#expansion-opportunity"><i>expansion opportunities</i></a> within a
2232+
given level are expanded or compressed at the same priority, regardless of
2233+
which <a href="#character"><i>characters</i></a> created that opportunity.
2234+
For example, if <a href="#expansion-opportunity"><i>expansion
2235+
opportunities</i></a> between two Han characters and between two Latin <a
2236+
href="#letter0"><i>letters</i></a> are defined to be at the same level (as
2237+
they are in the ‘<code class=css>distribute</code>’ justification
2238+
style), they are not treated differently because they originate from
2239+
different <a href="#character"><i>characters</i></a>.
22172240

22182241
<h4 id=justify-symbols><span class=secno>7.3.2. </span> Handling Symbols
22192242
and Punctuation</h4>
@@ -2255,7 +2278,7 @@ <h4 id=justify-limits><span class=secno>7.3.3. </span> Unexpandable Text</h4>
22552278
introduced by <a href="#word-separator"><i>word separators</i></a>. How
22562279
any remaining space is distributed once all <a
22572280
href="#expansion-opportunity"><i>expansion opportunities</i></a> reach
2258-
their limits is up to the UA.
2281+
their specified limits is up to the UA.
22592282

22602283
<p>If the inline contents of a line cannot be stretched to the full width
22612284
of the line box, then they must be aligned as specified by the ‘<a
@@ -2282,7 +2305,7 @@ <h4 id=justify-cursive><span class=secno>7.3.4. </span> Cursive Scripts</h4>
22822305
between any pair of <i>cursive script</i> <a
22832306
href="#letter0"><i>letters</i></a>.
22842307

2285-
<h4 id=justify-alt><span class=secno>7.3.5. </span> Possible Algorithms</h4>
2308+
<h4 id=justify-algos><span class=secno>7.3.5. </span> Possible Algorithms</h4>
22862309

22872310
<p>The guidelines in this level of CSS do not describe a complete
22882311
justification algorithm. They are merely a minimum set of requirements
@@ -2433,10 +2456,11 @@ <h3 id=word-spacing><span class=secno>8.1. </span> Word Spacing: the ‘<a
24332456
character's <i>advance measure</i>.
24342457
</dl>
24352458

2436-
<p>Additional spacing is applied to each <i>word separator character</i>
2437-
left in the text after the <a href="#white-space-rules">white space
2438-
processing rules</a> have been applied, and should be applied half on each
2439-
side of the character unless otherwise dictated by typographic tradition.
2459+
<p>Additional spacing is applied to each <a href="#word-separator"><i>word
2460+
separator</i></a> left in the text after the <a
2461+
href="#white-space-rules">white space processing rules</a> have been
2462+
applied, and should be applied half on each side of the character unless
2463+
otherwise dictated by typographic tradition.
24402464

24412465
<div class=example>
24422466
<p>The following example will make all the spaces between words in Arabic

css-text/Overview.src.html

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,21 +1613,33 @@ <h3 id="text-justify">
16131613
<h4 id="expanding-text">
16141614
Expanding and Compressing Text</h4>
16151615

1616-
<p>When justifying text, the user agent takes the remaining space between
1617-
the ends of a line's contents and the edges of its line box, and
1618-
distributes that space throughout its contents so that the contents
1619-
exactly fill the line box.
1620-
The user agent may alternatively distribute negative space,
1621-
putting more content on the line than would otherwise fit under normal spacing conditions.
1622-
1623-
<p>An <dfn>expansion opportunity</dfn> is
1624-
a point where the justification algorithm may alter spacing within the text.
1625-
An expansion opportunity can be provided by a single <i>character</i>
1626-
(such as a <i>word separator character</i>),
1627-
or by the juxtaposition of two <i>characters</i>.
1628-
The UA divides <i>expansion opportunities</i> into different priority levels:
1629-
within a level, all <i>expansion opportunities</i> are
1630-
expanded or compressed at the same priority.
1616+
<p>When justifying text, the user agent takes the remaining space between
1617+
the ends of a line's contents and the edges of its line box, and
1618+
distributes that space throughout its contents so that the contents
1619+
exactly fill the line box.
1620+
The user agent may alternatively distribute negative space,
1621+
putting more content on the line than would otherwise fit under normal spacing conditions.
1622+
1623+
<p>An <dfn>expansion opportunity</dfn> is
1624+
a point where the justification algorithm may alter spacing within the text.
1625+
An expansion opportunity can be provided by a single <i>character</i>
1626+
(such as a <i>word separator</i>),
1627+
or by the juxtaposition of two <i>characters</i>.
1628+
Space distributed by justification is <em>in addition to</em>
1629+
the optimal spacing defined by the 'letter-spacing' or 'word-spacing' properties.
1630+
However, when space is distributed to a <i>word separator</i> <i>expansion opportunity</i>,
1631+
it is applied under the same rules as for 'word-spacing'.
1632+
Similarly, when space is distributed an <i>expansion opportunity</i> between two <i>characters</i>,
1633+
it is applied under the same rules as for 'letter-spacing'.
1634+
1635+
<p>A justification algorithm may divide <i>expansion opportunities</i> into different priority levels.
1636+
All <i>expansion opportunities</i> within a given level
1637+
are expanded or compressed at the same priority,
1638+
regardless of which <i>characters</i> created that opportunity.
1639+
For example, if <i>expansion opportunities</i> between two Han characters
1640+
and between two Latin <i>letters</i> are defined to be at the same level
1641+
(as they are in the ''distribute'' justification style),
1642+
they are not treated differently because they originate from different <i>characters</i>.
16311643

16321644
<h4 id="justify-symbols">
16331645
Handling Symbols and Punctuation</h4>
@@ -1661,7 +1673,7 @@ <h4 id="justify-limits">
16611673
<p>The 'word-spacing' property can specify limits on
16621674
<i>expansion opportunities</i> introduced by <i>word separators</i>.
16631675
How any remaining space is distributed once all <i>expansion opportunities</i>
1664-
reach their limits is up to the UA.
1676+
reach their specified limits is up to the UA.
16651677

16661678
<p>If the inline contents of a line cannot be stretched to the full width of the line box,
16671679
then they must be aligned as specified by the 'text-align-last' property.
@@ -1680,7 +1692,7 @@ <h4 id="justify-cursive">
16801692
It otherwise <em>must</em> assume that no <i>expansion opportunity</i> exists
16811693
between any pair of <i>cursive script</i> <i>letters</i>.
16821694

1683-
<h4 id="justify-alt">
1695+
<h4 id="justify-algos">
16841696
Possible Algorithms</h4>
16851697

16861698
<p>The guidelines in this level of CSS do not describe a complete
@@ -1798,7 +1810,7 @@ <h3 id="word-spacing">
17981810
character's <i>advance measure</i>.
17991811
</dl>
18001812

1801-
<p>Additional spacing is applied to each <i>word separator character</i>
1813+
<p>Additional spacing is applied to each <i>word separator</i>
18021814
left in the text after the <a href="#white-space-rules">white space processing rules</a> have been applied,
18031815
and should be applied half on each side of the character
18041816
unless otherwise dictated by typographic tradition.

0 commit comments

Comments
 (0)