Commit Graph

8340 Commits

Author SHA1 Message Date
FredApps 77cf46053f Merge remote-tracking branch 'origin/main' into port/ui-chrome 2026-12-04 18:15:41 +01:00
FredApps 74fa6be0ac Merge pull request #7446 from vangel76/fix/autotag-text-state-7416
Auto-tag works on pages edited with PDFCraft's text editor
2026-12-04 18:09:30 +01:00
Perchenko Anton d89b67d045 fix(reader): bound malformed-object diagnostics per load (#3044)
* fix(reader): bound malformed-object load diagnostics (#2670)

* fix(reader): share diagnostic budget across eager load paths (#2670)

* M1: share diagnostic budgets through compressed Length lookups

* M1: share warning budgets across encrypted object streams

* M1: count encrypted stream failures and bound lookup warnings

* #2670: document bounded reader diagnostics and regressions

* M7: the Preferences language test opens the app menu on macOS

On macOS the in-window menu bar takes the Mac layout (Target::current() in
menus.rs), which moves Preferences out of Edit into the app menu as
Settings…. The test opened Edit and found no Preferences row, so it failed
on every macOS run. CI runs the tests only on Ubuntu and Windows, so it
never saw this.

The test now opens the menu that holds Preferences on the platform it runs
on: the PdfCraft app menu and its Settings… row on macOS, Edit and
Preferences elsewhere. The Windows and Linux path is unchanged, and so is
the app.

* M7: a doc comment on the Preferences language test

Says what the test checks and where each platform keeps Preferences, for the docstring coverage check.

* M7: a doc comment on the Ukrainian Preferences test

The doc comment added above the next test touches this one too, so CodeRabbit's docstring check counts it.

* M7: doc comments on the neighboring language and state tests

Each doc comment's context reaches the test above it, so CodeRabbit's docstring check counts those too.

* M14: the comments panel lays out only the cards in view (#5488)

With more than 100 comments, a card or page header out of view that
was measured at the current width only takes up its height instead of
being laid out every frame. The selected card is always drawn, so it
still scrolls itself into view. Shorter lists are laid out whole and
keep every card in the accessibility tree.

The 500-comment panel in tests/perf.rs drops from about 23 ms to 5 ms
per frame locally, well inside the 40 ms budget it overran on CI.

* ci: retrigger checks after the GitHub Actions outage

---------

Co-authored-by: Eric Kaden <608341+EricKaden@users.noreply.github.com>
Co-authored-by: Perchenko Anton <perchenkoanton@iMac-Perchenko.local>
Co-authored-by: Lcoding15 <125505497+Lcoding15@users.noreply.github.com>
Co-authored-by: Anton Pepperok <perchneko.anton@gmail.com>
Co-authored-by: PerchAnton <PerchAnton@users.noreply.github.com>
2026-12-04 17:58:22 +01:00
FredApps 9e54608678 Merge origin/main into port/ui-chrome
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 17:55:53 +01:00
Ken Mantle 51d05efb63 M6: copy and paste selected form fields from the Edit menu (#1571) (#8604)
* M6: copy and paste selected form fields (fixes #1571)

[KenM76: rebased onto main. copy_field moves to crates/forms/src/author/copy.rs
(author.rs is split), Edit::CopyField to crates/engine/src/edit.rs, labels.rs and
run.rs, the tool to dispatch.rs, the test to tests/it/automation.rs. The i18n/*.tsv
rows are dropped (catalogs now live in craft-i18n), and the Prepare ⌘C/⌘V key handling
is dropped here because crates/ui-egui/src/prepare.rs and its raw key events are gone;
it is rebuilt on the edit.copy and edit.paste commands in a later commit.]

* M6: a copied field keeps an inherited MaxLen and its buttons' /Opt values, and a signature copies blank

[KenM76: rebased onto main; applied to crates/forms/src/author/copy.rs.]

* M6: a copied button keeps an inherited /Opt, and on states named after /Opt positions are renumbered

[KenM76: rebased onto main; applied to crates/forms/src/author/copy.rs.]

* M6: a pasted field has a look of its own

copy_field shared the source's appearance streams, and its /MK and /BS
when they were indirect. Restyling a copy, or filling in a copy whose
look is redrawn in place (a password field), then changed the source.
Each copied widget now gets its own copies of the streams its /AP
reaches, and a direct /MK and /BS. The copy also drops /NM and the XFA
binding keys, and takes what the field inherits from tree::inherited
rather than a second walk of its own.

Tests: a restyled or refilled copy leaves the source alone; a
transparent, borderless multiline field (a calendar day) pastes onto
another page with its flags, look and appearance.

Co-authored-by: Marco Arnulfo <marcoarnulfo1@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M6: copy and paste the selected fields from the Edit menu while preparing a form

Copy (Edit menu, Ctrl+C) in Prepare a form takes the selected fields and
puts their names on the clipboard as text; Paste (Ctrl+V) adds a copy of
each on the current page as one undo step, "Paste fields", and selects the
copies. On their own page the copies land 18 pt right and down, one step
more per paste; on another page, in place. Paste brings the fields back
only while the clipboard still holds their names, so pasting other text
does not paste stale fields.

The paste rides the edit.copy / edit.paste commands, so it works from the
menu as well as the keys. It keeps Marco's paste guard (no paste under a
dialog, none into a document that forbids changes).

Parity: form.copy-paste-fields lists the UI tests, and its notes say what
is still missing: Cut, and pasting into another PDF (#2543).

Co-authored-by: Marco Arnulfo <marcoarnulfo1@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M6: a pasted field moves right and down as the page is shown

The Prepare paste step now goes through the page's view transform, as
form_copy_field's dx/dy already did, so on a turned page the copies still
land right and down on screen. Prepare keeps Paste for its fields: a
paste whose fields have since been deleted, or a picture on the
clipboard, pastes nothing there, as before.

copy_field is split into helpers (picking the widgets, the field half,
the /Opt renumbering, the widget half, attaching to the tree) with no
change of behaviour, and form_copy_field looks its page up with get.

Co-authored-by: Marco Arnulfo <marcoarnulfo1@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(forms): a field copy's /DV never names a button it lacks

A check box or radio copy made without the widget its /DV names now gets
/DV /Off. Before, reset sent that state to the copy, write_value refused it
(Invalid), and reset_with_formatting stopped there, so Clear form failed for
every field in the document. renumber_states also renames /AP /R with /N
and /D, so a renumbered button keeps its rollover look.

Tests: a_radio_copy_without_its_default_button_still_resets,
a_radio_copy_with_its_default_button_keeps_it,
copying_a_numbered_radio_button_renames_its_rollover_look. Each fix reverted
on its own fails its test; with the /DV fix reverted, reset itself returns
Invalid("\"size1\" has no option \"S\" (options: L)").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(forms,ui-egui): address #8604 review of field copy and paste

- A one-widget copy merges the field's and the widget's /AA, so the
  field's calculate/format/keystroke/validate triggers survive the merge.
- Copying fields in Prepare cancels a running whole-document text copy,
  so its older text cannot land over the field names.
- Copy remembers each widget's object, not its index; paste finds its
  current position and skips one deleted since.
- The paste step is turned back by the view rotation, so a paste in a
  turned view still moves right and down on screen.

Each fix's test fails with that fix reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(forms): compare a copied button's default as name bytes

`off_unless_copied` compared the raw `/DV` name with the escaped text of
each copied widget's on state, so a state such as `/A#23B` (text "A#23B",
bytes "A#B") never matched and a copy that kept the default button lost
its `/DV`. Compare against `name_bytes(on_state)`.

`a_copy_keeps_a_default_whose_name_has_a_hash` fails with the old
comparison (`/DV` became `/Off`).

Also write the turned-view paste test's clipboard text as "consent\nshade",
like the other paste tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep radio copies and per-page paste offsets consistent

---------

Co-authored-by: Marco Arnulfo <marcoarnulfo1@gmail.com>
Co-authored-by: KenM76 <172507185+KenM76@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-12-04 17:52:12 +01:00
FredApps c43203a482 Port release fixes to main: platform-tests (#9305)
* desktop: position menus and dialogs against the actual Windows display

(cherry picked from commit 76f52b00dd)

* test: click File and print to PDF on an offset portrait display

(cherry picked from commit 9e79bae8d0)

* test: hit adjacent toolbar controls after moving to portrait

(cherry picked from commit b486ba01e4)

* Allow a third Metal drawable in native macOS fullscreen

(cherry picked from commit 7db123a913f49177ce3d53e54bb9f2b5044861ee)
(cherry picked from commit 7d4c3cfa11)

* Skip the Metal surface lookup between fullscreen transitions

(cherry picked from commit d7e6ac8a3f96afca091a9d64ce4e43d2cc489647)
(cherry picked from commit ede39fcaba)

* Deliver XFA field typing through the native input path

(cherry picked from commit fae3ec8053)

* Wait for the PDF to open before running redaction commands

(cherry picked from commit 9a76183b1f)

* Wait for the unlocked document and the active signing page in UI tests

(cherry picked from commit 6721d2dd3f)

* Isolate successful nightly socket preparation from stable-profile tests

(cherry picked from commit 6ff99bde51)

* Type fractional UI test inputs using the active formatting region

(cherry picked from commit f5f02ea845)

---------

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-12-04 17:44:48 +01:00
Dylan M. Taylor 290e5b1e0b Merge pull request #9317 from storytold/docs/freebsd-release-minimum
Docs: state FreeBSD 15.1 requirement for prebuilt packages
2026-12-04 11:23:40 -05:00
FredApps e9d6f2db6d Merge branch 'main' into fix/autotag-text-state-7416 2026-12-04 17:21:02 +01:00
FredApps bfc45e4384 Port release fixes to main: dock-layout (#9311)
* chore(deps): pin craft-libs to the rev the 0.23.2 release builds against (9888a5855)

Release has built against craft-libs 9888a585 since 0.23.2; main stayed on 6afe03f5b, so
main could not take the release-only UI fixes that use the newer craft-libs APIs (centred
TextField, tab wheel browsing, bounded document preview width, wheel messages for fitted
page spreads). This moves main to the same rev; Cargo.lock only changes the craft-libs source.

The 12 craft-libs commits behind this rev are being put on craft-libs main in
https://github.com/storytold/craft-libs/pull/5306.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(ui): align navigation and menu controls and fit the All tools dock

(cherry picked from commit 9877f32c7e)

* test(ui): cover the docked toolbar gear and chrome alignment

(cherry picked from commit db0a90bbae)

* fix(ui): preserve fitted tool widths across launch and list expansion

(cherry picked from commit ab290c34ae)

* Keep the menu and mode controls aligned and maintain page width when editing

(cherry picked from commit 57ff1524a4)

* Keep room for document tools while sizing the Home list to its labels

(cherry picked from commit 1dfd996c5c)

* Check that the All tools heading aligns with its list on Home

(cherry picked from commit 42ab49f7f1)

* Fit horizontally docked toolbar to its wrapped controls

(cherry picked from commit c97b8120b8)

* Exercise top and bottom toolbar docking at two window widths

(cherry picked from commit 5cc98a8448)

* Account for the themed minimum pane height in toolbar layout checks

(cherry picked from commit ce7f8548b7)

* Measure unused space on both sides of the bottom toolbar

(cherry picked from commit 91eb17547e)

* Exercise protected document controls and localized prompts after layout settles

(cherry picked from commit 04bf3e7e25)

* Check notice text and dismiss geometry in both announcement layouts

(cherry picked from commit 854a60ad13)

Adapted: card.children().next().is_some() replaces the unstable
ExactSizeIterator::is_empty, which does not compile on stable.

---------

Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Codex <codex@openai.com>
2026-12-04 16:42:05 +01:00
FredApps 6d1677e887 Port release fixes to main: libs-api (#9312)
* chore(deps): pin craft-libs to the rev the 0.23.2 release builds against (9888a5855)

Release has built against craft-libs 9888a585 since 0.23.2; main stayed on 6afe03f5b, so
main could not take the release-only UI fixes that use the newer craft-libs APIs (centred
TextField, tab wheel browsing, bounded document preview width, wheel messages for fitted
page spreads). This moves main to the same rev; Cargo.lock only changes the craft-libs source.

The 12 craft-libs commits behind this rev are being put on craft-libs main in
https://github.com/storytold/craft-libs/pull/5306.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* Let the mouse wheel browse overflowing PDF tabs in either pane

(cherry picked from commit ba286d585a4691b98ec1eb98a4c99b9df5de8149)
(cherry picked from commit 3827fe059a)

* Exercise wheel browsing on real overflowing PdfCraft document tabs

(cherry picked from commit 021c744c0dff19e070a926190368d0612db11af6)
(cherry picked from commit 18284fee73)

* Enlarge header and footer page preview

(cherry picked from commit f90e3d1c83b23dea32cdb75d2e9638e594409b92)
(cherry picked from commit a0f1f51c06)

* Place page content on physical pixels for sharp text at normal zoom

(cherry picked from commit a2d040ce08)

Ported without the craft-libs rev bumps the release commit also carried: the pin is already 9888a5855 (stacked on #9308).

* Restore Windows wheel flicks across fitted document spreads

(cherry picked from commit c40a2683f8)

Ported without the craft-libs rev bumps the release commit also carried: the pin is already 9888a5855 (stacked on #9308).

* Keep the Windows caption cursor as an arrow

(cherry picked from commit 53a014bf1d)

* Center page navigation and fit page size hint (#8989)

(cherry picked from commit 04c0aa7c73)

---------

Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Codex <codex@openai.com>
2026-12-04 16:41:30 +01:00
FredApps 16febfbbab Integrate text-editor auto-tagging and reject malformed end marks 2026-12-04 16:33:56 +01:00
FredApps 1f59d3638a Merge origin/main into port/ui-chrome
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 16:15:35 +01:00
FredApps 67e3288769 Port release fixes to main: reader-web (#9306)
* Return keyboard to reader on blank page view click

(cherry picked from commit b12d744c3a)

* Check field draft survives background focus handoff

(cherry picked from commit 82abf52b1a)

* Preserve the OCR text drag anchor over a scanned page

(cherry picked from commit a28bdd3db1fd5723736b038a16bf7ac13795baf6)
(cherry picked from commit bbb0c61a1c)

* Restore saves to the embedding web page

(cherry picked from commit 24702af7e6)

* Keep host copy saves from marking the open document saved

(cherry picked from commit 2624b9b9d2)

* Use pinned APIs in Space Audit and host save checks

Port of the host save test half only; the Space Audit half is covered by another open PR.

(cherry picked from commit bbde94e743)

* Read the browser clock when painting comment and file timestamps

(cherry picked from commit cbda2fd3ff)
(cherry picked from commit c5984569d1)

* Web: give the document session a browser wall clock (#8957)

(cherry picked from commit b90c6de6e0)

* Test organize thumbnails after moving a page

(cherry picked from commit 0230ac0fc7)

* Test organize deletion of selected and tile pages

(cherry picked from commit 9a12b9b1fb)

* feat(view): rulers along the page area (view.rulers)

View ▸ Show/Hide ▸ Rulers (Ctrl+R / ⌘R) reserves a strip along the top
and left of the document area and draws rulers in the measurement units
preference, from the top-left of the page under the pointer (or the
current page) in its displayed orientation. Major ticks use the 1/2/5
interval that keeps labels apart at the current zoom, the tick count is
capped, and a marker follows the pointer. The choice persists, and the
control channel takes `rulers=on|off` and reports `rulers`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit c8a854134f)
(cherry picked from commit dcb941b3f9)

---------

Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Terra854 <bentinner@yahoo.com.sg>
Co-authored-by: yusufmntm <yusuf.mantam56@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 16:13:04 +01:00
FredApps 2845f072fb fix(windows): keep the integrated title bar's window borderless (#8845, #8793, #9040) (#9297)
winit 0.30 gives an undecorated window WS_CAPTION | WS_BORDER. On some Windows
systems the compositor still reserves that frame, so the content is drawn below
a black bar while the pointer keeps the client coordinates, and a click lands
above the control. PhotoCraft, VectorCraft, FigCraft and DesignCraft fixed the
same symptom by stripping WS_CAPTION/WS_BORDER and having Windows recalculate
the frame; winit puts them back on every flag change, so the guard runs once per
frame and only reads the style once they are gone. WS_THICKFRAME stays, so edge
resizing and snap keep working. Only the integrated (undecorated) title bar is
guarded; the system title bar is untouched.

Ports storytold/photocraft#2401. Not yet verified on affected hardware.

Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 16:12:56 +01:00
Siguret Audric 55bb74cd1a Scale Wayland touchpad scrolling with the scroll speed preference (#8870)
* Scale Wayland touchpad scrolling with the scroll speed preference

Co-authored-by: Leonid <leonidofsparta@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Expect the touchpad gain in the held point-scroll test

The Linux touchpad gain (#1904) scales a point wheel delta once, in the
runtime, so a 30-point delta moves the page 90 points at Normal speed there.
selection_point_scroll_is_not_applied_twice compared the held-drag motion
with the raw 30; compare it with 30 times the gain instead, which still
fails if the held drag scales the delta a second time.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Audr1c <Audr1c@users.noreply.github.com>
Co-authored-by: Leonid <leonidofsparta@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-12-04 16:12:48 +01:00
Sandip Patel 00c357ac71 fix(xfa): remap bookmarks and named destinations to the pages a relayout writes (#9027) (#9080)
* fix(xfa): remap bookmarks and named destinations to the pages a relayout writes (#9027)

After an XFA form is laid out again, the document's pages are replaced, so
bookmarks and named destinations that named the old pages pointed at orphaned
objects. Remap them to the replacements by page position (a destination naming
a page the layout dropped goes to the last page written); destinations naming
untouched pages or non-page targets are left alone.

- xfa/pdf.rs: page_list (the pages a layout replaces, in reading order);
  write_form captures the old pages before page creation and remaps
  destinations after the new pages are written; remap_destinations handles
  /Dests, /Outlines (bookmark items, /Next chains and /Kids), and /Names
  (Dests and Pages categories); remap_dest / remap_action / remap_name_tree
  update indirect objects in place.
- xfa/fixtures.rs: dests_shell, a shell with /Dests, /Names and two /Outlines
  items (a /Dest and a GoTo action) naming the placeholder page.
- engine/tests.rs: xfa_relayout_keeps_bookmarks_and_named_destinations_on_the_pages_it_writes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(xfa): bound the destination remap's walks and remap what they omit (#9027 review)

The remap that points bookmarks and named destinations at the pages a
relayout writes could walk a malformed document forever, and silently left
a destination stale when a search hit its bound:

- xfa/pdf.rs: page_list errors on a page tree that lists a node twice,
  and on one past MAX_PAGES_SEARCHED, before any page is replaced; the
  outline walk follows each item's /First child (the spec's way) and
  errors at the bound instead of truncating; /Names categories are
  handled per category, the Pages one's values being page references
  remapped through the map directly (remap_page_ref); remap_dest,
  remap_action and remap_name_tree take a visited set, a /D chain or
  /Kids chain that repeats being an error before the recursion
  continues.
- xfa/fixtures.rs: the name-tree key is the string (end), as the spec
  requires.
- xfa/pdf.rs tests: each fix is guarded by a test that fails without it;
  automation hostile_args: the cyclic page tree, destination, and name
  tree are in the hostile-input sweep.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(xfa): count pages and bookmarks at acceptance, pin the position remap (#9027 review)

- page_list: the 10,000-page bound is checked when a leaf is accepted, so a tree of
  exactly the bound followed by an empty /Pages node is still walked.
- the bookmark walk checks `seen` before the item bound, so a repeat of an item
  already counted is not a new item.
- tests for 3 old pages onto 2 and 2 onto 3, each with a bookmark, a /Dests entry and
  a /Names entry, plus one for each bound case above.
- remap_destinations' doc says what an error leaves behind: the walks after the bookmark
  walk can fail once earlier ones were written.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(xfa): a page tree the remap cannot list is a warning, not a failed layout (#9027)

Main's relayout tests (cyclic page trees, a shared-reference page subtree past the walk bound)
expect the layout to be written. The destination remap now reports what it could not do as a
warning and keeps the layout, instead of failing the whole relayout.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 16:12:36 +01:00
Sandip Patel 86db88e630 Fix #9016: draw added Greek and Cyrillic text with the bundled Inter face (#9078)
* Fix #9016: draw added Greek and Cyrillic text with the bundled Inter face

The Add-text path only accepted WinAnsi-encodable text (plus Arabic/Hebrew/
Thai via their shaped faces), so Greek and Cyrillic were refused even though
the bundled Inter face draws them. first_undrawable now uses undrawable_char
(a char is undrawable only if WinAnsi lacks it AND the Inter face can't
draw it), and draw now sets the embedded Inter face for such text, mirroring
doc_create and text_edit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix mixed-script added text and the Greek drawing test

Address the CodeRabbit review findings on the #9016 fix:

- draw_laid_shaped: a run the shaped layout leaves as a Piece::Latin
  but that WinAnsi cannot encode (Greek or Cyrillic) is now drawn with
  the bundled Inter face, embedded, instead of being silently lost to
  WinAnsi '?'. The face is added only when a run needs it, so pure
  Hebrew (or Arabic/Thai) text is unchanged.
- tests: the Greek drawing test now selects the added item's content
  stream by its /PCMark /Added tag (the page's own "Hi" stream also has
  a Tj, so the first Tj stream was the wrong one) and verifies the
  embedded face (Type0, FontFile, ToUnicode to Greek). A new test covers
  mixed Hebrew + Greek text, asserting the Greek run uses the embedded
  face and the Hebrew run the shaped face.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(edit): a second Greek item no longer takes the first item's font name (#9016)

draw_inter_face and the mixed-script path embedded the bundled face into a
dict that held none of the page's fonts, so the resource was always PCFull0
and `write` set it over any other PCFull0 the page already had. Seed the dict
with the page's PCFull* entries first, so embedding picks a free name or reuses
an identical face. The mixed-script Latin branch now draws a soft hyphen as a
hyphen, as draw_inter_face does.

Review: https://github.com/storytold/pdfcraft/pull/9078#pullrequestreview-6187655188

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(ui): Greek added text is drawable with the default font (#9016)

Two UI tests still asserted that a standard font refuses Greek phi, which this
change makes drawable through the bundled Inter face. Assert the new behaviour;
an explicit document font keeps working and keeps its resource. Matches the
updates the 0.23.2 release branch made to the same tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 16:12:30 +01:00
FredApps ae3c7b7592 chore(deps): pin craft-libs to the rev the 0.23.2 release builds against (9888a5855) (#9308)
Release has built against craft-libs 9888a585 since 0.23.2; main stayed on 6afe03f5b, so
main could not take the release-only UI fixes that use the newer craft-libs APIs (centred
TextField, tab wheel browsing, bounded document preview width, wheel messages for fitted
page spreads). This moves main to the same rev; Cargo.lock only changes the craft-libs source.

The 12 craft-libs commits behind this rev are being put on craft-libs main in
https://github.com/storytold/craft-libs/pull/5306.

Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 16:12:23 +01:00
jweaver3 f20205bf31 fix(js): XFA scripts reach fields and subforms named with accented letters (#8876) (#8877) 2026-12-04 15:39:09 +01:00
Dylan M. Taylor eb409650da Docs: state FreeBSD 15.1 requirement for prebuilt packages 2026-12-04 09:09:39 -05:00
Enrico ece4d2201d feat(ui): a Full screen button in the page controls (#2995) (#3209)
* feat(ui): a Full screen button in the page controls (#2995)

The page controls in the right rail had no way to enter Full screen
mode; only View ▸ Full screen mode and Ctrl/Cmd+L did. A button directly
below Zoom out now runs the existing view.full_screen command, after the
view borrow ends as the Page display button does. It reuses the
translated "Full screen mode" label and the shipped monitor icon, since
the corner-bracket icons look like the fit toggle in the same column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Expose full screen button toggle state

* Check the rail toggle using its pinned accessibility contract

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-12-04 15:08:30 +01:00
Aleksander Helgaker b026f59f32 fix(annot): a comment without text is saved without /Contents (#7434) (#7662)
* fix(annot): a comment without text is saved without /Contents (#7434)

Every new comment got a /Contents entry, an empty string when nothing
was typed, and clearing a comment's text wrote an empty one too. macOS
Preview marks a markup comment that has the key, even empty, as holding
a note, so highlights made in PdfCraft showed a note bubble there.
Acrobat writes no /Contents for a highlight without a note.

New comments now get /Contents only when they have text, and clearing a
comment's text removes it. Summaries already read an empty /Contents as
no text, so nothing else changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(annot): test the empty-comment case with an open pop-up (#7434)

The test described a double-click but made a closed pop-up. It now
opens it, checks it is open, and checks the comment is still saved
without /Contents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Align empty comment property with omitted contents

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-12-04 15:07:54 +01:00
Eric Kaden 30dfab44ff Forms: a push button takes the focus on a click and as a Tab stop (#4589)
* M6: a field's mouse and focus actions run as the pointer and the focus move

Every trigger of ISO 32000-2 Table 197 runs its action: Mouse Enter and Exit as the pointer arrives over a widget and leaves it, Mouse Down on a press (before the field the focus leaves commits), On Blur and On Focus with #4359's focus scripts, and Mouse Up on the release once they have run, which a push button's click now waits for too. Order and event.name values measured black-box on a synthetic form. forms::widget_action reads any trigger's action; Session::run_field_script runs a script as that field event; form_trigger runs one headlessly.

* M6: only a click's field actions may print, open links or Save As

A field's Mouse Enter, Mouse Exit, Focus and Blur actions run without anyone asking: their scripts' requests to print, open a link or Save As, or show a side panel are dropped and noted on the console, and an action that runs a menu item, opens a link, submits or picks a picture doesn't run. Mouse Down and Up, a click, keep them.

* M6: a trigger's reset or show/hide keeps the typing a press committed

A press commits the field it leaves into the view's queued edit, and a Mouse Down reset or show/hide action replaced that queued edit, losing the typing. A trigger's reset or show/hide now applies at once, and the queued commit applies after it, as another viewer orders a press's Mouse Down before the field left commits. action_edit builds the edit for both a push button's click and a trigger.

* M6: a push button takes the focus on a click and as a Tab stop

Another viewer gives a push button the focus when it is clicked, and stops at it on Tab (probe 10: Tab from a text field reached the button; a click on it ran Mouse Down, the field left's Blur, its Focus, then Mouse Up). PdfCraft's push buttons took none, so their On Focus and On Blur never ran and Tab skipped them. A click now focuses the button as it does a check box, Tab and Shift+Tab include push buttons, and Space or Enter presses the focused button. The check box's keyboard holder is shared as hold_keys.

* M6: a test that XFA focus scripts may not print, open links or Save As

The XFA runner already drops these for any activity but a click; the test holds enter and exit to the same rule as an AcroForm field's Focus and Blur.

* M6: hovering a form that may not be filled in runs none of its actions

Mouse Enter and Exit ran where the document's security forbids filling in the form, as Mouse Down and the other actions don't: a script changing a value was refused on every pass, with a message each time. The hover is noted only where the form may be filled in.

* M6: a reset by a field's action shows in the editor of the field being edited, as a script's change does

* M6: a push button scrolled out of view lets go of the focus, as a check box does
2026-12-04 14:42:36 +01:00
Marco Arnulfo 640ce697e8 M11: show art, trim and bleed boxes on the page (view.show-page-boxes) (#2779)
* M11: show art, trim and bleed boxes on the page (view.show-page-boxes)

Preferences > Documents and view outlines the bleed, trim and art boxes a
page sets, as Acrobat's Page Display preference does: only boxes the page
defines, clipped to the media box, placed through the crop box and /Rotate
and cut at the page edge. Art red, trim green, bleed blue, the colours of
Acrobat's Set Page Boxes > Show All Boxes. Remembered across restarts,
page-boxes on|off on the command line and control channel.

* Fix page box preference test selection

* Keep page box options in sync and mark box edges by type

---------

Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-12-04 14:34:13 +01:00
Ken Mantle ad27770a23 fix(ui): the watermark and background previews show a file's picture (#2817) (#8679)
* fix(ui): the watermark and background previews show a file's picture (#2817)

The Add Watermark and Add Background dialogs previewed a mark taken
from a file (an image, or a page of a PDF) as a grey frame with the
file name, so its size, offset, turn and opacity could not be judged
before OK. The preview now draws the picture itself, where OK puts it.

The engine's new mark_picture brings the file in the way OK does
(mark_source: an image turned upright by its EXIF orientation, a PDF
page as an upright form), draws it alone on a page of its shape and
renders it small, once on white paper and once over black, so its own
transparency survives. The dialog renders it on a worker thread, keeps
it in the draft as a texture keyed by the file and the page, and shows
the frame with the file name until it arrives or when the file can't
be drawn. It is laid out as picture() in pdfcraft-edit lays it out:
fitted to the page at the scale, centred plus the offset, turned, at
the opacity. A watermark on top is drawn over the page. A background,
or a watermark behind the page, shows where the page is white: the
page's picture is multiplied by the picture, averaged over a fine
grid, as a background colour already tints it.

Item 14 of #2817.

* deps: ctutils 0.4.5 for RUSTSEC-2026-0385

* parity: evidence paths where main moved the tests (tests/it/)

* style: cargo fmt after the merge

* engine: the picture sheet's black background has no backdrop to replace (main's new Background field)

* engine: the mark-picture tests encode their PNGs with craft-image-codecs, as the engine does since main dropped the png crate

* fix(ui): a file background previews nowhere the page's own backdrop hides it

The colour tint already left out pages that keep their backdrop: a scan, or a
white backdrop with Replace unticked. The picture did not, so the preview
showed a background OK would not. backdrop_hides is now the one test both use,
and such a page previews with no picture at all.

The new test fails with the check removed ("page 1 keeps its backdrop").

Raised by CodeRabbit on #3024.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): a mark from a file is clipped at the page edge in the preview

OK crops a watermark or background at the page edge, but the preview drew it
under the pane's clip, so a scaled, offset or turned mark ran past the page
into the pane. It is now drawn with the clip narrowed to the page.

The test uses the landscape page, where the pane is taller than the page, and
fails with the clip removed.

Raised by CodeRabbit on #3024.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): a picture behind the page shows only where the page paints nothing

The watermark and background previews drew a file's picture behind the
page by tinting the page picture with it, so the page's own colours were
multiplied by the picture: an opaque blue box over a red picture previewed
black, though after OK it stays blue.

The preview now paints white paper, the picture, then the page rendered
on a transparent sheet (Document::pages_on_glass), which is clear only
where the page paints nothing. The sheet drops the marks an Update
replaces and, for a background with Replace ticked, the white backdrops
OK replaces. Until the sheet is rendered nothing is drawn behind the
page. The per-cell averaging grid the tint needed goes.

a_picture_behind_the_page_is_covered_where_the_page_paints reads what
the preview's meshes show at the box: with the old preview it fails
(#00_00_00_FF, black). the_pages_on_glass_are_clear_only_where_they_paint_nothing
fails with the sheet rendered opaque (alpha 255 on bare paper).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): render a page sheet only at a positive, finite scale

A zero, negative or non-finite preview scale no longer reaches
render_page: glass_scale refuses it and the picture behind the page
is simply not drawn. The engine gains a test that pages_on_glass with
replace_backdrops takes a page's own white backdrop away.

Revert proof: with glass_scale returning Some for every scale,
a_sheet_is_rendered_only_at_a_positive_finite_scale fails (Some(0)
for 0.0); with replace_backdrops ignored,
the_pages_on_glass_lose_the_white_backdrop_a_background_replaces
fails (alpha 255 on bare paper).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ui): read mesh triangles with as_chunks

Clippy on the CI toolchain rejects chunks_exact with a constant size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): show the file name while a picture's page sheet is missing

A picture placed behind the page draws on the page's transparent sheet.
While that sheet renders, or when it can't be rendered, the preview fell
back to Layer::Hidden and drew nothing, the same as a mark the page's own
backdrop hides. The user saw no sign of the picture they had chosen.

file_layer now returns None when the sheet is missing, so the overlay
takes its name-frame arm. A picture the backdrop hides is still not drawn,
and asks for no sheet. The sheet is rendered only when there is a picture.

Test: a_picture_behind_a_page_whose_sheet_is_missing_shows_the_file_name_frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Format marks_ui.rs after the merge with main

rustfmt joins the overlay() signature onto one line (the merge with main left it split).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9

---------

Co-authored-by: Guillem Hermida <guillemhr2@gmail.com>
Co-authored-by: KenM76 <172507185+KenM76@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 14:23:37 +01:00
Aleksander Helgaker e4f370cda3 fix(edit): preserve existing fonts when adding text (#7762) (#7766)
* fix(edit): preserve occupied font names when adding text

* fix(edit): preserve reused indirect font resources

* fix(edit): reuse a matching font whatever the order of its entries

Dict compares its entries in order, so a Helvetica on the page with the
entries we write in another order was not reused, and added text took a
suffixed resource it didn't need. The fonts are compared by key now.

A test keeps a Helvetica that differs only in its /Encoding, has none, or has
an entry more: the Courier fixture also differs in /BaseFont and would pass
without the encoding check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Adapt mixed-script font test to DrawnItem

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-12-04 14:22:40 +01:00
Ken Mantle a8176e3194 M5: change the text range a highlight, underline, strikethrough or squiggly marks (#4824) (#8555)
* M5: change the text range a highlight, underline, strikethrough or squiggly marks (#4824)

pdfcraft_annot::set_quads and Edit::SetMarkupRange give an existing text markup
new quadrilaterals (colour, note and replies kept, one undo step). The comment
context menu gets Mark the selected text instead, and comment_edit takes
find/all/quads. Appearance redraws read indirect /CA, /C and friends, and a
squiggly's zigzag has a total vertex budget.

* M5: refuse empty markup quadrilaterals before changing comments (#4824)

* M5: check markup refusals before promoting inline annotations (#4824)

* M5: keep every squiggly area zigzagged within its drawing budget (#4824)

* M5: refuse markup redraws before promoting inline annotations (#4824)

* M5: fit the markup range tests to main and list comment_edit for highlights (#4824)

The rebase onto main left two tests on APIs main has since changed:
appearance::build now takes the document, and the UI test selects a
comment through session.comments.select_only and runs commands, options
and undo through the harness helpers. The comment.highlight parity entry
now also lists comment_edit, which changes a highlight's marked text.

Co-authored-by: AdrianTM <418436+AdrianTM@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M5: check restyles before promotion and store quads in drawing order (#4824)

set_style checks the target and every Replace Text partner before
annot_ref can promote an inline annotation, so a refused restyle (one
too large to redraw, one that cannot be drawn, one locked) adds no
object and leaves /Annots as it was. A partner the change leaves alone
(a strikeout under a width-only restyle) is still checked for its lock
only.

set_quads stores corners given around the area (ISO 32000-2 §12.5.6.10,
Table 182) in the order the appearance draws, so a highlight fills its
area instead of crossing itself; a quad whose first two corners are
opposite each other is refused.

Co-authored-by: AdrianTM <418436+AdrianTM@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* M5: compare signs when testing a quad's outline for crossings (#4824)

z_order multiplied two side values to test whether an edge pair
crosses. For a tiny quad (edges near 1e-100) the product underflows
to zero, the crossing goes unseen and a perimeter-order quad is stored
unchanged. Compare the signs of the two values instead.

Co-authored-by: AdrianTM <418436+AdrianTM@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Adrian <adrian@mxlinux.org>
Co-authored-by: KenM76 <KenM76>
Co-authored-by: AdrianTM <418436+AdrianTM@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: KenM76 <172507185+KenM76@users.noreply.github.com>
2026-12-04 14:13:56 +01:00
FredApps 517191bd20 Translate the first custom stamp category
(cherry picked from commit d7091427e3)
2026-12-04 13:49:10 +01:00
FredApps a53b59d73a Return from tool details to All tools
(cherry picked from commit e1611c5577)
2026-12-04 13:49:10 +01:00
FredApps 49b2780c3a Cover Open alignment with a document tab
(cherry picked from commit 538d72b04e)
2026-12-04 13:49:10 +01:00
LeandroLP23 a8a8319350 Set the Open button on the line of the document tabs
Its slot was a plain egui allocation at the top of the row, while the tab
strip stands on the row's line, so Open sat above the tabs (#8800).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 96e322bd1e)
2026-12-04 13:49:09 +01:00
Adrian 6612d95df2 M4: scroll All tools in short windows (#8653)
(cherry picked from commit 34b56da235)
(cherry picked from commit 10ecf2d454)
2026-12-04 13:49:09 +01:00
mocenigo 1340e912f7 Show the Edit panel under the dock's header alone, with no second title line or rule above Modify page
(cherry picked from commit f8d09137a3)
2026-12-04 13:49:09 +01:00
FredApps fa19a252d4 Reopen a closed workspace pane through the mode tab (#8967)
(cherry picked from commit 825cdf03ec)
2026-12-04 13:49:09 +01:00
FredApps aac23fb4d8 Merge pull request #8591 from KenM76/feat/bates-files-dialog
Add Bates numbering to a list of files from the app
2026-12-04 13:37:05 +01:00
FredApps 4b03632ebb Merge pull request #8558 from KenM76/feat/form-field-grid-copies
M6: copy a form field into a grid (#6012)
2026-12-04 13:35:45 +01:00
FredApps fb62b2d4fa Merge pull request #8576 from KenM76/fix/add-text-marks-modified
Add text: choosing another tool applies the text being typed
2026-12-04 13:34:42 +01:00
FredApps 359a3857f5 Merge pull request #8756 from KenM76/feat/xfa-breaks-leaders
M12: XFA breaks per instance, to content areas, with startNew (form.xfa-dynamic)
2026-12-04 13:26:20 +01:00
FredApps e0422967ea Offer 110% and 115% interface sizes
The preferences menu takes its choices from the existing validated preset list. Add the two intermediate sizes requested in #8930.

(cherry picked from commit 637550c2c5)
(cherry picked from commit 1c539fb496)
2026-12-04 13:20:47 +01:00
FredApps 7b6bc974f0 Refresh interface fonts after a language preference change
(cherry picked from commit 63fd12595e)
(cherry picked from commit cee03d3b61)
2026-12-04 13:20:37 +01:00
sixparks 9788537507 fix(ui): the current mode tab reopens its closed tool panel
A click on the tab already selected changes no selection, so the mode
strip reported nothing: once Edit a PDF was closed with its ×, the Edit
tab did nothing and only Shift+F4 brought the panel back (#8526).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit f54e48bd5c)
(cherry picked from commit eb74bfb9cf)
2026-12-04 13:20:32 +01:00
jweaver3 8db03bbe3f fix(ui): All tools ▸ Audit space usage opens the Space Audit (#8993) (#9004)
* fix(ui): All tools ▸ Audit space usage opens the Space Audit (#8993)

The Space Audit shipped (Document Properties ▸ Space Audit and the
Optimizer's button), but the Compress a PDF catalogue entry still said
Planned (M11) and had no command behind it. Register optimize.audit,
open the stand-alone Space Audit dialog from it, and mark the entry
Ready.

* fix(ui): the Space Audit shows only the active document's figures

A finished audit was written to the shared result whatever document it
measured, so a late audit of one document could replace another's, and
the dialog showed the previous document's rows while the new measure
ran. Take in a result only when it is the active document's at its
current edit generation, and clear the rows and say "Measuring…" until
that result arrives.

* fix(ui): the Space Audit dialog measures again after an edit lands mid-measure (#8993)

pass dropped a stale audit result but left space_audit_pending set, and only
the Properties tab starts a new measure, so the stand-alone and Optimizer audit
dialogs could stay on "Measuring..." with an empty table. Start the measure for
the current edit once when it is pending, the result is not for this edit and no
job exists for it, as Properties does. Adds a test that edits before the first
measure finishes.

Review: https://github.com/storytold/pdfcraft/pull/9004#pullrequestreview-6187726404

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-04 13:19:28 +01:00
sixparks 0893943ce2 fix(ui): F11 fills the screen and keeps the menu bar and panels (#7954)
F11 did nothing in PdfCraft. The only full screen was Full screen mode
(Ctrl+L), which hides everything but the page to present it.

`view.full_screen_with_menu_bar` (View > Full screen mode with menu
bar, F11) switches the shell's screen mode between Standard and Full
Screen With Menu Bar, which the shell already offers: the window fills
the screen and keeps its menu bar and panels. macOS keeps its own
shortcut, so F11 stays unbound there. In Full screen mode, F11 leaves
that mode. Leaving Full screen mode now gives back the mode it was
entered from, so a window already full screen with F11 stays so.

Fixes #7954

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5aab4b98fc)
(cherry picked from commit 257e69b81d)
2026-12-04 13:17:28 +01:00
FredApps 4f76f1af37 Merge branch 'main' into feat/form-field-grid-copies 2026-12-04 12:55:02 +01:00
FredApps ec828d0093 Merge branch 'main' into feat/bates-files-dialog 2026-12-04 12:54:56 +01:00
FredApps 9128fbca65 Merge branch 'main' into feat/xfa-breaks-leaders 2026-12-04 12:46:15 +01:00
FredApps 4a4f857e0f Merge branch 'main' into fix/add-text-marks-modified 2026-12-04 12:45:06 +01:00
简直蠢丶 bb669c7a4c ui: the start screen's drop hint uses the catalog's full sentence, so it is translated (#9208)
Co-authored-by: jianzhichun <17561654+jianzhichun@users.noreply.github.com>
2026-12-04 12:40:40 +01:00
FredApps 7b50cfaa7f Merge pull request #4564 from dotCooCoo/fix/automation-camera-xfa-warnings
fix(automation): page_enhance_camera reports the XFA data it could not write
2026-12-04 12:35:48 +01:00
Djelli96 02a29d8bca Fix selection actions staying hidden after highlighting text (#8874)
* Fix selection actions staying hidden after highlighting text

* Exercise selection toolbar focus suppression with selected page text

* Format the selection toolbar visibility guard
2026-12-04 12:34:54 +01:00