Commit Graph
19 Commits
Author SHA1 Message Date
dotCooCoo 54d0db01ab Merge #710 (fix/linesweeper-generators-zero) into integration/linesweeper 2026-11-09 14:00:49 -08:00
dotCooCoo 89d6a1bfca Merge #657 (fix/linesweeper-paperjs-alpha) into integration/linesweeper 2026-11-09 13:44:41 -08:00
dotCooCoo 4ec7f67b2e Merge #649 (fix/linesweeper-example-viewbox) into integration/linesweeper 2026-11-09 13:42:09 -08:00
dotCooCoo 67f79dd30d Merge #642 (fix/linesweeper-unbuildable-targets) into integration/linesweeper 2026-11-09 13:39:13 -08:00
dotCooCoo 77f38a985d linesweeper: checkerboard generators return empty collections for n = 0
checkerboard and slanted_checkerboard counted the inner squares as n - 1, which overflowed for n = 0. They now use n.saturating_sub(1). test-pdf-backends.sh runs the generators tests with the feature on.
2026-11-08 05:13:42 -08:00
dotCooCoo 1e44beee08 Merge main into fix/linesweeper-paperjs-alpha 2026-11-07 06:56:56 -08:00
dotCooCoo 49e20d677a Merge main into fix/linesweeper-example-viewbox 2026-11-07 06:56:14 -08:00
dotCooCoo 7561b89979 Merge main into fix/linesweeper-unbuildable-targets 2026-11-07 06:55:54 -08:00
dotCooCoo e9bc759406 Merge main into fix/linesweeper-example-stroke-width 2026-11-07 06:55:47 -08:00
FredApps 481f66d287 Merge pull request #633 from dotCooCoo/chore/vendor-linesweeper
linesweeper: keep a copy of the crates.io 0.5.0 package in vendor/
2026-11-07 15:37:48 +01:00
dotCooCoo 9aa0870fe7 linesweeper: the paperjs image check counts a difference in alpha
`pixmap_distance` in `tests/paperjs.rs` compared only red, green and
blue. The test fills both shapes with opaque black on a transparent
pixmap, so a covered pixel and an empty one have the same color and the
distance was 0 for any result. The distance now also counts the alpha
difference, and `pixmap_distance_counts_coverage` checks that a filled
pixmap and an empty one are at distance 1.

`scripts/test-pdf-backends.sh` and `README.craft.md` run the `paperjs`
test as well. The package does not include the `boolean-test/data/`
files the test reads, so here it runs only the new test.

The change is recorded in `SOURCE.json`, the Local changes table in
`README.craft.md` and `NOTICE`.
2026-11-07 03:30:35 -08:00
dotCooCoo 6ca0223808 linesweeper: the curve_metrics example's SVG shows the left half of each curve
The example's curves span x = -1 to 1 and each row is translated only in
y, but the viewBox started at x = 0, so the left half of every curve was
cut off. The viewBox now starts at x = -1.5. A test in the example checks
that every curve fits in the viewBox, and scripts/test-pdf-backends.sh
runs it. README.craft.md and SOURCE.json record the change.
2026-11-06 23:15:56 -08:00
dotCooCoo d339fb619a linesweeper: the copy registers only targets that compile
The package's Cargo.toml registers the fonts and snapshots tests, the
boolean_op and winding-numbers examples and the linebender_logo bench.
They import linesweeper_util, path_bool or kompari, which the published
manifest leaves out, and the bench also reads examples/linebender.svg,
which the copy omits. `cargo check --all-targets --all-features` in
vendor/linesweeper failed with E0432 and a missing-file error.

The copy's Cargo.toml no longer registers those five targets; their
source files are unchanged. scripts/test-pdf-backends.sh now runs
`cargo check --locked --all-targets --all-features` on the copy.
README.craft.md, SOURCE.json and NOTICE record the change.
2026-11-06 23:12:40 -08:00
dotCooCoo a9f8597431 linesweeper: example SVG strokes scale with the bounding box's width
The boolean_op, visualize_op and winding-numbers examples set the SVG
stroke width to (max_y - min_y).max(max_x - max_y) / 512, which uses
max_x - max_y for the width. A bounding box from (0, 1000) to
(512, 1001) got a stroke width of 1/512 instead of 1. The width is now
max_x - min_x.

