Commit Graph
3518 Commits
Author SHA1 Message Date
aiongg f700dc3f2e refactor(export): move pptx.rs's tests to pptx/tests.rs 2026-10-26 20:51:19 +00:00
aiongg 37fa7dca86 refactor(platform): move staging.rs's tests to staging/tests.rs 2026-10-26 20:51:19 +00:00
aiongg d823fbd77a refactor(forms): move af.rs's tests to af/tests.rs 2026-10-26 20:51:19 +00:00
aiongg 701988ecd6 refactor(automation): move lib.rs's tests to tests.rs 2026-10-26 20:51:19 +00:00
aiongg 9d6ae81f0e refactor(ui-egui): move editing.rs's tests to editing/tests.rs 2026-10-26 20:51:19 +00:00
aiongg e0033d3989 refactor(export): move lib.rs's tests to tests.rs 2026-10-26 20:51:19 +00:00
aiongg 79d72038f1 refactor(fonts): move pdf.rs's tests to pdf/tests.rs 2026-10-26 20:51:19 +00:00
aiongg 6d8c0bb8dd refactor(ui-egui): move i18n.rs's tests to i18n/tests.rs 2026-10-26 20:51:19 +00:00
aiongg 38e95285d3 refactor(cos): move document.rs's tests to document/tests.rs 2026-10-26 20:51:19 +00:00
aiongg a892922237 refactor(render): move text.rs's tests to text/tests.rs 2026-10-26 20:51:19 +00:00
aiongg 401397d2be refactor(ui-egui): move canvas.rs's tests to canvas/tests.rs 2026-10-26 20:51:19 +00:00
aiongg dd927f62cb refactor(render): move inspect.rs's tests to inspect/tests.rs 2026-10-26 20:51:19 +00:00
aiongg 2f88c5e192 refactor(render): move raster.rs's tests to raster/tests.rs 2026-10-26 20:51:19 +00:00
aiongg c3f6fa3b8c style(ui-egui): format i18n.rs after the include path update 2026-10-26 20:51:18 +00:00
aiongg d932d3bb3c refactor(ui-egui): move i18n/mod.rs to i18n.rs 2026-10-26 20:51:18 +00:00
aiongg c316328bb0 test: scan source directories recursively 2026-10-26 20:51:18 +00:00
KenM76andClaude Opus 5.5 ccb2565036 fix(forms): auto-sized single-line text fields fill their height, not 12 pt
An auto-sized (`0 Tf`) single-line text field drew at most 12 pt however
tall the box. Acrobat Reader draws it at the size the height gives (checked
black-box on a synthetic form: 30 pt and 60 pt fields); ISO 32000-2
§12.7.4.3 leaves the size implementation-defined. auto_text_size_by now
keeps the existing height / 1.15 size without the 12 pt cap, still shrinks
to the width and never goes under 4 pt, with the height bounded at 14,400
(MAX_AUTO_HEIGHT, the largest page side ISO 32000-1 Annex C recommends).

Multiline and comb auto-size keep their 12 pt cap: not yet checked against
Acrobat.

Tests: the forms unit tests now pin a tall box's size (they pinned 12 pt),
and an automation test fills a 30 pt field through form_fill and measures
the drawn text with text_find. All three fail with the cap restored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-10-26 16:29:44 -04:00
alehel fd1382af6e Merge remote-tracking branch 'refs/remotes/origin/main' into fix/background-hidden-by-page-backdrop
# Conflicts:
#	crates/engine/src/lib.rs
2026-10-26 21:20:09 +01:00
Dylan M. Taylor f94668f1c8 fix(sonar): clear css:S9441 and S3776 in forms actions 2026-10-26 16:01:32 -04:00
Dylan M. Taylor 32a9af4d08 proposal(redact): unlink unused Type 3 glyph programs and fonts on redaction (F-011) 2026-10-26 16:01:29 -04:00
Combiler01 1d1d509331 Merge remote-tracking branch 'upstream/main' into main 2026-10-27 00:28:10 +05:30
aiongg d28d047a9e Merge pull request #4730 from alehel/refactor/engine-lib-split
refactor(engine): split lib.rs into modules
2026-10-26 14:35:30 -04:00
KenM76andClaude Opus 5.5 bac061e473 fix(render): a form's stray Q no longer pops the page's saved states
A form XObject or annotation appearance with more `Q` than `q` popped
graphics states saved by the content that drew it, so later page text,
paint and clip lost the page's `cm` and clip, and search redaction of that
text failed closed at `redact_apply`.

A content stream balances its own `q` and `Q` (ISO 32000-2 §8.4.2,
§8.10.1). Vendored hayro-interpret patch (68): `interpret()` records the
state depth at which its stream starts (`Context::enter_stream`) and
restores the outer floor on exit; a `Q` at the floor is ignored with a
warning. Page content (`interpret_content`) is unchanged.

