Adds three regression tests from wireless89's review of #4791:
- xfa_opening_reset_reaches_a_section_shown_by_an_earlier_script (a text field of a section
an earlier opening script showed is reset in the widget and the saved data);
- xfa_deferred_choice_resets_preserve_the_reset_value_through_reopen (the same for choice
lists: multi-select with structured picks and an empty or set default, and a label saved
as its export value; widget, open datasets and saved datasets checked separately);
- xfa_initialize_scripts_that_hide_subforms_lay_the_form_out_once now edits the check box
and checks fields, pages and the value through three save/reopen cycles.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
Conflicts, each resolved by keeping both sides:
- parity/acrobat-features.toml (dynamic XFA entry): main added the rotate
evidence and the note on draws turning about their anchor; this branch
added its open-script evidence and notes. Both kept on the one line.
- crates/engine/src/tests.rs and crates/xfa/src/tests.rs: both sides added
tests at the end of the file. Both kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
pdfcraft-xfa keeps its own copy of pdfcraft_forms::name_text (it can't
depend on forms), and a radio group's value only finds its button while the
two agree. xfa_and_forms_spell_names_alike compares them, and checks that
forms' name_bytes reads the copy's spelling back, for UTF-8, '#', Shift-JIS
and stray bytes. With the copy writing lowercase hex it fails at the
Shift-JIS case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
The focus now carries the focused field's object, so the overlay, the
draft commit and the focus frame use the twin that has the focus rather
than the first field with its name. The arrow keys pick by position
through the same twin mapping a click uses (list_pick_edit), so an arrow
in a twin listing its options in another order picks its own next row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
The pdfcraft-print unit-test executable imported windows.data.pdf.dll and
prntvpt.dll at load time (the windows crate binds them with raw-dylib), so
on a Windows installation without them it could not start, and the tests
of the missing-DLL guard never ran there. crates/print/build.rs now passes
/DELAYLOAD for both and delayimp.lib on MSVC, as the applications' build
scripts do. Link arguments from a build script reach only this package's
own executables, so dependents are unaffected.
dumpbin /imports: before, both DLLs under "the following imports"; after,
under "the following delay load imports". A copy of each test binary with
prntvpt.dll renamed to a DLL that doesn't exist: the old one exits with
0xC0000135 (STATUS_DLL_NOT_FOUND) before main, the new one starts and runs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
Answering the lock question removed the placed-signature mark before the save ran, so a
save that then failed or was cancelled didn't ask again. The answer now only lets the save
that follows go ahead without asking; the mark is removed when a save succeeds, as before.
A reload from disk replaces the document, so it forgets the mark too (a failed reload keeps
it).
Review on #2348 (CodeRabbit).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
main gave the colour-space constructors a nesting depth (ColorSpace::within) and read the
Indexed lookup once by type (patch (71)). Indexed::new keeps this PR's recovery (hival
truncated and clamped, black past a short table, no table skipped) with main's depth bound;
vendor/README.md takes main's rows with this PR's patch (60) entries after (59).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
disconnected_subpaths_on_one_line_leave_the_gap_between_them_unpainted
checked overlapping subpaths drawn in opposite directions under f* only.
It now checks the W* clip of the same path keeps their union too: with
the clip area pushed under the path's own even-odd rule instead of
non-zero, the overlap goes missing and the new assertion fails.
Review on #4433 (CodeRabbit, crates/render/tests/it/zero_area_fill_clip.rs).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
border_width_of, which fits a text box's new text and sizes callouts,
polygons and line endings, read only /BS /W (and turned a negative width
into 0), while the appearance draws with appearance::border_width: /BS /W,
else /Border's third number, 1 for an unusable one. A text box with
/Border [0 0 4] and no /BS was drawn with a 4-pt border but fitted as if
it had a 1-pt one, 6 pt shorter. border_width_of now is that rule.
Review on #4365 (CodeRabbit, crates/annot/src/modify.rs).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
callout_side's doc says a coordinate that isn't a number takes the bottom
side, but every comparison with NaN is false, so the other coordinate
alone decided: [NaN, y above the box] gave Top, [x left of it, NaN] Left.
A NaN coordinate is now checked before any comparison.
Review on #4094 (CodeRabbit, crates/annot/src/create.rs).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
crates/ui-egui/src/panels/right.rs.orig and crates/automation/src/json.rs.orig
were left by a merge tool in 211718668. Neither is compiled (the modules
load right.rs and json.rs), and right.rs.orig still drew the old flat
Layers list, so a reader searching the tree could take it for the code.
Review on #4396 (CodeRabbit, crates/ui-egui/src/panels/right.rs.orig).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
File > Revert discards a signature placed since the last save, but its marker stayed, so the
next save asked to lock a signature that was gone whenever the saved file held an earlier
Fill & Sign mark. A successful revert now clears the marker.
Review on #2348 (CodeRabbit).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
Review follow-up on #2348: flatten_fill_sign_in refreshed the view after Edit::FlattenFillSign but kept view.comments.selected. The placed signature is usually the selected comment, and once it is part of the page its (page, index) names nothing, or another comment after the indices shift. Both Lock now and the save-time Lock and save go through flatten_fill_sign_in, so both clear it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
Catalan, Sorani, Finnish, Hindi, Indonesian, Korean, Lao, Norwegian Bokmål, Romanian, Albanian and Thai joined main after this branch was written; their coverage tests ask for these strings too. AI-assisted, as noted in each catalogue.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
benandez's review suggestion on #2348. Right after Fill & Sign places a
signature or initials, a notice says "Signature added. Others can move it
until it's locked." with Lock now, which flattens the marks into the page
(undoable) without saving; the save that follows then has nothing to ask
about. The placed-signature mark is kept, so undoing the lock brings back the
notice and the save-time question, which stays as the fallback. Dismiss hides
the notice until the next signature. No notice on a digitally signed document
or when saves lock anyway. The "Lock into the page when saving" switch is
now once, in the panel's Sign yourself section, no longer in the Sign menu
over the page. The three new strings are in all 22 catalogues (AI-assisted,
not reviewed by native speakers).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up on #2348: as the native save does, so a later save with the
question turned back on doesn't ask about what was already saved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-ups on #2348 (benandez): a dialog an answer opened this frame
isn't closed with it; documents with digital signatures aren't asked, since
locking changes them after signing; a placement that was undone asks nothing;
the mark is forgotten when the tab closes; the other catalogues carry the
AI-assisted header; parity evidence lists the new tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up on #2348: the document stays tracked as holding a placed
signature and "Don't ask again" is remembered only once locking succeeded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Fill & Sign signature stays a removable comment unless Flatten Fill &
Sign when saving is on, which sat only in Preferences. The first save
after a signature or initials is placed now asks: Lock and save flattens
the document's Fill & Sign marks, Keep editable saves as before, Cancel
saves nothing, and Don't ask again turns the answer into the
preference. The Sign menu carries the same switch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
radio_widgets read each button's on-state name with from_utf8_lossy,
while the group's value it is compared with comes from pdfcraft_forms,
which writes '#' as #23 and bytes that are not UTF-8 as #XX (name_text).
A state /A#23B (the bytes A#B) or a Shift-JIS /#82#CD then matched no
button: saving wrote the state's text as the item instead of the button's
/Opt entry, and opening returned a state no button has. The states are
now spelled with the same rules (a copy of name_text: this crate can't
depend on pdfcraft-forms).
Also pins that taking the XFA out notes no lost data when the data names
the shown button by its /Opt entry while saving would write its /PCOn.
Review on #4784 (CodeRabbit, crates/xfa/src/data/values.rs and
crates/engine/src/xfa_form.rs).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
apply works on a copy, so nothing changes when it refuses, but remove_hidden
isn't transactional: a direct caller's document is part changed by then. The
message said nothing was changed for both. The app's callers work on copies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
table_rows_of_minimum_height_cells_fill_the_page_at_that_height read the
height of the first widget on the first page only, and counted only the c
cells per page. A shorter last row leaves both the counts and that one
height as they were (checked: with the last row at minH 0.3in the old
assertions pass). It now collects the c and d cells of every row on every
page and asserts each is 28.8pt, with 60 and 20 cells.
Review on #5124 (CodeRabbit, crates/xfa/src/tests.rs).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
ISO 32000-2 §8.5.2.1, Table 58: h "terminates the current subpath.
Appending another segment to the current path shall begin a new subpath,
even if the new segment begins at the endpoint reached by the h
operation." kurbo carries a segment after ClosePath on from the subpath
start without a MoveTo, so resolve_degenerate_subpaths saw "h" then an "l"
back to that point as part of the closed subpath, and the round-cap dot
of that degenerate subpath was lost (main drew it, through the nudge this
PR removed). l, c, v and y after h now start with a MoveTo to the point h
reached.
Review on #4410 (CodeRabbit, vendor/hayro-interpret/src/interpret/mod.rs).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
The area Take a Snapshot copies stays outlined with a small menu under it:
Print area… and Save as image… (PNG). Print area… opens Print with
"Selected area (page N, size)" under Pages to Print; the area prints alone,
as a page of that size, with Fit, Actual size, Shrink or a custom scale,
clipped to the area. Multiple, Booklet, Poster and Label stay for pages.
- print: Settings.area (one page's rectangle in display space, y up),
placed with place_crop under a Size layout; other layouts are refused.
- ui: PrintDraft.area and Which::Area; only Size is offered while the area
is chosen. Another tool puts the area and its menu away.
- automation: doc_print takes area [x0, y0, x1, y1] from the top-left.
- Five new labels in all 22 catalogs (ATTRIBUTION.toml checksums
refreshed); parity print.selected-area; ROADMAP progress log.
Requested in #2051.
Carries the review fixes:
- Save as image: save this tab's area, not the last snapshot taken anywhere
- Web downloads: type the file by its extension; keep the snapshot area after Print area
- Clear the copied area of every tab when Snapshot is left
- i18n(ui): carry this PR's new wordings in the catalogues that must cover them
- style: rustfmt after the merge with main
- Use Id::unique for the snapshot area menu (Id::new is deprecated in egui 0.37)
- rustfmt
- print area: refuse an area that isn't finite, and a page out of range first
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every colour operator in the pages' content and the Form XObjects it draws is
rewritten in the target space by the standard device formulas, source colours
read through the space in force (edit/src/colour.rs: device, ICCBased, CalRGB/
CalGray, Lab, Indexed, Separation/DeviceN through a Type 2 tint). Preserve black,
pictures too (optimize::recolour_image: 8-bit gray/RGB re-encoded, JPEG stays
JPEG, CMYK lossless), comments' and fields' appearances optionally.
Edit::ConvertColours (one undo step; refuses when nothing changes, so
Session::count_colours counts first), the Convert colours dialog, command
prepress.convert_colors, tool doc_convert_colours, rows in every language
(RGB and CMYK allowed unchanged in the Ukrainian and Kazakh checks), parity
print.convert-colors shipped.
Carries the review fixes:
- ATTRIBUTION.toml: the language files' checksums after the new rows
- Convert colours: keep RGB and CMYK as-is in the Czech and Turkish menu-label checks
- Convert colours: CMYK black start, shared objects copied, streams kept apart, guarded count
- Convert colours tests: drop an unused helper
- Format with rustfmt
- i18n(ui): carry this PR's new wordings in the catalogues that must cover them
- Parity: evidence paths follow the tests moved into tests/it
- fix(colours): comment permission for appearances; page range per document
- fix(convert-colours): say what it is not, and what it leaves behind
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Trim marks at the trim box's corners, dashed bleed marks at the bleed box,
registration targets, a colour bar and a page-information line, drawn outside
the trim box as a removable page mark (MarkKind::PrinterMarks); the page is
widened to make room when asked and the trim box stays, so the printed page
cuts the same. Edit::AddPrinterMarks (scope Full, undoable) and Remove printer
marks through Edit::RemoveMarks; Dialog::PrinterMarks reachable from the
catalog, the palette and --view printer-marks; tools doc_printer_marks and
doc_remove_marks kind printer_marks; rows in every language; parity
print.printer-marks shipped.
Carries the review fixes:
- ATTRIBUTION.toml: the language files' checksums after the new rows
- Printer marks: drop the unreachable AddPrinterMarks pattern in scope_of
- Tests: printer marks read the document's marks through upstream's marks() (#1434)
- Printer marks: make room inside the crop box and keep the trim box on rerun
- Format with rustfmt
- Printer marks: keep accented labels and make room for the bleed marks
- Printer marks test: the page is letter size, so the bleed marks (33 pt beyond the trim box) fit
- i18n(ui): carry this PR's new wordings in the catalogues that must cover them
- Parity: evidence paths follow the tests moved into tests/it
- Fix the build after merging upstream/main
- fix(printer-marks): refuse numbers out of range, print on every plate
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redaction starts from the images a run replaces or removes and the forms
and soft masks under them, so a dictionary used by something that left
another way stays, with apply returning Ok: a stamp or widget appearance, a
Type 3 glyph, an /Alternates entry, a /Mask, or an image with /Filter by
reference or /DecodeParms through a reference to a reference. A
byte-identical copy stays too, which is what pdfseparate then pdfunite
leaves, and Remove Hidden Information never takes a dictionary out.
Compare what a full save would keep before and after the run instead, the
same walk write_full makes, now cos::reachable. What left names the
dictionaries, in any entry of its parameters; what stays that names one, or
a copy, is stored again without it; and the walk is taken once more, so a
dictionary still kept refuses the run, whatever keeps it. An image with
/Width, /Height or /Filter by reference is read, and is one bit in the copy,
as it was when drawn. /Alternates stays with what is stored again, and a
stream that isn't JBIG2 refuses rather than being stored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
Annotation appearances draw through a page's resources, never through a
form's own, so the form path passes no page. The form's own patterns
and soft masks are still counted. Asked in review.
Tests for the mutation pass on c709dd99e:
- a_fill_colour_in_a_space_with_no_table_keeps_the_fallback now covers
CS/SC too;
- a_shading_in_a_space_with_no_table_is_not_drawn checks that only
images and the colour operators see a tableless space.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
Seven readers were compared on synthetic files. Most draw the entries a
short table holds and black past them, and none draws an image whose
lookup is missing.
- Indexed::new keeps how many entries the table holds in full. Indices
at or past that are set to black after conversion, so DeviceCMYK,
ICCBased, Separation, DeviceN and Lab come out black too (zero bytes
gave white, or blue in Lab). Fill and stroke colours follow the same
rule. An incomplete last entry counts as missing.
- A lookup that is missing, null, a number, or a stream that does not
decode (or decodes to nothing although it holds data) is no table.
ColorSpace::new_allowing_tableless builds such a space marked
tableless (for the resource cache and ImageXObject::new only), and
the image is skipped with MalformedIndexedImage. A cs/CS colour in it
keeps the upstream DeviceGray fallback with ColorFallback. Every other
caller still gets None, as upstream.
- hival clamping and truncation are unchanged, and so is case C.
- The warning now reads "an image with a malformed Indexed colour table
may be drawn wrongly or not at all".
- vendor/README.md: the patch (60) row is one line again. 3275f853c
split it.
Tests: indexed_lookup.rs now has 25 tests, including one per base space
(DeviceGray, DeviceCMYK, Lab, Separation, DeviceN, and ICCBased N=4
drawn through its alternate). Against 6179cf795, 13 fail, including
every base space except DeviceGray, where zero is black. Against
b6f93a3ae, 19 fail.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
An image that shared a redacted image's /JBIG2Globals is now stored
again as the smallest of Flate, Group 4 or JBIG2 coded alone (smallest),
like a cleared copy, rather than always Flate, so the other pages of a
scan don't balloon either. The shared-globals test's second page is a
ragged scan and checks it is no longer Flate and is smaller.
A JBIG2 image's /JBIG2Globals hold the symbol dictionary of every image that
shares them (jbig2enc -s and most scanners give one to all of a scan's pages),
so the bitmaps of marks drawn only under a redaction stayed in the file while
another page's image used them. Every image using the globals of a removed or
replaced image (or of one in a removed or replaced form) is now decoded and
stored again in place as Flate without them; a full save then drops them. One
that can't be decoded for certain refuses the redaction
(RedactError::SharedJbig2Globals). Report::images_restored counts them.