Skip to content

Commit 04758c3

Browse files
committed
[css3-text] Revert letter-spacing to taking a single value. Make word-spacing interpret its values more sensibly. Add pictures for text-justify.
--HG-- extra : rebase_source : b52796c2a09b3494484a510d84850693568d9f99
1 parent c025a05 commit 04758c3

5 files changed

Lines changed: 231 additions & 179 deletions

File tree

css3-text/Overview.html

Lines changed: 128 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,20 +2142,49 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
21422142
along with expanding between CJK and Southeast Asian <a
21432143
href="#letter0"><i>letters</i></a>.
21442144

2145+
<div class=figure id=fig-text-justify-cursive>
2146+
<p> <img
2147+
alt="Two lines of calligraphic Arabic end together due to a mix of compressed and swash forms."
2148+
class=example src=text-justify-cursive.png
2149+
title="Swash forms elongate the first line while a compressed contextual ligature shortens the second, allowing both to end precisely together.">
2150+
2151+
<p class=caption>An example of cursively-justified Arabic text rendered
2152+
by <a href="http://www.decotype.com/">Tasmeem</a>.
2153+
</div>
2154+
2155+
<div class=figure id=fig-text-justify-distribute>
2156+
<p> <img
2157+
alt="Extra space is partly to spaces and partly among CJK and Thai letters."
2158+
class=example src=text-justify-compromise.png>
2159+
2160+
<p class=caption>Mixed-script text with ‘<code class=css>text-justify:
2161+
auto</code>’: this interpretation uses a universal-compromise
2162+
justification method, expanding at spaces as well as between CJK and
2163+
Southeast Asian letters.
2164+
</div>
2165+
21452166
<dt><dfn id=none1 title="text-justify:none"><code
21462167
class=css>none</code></dfn>
21472168

2148-
<dd>Justification is disabled. <span class=note>This value is intended for
2149-
use in user stylesheets to improve readability or for accessibility
2150-
purposes.</span>
2169+
<dd>Justification is disabled.
2170+
<p class=note>This value is intended for use in user stylesheets to
2171+
improve readability or for accessibility purposes.
21512172

21522173
<dt><dfn id=inter-word title="text-justify:inter-word"><code
21532174
class=css>inter-word</code></dfn>
21542175

21552176
<dd>Justification primarily varies the used ‘<a
21562177
href="#word-spacing0"><code class=property>word-spacing</code></a>’.
21572178
This behavior is typical for languages that separate words using spaces,
2158-
like English or Korean. <!--
2179+
like English or Korean.
2180+
<div class=figure id=fig-text-justify-distribute>
2181+
<p> <img alt="Extra space is equally distributed mainly to spaces."
2182+
class=example src=text-justify-interword.png>
2183+
2184+
<p class=caption>Mixed-script text with ‘<code class=css>text-justify:
2185+
inter-word</code>
2186+
</div>
2187+
<!--
21592188
<dt><dfn title="text-justify:inter-ideographic">''inter-ideograph''</dfn></dt>
21602189
<dd>Justification primarily changes spacing at word separators and
21612190
between characters in <a href="#block-scripts">block scripts</a>.
@@ -2175,8 +2204,16 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
21752204
href="#letter-spacing0"><code class=property>letter-spacing</code></a>
21762205
(excepting between <a href="#letter0"><i>letters</i></a> in <a
21772206
href="#cursive-scripts"><i>cursive scripts</i></a> such as Arabic). This
2178-
value is sometimes used in e.g. Japanese.</dd>
2179-
<!--
2207+
value is sometimes used in e.g. Japanese.
2208+
<div class=figure id=fig-text-justify-distribute>
2209+
<p> <img
2210+
alt="Extra space is equally distributed at points between spaces and letters of all writing systems."
2211+
class=example src=text-justify-distribute.png>
2212+
2213+
<p class=caption>Mixed-script text with ‘<code class=css>text-justify:
2214+
distribute</code>
2215+
</div>
2216+
<!--
21802217
<dt><a name="kashida-prop"></a><a name="text-kashida-space"></a>
21812218
<dfn title="text-justify:kashida">''kashida''</dfn></dt>
21822219
<dd>Justification primarily stretches
@@ -2195,13 +2232,6 @@ <h3 id=text-justify><span class=secno>7.3. </span> Justification Method:
21952232
class="example" src="text-justify-east-asia.png" height="376" width="491"></p>
21962233
<p class="caption">Values of 'text-justify': ''inter-word'', ''auto'', and ''distribute''</p>
21972234
</div>
2198-
2199-
<div class="figure" id="fig-text-justify-kashida">
2200-
<p>
2201-
<img alt="One possible example of rendering for Arabic justification"
2202-
class="example" src="text-justify-arabic.png" height="73" width="325"></p>
2203-
<p class="caption">One possible example of rendering for 'text-justify': ''auto''</p>
2204-
</div>
22052235
-->
22062236

