Commit Graph
684 Commits
Author SHA1 Message Date
.CooCoo 40060e0943 Merge pull request #10680 from dotCooCoo/fix/pdf-coverage-gaps-batch-11
Tests: cover PDF mesh shadings, restroked glyphs, repeated masks and spot midpoints
2026-12-03 02:03:39 -08:00
dotCooCoo c2d242eafa Tests: cover PDF mesh shadings, restroked glyphs, repeated masks and spot midpoints
Adds tests for PDF import and export paths that no test reached:

- A tensor-product patch mesh (type 7) imports as the gradient mesh of
  its boundary, the same mesh a Coons patch over that boundary gives.
- A triangle mesh (type 4) imports as one gradient mesh per triangle,
  each corner in its vertex's color.
- Tensor and triangle meshes over the 16,384-patch limit import as a
  flat gray with a warning.
- The last glyph of a run stroked again in another color splits off
  into its own run; the glyph before it keeps its stroke.
- A masked CMYK image drawn twice at two sizes keeps its opacity mask
  both times, fitted to each drawing; with a mask that hides nothing it
  has no mask either time.
- A one-spot-ink gradient with an off-center midpoint exports a stop at
  the midpoint with the mean tint, still as a Separation shading.

Each test fails with the code it covers broken.
2026-12-02 21:14:39 -08:00
dotCooCoo 03c3d8264b Tests: format the nested pattern and soft mask chains 2026-12-02 20:41:13 -08:00
dotCooCoo 95e2aa4804 Tests: PDF import limits and optional content membership
Add tests that fail when these PDF import paths break:

- Optional content membership dictionaries: AllOn, AnyOff, AllOff and
  the default AnyOn decide which marked art the page walk skips, with
  groups given as an array or a single reference. Each shown path keeps
  the spot ink the walk found it painted in.
- Tiling patterns and soft masks nested more than 8 levels deep open
  with their "nested too deeply" warnings.
- The ink-space scan stops 32 levels into an object and after 4,096
  spaces.
- A one-ink image of more than 2^26 pixels is refused before its
  samples are decoded.
2026-12-02 20:26:38 -08:00
dotCooCoo 540d7d9673 PDF/EPS/.ai import: store imported images with fast PNG compression
Opening a PDF, EPS or .ai file with images re-encodes each image, and
each image's opacity mask, as a PNG. Since the switch to the shared
image codec these PNGs were written with the codec's default
compression (deflate level 6) instead of fast compression. A PDF and
an .ai file each holding one image opened about 50 ms and 105 ms
slower than in 0.24.1.

PDF import and the EPS and .ai readers now each encode through one
helper that asks for PngCompression::Fast, the setting the SVG filter
raster already uses. The pixels are unchanged.

Tests check the zlib header of every PNG an import stores (RFC 1950
FLEVEL): PDF RGB, gray and image-mask images and a CMYK image's soft
mask; a PostScript RGB image and a masked CMYK image's mask; and .ai
RGB and Separation images with their masks, at full size and reduced.
2026-12-02 11:44:52 -08:00
.CooCoo 22bc29d69d Merge pull request #10460 from dotCooCoo/fix/test-lint-mirror-false-alarms
xtask: test-lint mirror leaves out entry reads, never-run follows #[path] modules
2026-12-01 20:19:50 -08:00
dotCooCoo 52d08f0f9c Tests: SVG, PDF and EPS tests check what they claim
Assertions that ran all() over a list that could be empty now check the
list's length first: mesh points, image inks, glyph origins, imported
text, the PDF mesh and arrowhead paths, and the resampled CMYK pixels.
An image that takes a Warp from its art style is checked to keep none of
the look's fills and strokes, instead of checking each of none.

The convolve-matrix tests check that the filtered rectangle is imported,
not only that the import returned Ok. The fan-out clip path test moves
to a unit test that counts the clip paths read. The self-nesting symbol
test checks that the other symbol comes back. The EPS level and preview
id test checks the param values and the trimming and case rules instead
of looping over every value. The ignored PDF text-heavy timing run says
why it is ignored.

