Skip to content

Commit 1fa76c0

Browse files
authored
[css-text-3][css-text-4] Switch letter-spacing from between letters to around letters #10193 (#14315)
1 parent 325262a commit 1fa76c0

2 files changed

Lines changed: 27 additions & 47 deletions

File tree

css-text-3/Overview.bs

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6126,9 +6126,10 @@ Word Spacing: the 'word-spacing' property</h3>
61266126
Tracking: the 'letter-spacing' property</h3>
61276127

61286128
<wpt title="
6129-
This section has partial test coverage.
6129+
This section has partial test coverage. Some tests may also need updating to the new letter-spacing model.
61306130
61316131
Missing tests:
6132+
* switch to applying letter-spacing on both sides of each letter instead of between letters
61326133
* Applies to text
61336134
* Due to <a href=https://github.com/w3c/csswg-drafts/issues/1518>issue 1518</a>, some/many tests in this section should be converted from MUST to SHOULD.
61346135
* inherit lengths as absolute
@@ -6317,8 +6318,9 @@ Tracking: the 'letter-spacing' property</h3>
63176318
letter-spacing/letter-spacing-204.html
63186319
</wpt>
63196320

6320-
Letter-spacing must not be applied at the beginning of a line.
6321-
Whether letter-spacing is applied at the end of a line is undefined in this level.
6321+
Letter-spacing is applied to each [=typographic character unit=]
6322+
by inserting half of the additional spacing on each side;
6323+
except it is not applied at the beginning or end of a line.
63226324

63236325
<wpt>
63246326
letter-spacing/letter-spacing-trim-start-001.html
@@ -6331,8 +6333,8 @@ Tracking: the 'letter-spacing' property</h3>
63316333
</wpt>
63326334

63336335
<div class="example">
6334-
When letter-spacing is not applied at the beginning or end of a line,
6335-
text always fits flush with the edge of the block.
6336+
Letter-spacing is not applied at the beginning or end of a line
6337+
so that text always fits flush with the edge of the block.
63366338

63376339
<pre highlight=css>
63386340
p { letter-spacing: 1em; }
@@ -6345,27 +6347,12 @@ Tracking: the 'letter-spacing' property</h3>
63456347
<p class="ls-ex good ls-fixed-width color-box" style="text-align: left">a&#x3000;b&#x3000;c</p>
63466348
<p class="ls-ex good ls-fixed-width color-box" style="text-align: right">a&#x3000;b&#x3000;c</p>
63476349

6348-
UAs therefore <em>really should not</em> [[RFC6919]]
6349-
append letter spacing to the right or trailing edge of a line:
6350+
Applying letter spacing to the right or trailing edge of a line
6351+
is incorrect:
63506352

63516353
<p class="ls-ex bad ls-fixed-width color-box" style="text-align: right">a&#x3000;b&#x3000;c&#x3000;</p>
63526354
</div>
63536355

6354-
Letter spacing between two [=typographic character units=]
6355-
effectively “belongs” to the innermost element
6356-
that contains the two [=typographic character units=]:
6357-
the total letter spacing between two adjacent [=typographic character units=]
6358-
(after bidi reordering)
6359-
is specified by and rendered within the innermost element
6360-
that <em>contains</em> the boundary
6361-
between the two [=typographic character units=].
6362-
However, the UA may instead attach letter-spacing at element boundaries
6363-
to one or the other [=typographic character unit=]
6364-
using the letter-spacing value pertaining to its containing element.
6365-
6366-
Note: This secondary behavior is permitted in this level
6367-
due to Web-compat concerns.
6368-
63696356
<wpt>
63706357
letter-spacing/letter-spacing-bidi-002.html
63716358
letter-spacing/letter-spacing-bidi-004.xht
@@ -6377,6 +6364,7 @@ Tracking: the 'letter-spacing' property</h3>
63776364
letter-spacing/letter-spacing-205.html
63786365
</wpt>
63796366

6367+
<!-- THIS EXAMPLE IS WRONG FIX IT
63806368
<div class="example">
63816369
An inline box is expected to only include
63826370
letter spacing between characters completely contained within that element,
@@ -6427,13 +6415,14 @@ Tracking: the 'letter-spacing' property</h3>
64276415

64286416
<pre highlight=html>
64296417

