Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

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.

shinyobjectz85beee43c675
diff --git a/bench/text-autospace/check.sh b/bench/text-autospace/check.sh
new file mode 100755
index 00000000..2f752538
--- /dev/null
+++ b/bench/text-autospace/check.sh
@@ -0,0 +1,22 @@
+#!/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
diff --git a/bench/text-autospace/index.html b/bench/text-autospace/index.html
new file mode 100644
index 00000000..c65ad99b
--- /dev/null
+++ b/bench/text-autospace/index.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<!-- #44: text-autospace's initial value is no-autospace, as Chrome's is: an unstyled "2026년" is drawn tight, as with
+ no-autospace, and only text-autospace: normal puts 1/8 em (6 px at 48 px) between the digits and the Hangul.
+ Chrome 148: getComputedStyle(body).textAutospace is "no-autospace", and the three lines measure 148.31, 154.31
+ and 148.31 px wide. check.sh compares where each line's ink ends. -->
+<meta charset="utf-8">
+<style>
+ body { margin: 0; background: #fff; color: #000; font: 48px sans-serif; }
+ div { height: 80px; padding-left: 20px; }
+</style>
+<body>
+<div data-composition-id="main" data-start="0" data-duration="1" data-width="320" data-height="240">
+ <div>2026년</div>
+ <div style="text-autospace: normal">2026년</div>
+ <div style="text-autospace: no-autospace">2026년</div>
+</div>
+</body>
diff --git a/vendor/parley/src/layout/autospace.rs b/vendor/parley/src/layout/autospace.rs
index ad8e7f42..8d8e4b24 100644
--- a/vendor/parley/src/layout/autospace.rs
+++ b/vendor/parley/src/layout/autospace.rs
@@ -1,10 +1,10 @@
// raea: CSS Text 4 § 6.4 `text-autospace`: 1/8 em of space where an ideograph meets a letter or a decimal digit
-// (UTR #59's Wide against Narrow, parley_engine raea_autospace_class), as Chrome inserts it (its initial value is
-// `normal`). The space follows the logically earlier atom, so that it falls between the two: in a right-to-left run it
-// goes on the later one, and after one on the run's first atom (its right edge). It crosses an inline element's edges
-// but not an atomic inline. Both sides' styles must ask for it, and it takes the later atom's font size. The
-// line breaker adds it to the atom's advance (LayoutData::tab_extras), doesn't count it toward the line's fit and
-// drops it at the end of a line that wraps after the atom (line_break.rs).
+// (UTR #59's Wide against Narrow, parley_engine raea_autospace_class), as Chrome inserts it with `normal` (its
+// initial value is `no-autospace`: raea #44). The space follows the logically earlier atom, so that it falls between
+// the two: in a right-to-left run it goes on the later one, and after one on the run's first atom (its right edge).
+// It crosses an inline element's edges but not an atomic inline. Both sides' styles must ask for it, and it takes the
+// later atom's font size. The line breaker adds it to the atom's advance (LayoutData::tab_extras), doesn't count it
+// toward the line's fit and drops it at the end of a line that wraps after the atom (line_break.rs).
use alloc::collections::BTreeMap;
diff --git a/vendor/parley/src/style/mod.rs b/vendor/parley/src/style/mod.rs
index 2ca984df..5a3f98c8 100644
--- a/vendor/parley/src/style/mod.rs
+++ b/vendor/parley/src/style/mod.rs
@@ -305,7 +305,7 @@ pub enum Hyphens {
}
/// raea: CSS Text 4 `text-autospace`: which boundaries between ideographs and other text get 1/8 em of space
-/// (layout/autospace.rs). Off by default; Blitz sets it from stylo (`normal`, Chrome's initial value, is both).
+/// (layout/autospace.rs). Off by default; Blitz sets it from stylo (initial `no-autospace`, as Chrome's).
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
pub struct TextAutospace {
/// Between an ideograph and a letter.
diff --git a/vendor/stylo/properties/longhands.toml b/vendor/stylo/properties/longhands.toml
index 0af833bc..62433ad2 100644
--- a/vendor/stylo/properties/longhands.toml
+++ b/vendor/stylo/properties/longhands.toml
@@ -2587,8 +2587,8 @@ affects = "layout"
[text-autospace]
type = "TextAutospace"
-# raea: on servo too, with Chrome's initial value (normal; Gecko's is no-autospace), for parley's layout/autospace.rs
-initial = "computed::text::TextAutospace::NORMAL"
+# raea: on servo too, for parley's layout/autospace.rs; initial no-autospace, as Chrome's and Gecko's are (#44)
+initial = "computed::text::TextAutospace::NO_AUTOSPACE"
struct = "inherited_text"
animation_type = "discrete"
gecko_pref = "layout.css.text-autospace.enabled"
diff --git a/vendor/vendor.toml b/vendor/vendor.toml
index cf002a8c..81de0ab7 100644
--- a/vendor/vendor.toml
+++ b/vendor/vendor.toml
@@ -84,7 +84,7 @@ exit = "parley carrying the fix"
path = "vendor/stylo"
upstream = "crates.io:0.22.0"
kind = "patch"
-reason = "line-clamp, text-wrap-style (with Chrome's pretty) and pointer-events' SVG keywords (all, visible, painted...) for Servo too, Gecko-only upstream; url() filters; ::-webkit-slider-thumb and ::-moz-range-thumb as the slider thumb; unknown vendor-prefixed properties reported like any other, so a page can be told what it lost (raea #34); background-clip's text value for Servo too (#37)"
+reason = "line-clamp, text-wrap-style (with Chrome's pretty) and pointer-events' SVG keywords (all, visible, painted...) for Servo too, Gecko-only upstream; url() filters; ::-webkit-slider-thumb and ::-moz-range-thumb as the slider thumb; unknown vendor-prefixed properties reported like any other, so a page can be told what it lost (raea #34); background-clip's text value for Servo too (#37); text-autospace for Servo too, initial no-autospace as Chrome's (#44)"
exit = "Servo's stylo enabling them"
[anyrender]