22072237
<p>When justifying text, the user agent takes the remaining space between
@@ -2497,69 +2527,6 @@ <h2 id=spacing><span class=secno>8. </span> Spacing</h2>
24972527
<pre>p { word-spacing: -50% 0%; }</pre>
24982528
</div>
24992529

2500-
<p id=spacing-limits>The <dfn
2501-
id=ltspacing-limitsgt>&lt;spacing-limits&gt;</dfn> value type, which
2502-
represents optimum, minimum, and maximum spacing in ‘<a
2503-
href="#word-spacing0"><code class=property>word-spacing</code></a>’ and
2504-
<a href="#letter-spacing0"><code
2505-
class=property>letter-spacing</code></a>’, is defined as
2506-
2507-
<pre class=prod><dfn
2508-
id=ltspacing-limits>&lt;spacing-limits></dfn> = [ normal | &lt;length&gt; | &lt;percentage&gt;]{1,3}</pre>
2509-
2510-
<p>If three values are specified, they represent the optimum, minimum, and
2511-
maximum in that order. If only two values are specified, then the first
2512-
represents both the optimum and the minimum, and the second represents the
2513-
maximum. If just one value is specified, then it represents the optimum,
2514-
minimum, and maximum. The values are interpreted as defined below:
2515-
2516-
<dl>
2517-
<dt><dfn id=normal3 title="&lt;spacing-limits&gt;:normal"><code
2518-
class=css>normal</code></dfn>
2519-
2520-
<dd>Specifies normal spacing as defined by the current font and/or the
2521-
user agent; see <a href="#normal-spacing">below</a>. A ‘<code
2522-
class=css>normal</code>’ optimum spacing value computes to zero.
2523-
2524-
<dt><dfn id=ltlengthgt
2525-
title="&lt;spacing-limits&gt;:&lt;length&gt;"><code
2526-
class=css>&lt;length&gt;</code></dfn>
2527-
2528-
<dd>Specifies extra spacing <em>in addition to</em> the intrinsic
2529-
inter-character/inter-word spacing defined by the font. Values may be
2530-
negative, but there may be implementation-dependent limits.
2531-
2532-
<dt><dfn id=ltpercentagegt
2533-
title="&lt;spacing-limits&gt;:&lt;percentage&gt;"><code
2534-
class=css>&lt;percentage&gt;</code></dfn>
2535-
2536-
<dd>Specifies the additional spacing as a percentage of the affected
2537-
character's <i>advance measure</i>. Only valid on ‘<a
2538-
href="#word-spacing0"><code class=property>word-spacing</code></a>’.
2539-
</dl>
2540-
2541-
<p>In the absence of justification the optimum spacing is be used. The text
2542-
justification process may alter the spacing from its optimum (see the <a
2543-
href="#text-justify"><code class=property>text-justify</code></a>
2544-
property, above) but must not violate the minimum spacing limit and should
2545-
also avoid exceeding the maximum. The UA may also use the difference
2546-
between the minimum/maximum limits and the optimum as input into a
2547-
weighting algorithm for justification.
2548-
2549-
<p>The minimum is treated as a hard constraint: if the maximum is less than
2550-
the minimum, then the used it is set to the minimum. Likewise for the
2551-
optimum. Similarly if the maximum is less than the optimum, then the used
2552-
optimum is set to the used maximum.
2553-
2554-
<p><dfn id=normal-spacing>Normal spacing</dfn>: Although ‘<code
2555-
class=css>normal</code>’ minimum and maximum spacing limits are
2556-
UA-defined, they must be defined relative to the optimum so that the
2557-
limits increase and decrease with changes to the optimum spacing. Normal
2558-
limits may also vary according to the value of the <a
2559-
href="#text-justify"><code class=property>text-justify</code></a>
2560-
property, the element's language, some measure of the amount of text on a
2561-
line (e.g. block width divided by font size), and/or other factors.
2562-
25632530
<h3 id=word-spacing><span class=secno>8.1. </span> Word Spacing: the ‘<a
25642531
href="#word-spacing0"><code class=property>word-spacing</code></a>
25652532
property</h3>
@@ -2574,7 +2541,8 @@ <h3 id=word-spacing><span class=secno>8.1. </span> Word Spacing: the ‘<a
25742541
<tr>
25752542
<th><a href="#values">Value</a>:
25762543

