docs(docs): RUST.md §10.6 R4.4 layout record; TODO R4.4 closed; journal
This commit is contained in:
1 parent
1550d2160a
commit
4874913669
3 files changed
+73
-3
No files matched your search
@@ -1432,3 +1432,72 @@ Residual risks and open points (R4.3, for the J1 checkpoint):
|
||||
worker, which would keep hostile memory alive between imports.
|
||||
- The TypeScript reader stays in `packages/pdf` until R4.8 (parity and the
|
||||
full switch); `apps/app/src/pdf/import.ts` is now used by tests only.
|
||||
|
||||
### 10.6 R4.4: the layout in Rust (2026-10-18, nothing wired yet)
|
||||
|
||||
What runs in Rust (`crates/core/src/pdf/write`, feature `pdf-write`, enabled
|
||||
by the wasm facade and linked into the module only once R4.5 and R4.6 call
|
||||
it; the shipped size is unchanged until then): the text rules of
|
||||
`packages/pdf/src/text.ts` and `render/text.ts` (`text.rs`: `safe_text`
|
||||
with the Cc, Cf, Zl and Zp classes frozen from V8 in O4, not Rust's tables;
|
||||
`js_upper` from the O4 runs and specials; `js_trim` and the JS `\s` set;
|
||||
`measure` = Σ (WX or 250) + KPX over WinAnsi bytes, then × size / 1000 in
|
||||
that order; `wrap_lines` with JS `split(/\s+/)` semantics, empty words
|
||||
included), the AFM metrics and Unicode tables generated from O5 and O4 by
|
||||
`scripts/r4-afm-data.mjs` (`afm_data.rs`, 82 KB, deterministic), the dates
|
||||
of `render/dates.ts` (`dates.rs`: `Date.UTC` with years 0 to 99 mapped to
|
||||
1900 to 1999 as A3 keeps them, proleptic Gregorian, fr-FR and en-US long
|
||||
forms), the input checks of `export.ts` (`input.rs`: branding and labels
|
||||
through their schemas, the snapshot gate with every asset through the R3
|
||||
SVG reader, sheet mismatch, 500 observations and 8 views per observation)
|
||||
and the four layouts (`layout/{header,footer,observation,conclusion}.rs`)
|
||||
into a `DrawLog` (`draw_log.rs`: every text, image, line, rectangle call
|
||||
with its arguments at full precision, per page with the footer last, the
|
||||
links by page, the images in embed order with their pixel size read from
|
||||
the PNG header; the PNG gate and decode are R4.5).
|
||||
|
||||
Parity (cargo, `pdf_text` and `pdf_layout`):
|
||||
|
||||
| Oracle | Check | Result |
|
||||
|---|---|---|
|
||||
| O4 `measure` | 2,333 rows × 3 fonts × 8 sizes | 55,992 widths equal; 4,800 recorded widths bit for bit |
|
||||
| O4 `wrapLines` | 73 cases × 2 sizes × 8 widths | 1,168 wraps equal |
|
||||
| O4 `safeText` | every code point 0..0x10FFFF (the 2,048 surrogates excepted: not a Rust `char`; their row is `question`) | 79 ranges equal |
|
||||
| O4 `upper` | every scalar value | 1,580 changed code points equal; Rust's `to_uppercase` (Unicode 17) agrees with V8 on all of them |
|
||||
| O5 | every WX by byte and every kerning pair | equal; WinAnsi pairs: Helvetica 1,295, Helvetica-Bold 1,181, Times-Roman 986 |
|
||||
| O6 | 6,468 grid cells × 2 locales, 22 others | equal (1,355 refused cells) |
|
||||
| O1 | 12 runs (3 reports × 2 locales × 2 logo modes), inputs = the envelope of each run's own R3 PDF, rasters = the goldens' stubs | 2,124 calls equal at full precision, embeds and links equal |
|
||||
| Step 6 `text.*` and `images.*` | 24 goldens derived from the log in the engine's global call order (page contents, then footers), two decimals | equal |
|
||||
|
||||
Subtleties the port had to carry: U+00AD is WinAnsi (`hyphen`) but Cf, so
|
||||
dropped, while U+00A0 is kept; kerning goes by glyph name, so bytes 32/160,
|
||||
45/173 and 255/159 share their pairs; a leading or trailing whitespace run
|
||||
gives an empty word to the wrap, which joins as a trailing space when it
|
||||
fits; words are split on raw JS whitespace before `safeText` runs (U+200B is
|
||||
dropped but not `\s`); `Date.UTC` applies the leap rule to the mapped year
|
||||
(0000-02-29 is refused, 1900 is not leap); the first-page link order of the
|
||||
saved file is per page (header, then footer), whatever the call order; the
|
||||
Step 6 text golden is in global call order, footers after every page.
|
||||
|
||||
Declared differences: none in the oracles. The snapshot assets go through
|
||||
the R3 SVG reader where the TypeScript ran its sanitiser (declared at R3,
|
||||
RUST.md §9.4, plan §A.3): a foreign archive the sanitiser cleaned and the
|
||||
reader refuses is `snapshot_invalid` with the reader's reason in the detail
|
||||
(the detail reaches the DEV console only).
|
||||
|
||||
Cost (release build, i7-11700B): L (60 observations) 61 pages, 2,377 calls,
|
||||
124 embeds, checks 1 ms, layout 3 ms; CAP (500 observations) 501 pages,
|
||||
19,625 calls, 1,004 embeds, checks 1 ms, layout 24 ms (debug: 29 and 222 ms).
|
||||
|
||||
Residual risks and open points (R4.4):
|
||||
|
||||
- The PNG header alone sizes an image (`embedPng`'s `width` and `height`);
|
||||
the UPNG acceptance rules and the branding PNG gate (`pngIssue`) are R4.5,
|
||||
with the O6 PNG cases (108). A PNG the header reads and UPNG refuses is
|
||||
not detected before R4.5.
|
||||
- `rasterSizeOf` (the raster request size from a viewBox, JS `Number`
|
||||
semantics) and `numberToString` are pinned in O4 but ported at R4.5 / R4.6
|
||||
with the content emitter and the session.
|
||||
- The module size impact of the writer is measured when R4.5 links it
|
||||
(W1, the `afm_data` tables are 82 KB of source, the compiled tables about
|
||||
12 KB).
|
||||
Reference in new issue
Block a user