visualize_op computes the width in a stroke_width function with a test,
and scripts/test-pdf-backends.sh runs that example's test. The other two
examples do not compile in this copy. README.craft.md and SOURCE.json
record the change.
2026-11-06 23:12:02 -08:00
dotCooCoo f14cc7f21e linesweeper: keep a copy of the crates.io 0.5.0 package in vendor/
Add the linesweeper 0.5.0 package to vendor/ with no file changed, so
that a fix to it can reach the Craft apps through this repository
without waiting for a linesweeper release. The GitHub repository its
manifest names is archived, and its README says development moved off
GitHub.

Leave out the test font (fonts live in craft-fonts), the logo artwork,
the snapshot images and the package's repository tooling. SOURCE.json
lists each with its hash.

Add a workspace exclude, a [patch.crates-io] entry, SOURCE.json with
the archive hash and per-file hashes, NOTICE and ATTRIBUTION.md rows,
and the package's tests in the backend test script. craft-prepress's
flatten feature now builds against the copy, so Cargo.lock drops the
package's registry source and checksum.
2026-11-06 19:05:18 -08:00
dotCooCoo f686f6c3f6 PDF: allow opening to be canceled during parsing 2026-11-03 06:33:31 -08:00
aiongg 2eca9b3a53 pdf: vendor hayro-postscript and skip << and >> runs without recursion (#263)
hayro-postscript 0.1.0 is the token scanner hayro-cmap uses for the
CMap streams PDFs embed. Its object reader skipped each `<<` or `>>`
by calling itself again, so a stream holding a long run of `<` or `>`
bytes recursed once per pair and aborted the process with a stack
overflow.

Vendor the crates.io package unchanged and patch `object::read` to
skip those runs in a loop, returning the same next object as before.
Wire it in like the other Hayro crates: workspace exclude,
[patch.crates-io] entry, SOURCE.json with registry and local hashes,
the backend test script, NOTICE, ATTRIBUTION.md and the reader README.

Tests cover a million `<` and a million `>` bytes, `<< /A 1 >>` and
nested `<<<< /X >>>>` runs.
2026-10-23 23:31:35 -04:00
aiongg 9f75d3dc19 pdf: keep a CID font's /W2 table past an out-of-range first CID; vendor hayro-cmap from PdfCraft (#254)
* pdf: keep a CID font's /W2 table past an out-of-range first CID; vendor hayro-cmap from PdfCraft

- hayro-interpret: a /W2 run whose first CID is past 65535 is skipped, as in
  /W. A run starting at 4294967295 overflowed the CID counter and discarded
  the whole table. Unit test in font::cid.
- hayro-cmap 0.1.0 is vendored from PdfCraft a2ec27b47 with its malformed-CMap
  patch (PdfCraft #3177): bad bfchar/bfrange entries, an unresolvable usecmap
  and an unparseable tail are skipped instead of failing the whole CMap. The
  crate's tests come with it. Wired up like the other vendored Hayro crates
  (workspace exclude, patch entry, SOURCE.json, backend test script); NOTICE,
  ATTRIBUTION.md and vendor/README.craft-reader.md record the source.

* hayro-syntax: refuse an xref-stream subsection that runs past object number u32::MAX

The object number was start + i in unchecked u32: a subsection starting near
u32::MAX overflowed (a panic in debug builds, a wrong object number in
release). Covered in xref::tests::xref_stream_entries_need_backing_bytes.

* hayro-cmap: a binary usecmap counts against the nesting limit; /W2 checks the CID first

- hayro-cmap: a binary CMap's usecmap passed its own depth to the nested
  parse, so a self-referencing binary CMap recursed until the stack
  overflowed. It now counts like a text usecmap. Test:
  self_referencing_binary_usecmap_stops_at_the_nesting_limit.
- hayro-interpret: the /W2 first-CID check runs before the run's metrics
  are read, so an incomplete run past CID 65535 no longer discards the
  rest of the table.

* hayro-syntax: refuse xref-stream object numbers past i32::MAX

ObjectIdentifier stores an i32; a number between i32::MAX and u32::MAX
was cast to a negative object number.
2026-10-23 22:17:04 -04:00
skylar taylor-barrick c07b3fada6 feat(pdf): share patched reading and rasterization 2026-10-13 12:52:32 -06:00