6430-
&lt;!-- abc followed by Hebrew letters alef (&#x5d0;), bet (&#x5d1;) and gimel (&#x5d2;) -->
6418+
&lt;!-- abc followed by Hebrew letters alef (&#x5d0;), bet (&#x5d1;) and gimel (&#x5d2;) --&gt;
64316419
&lt;!-- Reordering will display these in reverse order. --&gt;
64326420
<bdo dir=ltr>&lt;p>ab&lt;span>c&#x5d0;&lt;/span>&#x5d1;&#x5d2;&lt;/p></bdo>
64336421
</pre>
64346422

64356423
<p class="ls-ex">a&#x3000;b&#x3000;<span class="color-box">c</span>&#x3000;<span class="color-box">&#x5d0;</span>&#x3000;&#x5d1;&#x3000;&#x5d2;</p>
64366424
</div>
6425+
-->
64376426

64386427
Letter spacing ignores invisible zero-width formatting characters
64396428
(such as those from the Unicode Cf category).
@@ -8407,7 +8396,9 @@ Recent Changes</h3>
84078396

84088397
The following changes have been made since
84098398
the <a href="https://www.w3.org/TR/2026/CRD-css-text-3-20260608/">June 2026 Candidate Recommendation Draft</a>:
8410-
* Clarify that shaping breaks when 'vertical-align' is not its [=initial value=],
8399+
* Changed the 'letter-spacing' model from inserting space <a href="https://www.w3.org/TR/2026/CRD-css-text-3-20260608/#letter-spacing">between characters</a> to <a href="#letter-spacing">around characters</a>.
8400+
(<a href="https://github.com/w3c/csswg-drafts/issues/10193">Issue 10193</a>)
8401+
* Clarified that shaping breaks when 'vertical-align' is not its [=initial value=],
84118402
rather than mentioning ''vertical-align/baseline'' specifically,
84128403
to avoid confusion given further developments to 'vertical-align'.
84138404
(<a href="https://github.com/w3c/csswg-drafts/issues/13277">Issue 13277</a>)

css-text-4/Overview.bs

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9961,9 +9961,10 @@ Word Spacing: the 'word-spacing' property</h3>
99619961
Tracking: the 'letter-spacing' property</h3>
99629962

99639963
<wpt title="
9964-
This section has partial test coverage.
9964+
This section has partial test coverage. Some tests may also need updating to the new letter-spacing model.
99659965
99669966
Missing tests:
9967+
* switch to applying letter-spacing on both sides of each letter instead of between letters
99679968
* Applies to text
99689969
* Due to <a href=https://github.com/w3c/csswg-drafts/issues/1518>issue 1518</a>, some/many tests in this section should be converted from MUST to SHOULD.
99699970
* inherit lengths as absolute
@@ -10165,8 +10166,9 @@ Tracking: the 'letter-spacing' property</h3>
1016510166
letter-spacing/letter-spacing-204.html
1016610167
</wpt>
1016710168

10168-
Letter-spacing must not be applied at the beginning of a line.
10169-
Whether letter-spacing is applied at the end of a line is undefined in this level.
10169+
Letter-spacing is applied to each [=typographic character unit=]
10170+
by inserting half of the additional spacing on each side;
10171+
except it is not applied at the beginning or end of a line.
1017010172

1017110173
<wpt>
1017210174
letter-spacing/letter-spacing-trim-start-001.html
@@ -10179,8 +10181,8 @@ Tracking: the 'letter-spacing' property</h3>
1017910181
</wpt>
1018010182

1018110183
<div class="example">
10182-
When letter-spacing is not applied at the beginning or end of a line,
10183-
text always fits flush with the edge of the block.
10184+
Letter-spacing is not applied at the beginning or end of a line
10185+
so that text always fits flush with the edge of the block.
1018410186

1018510187
<pre highlight=css>
1018610188
p { letter-spacing: 1em; }
@@ -10193,27 +10195,12 @@ Tracking: the 'letter-spacing' property</h3>
1019310195
<p class="ls-ex good ls-fixed-width color-box" style="text-align: left">a&#x3000;b&#x3000;c</p>
1019410196
<p class="ls-ex good ls-fixed-width color-box" style="text-align: right">a&#x3000;b&#x3000;c</p>
1019510197

10196-
UAs therefore <em>really should not</em> [[RFC6919]]
10197-
append letter spacing to the right or trailing edge of a line:
10198+
Applying letter spacing to the right or trailing edge of a line
10199+
is incorrect:
1019810200

1019910201
<p class="ls-ex bad ls-fixed-width color-box" style="text-align: right">a&#x3000;b&#x3000;c&#x3000;</p>
1020010202
</div>
1020110203

10202-
Letter spacing between two [=typographic character units=]
10203-
effectively “belongs” to the innermost element
10204-
that contains the two [=typographic character units=]:
10205-
the total letter spacing between two adjacent [=typographic character units=]
10206-
(after bidi reordering)
10207-
is specified by and rendered within the innermost element
10208-
that <em>contains</em> the boundary
10209-
between the two [=typographic character units=].
10210-
However, the UA may instead attach letter-spacing at element boundaries
10211-
to one or the other [=typographic character unit=]
10212-
using the letter-spacing value pertaining to its containing element.
10213-
10214-
Note: This secondary behavior is permitted in this level
10215-
due to Web-compat concerns.
10216-
1021710204
<wpt>
1021810205
letter-spacing/letter-spacing-bidi-002.html
1021910206
letter-spacing/letter-spacing-bidi-004.xht
@@ -10225,6 +10212,7 @@ Tracking: the 'letter-spacing' property</h3>
1022510212
letter-spacing/letter-spacing-205.html
1022610213
</wpt>
1022710214

10215+
<!-- THIS EXAMPLE IS WRONG FIX IT
1022810216
<div class="example">
1022910217
An inline box is expected to only include
1023010218
letter spacing between characters completely contained within that element,
@@ -10275,13 +10263,14 @@ Tracking: the 'letter-spacing' property</h3>
1027510263

1027610264
<pre highlight=html>
1027710265

10278-
&lt;!-- abc followed by Hebrew letters alef (&#x5d0;), bet (&#x5d1;) and gimel (&#x5d2;) -->
10266+
&lt;!-- abc followed by Hebrew letters alef (&#x5d0;), bet (&#x5d1;) and gimel (&#x5d2;) --&gt;
1027910267
&lt;!-- Reordering will display these in reverse order. --&gt;
1028010268
<bdo dir=ltr>&lt;p>ab&lt;span>c&#x5d0;&lt;/span>&#x5d1;&#x5d2;&lt;/p></bdo>
1028110269
</pre>
1028210270

1028310271
<p class="ls-ex">a&#x3000;b&#x3000;<span class="color-box">c</span>&#x3000;<span class="color-box">&#x5d0;</span>&#x3000;&#x5d1;&#x3000;&#x5d2;</p>
1028410272
</div>
10273+
-->
1028510274

1028610275
Letter spacing ignores invisible zero-width formatting characters
1028710276
(such as those from the Unicode Cf category).

0 commit comments

Comments
 (0)