Intent to Ship: CJK punctuation kerning: the CSS `text-spacing-trim` property

618 views
Skip to first unread message

Koji Ishii

unread,
Jan 31, 2024, 12:38:19 AM1/31/24
to blink-dev, Lingqi Chi, Ian Kilpatrick

Contact emails

ko...@chromium.orglin...@chromium.org

Explainer

None

Specification

https://drafts.csswg.org/css-text-4/#text-spacing-trim-property

Design docs


https://docs.google.com/document/d/146Bupkg3nrNALL3bm8UElRd0vsLVH5807xubsnrthDw/edit?usp=sharing

Summary

Applies the kerning to CJK punctuation characters to produce the visually pleasing typography as defined by JLREQ (Requirements for Japanese Text Layout) and CLREQ (Requirements for Chinese Text Layout). Many CJK punctuation characters include glyph-internal spacing. For example, the CJK full stop and the CJK close parenthesis usually have glyph-internal spacings on the right half of their glyph spaces, to give them a constant advance as other ideographic characters. But when they appear in a row, the glyph-internal spacings become excessive. This feature adjusts such excessive spacing. This feature adjusts the glyph-internal spacing for 1) adjacent characters (pair kerning), 2) at the line start, and 3) at the line end, by using the font data.



Blink component

Blink>Layout>Inline

TAG review

https://github.com/w3ctag/design-reviews/issues/907

TAG review status

Not applicable

Risks



Interoperability and Compatibility

None