Tests: pdfcraft-render `it::stray_q_in_a_form` (three behaviour tests fail
with the fix reverted, one guard) and pdfcraft-automation
`it::redact_after_stray_q_form` (end to end; fails at `redact_apply` with
the fix reverted).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-10-26 11:34:17 -04:00
KenM76andClaude Opus 5.5 086339b7d7 fix(render): keep the text matrix across Q inside a text object
The vendored hayro-interpret kept the text and text line matrices in the
saved graphics state, so a `q … Q` inside BT … ET put the pen back where it
was before `q`. Text after the `Q` was drawn, extracted and found at the
wrong place, and search redaction refused to apply because its find boxes
(from the render text layer) disagreed with the redactor's own measurement.

Tm and Tlm are not graphics state (ISO 32000-2 §8.4.1 Table 51, §9.4.1);
q/Q inside a text object is allowed in PDF 2.0 (§8.2). Patch (67) carries
them across the restore; font and the other text parameters are still
restored. Forms and annotations save and restore around their own content,
and Type 3 glyphs, patterns and soft masks run in a context of their own, so
a stream's pen does not reach its caller unless the stream pops past its own
saves (two or more stray Q in a form already corrupt the page state on main;
unchanged here).

Tests: pdfcraft-render it::text_matrix_q (three behaviour tests that fail
with the fix reverted, two guards) and pdfcraft-automation
it::redact_text_after_q (end to end, fails at redact_apply when reverted).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-10-26 10:57:16 -04:00
Combiler01 8f3151d4e7 chore(ui): mark image_menu_id with #[doc(hidden)] 2026-10-26 16:33:05 +05:30
RiceDee a85a6c7211 fix(ui): restyling an open added-text box restarts its typing history
restyle_draft applies a format change to an open added-text box in
place, so the page then has the box's text. Unlike a paragraph's
applied(), it left typing_from as it was: when the restyle left the
text as it was, the box kept its history, and Redo put typing undone
before the restyle back on top of it, to be saved on finishing. It now
resets typing_from after a successful edit, so the next claim clears
the history (and the rows' alignments by text with it).
2026-10-26 21:22:57 +11:00
RiceDee a33a8bba38 Merge main into feat/align-selected-lines
Main moved to egui 0.37 (#4591) and took the menus change (#4752).
Conflicts:
- edit_text_ui.rs: the paragraph box keeps the shared input id, now
  Id::unique; the added-text box's shared id and the unit tests' ids
  follow.
- content_ui.rs: the added-text box keeps its per-paragraph layouter
  (which places each line itself, so main's .align(halign) is left out)
  and takes main's inset, margin(4, 2), and its "Added text"
  accessibility label.
2026-10-26 21:02:08 +11:00
jonathanwxh-cellandjonathanwxh-cell 0a6d0f3689 fix(crypt): derive a new file id from the encryption seed
/ID is SHA-256 of the seed under the label id, not an unkeyed DefaultHasher digest. The salts test is a characterization; failing closed when randomness is missing stays the regression guard.

Co-authored-by: jonathanwxh-cell <jonathanwxh-cell@users.noreply.github.com>
2026-10-26 10:00:14 +00:00
RiceDee c779488c79 Merge main into fix/undo-in-open-text-editor
Main moved to egui 0.37 (#4591) and renamed string ids to Id::unique.
Conflict in edit_text_ui.rs: the paragraph box keeps the shared input
id, now Id::unique; the added-text box's shared id follows.
2026-10-26 20:41:38 +11:00
songzhihui 3994c2ca9d M2: document installed CJK font resolution contracts 2026-10-26 16:39:20 +08:00
songzhihui 9745b7c5cc M2: match print-preview fonts to output policy 2026-10-26 16:03:04 +08:00
Combiler01 fb0fb54f50 refactor(ui): expose and use image_menu_id helper in tests 2026-10-26 12:22:08 +05:30
songzhihui d865886d39 M2: sync validated CJK viewer PR with latest main 2026-10-26 13:55:39 +08:00
songzhihui 9107ada7e7 M2: resolve CJK viewer PR conflicts with main 2026-10-26 13:37:48 +08:00
Combiler01 bf2c246a68 fix(ui): adapt custom controls to egui 0.37 API and deprecations 2026-10-26 10:40:41 +05:30
aiongg 64e0868b84 feat(ui): menus from craft-menu, native on macOS (#4752)
* feat(ui): menus from craft-menu, native on macOS

One menu definition (crates/ui-egui/src/menus.rs) built from the command
registry drives the native macOS menu bar (craft-menu's muda backend) and
an in-window egui bar on Windows, Linux and the web, which takes the place
of the "Menu" button at the start of the top bar.

- File, Edit, View, Sign, Window and Help, with separators and submenus.
  Edit gains Cut, Paste, Delete and Select All (they act as their keys
  do) and a Pages submenu; View gains a Tools submenu built from the All
  tools groups; Sign holds Fill & Sign and the certificate commands;
  Window lists the open documents.
- Toggles are check items and the page layouts, side panels and themes
  radio items, with their state from the app.
- File > Open Recent lists the recent files (file.open_recent with an
  index).
- A menu click and its shortcut run the same dispatch, including the
  form-field deferral (#166) and macOS Cmd+W closing the window (#869).
  Dialogs and the palette grey the menus through craft-menu's gate.
- Quit goes through craft-quit, so the unsaved-changes prompt runs.
- craft-ui, craft-quit, craft-menu and craft-keymap pinned to
  storytold/craft-libs 70ade1fb.

Menu state and dispatch follow #2610 by @hajdukste; the menu tree and the
view and panel items follow #3870 by @RivanJarjes.

* test(ui): the menu model, native dispatch and the in-window bar

- Unit tests for the menu definition: every registry menu command is
  listed once with its registry shortcut; check and radio items follow
  the app; a dialog greys document commands and drops their clicks; the
  recent files and open documents are listed once each; a native menu
  click (through a fake craft-menu backend) runs its command once.
- The kittests that opened the old "Menu" button use the menu bar, and
  the ones that look up a label the bar's titles share (Edit, File,
  Sign) skip the bar.
- The in-window bar takes its titles' width, so the mode tabs, search
  and buttons keep their place in the top bar.
- Edit menu clicks that stand for keys (Copy, Cut, Delete, Select All)
  reach this frame's input from `logic`, where test hosts see them too.

* test(ui): the language switch test opens File in the menu bar

Translated titles and rows carry their mnemonic ("ファイル(F)", "開く(O)…").

* feat(ui): the menu bars run Quit themselves, the bar shrinks to its titles, and AppKit's window list stays off

craft-libs main edc41f6 (craft-libs#354): MenuBarUi runs Quit and Minimize, shrink_to_fit sizes the in-window bar, Key::parse reads the registry's arrow and minus glyphs, and mac::install_with(.., window_list(false)) keeps the Window menu to PdfCraft's own document list.

* fix(ui): the menu command filter is an if, for clippy

* test(ui): drop a needless borrow in the edit-tab helper

* test(ui): two tests follow the menu bar

The tests were wrong, not the app. The Preferences language test clicked the old Menu button; it opens Edit in the menu bar and its Preferences row. The prepare Actions test counted the Edit labels: the narrower menu bar leaves room for the Edit tab, so the rows' Edit buttons come third and fourth.
2026-10-26 00:57:46 -04:00
Combiler01 3dfcff3884 Merge remote-tracking branch 'upstream/main' into main 2026-10-26 10:24:50 +05:30
Combiler01 2c0588eaf6 Self Reviewed Bug Fixes 2026-10-26 10:12:01 +05:30
aiongg 01b696df2c test(ui): CJK interface tests skip without craft-fonts (#4706)
* test(ui): CJK interface tests skip without craft-fonts

* test(ui): a build that requires craft-fonts never skips the CJK interface tests
2026-10-25 23:11:45 -04:00
songzhihui 46fbb73d1a M2: address CJK viewer review and sync main 2026-10-26 09:03:41 +08:00
skylar fc578a0b02 chore(deps): bump 11 safe dependency updates 2026-10-25 16:36:22 -06:00
alehelandClaude Opus 5.5 00596b69a6 refactor(engine): keep the moved docs' intra-doc links resolving (document, fill_sign)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:12:15 +01:00
alehelandClaude Opus 5.5 dc224884cb refactor(engine): gather lib.rs's imports and re-exports under the module list
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:10:38 +01:00
alehelandClaude Opus 5.5 51fbed293b refactor(engine): move the test-only hooks to test_hooks.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:09:57 +01:00
alehelandClaude Opus 5.5 8ca4bf641f refactor(engine): move the page filters to page_filter.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:09:38 +01:00
alehelandClaude Opus 5.5 fc6072154d refactor(engine): move the Fill & Sign geometry helpers to fill_sign.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:09:23 +01:00
alehelandClaude Opus 5.5 94b6110819 refactor(engine): move placed pictures and mark sources to pictures.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:09:11 +01:00
alehelandClaude Opus 5.5 8473403a5d refactor(engine): move layer visibility to layers.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:08:38 +01:00
alehelandClaude Opus 5.5 4972a4e1eb refactor(engine): move the bookmark list rows to bookmarks.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:08:14 +01:00
alehelandClaude Opus 5.5 20974e7822 refactor(engine): move the combine and page-source helpers to sources.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:08:01 +01:00