mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-19 02:26:48 +00:00
996d34f432a353bb4fe2531ca7be55c6ffbd9979
6558
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
996d34f432 |
A hidden layer stays hidden after a full Save As
A layer I hid stays hidden in the open document after a full Save As. Fixes #7411 <details><summary>Details for review</summary> **Cause:** the issue's analysis is right. A full save rewrites the file and renumbers its objects, then `mark_saved` refreshes the open document. The refresh looked old layer choices up by the old object number, and the renderer's layer overrides (`config.layers`) still named the old numbers, so the hidden layer came back as shown. An incremental save keeps the numbers, which is why it was unaffected. **Fix:** `mark_saved` now knows when the saved bytes are a rewrite (it already computed that to reset the script runtime). In that case the refresh carries the visibility over by layer name (the nth layer with a name maps to the nth layer with that name, the writer keeps the `/OCGs` order) and rebuilds the renderer's overrides with the new numbers. Name matching also avoids an old number being reused by a different layer. The undo history survives the save, so undo and redo bring back a graph with the old numbers; when the restored layer numbers differ from the open document's, they use the same carry-over by name. Other refreshes are unchanged. **Test** (`crates/engine/src/tests.rs`): `a_full_save_as_keeps_the_layer_choices_of_the_open_document` hides one of two layers whose objects get renumbered by the rewrite, saves in full, and checks both the layer list and the rendered pixels. Without the fix it fails with the hidden layer shown again (I checked this). `undo_and_redo_after_a_full_save_as_keep_the_hidden_layer_hidden` hides a layer after an edit, saves in full, then undoes and redoes, checking the layer list and the pixels each time (it fails without the undo/redo carry-over). Checked: `cargo test -p pdfcraft-engine` (779 unit tests pass in the lib, the other test binaries pass; 7 OCR tests fail here because of the OCR setup on my machine, unrelated to layers), clippy `-D warnings --all-targets`, rustfmt, `xtask layers`. I did not run the native app. </details> |
||
|
|
439401188d |
Double-clicking a one-letter word selects only that word
Double-clicking a one-letter word in the paragraph editor now selects only that word, so typing replaces just it. Fixes #7413 <details><summary>Details for review</summary> **Cause:** the paragraph editor uses `egui::TextEdit`, whose double-click selection combines previous-word and next-word navigation around the nearest caret. With the caret at the start of a word (or end of one) the previous-word step skips the space and lands in the neighbouring word, so the left half of `a` in `Take a calm walk.` selected `Take a`. I confirmed the cause in the pinned egui fork (`select_word_at`) and that the issue's analysis matches. The fork is a pinned dependency, so I fixed it in PdfCraft rather than in egui. **Fix:** after the editor is shown, a double-click is narrowed to the word under the caret: the word that starts at the caret, or the one that ends at it. This reuses egui's own word boundaries (`ccursor_previous_word`/`ccursor_next_word`), so what counts as a word is unchanged. Only a double-click with the pointer over a word glyph is narrowed; one on a space is left to egui (the caret a space hit reduces to ends the word before it). The added-text editor (`content_ui.rs`) gets the same correction. The other multiline boxes (comments, form fields, fill and sign, dialogs) are left as they are: they are short notes and fields, not page text, and most are added with `ui.add`, which returns no galley to test the pointer against. Right-to-left runs are a known limit: there the glyph test finds no glyph and egui's selection is kept. Shift-double-clicks are left to egui too (it extends the selection then). Shift-clicks and Shift-double-clicks that follow a narrowed double-click, in a row and in either direction, keep the word selected until a plain click or new selection: egui's word anchor cannot be set from outside and `set_char_range` clears it, so the click is completed in PdfCraft to give the result egui gives after its own double-click. **Tests** (`crates/ui-egui/src/tools/edit_text_ui.rs`): - `a_double_click_at_a_word_edge_means_that_word` - `double_clicking_a_one_letter_word_selects_only_that_word` (drives a real `TextEdit` with a double-click 20% into the `a`; without the fix it selects `Take a`, I checked this) - `a_shift_double_click_keeps_the_extended_selection` (with Shift held, the selection egui extends is kept; without the Shift check it is cut to `a`) - `a_shift_click_after_the_narrowed_double_click_keeps_the_word` (Shift-click and Shift-double-click before, after and inside the narrowed word, compared with egui's own double-click of `calm`; without the completion a Shift-click before `a` selects `ke ` and drops it) - `shift_clicks_in_a_row_keep_extending_from_the_narrowed_word` and `shift_double_clicks_in_a_row_extend_by_words_from_the_narrowed_word` (before, after, before again in one box, compared with egui's own double-click of `calm`; with the anchor dropped after the first extension the later clicks lose `a`) - `a_one_letter_word_that_starts_a_wrapped_row_is_narrowed` (a narrow box where `a` starts the second row; at a soft wrap the end of a row and the start of the next share an index) - `a_key_that_moves_the_selection_ends_the_word_anchor` (double-click `a`, Shift+Right, then Shift-click before: extends from the selection's own start as egui does) - `a_double_click_on_a_space_is_left_to_egui` (four points across the space after `Take`: the selection equals egui's own; without the glyph check the left half selects `Take`) Checked: `cargo test -p pdfcraft-ui-egui` (1021 unit tests pass, plus the integration tests), clippy `-D warnings --all-targets`, rustfmt, `xtask layers`, `xtask assets`. Ten integration tests (`ocr::*`, `comments::the_selection_bar_stays_inside_the_pages_area`, `editing::a_custom_property_whose_name_the_tools_refuse_is_listed_and_left_alone`) fail the same way on current upstream/main without my change. I did not run the native app by hand. </details> |
||
|
|
79b76e609b |
fix(forms): draw field text the field font cannot hold from the bundled face instead of ?
Fixes #3913 (also reported as #6822, closed as its duplicate). ## What was wrong The field value was never lost: `/V` is stored losslessly as UTF-16BE, and PdfCraft sets `/NeedAppearances`, which is why other viewers show the Greek correctly. The `?` is only in the appearance PdfCraft draws itself: when the field's `/DR` font can't encode the text, `field_appearance_fit` falls back to Helvetica/WinAnsi, and every character outside WinAnsi is drawn as `?` (and reported through the "This field's font can't draw…" notice). ## The fix At that fallback decision, characters that neither the field's font nor Helvetica holds but the bundled Inter face does (Latin, Greek, Cyrillic) are now drawn as Type 3 glyphs built from Inter — the same mechanism Thai text already uses in field appearances. Characters no available face holds (e.g. CJK in a Helvetica field) are still drawn as `?` and reported, exactly as before. Text the field's font holds is byte-for-byte unchanged, and no font resource is added in that case. ## Behaviour change to be aware of Date names in Russian, Czech, Greek, etc. in Helvetica fields (#5303) are now drawn in the date language rather than falling back to English — the "a font that holds them keeps them" rule applied to the bundled face. Japanese still falls back to English. Push-button captions are unchanged (still `?`); same mechanism, possible follow-up. ## Tests - New forms test `greek_a_field_font_cannot_hold_is_drawn_from_the_bundled_face`: Greek, mixed Latin+Greek (multiline), and exact-WinAnsi strings in a `/Helv` field; asserts the `/V` bytes, no `?` in the appearance, a `PCLa` Type 3 font with ToUnicode, and no undrawn report; a CJK character is still reported. It fails on unmodified code and passes with this change. - New fonts unit test for splitting a line between the standard font and Inter. - Updated the engine signature test and the #5303 `form_date_language` tests where they pinned the old `?` behaviour. Verified locally: `cargo test` for fonts, forms, edit and engine — 1,813 passed, 0 failed; `cargo fmt --check` clean; clippy clean on the touched crates. *Disclosure: this change was drafted with AI assistance (Claude) under my direction; the diff was reviewed and the verification above was run before opening this PR.* |
||
|
|
febd6dc2b6 |
fix(sign): an unlisted body or an entry that leads nowhere is no permitted change (#6754)
## What this changes Fixes #6754. A revision appended after signing could change what a signed page shows while `classify_changes` reported only permitted changes. The update carried a new body for the page's content stream that no cross-reference section lists, plus an entry, named from the trailer, that points at no object. cos kept reading the signed content object (its entry had not changed), and read the new number as null, which `classify` drops. The renderer instead rebuilds its object index from the file's `N G obj` headers when an entry leads to no object (`vendor/hayro-syntax/src/xref.rs`, `repair` / `fallback_xref_map_inner`), and there the last header for a number wins, so the page drew the unlisted body. `crates/sign/src/pdf/changes.rs` now refuses both halves, each on its own: - **An entry that does not locate its own object.** Every object whose place changed since signing must have an entry that `xref_entry_is_exact` accepts, whatever the object reads as. Before, this was checked only when the content equalled the signed object's. Reported as `other changes`. - **A body the reader does not read.** `unlisted_bodies` scans the bytes after the signed revision for `N G obj` headers. For each number and generation, the last header there must be where the current entry for that number points. Otherwise the renderer's rebuilt index may draw it. Reported as `page content` when the number had a signed page role, else `other changes`. This holds whatever triggers the rebuild, including a damaged entry the signed file already had. The scan is linear and bounded: past 2^20 distinct headers the appended bytes are not judged and the change is refused. The scan finds more headers than the renderer's (it does not skip dictionaries or check that an object follows), so it errs towards refusing. A writer that lists what it writes is unaffected. ## How you verified it - `cargo fmt --check -p pdfcraft-sign` - `cargo clippy -p pdfcraft-sign --all-targets -- -D warnings` - `cargo test -p pdfcraft-sign --test it`: 144 passed, 2 ignored. - `cargo test -p pdfcraft-sign --lib`: 116 passed, 1 ignored. `shared_annotation_arrays_are_judged_in_bounded_time` (30,000 rewritten pages, 20 s budget) took 11.6 s and 14.4 s with the fix and 13.2 s with `changes.rs` at `main`, on the same machine under similar load: the scan and the extra entry check cost nothing measurable there. New test `an_unlisted_object_body_or_an_entry_that_points_at_no_object_is_not_permitted` in `crates/sign/tests/it/pdf.rs`, for a P=1 certification and an approval signature: - the issue's shape (unlisted content body, plus an entry for `/Info 60 0 R` that points at the section's own `xref` keyword) is Invalid, `page content`; - the entry alone is Invalid, `other changes`; - the unlisted body beside an honestly listed object is Invalid, `page content`; - an honest revision that lists what it adds stays Valid. **Seen failing before the fix:** with `changes.rs` at `main`, the test fails on its first case with `Allowed([])` and status Valid. ## Never-crash - [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests - [x] No indexing or slicing with input-derived positions (`get` throughout); offsets use checked or saturating arithmetic; the header map is capped - [x] No `unsafe` - [x] Not a crash fix ## Provenance - [x] No assets, fonts or copied code - [x] Behaviour from ISO 32000-2 §7.5 and §12.8.2.2, and from observing the vendored renderer's repair path ## Anything a reviewer should look at first - **What is still not modelled.** The renderer's repair scan also files the members of any `/Type /ObjStm` stream it meets (last one wins, unless a plain header exists for the number), attributes a headerless object-stream dictionary to the last header it saw, and keeps the last trailer-like dictionary whose `/Root` has `/Pages`. An appended object stream holding a forged member for an object the signed file kept only in an object stream, or a trailing `<< /Root … >>`, could still diverge once something else makes the renderer rebuild. This PR closes the issue's trigger (an entry that leads nowhere) and the unlisted plain body. The general fix, as the issue says, is to judge changes with the renderer's own object resolution. I have not covered those here, to keep this to the issue; they need their own issue. - **Kind for a misplaced entry.** It stays `other changes`, as the existing `a_cross_reference_entry_that_misses_its_object_is_not_an_unchanged_object` expects, even for a signed page's content object: what the renderer draws there is unknown, not known to be new content. |
||
|
|
6da8fa27ed |
fix(redact): redact an XObject or font whose /Subtype is a reference (#6750)
## What this changes Fixes #6750 (audit F-9). Redaction kept an image under a mark when the image's `/Subtype` was an indirect reference (`/Subtype 8 0 R`, object 8 being `/Image`). `xobject()` in `crates/redact/src/interp.rs` matched on `s.dict.name(b"Subtype")`, and `Dict::name` does not follow references. The image fell through to `_ => None`, so the `Do`, the resource entry and the samples stayed in the saved file under the black box. The renderer still draws such an image. - `xobject()` resolves `/Subtype` before matching, so an image or form named by reference is redacted like a direct one. - `is_vertical()` does the same for a Type0 font, so vertical text in a font with a referenced `/Subtype` still makes Apply refuse rather than pass. - The `_` arm now fails closed. An XObject with no `/Subtype`, or one the redactor doesn't read, is removed in Apply when its placement hits a mark. Verify counts it as residue there. Its placement is the unit square an image fills, or the `/BBox` under its `/Matrix` when it has one. Apply counts it in `forms_removed` and sets `removed_cut`, as it does for a form it cannot read. A placement outside every mark is left alone. Related open PRs, checked for overlap: #5849 resolves `/Subtype` on annotations in `lib.rs`, and #5662 resolves an indirect `/Subtype /Form` in `prune.rs`. Neither touches `xobject()` or `is_vertical()`. ## How you verified it - [x] `cargo fmt --check` (clean) - [ ] clippy with `-D warnings` on `pdfcraft-redact`: **not run locally** - [ ] tests pass on `pdfcraft-redact`: **not run locally with the fix**, see below **What ran.** With the three new or extended tests in place and `interp.rs` reverted to `main`, I ran `cargo test -p pdfcraft-redact --lib -- an_image_whose_subtype an_xobject_of_unknown vertical_writing_text`. All three failed on the expected assertions: - `an_image_whose_subtype_is_a_reference_is_redacted`: the direct `/Subtype /Image` control passed, then the `8 0 R` case failed with `images_removed: 0`. - `an_xobject_of_unknown_subtype_under_a_mark_goes`: the verifier counted 0, expected 1. - `vertical_writing_text_under_a_mark_fails_closed`: the referenced `/Subtype /Type0` case did not refuse. **What did not run.** Local builds were stopped for this change before the run with the fix completed. I have **not** seen these tests pass with the fix, nor run the rest of the crate's tests or clippy. I'm relying on CI for those. This PR is a draft until CI passes. ## Never-crash - [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests - [x] No indexing with input-derived positions (the `/BBox` is read with a slice pattern) - [x] No `unsafe` ## Parity and reach No parity change: this hardens the existing Apply Redactions behaviour. ## Anything a reviewer should look at first The fail-closed `_` arm. It removes an unclassifiable XObject only where a placement hits a mark, never elsewhere. Verify counts it as residue, so the post-apply check would refuse if Apply ever left one. |
||
|
|
d5bcb41099 |
fix(sign): a change to a field a signature locks invalidates it (#6757)
## What this changes Fixes #6757. Validation read only DocMDP references. A signature field's `/Lock` (ISO 32000-2 §12.7.5.5) and the FieldMDP references in its value (§12.8.2.4) were ignored. So changing a locked field after an approval signature read as a permitted form fill, and the signature stayed **Valid**. After this change: - `crates/sign/src/pdf/locks.rs` (new) reads both from the **signed revision**: `All`, `Include` and `Exclude`. A listed name also covers the fields below it, so `address` covers `address.city` but not `addressee`. Both sources count, because signers write one or the other or both. - The locked fields are compared between the signed revision and the document as it is now. That covers each field's dictionary and every dictionary above it (an inherited `/V` is its value too), plus its widgets. Tree links (`/Kids`, `/Parent`, `/P`) are left out of the comparison, and a page is compared by reference only, because adding an annotation rewrites it. - A locked field that changed, disappeared, or gained a second field under its name adds the new change kind `kind::LOCKED_FIELD` ("locked field") to a **Disallowed** modification. The signature is then Invalid, whatever `classify_changes` called the change. - A lock that is present but can't be read (an unknown `/Action`, a FieldMDP reference with no parameters, a non-dictionary `/Lock`), or a form too large to compare within the listing's caps, leaves the signature **Unknown**, never Valid. The detail is the existing "The signature could not be checked ({})." wording. - New fields added under a locked field, and the form's `/NeedAppearances` (plus `/DA`, `/DR` and `/Q` when a locked field has no appearance of its own), count as changes to it. The signature's own field is compared when its lock covers it. - `classify_changes` and `changes.rs` are unchanged. The check is wired in `finish_validation` (`validate.rs`). - `parity`: `sign.field-mdp` moves from `planned` to `partial`, with what's still missing. Related: #4809 makes *filling* refuse locked fields in PdfCraft's own form UI. The `sign` crate can't depend on `forms`, so this PR doesn't share its `signature_locks`. The lock reading follows the same rules (action, prefix matching, both sources) independently, and the two can be merged into one reader later. The two PRs touch different files. ## How you verified it Run locally (Windows), scoped to `pdfcraft-sign`: - [x] `cargo fmt --check -p pdfcraft-sign` - [x] `cargo clippy -p pdfcraft-sign --all-targets -- -D warnings`: clean - [x] `cargo test -p pdfcraft-sign --no-fail-fast`: integration 154 passed. Lib 120 passed, 1 failed: `shared_annotation_arrays_are_judged_in_bounded_time` (20 s limit) took 25 to 34 s. That test calls `classify_changes` directly, which this PR doesn't touch, and it fails the same way on unmodified `origin/main` on this machine (42 s), which was heavily loaded. CI should settle it. - [x] `cargo xtask parity`: ok - [x] Rerun on |
||
|
|
0293facd77 |
Tests: frame budgets scale with a calibration workload on slow machines
## What this changes UI frame-budget tests scale the 40 ms budget against a fixed workload of 18 million integer updates. Calibration runs before and after each round's frames, each run taking the fastest of three trials, and the faster of the two runs sets that round's budget. A 17 ms reference sets the scale, capped at three times the base budget. Calibration does not call egui or PdfCraft. Each frame measurement uses the budget calculated for that round. The `PERF` lines include both calibration durations, scale factor, budget, average frame time, and worst frame time. The wheel-input frame test checks against the same calibrated budget. ## How you verified it - [x] `cargo fmt --check` - [x] clippy with `-D warnings` on the crates I changed - [x] tests pass on the crates I changed - [ ] `cargo xtask layers` and `cargo xtask assets` (if you touched crate boundaries or any asset) - `cargo fmt --all -- --check` - `cargo clippy -p pdfcraft-ui-egui --all-targets -- -D warnings` - `cargo test -p pdfcraft-ui-egui --test perf -- --nocapture --test-threads=1` On Windows, the four performance tests passed with calibration between 16.33 and 16.57 ms, factor 1.00, and a 40 ms budget. A temporary 45 ms delay in every measured step made the comments test fail in all three rounds, with a best average of 47.81 ms. Scaling calibration and average frame durations by 2.5 passed all four tests with budgets between 96.40 and 98.17 ms. Both temporary changes were removed. On |
||
|
|
bff4be14c3 |
M10: Recognize text finds small print on large pages (tiled detection)
## What this changes Recognize text now finds small print on large, dense pages (newspapers, small print, blurred photos). The ocrs detection model reads a fixed 600 × 800 pixel input, so ocrs shrinks every page to that size before detecting words. A full page at 300 dpi (2480 × 3508) is shrunk about four times, and small letters disappear. With this change: - **When (size):** an axis is cut in two when the page is at least twice the detector's input along it (width ≥ 1200 px, height ≥ 1600 px for the ocrs models). Any full page at 300 dpi becomes 2 × 2 tiles; a landscape page may become 2 × 1. The input size is read from the detection model when it loads. Pages below that size (72 to 150 dpi renders, screenshots) are read exactly as before and cost nothing extra. - **When (text size):** a page that passes the size rule is tiled only if its text is small once the page is shrunk to the detector's input, decided by a cheap pixel signal, the **line pitch** (`crates/ocr/src/pitch.rs`). The page is box-averaged to a grey copy of at most 1600 px a side and cut into a 6 × 6 grid of blocks. In each block, the ink is summed per pixel row, the slow trend (shading, pictures) is removed with a moving average, and the autocorrelation is taken. The block autocorrelations are averaged, and the first strong peak is the pitch. Lines in columns that don't line up still agree on the period, and blank blocks are skipped. The same runs on pixel columns for sideways pages, and the axis with the stronger peak wins. The pitch is converted to detector pixels (pitch × 800 / page height). The rule: - pitch **under 9 detector pixels**: tile; - ink but **no clear line spacing** (no autocorrelation peak above 0.05): tile, because the measurement showed these pages (blurred, creased, oblique or moiré photos) gain on average; - large print, and blank pages: detect whole, as before. It costs 6.6 ms per page on average (median 5.1 ms, max 45 ms) and reads every pixel once. - **How:** tiles overlap by 4 % of the page on each side of a cut. Words are **detected** tile by tile. A word is kept only by the tile whose core cell (its share of the page without the overlap) holds its centre, so a word in an overlap counts once. The words are moved back to page pixels, and then lines are formed and **recognised on the whole page** as before. Lines that cross a cut stay single lines, and recognition reads the same pixels it read before. - The edge cells reach to infinity, so every finite word centre belongs to exactly one tile, including boxes that stick out past the page. The change is small and lives in `crates/ocr/src/tiles.rs` plus a `detect_words` step in `Ocr::recognize`. While I was there I also made the existing RGBA length check use checked arithmetic (`width * height * 4` was a `u32` product). ### Measured MDPBench de/es/fr (480 pages), official evaluation with CDM off, `en` recogniser. I ran the same harness build with and without the change (the baseline reproduces the earlier one exactly): | | Digital | Photo | All | Time per page | |---|---|---|---|---| | before | 78.9 | 41.5 | 50.8 | 0.39 s (190 s total) | | tiling every large page (this PR's first commit) | 80.4 | 42.8 | 52.2 | 0.58 s (281 s total) | | **tiling only small or unclear print (this PR)** | **81.2** | **42.9** | **52.5** | 0.54 s (259 s total) | | earlier prototype (full OCR per tile, outside the app) | 81.4 | 42.4 | 52.1 | n/a | The three rows of this PR come from one harness binary with the rule switched by an environment variable. Each was timed twice (190/191, 281/281, 259/259 s). Per language, the line-pitch rule against tiling every large page: DE 62.9 vs 62.7, ES 47.9 vs 47.8, FR 46.8 vs 46.1. It tiles **214 of the 457** pages that pass the size rule. **How the rule was chosen.** I measured first, in Python on the per-page scores of the official evaluation (`overall` per page, base vs. tiled). Per-page score gain from tiling, by measured pitch: | pitch (detector px) | pages | mean gain | pages gaining / losing > 0.02 | |---|---|---|---| | < 4 | 40 | +0.018 | 10 / 4 | | 4–6 | 40 | **+0.114** | 24 / 2 | | 6–10 | 82 | +0.004 | 10 / 6 | | 10–14 | 80 | **−0.013** | 5 / 26 | | 14–35 | 144 | −0.003 | 22 / 25 | | no clear line spacing | 82 | +0.029 | – | The gain sits at small pitch, and pitches of 10–14 detector pixels (ordinary body text on a full page) **lose** a little when tiled. Picking tiled or base per page by this rule, and running the official evaluation on that mix, predicted exactly what the Rust build then scored (52.5 / 81.2 / 42.9). Thresholds between 8 and 10 give 52.4–52.5. Treating "no clear spacing" as "don't tile" instead gives 52.0 with only 132 pages tiled. The choice is tuned on these 480 pages, so take the last few tenths with that in mind. **Time.** The saving is smaller than the page count suggests. The pages that stay tiled are the dense ones, where tiling finds many more words, and recognising those words costs more than the three extra detector runs. Tiling every large page cost +91 s. The pitch rule costs +69 s, so it removes about a quarter of the overhead and still scores higher. Word recall in the benchmark's own per-kind table, before → after: de digital 61.9 → 78.5 %, fr digital 17.8 → 24.5 %, de/es/fr photos 38.1/37.7/10.1 → 42.1/43.2/12.6 %. Sideways photos are unchanged; those need rotation, which is a separate PR. Detection runs four times instead of once on a tiled page (machine: Ryzen AI Max+ 395, CPU). ### How it composes with the open OCR PRs - #5157 (reading order) ends `recognize` in `layout::reading_order`. This PR changes only the detection step before `find_text_lines`, so tiles are merged before lines are formed and before reading order runs, which is the order we want. I measured both together: the numbers above come from a harness tree that has #5157's reading order applied. The two diffs touch neighbouring lines in `recognize`, so whichever merges second needs a trivial rebase. - #5171 (layout regions) and #5058 (line padding) work on lines and regions after detection, so they compose the same way. ## How you verified it - [x] `cargo fmt --check` - [x] `cargo clippy -p pdfcraft-ocr --all-targets -- -D warnings` - [x] `cargo test -p pdfcraft-ocr`: 26 passed, **with the OCR models installed** (CI has none, so CI skips the model-backed tests). With the models, I also ran the OCR tests of `pdfcraft-engine` (`ocr`, `recogni` filters) and `pdfcraft-automation` (`ocr`, `scan`) locally, and all pass. - [x] `cargo xtask layers`, `cargo xtask assets`, `cargo xtask parity` **Tests.** - Unit tests, no models (`crates/ocr/src/tiles.rs`): the tile geometry for small pages and for A4 at 300 dpi; every word centre, on cuts, edges and outside the page, belongs to exactly one tile, and NaN or infinity belongs to none; cropping, including out-of-range and overflowing crops, returns `None` without panicking. - Unit tests, no models (`crates/ocr/src/pitch.rs`), on synthetic A4 pages at 300 dpi: a blank page is not tiled; large print (lines every 100 px, 22.8 detector px) is not; small print (every 30 px, 6.8 detector px) is, in grey, RGB and RGBA alike; sideways small print (lines running down the page) is; noise (ink without lines) is; the first strong autocorrelation peak is the pitch, not its multiple; empty, 1-pixel, short or long buffers, 0 or 5 channels, overflowing sizes, a zero-sized detector and slivers give an answer without panicking. - Model-backed test `finds_small_print_on_a_large_page`: an A4 page at 300 dpi with four lines of small print. One sits inside a tile, one crosses the vertical cut, one is half in the overlap, and one crosses the horizontal cut. Each line must come back as exactly two words at the right place in page pixels. - **Seen failing by reverting the fix:** - Detection on the whole page instead of tiles: 5 words instead of 8, unreadable ("FIOWOR", "In3"). - Keeping every tile's words without the centre-in-core rule: 14 instead of 8, because the lines in the overlaps doubled. - Finite edge cells: `every_word_centre_belongs_to_exactly_one_tile` fails. - Never cutting: the geometry tests fail. - Line-pitch rule, each mutation reverted afterwards: tiling every page (the first commit's behaviour) fails `a_blank_page_is_not_tiled` and `large_print_is_not_tiled`. Never tiling on a measured pitch fails `small_print_is_tiled` and `sideways_small_print_is_tiled`. Rows only, without the column profile, fails `sideways_small_print_is_tiled`. Taking the strongest peak instead of the first strong one fails `the_first_strong_peak_is_the_pitch`. Not tiling unclear pages fails `ink_without_lines_is_tiled`. No detrending fails four tests. With the threshold lowered to 5 detector pixels, the model-backed `finds_small_print_on_a_large_page` finds 5 words instead of 8, so it exercises the rule too (its page measures 5.8). ## Never-crash - [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests - [x] No indexing or slicing with input-derived positions: crops use checked arithmetic and `get`; tile bounds are clamped to the page; float-to-int casts are of values clamped to `0..=len`. The pitch measure checks that the buffer matches width × height × channels with checked arithmetic, reads pixels through iterators and `get`, and works on at most 1600 × 1600 values whatever the page size. It divides only by non-zero counts, so it returns an answer for any input. - [x] No `unsafe` - [x] n/a, this fixes no crash ## Provenance - [x] No asset from an Adobe product - [x] No font files - [x] No GPL/AGPL code - [x] Behaviour comes from our own measurements on MDPBench. The approach (overlapping tiles, keep by centre; line pitch from the autocorrelation of a projection profile) is a generic technique, not read from another implementation. - [x] No new assets. One new dependency edge, `rten-imageproc` 0.26 (MIT/Apache-2.0), which was already in the tree through `ocrs`. ## Security - [x] No path handling changed - [x] No MCP or control channel changes - [x] No network access ## Parity and reach - [x] `ocr.recognize-text` notes say when pages are tiled (size and line pitch), and that the model-backed test runs only where the models are installed. The tiling and pitch unit tests are evidence. - [x] Reachable headlessly: this is inside `Ocr::recognize`, so `ocr_recognize` and `ocr_recognize_files` get it unchanged. - [x] No documented behaviour changed ## Anything a reviewer should look at first - **The tiling rule:** an axis is cut only if each half still fills the detector's input, so a tile is never padded. A lower threshold would also tile mid-size pages. I kept it conservative so that small pages cost nothing. The prototype tiled every page; under this rule, 468 of the 481 benchmark images are cut along at least one axis and 337 along both. - **The line-pitch rule (`pitch.rs`).** Its constants (1600 px working size, 6 × 6 blocks, peak floor 0.05, first peak ≥ 60 % of the strongest, 9 detector px) were chosen on MDPBench as described above. "No clear line spacing → tile" is deliberate. My first idea was the opposite, but the measurement favoured tiling. - **Detect per tile, recognise on the whole page**, rather than full OCR per tile like the prototype. This is simpler: there are no lines to stitch back together and no rows to re-sort. It scores about the same as the prototype (all 52.2 vs 52.1, photo 42.8 vs 42.4, digital 80.4 vs 81.4). |
||
|
|
55983f1f92 |
M12: forms show and add pages from page templates (#1429)
## What this changes Part of #1429. The form in that report keeps pages it shows on demand as **page templates**: the name dictionary's `/Templates` tree names pages kept out of the page tree, and `/Pages` names visible ones (ISO 32000-2 §7.7.4). Until now their fields were listed as unplaced, and the form's JavaScript could not reach them, so buttons that add a page or show a section did nothing. - **organize**: `templates`, `spawn_template` and `set_template_hidden`. - A spawned page is a copy of the template page. - With renaming, its fields become fields of their own under `P<page>.<template>.<name>`. - Without renaming, its widgets join the template's fields and share their values. A template field that is its own widget is split into field + widget first. - Hiding a template takes its page out of the tree, keeps what it inherited (MediaBox, Resources, …) and refuses to hide the last page. - **js**: `this.templates`, `getTemplate(name)`, `Template.name`, `Template.hidden` (setting it shows or hides the page), `Template.spawn(nPage, bRename, bOverlay)` and `spawnPageFromTemplate`, with positional or named arguments and the documented defaults (0 / true / true). Non-number pages are clamped. - **engine**: new `Edit::SpawnTemplate` and `Edit::SetTemplateHidden`. - Both are checked against the assemble permission and applied in the same undo step as the script's field changes. - Only a button's or the console's script may change the pages. A field's own scripts (format, keystroke, validate, calculate) are told so on the console. - At most 100 template pages per script run, because each spawn copies the document. A loop that asks for more stops there with one console note. - **automation**: `page_templates` (read-only), `page_template_spawn` and `page_template_set_hidden`. - Undo labels translated in all 34 catalogues. Not in this PR: - `bOverlay` true (laying a template over an existing page). The script is told so on the console once and nothing changes. - `createTemplate` / `removeTemplate`. - An Organize-panel UI for templates. - `numPages` is not updated inside the running script. - Mouse Up actions on radio buttons and checkboxes (the other half of #1429) are in the open #2546. ## How you verified it - [x] `cargo fmt --check` - [x] clippy with `-D warnings` on the crates I changed (organize, js, engine, automation, ui-egui) - [x] tests pass on the crates I changed | Crate | Result | |---|---| | organize | 188 passed | | js | 97 passed | | engine lib | 382 passed | | engine it | 21 passed | | automation | 45 + 282 passed | | ui-egui i18n | 65 passed | - [x] `cargo xtask layers`, `cargo xtask assets` and `cargo xtask parity` **Tests.** - organize has 9 unit tests: listing, renamed and shared spawns, appending past the end, show/hide, the last page and unknown names refused, hostile template trees, repeated unrenamed copies, and inherited attributes kept when hiding. - js has 5 tests: listing, `spawn` defaults, both argument forms, `hidden` read back, and clamping. - engine has 5 integration tests: one undo step, renamed and shared spawns surviving save + reopen, overlay noted, field scripts refused, and the 100-page budget. - automation has 2 tool tests. Each behaviour was seen failing by reverting it: - no renaming - no field sharing - no MediaBox fallback - hidden page dropping inherited attributes - no budget - field scripts allowed to spawn - requests not applied - wrong default flags Under a loaded machine `tests::xfa_model::a_slow_engine_start_does_not_count_against_the_script` (an existing timing test) failed once and passes on its own. It is not touched here. ## Never-crash - [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests, unless it is provably infallible with a comment saying why - [x] No indexing or slicing with input-derived positions; checked or saturating arithmetic; allocations sized by input are capped; recursion is bounded - Name trees are capped at 4096 names. - Field walks are capped at 32 levels and 100 000 nodes, with seen-sets. - Spawns are capped at 100 per script run. - Template names are clipped and charged to the script's output budget. - [x] No `unsafe` - [x] Any crash this fixes has a small synthetic regression test (no crash fixed; the hostile-tree test covers cyclic and malformed `/Templates`) ## Provenance - [x] No asset from an Adobe product, and no Adobe icon recreated, traced or imitated - [x] No font files committed here - [x] No GPL/AGPL code copied in - [x] Behaviour comes from the specification or black-box observation, **not** from reading another implementation's source. The sources are ISO 32000-2 §7.7.4 and §12.7.6 and the public Acrobat JavaScript API reference for `Template`/`spawnPageFromTemplate`. - [x] Every new asset has an `ATTRIBUTION.toml` entry and `cargo xtask assets` passes (no new assets) ## Security - [x] `--root` confinement still holds on every path, including ones reached by nested tool dispatch (the new tools take a document id, no paths) - [x] MCP and the UI control channel stay opt-in, loopback-only and token-authenticated - [x] No new outbound network access ## Parity and reach - [x] `parity/acrobat-features.toml` updated: `organize.page-templates` is now `partial`, with notes on what is still missing - [x] Reachable headlessly through an `automation` tool (`page_templates`, `page_template_spawn`, `page_template_set_hidden`, and `js_run` for scripts) - [x] Docs updated if this changes a documented behaviour (crate doc comments) ## Anything a reviewer should look at first - `share_fields_with_originals` in `crates/organize/src/import/fields.rs`: how an unrenamed copy's widgets are reparented onto the template's fields. When a template field is its own widget, it is split into a field with two widget kids. - The 100-page budget per script run in `crates/engine/src/js.rs`. Each spawn copies the document, so a `for` loop over `spawn` in a hostile form is bounded there. |
||
|
|
5aae9dbae2 |
Keep the part of an email address before an apostrophe when redacting
## What this changes Email redaction no longer drops the part of an address before an apostrophe. The email scanner's `local` closure in `crates/redact/src/patterns.rs` did not accept an apostrophe in the local part. It treated `'` as a boundary and started the match after it, so for `o'brien@example.com` only `brien@example.com` matched. Search and Redact share that span, so the leading `o'` stayed visible. The local part may now contain an apostrophe, but a match cannot start on one. `o'brien@example.com` and `'john'@example.com` are now matched as `o'brien@example.com` and `john'@example.com`. A quote around an address (`'john@example.com'`) stays outside the match. No linked issue. Found while testing `crates/redact/src/patterns.rs:216` (email, `local` closure). ## How you verified it - [ ] `cargo fmt --check` - [ ] clippy with `-D warnings` on the crates I changed - [x] tests pass on the crates I changed - [ ] `cargo xtask layers` and `cargo xtask assets` (if you touched crate boundaries or any asset) - Regression test `patterns::tests::email_local_part_may_contain_an_apostrophe` covers all three cases. It fails on `main` without the fix and passes with it (`cargo test -p pdfcraft-redact email_local_part_may_contain_an_apostrophe`). - `cargo xtask ci` passes. ## Never-crash - [ ] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests, unless it is provably infallible with a comment saying why - [ ] No indexing or slicing with input-derived positions (`get`, and strings only at char boundaries); checked or saturating arithmetic; allocations sized by input are capped; recursion is bounded - [ ] No `unsafe` - [ ] Any crash this fixes has a small synthetic regression test ## Provenance - [ ] No asset from an Adobe product, and no Adobe icon recreated, traced or imitated - [ ] No font files committed here (they live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts)) - [ ] No GPL/AGPL code copied in (MuPDF, Ghostscript, Poppler, veraPDF and DSS may only be run as external oracle processes) - [ ] Behaviour comes from the specification or black-box observation, not from reading another implementation's source - [ ] Every new asset has an `ATTRIBUTION.toml` entry and `cargo xtask assets` passes ## Security - [ ] `--root` confinement still holds on every path, including ones reached by nested tool dispatch - [ ] MCP and the UI control channel stay opt-in, loopback-only and token-authenticated - [ ] No new outbound network access ## Parity and reach - [ ] `parity/acrobat-features.toml` updated in this PR, with `notes` saying what is still missing - [ ] Reachable headlessly through an `automation` tool where that applies, so agents can drive it and not just the UI - [ ] Docs updated if this changes a documented behaviour (`docs/`, crate README) ## Anything a reviewer should look at first - A quote right before the local part, as in `'john'@example.com`, stays outside the match, so that leading quote stays visible after Redact. Matching it would also pick up the quote around quoted addresses. This is a deliberate restraint. - The domain scan and the other patterns are unchanged. 🤖 Generated with AI by [ApolloOffice](https://github.com/Silvertree2010/ApolloOffice), see the Co-Authored-By trailers for the models |
||
|
|
f435c182d2 |
fix(xfa): render lines without width as vertical and without height as horizontal
## What this changes XFA templates often draw a vertical divider as a `<line>` with `h` but no `w`, and a horizontal one with `w` but no `h`, while still declaring `slope="/"`. A width-less draw was measured as wide as its row and every line was drawn corner to corner along its slope, so these dividers came out as diagonals running across the form to the page edge. DAF Form 988 shows it on all 3 pages: its 66 vertical separators are all width-less lines. - `layout/measure.rs`: a line draw without a width is as wide as its stroke (clamped to 0.1 to 20pt, as it is drawn) plus its margin, capped at the available width, so a separator sits at its own x. - `layout/draw.rs`: a line without a width is vertical and one without a height is horizontal, whatever its slope says. A line whose box is no wider or no taller than twice its drawn stroke runs along the box's longer side, so a zero-height line is horizontal. Only a box with room for its stroke both ways follows `slope`. - `tests.rs`: `xfa_line_without_width_is_vertical_and_without_height_is_horizontal` covers six shapes: no width, no height, 1pt high, 1pt wide, a 48x72pt box with a 25pt stroke (drawn 20pt, so it still follows its slope) and 2pt by 0pt. It also pins the width-less line's x. ## How you verified it - `cargo test -p pdfcraft-xfa`: 314 passed. The new test fails with either half of the fix reverted. - `cargo test -p pdfcraft-engine xfa`: 86 passed. - `cargo fmt --all -- --check` and `cargo clippy -p pdfcraft-xfa --all-targets -- -D warnings`: clean. - DAF Form 988 laid out with `render_into`: 66 diagonal lines on `main`, none with this change (66 vertical, 68 horizontal). - [x] `cargo fmt --check` - [x] clippy with `-D warnings` on the crates I changed - [x] tests pass on the crates I changed - [ ] `cargo xtask layers` and `cargo xtask assets` (if you touched crate boundaries or any asset) ## Never-crash - [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests, unless it is provably infallible with a comment saying why - [x] No indexing or slicing with input-derived positions (`get`, and strings only at char boundaries); checked or saturating arithmetic; allocations sized by input are capped; recursion is bounded - [x] No `unsafe` - [x] Any crash this fixes has a small synthetic regression test ## Provenance - [x] No asset from an Adobe product, and no Adobe icon recreated, traced or imitated - [x] No font files committed here (they live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts)) - [x] No GPL/AGPL code copied in — MuPDF, Ghostscript, Poppler, veraPDF and DSS may only be run as external oracle processes - [x] Behaviour comes from the specification or black-box observation, **not** from reading another implementation's source - [x] Every new asset has an `ATTRIBUTION.toml` entry and `cargo xtask assets` passes ## Security - [x] `--root` confinement still holds on every path, including ones reached by nested tool dispatch - [x] MCP and the UI control channel stay opt-in, loopback-only and token-authenticated - [x] No new outbound network access (that decision is the owner's) ## Parity and reach - [ ] `parity/acrobat-features.toml` updated in this PR, with `notes` saying what is *still* missing — `shipped` means "exists and tested", not "as good as Acrobat" - [ ] Reachable headlessly through an `automation` tool where that applies (`AGENTS.md` §3), so agents can drive it and not just the UI - [x] Docs updated if this changes a documented behaviour (`docs/`, crate README) ## Anything a reviewer should look at first The thin-box rule in `draw_draw`: it compares the box with twice the drawn (clamped) stroke and picks the longer side, so hairline borders never come out diagonal and a degenerate box never yields a zero-length segment. |
||
|
|
0c39992c99 |
Print: make a long printer list easier to browse and search (#4399)
**Update on 2026-11-03 (`db57e7de`).** Merged main `ecdd1e65` and preserved both sets of parity evidence. The picker now uses the public `ComboBox::show_ui` response to track the open menu and clear its search when it closes. All 30 print UI tests passed locally on macOS arm64, including the three printer-picker regressions. Formatting and `cargo xtask parity` passed. [CI](https://github.com/storytold/pdfcraft/actions/runs/41673448570) and [SonarCloud](https://github.com/storytold/pdfcraft/actions/runs/41673448592) track this commit. ## What this changes Fixes #4399. The printer picker opens a wider, taller menu with a name filter. Long device names wrap, while Search and Save as PDF stay visible as the device list scrolls. Search ignores case, trims surrounding spaces and keeps the current destination until a row is chosen. Reopening clears the filter and brings the selected device into view. The large-fleet test now checks that the selected row is between Search and Save as PDF after reopening, without manually scrolling at that point. This catches a broken automatic reveal instead of hiding it with a test-side scroll. ## How you verified it - At `d14aed41`, the [hosted gate](https://github.com/storytold/pdfcraft/actions/runs/40305529036/job/121513571419) passes: 5,194 tests, 21 skipped. All three `printer_picker` tests explicitly pass, including the new reopening visibility assertion. Formatting, strict Clippy, layers, assets, parity and wasm checks pass in that gate. - CodeRabbit's refreshed documentation check passes at 100%; both remaining test helpers are documented. - The three original UI regressions failed against the original production module. They cover a 120-device fleet, Unicode/case matching, selection, reopening, no matches, long names and a 1024×768 window. A separate earlier before/after check caught an initially clipped Save as PDF row by physically clicking it. - Earlier macOS validation inspected headless captures and exercised the real Print dialog through its control channel. Those are earlier-run results, not a new native macOS run on this head. - The current local Windows Cargo 1.95 run cannot resolve the pinned craft-menu manifest and does not reach the UI tests. Runtime validation of this latest test update is the hosted gate above; no local test pass is claimed. ## Safety, provenance and reach - [x] No new panicking shortcuts, unsafe code or input-derived indexing. - [x] No new assets, fonts or dependencies. - [x] Existing printer discovery, properties and print submission paths are used. - [x] Automation remains available through `printers`, `printer_options` and `doc_print`; UI controls remain opt-in. - [x] Printer-selection parity evidence and M10 progress notes are updated. ## Limits of verification Physical printing was not tested. Keyboard injection into the earlier background native macOS window did not enter text; filter typing and selection were verified through egui_kittest. AI assistance: implementation, tests and validation used Codex. |
||
|
|
cc0edc29d1 |
fix(edit): preserve source fonts in mixed-script paragraphs
## Follow-up after #6806 The main mixed-script font change landed in #6806. This PR covers the remaining case where the source font lacks only a variation selector (U+FE00–U+FE0F). A visible letter now selects the fallback face. The regression compares implicit and explicit fallback in two source fonts, including character spacing, alignment, and save/reopen. Verified locally on macOS arm64 with the CI-pinned craft-fonts input: `cargo test --locked -p pdfcraft-edit` and `cargo test --locked -p pdfcraft-automation --test it mixed_script` passed, as did formatting, scoped Clippy, the layer and asset checks, and the UI WebAssembly build. <!-- evening-module-refresh-20261027:start --> **Latest compatibility update (2026-10-27):** [ |
||
|
|
d4da4b94bb |
M5.1: structural round-trip, property and never-crash tests for crates/annot (tests only)
## What this adds
Structural round-trip, property and never-crash evidence for `crates/annot`, which had no `tests/` directory — every prior test checked an in-memory object and never crossed the writer. 50 new tests take the crate from 42 to **92 passing / 0 failed**, with nothing ignored and no existing test weakened:
- `tests/round_trip.rs` (25) — annotations survive save and reopen across all three writer paths: geometry, contents text, flag bits, opacity, identifying names, pop-up back-references, link targets/URIs/dash structure, per-page order and ownership.
- `tests/properties.rs` (10) — proptest invariants over generated geometry, opacity and flags.
- `tests/malformed.rs` (15) — damaged input must never panic; each case documents the *measured* behaviour as defined degradation, not endorsed output.
- `tests/support/{bytes.rs,fixture.rs}` — a raw-byte reader and PDF skeletons, so claims can be made about the saved file rather than only about parsed objects.
`proptest = { workspace = true }` as a dev-dependency (same declaration as `cos`; style differs from the dotted form in crypt/filters). proptest 1.11.0 is already locked in the workspace, so `Cargo.lock` gains one edge and no new package.
**No product code is changed.** This pins current behaviour, including three questionable behaviours it surfaced (below), and leaves every fix to a follow-up.
## Appearance is deliberately out of scope
Nothing here asserts what an appearance stream draws, so this stays clear of #2345, #2137, #2066, #1775 and #1513 (all open, all rewriting appearance generation). Structural fidelity — where a mark sits, what it says, which rules apply — is behaviour none of them intends to alter.
## Evidence quality: mutation-tested, with credit split honestly
Ten single-site guard/arithmetic/key-rename mutants were run against `crates/annot/src/lib.rs` by two independent reviewers plus the author. All ten were caught, and they split **five and five**:
- Killed by pre-existing inline tests in `crates/annot/src/tests.rs` as well: `lib.rs:857` inverted, `:1030` inverted (six inline tests), `:1930` inverted, `:2161` tie-break swapped, `:1241` `/Parent` renamed.
- Killed **only** by tests added here: `:1030` clamp deleted, `:857` clamp deleted, opacity clamp removed at `:1024`, colour clamp in `rgb()` removed at `:824`, and a clamp introduced on the read path at `:2238`.
`lib.rs:857` and `:1030` appear on both sides deliberately — inverting either trips inline tests, deleting them trips nothing outside this branch. Confusing those two mutation families is easy enough to produce a false refutation, so the distinction is recorded in `round_trip.rs` rather than left to whoever re-runs them. A build failure was never counted as a kill in any pass. The mutants were run at `crates/annot/src/lib.rs` as of base `99941daa`. Main has since split that file into modules (`5ce4d244`); the anchor statements are byte-identical at their new homes (the `/Parent` site apart, locals renamed), but main also grew the inline suite from 42 to 74 tests — so the five-and-five split describes the base tree, and the battery was not re-run at the merge head `3122ebad`.
## Three defects found while writing this — reported, not fixed
1. **Large finite numbers are written unvalidated and become unreadable downstream.** The only style guard on the create path (`lib.rs:1018`) is `!finite(&style.color) || !style.opacity.is_finite() || !style.width.is_finite()`; the `abs() < 1e7` cap inside `finite()` (`:827-829`) applies to **colour alone**, so `width` carries no magnitude limit at all. Measured: `width = 1e9` and `1e299` are accepted and written verbatim to `/BS /W`. qpdf (`pikepdf.Job(["--check", …])`, pikepdf 9.11 / libqpdf 12.2) exits **3** — its *warning* status, printed with "operation succeeded with warnings" (0 = clean and silent here) — reporting `overflow/underflow converting <301 digits> to 64-bit integer`, and `/Annots[0]` resolves to `null` (still null after a qpdf re-save) while `pikepdf.open()` reports success. Our own `repair_log()` stays empty, which conflicts with CLAUDE.md's "never silently drop or repair data".
2. **Fill colour is accepted on create and refused on edit.** Create never screens `fill` (it is clamped component-wise by `rgb()` at `:823-825`), while `set_fill` refuses the identical value with `Invalid("invalid fill colour")` at `:2010`. Pinned by `malformed::the_same_huge_fill_is_accepted_on_create_and_refused_on_edit`.
3. **One unparseable token in a page's `/Annots` loses the whole page, silently.** For `[4 0 R notanumber]`, `page_refs()` returns `Ok([])` with `/Pages` still showing the page — so the page object itself fails to parse, every annotation on it disappears, and `repair_log()` records nothing. qpdf keeps the page and warns: `(object 3 0, offset 191): unknown token while reading object; treating as string`.
Anchors in this section read against `crates/annot/src/lib.rs` at base `99941daa`; main has since split that file (`5ce4d244`). The same code at merge head `3122ebad`: `:1018` → `create.rs:416`, `:827-829` → `create.rs:17-19`, `:823-825` → `create.rs:13-15`, `:2010` → `modify.rs:626-627`. All three described behaviours re-verified unchanged at this head.
These need a policy decision rather than a patch, so they are described here and will be filed as separate issues; nothing in this PR fixes them.
## CI status and base note
This branch was opened at `afa8e18` (then current `main`) and rebased onto `99941da`. Two jobs were red on the original base — `test (ubuntu-latest)`, `test (windows-latest)` and the FreeBSD job, all failing in `crates/automation/tests/automation.rs` at `:354` (`signing_with_translated_labels_through_tools`, which passed a 7-character password against an 8-character minimum) and at `:359` (`a_save_that_does_not_reopen_leaves_the_file_as_it_was`), `173 passed; 2 failed`. Those were upstream failures reproduced on that commit's own CI run (**38703572296**, plus the FreeBSD run **38703573428**) in a crate this change never touches; they have since been fixed on `main` by #2420 (the signing password now meets the minimum) and #2484 (save/search regression expectations updated), which is why `main`'s latest CI run is green and why this branch was rebased. The rebase is a no-op for our code: `crates/annot/src/lib.rs` at both commits is byte-identical (`fb491e19…`), so every line number cited below still resolves as written.
Since then `main` was merged in (`dc943eeb`, merge commit `3122ebad`) to clear the FreeBSD job per the CI triage on this PR: the `files_and_quit_from_the_operating_system` race was fixed on main by `12fcc641` (#2812). The merge probe was clean (zero conflicts; `Cargo.lock` the only overlapping path). Main split `crates/annot/src/lib.rs` into modules and reshaped `set_style` to take a `StyleChange`; the merge commit carries three tests-only adaptations (two `SaveOptions` literals gain `drop_unlinked: false`, the writer's default; one `set_style` call re-shaped; citations re-derived to the new file layout). No crate source diverges from main's: `git diff --stat upstream/main HEAD -- crates/annot/src/` is empty. Inline-suite counts at this head: 74 (main grew it from 42); the 42 → 92 figures above describe base `99941daa`. proptest on main's lock is now 1.12.0; one edge added, no new package.
## Where the proof stops
- The first CI run on this branch was at our original base and showed the inherited failures described above; results cited here are local macOS runs (we have no Poppler locally, so qpdf cross-checks ran through pikepdf in a workspace virtualenv).
- The probe PDFs used for qpdf measurements are **not** committed, because AGENTS.md §1 requires an `ATTRIBUTION.toml` entry per sample document — so CI cannot re-measure them. Each measurement carries a regenerate recipe and sha256 in the test comments (`malformed.rs`).
- All oracle figures are tied to one machine's build: pikepdf 9.11 over libqpdf 12.2 (`__libqpdf_version__`; the Job API rejects `--version`, so no raw qpdf version string). Poppler comparisons would need CI, as `pdftoppm` is unavailable locally.
- Mutation evidence covers single-site guard/arithmetic/key-rename mutants only — no multi-site, data-flow or off-by-one classes were attempted.
- We did not measure what any viewer displays to a user after these failures; the listed-but-null entry was observed, not rendered behaviour.
## Question for maintainers
CLAUDE.md asks new tests to be registered in `ROADMAP.md` and `parity/acrobat-features.toml`, but several open PRs above are editing both files right now, so we left them untouched to avoid collisions. Tell us where you would like these registered and we will add the lines here, or open a follow-up.
Credit: `contributors/people.toml` deliberately carries no new entry in this PR — ours is already queued on #2073.
|
||
|
|
3516508589 |
Edit text: space between paragraphs
## What this changes `edit.line-paragraph-spacing` was partial: line spacing existed, the space between paragraphs did not. Now a line break in the edited text starts a paragraph, and the paragraphs are set apart: - `BlockStyle.paragraph_spacing: Option<f64>` (points, beyond the line spacing). `rewrite_block` splits the text at line breaks, wraps and justifies each paragraph on its own (the last line of each paragraph is never stretched), and steps down by the line spacing plus the gap before a paragraph's first line; underlines follow. `None` is half the font size when the text has several paragraphs, so a plain Enter already reads as a paragraph; a non-finite value is refused. - The row-model rewrite (`text_regions`) keeps the rows a line break started apart from wrapped ones: the gap goes before those, and a row the page already had sits where it was, shifted by the spacing added above it. - Format text panel: a Paragraph spacing field (points) next to the line spacing; the tool `text_edit` takes `paragraph_spacing`. - Rows for the two labels in all 21 languages; `parity/acrobat-features.toml` `edit.line-paragraph-spacing` → shipped (notes: space before and after as separate values are still missing). ## How you verified it Re-run on 2026-10-15 after merging `main` into the branch ( |
||
|
|
4f9d93c173 |
fix(ui): Edit ▸ Copy and Paste are enabled for selected comments (#7123)
Fixes #7123 ## What this changes With a drawn annotation (or any comment) selected, Edit ▸ Copy is now enabled, and Edit ▸ Paste is enabled once comments have been copied, matching ⌘C / ⌘V. **Root cause.** `run_menu_command` already sends the clipboard items as their keys (`menus.rs:561`: Copy pushes `Event::Copy`, Paste requests a paste), and `clipboard_keys` handles those by copying the selected comments when no text is selected and by pasting copied XFDF onto the canvas. Only the enabled state was out of sync. `menu_state` enabled Copy for selected text, a picked image, Edit-a-PDF objects or Organize, and Paste only for objects or pages, so both stayed greyed out with a comment selected. **Fix.** There are two new arms in `menu_state` (`crates/ui-egui/src/menus.rs`), placed after the existing image, object and page arms so those still take precedence: - Copy follows `comment.copy` when a comment is selected and no text is. Selected text is what ⌘C copies first, so it is left to the existing text rule. - Paste follows `comment.paste` when the comment clipboard holds something, outside Organize and Prepare Form, where the canvas does not take pastes. ## How you verified it - [x] `cargo fmt --check` - [x] clippy with `-D warnings` on `pdfcraft-ui-egui` (the only warning is in vendored `hayro-interpret`, which was already there) - [x] tests pass on `pdfcraft-ui-egui`, except for failures that also happen on `main` on my machine (Windows, MSVC): `comments::the_selection_bar_stays_inside_the_pages_area` fails every time, and `print::printing_landscape_sheets_tells_cups_to_turn_them` and `print::each_printer_keeps_what_it_last_printed_with_across_a_restart` fail some runs and not others **Test.** `comments::edit_copy_and_paste_are_enabled_for_a_selected_comment` draws a square, selects it, and checks that Edit ▸ Copy is enabled. It then runs Edit ▸ Copy through `run_menu_command` and checks that the comment was copied and that Paste is now enabled. Finally it deselects the comment and checks that Copy is greyed out again. It fails on `main` (`Edit ▸ Copy is enabled with a comment selected`) and passes with the fix. ## Never-crash - [x] No new `unwrap`/`expect`/`panic!` outside tests, no indexing, no `unsafe` ## Anything a reviewer should look at first - **Paste is enabled from app state, without reading the clipboard.** After copying a comment, if another app later puts plain text on the system clipboard, Edit ▸ Paste looks enabled but pastes nothing, as ⌘V already does in that case. I did not read the clipboard just to draw the menu (see #6169 / #6379). - **Copy follows `comment.copy`, which needs only an open document.** So Edit ▸ Copy is now enabled for a selected comment on a document that forbids copying. The same was already true of ⌘C and Edit ▸ Copy comments, so this is not a new way to copy. Whether copy-restricted documents should block copying comments at all is a separate question, and this PR leaves it alone. - **The command palette is unchanged.** `edit.copy` run from the palette (`command_enabled` / `execute`) still covers only text; this PR fixes the menus the issue reports. |
||
|
|
4448ee940b |
fix(ui): mirror the macOS title bar when the traffic lights are on the right (RTL system languages)
## What this changes On macOS with a **right-to-left system language** (Arabic, Hebrew, Persian, …) AppKit lays the traffic lights out from the **right** end of the title bar. That happens even though PdfCraft has no right-to-left localization, and whatever PdfCraft's own interface language is (I checked 0.8.0 in English on an Arabic system: same result). The integrated tab strip (#789 / #1055) always kept its clearance on the left. So: - the lights covered the **theme** and **keyboard-shortcuts** buttons and crowded **Discord**, so they couldn't be clicked; - Home sat beside an empty 70 pt gap where the lights would have been. Before (0.8.0, Arabic system language): | | Strip | |---|---| | Expected left-to-right design | `[● ● ●] [Home] [tabs…] [+ Open] ……… [Discord] [?] [theme]` | | 0.8.0, RTL system | `[ 70 pt gap ] [Home] [+ Open] ……… [Discord] [?][theme] under [● ● ●]` | | This PR, RTL system | `[theme] [?] [Discord] ……… [Open +] [tabs…] [Home] [● ● ●]` | The fix: 1. **Ask the window which side the lights are on** instead of guessing from a language: `NSWindow.windowTitlebarLayoutDirection`, which Apple documents for apps that use `titlebarAppearsTransparent` and put controls under the title bar ("the layout direction may be RTL even in applications that do not have a RTL language localization"). Safe `objc2-app-kit` calls only (same approach as `drag_pointer.rs`), on the main thread, cached in `PdfCraftApp::titlebar_lights_right` once a window has answered. The new features (`NSApplication`, `NSResponder`, `NSWindow`, `NSUserInterfaceLayout`) are already in the tree through winit/rfd, except the empty `NSUserInterfaceLayout` feature. 2. **Mirror the strip** when they are on the right, so the existing design holds with the lights at the other end: Home beside the lights, the tabs reading from the right (the first tab beside Home), then Open; Discord, shortcuts and theme at the far end, in mirrored order. The scroll arrows keep their visual sides. - egui's `ScrollArea` only scrolls content that grows to the right, so mirrored, the tabs keep a left-to-right scroll area inside a box exactly their width (`tabs_shown_width`), set beside Home. - Tab dragging (#1537) reads the slots in reading order with x flipped (`reading_order`), so `drop_index` and `drop_marker` serve both directions unchanged. - The Combine files tab block moved into `combine_tab()` (unchanged behaviour) so it can be drawn first when mirrored and still read last. Left-to-right systems, Windows, Linux (including the GNOME header bar) and the web are unchanged: everything new hangs off `mirrored`, which is only true on macOS with the integrated title bar and lights on the right. ## How you verified it - [x] `cargo fmt --check` - [x] `cargo clippy -p pdfcraft-ui-egui --all-targets -- -D warnings`: clean. With Rust 1.95, `main` itself trips `clippy::collapsible_match` in `crates/edit/src/images.rs` and `clippy::nonminimal_bool` in `crates/ui-egui/src/compare_ui.rs`, files this PR doesn't touch, so the run allowed those two lints; a separate pass with them as warnings finds them only there. - [x] `cargo test -p pdfcraft-ui-egui --no-fail-fast`: 2,911 passed, 0 failed, after the rebase on `main` (`d749fd80`, 2026-11-12) on Windows 11; `pdfcraft-cli` + `pdfcraft`: 198 passed. The rebase moved the mirrored drag into `main`'s new `tab_drag`, which split view's strips share: the main strip passes `mirrored`, the second pane's strip does not. The macOS tests below run only on macOS; on Windows I ran them with the macOS gate lifted locally (not committed): they pass, and with the scrolling fix switched off its test fails. - [x] `cargo xtask layers` and `cargo xtask assets` New tests (macOS, `crates/ui-egui/tests/ui.rs`): - `the_integrated_title_bar_mirrors_with_traffic_lights_at_the_right`: everything stays in the 28 pt band and clear of the lights; Home is beside the lights, the tabs read from the right, then Open; theme, shortcuts and Discord are at the far left in mirrored order. - `dragging_a_tab_in_the_mirrored_title_bar_follows_its_reading_order`: dragging left moves a tab later in the order, and dragging right moves it earlier. Unit tests in `chrome.rs`: `mirrored_tabs_drop_in_their_reading_order`, `shown_tabs_take_their_capped_widths_and_the_gaps`. **Seen failing before the fix:** with mirroring switched off, both UI tests fail. With only the x-flip removed, the drag test fails and the layout test passes, so each test pins its own part. Checked by eye on macOS with an Arabic system language: the real app (dev build, portable mode, three sample PDFs) shows `[theme][?][Discord] … [فتح +][third][second][first][Home][● ● ●]`, with nothing under the lights. ## Never-crash - [x] No new `unwrap`/`expect`/`panic!`/`unreachable!`/`todo!` outside tests - [x] No indexing with input-derived positions (the tab loop indexes `app.views` with indices from `0..len`, as before) - [x] No `unsafe`: the AppKit calls are safe methods in `objc2-app-kit` 0.3; `MainThreadMarker::new()` returns `None` off the main thread, and a missing window returns `None` (then the strip stays as it was and asks again next frame) - [x] No crash fixed here ## Provenance - [x] No asset from an Adobe product - [x] No font files - [x] No GPL/AGPL code - [x] Behaviour from Apple's public AppKit documentation and black-box observation of PdfCraft itself - [x] No new assets ## Security - [x] `--root` confinement untouched - [x] MCP and the control channel untouched - [x] No network access ## Parity and reach - [ ] `parity/`: not applicable (a layout fix, not a feature) - [ ] `automation` tool: not applicable (window chrome) - [x] Docs: no documented behaviour changes ## Anything a reviewer should look at first - **Mirroring follows the lights, not the interface language.** The rest of the app isn't mirrored for RTL languages, so mirroring only the title bar could look like a partial RTL mode. But the title bar's order is anchored to the lights (Home beside them is the #789 design), and AppKit picks their side from the system language, not ours. Tying it to `windowTitlebarLayoutDirection` also covers an English UI on an Arabic system. - **Overflowing tabs when mirrored:** the scroll area still starts at offset 0, its left end, which holds the last tabs. The active tab is scrolled into view on every change (as before), so it's always visible, but at startup with many tabs the first ones (beside Home) may start out of view. Starting it scrolled to the right end would need the content width before the first frame; I left that out to keep this small. Happy to add it. - **A flaky test I saw locally:** `files_and_quit_from_the_operating_system` failed 3 times in ~40 full `--test ui` runs while the machine was also building and running the app, then 0/20 on a quiet machine, both with and without this change. It opens a file on the open worker and waits a fixed 4 frames, so it looks timing-sensitive under load rather than related to this change. - Also adds my own entry to `contributors/people.toml` (separate commit, `sync_github_name = true`). |
||
|
|
9db6c9d95c |
fix(xfdf): bound field text, look up names, guard tab cells, protect fields (#5937)
* fix(xfdf): bound field text, look up names, guard tab cells, protect fields XFDF import built every full field name from its parent's with no total; it is held to 64 MiB of names and values. FDF field arrays charge each decoded value before keeping it instead of after decoding all of them. merge_csv, XFDF field export and apply_values looked names up by linear scan per field; they use maps, keeping first-match behaviour. Tab-delimited export guards formula-like cells with a leading ' as CSV does, and import takes it off. A same-name comment import no longer replaces a widget whose subtype is a reference or whose /FT is inherited from its parent, existing annotations are borrowed instead of deep-copied per import, and an imported redaction mark's /Rect is grown to hold its /QuadPoints so nothing is removed outside its review outline. * address review: follow /Parent 64 levels in is_field |
||
|
|
df3f58d8b8 |
Set Page Boxes crops the margin you type on UserUnit pages (#7445)
* Convert Set Page Boxes margins by the page UserUnit The dialog's margins are physical (pt, in, mm, cm) but were written as user-space units, so a UserUnit 2 page cropped twice the requested margin. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Say that page_set_box margins are user-space units Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Print readiness reads page boxes in points; Set Page Boxes batch keeps its wording Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
c4e174675e |
Bookmarks from text styles open at the heading top on turned pages (#7443)
* Style bookmarks go to the displayed heading top on turned pages Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Read and join style-bookmark headings in displayed order on turned pages Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Read page rotations once per document for style bookmarks Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Test style bookmarks on cropped turned pages and after save and reopen Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
7895411b03 |
fix(forms): name detected check boxes from the nearer neighbouring label (#2943) (#2953)
* fix(forms): name detected check boxes from the nearer neighbouring label (#2943) * M6: bound rectangle work during form detection (#2953) Limit drawn and existing rectangle candidates before pairwise comb and checkbox work, preserve every widget overlap exclusion, and avoid cubic default-name lookup. Document partial proposals on unusually complex pages. Verified: 143 forms unit tests, strict forms clippy, wasm check, layers, assets, and format. The count-based regression fails when the pre-comb cap is removed. * Bound existing-widget overlap work during field detection Index every existing widget spatially and cap aggregate query work, rejecting unchecked proposals if adversarial geometry exhausts the budget. Retain exclusions beyond the proposal/label budget. Add synthetic 100k-widget, inverted-geometry and linear-equivalence regressions. The original linear scan fails the new work-bound negative control. All 147 forms tests, strict Clippy, formatting, wasm, layers and assets checks pass. --------- Co-authored-by: skylar taylor-barrick <hi@skylar.cc> |
||
|
|
2251a75cc8 |
fix(render): resolve TrueType glyphs across Unicode/UCS-4 cmaps, post v2.0 aliases, and truncated FontFlags (#2159) (#2980)
* fix(render): resolve accented TrueType glyphs across Symbolic flags, Unicode cmaps, post v2.0, and ToUnicode (#2159, #2426) * fix(render): separate TrueType glyph selection from extraction (#2980) Restore the existing Symbolic and CFF mapping paths. Keep name-derived Unicode cmap lookup, post-name aliases, known flag bits, and explicit .notdef handling. Replace disputed expectations with synthetic glyph/extraction regressions; the original PDFs in #2159 and #2426 remain unavailable and unverified. * fix(render): check exact post v2.0 glyph name before suffix-stripped cmap lookup (#2980) * fix(render): prefer exact post v2.0 name for multi-codepoint AGL glyph names (#2980) * style: format vendor true_type.rs * fix(render): keep TrueType vendor patch in upstream style Restore unchanged upstream formatting around the glyph-mapping fix and use upstream-default formatting for its new helpers. Preserve the upstream glyph_name_to_text extraction fallback and every existing functional change. Validated workspace cargo fmt, git diff --check, and byte-identical rustfmt canonical output before and after this formatting-only change. The eight TrueType integration tests passed on the prior head in hosted CI; fresh CI will validate this follow-up. Local recompilation and optional negative controls were not attempted because build storage is exhausted. |
||
|
|
bd0a21c2de |
M3: full screen fills the screen or keeps the page display, and Esc closes the find bar before leaving (#576, #4273, #5302) (#5325)
Full screen can fill the screen edge to edge, fixing the fake full screen in #379, or keep the normal page display, via a preference. The forms bar is hidden in full screen. Up-arrow and wheel no longer jump back a page, and Esc closes one thing at a time (the find bar before leaving full screen). Bundles #576, #4273 and #5302. |
||
|
|
8ad5f0d029 |
deny: ignore RUSTSEC-2026-0543, chrono unmaintained (#7647) (#7649)
RUSTSEC-2026-0543 marks every chrono version unmaintained and has no release to move to. It fails cargo deny on every gate run. It is a maintenance notice, not a vulnerability. Add the advisory to [advisories].ignore in deny.toml with justification, the same way other unmaintained advisories are handled. Replacing chrono is not a fix for this repository alone: house rules require time to go through chrono, and craft-libs depend on it. Revisit the ignore when a successor is chosen in craft-contrib. Fixes #7647 |
||
|
|
271e479c53 |
Merge pull request #7591 from storytold/dot/pdf-shared-markdown-20261117
Export: use shared extracted-text Markdown writer with exact output parity |
||
|
|
2959b7050f | Fix canonical ordering of pinned XML lock entries | ||
|
|
a49949388b |
fix(test): allow the unused mut on Windows in the private test folders (#7595)
#5923 made the pptx LibreOffice test and the staging tests build their folders with a DirBuilder that only Unix sets a mode on. On Windows the binding is never changed, so -D warnings stops the build with unused_mut and main's Windows gate is red. |
||
|
|
4d64115874 | export: pin extracted-text writer to merged shared prerequisite | ||
|
|
9892160ed6 | fix(platform): confine staging names; private temp dirs for tests and macOS signing (#5923) | ||
|
|
f8197e29ca | fix(fonts): a CMap's codespace ranges are at most four bytes and listed once (#6075) | ||
|
|
0bb5fcca94 | fix(fonts): the licence policy reads name-table records one at a time within a total allowance (#7044) | ||
|
|
b3f6d485ba | docs: prefer shared craft-libs implementations (#7527) | ||
|
|
35a1d33857 | sign: use shared CMS SignedData signing writer (#7584) | ||
|
|
46234dd471 | export: map PDF layout through shared extracted-text Markdown writer | ||
|
|
efd265563e |
Merge pull request #7330 from MMexicann/patch-8
docs(prc-render): name the current craft-prc parser dependency |
||
|
|
412e6963b5 |
Merge pull request #7529 from storytold/onee/778-pdf-content-facade
refactor(content): re-export craft_pdf::cos::content |
||
|
|
3d43364928 |
fix(crypt): write RC4 fixtures through the legacy entry points
Pinning craft-pdf to the #1852 merge SHA also picked up d74e60b2, which makes create() and set_encryption() refuse RC4-40 and RC4-128. Tests, helpers and the protect example that still write those schemes now use create_legacy and set_encryption_legacy. Edit::Protect does the same when the chosen algorithm is legacy, so a file that must stay readable by a reader without AES can still be written. |
||
|
|
99ef606491 |
refactor(content): point the facade at craft-pdf #1852
Pin craft-pdf to 8e03cd016d42032b867fef6bad86bc69bf2c1920 and re-export craft_pdf::cos::content. Other craft-libs pins stay on e2dc681a3. |
||
|
|
f9aca964b1 |
refactor(content): re-export craft_pdf::cos::content
The parser, serializer and matrices now live in craft-pdf (craft-libs#1852, pin 8e03cd016d42032b867fef6bad86bc69bf2c1920). pdfcraft-content becomes a facade, like pdfcraft-cos. The unit tests moved with the implementation; hayro_sign_tokens stays here. Other craft-libs pins are unchanged. |
||
|
|
207a50ef13 |
Merge pull request #7344 from MMexicann/patch-20
test(create): fail explicitly for invalid one-bit RGB fixtures |
||
|
|
9d061a7668 |
Merge pull request #3762 from AdrianTM/feat/comments-panel-shortcut
Ctrl+M opens the Comments panel (#3741) |
||
|
|
f8d8aef6e4 | M5: preserve macOS Minimize alongside Ctrl+M Comments (#3741) | ||
|
|
2ace804522 |
M5: test Ctrl+M as Windows and Linux send it (#3741)
Real Ctrl events carry both ctrl and command, so a Cmd+Ctrl+M binding, which the registry tries first, would also match them. The test now sends that shape on Windows instead of the command modifier alone. |
||
|
|
fdf9350045 |
Ctrl+M opens the Comments panel (#3741)
Bind comment.list to Ctrl+M (Cmd+M on macOS). The command opens the panel rather than toggling it, so pressing it with the panel already open keeps it open. The binding comes from the command registry, so the View menu, the palette and Help > Keyboard shortcuts show it. |
||
|
|
75a6ce50c3 |
Merge pull request #7377 from gmrmad1/docs/roadmap-2026-11-15
docs: bring ROADMAP.md and parity assessment current through 2026-11-15 |
||
|
|
90d847ce17 |
Select the current query when refocusing search fields (#4533)
* Search field receives a focus request * Find keeps an IME composition when the find field already has the keyboard Selecting the query on Find made the next IME update replace the whole query when the field was composing: egui replaces the selected range, and only egui can end a composition from inside the field. The query is now selected only when the field takes the keyboard from elsewhere, in one helper for the find bar and the Search panel. * Test that the Search panel keeps an IME composition when asked for the keyboard again * A repeated Find selects the query while the field has the keyboard `owns_ime_events` is only `has_focus` on the pinned egui, so a second Find while the find field (or the Search panel field) still had the keyboard kept the caret and typing appended to the old query. Follow the IME composition from the field's own events and cursor instead: a non-empty pre-edit starts it, a commit or empty pre-edit ends it, and any other edit, click or loss of focus ends it too. Only a live composition keeps the selection; every other Find selects all of the query. Tests: a repeated Find with the keyboard still in the field, for both fields, and a Find after a committed composition. --------- Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com> |
||
|
|
799fdd14b9 |
bs: Bosnian language support (#5445)
* Add Bosnian (bs) to the interface languages bs.tsv: Bosnian (Latin script, Ijekavian) catalog covering every key of PdfCraft's other catalogs, its wording shared with storytold/craft-i18n locales/bs/ and the strings craft-i18n lacks translated new. Every bs-* locale selects it; counts use one/few/other. Locale and plural tests, localization docs and an attribution entry (AI-assisted, not yet reviewed by a native speaker). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * Bosnian: date-format language, English picker name, word-count ellipsis Preferences > Date format offers exactly the interface languages, so Bosnian gets its month and day names there; the picker falls back to "Bosnian" when no face can draw the native name; Word Count keeps the command label's trailing ellipsis. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * bs: wording from the craft-i18n catalog review The Bosnian catalog review (storytold/craft-i18n#72) asked for one word per concept; this catalog follows: pan is "pomjeranje" (not "pomicanje"), a spreadsheet is "proračunska tabela", Greek & Cyrillic reads "Grčko pismo i ćirilica". Placeholders and ellipses are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * bs: take the catalog from craft-i18n, keep only PdfCraft's code PdfCraft now reads its translations from storytold/craft-i18n (#6055), and this PR's Bosnian rows are there (storytold/craft-i18n#141, in the pinned commit), so crates/ui-egui/src/i18n/bs.tsv goes. What stays is PdfCraft's part, redone against the new registry: the bs row in LANGUAGES, "Bosnian" as its English picker name, Bosnian date names, locale, persistence and one/few/other plural tests (Bosnian follows the Russian rule in the legacy rule table), and the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * docs: Bosnian revision row in the revision history; language totals The 2026-11-04 Bosnian row had landed in the key-languages table instead of the revision history; it is now the history's first row. The summary counts 21 other languages, 35 catalogs plus English, 36 in Preferences, as LANGUAGES lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z * Docs: list bs as a ui.set / ui.state language value --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
923dd9f593 |
Merge pull request #7449 from storytold/extract/shared-export-base64
export: replace local Base64 encoder with existing craft-mime |
||
|
|
a0bc1b3477 |
Revert "xfa: avoid rescanning prototype-only child lists"
This reverts commit
|
||
|
|
1c7b507a24 |
Merge pull request #7475 from storytold/extract/shared-signature-verification
sign: replace local signature verification with existing craft-pkcs7 |