A gradient that repeats or reflects with no stops now paints as one
that pads. Before, PDF export wrote it as two 160 by 160 images and EPS
wrote three runs of a conic where one that pads writes one;
`Gradient::is_spread` is false without stops. `paint.setFill`'s params
still report the spread.
2026-12-01 17:38:19 -08:00
dotCooCoo a61a9ba254 Merge main into fix/test-lint-mirror-false-alarms 2026-12-01 16:17:26 -08:00
.CooCoo 4596f1a8be Merge pull request #10374 from dotCooCoo/fix/swallowed-regression-guards
Tests: guards check the environment, not the output under test
2026-12-01 14:10:23 -08:00
dotCooCoo adef85f5f0 Merge main into chore/never-run-test-allows 2026-12-01 03:42:46 -08:00
.CooCoo c3c545dc69 Merge pull request #10430 from dotCooCoo/fix/format-test-tolerances
Tests: format tests check exact values instead of wide tolerances
2026-12-01 03:16:25 -08:00
.CooCoo fac0d0fc80 Merge pull request #10385 from dotCooCoo/fix/behavior-tests-for-source-greps
Tests: check the PDF key and Math.random seeds by behavior
2026-12-01 02:59:13 -08:00
dotCooCoo b2e8b5637e Merge main into chore/never-run-test-allows 2026-12-01 02:55:37 -08:00
.CooCoo 295da28ec5 Merge pull request #10420 from dotCooCoo/fix/pdf-read-counter-address-reuse
PDF: count test reads of a buffer from a mark, not over its address's whole history
2026-12-01 02:32:29 -08:00
dotCooCoo 9730c888fb Tests: seed the PDF file key test through protect
The test called Entropy::seeded directly, so it still passed if export
stopped reading the OS random source. Entropy::new now reads the OS
bytes and the time through seed_sources(), which a test can set for
its thread, and the test runs protect with fixed OS bytes, other OS
bytes and a failed OS read. The OS read in vectorcraft-js's os_random()
is now one function for tests and builds alike.
2026-12-01 02:17:47 -08:00
dotCooCoo d0cf7f09ec Tests: format tests check exact values instead of wide tolerances
The PDF, EPS, SVG mesh, metafile hatch and distorted-image tests now
assert the values the input gives: the Letter page a page without area
falls back to, the H glyph's box from its font metrics, the middle gray
of each mesh piece, the 8 of 64 hatch pixels, and the bounds of the
placement taken at the image's center.
2026-12-01 02:05:29 -08:00
dotCooCoo 010367e39e Tests: allow the 26 Windows and macOS tests that CI never runs
Each test that a cfg limits to Windows, macOS or a case-insensitive file
system gets a `test-lint: allow never-run` line naming its platform, so
`cargo xtask test-lint` no longer reports them. The tests are unchanged
and still run on their own platform.
2026-12-01 01:46:09 -08:00
dotCooCoo 68dbba0b92 PDF: count test reads of a buffer from a mark, not over its address's whole history
reads_of counts reads by buffer address and never forgets them, so a buffer
allocated where another test's freed buffer was read starts with that count.
linked_pages_read_the_file_once_and_a_blank_page_keeps_its_crop_box asserted
reads_of(&blob) == 0 and failed once that way under 16 test threads.

Each read now gets a sequence number. read_mark returns the next one and
reads_of_since counts only the reads at or after a mark. The linked-pages test
takes a mark before opening the file.
2026-11-30 23:05:46 -08:00
dotCooCoo 3f21a06bed Tests: cover broken hex strings in the stream scan and restricted file fonts
A hex string broken by a byte that is neither a hex digit nor white space
is no string: the hostile-input scan goes on from the next byte, so a
cross-reference stream after it is still read. A font a PDF carries with
restricted license flags (OS/2 fsType 0x0002) keeps drawing its type, and
a PDF saved from the document draws that type as outlines with the license
warning instead of embedding the font again.
2026-11-30 23:03:07 -08:00
dotCooCoo c47fdb8974 Tests: check the PDF key and Math.random seeds by behavior
The PDF encryption and Math.random seed tests read their source files
and searched for names. They now build the seed from given OS bytes:
equal bytes give an equal stream, other bytes give another stream, and
a failed OS read is an error for the PDF key. Mixing any other source
into either seed fails the tests.

The PDF seed is split into Entropy::seeded, which takes the OS bytes
and the time, and the module doc now names the OS random source.
2026-11-30 22:58:06 -08:00
dotCooCoo 1dbbf87436 Tests: guards check the environment, not the output under test
Several tests returned early when the code under test gave back nothing,
so the regression they guard against passed. Each of those guards now
checks only what the host provides (an installed face, the bundled
fonts), and the output itself is asserted:

- PDF live text: the lam-alef face is no longer picked by whether its
  type imports (#6072); Insert Kashidas asserts the kashida and the
  imported type.
- Effects and Expand Appearance on type assert the outlines and the
  drawn type when the default face is installed.
- The OpenType panel's Stylistic Sets test asserts sets with the
  bundled fonts.
- Thumbnail worker tests assert that the worker starts; the memory
  peak test asserts a reading.
- The json2 test checks the interpreter's Date, replace and RegExp on
  every run, before looking for json2.js.
- Devanagari arrow keys and the Arabic narrow-area wrap assert the
  layout they set up.
2026-11-30 21:56:24 -08:00
BFlat cf2d168d49 PDF import: inline images with the same dictionary keep their own pixels (#10313)
An inline image has no object of its own, and the interpreter keys an image
by its dictionary alone, so every inline image of one size and encoding got
the key of the first one and was imported with its pixels: Type 3 glyphs drawn
as inline stencil images came in as the wrong letters. An inline raster image
is now keyed by its samples too, and a stencil image by its decoded pixels.

Fixes #9247
2026-12-01 05:05:57 +07:00
dotCooCoo c1eb29c054 Docs: doc comments name U+FFFD in place of the literal character
Two doc comments held a literal U+FFFD replacement character, which
SonarCloud reports as "Invalid character encountered". They now write
it as `\u{FFFD}`:

- crates/ui-egui/src/panels/actions/playback.rs (`shown_text`)
- crates/pdf/src/tests/realtext.rs (the #708, #811 test)
2026-11-29 16:39:26 -08:00
jmvergesandClaude Opus 5.5 cbfb26b9ab Merge main (89a5b64170) into the font width import branch
Main now reads the editing copy decoded as its streams are read
(#9922: ai_alone_decoded, ai_layers_alone_decoded, AiLayers::decoded)
and renamed the text document's patterns to paints (#9782:
text_patterns, Texts::with_paints). The decoded entry points take the
PDF part's widths as the ones they wrap did, AiLayers::decode goes
through AiLayers::decoded, and the text document still takes the widths
when it is first read, before its paints. The docs keep both sides'
entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-28 20:50:55 +00:00
.CooCoo 4fe3b646f7 Merge pull request #9937 from dotCooCoo/train/carry9168
PDF: PDF/X-4 exports declare the identification namespace on the XMP description (carries #9168)
2026-11-28 08:36:48 -08:00
dotCooCoo b464b1ecad PDF: check that the PDF/X-4 XMP packet stays well-formed
The PDF/X test now asserts that the outer description declares the
pdfxid namespace exactly once, and that the edited packet parses with
the strict XML parser that File Info uses to read it back.
2026-11-28 08:08:13 -08:00
dotCooCoo 09c619f63e Merge main into train/carry9168 2026-11-28 07:34:31 -08:00
dotCooCoo 4d1f6cc249 .ai import: editing data whose streams pass 256 MiB opens with its layers
The private data streams of a .ai file, or of a PDF saved with its
editing data, were joined into one buffer of at most 256 MiB before
they were decoded, while the decoded editing data may take up to an
eighth of installed memory (512 MiB to 2 GiB). A file whose streams
passed 256 MiB opened as its PDF part without a note, and a file whose
PDF part can't be read failed with "it is larger than 256 MB".

The streams are now read one after the other and decoded as they are
read, so they are never joined. The decoded data keeps its limit, and
no more of the streams is read than that limit and a sixteenth more.
The data is decompressed after the first compression marker in it.
2026-11-28 05:19:31 -08:00
.CooCoo 39f317a0c6 Merge pull request #9840 from dotCooCoo/fix/engine-tests-count-work
Tests: bounded-work checks count the work instead of timing it
2026-11-28 00:16:46 -08:00
dotCooCoo f23186d1d4 PDF import: count function evaluations on an import that stops part way
The work count recorded a PDF import's function evaluations only after
the last page, so an import that stopped on a later page (a page whose
scan or drawing fails) recorded none of the evaluations its earlier
pages took. Each page now adds its evaluations right after it is drawn,
before any error returns, and each evaluation is counted once.
2026-11-27 21:47:49 -08:00
.CooCoo b7cec34427 Merge pull request #9778 from dotCooCoo/fix/pdf-cmyk-count
PDF export: the CMYK document warning counts only RGB images written to the file
2026-11-27 21:41:17 -08:00
.CooCoo 94fa38479f Merge pull request #9861 from dotCooCoo/fix/pdf-import-work-counters
PDF import: complexity tests count the work done instead of timing it
2026-11-27 21:38:07 -08:00
dotCooCoo 5466829792 PDF import: complexity tests count the work done instead of timing it
The four tests of the pre-open stream scan and the page hash test
asserted elapsed time (5 s and 60 s), so a loaded machine could fail
them and a slower but still bounded scan could pass them.

- streams.rs: a test-only counter adds up the bytes the scan looks at:
  in each helper that walks the file, in each charge to the scan's
  budget, and once for each step of the main reading. The tests assert
  at most 32 bytes looked at for each byte of the file. The largest
  case today looks at 21.
- editing.rs: a test-only counter adds up the page content the hash
  decodes. The test asserts no more than the hash limit plus the one
  stream that goes past it.

Each counter assertion fails on a broken version: strings read to the
end of the file instead of 64 bytes (131,076 bytes a byte), each
stream keyword reading back 64 KiB (7,937 bytes a byte), and every
page decoding the shared stream again (300 MiB decoded).
2026-11-27 18:03:03 -08:00
dotCooCoo 8c2ab73b81 Tests: bounded-work checks count the work instead of timing it
Six engine tests guarded against quadratic or unbounded work by timing
it (under 2, 10, 30 or 60 seconds) or by printing how long it took. A
slow or loaded machine could fail them, and a regression that stayed
under the bound passed. Each now counts the work the guarded code does
and compares it with a smaller input or with the code's own limit:

- An unknown command id or parameter key of 200,000 characters compares
  no more characters than one of 20 (edit-distance cells).
- A Word .doc with 20,000 hidden paragraphs reads at most one more Prl
  per paragraph than one with a single paragraph, and each style's
  properties are read once.
- One function-based shading filling 5,000 paths takes no more function
  evaluations than filling one, and twenty stay within the import's
  evaluation budget.
- A form decoding to 64 MiB drawn 1,000 times is walked no further than
  the page's form-content limit and one more form.
- A blend of 998 steps measures no more laid steps per object than a
  blend of 3, and one of 1,500 steps is not laid out.
- Retype of a tracked line of 450 glyphs lays out at most 20 times the
  glyphs a line of 45 does.

The counters are test-only: thread-local cells in the engine under
cfg(test), and in vectorcraft-pdf (read-count feature) and
vectorcraft-eps (new work-count feature), which the engine enables in
its dev-dependencies only. Retype's layout calls go through one helper
that counts them.
2026-11-27 16:20:23 -08:00
jmvergesandClaude Opus 5.5 3ce7a70811 PDF export: a black-and-white colorized image is never smoothed
A 1-bit image mask opens as a grayscale image of black and white pixels
colorized by its fill color. The PDF export wrote it as its ink with the
pixels as an 8-bit soft mask and /Interpolate true on both. A RIP that
honors /Interpolate smooths the mask and grays its edges, so where the
same mask is drawn over itself in another ink, as separated garment art
stacks its plates, the ink below shows along every edge. The file's own
PDF part and the EPS export keep the mask hard.

A colorized image whose coverage is only 0 or 255 (the test the
Monochrome compression settings already use, now
`images::bilevel_coverage`) is written without /Interpolate. Grayscale
images keep it. krilla has no 1-bit soft mask or /ImageMask, so the
mask stays 8-bit and just isn't smoothed.

The pixelated colorized image test now uses gray pixels, since a
black-and-white image no longer asks for smoothing whether or not it is
pixelated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-27 22:35:24 +00:00
dotCooCoo 65268c8761 PDF export: the CMYK document warning counts only RGB images written to the file
The warning that #8825 (dmytrochornyi) split into converted and kept RGB
images counted each image before it was recoded. An image that is then
left out of the file (its pixels can't be read, or it can only be written
in its own colors) was still counted, and an image that is written as it
is after its pixels can't be decoded for a CMYK destination was counted
as converted to CMYK.

Each RGB image of a CMYK document is now counted once its outcome is
known: converted when the recoded image is written in CMYK, kept when it
is written in RGB, and not at all when it is left out.
2026-11-27 09:05:28 -08:00
.CooCoo df35d52041 Merge pull request #8825 from dmytrochornyi/fix/pdf-cmyk-image-warning
PDF export: the CMYK document warning says whether RGB images are converted (#1242)
2026-11-26 21:30:17 -08:00
jmvergesandClaude Opus 5.5 8ed08d6637 Merge main (016ead2572) into the font width import branch
Main added its own entries to the change line at the top of
docs/file-format-parity.md and docs/target-app-parity.md: keep main's
lines and dates, with this branch's entry in front of them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-26 02:08:57 +00:00
dotCooCoo c27619310a Merge main into feat/fogra51-52-cmyk-v2 2026-11-25 10:19:57 -08:00
dotCooCoo 2784f684a1 EPS: white overprints knock out on PostScript plates with Discard White Overprint
On a separated PostScript plate, a process white fill, stroke or
character fill or stroke marked to overprint kept its overprint flag
with Discard White Overprint on, so it was drawn as nothing and the ink
below it stayed. The plate document now turns overprinting off for
those whites, so they knock out as in composite output. White linked to
a spot swatch that has a color, at a tint above 0%, still overprints.

An overprinting colorized image in the tile of an overprinting pattern
fill is now written in only the process inks it puts down, as it is
outside a pattern, instead of as a full CMYK image that removed the
inks below it.

The params text and docs/mcp.md now say the spot exception needs a spot
swatch with a color.
2026-11-25 04:12:07 -08:00
dotCooCoo 8f474a41a3 Merge main into fix/white-spot-ink-overprints
The white checks for colorized images in PDF export, EPS export and Print
Ink Fixes now go through DiscardWhite, which replaces
Document::spot_ink and Document::discards_white_overprint. Printed
separations read DiscardWhite with the spot inks they print, so a white
spot ink converted to process inks knocks out there.
2026-11-24 12:31:45 -08:00
ViktorBystrov72 f0a5396e41 Declare the PDF/X-4 identification namespace on the XMP description (#9134) 2026-11-24 20:10:46 +05:00
jmvergesandClaude Opus 5.5 6467e3d1d5 Merge main (19ebdcab54) into the font width import branch
Main moved the pdf crate to the craft framework (craft::pdf) and added the
marks and output exports next to this branch's page_widths ones: keep all
three, keep cid::replacement crate-visible for page_widths, and read
craft::pdf in page_widths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 13:56:42 +00:00
BFlat d48c4207f7 Merge pull request #9102 from dotCooCoo/feat/colorized-image-overprint
Images: Overprint Fill makes a colorized image's color overprint
2026-11-24 16:39:55 +07:00
BFlat c3c02f81e0 Merge pull request #9128 from dotCooCoo/fix/print-fonts-setting
Print: the Fonts setting chooses how PostScript output sends type
2026-11-24 16:06:58 +07:00
BFlat d5b5980092 Merge pull request #8917 from dotCooCoo/fix/pdf-masked-cmyk-warp-image-size
PDF export: a distorted CMYK image with an image mask keeps the resolution its pieces need
2026-11-24 16:02:31 +07:00
dotCooCoo 116a8c2411 Overprint: a white spot ink keeps overprinting with Discard White Overprint
With Discard White Overprint on, PDF export, Overprint Preview,
Separations Preview and printed separations took the overprint off any
white paint, including a tint above 0% of a spot swatch whose color is
white, which prints as that ink. Such a tint now keeps its overprint in
fills, strokes, character paints and a colorized image's color; process
white and a 0% tint still knock out.

DiscardWhite holds the setting and the document's spot inks, and
Document::discards_white_overprint gives the same answer for the PDF and
EPS writers.
2026-11-24 00:45:00 -08:00
BFlat 6f37bd839c VectorCraft on the craft UI framework (#8800)
VectorCraft's UI moves onto the shared craft UI framework in storytold/craft-libs (`next`; the framework side is storytold/craft-libs#2809), as PhotoCraft's did. The app keeps its engine, document model, file formats, commands and automation; its windows, panels, bars, dialogs and canvas are now built and driven by the framework: shell, docking and panels, hosted dialogs, keyboard, focus, IME and pointer routing, and theme tokens.

About 264,000 lines of VectorCraft's own egui UI code are removed and about 154,000 added. craft-libs is pinned at bf62d509f (in `next`), the egui fork at f5025284.

Tests that drove the old UI were rewritten against the port where only their premise changed, with their assertions kept. The UI tests still failing at merge, and their follow-ups, are listed in the pull request.
2026-11-24 08:25:24 +07:00
dotCooCoo 5a82ba3742 Overprint Preview: a colorized image showing a full-color preview keeps knocking out
A linked image whose file is missing shows its full-color preview as it
is, without its colorize paint, and separations and PDF export already
print it that way. Overprint Preview and simulated overprints in
composite output still darkened the whole image. darken_overprints and
image_overprints_whole now take the document's images and leave such an
image at its own blend mode, and the helpers that find the pixels a
colorized image shows move from the separations code to
vectorcraft_doc::overprint so both use them. The preview's cached art is
made again when the document's images change.
2026-11-22 23:07:34 -08:00
dotCooCoo 144544aa20 Tests: set the ImageBlob file_font field in the colorized image separations test
main added the file_font field to ImageBlob, and the separations test
for an image whose pixels refuse its color built one without it, so the
vectorcraft-pdf tests did not compile after the merge of main.
2026-11-22 22:46:01 -08:00