Repository navigation
Drawing export: a sheet as a vector PDF, geometry only, as a starting point for the PDF work (#4890) - #7626
Conversation
|
@CamWight, thank you for the complete handoff. I have checked out exact The first bounded change repairs and strengthens the two test oracles: cross-reference offsets are byte offsets (including PDFDocEncoding and UTF-16 metadata), while the 10 nm coordinate grid is distinct from the millimetre-to-point transformation. I will keep the nine-decimal scale, assert its physical-size error independently, and apply the five-decimal check to geometry/paint operands rather than weaken the curve tolerance. Arc/parabola acceptance keeps the agreed literal 1e-4 mm bound, independent of the implementation constant. W38a currently owns the shared native build slot on Pegasus. This PDF continuation remains source-only until that slot is free. No parallel compilation, new test pass, full-CI pass or merge is claimed. Your original runtime and mutation results remain evidence for your exact source; actual final-source checks and any new findings will be recorded here. |
Continue the P1 handoff in tangency-labs#7626 with original commits preserved. Only the existing PDF test module changes. Complete IO library 153/0/2 existing ignored, scoped strict Clippy and wasm pass. Full workspace gate remains unqualified on the limited-memory drawings receiver; see PR evidence.
|
@CamWight, continued at Executed: complete IO library 153 passed / 0 failed / 2 existing ignored, including all nine PDF tests and the PDF mutation case; scoped fmt, strict geom/IO Clippy and wasm pass. Both original failing tests now pass. Your original A3 sample is exactly 1063 bytes with its original SHA-256, repeated byte-for-byte; external strict pypdf read-back and an inspected PDFium render also pass. No physical-printer or Drawing-editor acceptance is inferred. Full workspace CI remains unqualified on the limited-memory, unbounded-runner receiver; this stays draft. Your earlier 21-mutation campaign is not claimed rerun. P2 fonts/text, P3 layers and scene/export integration remain separate. The body contains final-source evidence and your preserved handoff. A matching backup commit is in our fork, with no second PDF PR. |
Continue P1 in tangency-labs#7626. Four regressions reproduce the previous late-check policy using tightened limits; six budget tests pass with all 159 IO library tests, scoped strict Clippy and wasm. Original A3 output bytes unchanged. The limited-memory full-workspace gate remains explicitly unqualified; no CI changes.
|
@CamWight, P1 now enforces the existing content-size limit before every append, including within paths/arc subdivision and the final Q, at Complete IO library: 159 passed / 0 failed / 2 existing ignored, including all 15 PDF tests and the existing PDF mutation case; scoped fmt/strict Clippy/wasm pass. The original A3 sample is still exactly 1063 bytes with its original SHA-256, reproduced twice. The bound is on uncompressed content, not all export memory. Only pdf.rs and its existing tests changed; original tests, your commits and stack are retained. This remains draft with full CI/shared-stack integration unqualified; no CI, kernel or other export changes, and no new mutation-campaign claim. Exact commands and limitations are at the top of the PR. |
Continue the existing tangency-labs#7626 handoff with five ordered default-visible optional-content groups, bounded marked content, paint order and style preservation. Original implementation and earlier tests retained; an original five-kind repeated-group fixture adds independent structure and PDFium visibility acceptance. Focused validation: complete IO 162 passed, 0 failed, 2 existing ignored; all18 PDF cases, strict IO Clippy and wasm passed. Exact native build artifact reused after a preserved private runner drain failure. Full cargo xtask ci, Drawing UI and print acceptance remain unrun; this is saved draft work, not a ready/merge claim.
Preserve default layered output and vector paint. Original acceptance covers flat metadata, exact content limits, empty groups and the original 1063-byte A3 pin. Complete IO165/0/2 existing ignored, all21 PDF cases, strict Clippy, wasm and independent five-layer/flat raster checks passed on unchanged final source. An earlier new-test metadata indentation failure is preserved separately and corrected with stricter raw-byte metadata assertions. Full workspace CI and editor/print qualification remain outstanding; saved draft increment in tangency-labs#7626.
|
@0xlillith, thanks for the split on #4890. Here's what we'd like to propose for the many-page and picture follow-up, so we stay out of each other's way in Base: #7626 sits on older versions of #7255, #7429 and #7430. Those three are now rebased on Window: we'd change only P2: fonts would take the next numbers in the same place as layers, whichever lands first, and nothing we change touches how text is written. Tests: we'd add ours at the end of Your Does that work for you? Happy to adjust any of it before we start. |
|
Thanks, that split works for us. Please start the many-page follow-up from the current You can update the original I also checked #9512/#9513: the intrinsic per-GID Source-preservation update: the typed B1 text-plan scaffold and13 original unrun cases are now archived in the canonical repository. This is uncompiled, unregistered WIP around the delivered B1a/B1b records; it preserves your content/common-allocator window and all earlier P2 test suffixes. It still uses the old metric compatibility helper, so it does not supersede the agreed final B1 intrinsic-width authority or resolve DW. We are preparing that width-provider migration separately; no production integration or extraction result is claimed. Thanks for the many-page follow-up in #9647. We have now pinned its actual The additive B1-width and actual #9647 Refs proposal is now preserved as source WIP. It uses the original-GID intrinsic advances, keeps the older SFNT parser only as a test oracle, and stages six references through your delivered F0 explicit-width successor — source onlyFollowing your width clarification, our font-resource helper and exact delta are now preserved here. The helper emits explicit For the next integration, would you prefer to wire this into your current many-page/Refs parent yourself, or hand us a narrow window in |
|
Thanks @0xlillith, the many-page follow-up is up as a draft: #9647, stacked on this PR's
The |
Owner decision received — 30 OctoberThanks, @CamWight. Following your clarification, we'll emit a complete explicit Earlier question, preserved for contextThanks Cam — we have read One remaining B1/P2 contract question: B1 correctly carries only the used glyphs and refuses missing characters, so original GID 0 is normally absent from its width records. Would you prefer complete explicit The earlier prepared-text dependency question in #4890 is answered by #9512/#9513; this is its concrete follow-up, not a new B1 claim. |
|
@0xlillith, complete explicit |
|
drawings now includes main as of today; please merge drawings into your branch. Thanks! |
|
Thanks, Cam. P2 is rebound to I’m keeping P2 separate from your writer/pages claims. Please flag anything still blocking #7626 and #9647 from leaving draft, so we can land the parents before the consumer. I’ll publish P2 with its actual validation results and dependency links when the remaining checks finish. |
90fce1b to
72e23c8
Compare
…labs#4890 P1) civil (seconds since 1970 to a UTC year, month, day, hour, minute and second) moves from engine::crash down to solidcraft_io, unchanged, so sheet PDFs can write their dates by the same rule. Crash reports call it from there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… P1) A new writer, io::paper::paper_pdf, beside paper_svg and paper_png, reading the same walk: one page the sheet's size, its lines, arcs, cubics, parabolas, fills and dashes. Text follows with P2. - The file comes from pdf-writer 0.15 (MIT OR Apache-2.0; brings ryu): a catalog, one page whose MediaBox is the sheet in points, the content deflated with flate2 (already in the tree through zip), and an Info dictionary: Producer "SolidCraft <version>", the Title when one is given, and CreationDate/ModDate only from PdfOptions::output_time (UTC), never the clock, so a scene always gives the same bytes. ISO 32000-1 14.3.3: unknown entries are left out, not written empty. - Numbers: the walk runs on a 10 nm grid (Grid::TEN_NANOMETRES), written as millimetres with up to five decimals (Annex C's precision) inside one `2.834645669 0 0 2.834645669 0 0 cm`; y is up in both, so nothing flips. The SVG writer's number rule moves to io::paper::push_mm, taking the decimals. - Arcs: each of the walk's quarter-turn pieces is cut into as many 4/3 tan(t/4) cubics as keep it within 1e-4 mm, the rounding of control points onto the grid included (one cubic a quarter turn would be 2.7e-4 r off). The arc's centre comes from Piece::seg, the rule the flattener used, moved onto Piece so both read it. Parabolas are raised to cubics. - Paint: w at the walked width (never 0: 8.4.3.2 says 0 is a device pixel), 0 J 0 j 4 M as SVG and PNG, d for A5's dashes, each set only when it changes; closed outlines `s`, fills even-odd `f*`. - Refused: a page under 3 pt a side (Annex C), a title over 1,000 characters, a date past 9999. - Dates use io::civil, the crash reports' rule (moved in the commit below). Tests: the A3 MediaBox; 50 mm on paper is 141.732 pt; the same bytes twice, dates only from output_time (2000-02-29 and 9999-12-31 23:59:59); every xref entry at its object; arcs from 0.5 mm to 2 m radius within 1e-4 mm and a parabola on its cubic, every number at most five decimals; widths, dashes, closes and fills as the other writers paint them; the refusals. One fuzz scene now feeds the SVG, PNG and PDF mutation tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Continue the P1 handoff in tangency-labs#7626 with original commits preserved. Only the existing PDF test module changes. Complete IO library 153/0/2 existing ignored, scoped strict Clippy and wasm pass. Full workspace gate remains unqualified on the limited-memory drawings receiver; see PR evidence.
Continue P1 in tangency-labs#7626. Four regressions reproduce the previous late-check policy using tightened limits; six budget tests pass with all 159 IO library tests, scoped strict Clippy and wasm. Original A3 output bytes unchanged. The limited-memory full-workspace gate remains explicitly unqualified; no CI changes.
Continue the existing tangency-labs#7626 handoff with five ordered default-visible optional-content groups, bounded marked content, paint order and style preservation. Original implementation and earlier tests retained; an original five-kind repeated-group fixture adds independent structure and PDFium visibility acceptance. Focused validation: complete IO 162 passed, 0 failed, 2 existing ignored; all18 PDF cases, strict IO Clippy and wasm passed. Exact native build artifact reused after a preserved private runner drain failure. Full cargo xtask ci, Drawing UI and print acceptance remain unrun; this is saved draft work, not a ready/merge claim.
Preserve default layered output and vector paint. Original acceptance covers flat metadata, exact content limits, empty groups and the original 1063-byte A3 pin. Complete IO165/0/2 existing ignored, all21 PDF cases, strict Clippy, wasm and independent five-layer/flat raster checks passed on unchanged final source. An earlier new-test metadata indentation failure is preserved separately and corrected with stricter raw-byte metadata assertions. Full workspace CI and editor/print qualification remain outstanding; saved draft increment in tangency-labs#7626.
…ene (tangency-labs#4890 P1) The sheet PDF writer and @0xlillith's layer, budget and flat-output work, replayed onto drawings 8a0b1fd. What the replayed commits couldn't hold: - Geometry only, as before: the scene's text runs (B1b, B2a) and pictures (tangency-labs#10926) are passed over; text follows with P2. A group with no stroke or fill puts no mark on the page, so it invents no layer and doesn't break a run of one kind (`painted`, the one test the layers and the content share). - Seg2 and Vec2 come from solidcore-record and the vector maths from the geom prelude (tangency-labs#11496). - The tests build scenes with Scene::new (scenes now carry fonts and clips). Line widths need nothing: the walk already gives each stroke its kind's and line group's width (tangency-labs#12232). The replayed commits keep their resolutions: the io paper module keeps PaperColour beside push_mm, and the PDF fuzz test is built like the SVG and PNG ones, on seed 0x5a7 (0x5a5 is the clip test's). Test change: flat_pdf_reproduces_the_original_p1_a3_sample_bytes pinned the whole file, and its Info dictionary names the build ("SolidCraft 0.19.0" then, 0.41.0 now). The same file with 0.19.0 put back has the old SHA-256, so the drawing's bytes are unchanged. The pin is now the 721 bytes before the Info dictionary, and the Producer is checked against this build's version, so a release bump no longer moves it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…refused (tangency-labs#4890 P1) A drilled plate's iso view failed the sheet PDF with "an arc needs too many cubics", while its SVG and PNG were fine. The walk's arc pieces are about a quarter turn, but can turn a little more: their ends are rounded onto the 10 nm grid, and a sliver piece merges into the next. cubics_for refused anything past a quarter turn plus 1e-9. cubics_for now takes up to a half turn, and starts from enough cubics that each spans at most a quarter turn. Any arc it wrote before starts at one cubic as before, so it writes the same bytes: the byte pins pass unchanged. Piece::Arc's doc says what the walk gives (a comment change only in geom). The scene caps a sweep at a whole turn plus 1e-12, so the walk's four-piece cap adds nothing past the old slack. Found by @DevonHope on tangency-labs#9647, with this fix and its unit test (an_arc_a_little_over_a_quarter_turn_is_written). The second test walks Ø16 circles at nearby centres until one gives a piece past a quarter turn, then writes each and checks every cubic lies on the circle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e the PNG and PDF writers that use them (tangency-labs#4890 P1) geom's paper module only shrinks (CONTRIBUTING). Its flattener had one caller, io's PNG writer, and the stack had added `Piece::seg`, `GridPoint::vec` and a 10 nm grid constant to geom for io's PDF writer. They now live in io/src/paper/flatten.rs, with the flattener's tests unchanged except one call form: `flatten`, `seg` (a piece's curve, which both writers read) and `vec`. The PDF writer makes its own 10 nm grid with `Grid::new`. Nothing writes different bytes: the PNG and PDF byte pins pass as they were. geom's walk test for an ellipse's cubics checked them by flattening them. It now samples each cubic itself, with the same bound, so geom's test needs no io. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72e23c8 to
15b7937
Compare
…ed test (tangency-labs#4890 P1) Replayed onto the rebased tangency-labs#7626. A page lists the layers of the kinds it paints, now by the writer's one painted test (a stroke or a fill), so a page whose group of a kind holds only text or pictures doesn't list that kind's layer. The pages' tests build scenes with Scene::new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@0xlillith, thank you for rebinding P2, and sorry the answer on what's left took a while. Here is where #7626 and #9647 stand. Nothing of yours blocks them. Both are now rebased onto today's
Parents for P2:
Your registration and emission window is where it was, give or take the import lines. The line numbers are at #9647's head:
One thing moved, in case your helper used it. The 10 nm grid is now io's own, Tell us if anything doesn't line up when you rebind. And thank you again for the layers and the content budget: they're a big part of why this is ready. |
…lue, and io lists the grids (tangency-labs#4890 P1) A paper writer's precision was two facts that had to agree: PDF kept PER_MM and DECIMALS, SVG kept the nanometre grid and its six decimals, and PNG named the nanometre grid too. Now io/src/paper.rs holds one Decimals value for each: whole nanometres (SVG's numbers, PNG's grid) and 10 nm (PDF's). Each gives the writer its grid and writes its numbers. io lists the writers' grids (writer_grids). The engine's hatch-dot check in drawing_scene/fill.rs, from @0xlillith's saved fills, loops over that list instead of keeping its own copy of the PDF grid, so a new writer's grid reaches it too. Docs: the flattener's notes no longer say PDF flattens curves, and its cap is MAX_PATH_POINTS, apart from the PNG writer's MAX_POINTS. Two geom doc comments (grid.rs, cubic_pieces.rs) say what the code does, in the same number of lines, and the xref check's comment says what its bound is. No bytes change: the PDF and SVG byte pins pass as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed test (tangency-labs#4890 P1) Replayed onto the rebased tangency-labs#7626. A page lists the layers of the kinds it paints, now by the writer's one painted test (a stroke or a fill), so a page whose group of a kind holds only text or pictures doesn't list that kind's layer. The pages' tests build scenes with Scene::new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed test (tangency-labs#4890 P1) Replayed onto the rebased tangency-labs#7626. A page lists the layers of the kinds it paints, now by the writer's one painted test (a stroke or a fill), so a page whose group of a kind holds only text or pictures doesn't list that kind's layer. The pages' tests build scenes with Scene::new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…9647) * Paper PDF: sheets as the pages of one document (#4890 P1) `paper_pdf_pages` writes several prepared scenes as the pages of one PDF, in order, each page its own sheet's size. `paper_pdf` is now its one-page call and writes the same bytes as before. - Object numbers come from one counter in the order the objects are written: the catalog, the page tree, each page then its content, the Info dictionary, then the layers. One page keeps 1 to 5 and layers from 6, as now. P2's fonts can take their numbers from the same counter. - One layer for each kind across all pages, tagged as it is first painted, so a kind is the same layer on every page. Each page lists only the layers it paints. - The pages share one allowance of content, `MAX_DRAWING_BYTES`. A document has 1 to 1000 pages (a drawing's sheets), and every page meets the one-page size check. Tests, under their own heading in `pdf_tests.rs`: one page is the one-page call byte for byte, with and without layers, a title and a date; three sheets of different sizes as pages in order, sharing layers; the page limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Paper PDF: the pages on drawings, each page's layers by the one painted test (#4890 P1) Replayed onto the rebased #7626. A page lists the layers of the kinds it paints, now by the writer's one painted test (a stroke or a fill), so a page whose group of a kind holds only text or pictures doesn't list that kind's layer. The pages' tests build scenes with Scene::new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Paper PDF: pages are put on the grid one at a time, as they are written (#4890 P1) paper_pdf_pages put every page on the grid before it wrote the first. Each page's grid is capped, but up to 1000 pages of them were held at once, only to learn the page sizes and the layers. The prepared scenes already say both. Now a first pass reads each page's size and the layers from the scenes, and the write loop puts one page on the grid just before it writes it, then drops it. `painted` is asked of the scene's groups: each prepared stroke and fill stays one on the grid, in order, and the loop refuses a page whose groups don't match. The object numbers, the write order and the bytes are the same: the byte pins (the A3 sample, one page against pages, pages in order, the later page's 3 pt refusal) pass as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Change
A drawing sheet can now be written as a vector PDF: one page the sheet's size, with its lines, arcs, curves, dashes and fills.
io::paper::paper_pdf(scene, options)sits besidepaper_svgandpaper_pngand reads the same prepared paper scene. Text, pictures and thedrawing.exportcommand come in their own PRs (below).Part of #4890. This is the first of a series. #9647 (the pages of one PDF) stacks on it, and then come text (P2, @0xlillith) and the
drawing.exportPDF command (EX3, @DevonHope).[0 0 1190.5511 841.8898]).PdfOptions::output_time, never from the clock, so a scene always gives the same bytes.cmthat scales millimetres to points. y is up on the page as in the scene, so nothing flips.d. Fills are black and even-odd. Each width and dash pattern is written only when it changes.PdfOptions::layers = falsewrites the same marks without layers.Changes a default: no
This adds a new writer, and nothing that exists writes differently.
crates/geomshrinks. There were two choices: keep the line flattener ingeom, or move it to io. @CamWight chose the move, and it is commit15b7937e98. The flattener (paper/flatten.rs) and the rule that turns a walked piece into its curve (Piece::seg) move fromgeomintoio/src/paper/flatten.rs. They arepub(super)there, so io's public API gains nothing. Their only callers are io's PNG and PDF writers, sogeomloses them with no copy left behind (+13/−186 lines). The 10 nm grid is now io's ownGrid::new(1e5), and a refusal of it is a typedIoError.Test change:
slivers_and_radii_are_in_the_grids_own_steps(crates/geom/src/paper_tests.rs) checked the walked cubics against an ellipse by flattening them. The flattener is now in io, so the test samples 101 points on each cubic directly, with the same bound (error * 1.2).Decisions
Each was read first-hand in ISO 32000-1.
f32: 1.2e-4 mm coarse at A0, too coarse for 1e-4 mm curves. pdf-writer still writes everything around the content: objects, cross-references, page, Info and dates. SVG and PDF share one number rule (io::paper::push_mm).wis never 0: 8.4.3.2 says 0 means one device pixel.pdf-writer0.15.0 (MIT OR Apache-2.0) andryu1.0.23 (Apache-2.0 OR BSL-1.0).flate2was already in the tree. They are covered bycargo xtask licences.sin/tanin io, as the SVG and PNG writers turn paper curves into their own formats in io. Drawing maths stays in drawing code, not solidcore.What the tests can't reach
Validation
Targeted checks, in
--profile ci. The head is15b7937e98, ondrawings76eb8bfc98:papertests 80 passed, geompapertests 71 passed.f870531442): iopaper85 passed and geompaper71 passed. This head builds on its own (cargo check -p solidcraft-io).-D warningsand the wasm check pass for geom and io. The move adds no crate edge or dependency: io already depends on geom.cargo xtask ciruns in CI.Screenshots of the behavior (when observable)
No command writes a PDF yet; that comes with EX3. Below is a sheet through this writer: a plate with two Ø16 holes, Top view at 1:1 on A3, opened in Chrome. Before
72e23c8fb9it failed with "an arc needs too many cubics".A test A3 scene (border, rectangle, circle, dash-dot centre lines, a quarter arc) as drawn by pdf.js:
Integration status
drawings, rebased ontodrawingsat76eb8bfc98. @0xlillith's five commits keep their author.Refs, in the window agreed on 30 Oct.engine/src/crash.rs(onmain), wherecivilmoves out. They meet at the next main-to-drawings sync, as a text merge.Earlier increments, with each one's own evidence (kept as written)
Earlier increments:
Additional P2 source-only preparation
The font prototype backup now includes a six-object resource-only font emitter and an alternative read-only subset adapter. Identity-H codes/CIDs, subset GIDs, widths and ToUnicode are kept distinct. Explicit descriptor metrics are required; synthetic fixtures do not establish B1/font-provider fidelity.
Production source review closed without an actionable finding in its scope. A weak width-test oracle was corrected and independently reviewed, with production unchanged. The emitter has 11 written, unrun tests; the selected P2 source proposals total52 declarations, zero executed. They remain outside this PR's product source: no module/Cargo adoption, page resources/content, provider integration, PDF-text/viewer acceptance or CI result is claimed. The qualified P1/P3 head stays
506d4190; its earlier results do not transfer to these proposals.28 October - adjacent PDF layer runs published
Current head:
506d419084a1cd6463c3117ea34d15f805a6ce37, normal forward continuation ofbe22b97b. Onlypaper/pdf.rsand its existing tests changed; all earlier commits and 21 tests are retained.Consecutive painted groups of the same kind now share one optional-content run. Empty groups do not interrupt it. An A/A/B/A sequence still paints all four objects in order, with three runs and two independently switchable layers. Shared widths and dashes, fill order, flat output and content limits are preserved.
Exact current source: complete IO 169 passed, 0 failed, 2 unchanged ignored; all 25 PDF tests passed, strict IO Clippy and wasm PASS. Three independent pypdf/PDFium checks passed: the existing five-kind layer fixture, flat/layered full-raster equality, and the actual new A/A/B/A test export with three runs/four paints/two layers. Its flat and layered 2100x2971 RGB rasters match; hiding either layer retains precisely the other marks. Original and hidden-layer PNGs inspected. The previous default layered fixture remains byte-identical (SHA
86be624b).All eight validation phases exited zero. Current Cargo JSON/executable and all 2348 precommit source files were bound and unchanged; owned processes ended and leases released. No test ignore/tolerance/baseline change. The earlier flat metadata-oracle failure and its separate corrected run remain documented below.
This is an incremental task commit to the existing draft under our agreed batch workflow. Full
cargo xtask ci, editor/print/two-viewer UI acceptance, text/fonts and integrated nonprinting filtering remain pending. No W22 completion, ready-for-review or merge claim.Previous source-specific increments and evidence:
28 October - explicit flat vector output published
Current head:
be22b97b70f31d1a0d79ed79fb1fc6c03b7f1011, normal forward continuation ofeffaf491in this existing draft. Only pdf.rs, its existing pdf_tests.rs and the mutation test's options literal changed. Cam's commits and the original tests are preserved.PdfOptions.layersdefaults to true. Explicit false writes the same ordered vector geometry/styles/metadata without optional-content objects or BDC/EMC wrappers. Both paths use the same content-growth budget. No paper scene, text/font, schema, kernel or dependency change.Final source executed: complete IO 165 passed, 0 failed, 2 unchanged ignored, all 21 PDF cases passed, strict IO Clippy and wasm PASS. The default layered five-kind export is still byte-identical (SHA86be624b); all five independently hidden-layer checks pass. Strict pypdf read-back and PDFium254dpi rendering show the flat877-byte fixture and its layered counterpart have identical full2100x2971 RGB pixels (SHAa4eccba298c4b026a08fe2b748e0a1cefa4814d15ecdedae2152c986be6b55e7). Original A3 flat sample remains1063bytes with its original SHA. The flat image was inspected.
An earlier run is preserved as 164 passed /1 failed /2 existing ignored: a new metadata oracle incorrectly required dictionary keys at column zero. Actual dictionaries are indented. The repair reads raw exact-key bytes and requires each of five fields exactly once with literal expected values in both PDFs, including UTF16 title bytes. Production was unchanged by that repair; no tolerance, ignore, expectation blessing or old-test removal. A fresh current native build and complete scoped validation then passed. All owned children ended and leases released.
Commands/profile/cache match the scoped commands below; current actual CargoJSON/executable and all2348 precommit RAW files were bound and remained unchanged through commit. Full cargo xtask ci, editor/print/two-viewer UI acceptance, text/fonts and integrated nonprinting filtering remain incomplete. This is saved qualified draft progress, not W22/M3/project completion or a ready/merge claim. Partial follow-ups preserve that distinction.
Previous source-specific increments and evidence:
28 October — P3 layers published, focused validation complete
Current head:
effaf49113dadafc2e16663972ed97e015cb5bf4, a normal forward commit fromdc911d80in this existing PR. Cam's original commits and stack are retained. Onlycrates/io/src/paper/pdf.rsand its existingpdf_tests.rschanged in this increment. This remains draft, with full repository CI and Drawing-editor acceptance outstanding.The writer now assigns each nonempty paper object kind one optional-content group using the shared layer names. Catalog order/default-ON, page properties and bounded BDC/EMC markers are explicit. Empty groups add no layers; repeated noncontiguous groups preserve paint order and share their layer. Stroke/fill/dash state and the existing content-growth cap remain enforced. All 17 earlier cases were retained; one original acceptance case covers all five kinds, repeated groups, empty groups, exact names/references and paint/style preservation.
Executed on the final precommit source, which remained unchanged through commit:
--lib --tests -- -D warnings) and IO wasm check: PASS.86be624bba735e2d8e739bb1150e7d8bcf61308b96ae5389a856cb0807cac3f5. Each of the five OCGs was independently disabled in a derived copy; its marks disappear and the other layers' probes remain identical. Decoded content and document semantics other than default visibility are preserved. Original and hidden-layer PNGs were inspected.Commands use the existing cache,
+stable-x86_64-pc-windows-msvc,--profile ci --locked --offline --jobs 1:cargo test -p solidcraft-io --lib --target x86_64-pc-windows-msvc --no-run --message-format=json, then that exact test executable unfiltered with--test-threads=1;cargo clippy -p solidcraft-io --lib --tests --target x86_64-pc-windows-msvc -- -D warnings;cargo check -p solidcraft-io --target wasm32-unknown-unknown. Profile/lock/offline/job arguments apply to each Cargo invocation.Still incomplete: full
cargo xtask ci/merge-queue qualification, P2 fonts/text, general shared-layer controls/flat-output option, integrated scene filtering and Drawing-editor/physical-print acceptance. This P3 foundation is not completion of W22, M3 or the Drawings project. No browser/viewer interoperability or archival/accessibility claim is inferred from the independent reader test.Previous P1 source-specific evidence and owner handoff follow unchanged.
27 October - bounded content generation, not only a final size check
Current head:
dc911d80d100028b349b3e1a05c238b11a4acf2e, continuing the original P1 stack in this same PR. Changes a default: no. This increment changes onlycrates/io/src/paper/pdf.rsand its existingpdf_tests.rs.The previous writer checked its 64 MiB uncompressed-content limit only after a complete stroke/fill. A single long path or an arc expanded into many cubics could grow the buffer beyond that allowance first. The header and final
Qwere not both covered by that late check.Every content append now checks cumulative byte arithmetic before growing the string. This applies to coordinates, widths, dash operands, operators, each cubic inside an arc, all fill loops/groups and the final graphics-state restore. Reservations use
try_reserve_exact, with bounded geometric growth and an explicit allocation error. The existing shared number formatter uses one reused small scratch buffer; number formatting, curve conversion, public options and the file structure are unchanged. Refusal returns no partial successful PDF.This bounds the content buffer's logical bytes, not total export memory: the prepared scene, grid data, compression and PDF structure have their own costs. No whole-application out-of-memory guarantee is claimed.
Executed evidence
A private limit-injection seam, retaining the original late-check policy and default production limit, first ran four new regressions: 0 passed / 4 failed. The fix plus two further guard tests then passed on unchanged final source:
0de09bc342566206514754fc2ed7836156fbe10ba444e8ebb66427b10dd89c02; identical to Cam's original and the prior independently rendered sampleThe six small-bound tests exercise header/trailer accounting, early stop inside one path and one arc expansion, cumulative groups/fill accounting, non-mutating refused appends and exact formatting including both i64 extremes. Test limits can only tighten the production ceiling; no huge allocation, relaxed tolerance, new ignore, generated golden or source-dependent expected geometry is used. All original tests remain unchanged.
Checks ran sequentially in the existing cache, one Cargo job and one libtest thread, native CI profile, locked/offline. Source manifests and Cargo.lock remained fixed during each run. The A3 example was compiled against this source, run twice and removed afterwards; its unchanged bytes reuse the previous read-back/render evidence rather than claiming a new renderer run.
This remains draft WIP. The existing shared-walk/A5 stack and resource-bounded full repository gate remain outstanding; no runner or CI change, approval label or waiver is included. The earlier mutation campaign remains source-specific author evidence, not a rerun. P2/P3 and
drawing.exportintegration remain separate.Previous P1 continuation and original handoff (source-specific history)
27 October - P1 handoff continued; both failing test oracles repaired
Current head:
4ae2e1db656c0a39b1897d9ab7ad954857320639. This continues CamWight's exact7dc82dc7handoff in the existing #7626, preserving both original P1 commits and its A5/shared-walk stack. Onlycrates/io/src/paper/pdf_tests.rschanges in our continuation. The production PDF writer, curve helpers, date rule, dependencies, lockfile and previously emitted output remain unchanged.Correction and independent regression checks
startxrefand each object offset are byte positions, not positions in lossy UTF-8 text. It verifies the emitted six-entry subsection, fixed-size records, generation/in-use fields and each exact object header. ASCII, PDFDocEncoding, UTF-16/non-BMP and escaped titles are covered. Deliberate byte insertion and an object offset pointing into the header are refused by the oracle.cm. The oracle separately requires exactly one uniform, untranslated, unflipped transform and bounds its scale-only error across 5,000 mm by 1e-6 mm using the independent rational 360/127. Geometry, widths and dash parameters still have at most five decimals. Six-decimal geometry/paint, low-precision scale, exponents, nonfinite values, negative zero and duplicate/missing transforms are rejected.Executed on the exact final test source
solidcraft-io --lib, CI profile, no filteringgit diff --check-D warnings)wasm32-unknown-unknowncompilation0de09bc342566206514754fc2ed7836156fbe10ba444e8ebb66427b10dd89c02, byte-identical to Cam's sample and to a second run. pypdf 5.9.0 strict read-back and PDFium rendering checked externally; A3 size, metadata and geometry-only resources verified.Checks used stable native MSVC,
--profile ci --locked --offline --jobs 1, one libtest thread, and the existing shared target; source manifests and the lockfile stayed unchanged. The new PDF dependency cache was filled once withcargo fetch --locked, without updating the lockfile. The full repository gate was not launched on this PDF head: the stackeddrawingsreceiver still has the unbounded test runner previously raised with its shepherd, and the shared host is memory-constrained. No runner, skip, lint allowance, infrastructure change or gate waiver is included. This remains a draft, not merge-qualified.Cam's earlier mutation campaign remains author evidence on its original head. This continuation does not claim that the five previously inconclusive mutation cases or the non-building mutation were rerun. The now-passing literal-tolerance/endpoint/parabola checks are stronger, but mutation coverage must be stated separately from ordinary test success.
P2 searchable text/fonts, P3 layers, images, integration with
drawing.export, full CI and later end-to-end Drawing acceptance remain separate work. The unrelated X1 53 byte pins, W38d source and paused kernel are untouched. No new screenshot of the Drawing editor or completed workspace is implied by a geometry PDF sample.Original CamWight handoff and head-bound evidence (preserved)
@0xlillith, this is a starting point handed to you and your team. PDF export (P1 to P3 of #4890) stays yours, as handed over on #4890, and your team continues it from here. We started on it by mistake after the handover; rather than throw it away, here is what is done, as a draft for you to take, change or drop as you like. We won't push to it again unless you ask.
For @0xlillith's list
Branch and commit:
CamWight:paper-pdf-4890-p1at7dc82dc7. Both commits are by @CamWight, kept as they are (no squash).Base and stack: into
drawings, stacked on Drawing export A5: dashed lines draw dashed in SVG and PNG (#4890) #7430 (A5, dashed lines,1aaff713), on Paper scene: a sheet PNG at a chosen dpi and colour (#4890 A4) #7429 (A4,dadb5f00), on Paper scene: one walk onto a writer's number grid, for every writer (#4890) #7255 (the shared paper walk,d2fcae51), on the currentdrawings. Until those land, this PR also shows their commits. Only the last two commits are this PR:884fc537io: the date rule crash reports use, for other writers too.civilmoves fromengine::crashtosolidcraft_io, unchanged, and crash reports call it from there. It is its own commit so other crash-report work can rebase past it easily.7dc82dc7the PDF writer.Implemented: P1's geometry: a sheet's lines, arcs, curves, dashes and fills as a one-page vector PDF (details below).
Not implemented: text and fonts (P2, after Sketch text: a line's width and the line pitch are worked out only while drawing it, so nothing can measure text to fit a box #4813's text metrics), layers (P3), and a full gate.
Commands run (on Windows,
--profile ci, in this order):cargo test -p solidcraft-geom --lib -- papercargo test -p solidcraft-io --lib -- papercargo test -p solidcraft-engine --lib -- crash(the moved date rule)iotest run, then a clean runcargo clippy -p solidcraft-geom -p solidcraft-io -p solidcraft-engine --all-targets -- -D warningscargo fmt --all -- --checkcargo check -p solidcraft-geom -p solidcraft-io --target wasm32-unknown-unknownRemaining failures:
paper::pdf::tests::arcs_are_cubics_within_a_ten_thousandth_of_a_millimetre(pdf_tests.rs:148). The arcs themselves pass. The last check, "every number has at most five decimals", also reads the page's scaleq 2.834645669 0 0 2.834645669 0 0 cm, which has nine. Either the check skips thecmline, or the scale is written with five decimals (a relative change of about 2e-6, so up to 0.002 mm across A0). That choice is yours.paper::pdf::tests::every_cross_reference_points_at_its_object(pdf_tests.rs:122). The test reads the file as lossy UTF-8. The titleÇis one byte in the file, and the lossy reading turns it into the three-byte U+FFFD, so the byte offsets after it no longer line up with the text, and slicing panics on a character boundary. The fault is in the test, not the writer: comparing bytes instead of text fixes it. The sample below checks the same offsets byte by byte, and they are right.PDF evidence: a public-safe A3 sample, made by a throwaway example (not committed; source below):
0de09bc342566206514754fc2ed7836156fbe10ba444e8ebb66427b10dd89c02. The same scene always gives these bytes.Read back two ways:
startxref, every cross-reference entry at itsN 0 obj, the MediaBox and the inflated content:%PDF-1.7, ends%%EOF;[0 0 1190.5511 841.8898]= 420.000 × 297.000 mm;m8,l14,c14,h2,S3,f*2,w4,d2, oneq … cm … Q;D:20270115080000Z.The sample's source (an example in
crates/io/examples/, run withcargo run -p solidcraft-io --example p1_sample -- sample-a3.pdf)Changes a default: no
This adds a new writer; nothing that exists writes differently.
What it does
io::paper::paper_pdf(scene, options)writes the sheet as a one-page PDF, besidepaper_svgandpaper_png. It reads the same walk, so it draws the same joints, closures and merges.[0 0 1190.5511 841.8898]).PdfOptions::output_time(seconds since 1970, written in UTC), never from the clock, so a scene always gives the same bytes.q 2.834645669 0 0 2.834645669 0 0 cm … Q, so its numbers are the scene's own millimetres with y up, and nothing flips.0 J 0 j 4 M), as SVG and PNG draw them.d. Each width and dash pattern is written only when it changes.s; fills even-odd withf*.Decisions
Each was read first-hand in Adobe's copy of ISO 32000-1.
Grid::TEN_NANOMETRESgives at most five decimals of a millimetre, Annex C's precision, and every number is exact. pdf-writer's content calls takef32, which is 1.2e-4 mm coarse at A0 and 2.4e-4 mm at the scene's 5 m limit: too coarse for the curves' 1e-4 mm. pdf-writer still writes the file around the content: objects, cross-references, page, Info and dates. The SVG writer's number rule moved toio::paper::push_mm, which takes the decimals, so both writers read one rule.Piece::seg, the rule A4's flattener used, now onPieceso both read it.wis never 0, because the walk gives every line at least one step: 8.4.3.2 says a 0 width means one device pixel and shouldn't be used.pdf-writer0.15.0 (MIT OR Apache-2.0) andryu1.0.23 (Apache-2.0 OR BSL-1.0).flate2was already in the tree through zip. They are covered bycargo xtask licences, and THIRD-PARTY-LICENSES is regenerated onmainafter the merge. ATTRIBUTION.md is for asset files, and this adds none.hayro-syntaxwas considered. With its default features off it builds only itself, but Cargo.lock gains three more entries (its image decoders, never built). The tests read the file with their own small reader instead: inflate, operators and numbers.What the tests can't reach
MAX_DRAWING_BYTES) needs a scene of tens of millions of numbers, so no test builds it. It is the same check as SVG's.Tests
output_time: 2000-02-29 and 9999-12-31 23:59:59.N 0 obj(fails today: see above).No full gate: only the targeted checks above.
P2 source preservation — 28 October 2026
Bundled-font admission guard, ToUnicode serializer and original unrun acceptance, saved as source-only WIP. The new ToUnicode module has eleven inline tests plus six independent acceptance cases, all unrun; module/caller integration is pending. This does not implement embedding/subsetting or replace B1's prepared-text contract. Complete team WIP index. Existing P1–P3 results and remaining gates above are unchanged.
P2 source-only adapter backup
The existing P2 source packet now also preserves the real subsetter0.2.6 adapter and its bounded preflight/readback source, with eighteen unrun closure/adapter tests and separate source/oracle reviews. This is not applied to this PR, has not produced a subset font, and has not been compiled/run. B1, descriptor/layout metrics, resource-object emission, actual PDF text integration and all runtime gates remain pending. Existing P1–P3 results above qualify only their recorded source; they do not qualify these new proposals.
One grid value per writer (17 Nov)
Change: each paper writer's precision is now one value in
io/src/paper.rs: its decimals, which give both the grid itputs the scene on and the text of its numbers. SVG and PNG use whole nanometres (6 decimals), PDF uses 10 nm (5
decimals). Before, PDF kept
PER_MMandDECIMALSas two constants that had to agree, and SVG had its own pair.solidcraft_io::paper::writer_grids()). The hatch-dot check inengine/src/drawing_scene/fill.rs(from @0xlillith's saved fills) loops over that list. It no longer keeps its owncopy of the PDF grid (
Grid::new(1e5)), so it can't fall behind a writer.MAX_PATH_POINTS, so it isn'tconfused with the PNG writer's
MAX_POINTS; two geom doc comments (grid.rs,cubic_pieces.rs) are corrected withthe same line count (geom doesn't grow); a test comment on the xref check says what its bound is.
For reviewers:
main) counts.normalized()calls. Oncedrawingsmeetsmain, it will listone line here:
crates/io/src/paper/flatten.rs:seg. That call was geom's flattener before this PR moved it into io,so the PDF work adds no new site.
drawing.exportwithformat: "pdf"(EX3, @DevonHope's) must refuse a blue
paper, as PNG refusespaperwith a grey or black-and-whitecolour.Test change: the flattener's own tests (
io/src/paper/flatten.rs,too_many_points_or_no_tolerance_is_refused) nameits cap by its new name,
MAX_PATH_POINTS.Validation (head
76785aef85, the targeted run):each listed grid is refused, naming that grid) failed to build before the change, and pass after.
paper::77 passed, geompaper::64 passed, engine dot and hatch tests 45 passed. The PDF and SVG byte pinspass unchanged.
the PDF grid left out of the list (both engine dot tests).
-D warningson io, engine and geom;cargo check -p solidcraft-io --target wasm32-unknown-unknown; rustfmt.