Gecko: Positive (https://github.com/mozilla/standards-positions/issues/903)

WebKit: Positive (https://github.com/w3c/csswg-drafts/issues/4246) A flag is available in Safari Technology Preview.

Web developers: Positive (https://twitter.com/fontplus/status/1405020633600233479) This tweet about a web font provider in Japan providing this feature in fonts got 485 likes as of Aug 2023.

Other signals: Parts of the feature is shipping in Android 13, ChromeOS 90, iOS 17, MS Word 6.0, and LibreOffice.

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

Yes

Is this feature fully tested by web-platform-tests?

Yes

https://wpt.fyi/results/css/css-text?label=experimental&label=master&aligned&q=text-spacing-trim



Flag name on chrome://flags

None

Finch feature name

None

Non-finch justification

None

Requires code in //chrome?

False

Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1463891

Sample links


https://output.jsbin.com/figixaq

Estimated milestones

Shipping on desktop123
Shipping on Android123
Shipping on WebView123


Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5170044014690304

Links to previous Intent discussions

Intent to prototype: https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAHe_1dKP6u%2BXJ5Vi9aH_AVHJiFPoUM7BhSTYX-oRTPxz87c5XQ%40mail.gmail.com

This intent message was generated by Chrome Platform Status.

Koji Ishii

unread,
Jan 31, 2024, 7:40:27 AM1/31/24
to Kagami Rosylight, blink-dev, Lingqi Chi, ikilp...@chromium.org
Hi Kagami,

Thank you for the information and sorry about the misunderstanding. Fixed the chromestatus entry.

On Wed, Jan 31, 2024 at 8:30 PM Kagami Rosylight <krosy...@mozilla.com> wrote:

Hi Blink people,

I think there was a misunderstanding while reading Mozilla's standards position issue; the issue currently has no response from Mozilla employee and thus should be understood as No Signal rather than Positive.

I hope this makes sense.

Kagami Rosylight

unread,
Jan 31, 2024, 10:10:02 AM1/31/24
to blink-dev, Koji Ishii, Lingqi Chi, Ian Kilpatrick
Hello, Koji Ishii;

I think this post includes a mistake about Mozilla's standards position. https://github.com/mozilla/standards-positions/issues/903 does not have any comment from Mozilla employee so far, so I think it should be No Signal instead.

Kagami Rosylight

unread,
Jan 31, 2024, 10:10:02 AM1/31/24
to blink-dev, ko...@chromium.org, Lingqi Chi, ikilp...@chromium.org

Hi Blink people,

I think there was a misunderstanding while reading Mozilla's standards position issue; the issue currently has no response from Mozilla employee and thus should be understood as No Signal rather than Positive.

I hope this makes sense.

Kagami Rosylight

unread,
Jan 31, 2024, 10:10:02 AM1/31/24
to blink-dev, Koji Ishii, Lingqi Chi, Ian Kilpatrick
Hello, Koji Ishii;

I think this post has a mistake about Mozilla's standards position. https://github.com/mozilla/standards-positions/issues/903 is empty without Mozilla employee's comment, so I think it should be treated as No Signal here.

Thanks!

Kagami Rosylight

unread,
Jan 31, 2024, 10:12:41 AM1/31/24
to blink-dev, Kagami Rosylight, ko...@chromium.org, Lingqi Chi, ikilp...@chromium.org
Oops, the approved emails are now coming. Sorry for the spam, and thank you for fixing it 👍

Philip Jägenstedt

unread,
Feb 1, 2024, 6:02:55 AM2/1/24
to Koji Ishii, blink-dev, Lingqi Chi, Ian Kilpatrick
Hi Koji,

Thanks for linking the tests, judging just by the test names it looks like many combinations of languages and fonts are tested. Some of the tests are failing though, is that expected?

Also, I see that some of the tests don't actually use text-spacing-trim, are those just testing default behaviors or what's the reason?

The design doc says "This version implements a subset of the values defined in the spec", is that still accurate, or is there support for all of space-all | normal | trim-auto | trim-start | space-first | trim-all?

Finally, since text-spacing-trim and text-autospace are longhands for text-spacing, what is the plan for text-spacing? Will we introduce the shorthand later together with text-autospace? That should mean that something like `text-spacing: trim-all` won't work initially, even though it doesn't involve text-autospace. But on the other hand shipping the shorthand without text-autospace would break `text-spacing: punctuation` and similar. I don't have a suggestion here, but can you clarify what the overall plan is?

Best regards,
Philip

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAHe_1dLUB%3D%3Dt8Qp102HDPUQiuM1qAG_da3bb44mG22FAVP%3Dk6A%40mail.gmail.com.

Philip Jägenstedt

unread,
Feb 1, 2024, 6:14:24 AM2/1/24
to Koji Ishii, blink-dev, Lingqi Chi, Ian Kilpatrick
As a data point, I see that the flag in STP is called "CSS text-spacing property", which suggests all 3 properties behind a single flag. It might not ship together, but it's a good guess.

Koji Ishii

unread,
Feb 1, 2024, 6:42:36 AM2/1/24
to Philip Jägenstedt, blink-dev, Lingqi Chi, Ian Kilpatrick
Hi Philip, thanks for the questions. Please see replies inline:

Thanks for linking the tests, judging just by the test names it looks like many combinations of languages and fonts are tested.

Yes, many combinations are to ensure they test different branches in our code.

Some of the tests are failing though, is that expected?

Yes, this current implementation supports subset (see below), and failing tests are for values that are not supported yet.

Also, I see that some of the tests don't actually use text-spacing-trim, are those just testing default behaviors or what's the reason?

Yes, the initial value `normal` applies the pair-kerning (adjacent) and line-end (the table below the value list might be easier to know which value affects where). Tests without `text-spacing-trim` are testing these behaviors.

The design doc says "This version implements a subset of the values defined in the spec", is that still accurate, or is there support for all of space-all | normal | trim-auto | trim-start | space-first | trim-all?

It's still accurate. The current implementation supports 4 values: normal | trim-start | space-all | space-first. I added this to the chromestatus entry (I thought I did this but it looks like it's gone somehow).

Finally, since text-spacing-trim and text-autospace are longhands for text-spacing, what is the plan for text-spacing? Will we introduce the shorthand later together with text-autospace? That should mean that something like `text-spacing: trim-all` won't work initially, even though it doesn't involve text-autospace. But on the other hand shipping the shorthand without text-autospace would break `text-spacing: punctuation` and similar. I don't have a suggestion here, but can you clarify what the overall plan is?

The current plan is to ship the shorthand when both properties ship. Shipping the shorthand only for `text-spacing-trim` is technically possible, but it complicates the code and tests. I think it's prudent to defer until both properties ship.

Originally we thought the `text-autospace` could ship before `text-spacing-trim` or together, but a blocking spec issue was found recently. Given its complexity, it's likely to take a few quarters.

As a data point, I see that the flag in STP is called "CSS text-spacing property", which suggests all 3 properties behind a single flag. It might not ship together, but it's a good guess.

Right, the current code in WebKit under the flag isn't ready to ship yet, but this is one of their 2024 plans discussed at the WebKit contributor meeting. I'm talking to WebKit engineers about our status, they're interested in seeing web developer feedback to Chromium. This is one of the reasons I think we should ship `text-spacing-trim` first, without waiting for `text-autospace` to be ready.

Domenic Denicola

unread,
Feb 12, 2024, 10:13:45 PM2/12/24
to blink-dev, Koji Ishii, blink-dev, Lingqi Chi, Ian Kilpatrick, Philip Jägenstedt
LGTM1

Asif jutt Jutt

unread,
Feb 13, 2024, 5:24:44 AM2/13/24
to Domenic Denicola, ko...@chromium.org, blink-dev, Lingqi Chi, Ian Kilpatrick, Philip Jägenstedt
Support on update 

Service delivery Manager

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Philip Jägenstedt

unread,
Feb 13, 2024, 9:35:35 AM2/13/24
to Domenic Denicola, blink-dev, Koji Ishii, Lingqi Chi, Ian Kilpatrick
LGTM2

I agree that it makes sense to wait with the shorthand until we support both of the longhand properties. Some developers may be surprised when text-spacing doesn't work but text-spacing-trim does, but it can be feature detected so I don't think it's worth delaying all 3 properties to ship together.

Yoav Weiss (@Shopify)

unread,
Feb 13, 2024, 1:48:17 PM2/13/24
to Philip Jägenstedt, Domenic Denicola, blink-dev, Koji Ishii, Lingqi Chi, Ian Kilpatrick
LGTM3

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Reply all
Reply to author
Forward
0 new messages