Commit Graph
121 Commits
Author SHA1 Message Date
bflatastic 03df09a1c3 hayro-interpret: a soft mask's group draws within the forms where the mask was set, so a mask drawing the form it masks is not a form drawing itself 2026-11-22 23:28:59 +07:00
David MannandClaude Opus 5.5 1929e79ebb Merge storytold main into next (20 Nov, second sync)
Merges main at 8f92ed1334 (#2550 and the rest of main since the 20 Nov sync).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:38:55 +01:00
Dylan M. Taylor 9eb02be84f Merge pull request #2546 from dylanmtaylor/feat/pdf-max-coverage
feat(pdf): enforce max_coverage budget via vendored vello_cpu 0.0.8
2026-11-20 08:27:48 -05:00
Dylan M. Taylor c470ed170d hayro-interpret: restore FormXObject RESOURCES presence check and Indexed image recovery in x_object.rs (#2497)
* hayro-interpret: port remaining pdfcraft resource-scope, indexed-image, and text-clip patches

* hayro-interpret: keep craft-libs resource-scope and text contracts; retain x_object.rs fixes
2026-11-19 23:46:01 -05:00
Dylan M. Taylor c8087acbd9 hayro*: port pdfcraft vendor/hayro* patches (#2472)
* hayro*: port pdfcraft vendor/hayro* patches (storytold/craft-libs#778)

* hayro-syntax: fix test and merge compile errors from port

* fix(hayro-syntax): avoid moving params.control in lzw_flate test

* fix(hayro-syntax): include early_change in lzw_flate test

* hayro*: fix hayro-interpret compile errors and hayro-syntax test failures

* hayro*: fix duplicate char_code_to_unicode and super::LETTER in test

* hayro-syntax: fix predictor cancellation and ArrayIter parse failure tests

* hayro-syntax: restore bit-level PNG predictor fallback when control is set

* hayro-syntax: support Checkpoints cancellation inside unfilter_png

* hayro-interpret: remove duplicate blob::tests and require hayro-syntax 0.7.2

* hayro-interpret: cast MAX_COLOR_SPACE_DEPTH u32 as usize in test

* hayro: drop unvendored vello_cpu set_max_coverage/coverage_full calls

* hayro-interpret: restore interpret_form_contents call and TextPass order

* hayro-interpret: split ExtendedWarning out of InterpreterWarning for vectorcraft compatibility

* hayro-interpret: clone extended_warning_sink before ImageXObject::new closure

* hayro-interpret: restore OP/op/OPM ExtGState handling for overprint

* hayro-interpret: restore DecodeLimits and truncation reporting in decode_content

* hayro: restore on_plate DefaultColorSpaces bypass and cmyk_luminosity soft mask
2026-11-19 21:57:15 -05:00
Martin Ball 6dedbe4fe6 skeleton: merge up/next into area/ribbon-fw with conflict markers left in (land step 1) 2026-11-19 20:42:08 +00:00
aiongg ca58dfe6c9 Merge storytold main into next (19 Nov sync)
Merges main at d7c9632bfb.

- Cargo.toml: both sides' new workspace crates (next's font-subset, harfbuzz-subset-sys and
  host; main's gpu, gpu-null, gpu-providers and gpu-wgpu).
- crates/jpeg: next split lib.rs into modules; main's reduced-size decoding goes to them: the
  scaled IDCT, reconstruction and render_scaled to idct.rs, MAX_SHRINK, reduced_estimate and
  decode_reduced stay public in lib.rs. Main's new test added; the frame test next removed
  stays removed.
- crates/audio, crates/media: next builds the integration tests into the library's test
  executable (autotests off, tests/main.rs); main's new DSD and MPEG-TS mux tests are modules
  there behind their features instead of [[test]] targets, and the mux tests reach their shared
  helper module through the integration module.
- crates/media/src/matroska/track.rs: main's new FFV1 codec-parameter test added; the test
  modules next removed stay removed.
- crates/file-formats: main's JXL capability test, which asks the codec whether JXL reads,
  replaces next's interim check.
2026-11-19 16:22:24 +00:00
mtlcl410 d2a7d88d2e hayro-postscript: a \ddd escape above \377 keeps its low eight bits (#2321) (#2324)
A literal string's octal escape was converted with `u8::from_str_radix`,
which fails above 0o377, so the byte was dropped. Read one to three octal
digits into a u16 (at most 0o777) and push the low byte, as ISO 32000-2
7.3.4.2 and the PostScript Language Reference (third edition, 3.2.2)
specify: "high-order overflow shall be ignored". Escapes up to `\377`
decode as before.

Record the patch in SOURCE.json and vendor/README.craft-reader.md.

Fixes #2321
2026-11-18 23:20:45 -05:00
Dylan M. Taylor 07d5165036 hayro-postscript: add Scanner::parse_object_or_skip (#2287) 2026-11-18 18:59:47 -05:00
Martin Ball b21c69300c Contract stubs: craft-codepage craft-i18n craft-host craft-quit craft-theme craft-keymap craft-behavior craft-settings craft-platform 2026-11-18 08:01:14 +00:00
aiongg ac3dfd1f53 Merge storytold main into next (17 Nov sync)
storytold main 83cb1133dd (291 commits) into the integration head bab1a99b85; 47 conflicted files.

- Domain test files (metafile, prepress, pdf plates, settings store, heif, media-testkit, atomic): tests next cut stay cut; tests new on main are kept, as trials where the crate's test target runs trials.
- atomic: main's group-bits test and Faulty::set_group go to src/tests.rs. audio: main's GSM and SBC oracles join tests/main.rs. cms constructors, pdf knockout_backdrop and testing_pdf join their crates' one test binary; timeline's preflight tests become src/preflight_tests.rs trials.
- update: main's changes to detect, install (linux, macos) and the tests land in next's split modules. The app's own offer is inspected on a thread of its own, picked up by tick's polling; settle_for_tests settles offers too. Later on a ready update drops the close it asked for. updater_pin_tests.rs stays deleted; its new pin test is in tests/it/update.rs.
- craft-color: main added a different crate at crates/color (the colour tags of compositor and display frames); it is next's craft-color module `tags`, re-exported at the root.
- Old crates/ui (combo, docking, testing, README) and keymap's ui/view.rs stay deleted; main's new crates/ui/src/testing files are dropped with them.
- New crates in the craft facade: ai, control, dds, frame, ipc, media-source, palette, press-print, score, ssip. testkit and xtask are listed outside it.
- Cargo.lock: the union of both locks, resolved by cargo metadata. Workflow: main's nextest Windows leg, with next's --keep-going clippy.
2026-11-17 12:44:52 +00:00
.CooCoo 47153d5bec linesweeper: the vendored copy passes clippy 1.100.0 with every feature (#1248) 2026-11-16 21:37:04 -05:00
.CooCoo 5724da0f2e linesweeper: short chords at huge x and subnormal line x stay finite and exact (#1258) 2026-11-16 21:36:59 -05:00
Ken Mantle b8eaa8e2f3 pdf: blend each element of a non-isolated knockout group with its backdrop (#1137) 2026-11-16 21:32:26 -05:00
.CooCoo ff5a8af742 hayro-syntax, hayro-interpret: callers set the image byte and pixel limits (#1901) 2026-11-16 21:30:21 -05:00
aiongg dffc61a7e0 Merge storytold main 832883b5 (sync 16 Nov)
961 upstream commits since 7bb6c900. Resolutions:
- Test-only conflicts: upstream tests from before the base that our side
  cut stay cut; tests new upstream are kept (audio aac/config, layout,
  encode_format; cms lutfile; media mux; print windows_native, ticket;
  update self_update; xml hostile).
- Code our side moved, with upstream's change carried to the new place:
  craft-media mux roll sample groups (mux/boxes.rs) and writer-start
  offsets with overflow checks (mux/progressive.rs); craft-print's
  shrink-to-fit scale guard (sheets/plan.rs); craft-update's nextest
  archive detection (self_update/detect.rs); craft-vectorcraft-format's
  Tail::write_to_with (container.rs); craft-i18n's pedantic fixes
  (bidi.rs, negotiation.rs).
- craft-ui: the old crate's modules stay removed; gpu_test_lock guarded
  their per-test wgpu renderers, which the snapshot kit does not have.
- New upstream tests in crates that build their integration tests into
  the library's test executable are modules of tests/main.rs (audio
  flac_decode and qoa_oracle, cms, docpath, pcraft-format,
  vectorcraft-format).
- The 22 new crates are optional members of the craft facade.
2026-11-16 01:52:09 +00:00
Dylan M. Taylor abe4aca262 vendor: record the hayro-syntax transmute as an audited exception 2026-11-14 14:44:00 -05:00
Dylan M. Taylor b6b222afb0 fix(prepress): address PDF/X review findings 2026-11-14 17:45:53 +00:00
aiongg 7808f7f6d2 Lints: fix clippy, rustdoc and test findings (shadowed f32 module, unused import, private doc link, struct-update defaults, test attributes lost in the 13 Nov sync) 2026-11-14 00:15:29 +00:00
dotCooCoo 32ffa0b58a Merge main into fix/linesweeper-sweep-doc-left-scan 2026-11-12 09:02:06 -08:00
Hamza NaveedandHamza 75af6f589a PDF interpret: a glyph shown in a clipping mode clips even with no outline
* PDF interpret: a glyph shown in a clipping mode clips even with no outline

A glyph shown in a clipping render mode (`4 Tr` to `7 Tr`) adds its outline to
the clipping path, and that clip applies to everything painted after `ET` until
the enclosing `Q`. When the glyphs shown have no outline -- a space, say -- the
clip they contribute is empty, and an empty clip admits nothing.

`interpret_window` applied a clip only once a glyph had contributed an outline,
so such a text object applied *no* clip and what followed painted unmasked.

A text object that shows no glyph at all is a different case and is left alone:
the clipping path is unchanged there, as readers leave it, and a glyph whose
outline is unavailable (Type 3) leaves the real clip unknown, so both stay
unclipped. pdf.js draws the same line in `endText`: it builds the clip from the
glyphs shown, empty outlines and all, and applies none when none were shown.

Measured on a page filled red behind the text object, Preview (CoreGraphics)
and Firefox (pdf.js) agreeing on the case this changes:

    a space shown in 7 Tr    before: the fill paints   after: nothing paints
    no glyph shown in 7 Tr   unchanged: the fill paints

Companion to storytold/pdfcraft#3451.

The first push of this branch also carried 803 build-artifact files from
`crates/pdf/read-only-contract/target/`, which `.gitignore` did not cover: its
`/target` is anchored to the repository root, so a sub-crate's own build
directory is not ignored. Recommitted without them, and `target/` added so the
next one cannot slip in either (#185 review).

* pdf: test visible glyphs in a clipping mode, and what each clip leaves on the page

---------

Co-authored-by: Hamza <mail.hamzanaveed@gmail.com>
2026-11-12 10:38:02 -05:00
Hamza NaveedandHamza 9b7b748fbb krilla: TrueType subsets keep the font's OS/2 table (embedding permissions)
* krilla: TrueType subsets keep the font's OS/2 table (embedding permissions)

The subsetter writes only the tables it subsets, so a FontFile2 program
had no OS/2 table and the font's embedding permissions (OS/2.fsType)
never reached the PDF: a Preview & Print or Restricted font looked
unrestricted to anything reading the file later (designcraft#1781).

Patch 18 adds the source font's OS/2 table, byte for byte, to a
TrueType subset that lacks one, rewriting the table directory with its
checksums and head.checkSumAdjustment. CFF programs are still embedded
bare. Ledger, patch file and SOURCE.json updated; craft-pdf's new
font_tables test checks the table, its fsType and the font's checksums.

* krilla: the OS/2 test checks the embedded program is a subset

Its sfnt and re-read checks also pass for the source font embedded whole. A subset has fewer glyphs than the fixture's 11, and a shorter glyf.

---------

Co-authored-by: Hamza <mail.hamzanaveed@gmail.com>
2026-11-12 10:36:53 -05:00
.CooCoo d624d5895a linesweeper: line_segment's doc says it can return an exited segment
A segment that exits at a sweep line keeps its position until the sweep advances, and segment_range leaves it out.

---------

Co-authored-by: dotCooCoo <RobertLeeLW@gmail.com>
2026-11-12 10:06:02 -05:00
dotCooCoo e314c9a4f2 linesweeper: the left-scan lemma in docs/sweep.typ takes ordering on alpha^(i+1)
The lemma for the intersection scan to the left asked for the ordering
invariant on (alpha^1, ..., alpha^i) and the crossing invariant on
(alpha^1, ..., alpha^(i+1)). The bidirectional lemma applies it with
alpha^(i+1) = beta before the extended list is known to satisfy the
crossing invariant, so the premises now mirror the right scan: ordering
on (alpha^1, ..., alpha^(i+1)), crossing on (alpha^1, ..., alpha^i).

The argument that the order invariant holds between events cited a
"third invariant"; the document defines two, and it now cites the
crossing invariant.

SOURCE.json gets a local_patches entry and the new sha256 of
docs/sweep.typ, and README.craft.md lists the change.
2026-11-11 21:37:35 -08:00
Dylan M. Taylor 1d92efa707 hayro-syntax: the repair scan finds an object whose header names another generation (#900)
Ports pdfcraft 4a0b1dd1 (hayro-syntax patch 34, #5580).
2026-11-11 21:49:13 -05:00
Dylan M. Taylor 93144311ae hayro-syntax: a stream with no endstream is its /Length, and the search for endstream does not run into a later object (#898)
Ports pdfcraft bfaa20db and 9e29af78 (hayro-syntax patch 36).
2026-11-11 21:47:50 -05:00
Dylan M. Taylor bafefe627a hayro-jbig2: PdfCraft's JBIG2 follow-ups (refinement fixes, file header, work accounting, dictionary pixel cap) (#886)
* hayro-jbig2: bound a stream's total decode work and what a page retains; no i32 overflow

Port of pdfcraft 85c10051 (patches 5-9), 82439525 (patch 10) and 10107d94 (patch 12).

* hayro-jbig2: PdfCraft's JBIG2 follow-ups (refinement fixes, file header, work accounting, dictionary pixel cap)

Ports pdfcraft 72e763ad, b7ec3669, e3bc4e85, 01d3479f, b9e068aa, 858ce960, 07f44038, e38b9d18, 8717a085, 58c30af3 and the hayro-jbig2 part of e2464e14 (with the hayro-jbig2 part of 0ed33990 they build on).

* vendor/README.craft-reader.md: one #831 paragraph, the follow-ups after it
2026-11-11 19:20:53 -05:00
Dylan M. Taylor 85f30007d7 hayro-jbig2: bound a stream's total decode work and what a page retains; no i32 overflow (#831)
Port of pdfcraft 85c10051 (patches 5-9), 82439525 (patch 10) and 10107d94 (patch 12).
2026-11-11 18:49:24 -05:00
Dylan M. Taylor 7f0f352d21 pdf inspection: count pending text clips and drop page content after reading (#566)
* pdf inspection: count pending text clips and drop page content after reading

- hayro-interpret: state_bytes counts the pending text-clip outlines a
  saved state copies, so MAX_SAVED_STATE_BYTES bounds them too.
- plate-test structure: read each page through a ContentReader into a
  buffer dropped after the page, instead of page.operations(), which keeps
  every page's decoded content for as long as the document.

* address review: cap page content read at the 256 MiB decode limit

* fix the saved-state test: start the clip outline with a MoveTo
2026-11-11 16:12:06 -05:00
Dylan M. Taylor 9eee29b69d hayro-syntax: refuse a legacy encryption key length above 128 bits instead of panicking (#817)
Port of pdfcraft #1882 (344ba9f8). Revisions 2-4 take the file key from a 16-byte MD5 hash; /V 2 /R 3 /Length 256 sliced past it and panicked on open.
2026-11-11 15:46:28 -05:00
dotCooCoo 95fa868c6e linesweeper: docs/sweep.typ spells "conditions" and names q(i+1)
Two typos in docs/sweep.typ are corrected: "condi0.2tions" reads
"conditions", and the insertion-position argument says q(i+1) is false
instead of q(i+i).

SOURCE.json records the new sha256 of docs/sweep.typ and the change in
local_patches, and README.craft.md lists it.
2026-11-10 22:46:50 -08:00
dotCooCoo a28406151f Merge main into fix/linesweeper-sweep-doc-left-scan 2026-11-07 06:55:31 -08:00
FredApps 2396054e77 Merge main and retain image-only CCITT guards 2026-11-07 15:39:40 +01: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
FredApps 9fa0111656 Merge pull request #582 from dotCooCoo/fix/hayro-jpx-unused-import
PDF: remove an unused JPX macro import
2026-11-07 15:37:35 +01:00
FredApps 2eac880de8 Merge pull request #580 from dotCooCoo/fix/hayro-interpret-source-digest
hayro-interpret: refresh the local image-reader digest
2026-11-07 15:37:25 +01:00
dotCooCoo 7a9fe3a4b2 linesweeper: the left intersection scan in docs/sweep.typ uses alpha^(i+1)
The pseudocode for the intersection scan to the left looped j = i down
to 1 and compared each alpha^j with alpha^i, so its first pass compared
alpha^i with itself. The lemma after it is stated for alpha^(i+1), the
segment being inserted to the right of alpha^i. The loop body now uses
alpha^(i+1), and w^j is the smallest event height between j and i+1.

SOURCE.json records the patch in local_patches and the new sha256 of
docs/sweep.typ. README.craft.md and NOTICE say one file is changed.
2026-11-06 23:00:31 -08:00
dotCooCoo f211604aad linesweeper: the copy's README says which workflow a change here does not start
sonarcloud.yml runs on every pull request, so a change only under vendor/linesweeper starts a workflow; it does not start pdf.yml.
2026-11-06 20:51:55 -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 6e909558c1 PDF: compile the CCITT row helper only with images 2026-11-03 09:59:55 -08:00
dotCooCoo c8aeab2226 hayro-interpret: refresh the local image-reader digest 2026-11-03 09:05:50 -08:00
dotCooCoo a017817164 PDF: remove an unused JPX macro import 2026-11-03 09:03:01 -08:00
dotCooCoo a5a162a87a PDF: bound cancellation work in coded blocks and stream repair 2026-11-03 07:14:43 -08:00
dotCooCoo f686f6c3f6 PDF: allow opening to be canceled during parsing 2026-11-03 06:33:31 -08:00
Dylan M. Taylor 23738e1650 Merge pull request #532 from storytold/fix/sec-color-space-depth
hayro-interpret: bound how deeply color spaces may nest
2026-11-02 22:40:31 -05:00
Dylan M. Taylor 31e54f7e41 Merge pull request #531 from storytold/fix/sec-xref-entry-cap
hayro-syntax: cap a document's xref map at the PDF object limit
2026-11-02 22:40:16 -05:00
Dylan M. Taylor 80bbc2939c Merge pull request #530 from storytold/fix/sec-jbig2-decode-limit
hayro-syntax: hold a JBIG2 page to the stream's decode limit
2026-11-02 22:39:43 -05:00
Dylan M. Taylor f52b9dc547 Merge pull request #475 from dotCooCoo/fix/hayro-syntax-debug-closing-brace
hayro-syntax: tests check that valid entries survive an unreadable value, and Debug prints the closing brace
2026-11-02 21:57:54 -05:00
Dylan M. Taylor 40bb05042f Merge pull request #474 from dotCooCoo/fix/krilla-gray-black
krilla: a gray stop in a CMYK gradient becomes its exact black (patch 17)
2026-11-02 21:57:50 -05:00
Dylan M. Taylor 9be9a63782 Merge pull request #426 from mockydevs/fix/path-as-rect-open-polyline
pdf reader: a five-point open polyline is not a rectangle
2026-11-02 21:53:06 -05:00