Skip to content

Commit 21f49a5

Browse files
committed
[css-text] More tweaking of the justification section. Add section headings. Rearrange paragraphs. Etc.
--HG-- extra : rebase_source : c04bd2c0b72e6dcf08f97e3f85743269656e2420
1 parent fb73ce2 commit 21f49a5

2 files changed

Lines changed: 185 additions & 126 deletions

File tree

css-text/Overview.html

Lines changed: 113 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
rel=dcterms.rights>
1111
<meta content="CSS Text Module Level 3 (CSS3 Text)" name=dcterms.title>
1212
<meta content=text name=dcterms.type>
13-
<meta content=2013-07-12 name=dcterms.date>
13+
<meta content=2013-07-16 name=dcterms.date>
1414
<meta content="Elika J. Etemad" name=dcterms.creator>
1515
<meta content="Koji Ishii" name=dcterms.creator>
1616
<meta content=W3C name=dcterms.publisher>
@@ -26,14 +26,6 @@
2626
.egbidiwsaB { background:yellow;border:2px dotted white }
2727
.egbidiwsbC { border:2px dotted red }
2828

29-
#letter-spacing-example .LS { padding: 1px 0;
30-
color: orange; }
31-
#letter-spacing-example .Z { color: blue; }
32-
#letter-spacing-example .Y { color: green; }
33-
#letter-spacing-example .P { color: gray;
34-
padding: 2px 0; }
35-
#letter-spacing-example span { border: 1px solid; }
36-
3729
/* Start Letter-spacing Tutorial */
3830
.ls-ex {
3931
font-size: 200%;
@@ -76,12 +68,12 @@
7668

7769
<h1>CSS Text Module Level 3</h1>
7870

79-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 12 July 2013</h2>
71+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 16 July 2013</h2>
8072

8173
<dl>
8274
<dt>This version:</dt>
8375
<!--
84-
<dd><a href="http://www.w3.org/TR/2013/WD-css3-text-20130712/">http://www.w3.org/TR/2013/WD-css3-text-20130712/</a></dd>
76+
<dd><a href="http://www.w3.org/TR/2013/WD-css3-text-20130716/">http://www.w3.org/TR/2013/WD-css3-text-20130716/</a></dd>
8577
-->
8678

8779
<dd><a
@@ -309,6 +301,23 @@ <h2 class="no-num no-toc" id=contents> Table of Contents</h2>
309301

310302
<li><a href="#text-justify"><span class=secno>7.3. </span> Justification
311303
Method: the ‘<code class=property>text-justify</code>’ property</a>
304+
305+
<ul class=toc>
306+
<li><a href="#expanding-text"><span class=secno>7.3.1. </span>
307+
Expanding and Compressing Text</a>
308+
309+
<li><a href="#justify-symbols"><span class=secno>7.3.2. </span>
310+
Handling Symbols and Punctuation</a>
311+
312+
<li><a href="#justify-limits"><span class=secno>7.3.3. </span>
313+
Unexpandable Text</a>
314+
315+
<li><a href="#justify-cursive"><span class=secno>7.3.4. </span>
316+
Cursive Scripts</a>
317+
318+
<li><a href="#justify-alt"><span class=secno>7.3.5. </span> Possible
319+
Algorithms</a>
320+
</ul>
312321
</ul>
313322

314323
<li><a href="#spacing"><span class=secno>8. </span> Spacing</a>
@@ -1791,6 +1800,9 @@ <h3 id=overflow-wrap><span class=secno>6.2. </span> Overflow Wrapping: the
17911800
<h2 id=justification><span class=secno>7. </span> Alignment and
17921801
Justification</h2>
17931802

1803+
<p>Alignment and justification controls how inline content is distributed
1804+
within a line box.
1805+
17941806
<h3 id=text-align><span class=secno>7.1. </span> Text Alignment: the ‘<a
17951807
href="#text-align0"><code class=property>text-align</code></a>’ property</h3>
17961808

@@ -2117,12 +2129,11 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
21172129
<dt><dfn id=inter-word title="text-justify:inter-word"><code
21182130
class=css>inter-word</code></dfn>
21192131

2120-
<dd>Justification varies the used ‘<a href="#word-spacing0"><code
2121-
class=property>word-spacing</code></a>’ on the line, i.e. the primary
2122-
<a href="#expansion-opportunity"><i>expansion opportunities</i></a> are
2123-
at <a href="#word-separator"><i>word separators</i></a>. This behavior is
2124-
typical for languages that separate words using spaces, like English or
2125-
Korean.
2132+
<dd>Justification adjusts spacing at <a href="#word-separator"><i>word
2133+
separators</i></a> (effectively varying the used ‘<a
2134+
href="#word-spacing0"><code class=property>word-spacing</code></a>’ on
2135+
the line). This behavior is typical for languages that separate words
2136+
using spaces, like English or Korean.
21262137
<div class=figure id=fig-text-justify-interword>
21272138
<p> <img alt="Extra space is equally distributed mainly to spaces."
21282139
src=text-justify-interword.png>
@@ -2146,15 +2157,11 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
21462157
<dt><dfn id=distribute title="text-justify:distribute"><code
21472158
class=css>distribute</code></dfn>
21482159

2149-
<dd>Justification varies the used ‘<a href="#letter-spacing0"><code
2150-
class=property>letter-spacing</code></a>’ on the line (except between
2151-
<a href="#letter0"><i>letters</i></a> in <a
2152-
href="#cursive-scripts"><i>cursive scripts</i></a> such as Arabic), i.e.
2153-
the primary <a href="#expansion-opportunity"><i>expansion
2154-
opportunities</i></a> are between adjacent <a
2155-
href="#character"><i>characters</i></a> where both <a
2156-
href="#character"><i>characters</i></a> in the pair are
2157-
non-<i>cursive</i>. This value is sometimes used in e.g. Japanese.
2160+
<dd>Justification adjusts spacing between each pair of adjacent <a
2161+
href="#character"><i>characters</i></a> (effectively varying the used
2162+
<a href="#letter-spacing0"><code
2163+
class=property>letter-spacing</code></a>’ on the line). This value is
2164+
sometimes used in e.g. Japanese.
21582165
<div class=figure id=fig-text-justify-distribute>
21592166
<p> <img
21602167
alt="Extra space is equally distributed at points between spaces and letters of all writing systems."
@@ -2184,64 +2191,49 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
21842191
</div>
21852192
-->
21862193

2194+
<p>The exact justification algorithm is UA-dependent; however, CSS provides
2195+
some general guidelines...
2196+
2197+
<h4 id=expanding-text><span class=secno>7.3.1. </span> Expanding and
2198+
Compressing Text</h4>
2199+
21872200
<p>When justifying text, the user agent takes the remaining space between
21882201
the ends of a line's contents and the edges of its line box, and
21892202
distributes that space throughout its contents so that the contents
2190-
exactly fill the line box. If the ‘<a href="#letter-spacing0"><code
2191-
class=property>letter-spacing</code></a>’ and ‘<a
2192-
href="#word-spacing0"><code class=property>word-spacing</code></a>
2193-
property values allow it, the user agent may also distribute negative
2194-
space, putting more content on the line than would otherwise fit under
2195-
normal spacing conditions. The exact justification algorithm is
2196-
UA-dependent; however, CSS provides some general guidelines which should
2197-
be followed when a justification method other than ‘<a
2198-
href="#auto1"><code class=property>auto</code></a>’ is specified.
2199-
2200-
<div class=note>
2201-
<p>The guidelines in this level of CSS do not describe a complete
2202-
justification algorithm. They are merely a minimum set of requirements
2203-
that a complete algorithm should meet. Limiting the set of requirements
2204-
gives UAs some latitude in choosing a justification algorithm that meets
2205-
their needs and desired balance of quality, speed, and complexity.
2206-
2207-
<p>For instance, a basic but fast ‘<code class=css>inter-word</code>
2208-
justification algorithm might use a simple greedy method for determining
2209-
line breaks, then distribute leftover space. This algorithm could follow
2210-
the guidelines by expanding word spaces first, expanding between letters
2211-
only if ‘<a href="#word-spacing0"><code
2212-
class=property>word-spacing</code></a>’ hit a limit.
2213-
2214-
<p>A more sophisticated but slower ‘<code class=css>inter-word</code>
2215-
justification algorithm might use a Knuth/Plass method where <a
2216-
href="#expansion-opportunity"><i>expansion opportunities</i></a> and
2217-
limits were assigned weights and assessed with other line breaking
2218-
considerations. This algorithm could follow the guidelines by giving more
2219-
weight to <a href="#word-separator"><i>word separators</i></a> than
2220-
letter spacing.
2221-
</div>
2203+
exactly fill the line box. The user agent may alternatively distribute
2204+
negative space, putting more content on the line than would otherwise fit
2205+
under normal spacing conditions.
22222206

22232207
<p>An <dfn id=expansion-opportunity>expansion opportunity</dfn> is a point
2224-
where the justification algorithm may alter spacing within the text. The
2225-
UA divides <a href="#expansion-opportunity"><i>expansion
2226-
opportunities</i></a> into different priority levels: within a level, all
2227-
<a href="#expansion-opportunity"><i>expansion opportunities</i></a> are
2208+
where the justification algorithm may alter spacing within the text. An
2209+
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
2213+
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
22282216
expanded or compressed at the same priority.
22292217

2218+
<h4 id=justify-symbols><span class=secno>7.3.2. </span> Handling Symbols
2219+
and Punctuation</h4>
2220+
22302221
<p>When determining <a href="#expansion-opportunity"><i>expansion
22312222
opportunities</i></a>, characters from the Unicode Symbols (S*) and
22322223
Punctuation (P*) classes are generally treated the same as a <a
22332224
href="#letter0"><i>letter</i></a>: in the case of ‘<code
22342225
class=css>inter-word</code>’, as a Latin <a
2235-
href="#letter0"><i>letter</i></a>, in the case of ‘<code
2226+
href="#letter0"><i>letter</i></a>; in the case of ‘<code
22362227
class=css>distribute</code>’, as a Han <a
2237-
href="#letter0"><i>letter</i></a>, and in the case of ‘<a
2228+
href="#letter0"><i>letter</i></a>; and in the case of ‘<a
22382229
href="#auto1"><code class=css>auto</code></a>’, as a <a
2239-
href="#letter0"><i>letter</i></a> of the dominant script. However, by
2240-
typographic tradition there may be additional rules controlling the
2241-
justification of symbols and punctuation. Therefore, the UA may reassign
2242-
specific characters or introduce additional levels of prioritization to
2243-
handle <a href="#expansion-opportunity"><i>expansion opportunities</i></a>
2244-
involving symbols and punctuation.
2230+
href="#letter0"><i>letter</i></a> of the dominant script.
2231+
2232+
<p>However, by typographic tradition there may be additional rules
2233+
controlling the justification of symbols and punctuation. Therefore, the
2234+
UA may reassign specific characters or introduce additional levels of
2235+
prioritization to handle <a href="#expansion-opportunity"><i>expansion
2236+
opportunities</i></a> involving symbols and punctuation.
22452237

22462238
<p class=example> For example, there are traditionally no <a
22472239
href="#expansion-opportunity"><i>expansion opportunities</i></a> between
@@ -2255,6 +2247,8 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
22552247
prioritization level than the opportunities between ideographic
22562248
characters.
22572249

2250+
<h4 id=justify-limits><span class=secno>7.3.3. </span> Unexpandable Text</h4>
2251+
22582252
<p>The ‘<a href="#word-spacing0"><code
22592253
class=property>word-spacing</code></a>’ property can specify limits on
22602254
<a href="#expansion-opportunity"><i>expansion opportunities</i></a>
@@ -2273,7 +2267,54 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
22732267
class=css>center</code>’ if ‘<a href="#text-justify0"><code
22742268
class=property>text-justify</code></a>’ is ‘<code
22752269
class=css>distribute</code>’, and as ‘<code class=css>start</code>
2276-
otherwise.) <!--
2270+
otherwise.)
2271+
2272+
<h4 id=justify-cursive><span class=secno>7.3.4. </span> Cursive Scripts</h4>
2273+
2274+
<p>Justification <em>must not</em> introduce gaps between <a
2275+
href="#letter0"><i>letters</i></a> of <a
2276+
href="#cursive-scripts"><i>cursive scripts</i></a> such as Arabic. If it
2277+
is able, the UA <em>may</em> translate space distributed to <a
2278+
href="#expansion-opportunity"><i>expansion opportunities</i></a> within a
2279+
run of such <a href="#letter0"><i>letters</i></a> into some form of
2280+
cursive elongation for that run. It otherwise <em>must</em> assume that no
2281+
<a href="#expansion-opportunity"><i>expansion opportunity</i></a> exists
2282+
between any pair of <i>cursive script</i> <a
2283+
href="#letter0"><i>letters</i></a>.
2284+
2285+
<h4 id=justify-alt><span class=secno>7.3.5. </span> Possible Algorithms</h4>
2286+
2287+
<p>The UA may enable or break optional ligatures or use other font features
2288+
such as alternate glyphs or glyph compression to help justify the text
2289+
under any method. This behavior is not controlled by this level of CSS.
2290+
2291+
<div class=note>
2292+
<p>The guidelines in this level of CSS do not describe a complete
2293+
justification algorithm. They are merely a minimum set of requirements
2294+
that a complete algorithm should meet. Limiting the set of requirements
2295+
gives UAs some latitude in choosing a justification algorithm that meets
2296+
their needs and desired balance of quality, speed, and complexity.
2297+
2298+
<p>For instance, a basic but fast ‘<code class=css>inter-word</code>
2299+
justification algorithm might use a simple greedy method for determining
2300+
line breaks, then distribute leftover space. This algorithm could follow
2301+
the guidelines by expanding word spaces first, expanding between letters
2302+
only if ‘<a href="#word-spacing0"><code
2303+
class=property>word-spacing</code></a>’ hit a limit.
2304+
2305+
<p>A more sophisticated but slower ‘<code class=css>inter-word</code>
2306+
justification algorithm might use a Knuth/Plass method where <a
2307+
href="#expansion-opportunity"><i>expansion opportunities</i></a> and
2308+
limits were assigned weights and assessed with other line breaking
2309+
considerations. This algorithm could follow the guidelines by giving more
2310+
weight to <a href="#word-separator"><i>word separators</i></a> than
2311+
letter spacing.
2312+
2313+
<p>It's not defined whether expansion or compression is preferred, so a UA
2314+
may, for example, bias towards compression for CJK languages but towards
2315+
expansion for Western alphabetic languages.
2316+
</div>
2317+
<!--
22772318
<p>The <i>expansion opportunity</i> priorities for values of 'text-justify'
22782319
are given in the table below. Since justification behavior
22792320
varies by writing system, <i>expansion opportunities</i> are organized by
@@ -2396,7 +2437,7 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
23962437
classes.
23972438
The default justification priority of these <i>expansion opportunities</i> is given above.
23982439
-->
2399-
<!--
2440+
<!--
24002441
<p id="justify-cursive">For justification of <i>cursive scripts</i>,
24012442
words may be expanded through kashida elongation or other cursive
24022443
expansion processes. Kashida may be applied in discrete units or
@@ -2464,10 +2505,6 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
24642505
</ol>
24652506
--></div>
24662507

2467-
<p>The UA may enable or break optional ligatures or use other font features
2468-
such as alternate glyphs or glyph compression to help justify the text
2469-
under any method. This behavior is not controlled by this level of CSS.
2470-
24712508
<h2 id=spacing><span class=secno>8. </span> Spacing</h2>
24722509

24732510
<p>CSS offers control over text spacing via the ‘<a

0 commit comments

Comments
 (0)