fabric: em-square glyph coordinate convention (EM-X/EM-Y/G-LINE)

Punch list §25 item 4.3.6 complete.
capsules/fabric.4th blocks 4916-4917: EM-UNITS, GOX/GOY/GSIZE/GCOLOR,
EM-X/EM-Y/G-LINE per §27.6.1, scaling/translating em-square strokes
into CART-PLOT screen coordinates via */. Verified live on amd64 via
a temporary probe (built, run once, reverted): two G-LINE test shapes
at GSIZE 100 and GSIZE 50, one leg each exercising a negative em-y
value chosen to hit */'s truncate-toward-zero behaviour, not a
multiple of EM-UNITS. Screendump pixel-bbox extraction matched
hand-calculated raster coordinates exactly on both shapes. Three-arch
acceptance boot clean, Stadium conservation unaffected
(resident_sum=43691 reservoir=21845 sum=65536 on all three).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-08-09 18:53:02 -04:00
co-authored by Claude Sonnet 5
parent 980f902c7b
commit 82e948afe9
13 changed files with 54489 additions and 93 deletions
+31 -1
View File
@@ -4388,7 +4388,7 @@ document and committing that amendment as its own item.*
> `#ifdef __STARKERNEL__`, or elsewhere is an open question for that later item, not
> decided here.
- [ ] **4.3.6 — Em-square glyph coordinate convention.** `EM-UNITS 1000` (baseline Y=0,
- [x] **4.3.6 — Em-square glyph coordinate convention.** `EM-UNITS 1000` (baseline Y=0,
x-height ≈500, cap-height ≈700, ascender ≈750, descender ≈-250), plus `EM-X`/`EM-Y`/
`G-LINE` scaling/translating em-square strokes into `CART-PLOT` screen coordinates via
`*/`, parallel to 4.3.3's `PROJECT`. Prerequisite for every glyph-drawing word that follows.
@@ -4396,6 +4396,36 @@ document and committing that amendment as its own item.*
two different requested sizes, verified live via screendump against hand-calculated pixel
positions. *Refs:* §27.6.1.
> **Done, 2026-08-09.** Blocks 49164917 in `capsules/fabric.4th` (lint-clean per
> `mkcapsule --lint`), landed there rather than a new file — 4.3.6d already names only
> `fabric.4th` and the 4.3.6c font capsule as the two capsules wired into boot, and blocks
> 4916+ were confirmed free across the entire block map, not just the `fabric.4th` family.
> `1000 CONSTANT EM-UNITS` (the punch list's "`EM-UNITS 1000`" is prose shorthand, not
> FORTH argument order — matches `fabric.4th`'s own `46341 CONSTANT COS45` precedent).
> `EM-X`/`EM-Y`/`G-LINE` exactly as §27.6.1 specifies, no deviation.
>
> **Verified live on amd64**, not just non-crashing: `fabric.4th` isn't wired into
> `init.4th`'s boot chain yet (that's 4.3.6d), so a temporary monitor+serial-injection
> harness (built, run once, reverted — same pattern as 4.3.5b/4.3.5d's probes) manually
> `EXEC`'d the capsule and called `G-LINE` at two sizes from a shared origin: `GSIZE 100`
> (white, origin 200,300) and `GSIZE 50` (yellow, origin 500,100), each drawing one leg to
> `1000 700` (positive em-y) and one leg to `300 -333` (**negative** em-y, deliberately
> chosen non-multiple-of-1000 to exercise `*/`'s truncate-toward-zero behaviour the section
> itself flags — `300*-333/1000` truncates to `-33`, not floor's `-34`).
>
> Screendump + exact pixel-bbox extraction (Python/PIL, not eyeballed) confirmed both
> shapes landed exactly on hand-calculated raster coordinates: white bbox `(200,300,
> 429,532)` against hand-calc `EM-X(0)=200, EM-X(1000)=300, EM-Y(700)→raster 429,
> EM-Y(-333)→raster 532` — exact match on all four; yellow bbox `(500,550,664,715)`
> against the size-50 hand-calc — exact match, confirming correct scaling at a second
> size and correct truncation behaviour on the descender case. Screenshot (local only,
> `fb/` is gitignored per 4.3.2): `fb/amd64/verify-4.3.6-20260809-184431.png`.
>
> Three-architecture acceptance boot clean, identical Stadium conservation on all three
> (`resident_sum=43691 reservoir=21845 sum=65536`, matching item 4.2's baseline —
> unaffected by this item, as expected): amd64 (`logs/20260809-184959`), aarch64
> (`logs/20260809-185037`), riscv64 (`logs/20260809-185127`).
- [ ] **4.3.6a — UTF-8 decoder.** `DECODE-UTF8`, composed in FORTH per the
compose-in-FORTH-first rule — no existing UTF-8 decoding anywhere in this tree (checked).
Must handle 1-byte and 2-byte sequences (ASCII, Latin-1) *and* 3-byte sequences (General