Files
shinyobjectz 85beee43c6 text-autospace's initial value is no-autospace, as Chrome's and Gecko's are (closes #44). raea's stylo enabled text-autospace for Servo (for parley's layout/autospace.rs) with an initial value of normal, so every page without the property got Chrome's ideograph-alpha/ideograph-numeric spacing anyway: "2026년" at 48px sans-serif drew 6 px wider unstyled than with text-autospace: no-autospace. Chrome 148 draws the unstyled line as no-autospace and only text-autospace: normal wider. The initial value is now NO_AUTOSPACE (vendor/stylo longhands.toml); parley's comments said Chrome's initial was normal and now say what it is.
bench/text-autospace/check.sh draws three "2026년" lines (unstyled, normal, no-autospace) and finds where each line's ink ends. The unstyled line must end where no-autospace's does, and normal's 5-7 px further right. The raea before this ends them at 202/202/196 and fails, the raea with it at 196/202/196 and passes; Chrome 148 ends them at 184/190/184 (a different sans-serif, the same 6 px). WPT css-text --only text-autospace: 13 of 26 pass before and after, the same tests.

fps, the same 120-frame text-autospace page back to back, three runs each: 4.3, 3.3, 3.9 ms a frame before, 3.7, 3.5, 4.3 after (about 260 fps both).

Upstream candidate: stylo's text-autospace is Gecko-only upstream; enabling it for Servo would need this initial value.
2026-11-08 02:07:51 -08:00

23 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# #44: text-autospace's initial value is no-autospace, as Chrome's is (raea had normal: digits next to Hangul or CJK
# got 1/8 em gaps Chrome doesn't draw). index.html draws "2026년" at 48 px three times: unstyled, with
# text-autospace: normal, and with no-autospace. The unstyled line's ink must end where the no-autospace line's does,
# and the normal line's 6 px (1/8 em) further right, as Chrome 148 measures them (148.31, 154.31, 148.31 px).
# Exits 1 on a failure.
# bench/text-autospace/check.sh (RAEA_BIN: the raea to run, default target/release/raea)
cd "$(dirname "$0")/../.." || exit 2
BIN=${RAEA_BIN:-$PWD/target/release/raea}
export RAEA_SIGN=0 RAEA_MARK=0 RAEA_EXPORT_CACHE=0
OUT=$(mktemp -d "${TMPDIR:-/tmp}/raea-text-autospace.XXXXXX")
trap 'rm -rf "$OUT"' EXIT
"$BIN" render bench/text-autospace/index.html -o "$OUT/a.png" > "$OUT/log" 2>&1 || { echo "FAIL render (log below)"; sed 's/^/ /' "$OUT/log"; exit 1; }
# the x just past a line's last ink (line n: y 80n to 80n+80)
end() { magick "$OUT/a.png" -crop "x80+0+$((80 * $1))" +repage -threshold 50% -negate -trim -format '%[fx:page.x+w]' info:; }
unstyled=$(end 0) normal=$(end 1) none=$(end 2)
status=0
[ "$unstyled" = "$none" ] || { echo "FAIL the unstyled line ends at x $unstyled, the no-autospace one at $none (Chrome: the same)"; status=1; }
gap=$((normal - none))
(( gap >= 5 && gap <= 7 )) || { echo "FAIL text-autospace: normal ends $gap px past no-autospace, wanted 6 (1/8 em)"; status=1; }
[ $status = 0 ] && echo "PASS text-autospace (ends at $unstyled, $normal, $none)"
exit $status