Files
solidcraft/crates
Cameron WightandClaude Opus 5.5 7dc82dc7bb Paper scene: a sheet as a vector PDF, geometry only (#4890 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>
2026-10-27 10:24:01 +00:00
..