diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e251578..9f7d054 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -119,11 +119,18 @@ jobs:
npm run render:fonts -- --package-root output/font-baseline-consumer/node_modules/fullbleed --out output/font-baseline
npm run verify:fonts -- --evidence-root output/font-baseline --allow-legacy-metadata
npm run render:fonts
- npm run verify:fonts -- --baseline output/font-baseline --reviewed-layout test/fixtures/inline-layout-2.5.46.json
+ npm run verify:fonts -- --baseline output/font-baseline --reviewed-layout test/fixtures/inline-layout-2.5.48.json
- name: Verify installed custom font families against explicit faces
run: |
npm run render:families
npm run verify:families
+ - name: Verify page-margin aliases and the published fallback failure
+ run: |
+ npm install --prefix output/page-margin-baseline-consumer --ignore-scripts --no-audit --no-fund --save-exact fullbleed@0.9.0
+ node tools/render-page-margin-fonts.mjs --package-root output/page-margin-baseline-consumer/node_modules/fullbleed --out output/page-margin-baseline
+ python tools/verify-page-margin-fonts.py output/page-margin-baseline --negative-control
+ node tools/render-page-margin-fonts.mjs
+ python tools/verify-page-margin-fonts.py output/page-margin-fonts
- uses: actions/upload-artifact@v4
with:
name: node-engine
@@ -164,6 +171,9 @@ jobs:
output/font-baseline/
output/font-subsets/
output/font-families/
+ output/page-margin-fonts/
+ output/page-margin-baseline/
+ output/page-margin-baseline-consumer/package-lock.json
output/inline-wrapping/
output/standard-baseline-consumer/package-lock.json
output/standard-baseline/
@@ -232,9 +242,11 @@ jobs:
run: |
python -m pip install pypdf==6.19.0 pypdfium2==5.14.0 fonttools==4.65.0 pillow==12.3.0
npm run render:fonts
- npm run verify:fonts -- --reviewed-layout test/fixtures/inline-layout-2.5.46.json
+ npm run verify:fonts -- --reviewed-layout test/fixtures/inline-layout-2.5.48.json
npm run render:families
npm run verify:families
+ node tools/render-page-margin-fonts.mjs
+ python tools/verify-page-margin-fonts.py output/page-margin-fonts
npm run render:inline
npm run verify:inline
npm run render:standard
@@ -270,6 +282,7 @@ jobs:
path: |
output/font-subsets/
output/font-families/
+ output/page-margin-fonts/
output/inline-wrapping/
output/standard-fonts/
output/engine-regressions/
diff --git a/README.md b/README.md
index 9487df2..d6759e9 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ no Python, Rust compiler, browser, or system fonts. MIT licensed.
Use `fullbleed` in Node.js, `fullbleed/browser` in a web application, or
[`fullbleed/cloudflare`](docs/cloudflare.md) inside a Cloudflare Worker.
-Package **0.9.0** wraps the published **Fullbleed 2.5.46** engine.
+Package **0.9.1** wraps the published **Fullbleed 2.5.48** engine.
[Try the browser playground](https://docs.fullbleed.dev/playground/) ·
[Documentation](https://docs.fullbleed.dev/getting-started/node/) ·
@@ -176,6 +176,12 @@ supported. Plain byte arrays continue to use the font's intrinsic family names.
Both forms are copied when the job is accepted and count toward the same asset
limit. A font file does not also need to be included in `assets`.
+From 0.9.1, page headers and footers can use these same CSS aliases, including
+fallback lists and inherited weights. Their typography inherits from `html`,
+then `@page`, then the margin box. A font applied only to `body` does not
+set the page-header font. Use `defaultStyles: false` when your document
+should inherit its body font from `html`.
+
The WebAssembly engine sees an in-memory filesystem containing the supplied
inputs and bundled fonts. It does not fetch remote URLs or read application files.
Use the asset map or data URIs for document images. Render and review previews
diff --git a/docs/browser.md b/docs/browser.md
index 668a117..85618b1 100644
--- a/docs/browser.md
+++ b/docs/browser.md
@@ -1,6 +1,6 @@
# Generate PDFs in a browser
-The `fullbleed/browser` entry in Fullbleed 0.9.0 renders static HTML/CSS in a
+The `fullbleed/browser` entry in Fullbleed 0.9.1 renders static HTML/CSS in a
dedicated Web Worker. It uses the same pinned 2.5.46 engine and bundled fonts as
the Node entry. The result is a `Uint8Array`, suitable for a PDF `Blob`, plus
optional PNG previews. No PDF server or account is required.
@@ -21,7 +21,7 @@ Install the package in your web project, then copy its browser files into the
directory your application serves as static files:
```sh
-npm install --save-exact fullbleed@0.9.0
+npm install --save-exact fullbleed@0.9.1
npx fullbleed-browser-assets public/fullbleed
```
diff --git a/docs/cloudflare.md b/docs/cloudflare.md
index 2734770..38eb790 100644
--- a/docs/cloudflare.md
+++ b/docs/cloudflare.md
@@ -21,7 +21,7 @@ local tests for normal, long, escaped and invalid invoices.
Use Node.js 22 or newer for your development tools:
```sh
-npm install --save-exact fullbleed@0.9.0
+npm install --save-exact fullbleed@0.9.1
npm install --save-dev --save-exact wrangler@4.151.3
```
diff --git a/engine/Cargo.lock b/engine/Cargo.lock
index 6b5bf9f..be51965 100644
--- a/engine/Cargo.lock
+++ b/engine/Cargo.lock
@@ -4,9 +4,9 @@ version = 4
[[package]]
name = "fullbleed"
-version = "2.5.46"
+version = "2.5.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "833f291584597549d6c3b411e2275c5d5e67c21ea40fa8e2766210b2768a6491"
+checksum = "6b059dbcc6a014a8416456dab6b6d8fed8365faf84c28c797b55f6bfff1387b4"
dependencies = [
"fullbleed_audit_contract",
"subsetter",
@@ -15,7 +15,7 @@ dependencies = [
[[package]]
name = "fullbleed-node-adapter"
-version = "0.9.0"
+version = "0.9.1"
dependencies = [
"fullbleed",
"serde_json",
diff --git a/engine/Cargo.toml b/engine/Cargo.toml
index 4cd6c8a..224679c 100644
--- a/engine/Cargo.toml
+++ b/engine/Cargo.toml
@@ -1,12 +1,12 @@
[package]
name = "fullbleed-node-adapter"
-version = "0.9.0"
+version = "0.9.1"
edition = "2024"
license = "MIT"
publish = false
[dependencies]
-fullbleed = { version = "=2.5.46", features = ["svg_raster"] }
+fullbleed = { version = "=2.5.48", features = ["svg_raster"] }
serde_json = "=1.0.154"
[profile.release]
diff --git a/examples/cloudflare/package.json b/examples/cloudflare/package.json
index 1cfad7e..39e7c49 100644
--- a/examples/cloudflare/package.json
+++ b/examples/cloudflare/package.json
@@ -11,6 +11,6 @@
"test": "node --test test/request.test.mjs",
"test:worker": "node test/worker.mjs"
},
- "dependencies": { "fullbleed": "0.9.0" },
+ "dependencies": { "fullbleed": "0.9.1" },
"devDependencies": { "wrangler": "4.151.3" }
}
diff --git a/package-lock.json b/package-lock.json
index ddd2304..61e81a9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "fullbleed",
- "version": "0.9.0",
+ "version": "0.9.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "fullbleed",
- "version": "0.9.0",
+ "version": "0.9.1",
"license": "MIT",
"dependencies": {
"@bjorn3/browser_wasi_shim": "0.4.2"
diff --git a/package.json b/package.json
index b488bdc..d43a2c6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "fullbleed",
- "version": "0.9.0",
+ "version": "0.9.1",
"description": "Generate PDFs from HTML/CSS, components or JSX in Node.js, browsers and Cloudflare Workers, with bundled fonts and PNG previews.",
"type": "module",
"main": "./src/index.cjs",
@@ -140,7 +140,7 @@
"access": "public"
},
"fullbleed": {
- "engineVersion": "2.5.46"
+ "engineVersion": "2.5.48"
},
"devDependencies": {
"@types/node": "22.20.5",
diff --git a/test/fixtures/inline-layout-2.5.48.json b/test/fixtures/inline-layout-2.5.48.json
new file mode 100644
index 0000000..bd37574
--- /dev/null
+++ b/test/fixtures/inline-layout-2.5.48.json
@@ -0,0 +1,94 @@
+{
+ "schema": "fullbleed.reviewed_inline_layout.v1",
+ "engineVersion": "2.5.48",
+ "source": "https://crates.io/crates/fullbleed/2.5.48",
+ "reason": "Engine 2.5.48 must preserve the reviewed 2.5.46 PDF, preview and text expectations. The expected outputs are unchanged.",
+ "fonts": [
+ {
+ "name": "Inter-Variable.ttf",
+ "path": "fonts/Inter-Variable.ttf",
+ "bytes": 876576,
+ "sha256": "29160a80ff49ddcab2c97711247e08b1fab27a484a329ce8b813d820dc559031"
+ },
+ {
+ "name": "DMSerifDisplay-Regular.ttf",
+ "path": "fonts/DMSerifDisplay-Regular.ttf",
+ "bytes": 76580,
+ "sha256": "8cc3643535edf039aa5d95440a8542735e9197e4f4b8d9303e980fefbf5ab616"
+ },
+ {
+ "name": "DMSerifDisplay-Italic.ttf",
+ "path": "fonts/DMSerifDisplay-Italic.ttf",
+ "bytes": 71208,
+ "sha256": "df74c0ac387baeaeb0fe4f2324e1668e6a3ed8c09cd9796fe162c71753e19e45"
+ },
+ {
+ "name": "BebasNeue-Regular.ttf",
+ "path": "fonts/BebasNeue-Regular.ttf",
+ "bytes": 61400,
+ "sha256": "08e4623805102d819f58601e46e345648846075e363b2ceb23313c2d1c83ec73"
+ },
+ {
+ "name": "NotoSansMath-Regular.ttf",
+ "path": "fonts/NotoSansMath-Regular.ttf",
+ "bytes": 590904,
+ "sha256": "80b61fd613d3519197e64fff6f7e71fdc7f3e6526440ea4115b554ef7fd59af7"
+ }
+ ],
+ "fixtures": {
+ "invoice": {
+ "htmlSha256": "195725eeeb32c521e19b47dbacbb55048bebb6df8566ab135cdc41fbf33fe57a",
+ "cssSha256": "cda22b39ab1f7a1eeac7cd76d162b05cd3568c2430c099123ba30a2fbd58a296",
+ "pages": 1,
+ "text": "Northstar\nStudio\nD E S I G N W I T H D I R E C T I O N\nB R A N D\nD I G I T A L\nE X P E R I E N C E S\nT H A T M A T T E R .\n42 Cedar Avenue\nPortland, OR 97205\nhello@example.invalid\nnorthstar.example.invalid\nINVOICE\nGOOD WORK.\nCLEAR DETAILS.\nLET'S MAKE\nWHAT'S NEXT.\nP R E P A R E D F O R\nMaple & Finch\nAttn. Avery Morgan\nPortland, Oregon\nT H E P R O J E C T\nAutumn launch\nBrand workshop, digital\ndesign & handoff\nI N V O I C E N S - 1 0 4 2\nIssued \u00b7 01 October 2026\nDue \u00b7 31 October 2026\nCurrency \u00b7 USD\nDESCRIPTION HOURS RATE AMOUNT\nDiscovery & brand workshop\nPositioning, priorities, and a clear creative direction\n8 $125.00 $1,000.00\nDigital design & implementation\nA cohesive visual system, from layout to launch\n6 $95.00 $570.00\nReview & studio handoff\nFinal refinements, documentation, and delivery\n2 $150.00 $300.00\nA little clarity.\nA lot of possibility.\nThank you for inviting us\nto help shape your next chapter.\nSubtotal $1,870.00\nTax \u00b7 0% in this sample $0.00\nT O T A L D U E \u00b7 U S D\n$1,870.00\nP A Y M E N T D E T A I L S\nReference NS-1042 with your payment.\nPayment instructions are supplied separately.\nA N O T E F R O M T H E S T U D I O\nQuestions about a line item?\nWrite to hello@example.invalid.\nNORTHSTAR STUDIO / INVOICE NS-1042 FICTIONAL SAMPLE \u00b7 01 / 01",
+ "pdfSha256": "3078d155f30536f5ad721f7be3c241cd78661ae41249131fc0fd65f37f23e408",
+ "previewsSha256": [
+ "72420749ccc3deaa8025daf7baffcdf79be716b6e8e93ed605effebed01e86c7"
+ ],
+ "pdfiumPixelSha256": [
+ "d71293741974bef9abffbdf5d88b0827b48fe6523f8d9baf46f46fe1000895a5"
+ ]
+ },
+ "report": {
+ "htmlSha256": "46b0e975d43914c8b4492218feae09ea0ad684091a9f9ee3b18f66a87202e521",
+ "cssSha256": "519591ae75c239ec602324f008dd99108ebeae0b9306df7215fa5f0442905473",
+ "pages": 3,
+ "text": "Common Ground\nC O M M U N I T Y T R U S T\nP E O P L E\nP L A C E S\nP O S S I B I L I T I E S\nCOMMON\nGROUND\nStronger places.\nMore room\nfor everyone.\n2026\nC O M M U N I T Y R E V I E W\nA Y E A R\nI N C O M M O N\n0 2 / O U R R E A C H\nSmall actions,\nshared outcomes.\n0 3 / O U R R E S O U R C E S\nWhere the\nsupport goes.\nCOMMON GROUND / COMMUNITY REVIEW FICTIONAL DATA \u00b7 01 / 03Common Ground\n0 2 / O U R R E A C H\nA P L A C E T O B E G I N\nSmall actions.\nShared outcomes.\nAn open door, a working kitchen, a garden plot. This year, our fictional neighborhood\nprograms connected more people with practical spaces to learn, make, and belong.\n1,240\nhouseholds took part\nacross four neighborhoods\n4,860\nvolunteer hours\nshared across our programs\n12\ncommunity spaces\nkept open and active\nMore neighbors, each quarter.\nP A R T I C I P A T I N G H O U S E H O L D S\n420\n560\n790\n980\nQ1 Q2 Q3 Q4\nQuarterly participation counts; a household can participate in more than one quarter.\n\u201cBelonging starts\nwith somewhere\nto show up.\u201d\nO U R P R O G R A M P R I N C I P L E\nBuilt around daily life.\nEvening workshops, shared meals, and weekend garden\nsessions made participation easier for people with different\nschedules. The next step is a longer opening window at\neach neighborhood space.\nILLUSTRATIVE ANNUAL REVIEW / NOT AN ACTUAL ORGANIZATION 02 / 03Common Ground\n0 3 / O U R R E S O U R C E S\nF O L L O W T H E S U P P O R T\nGood intentions.\nClear allocations.\nA practical view of this fictional operating budget. Every category supports the same\naim: useful places, open to more people.\nPROGRAM AREA ALLOCATION SHARE\nNeighborhood spaces $168,000.00 40%\nLearning & workshops $126,000.00 30%\nShared meals & gardens $84,000.00 20%\nAccess & transport $42,000.00 10%\nT O T A L O P E R A T I N G A L L O C A T I O N \u00b7 U S D $420,000.00\nWhat we count.\nHouseholds are deduplicated within the annual program\nregister. Volunteer hours include recorded event and\nmaintenance time. Space counts refer to year-round\nlocations, not individual events.\nQuarterly counts show participation within each period and\nmust not be added to estimate unique annual reach.\nWhat comes next.\nExtend evening access. Improve step-free entrances.\nPublish a simple monthly view of program activity and\nspending.\nA shared tomorrow\nis built in the everyday.\nCOMMON GROUND / METHODS & ALLOCATIONS FICTIONAL DATA \u00b7 03 / 03",
+ "pdfSha256": "80fc4306db1898688d846cfea4fb1b4ef5bf07713fe9301662143619441205b5",
+ "previewsSha256": [
+ "33ee3398d59f6836368cdab0f3c725c3cf12cbf2f9f3a3ac6a6b168f6c1886f5",
+ "9e883a04ab32392aa87ef5931761285b8dc15f8fd642b4f9bbea582c044bcdbe",
+ "8c8bfdc01ef7a3c376fbe61a0736dbc5b65280b0781f0040c550e097e71a5dcd"
+ ],
+ "pdfiumPixelSha256": [
+ "c7dc8db8fc08a78f74c4477629e0f68f3b34aa37b9b9eba46a977805933d3f03",
+ "50298b3a05370f4dcefedf47b121c1da74e48307e85fac695dfbc5c1207b100e",
+ "55c5468322b64ae2583439553a13057218c418d38c4fcbeb0e492ec98160961c"
+ ]
+ }
+ },
+ "baselineSource": "https://crates.io/crates/fullbleed/2.5.24",
+ "previousReference": "inline-layout-2.5.41.json",
+ "previousReferenceSha256": "e6c796356e3b1360885ad3ea9c1ae27adda484f76cc6fee9c1f31fb7c9eae828",
+ "previousReview": {
+ "unchangedFixtures": [
+ "invoice",
+ "inter",
+ "dm-serif",
+ "dm-serif-italic",
+ "bebas-neue",
+ "math"
+ ],
+ "reportPages": 3,
+ "changedGlyphsPerPage": [
+ 0,
+ 12,
+ 12
+ ],
+ "change": "Common Ground heading baseline: 0.75pt down on pages 2 and 3.",
+ "allContentPreserved": true,
+ "allGlyphsWithinPage": true,
+ "publicPythonCore": "2.5.34",
+ "publicPythonPdfSha256": "80fc4306db1898688d846cfea4fb1b4ef5bf07713fe9301662143619441205b5"
+ }
+}
diff --git a/test/fixtures/page-margin-fonts-2.5.48.json b/test/fixtures/page-margin-fonts-2.5.48.json
new file mode 100644
index 0000000..9e2917e
--- /dev/null
+++ b/test/fixtures/page-margin-fonts-2.5.48.json
@@ -0,0 +1,101 @@
+{
+ "schema": "fullbleed.page_margin_font_fixture.v1",
+ "source": "https://github.com/fullbleed-engine/fullbleed-official/blob/0997487693615434e8f3d45422ab5a89e67f4d71/tools/smoke_page_margin_fonts.py",
+ "sourceSha256": "db4fe6a2061d75cd16e030de3e08c66450e04fe9e487abb4b842fe2e500e3f6d",
+ "fonts": [
+ {
+ "path": "test/fonts/NotoSans-Regular.ttf",
+ "name": "Body.ttf",
+ "sha256": "bfb7bb691513f12e734dc346c03a03f784912432d7e3fa8e56efcf906fe86b3d"
+ },
+ {
+ "path": "assets/fonts/DMSerifDisplay-Regular.ttf",
+ "name": "Display.ttf",
+ "sha256": "8cc3643535edf039aa5d95440a8542735e9197e4f4b8d9303e980fefbf5ab616"
+ }
+ ],
+ "scope": "Eight explicit-face comparisons for page-margin font selection; no complete CSS or conformance claim.",
+ "cases": [
+ {
+ "name": "local-alias",
+ "html": "
Record Alpha \u2014 body text.
",
+ "aliasCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@font-face {font-family:Brand;src:local(\"DMSerifDisplay-Regular\");} @page {@bottom-center {font-family:Brand;}}",
+ "controlCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@page {@bottom-center {font-family:\"DM Serif Display\";}}",
+ "footerFaces": [
+ "DMSerifDisplay-Regular"
+ ],
+ "footerSize": 12
+ },
+ {
+ "name": "url-alias",
+ "html": "Record Alpha \u2014 body text.
",
+ "aliasCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@font-face {font-family:Brand;src:url(\"Display.ttf\");font-weight:400;}@page {@bottom-center {font-family:Br\\61 nd;}}",
+ "controlCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@page {@bottom-center {font-family:\"DM Serif Display\";}}",
+ "footerFaces": [
+ "DMSerifDisplay-Regular"
+ ],
+ "footerSize": 12
+ },
+ {
+ "name": "inherited-weight",
+ "html": "Record Alpha \u2014 body text.
",
+ "aliasCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@font-face {font-family:Brand;src:url(\"Body.ttf\");font-weight:400;} @font-face {font-family:Brand;src:url(\"Display.ttf\");font-weight:700;} html {font-family:Brand;} @page {font-weight:700;}",
+ "controlCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@page {font-family:\"DM Serif Display\";font-weight:700;}",
+ "footerFaces": [
+ "DMSerifDisplay-Regular"
+ ],
+ "footerSize": 12
+ },
+ {
+ "name": "fallback-alias",
+ "html": "Record Alpha \u2014 body text.
",
+ "aliasCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@font-face {font-family:Brand;src:url(\"Display.ttf\");font-weight:400;}@page {@bottom-center {font-family:\"Unavailable\",Brand;}}",
+ "controlCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@page {@bottom-center {font-family:\"Unavailable\",\"DM Serif Display\";}}",
+ "footerFaces": [
+ "DMSerifDisplay-Regular"
+ ],
+ "footerSize": 12
+ },
+ {
+ "name": "page-inherit",
+ "html": "Record Alpha \u2014 body text.
",
+ "aliasCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@font-face {font-family:Brand;src:url(\"Display.ttf\");font-weight:400;}@page {font-family:Brand;@bottom-center {font-family:inherit;}}",
+ "controlCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@page {font-family:\"DM Serif Display\";}",
+ "footerFaces": [
+ "DMSerifDisplay-Regular"
+ ],
+ "footerSize": 12
+ },
+ {
+ "name": "quoted-generic-alias",
+ "html": "Record Alpha \u2014 body text.
",
+ "aliasCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@font-face {font-family:\"serif\";src:url(\"Display.ttf\");} @page {font-family:\"serif\";}",
+ "controlCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@page {font-family:\"DM Serif Display\";}",
+ "footerFaces": [
+ "DMSerifDisplay-Regular"
+ ],
+ "footerSize": 12
+ },
+ {
+ "name": "size-adjust",
+ "html": "Record Alpha \u2014 body text.
",
+ "aliasCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@font-face {font-family:Adjusted;src:url(\"Display.ttf\");size-adjust:125%;} @page {font-family:Adjusted;}",
+ "controlCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@page {font-family:\"DM Serif Display\";@bottom-center {font-size:15pt;}}",
+ "footerFaces": [
+ "DMSerifDisplay-Regular"
+ ],
+ "footerSize": 15
+ },
+ {
+ "name": "named-pages",
+ "html": "Record Alpha \u2014 first body.
Record Alpha \u2014 second body.
",
+ "aliasCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@font-face {font-family:Brand;src:url(\"Display.ttf\");font-weight:400;}@font-face {font-family:BodyAlias;src:url(\"Body.ttf\");} @page:first {font-family:Brand;} @page second {font-family:BodyAlias;} .second {break-before:page;page:second;}",
+ "controlCss": "\n@page { size: 320pt 240pt; margin: 40pt 24pt;\n @bottom-center { content: \"FOOTER \" counter(page) \" of \" counter(pages);\n font-size: 12pt; line-height: 18pt; }\n}\nhtml { font-family: \"Noto Sans\"; font-size: 14pt; font-synthesis: none; }\nbody, p { margin: 0; }\n@page:first {font-family:\"DM Serif Display\";} @page second {font-family:\"Noto Sans\";} .second {break-before:page;page:second;}",
+ "footerFaces": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ],
+ "footerSize": 12
+ }
+ ]
+}
diff --git a/test/fixtures/page-margin-native-2.5.48.json b/test/fixtures/page-margin-native-2.5.48.json
new file mode 100644
index 0000000..5a03ad1
--- /dev/null
+++ b/test/fixtures/page-margin-native-2.5.48.json
@@ -0,0 +1,431 @@
+{
+ "schema": "fullbleed.page_margin_native_reference.v1",
+ "sourceHead": "0997487693615434e8f3d45422ab5a89e67f4d71",
+ "engineVersion": "2.5.48",
+ "sourceRun": "https://github.com/fullbleed-engine/fullbleed-official/actions/runs/41199950122",
+ "artifactId": 13041599934,
+ "reportSha256": "b5d913880890eb162aaddd401bb08e722a9c30543d0d0ab8233e13293a587c12",
+ "fixtureSha256": "d74cbcc6e0ae61efb746af59747323bb61a1c6e8f2e5fd72a71219c78c3eb273",
+ "cases": [
+ {
+ "name": "local-alias",
+ "control": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ },
+ "alias": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ }
+ },
+ {
+ "name": "url-alias",
+ "control": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ },
+ "alias": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ }
+ },
+ {
+ "name": "inherited-weight",
+ "control": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ },
+ "alias": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ }
+ },
+ {
+ "name": "fallback-alias",
+ "control": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ },
+ "alias": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ }
+ },
+ {
+ "name": "page-inherit",
+ "control": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ },
+ "alias": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ }
+ },
+ {
+ "name": "quoted-generic-alias",
+ "control": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ },
+ "alias": {
+ "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550"
+ ],
+ "pdfiumPixelsSha256": [
+ "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274"
+ ]
+ }
+ },
+ {
+ "name": "size-adjust",
+ "control": {
+ "pdfSha256": "95a4ce20c19888e270cd8733c9a3334112cda65ecad538376ccd17c002e549c6",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 15.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "d9b53bd4b43a76f132a9aa55c708da337347c44e41bdb456c14ba9b898c0e810"
+ ],
+ "pdfiumPixelsSha256": [
+ "2b1848e1771111fae4039628b1fad1795b23214b08970162a9fc3bf224660de2"
+ ]
+ },
+ "alias": {
+ "pdfSha256": "95a4ce20c19888e270cd8733c9a3334112cda65ecad538376ccd17c002e549c6",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 body text. FOOTER 1 of 1",
+ "footer": {
+ "text": "FOOTER 1 of 1",
+ "font": "DMSerifDisplay-Regular",
+ "size": 15.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "d9b53bd4b43a76f132a9aa55c708da337347c44e41bdb456c14ba9b898c0e810"
+ ],
+ "pdfiumPixelsSha256": [
+ "2b1848e1771111fae4039628b1fad1795b23214b08970162a9fc3bf224660de2"
+ ]
+ }
+ },
+ {
+ "name": "named-pages",
+ "control": {
+ "pdfSha256": "06e929f29d6e5d98b9e55df44af824eb9cd94d269c395adcf66115d4a34c23b1",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 first body. FOOTER 1 of 2",
+ "footer": {
+ "text": "FOOTER 1 of 2",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ },
+ {
+ "text": "Record Alpha \u2014 second body. FOOTER 2 of 2",
+ "footer": {
+ "text": "FOOTER 2 of 2",
+ "font": "NotoSans-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "b911ece97b670d8ee29605cb8a1adb0df744407ed5bce5130d0bcb0fcc177f0b",
+ "d0d12bc6fabc3c36db2a6607fa0da0fefdd903139ed058f106850dd2fe05ec88"
+ ],
+ "pdfiumPixelsSha256": [
+ "b8dd4174a0fcf6c5cf44dd53499a5ad258263840312f647c2eb0e9430284b0fc",
+ "aa07e09729f9ee547b5aab1fcfcd63d23e49dd5c7b268697f7c142f80984dc90"
+ ]
+ },
+ "alias": {
+ "pdfSha256": "06e929f29d6e5d98b9e55df44af824eb9cd94d269c395adcf66115d4a34c23b1",
+ "pages": [
+ {
+ "text": "Record Alpha \u2014 first body. FOOTER 1 of 2",
+ "footer": {
+ "text": "FOOTER 1 of 2",
+ "font": "DMSerifDisplay-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ },
+ {
+ "text": "Record Alpha \u2014 second body. FOOTER 2 of 2",
+ "footer": {
+ "text": "FOOTER 2 of 2",
+ "font": "NotoSans-Regular",
+ "size": 12.0
+ },
+ "fonts": [
+ "DMSerifDisplay-Regular",
+ "NotoSans-Regular"
+ ]
+ }
+ ],
+ "nativePreviewSha256": [
+ "b911ece97b670d8ee29605cb8a1adb0df744407ed5bce5130d0bcb0fcc177f0b",
+ "d0d12bc6fabc3c36db2a6607fa0da0fefdd903139ed058f106850dd2fe05ec88"
+ ],
+ "pdfiumPixelsSha256": [
+ "b8dd4174a0fcf6c5cf44dd53499a5ad258263840312f647c2eb0e9430284b0fc",
+ "aa07e09729f9ee547b5aab1fcfcd63d23e49dd5c7b268697f7c142f80984dc90"
+ ]
+ }
+ }
+ ]
+}
diff --git a/tools/render-page-margin-fonts.mjs b/tools/render-page-margin-fonts.mjs
new file mode 100644
index 0000000..70c7e6a
--- /dev/null
+++ b/tools/render-page-margin-fonts.mjs
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: MIT
+// Render the reviewed core page-font fixtures through the installed npm tarball.
+import assert from 'node:assert/strict';
+import { createHash } from 'node:crypto';
+import { mkdir, readFile, writeFile } from 'node:fs/promises';
+import { join, resolve } from 'node:path';
+import { fileURLToPath, pathToFileURL } from 'node:url';
+import { parseArgs } from 'node:util';
+
+const root = fileURLToPath(new URL('../', import.meta.url));
+const { values } = parseArgs({ options: { 'package-root': { type: 'string' }, out: { type: 'string' } } });
+let packageRoot = values['package-root'];
+if (!packageRoot) {
+ const packed = JSON.parse(await readFile(join(root, 'output/pack-verification/verification.json'), 'utf8'));
+ assert(packed.ok);
+ packageRoot = join(root, 'output/pack-verification', packed.installDirectory, 'node_modules/fullbleed');
+}
+packageRoot = resolve(packageRoot);
+const { renderPdf, version, engineVersion } = await import(pathToFileURL(join(packageRoot, 'src/index.js')).href);
+const hash = bytes => createHash('sha256').update(bytes).digest('hex');
+const build = JSON.parse(await readFile(join(packageRoot, 'dist/build.json'), 'utf8'));
+assert.equal(build.packageVersion, version);
+assert.equal(build.engineVersion, engineVersion);
+assert.equal(hash(await readFile(join(packageRoot, 'dist/engine.wasm'))), build.files['dist/engine.wasm'].sha256);
+const fixtureBytes = await readFile(join(root, 'test/fixtures/page-margin-fonts-2.5.48.json'));
+const fixture = JSON.parse(fixtureBytes);
+assert.equal(fixture.cases.length, 8);
+const fonts = await Promise.all(fixture.fonts.map(async font => {
+ const data = await readFile(join(root, font.path));
+ assert.equal(hash(data), font.sha256);
+ return { name: font.name, data };
+}));
+const output = resolve(values.out ?? join(root, 'output/page-margin-fonts'));
+await mkdir(join(output, '..'), { recursive: true });
+await mkdir(output);
+await writeFile(join(output, 'fixture.json'), fixtureBytes);
+const report = { schema: 'fullbleed.binding_page_margin_fonts.v1', ok: false, packageVersion: version, engineVersion,
+ node: process.version, platform: process.platform, isolation: 'process', defaultStyles: false,
+ wasmSha256: build.files['dist/engine.wasm'].sha256, fixtureSha256: hash(fixtureBytes), cases: [] };
+try {
+ for (const specimen of fixture.cases) {
+ const pair = { name: specimen.name };
+ for (const kind of ['control', 'alias']) {
+ const folder = join(output, specimen.name, kind);
+ await mkdir(folder, { recursive: true });
+ const css = specimen[kind + 'Css'];
+ await writeFile(join(folder, 'input.html'), specimen.html);
+ await writeFile(join(folder, 'input.css'), css);
+ const result = await renderPdf({ html: specimen.html, css, fonts, previewDpi: 96, isolation: 'process', defaultStyles: false });
+ assert.equal(result.engineVersion, engineVersion);
+ assert.equal(result.pages, specimen.footerFaces.length);
+ assert.equal(result.missingGlyphs, 0);
+ assert.equal(result.previews.length, result.pages);
+ await writeFile(join(folder, 'document.pdf'), result.pdf);
+ for (let i = 0; i < result.previews.length; i++) {
+ await writeFile(join(folder, `page-${i + 1}.png`), result.previews[i]);
+ }
+ pair[kind] = { pages: result.pages, missingGlyphs: result.missingGlyphs,
+ htmlSha256: hash(specimen.html), cssSha256: hash(css), pdfSha256: hash(result.pdf),
+ nativePreviewSha256: result.previews.map(hash) };
+ }
+ report.cases.push(pair);
+ }
+ report.ok = true;
+} finally {
+ await writeFile(join(output, 'renders.json'), JSON.stringify(report, null, 2) + '\n');
+}
+console.log(JSON.stringify({ ok: report.ok, packageVersion: version, engineVersion, pairs: report.cases.length }));
diff --git a/tools/verify-page-margin-fonts.py b/tools/verify-page-margin-fonts.py
new file mode 100644
index 0000000..f7532ed
--- /dev/null
+++ b/tools/verify-page-margin-fonts.py
@@ -0,0 +1,143 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: MIT
+"""Read saved page-font PDFs independently and compare aliases with explicit faces."""
+import argparse
+from hashlib import sha256
+from importlib.metadata import version
+from io import BytesIO
+import json
+from pathlib import Path
+
+from pypdf import PdfReader
+import pypdfium2 as pdfium
+
+
+def digest(data):
+ return sha256(data).hexdigest()
+
+
+def inspect(folder, source, expected):
+ for filename, key in [('input.html', 'htmlSha256'), ('input.css', 'cssSha256'), ('document.pdf', 'pdfSha256')]:
+ assert digest((folder / filename).read_bytes()) == source[key]
+ data = (folder / 'document.pdf').read_bytes()
+ reader = PdfReader(BytesIO(data), strict=True)
+ assert len(reader.pages) == source['pages'] == len(expected['footerFaces'])
+ pages, problems = [], []
+ for number, page in enumerate(reader.pages):
+ spans = []
+ page.extract_text(visitor_text=lambda text, cm, tm, font, size: spans.append({
+ 'text': ' '.join(text.split()), 'font': str(font['/BaseFont']).split('+')[-1], 'size': size,
+ }) if text.strip() and font else None)
+ footers = [span for span in spans if span['text'].startswith('FOOTER')]
+ assert len(footers) == 1, (folder, spans)
+ footer = footers[0]
+ if footer['font'] != expected['footerFaces'][number]:
+ problems.append({'page': number + 1, 'field': 'footerFont', 'actual': footer['font'],
+ 'expected': expected['footerFaces'][number]})
+ if footer['size'] != expected['footerSize']:
+ problems.append({'page': number + 1, 'field': 'footerSize', 'actual': footer['size'],
+ 'expected': expected['footerSize']})
+ faces = []
+ for ref in page['/Resources']['/Font'].values():
+ font = ref.get_object()
+ faces.append(str(font['/BaseFont']).split('+')[-1])
+ for descendant in font.get('/DescendantFonts', [font]):
+ descriptor = descendant.get_object().get('/FontDescriptor')
+ if descriptor is None or not any(key in descriptor.get_object() for key in ['/FontFile', '/FontFile2', '/FontFile3']):
+ problems.append({'page': number + 1, 'field': 'unembeddedFallback', 'font': str(font['/BaseFont'])})
+ text = ' '.join(page.extract_text().split())
+ assert 'Record Alpha' in text and 'body' in text
+ pages.append({'text': text, 'footer': footer, 'fonts': sorted(faces)})
+ pixels = []
+ with pdfium.PdfDocument(data) as document:
+ for number, page in enumerate(document):
+ assert digest((folder / f'page-{number + 1}.png').read_bytes()) == source['nativePreviewSha256'][number]
+ textpage = page.get_textpage()
+ assert ' '.join(textpage.get_text_range().split()) == pages[number]['text']
+ width, height = page.get_size()
+ for index in range(textpage.count_chars()):
+ char = textpage.get_text_range(index, 1)
+ if not char or char.isspace():
+ continue
+ left, bottom, right, top = textpage.get_charbox(index)
+ assert min(left, bottom) >= -0.25 and right <= width + 0.25 and top <= height + 0.25
+ bitmap = page.render(scale=96 / 72)
+ original = bitmap.to_pil()
+ image = original.convert('RGB')
+ image.save(folder / f'page-{number + 1}-pdfium.png')
+ pixels.append(digest(image.tobytes()))
+ image.close()
+ original.close()
+ bitmap.close()
+ textpage.close()
+ page.close()
+ return {**source, 'pages': pages, 'pdfiumPixelsSha256': pixels, 'problems': problems}
+
+
+def verify(root, negative_control=False):
+ root = Path(root).resolve()
+ source = json.loads((root / 'renders.json').read_bytes())
+ fixture_bytes = (root / 'fixture.json').read_bytes()
+ fixture = json.loads(fixture_bytes)
+ assert source['ok'] and source['isolation'] == 'process' and source['defaultStyles'] is False
+ assert digest(fixture_bytes) == source['fixtureSha256']
+ expected = {case['name']: case for case in fixture['cases']}
+ assert len(expected) == len(source['cases']) == 8
+ assert {case['name'] for case in source['cases']} == expected.keys()
+ if negative_control:
+ assert source['packageVersion'] == '0.9.0' and source['engineVersion'] == '2.5.46'
+ native_path = Path(__file__).resolve().parents[1] / 'test/fixtures/page-margin-native-2.5.48.json'
+ native_bytes = native_path.read_bytes()
+ native = json.loads(native_bytes)
+ assert native['fixtureSha256'] == source['fixtureSha256']
+ native_cases = {case['name']: case for case in native['cases']}
+ assert native_cases.keys() == expected.keys()
+ report = {**{k: v for k, v in source.items() if k != 'cases'}, 'ok': False, 'negativeControl': negative_control,
+ 'readers': {name: version(name) for name in ['pypdf', 'pypdfium2', 'pillow']}, 'cases': [],
+ 'nativeReferenceSha256': digest(native_bytes), 'nativeMatchingDocuments': 0,
+ 'scope': fixture['scope']}
+ try:
+ for pair in source['cases']:
+ case = {'name': pair['name']}
+ for kind in ['control', 'alias']:
+ folder = (root / pair['name'] / kind).resolve()
+ assert folder.is_relative_to(root)
+ specimen = expected[pair['name']]
+ assert pair[kind]['htmlSha256'] == digest(specimen['html'].encode())
+ assert pair[kind]['cssSha256'] == digest(specimen[kind + 'Css'].encode())
+ case[kind] = inspect(folder, pair[kind], specimen)
+ case['mismatches'] = [key for key in ['pages', 'nativePreviewSha256', 'pdfiumPixelsSha256']
+ if case['alias'][key] != case['control'][key]]
+ report['cases'].append(case)
+ if negative_control:
+ indexed = {case['name']: case for case in report['cases']}
+ for name in ['local-alias', 'url-alias']:
+ assert not indexed[name]['control']['problems']
+ assert any(p['field'] == 'footerFont' for p in indexed[name]['alias']['problems'])
+ assert indexed[name]['mismatches']
+ report['publicFailureReproduced'] = True
+ else:
+ assert source['engineVersion'] == native['engineVersion']
+ for case in report['cases']:
+ assert not case['control']['problems'], case
+ assert not case['alias']['problems'], case
+ assert not case['mismatches'], case
+ for kind in ['control', 'alias']:
+ for field in ['pdfSha256', 'pages', 'nativePreviewSha256', 'pdfiumPixelsSha256']:
+ assert case[kind][field] == native_cases[case['name']][kind][field], (case['name'], kind, field)
+ report['nativeMatchingDocuments'] += 1
+ report['pairs'] = len(report['cases'])
+ report['pages'] = sum(len(case['alias']['pages']) * 2 for case in report['cases'])
+ report['ok'] = True
+ finally:
+ (root / 'verification.json').write_text(json.dumps(report, indent=2) + '\n', encoding='utf8')
+ return report
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('directory', type=Path)
+ parser.add_argument('--negative-control', action='store_true')
+ args = parser.parse_args()
+ result = verify(args.directory, args.negative_control)
+ print(json.dumps({key: result[key] for key in ['ok', 'packageVersion', 'engineVersion', 'negativeControl', 'pairs', 'pages']}))
diff --git a/tools/verify-release.py b/tools/verify-release.py
index 46fa131..3e567ef 100644
--- a/tools/verify-release.py
+++ b/tools/verify-release.py
@@ -32,6 +32,8 @@
NAMED_FONT_SOURCE = ENGINE_REGRESSION_SOURCE.parents[1] / 'named-fonts.test.mjs'
NAMED_FONT_FILE = ENGINE_REGRESSION_SOURCE.parents[1] / 'fonts/family/LibreCaslonText[wght].ttf'
BATCH_SOURCE = ENGINE_REGRESSION_SOURCE.parents[1] / 'batch-fixtures.mjs'
+PAGE_MARGIN_SOURCE = ENGINE_REGRESSION_SOURCE.with_name('page-margin-fonts-2.5.48.json')
+PAGE_MARGIN_NATIVE = ENGINE_REGRESSION_SOURCE.with_name('page-margin-native-2.5.48.json')
def require(condition, message):
@@ -78,7 +80,7 @@ def verify_engine_paint_evidence(report):
source_sha = hashlib.sha256(source).hexdigest()
names = {case['name'] for case in fixture['cases']}
families = {case['family'] for case in fixture['cases']}
- require(report.get('engine_version') in {fixture['engineVersion'], '2.5.46'}, 'Paint fixtures target another engine')
+ require(report.get('engine_version') in {fixture['engineVersion'], '2.5.46', '2.5.48'}, 'Paint fixtures target another engine')
evidence = report.get('engine_paint', [])
require(len(evidence) == 2 and {item.get('platform') for item in evidence} == {'win32', 'linux'},
'Paint inspection requires Windows and Linux evidence')
@@ -259,7 +261,7 @@ def verify_text_decorations_evidence(report):
expectations_sha = hashlib.sha256(TEXT_DECORATIONS_EXPECTATIONS.read_bytes()).hexdigest()
oracle = json.loads(TEXT_DECORATIONS_EXPECTATIONS.read_bytes())
require(oracle['inputSha256'] == source_sha and oracle['engineVersion'] == '2.5.40'
- and report.get('engine_version') in {'2.5.40', '2.5.41', '2.5.43', '2.5.46'},
+ and report.get('engine_version') in {'2.5.40', '2.5.41', '2.5.43', '2.5.46', '2.5.48'},
'Text decorations target another core or fixture')
names = sorted(row['name'] for row in oracle['cases'])
failing_names = sorted(row['name'] for row in oracle['cases'] if row['previousEngineFails'])
@@ -347,7 +349,7 @@ def verify_radial_gradient_evidence(report):
evidence = report.get('radial_gradients', [])
require(len(evidence) == 2 and {row.get('platform') for row in evidence} == {'linux', 'win32'},
'Radial gradients require separate Linux and Windows installed-package evidence')
- require(report.get('engine_version') in {'2.5.43', '2.5.46'}, 'Radial evidence targets another engine')
+ require(report.get('engine_version') in {'2.5.43', '2.5.46', '2.5.48'}, 'Radial evidence targets another engine')
for row in evidence:
require(row.get('ok') is True and row.get('negative_control') is False
and row.get('package_version') == report.get('package_version')
@@ -421,6 +423,53 @@ def verify_batch_evidence(report):
'Native/WASI batch PDF, preview or record-report evidence is incomplete')
+def verify_page_margin_evidence(report):
+ source = PAGE_MARGIN_SOURCE.read_bytes()
+ source_sha = hashlib.sha256(source).hexdigest()
+ native_bytes = PAGE_MARGIN_NATIVE.read_bytes()
+ native_sha = hashlib.sha256(native_bytes).hexdigest()
+ native = json.loads(native_bytes)
+ names = {case['name'] for case in json.loads(source)['cases']}
+ require(native['fixtureSha256'] == source_sha and report.get('engine_version') == native['engineVersion'],
+ 'Page-margin fixtures target another source or engine')
+ evidence = report.get('page_margin_fonts', [])
+ require(len(evidence) == 2 and {row.get('platform') for row in evidence} == {'linux', 'win32'},
+ 'Page-margin PDFs require Windows and Linux evidence')
+ expected = {case['name']: case for case in native['cases']}
+ for row in evidence:
+ require(row.get('ok') is True and row.get('negativeControl') is False and row.get('isolation') == 'process'
+ and row.get('defaultStyles') is False
+ and row.get('packageVersion') == report['package_version']
+ and row.get('engineVersion') == report['engine_version']
+ and row.get('tarballSha256') == report['package_sha256']
+ and row.get('wasmSha256') == report['wasm_sha256']
+ and row.get('fixtureSha256') == source_sha and row.get('nativeReferenceSha256') == native_sha
+ and row.get('pairs') == 8 and row.get('pages') == 18 and row.get('nativeMatchingDocuments') == 16,
+ 'Page-margin evidence is incomplete or targets another package')
+ cases = row.get('cases', [])
+ require(len(cases) == 8 and {case.get('name') for case in cases} == names,
+ 'Page-margin cases are missing or duplicated')
+ for case in cases:
+ require(case.get('mismatches') == [], 'An alias differs from its explicit-face control')
+ for kind in ['alias', 'control']:
+ actual = case.get(kind, {})
+ require(actual.get('problems') == [] and all(actual.get(key) == expected[case['name']][kind][key]
+ for key in ['pdfSha256', 'pages', 'nativePreviewSha256', 'pdfiumPixelsSha256']),
+ 'Page-margin PDF, font, text or preview differs from the qualified native control')
+ negative = report.get('page_margin_negative_control', {})
+ require(negative.get('ok') is True and negative.get('negativeControl') is True
+ and negative.get('defaultStyles') is False
+ and negative.get('publicFailureReproduced') is True and negative.get('packageVersion') == '0.9.0'
+ and negative.get('engineVersion') == '2.5.46' and negative.get('fixtureSha256') == source_sha,
+ 'The actual public page-margin failure control is missing')
+ failed = {case['name']: case for case in negative.get('cases', [])}
+ for name in ['local-alias', 'url-alias']:
+ case = failed.get(name, {})
+ require(case.get('control', {}).get('problems') == [] and bool(case.get('mismatches'))
+ and any(problem.get('field') == 'footerFont' for problem in case.get('alias', {}).get('problems', [])),
+ 'Page-margin failure control is uncalibrated')
+
+
def verify_binding(version, run_id, run, release, tag_commit, report):
require(re.fullmatch(r'[0-9]+\.[0-9]+\.[0-9]+', version), 'Use a stable numeric version')
require(re.fullmatch(r'[0-9]+', run_id), 'Use a numeric CI run ID')
@@ -491,7 +540,7 @@ def verify_binding(version, run_id, run, release, tag_commit, report):
hidden_sha = hashlib.sha256(hidden_source).hexdigest()
hidden_fixture = json.loads(hidden_source)
hidden_cases = hidden_fixture['cases']
- require(report.get('engine_version') in {hidden_fixture['engineVersion'], '2.5.46'},
+ require(report.get('engine_version') in {hidden_fixture['engineVersion'], '2.5.46', '2.5.48'},
'Hidden-text fixtures target another engine')
hidden = report.get('hidden_text', [])
require(len(hidden) == 2 and {item.get('platform') for item in hidden} == {'win32', 'linux'},
@@ -538,6 +587,8 @@ def verify_binding(version, run_id, run, release, tag_commit, report):
verify_radial_gradient_evidence(report)
if release_version >= (0, 9, 0):
verify_batch_evidence(report)
+ if release_version >= (0, 9, 1):
+ verify_page_margin_evidence(report)
def verify_tarball(data, info, report):