2577-
<td><a href="#spacing-limits">&lt;spacing-limits&gt;</a>
2544+
<td>[ normal | <var>&lt;length&gt;</var> |
2545+
<var>&lt;percentage&gt;</var>]{1,3}
25782546

25792547
<tr>
25802548
<th>Initial:
@@ -2609,14 +2577,60 @@ <h3 id=word-spacing><span class=secno>8.1. </span> Word Spacing: the ‘<a
26092577
class=css>normal</code>
26102578
</table>
26112579

2612-
<p>This property specifies the minimum, maximum, and optimal spacing
2613-
between “words”.
2580+
<p>This property specifies the optimum, maximum, and minimum spacing
2581+
between “words” (in that order). Missing values are assumed to be
2582+
<code class=css>normal</code>’. Values are interpreted as defined
2583+
below:
2584+
2585+
<dl>
2586+
<dt><dfn id=normal3 title="word-spacing:normal"><code
2587+
class=css>normal</code></dfn>
2588+
2589+
<dd>Specifies normal spacing as defined by the current font and/or the
2590+
user agent; see <a href="#normal-spacing">below</a>. A ‘<code
2591+
class=css>normal</code>’ optimum spacing value computes to zero.
2592+
2593+
<dt><dfn id=ltlengthgt title="word-spacing:&lt;length&gt;"><code
2594+
class=css>&lt;length&gt;</code></dfn>
2595+
2596+
<dd>Specifies extra spacing <em>in addition to</em> the intrinsic
2597+
inter-word spacing defined by the font. Values may be negative, but there
2598+
may be implementation-dependent limits.
2599+
2600+
<dt><dfn id=ltpercentagegt
2601+
title="word-spacing:&lt;percentage&gt;"><code
2602+
class=css>&lt;percentage&gt;</code></dfn>
2603+
2604+
<dd>Specifies the additional spacing as a percentage of the affected
2605+
character's <i>advance measure</i>.
2606+
</dl>
26142607

26152608
<p>Additional spacing is applied to each word-separator character left in
26162609
the text after the <a href="#white-space-rules">white space processing
26172610
rules</a> have been applied, and should be applied half on each side of
26182611
the character unless otherwise dictated by typographic tradition.
26192612

2613+
<p>In the absence of justification the optimum spacing is be used. The text
2614+
justification process may alter the spacing from its optimum (see the <a
2615+
href="#text-justify"><code class=property>text-justify</code></a>
2616+
property, above) but must not violate the minimum spacing limit and should
2617+
also avoid exceeding the maximum. The UA may also use the difference
2618+
between the minimum/maximum limits and the optimum as input into a
2619+
weighting algorithm for justification.
2620+
2621+
<p>The used optimum and maximum spacing is floored at the minimum.
2622+
Similarly if the maximum is less than the optimum, then the used optimum
2623+
is limited to the used maximum.
2624+
2625+
<p><dfn id=normal-spacing>Normal spacing</dfn>: Although ‘<code
2626+
class=css>normal</code>’ minimum and maximum spacing limits are
2627+
UA-defined, they must be defined relative to the optimum so that the
2628+
limits increase and decrease with changes to the optimum spacing. Normal
2629+
limits may also vary according to the value of the <a
2630+
href="#text-justify"><code class=property>text-justify</code></a>
2631+
property, the element's language, some measure of the amount of text on a
2632+
line (e.g. block width divided by font size), and/or other factors.
2633+
26202634
<div class=example>
26212635
<p>The following example will make all the spaces between words in Arabic
26222636
be rendered as zero-width, and double the width of each space in English:
@@ -2655,7 +2669,7 @@ <h3 id=letter-spacing><span class=secno>8.2. </span> Tracking: the ‘<a
26552669
<tr>
26562670
<th><a href="#values">Value</a>:
26572671

