The text-spacing-trim
property applies spacing/kerning to CJK punctuation characters to produce visually pleasing typography as defined by the Requirements for Japanese text layout (JLREQ) and the Requirements for Chinese text layout (CLREQ).
Many CJK punctuation characters include glyph-internal spacing. For example, the CJK full stop and the CJK close parenthesis usually have glyph-internal spacing on their right-hand side, to give them a constant advance measure consistent with other ideographic characters. However, when they appear in a row, the glyph-internal spacing can become excessive.
text-spacing-trim
can be used to adjust such excessive spacing between adjacent characters (kerning) and at the start or end of text lines. Generally speaking:
- If a full-width punctuation character is set to be full-width, it has internal spacing set on both sides and is the full width of an ideograph.
- If a full-width punctuation character is set to be half-width, it has internal spacing set on one side only, and its other side is flush to the start (in the case of opening punctuation characters) or end (in the case of closing punctuation characters). Half-width characters are typically half the width of an ideograph.
Note: To avoid the risk of excessive kerning, fonts must have the OpenType Alternate Half Widths (halt
) feature, the Contextual Half-width Spacing (chws
) feature, or both. If the font doesn't have either feature, text-spacing-trim
is disabled.