AutoSpacing extension

Inserts a four-per-em space (U+2005) between adjacent CJK ideographs and Latin letters or digits, approximating the inter-script gap specified by the W3C's Requirements for Chinese Text Layout (CLREQ) and CSS text-autospace: ideograph-alpha ideograph-numeric.

CLREQ targets flexible spacing applied by the layout engine — a default of 1/4 em, compressible to 1/8 em and expandable to 1/2 em during justification. Flutter has no native inter-script spacing (https://github.com/flutter/flutter/issues/94531), so this inserts a fixed U+2005 (exactly 1/4 em, the CLREQ resting width) as the closest static approximation. Hardcoding a regular space in source strings instead would produce an incorrect ~1/2 em gap and double up if native support ever lands, so apply this at render time — see issue #178.

Only Han ideographs are treated as CJK and only ASCII letters/digits as Latin; punctuation on either side is left untouched, matching the CSS spec. For non-mixed text (e.g. English-only strings) this is a cheap no-op.

on

Properties

spaced String

Available on String, provided by the AutoSpacing extension

This string with 1/4-em spaces inserted at CJK–Latin boundaries.
no setter