2658-
<td><a href="#spacing-limits">&lt;spacing-limits&gt;</a>
2672+
<td>normal | <var>&lt;length&gt;</var>
26592673

26602674
<tr>
26612675
<th>Initial:
@@ -2685,13 +2699,29 @@ <h3 id=letter-spacing><span class=secno>8.2. </span> Tracking: the ‘<a
26852699
<tr>
26862700
<th>Computed value:
26872701

2688-
<td>an optimum, minimum, and maximum value, each consisting of either an
2689-
absolute length or the keyword ‘<code class=css>normal</code>
2702+
<td>an optimum value each consisting of either an absolute length or the
2703+
keyword ‘<code class=css>normal</code>
26902704
</table>
26912705

2692-
<p>This property specifies the minimum, maximum, and optimal spacing
2693-
between <a href="#character"><i>characters</i></a>. Letter-spacing is
2694-
applied in addition to any word-spacing.
2706+
<p>This property specifies the optimal spacing between adjacent <a
2707+
href="#character"><i>characters</i></a>. Letter-spacing is applied in
2708+
addition to any word-spacing. Values have the following meanings:
2709+
2710+
<dl>
2711+
<dt><dfn id=normal4 title="word-spacing:normal"><code
2712+
class=css>normal</code></dfn>
2713+
2714+
<dd>Specifies normal spacing between <a
2715+
href="#character"><i>characters</i></a> as defined by the current font.
2716+
Typically this is zero.
2717+
2718+
<dt><dfn id=ltlengthgt0 title="word-spacing:&lt;length&gt;"><code
2719+
class=css>&lt;length&gt;</code></dfn>
2720+
2721+
<dd>Specifies additional spacing between <a
2722+
href="#character"><i>characters</i></a> Values may be negative, but there
2723+
may be implementation-dependent limits.
2724+
</dl>
26952725

26962726
<p>Letter-spacing must not be applied at the beginning or at the end of a
26972727
line. The total letter spacing between two adjacent <a
@@ -2729,6 +2759,9 @@ <h3 id=letter-spacing><span class=secno>8.2. </span> Tracking: the ‘<a
27292759
connections, it should not apply letter-spacing between characters of that
27302760
script at all.
27312761

2762+
<p class=issue>Current UAs just put gaps between joined letters in cursive
2763+
scripts.
2764+
27322765
<p>Letter-spacing ignores zero-width characters (such as those from the
27332766
Unicode Cf category). For example, ‘<a href="#letter-spacing0"><code
27342767
class=property>letter-spacing</code></a>’ applied to
@@ -3494,6 +3527,14 @@ <h3 class=no-num id=recent-changes> Changes from the <a
34943527
class=css>inter-cluster</code>’, and ‘<code
34953528
class=css>kashida</code>’ values of ‘<a href="#text-justify0"><code
34963529
class=property>text-justify</code></a>’.
3530+
3531+
<li>Dropped minimum and maximum values in ‘<a
3532+
href="#letter-spacing0"><code
3533+
class=property>letter-spacing</code></a>’.
3534+
3535+
<li>Changed interpretation of three-value syntax in ‘<a
3536+
href="#word-spacing0"><code class=property>word-spacing</code></a>’ to
3537+
default missing values to ‘<code class=css>normal</code>’.
34973538
</ul>
34983539

34993540
<p>Significant details updated:
@@ -3742,7 +3783,7 @@ <h2 class=no-num id=appendix-g-full-property-index>Appendix G: Full
37423783
<tr>
37433784
<th><a class=property href="#letter-spacing0">letter-spacing</a>
37443785

3745-
<td>&lt;spacing-limits&gt;
3786+
<td>normal | &lt;length&gt;
37463787

37473788
<td>normal
37483789

@@ -3908,7 +3949,7 @@ <h2 class=no-num id=appendix-g-full-property-index>Appendix G: Full
39083949
<tr>
39093950
<th><a class=property href="#word-spacing0">word-spacing</a>
39103951

3911-
<td>&lt;spacing-limits&gt;
3952+
<td>[ normal | &lt;length&gt; | &lt;percentage&gt;]{1,3}
39123953

39133954
<td>normal
39143955

0 commit comments

Comments
 (0)