PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Merge r2 track t15: mixed: accessibility-tags, dialogs-prefs, javascript, organize-pages
aionggdcf2802f96ca
diff --cc ROADMAP.mdindex 5f9a1fea1,eb2c85aae..48331cd61--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -1,16 -1,9 +1,18 @@@# PdfCraft roadmap+> **Last reviewed:** 2026-10-21 · **Last updated:** 2026-10-21 · **Change:** minor (M3, #3808: the Pages inspector has an independent 50–150% thumbnail size slider and buttons; selection and current-page following are retained, with headless ui.set coverage. Estimates unchanged.)+> **Last reviewed:** 2026-10-16; **Last updated:** 2026-10-16; **Change:** minor (M5 #2669, item 5: reply groups and page root counts per frame; estimates unchanged)+> **Last reviewed:** 2026-10-20 | **Last updated:** 2026-10-20 | **Change:** minor (M10, #3532 partial: vector printing retains existing appearances with absent Subtype; estimates unchanged)+**Stage: alpha** · next: beta, ~25% (ready for real work 50% → 75%) and ~400–700 h away+> **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** minor (M4: initial-view options resolve indirect boolean preferences; estimates unchanged)+> **Last reviewed:** 2026-10-20 | **Last updated:** 2026-10-20 | **Change:** minor (M2, #3574: named form properties retain page origin and own dictionary boundaries; estimates unchanged)+> **Last reviewed:** 2026-10-20 - **Last updated:** 2026-10-20 - **Change:** minor (M6, #3502: form detection uses the existing content-stream boundary policy; estimates unchanged)+> **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** minor (M3, #3541/#3620: comment hover follows individual marked lines and original annotation paint order; estimates unchanged)+> **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** minor (M2, #3601: missing spacing glyphs in non-embedded Japanese CID substitutes draw as blanks while PDF widths and Unicode stay unchanged; estimates unchanged)+ > **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** minor (M12 #3673: Character encoding accepts Identity-H/V with Adobe CJK collections; estimates unchanged)+> **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (M5, PR #1971: bounded nested FDF export excludes source page/page-tree dictionaries; refreshed against upstream 4db6ac4a; estimates unchanged)> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (M7: the Edit text caret is as tall as the row it is on; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (M6: CSV tab-containing headers; estimates unchanged)@@@ -52,10 -43,7 +54,11 @@@> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (architectural paper controls from #599; localized shortcut labels, #496; readiness table with hours per audience; full number as weighted sum 49%; earlier: second look: ready 40% → 47%, mainstream 55% added; core-workflow gate applied → alpha) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (closed issues synced: #774, #756 and the #799–#821 batch; earlier: localized shortcut labels, #496; readiness table with hours per audience; full number as weighted sum 49%; earlier: second look: ready 40% → 47%, mainstream 55% added; core-workflow gate applied → alpha) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M6 #2892: Push-button normal labels are editable per widget through Options and form_set_props, independently of field names; rendering, undo/redo and incremental/full save/reopen are covered. Estimates unchanged)+> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M7 #3187: Added-image automation normalizes extreme signed rotation angles before combining them with the current orientation; integer bounds, history, pixels, save/reopen and MCP have regressions. Estimates unchanged)+> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M12 #2569: Growable multiline XFA text reflows after edits, with undo/redo, save/reopen and print coverage; oversized fields still become read-only page text. Structured-data synchronization warnings retain accepted whitespace without relayout from stale data. Estimates unchanged)+> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M12 #2572: Every repeated page-master button resolves its own field to the shared XFA click script, including print buttons. Estimates unchanged)+> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M12 #2570: Dynamic XFA rich-text fields carry exData/maxLength into AcroForm MaxLen for reported and enforced Unicode character limits, retained after save/reopen. Estimates unchanged)+ > **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M4 #3309: bounded iterative named-destination pruning on page deletion; estimates unchanged)PdfCraft's one-page summary: how close it is to Adobe Acrobat Pro's offline feature set, and whatcomes next. Adobe's cloud services (Document Cloud, Acrobat Sign requests, shared review, the AI@@@ -186,31 -174,13 +189,34 @@@ Ranked; detail and the full milestone t| 8 | 1.0 polish: performance, right-to-left, missing languages, keyboard-only (M14) | 55–95 |## Progress log--- **2026-10-21 (M14, #3557):** Preferences: the OK button stays below the scrolling settings instead of being the last thing in them, so it is in reach in a short window.-+- **2026-10-13 (M7, free image rotation):** A selected page image has a rotate knob (Shift: 15 degree steps) and `image_edit` a `rotate_by` action; the angle is written as one undoable `cm`. Snapping to page edges while moving is in #1740; resize snapping is not done. Estimates unchanged.++- **2026-10-20 (M4, initial view):** Window and interface options read indirect boolean ViewerPreferences values. Synthetic regressions cover true/false, direct/indirect preference dictionaries and save/reopen; malformed entries retain false defaults. Estimates unchanged.+- **2026-10-20 (M3, #3535):** Escape with a menu open closes the menu and keeps the text selection; the next Escape clears it, as before. One keypress used to do both. A synthetic UI regression checks it. Estimates unchanged.+- **2026-10-16 (M3, close prompt keyboard):** The "Save changes?" prompt opens with Save chosen (Enter saves, as before) and the arrow keys and Tab / Shift+Tab move the choice to Cancel or Don't save, shown with a focus ring; Enter or Space press the chosen button and Escape still cancels. Before, Enter always saved whatever was Tab-focused. Estimates unchanged.+- **2026-10-21 (M3, #3808):** Page thumbnails in the Inspector can be resized independently from the document and Organize, with a slider, buttons and `thumbnail-zoom` control option. Selection, page following and reload are covered by regressions. Estimates unchanged.+- **2026-10-22 (M2, #3107 / PR #3438):** Inline-image parsing falls back to the existing EI heuristic when missing declared samples, headers or terminators exceed the content-window budget, instead of waiting for an impossible allocation. Exact-length parsing for available samples and ordinary large streamed images is retained. Estimates unchanged.+- **2026-10-21 (M14, Brazilian Portuguese):** Completed the `pt-br` catalog against the current 2,674-key union, including signature validation and accessibility messages; no build or compilation run. Localization remains partial because help and unpredictable engine/OS error details are not translated.- **2026-10-20 (M6, calculation order page):** Prepare a form ▸ Calculation order, a page of its own, lists the calculated fields in the order they calculate with their formulas and values, moved with Up/Down arrows (as Acrobat's Set Field Calculation Order), Alt+↑/↓ or by dragging. A card says what is wrong with the order and holds Fix order; a loop has a card of its own that opens one of its formulas. On the page, each calculated field shows its step, and arrows show what the field in focus reads and what reads it. Estimates unchanged.- **2026-10-20 (M6, calculation order):** The order a form's fields calculate in (`/CO`) is read, checked, fixed and set headlessly with `form_calculation_order`: it says which fields read one calculated later (they show stale values), which read each other in a loop, and which the PDF's order leaves out; Fix order moves only what must move, in one undo step, and the form recalculates. Editing a formula no longer moves its field to the end of the order, and a field the order lists twice calculates once. Estimates unchanged.+- **2026-10-20 (M2, #3574):** Forms without Resources use page Properties for ActualText and layer visibility. Synthetic tests cover boundaries, nested/shared forms, and save/reopen. Estimates unchanged.+- **2026-10-20 (M2, PR #3348 review):** Tracking samples retain short repeated punctuation (up to four glyphs), keeping tracked ellipses intact and searchable while longer TOC leaders still preserve title word spaces. Synthetic regressions cover isolated and surrounded ellipses. Estimates unchanged.+- **2026-10-20 (M2, #3601):** A missing spacing glyph in an OpenType substitute uses its ordinary-space glyph. Synthetic Japanese CID renderer tests check blank spaces, `/W` and `/DW` placement, and unchanged Unicode extraction. Font selection and embedded fonts are unchanged. Estimates unchanged.++- **2026-10-21 (M14, #3557):** Preferences: the OK button stays below the scrolling settings instead of being the last thing in them, so it is in reach in a short window.+++ - **2026-10-20 (M12, #3673):** Character encoding accepts Identity-H/V fonts with Adobe CJK collections and recognizes predefined non-Identity CMaps independently. Unknown CMaps and foreign registries remain refused; synthetic checker and read-only automation regressions passed after failing before the fix. Per-glyph mapping validation and embedded-font extraction remain separate. Estimates unchanged.- **2026-10-19 (M6, renames keep formulas):** Renaming a field renames it in every calculation that reads it, in the same undo step: `AFSimple_Calculate` field lists, simplified field notation (the comment and the JavaScript after it) and `getField` calls naming it in one string literal; the rest of each script is kept as written. A sum used to drop the renamed field, notation read it as 0 and a script kept a stale value. Field Properties says how many formulas changed and `form_set_props` lists them as `formulas_updated`. Names built at run time and other events' scripts are not rewritten. Estimates unchanged.+- **2026-10-19 (M7, #3591):** A background added to a page that already has one is painted over the old one instead of going under it and staying hidden. Behind the content, backgrounds come first, in the order added, and then behind-content watermarks, so a watermark added after a background no longer disappears. Synthetic regressions in `crates/edit` check the order. Estimates unchanged.++- **2026-10-16 (M7, #2516):** A paragraph number from `text_paragraphs` keeps naming the paragraph it listed after edits regroup the page: `text_edit`, `text_edit_layout` and `page_render`'s `hide_text_block` find it again by its text and box, and refuse one that was merged into a neighbour (the edited paragraph included) instead of rewriting the paragraph that took its number (`stale_paragraphs` lists the numbers gone). The inline editor's switch-paragraph click holds the same key. No stable identity across save and reopen yet (#2508).+- **2026-10-19 (M2, radial luminosity masks):** Added synthetic radial-fade coverage for the existing masked-gradient fix (#2132): centre, midpoint, antialiased clip and per-pixel shading reference, including previews, scales and tiles. Removing the existing native-gradient mask guard reproduces an opaque midpoint; restoring it passes. No new renderer behavior or estimate change.+- **2026-10-20 (M6, #3502):** Form detection preserves comments across content streams and does not add fields over rectangles hidden by those comments. Synthetic tests cover visible controls, graphics state, and saved field inventories. Estimates unchanged.+- **2026-10-20 (M6, #2273 / PR #2279):** Rebased the field-highlight default and Appearance preference onto main, retaining secured-form parity evidence and updating secured AcroForm/XFA toggle expectations. Build and test validation delegated to GitHub CI. Estimates unchanged.+- **2026-10-20 (M5, reshape lines):** A line or arrow could only be moved after it was drawn; its length and angle stayed. A selected line, connected lines, polygon or cloud now has a handle on each end or corner: dragging one reshapes it (Shift holds it to 45°), as one undo step, with the new shape drawn while dragging. `pdfcraft_annot::set_points`, `Edit::ReshapeAnnotation`, `comment_edit points`; comment lists carry the points. Estimates unchanged.+- **2026-10-20 (M3, #3620):** Overlapping comment hover uses the original annotation index independently of spatial inspection order. A synthetic UI regression covers different annotation upper edges. Estimates unchanged.++- **2026-10-20 (M3, #3541/#3620):** Comment hover follows the individual marked lines instead of the enclosing multiline rectangle, and overlapping comments follow paint order. Synthetic UI regressions cover all four text-markup kinds, page/view rotations, neighboring highlights, legacy rectangle fallback and unchanged PDF bytes. Estimates unchanged.+- **2026-10-20 (M10, #3532 partial):** Vector printing retains existing widget artwork when its appearance lacks Subtype. A print-owned copy adds Form dispatch metadata. The source stream and all explicit subtypes stay unchanged. Synthetic source/output raster checks cover resources, selected/shared appearances, placement, flags and content modes. Appearance regeneration and physical printer validation remain outside this fix. Estimates unchanged.- **2026-10-19 (M14, #3373):** The main menu and its long submenus scroll in short windows, keeping their commands reachable. Estimates unchanged.@@@ -226,10 -195,8 +232,12 @@@- **2026-10-18 (M6, #2892):** Push-button normal labels are editable per widget through Options and form_set_props, independently of field names; rendering, undo/redo and incremental/full save/reopen are covered. Estimates unchanged.- **2026-10-18 (M7, #3212):** Headers, Bates numbers, watermarks and added text stay visible after unfinished marked content, with original content preserved.+- **2026-10-18 (M7, #3187):** Added-image automation normalizes extreme signed rotation angles before combining them with the current orientation; integer bounds, history, pixels, save/reopen and MCP have regressions. Estimates unchanged.+- **2026-10-18 (M12, #2569):** Growable multiline XFA text reflows after edits, with undo/redo, save/reopen and print coverage; oversized fields still become read-only page text. Structured-data synchronization warnings retain accepted whitespace without relayout from stale data. Estimates unchanged.+- **2026-10-18 (M12, #2572):** Every repeated page-master button resolves its own field to the shared XFA click script, including print buttons. Estimates unchanged.+- **2026-10-18 (M12, #2570):** Dynamic XFA rich-text fields carry exData/maxLength into AcroForm MaxLen for reported and enforced Unicode character limits, retained after save/reopen. Estimates unchanged.+ - **2026-10-19 (M4, #3309 review):** Page deletion keeps working with 60,000 named destinations, without a name-count traversal limit. Synthetic regressions verify every surviving target after deletion and restoration of the deleted page and its destinations by undo/redo, full/incremental save/reopen and unchanged rendering. Estimates unchanged.+ - **2026-10-18 (M4, #3309):** Deleting a page prunes named destinations without recursive calls. Cyclic and shared indirect nodes are visited once. Synthetic deep/cyclic graph, save/reopen and automation regressions cover the change. Estimates unchanged.- **2026-10-15 (M7, Edit text caret):** In a text region that mixes sizes (a 24 pt title over 12 pt lines), the inline editor's caret on a small row was as tall as the region's first size and reached into the row below: egui draws the caret at least one row of the text field's font tall, and that font had the paragraph's first size. The field's font is now half the region's smallest size, so each row's own height decides. Kittest regression; checked in the app on a real document. Estimates unchanged.- **2026-10-16 (M3, #2781):** The Pages panel follows the current page, as Acrobat's page thumbnails do: going to a page whose thumbnail is out of sight (scrolling, Page Down, Go to page, a bookmark) scrolls the panel just enough to show it. A thumbnail already in view, or clicked, leaves the panel where it is, and a page change while the user scrolls the panel or drags thumbnails does not move it. Estimates unchanged.- **2026-10-16 (M12, #1645):** CLI info, text and render use the engine's dynamic XFA layout rather than placeholder pages. Synthetic two-page and encrypted-form regressions cover counts, text, pixels, copy permissions and unchanged input bytes. Estimates unchanged.diff --cc crates/edit/src/tests.rsindex 4fbeee4b8,56755d1b9..bf44aa921--- a/crates/edit/src/tests.rs+++ b/crates/edit/src/tests.rs@@@ -5862,358 -5219,23 +5862,379 @@@ fn a_clipping_copy_on_the_same_baselineassert_eq!(text::text_lines(&doc, 0).unwrap().len(), 2, "refused means untouched");}+/// #2512: a session's drafts are laid out from the document as it was opened, never from each+/// other, and its commit writes what a one-shot rewrite writes, whatever was laid out before.+#[test]+fn a_text_session_commits_what_a_rewrite_writes_whatever_it_laid_out_before() {+ let page = "BT /F1 12 Tf 14 TL 72 700 Td (The first row of a paragraph) Tj T* (and its second row here.) Tj ET";+ let bold = BlockStyle { bold: Some(true), ..Default::default() };+ let drafts: [(&str, &BlockStyle); 4] = [+ ("The first row of a paragraph\nand its second row here, with more words to wrap it onto a third row", &BlockStyle::default()),+ ("Short", &bold),+ ("The first row\nsecond", &BlockStyle::default()),+ ("The first row of a paragraph\nand its second row here.", &bold),+ ];+ let doc = text_page(page);+ let session = text::TextSession::open(&doc, 0, 0).unwrap();+ assert_eq!(session.source().editor_text, "The first row of a paragraph\nand its second row here.");+ for (text, style) in drafts {+ let fresh = text::text_edit_layout(&text_page(page), 0, 0, text, style).unwrap();+ assert_eq!(session.layout(text, style).unwrap(), fresh, "{text:?} is laid out from the opened page");+ }+ let (text, style) = drafts[0];+ let mut by_session = doc.clone();+ session.commit(&mut by_session, Some(text), style).unwrap();+ let mut by_rewrite = text_page(page);+ text::rewrite_block(&mut by_rewrite, 0, 0, Some(text), style).unwrap();+ assert_eq!(+ pdfcraft_cos::write_full(&by_session, &SaveOptions::default()).unwrap(),+ pdfcraft_cos::write_full(&by_rewrite, &SaveOptions::default()).unwrap(),+ "the commit writes what a rewrite writes"+ );+ // A document changed since the session opened isn't written to.+ let before = pdfcraft_cos::write_full(&by_session, &SaveOptions::default()).unwrap();+ let refused = session.commit(&mut by_session, Some("Again"), &BlockStyle::default());+ assert!(matches!(&refused, Err(EditError::Invalid(m)) if m.contains("changed while it was being edited")), "{refused:?}");+ assert_eq!(pdfcraft_cos::write_full(&by_session, &SaveOptions::default()).unwrap(), before);+ assert!(session.is_current(&doc) && !session.is_current(&by_session));+}++/// A one-page document whose resources have `/GS0` (30 % opacity) and `/L1`, a layer that is OFF.+fn row_state_page(content: &str) -> Document {+ let objs: Vec<String> = vec![+ "<< /Type /Catalog /Pages 2 0 R /OCProperties << /OCGs [5 0 R] /D << /OFF [5 0 R] /Order [5 0 R] >> >> >>".into(),+ "<< /Type /Pages /Kids [6 0 R] /Count 1 >>".into(),+ "<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>".into(),+ "<< /Type /ExtGState /ca 0.3 /CA 0.3 >>".into(),+ "<< /Type /OCG /Name (Hidden layer) >>".into(),+ "<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 7 0 R /Resources << /Font << /F1 3 0 R >> /ExtGState << /GS0 4 0 R /GS1 << /Type /ExtGState /ca 0.3 /CA 0.3 /BM /Normal >> /GS2 << /Type /ExtGState /ca 1 /CA 1 >> >> /Properties << /L1 5 0 R >> >> >>".into(),+ format!("<< /Length {} >>\nstream\n{content}\nendstream", content.len()),+ ];+ let mut out = b"%PDF-1.7\n".to_vec();+ let mut offs = Vec::new();+ for (i, o) in objs.iter().enumerate() {+ offs.push(out.len());+ out.extend_from_slice(format!("{} 0 obj\n{o}\nendobj\n", i + 1).as_bytes());+ }+ let x = out.len();+ out.extend_from_slice(format!("xref\n0 {}\n0000000000 65535 f \n", objs.len() + 1).as_bytes());+ for o in offs {+ out.extend_from_slice(format!("{o:010} 00000 n \n").as_bytes());+ }+ out.extend_from_slice(format!("trailer\n<< /Size {} /Root 1 0 R >>\nstartxref\n{x}\n%%EOF\n", objs.len() + 1).as_bytes());+ Document::open(Arc::new(out)).unwrap()+}++/// Each shown string on page 0 with the state it is drawn in: inside a `/OC` marked-content+/// sequence, after `/GS0 gs`, and its horizontal scale (percent).+fn shown_states(doc: &Document) -> Vec<(String, bool, bool, f64)> {+ let joined = streams(doc, 0).join("\n");+ let (mut oc, mut marks) = (0usize, Vec::new());+ let (mut gs, mut tz, mut stack) = (false, 100.0, Vec::new());+ let mut out = Vec::new();+ for op in pdfcraft_content::parse(joined.as_bytes()).ops {+ match op.op.as_slice() {+ b"BDC" | b"BMC" => {+ let layer = op.name(0) == Some(b"OC".as_slice());+ oc += usize::from(layer);+ marks.push(layer);+ }+ b"EMC" => oc -= usize::from(marks.pop().unwrap()),+ b"q" => stack.push((gs, tz)),+ b"Q" => (gs, tz) = stack.pop().unwrap(),+ b"gs" => gs |= op.name(0) == Some(b"GS0".as_slice()),+ b"Tz" => tz = op.num(0).unwrap(),+ b"Tj" | b"'" => {+ let Some(Object::String(s)) = op.operands.last() else { continue };+ if !s.bytes.is_empty() {+ out.push((String::from_utf8_lossy(&s.bytes).into_owned(), oc > 0, gs, tz));+ }+ }+ _ => {}+ }+ }+ out+}++/// #3115: a row drawn in a hidden layer, at 30 % opacity or at 80 % horizontal scale keeps that+/// state when another row of the same paragraph is edited; the edited row doesn't take it on.+#[test]+fn editing_a_row_keeps_the_layer_opacity_and_scale_of_the_rows_around_it() {+ let row1 = "BT /F1 12 Tf 72 700 Td (Hello world, this is the first line) Tj ET\n";+ let row2 = "BT /F1 12 Tf 72 686 Td (and the second) Tj ET";+ let pages = [+ (format!("{row1}/OC /L1 BDC {row2} EMC"), (true, false, 100.0)),+ (format!("{row1}q /GS0 gs {row2} Q"), (false, true, 100.0)),+ ("BT /F1 12 Tf 72 700 Td (Hello world, this is the first line) Tj 80 Tz 0 -14 Td (and the second) Tj ET".to_string(), (false, false, 80.0)),+ (format!("{row1}{row2}"), (false, false, 100.0)),+ ];+ for (n, (content, (oc, gs, tz))) in pages.iter().enumerate() {+ let mut doc = row_state_page(content);+ let blocks = text::text_blocks(&doc, 0).unwrap();+ let block = blocks.iter().position(|b| b.text.starts_with("Hello")).unwrap();+ let text = blocks[block].text.replacen("Hello", "Jello", 1);+ text::replace_block(&mut doc, 0, block, &text).unwrap();+ let shown = shown_states(&reopen(&doc));+ let find = |needle: &str| shown.iter().filter(|s| s.0.contains(needle)).cloned().collect::<Vec<_>>();+ let first = find("Jello");+ assert_eq!(first.len(), 1, "page {}: {shown:?}", n + 1);+ assert_eq!((first[0].1, first[0].2, first[0].3), (false, false, 100.0), "page {}: the edited row keeps its own state: {shown:?}", n + 1);+ let second = find("and the second");+ assert_eq!(second.len(), 1, "page {}: {shown:?}", n + 1);+ assert_eq!((second[0].1, second[0].2, second[0].3), (*oc, *gs, *tz), "page {}: the other row keeps its state: {shown:?}", n + 1);+ }+ // The control: rows in the same state are still one paragraph.+ let blocks = text::text_blocks(&row_state_page(&pages[3].0), 0).unwrap();+ assert_eq!(blocks.len(), 1);+ assert_eq!(blocks[0].text, "Hello world, this is the first line and the second");+}++/// What keeps rows apart is the graphics state they are drawn in, not the `gs` operators+/// before them: a repeated `gs` without q/Q, or another name with the same settings, is still one+/// paragraph, and a `gs` that changes the opacity or puts it back is not.+#[test]+fn rows_under_repeated_or_equal_gs_states_stay_one_paragraph() {+ let row1 = "BT /F1 12 Tf 72 700 Td (Hello world, this is the first line) Tj ET\n";+ let row2 = "BT /F1 12 Tf 72 686 Td (and the second) Tj ET";+ let paragraphs = |content: String| text::text_blocks(&row_state_page(&content), 0).unwrap().len();+ assert_eq!(paragraphs(format!("/GS0 gs {row1}/GS0 gs {row2}")), 1, "the same name twice");+ assert_eq!(paragraphs(format!("/GS0 gs {row1}/GS0 gs /GS0 gs {row2}")), 1, "the same name three times");+ assert_eq!(paragraphs(format!("/GS0 gs {row1}/GS1 gs {row2}")), 1, "two names, the same settings");+ assert_eq!(paragraphs(format!("/GS2 gs {row1}{row2}")), 1, "settings that are the defaults");+ assert_eq!(paragraphs(format!("{row1}/GS0 gs {row2}")), 2, "another opacity");+ assert_eq!(paragraphs(format!("/GS0 gs {row1}/GS2 gs {row2}")), 2, "the opacity put back");+}++/// A page of three vertical (`Identity-V`) columns at 20 pt: `ABCDEF` at x = 500, the same+/// text 30 pt to its left, and `ABCD` far away. Synthetic font: no font program is needed.+fn vertical_columns_page() -> Document {+ vertical_page(+ "BT /V1 20 Tf 500 720 Td <004100420043004400450046> Tj ET\nBT /V1 20 Tf 470 720 Td <004100420043004400450046> Tj ET\nBT /V1 20 Tf 300 720 Td <0041004200430044> Tj ET",+ )+}++/// A page drawing `content` with the vertical font `/V1` (as in [`vertical_columns_page`]) and+/// Helvetica `/F1`.+fn vertical_page(content: &str) -> Document {+ let mut doc = text_page(content);+ let mut font = Dict::from_iter([+ (b"Type".to_vec(), Object::name("Font")),+ (b"Subtype".to_vec(), Object::name("Type0")),+ (b"BaseFont".to_vec(), Object::name("SyntheticCID")),+ (b"Encoding".to_vec(), Object::name("Identity-V")),+ ]);+ let unicode = doc.add(Object::Stream(Stream::flate(+ Dict::new(),+ b"1 begincodespacerange <0000> <ffff> endcodespacerange 6 beginbfchar <0041> <0041> <0042> <0042> <0043> <0043> <0044> <0044> <0045> <0045> <0046> <0046> endbfchar",+ )));+ font.set(b"ToUnicode".to_vec(), Object::Ref(unicode));+ font.set(+ b"DescendantFonts".to_vec(),+ Object::Array(vec![Object::Dict(Dict::from_iter([+ (b"Subtype".to_vec(), Object::name("CIDFontType2")),+ (b"DW".to_vec(), Object::Int(1000)),+ ]))]),+ );+ let p = pdfcraft_model::pages(&doc)[0].obj;+ let helvetica = Dict::from_iter([+ (b"Type".to_vec(), Object::name("Font")),+ (b"Subtype".to_vec(), Object::name("Type1")),+ (b"BaseFont".to_vec(), Object::name("Helvetica")),+ (b"Encoding".to_vec(), Object::name("WinAnsiEncoding")),+ ]);+ let fonts = Dict::from_iter([(b"V1".to_vec(), Object::Dict(font)), (b"F1".to_vec(), Object::Dict(helvetica))]);+ let resources = Dict::from_iter([(b"Font".to_vec(), Object::Dict(fonts))]);+ doc.update_dict(p, |d| d.set(b"Resources".to_vec(), Object::Dict(resources))).unwrap();+ doc+}++#[test]+fn vertical_text_lines_are_columns_and_editing_one_keeps_its_neighbour() {+ let doc = vertical_columns_page();+ let lines = text::text_lines(&doc, 0).unwrap();+ let first = lines.iter().find(|l| l.baseline()[0] == 500.0).unwrap();+ let r = first.rect;+ // Six glyphs, each 20 pt wide and advancing 20 pt down, centred on x = 500.+ assert!((r[0] - 490.0).abs() < 0.5 && (r[2] - 510.0).abs() < 0.5, "{r:?}");+ assert!((r[1] - 600.0).abs() < 0.5 && (r[3] - 720.0).abs() < 0.5, "{r:?}");+ for edit in [0, 1] {+ let mut doc = vertical_columns_page();+ let lines = text::text_lines(&doc, 0).unwrap();+ if edit == 0 {+ let line = lines.iter().position(|l| l.baseline()[0] == 500.0).unwrap();+ text::replace_line(&mut doc, 0, line, "ABCDEA").unwrap();+ } else {+ let blocks = text::text_blocks(&doc, 0).unwrap();+ let block = blocks.iter().position(|b| b.lines.iter().any(|&i| lines[i].baseline()[0] == 500.0)).unwrap();+ assert_eq!(blocks[block].lines.len(), 1, "{blocks:?}");+ text::replace_block(&mut doc, 0, block, "ABCDEA").unwrap();+ }+ let after = text::text_lines(&doc, 0).unwrap();+ let texts: Vec<(f64, &str)> = after.iter().map(|l| (l.baseline()[0], l.text.as_str())).collect();+ assert!(texts.contains(&(500.0, "ABCDEA")), "{texts:?}");+ assert!(texts.contains(&(470.0, "ABCDEF")), "{texts:?}");+ assert!(texts.contains(&(300.0, "ABCD")), "{texts:?}");+ }+}++/// Gives `/V1` an embedded CMap that uses itself: which way its glyphs advance can't be known.+fn make_cmap_cyclic(doc: &mut Document) {+ let cmap = doc.add(Object::Null);+ doc.set(+ cmap,+ Object::Stream(Stream::flate(+ Dict::from_iter([(b"UseCMap".to_vec(), Object::Ref(cmap))]),+ b"1 begincodespacerange <0000> <ffff> endcodespacerange",+ )),+ );+ let p = pdfcraft_model::pages(doc)[0].obj;+ doc.update_dict(p, |d| {+ if let Some(Object::Dict(res)) = d.get_mut(b"Resources")+ && let Some(Object::Dict(fonts)) = res.get_mut(b"Font")+ && let Some(Object::Dict(font)) = fonts.get_mut(b"V1")+ {+ font.set(b"Encoding".to_vec(), Object::Ref(cmap));+ }+ })+ .unwrap();+}++#[test]+fn text_whose_cmap_writing_mode_cannot_be_read_is_not_edited() {+ let mut doc = vertical_columns_page();+ make_cmap_cyclic(&mut doc);+ let error = text::replace_line(&mut doc, 0, 0, "ABCDEA").unwrap_err();+ assert!(error.to_string().contains("cyclic"), "{error}");+}++#[test]+fn a_cyclic_cmap_falls_back_to_horizontal_and_only_refuses_its_own_lines() {+ let mut doc = vertical_page("BT /V1 20 Tf 100 700 Td <00410042> Tj ET\nBT /F1 12 Tf 100 600 Td (Plain) Tj ET");+ make_cmap_cyclic(&mut doc);+ // The page is still listed: the broken font's text as horizontal, the rest untouched.+ let lines = text::text_lines(&doc, 0).unwrap();+ let texts: Vec<&str> = lines.iter().map(|l| l.text.as_str()).collect();+ assert_eq!(texts, ["AB", "Plain"], "{texts:?}");+ assert!(lines[0].rect[2] - lines[0].rect[0] > 30.0 && lines[0].rect[3] - lines[0].rect[1] < 30.0, "{:?}", lines[0].rect);+ assert_eq!(text::reading_blocks(&doc, 0).unwrap().len(), 2);+ assert_eq!(text::text_blocks(&doc, 0).unwrap().len(), 2);+ // Only the line in the broken font is refused.+ let error = text::replace_line(&mut doc.clone(), 0, 0, "BA").unwrap_err();+ assert!(error.to_string().contains("cyclic"), "{error}");+ let block = text::text_blocks(&doc, 0).unwrap().iter().position(|b| b.text == "AB").unwrap();+ let error = text::replace_block(&mut doc.clone(), 0, block, "BA").unwrap_err();+ assert!(error.to_string().contains("cyclic"), "{error}");+ text::replace_line(&mut doc, 0, 1, "Changed").unwrap();+ let texts: Vec<String> = text::text_lines(&doc, 0).unwrap().into_iter().map(|l| l.text).collect();+ assert_eq!(texts, ["AB", "Changed"]);+}++#[test]+fn vertical_text_drawn_one_glyph_per_tj_is_one_line() {+ // One text object, a `Tj` per glyph; and a column with a text object per glyph.+ let doc = vertical_page(+ "BT /V1 20 Tf 500 720 Td <0041> Tj <0042> Tj <0043> Tj ET\n\+ BT /V1 20 Tf 1 0 0 1 470 720 Tm <0041> Tj ET\nBT /V1 20 Tf 1 0 0 1 470 700 Tm <0042> Tj ET\nBT /V1 20 Tf 1 0 0 1 470 680 Tm <0043> Tj ET",+ );+ let lines = text::text_lines(&doc, 0).unwrap();+ let columns: Vec<(f64, &str)> = lines.iter().map(|l| (l.baseline()[0], l.text.as_str())).collect();+ assert_eq!(columns, [(500.0, "ABC"), (470.0, "ABC")], "{columns:?}");+ for line in &lines {+ let r = line.rect;+ assert!((r[1] - 660.0).abs() < 0.5 && (r[3] - 720.0).abs() < 0.5, "{r:?}");+ }+ assert_eq!(text::text_blocks(&doc, 0).unwrap().len(), 2);+}++/// Two genuinely stacked rows of ordinary body text must not join into one row just because the+/// first is narrow enough to put the second's start within the #3252 tolerance band: here the+/// second row starts 1.4pt to the left of where the first ends (so the two overlap a little,+/// as compressed text or a tight column can) and 5pt below its baseline — inside the widened 50%+/// tolerance but outside the original 20% one. They stay two rows (and two paragraphs).+#[test]+fn stacked_rows_that_merely_overlap_do_not_join_into_one_row() {+ let doc = text_page("BT /F1 12 Tf 72 700 Td (A compressed line of body text here) Tj 190 -5 Td (Second stacked line of body text) Tj ET");+ let lines = text::text_lines(&doc, 0).unwrap();+ assert_eq!(lines.len(), 2);+ let gap = lines[1].rect[0] - lines[0].rect[2];+ assert!((-2.4..0.0).contains(&gap), "the rows overlap a little, within the old tolerance band: {gap}");+ let baseline_shift = lines[0].rect[3] - lines[1].rect[3];+ assert!((2.4..6.0).contains(&baseline_shift), "between the old and new vertical tolerance: {baseline_shift}");+ let blocks = text::text_blocks(&doc, 0).unwrap();+ assert_eq!(blocks.len(), 2, "two separate rows stay two paragraphs, not one: {blocks:?}");+}++/// Two equal-size rows with no horizontal overlap must not join into one row either (#3252):+/// the wider tolerance is for a run distinctly smaller or larger than its neighbour (a+/// super/subscript), not for two ordinary body-text rows that happen to sit close enough+/// vertically — here a 5pt baseline shift, inside the widened 50% tolerance but outside the+/// original 20% one, with the second row starting just past where the first ends.+#[test]+fn equal_size_rows_need_the_tighter_tolerance_even_without_overlap() {+ let doc = text_page("BT /F1 12 Tf 72 700 Td (Short line one) Tj 75 -5 Td (Second line two here) Tj ET");+ let lines = text::text_lines(&doc, 0).unwrap();+ assert_eq!(lines.len(), 2);+ assert_eq!(lines[0].size, lines[1].size, "same size: no super/subscript here");+ let gap = lines[1].rect[0] - lines[0].rect[2];+ assert!(gap >= 0.0, "no horizontal overlap: {gap}");+ let baseline_shift = lines[0].rect[3] - lines[1].rect[3];+ assert!((2.4..6.0).contains(&baseline_shift), "between the old and new vertical tolerance: {baseline_shift}");+ let blocks = text::text_blocks(&doc, 0).unwrap();+ assert_eq!(blocks.len(), 2, "two separate rows stay two paragraphs, not one: {blocks:?}");+}++/// A `TJ` with a surplus array operand (`[(FIRSTARR)] [(LASTARR)] TJ`) is malformed, but the+/// operator still takes the one immediately before it, as the renderer, MuPDF and pdftotext do+/// (#3569) -- not the first, which this reader took before, showing a word the page never draws.+#[test]+fn a_tj_with_a_surplus_array_reads_the_last_one() {+ let doc = text_page("BT /F1 24 Tf 20 100 Td [(FIRSTARR)] [(LASTARR)] TJ ET");+ let lines = text::text_lines(&doc, 0).unwrap();+ assert_eq!(lines.len(), 1);+ assert_eq!(lines[0].text, "LASTARR", "the operand immediately before TJ, as the page draws: {lines:?}");+}++/// A producer wrote `0.0001 Tc` on one word of a line (Word through macOS Quartz). That spacing+/// can't be seen, so the word stays on its line; spacing that can be seen still keeps runs apart.+#[test]+fn a_word_with_invisible_extra_spacing_stays_on_its_line() {+ let page = |spacing: &str| {+ text_page(&format!(+ "BT /F1 12 Tf 1 0 0 1 72 700 Tm (for company ) Tj ET \+ BT /F1 12 Tf 1 0 0 1 141.36 700 Tm (A) Tj ET \+ BT {spacing} Tc /F1 12 Tf 1 0 0 1 149.364 700 Tm (EROSOL) Tj ET"+ ))+ };+ let blocks = text::text_blocks(&page("0.0001"), 0).unwrap();+ assert_eq!(blocks.iter().map(|b| b.text.as_str()).collect::<Vec<_>>(), ["for company AEROSOL"]);++ let mut doc = page("0.0001");+ text::rewrite_block(&mut doc, 0, 0, Some("for company AEROSOL LLC"), &BlockStyle::default()).unwrap();+ let lines = text::text_lines(&reopen(&doc), 0).unwrap();+ assert_eq!(lines.iter().map(|l| l.text.as_str()).collect::<Vec<_>>(), ["for company AEROSOL LLC"]);+ assert!((lines[0].rect[0] - 72.0).abs() < 0.01, "{:?}", lines[0].rect);++ let blocks = text::text_blocks(&page("0.5"), 0).unwrap();+ assert_eq!(blocks.iter().map(|b| b.text.as_str()).collect::<Vec<_>>(), ["for company A", "EROSOL"]);+}+++ /// #3573: past the 256-level marked-content cap every `EMC` must still close its own sequence,+ /// so `/ActualText` nested that deep is neither dropped nor applied to too little text.+ #[test]+ fn actual_text_pairs_past_the_marked_content_cap() {+ let span = "/Span <</ActualText (REPLACED)>> BDC BT /F1 24 Tf 72 700 Td (abc) Tj ET EMC";+ let outer = "/Span <</ActualText (OUTER)>> BDC BT /F1 24 Tf 72 700 Td /Y BMC (abc) Tj EMC (def) Tj ET EMC";+ for (content, expected) in [+ (span.to_string(), "REPLACED"),+ (format!("{}{span}{}", "/X BMC ".repeat(256), " EMC".repeat(256)), "REPLACED"),+ (format!("{}{span}{}", "/X BMC ".repeat(1000), " EMC".repeat(1000)), "REPLACED"),+ (outer.to_string(), "OUTER"),+ (format!("{}{outer}{}", "/X BMC ".repeat(255), " EMC".repeat(255)), "OUTER"),+ ] {+ let doc = text_page(&content);+ let lines = text::text_lines(&doc, 0).unwrap();+ assert_eq!(lines.iter().map(|l| l.text.as_str()).collect::<Vec<_>>(), [expected]);+ let reading: Vec<String> = text::reading_blocks(&doc, 0).unwrap().into_iter().map(|b| b.text).collect();+ assert_eq!(reading, [expected]);+ }+ }diff --cc crates/engine/src/tests.rsindex 766976822,25b38905d..258d37390--- a/crates/engine/src/tests.rs+++ b/crates/engine/src/tests.rs@@@ -6632,209 -6150,185 +6635,391 @@@ fn undo_never_makes_an_unsaved_documents.undo(new).unwrap();assert!(!s.get(new).unwrap().dirty, "once saved, undo back to the saved state is clean");}++#[test]+fn undo_and_redo_roll_back_on_a_refresh_panic_or_error() {+ let (mut s, id) = session_with(1);+ s.apply(id, Edit::RotatePages { pages: vec![0], degrees: 90 }).unwrap();+ let (bytes_90, gen_90) = {+ let d = s.get(id).unwrap();+ (d.bytes.clone(), d.generation)+ };++ // 1. A panic during undo's refresh catches the unwind and rolls back cos, undo/redo, info, and working bytes.+ panic_on_refresh(1);+ let err = s.undo(id).unwrap_err();+ assert_eq!(err, EditError::Reopen("injected refresh panic".into()));+ {+ let d = s.get(id).unwrap();+ let ed = d.editor.as_ref().unwrap();+ assert_eq!(d.info.pages[0].rotation, 90);+ assert_eq!(d.bytes, bytes_90);+ assert_eq!(d.generation, gen_90);+ assert!(d.dirty);+ assert!(ed.cos.is_modified());+ assert_eq!(ed.undo.len(), 1);+ assert!(ed.redo.is_empty());+ }+ let _ = shown(&s, id, 0);++ // 2. If the rollback refresh also panics, `show_released` restores the renderer so the page still draws.+ panic_on_refresh(2);+ assert_eq!(s.undo(id), Err(EditError::Reopen("injected refresh panic".into())));+ assert_eq!(s.get(id).unwrap().editor.as_ref().unwrap().undo.len(), 1);+ let _ = shown(&s, id, 0);++ // Undo now succeeds cleanly.+ assert_eq!(s.undo(id).unwrap().as_str(), "Rotate page");+ let (bytes_0, gen_0) = {+ let d = s.get(id).unwrap();+ assert_eq!(d.info.pages[0].rotation, 0);+ assert!(!d.dirty);+ (d.bytes.clone(), d.generation)+ };++ // 3. A panic during redo's refresh catches the unwind and rolls back to the undone state.+ panic_on_refresh(1);+ let err = s.redo(id).unwrap_err();+ assert_eq!(err, EditError::Reopen("injected refresh panic".into()));+ {+ let d = s.get(id).unwrap();+ let ed = d.editor.as_ref().unwrap();+ assert_eq!(d.info.pages[0].rotation, 0);+ assert_eq!(d.bytes, bytes_0);+ assert_eq!(d.generation, gen_0);+ assert!(!d.dirty);+ assert!(!ed.cos.is_modified());+ assert!(ed.undo.is_empty());+ assert_eq!(ed.redo.len(), 1);+ }+ let _ = shown(&s, id, 0);++ // 4. If redo's rollback refresh also panics, `show_released` restores the renderer.+ panic_on_refresh(2);+ assert_eq!(s.redo(id), Err(EditError::Reopen("injected refresh panic".into())));+ assert_eq!(s.get(id).unwrap().editor.as_ref().unwrap().redo.len(), 1);+ let _ = shown(&s, id, 0);++ // Redo now succeeds cleanly.+ assert_eq!(s.redo(id).unwrap().as_str(), "Rotate page");+ assert_eq!(s.get(id).unwrap().info.pages[0].rotation, 90);++ // 5. Metadata scope: a panic after `doc.info.title` was written rolls back `info.title` and keeps `edit_notices`.+ s.apply(id, Edit::SetInfo { key: "Title".into(), value: "Draft".into() }).unwrap();+ let notice = TextNotice { field: None, page: 0, ch: '☺', redrawn_elsewhere: false };+ s.doc_mut(id).unwrap().edit_notices.push(notice.clone());+ panic_on_refresh(1);+ assert_eq!(s.undo(id), Err(EditError::Reopen("injected refresh panic".into())));+ assert_eq!(s.get(id).unwrap().info.title.as_deref(), Some("Draft"));+ assert_eq!(s.get(id).unwrap().edit_notices, [notice]);+ assert_eq!(s.undo(id).unwrap().as_str(), "Change Title");+ assert_eq!(s.get(id).unwrap().info.title, None);+ assert!(s.get(id).unwrap().edit_notices.is_empty());++ panic_on_refresh(1);+ assert_eq!(s.redo(id), Err(EditError::Reopen("injected refresh panic".into())));+ assert_eq!(s.get(id).unwrap().info.title, None);+ assert_eq!(s.redo(id).unwrap().as_str(), "Change Title");+ assert_eq!(s.get(id).unwrap().info.title.as_deref(), Some("Draft"));++ // 6. Protection keys: undo/redo rollback restores `editor.keys` and `doc.password` before re-inspecting.+ let protect = Protection { open_password: Some("u".into()), permissions_password: Some("o".into()), ..Protection::default() };+ s.apply(id, Edit::Protect(protect)).unwrap();+ assert!(s.get(id).unwrap().info.encrypted);+ panic_on_refresh(1);+ assert_eq!(s.undo(id), Err(EditError::Reopen("injected refresh panic".into())));+ assert!(s.get(id).unwrap().info.encrypted);+ assert_eq!(s.get(id).unwrap().password.as_deref(), Some("u"));+ assert_eq!(s.undo(id).unwrap().as_str(), "Protect with password");+ assert!(!s.get(id).unwrap().info.encrypted);+ assert_eq!(s.get(id).unwrap().password, None);++ panic_on_refresh(1);+ assert_eq!(s.redo(id), Err(EditError::Reopen("injected refresh panic".into())));+ assert!(!s.get(id).unwrap().info.encrypted);+ assert_eq!(s.get(id).unwrap().password, None);+ assert_eq!(s.redo(id).unwrap().as_str(), "Protect with password");+ assert!(s.get(id).unwrap().info.encrypted);+ assert_eq!(s.get(id).unwrap().password.as_deref(), Some("u"));+}++#[test]+fn a_bookmark_added_at_a_point_goes_there_through_undo_and_save() {+ use pdfcraft_render::DestView;+ let (mut s, id) = session_with(3);+ let view = |s: &Session, i: usize| s.get(id).unwrap().info.outline.get(i).map(|o| (o.page, o.view));+ let add = |s: &mut Session, title: &str, page: usize, left: Option<f64>, top: Option<f64>| {+ s.apply(id, Edit::AddBookmark { parent: vec![], index: usize::MAX, title: title.into(), page, left, top })+ };+ add(&mut s, "Plain", 0, None, None).unwrap();+ add(&mut s, "Section", 1, None, Some(500.5)).unwrap();+ add(&mut s, "Table", 2, Some(72.0), Some(300.0)).unwrap();+ // The page top (no position) is what it always was; the others carry their place.+ assert_eq!(view(&s, 0), Some((Some(0), DestView::Xyz { left: None, top: None, zoom: None })));+ assert_eq!(view(&s, 1), Some((Some(1), DestView::Xyz { left: None, top: Some(500.5), zoom: None })));+ assert_eq!(view(&s, 2), Some((Some(2), DestView::Xyz { left: Some(72.0), top: Some(300.0), zoom: None })));++ // A position that is not a number fails the edit, which then changes nothing.+ for (left, top) in [(Some(f64::NAN), None), (None, Some(f64::INFINITY))] {+ assert!(matches!(add(&mut s, "Bad", 0, left, top), Err(EditError::Bookmark(_))), "{left:?} {top:?}");+ }+ assert_eq!(s.get(id).unwrap().info.outline.len(), 3);+ assert_eq!(s.get(id).unwrap().can_undo(), Some("Add bookmark"));++ s.undo(id).unwrap();+ assert_eq!(s.get(id).unwrap().info.outline.len(), 2);+ s.redo(id).unwrap();+ let saved = s.save_bytes(id).unwrap();+ let mut again = Session::new();+ let id2 = again.open("again.pdf", None, saved, None).unwrap();+ let outline = &again.get(id2).unwrap().info.outline;+ assert_eq!(outline[2].view, DestView::Xyz { left: Some(72.0), top: Some(300.0), zoom: None });+ assert_eq!(outline[1].view, DestView::Xyz { left: None, top: Some(500.5), zoom: None });+}++/// #3470: a filled form whose writer left the appearances to the viewer (`/NeedAppearances`):+/// field A has an empty appearance, B none. The page as displayed (and printed) shows both+/// values, and a comment without an appearance beside them still gets its own; the file itself+/// is not changed, so saving writes it as it was.+#[test]+fn fields_left_to_the_viewer_are_displayed_from_their_values() {+ let pdf = |need: bool| {+ let flag = if need { "/NeedAppearances true " } else { "" };+ format!(+ "%PDF-1.7\n\+ 1 0 obj << /Type /Catalog /Pages 2 0 R /AcroForm 5 0 R >> endobj\n\+ 2 0 obj << /Type /Pages /Kids [3 0 R] /Count 1 >> endobj\n\+ 3 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 400 200] /Annots [6 0 R 7 0 R 10 0 R] >> endobj\n\+ 10 0 obj << /Type /Annot /Subtype /Square /Rect [360 20 390 50] /C [1 0 0] /BS << /W 4 >> >> endobj\n\+ 5 0 obj << /Fields [6 0 R 7 0 R] {flag}/DA (/Helv 0 Tf 0 g) /DR << /Font << /Helv 8 0 R >> >> >> endobj\n\+ 6 0 obj << /Type /Annot /Subtype /Widget /FT /Tx /T (a) /V (MMMMMMMM) /DA (/Helv 12 Tf 0 g) /Rect [50 120 350 140] /F 4 /P 3 0 R /AP << /N 9 0 R >> >> endobj\n\+ 7 0 obj << /Type /Annot /Subtype /Widget /FT /Tx /T (b) /V (MMMMMMMM) /DA (/Helv 12 Tf 0 g) /Rect [50 60 350 80] /F 4 /P 3 0 R >> endobj\n\+ 8 0 obj << /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj\n\+ 9 0 obj << /Type /XObject /Subtype /Form /BBox [0 0 300 20] /Length 4 >> stream\nq\nQ\nendstream endobj\n\+ trailer << /Root 1 0 R >>\n%%EOF"+ )+ .into_bytes()+ };+ let red = |s: &Session, id: DocId| {+ let doc = s.get(id).unwrap();+ let mut r = pdfcraft_render::PageRenderer::new(doc.display.clone(), doc.config.clone());+ let page = r.render(pdfcraft_render::RenderRequest { page: 0, scale: 1.0, ..Default::default() });+ page.rgba.as_chunks::<4>().0.iter().filter(|p| p[0] > 200 && p[1] < 80 && p[2] < 80).count()+ };+ // Dark pixels inside a field's box (user-space rectangle, page drawn at scale 1).+ let ink = |s: &Session, id: DocId, y0: u32, y1: u32| {+ let doc = s.get(id).unwrap();+ let mut r = pdfcraft_render::PageRenderer::new(doc.display.clone(), doc.config.clone());+ let page = r.render(pdfcraft_render::RenderRequest { page: 0, scale: 1.0, ..Default::default() });+ let (px, _) = page.rgba.as_chunks::<4>();+ (200 - y1..200 - y0)+ .flat_map(|y| (55..345).map(move |x| (x, y)))+ .filter(|&(x, y)| px.get((y * page.width + x) as usize).is_some_and(|p| p[0] < 128))+ .count()+ };+ let mut s = Session::new();+ let id = s.open("form.pdf", None, Arc::new(pdf(true)), None).unwrap();+ let (a, b) = (ink(&s, id, 122, 138), ink(&s, id, 62, 78));+ assert!(a > 100 && b > 100, "both values are shown: a {a}, b {b}");+ assert!(red(&s, id) > 100, "the comment is drawn too");+ // The file is saved as it was: B still has no appearance, A its empty one.+ let saved = pdfcraft_cos::Document::open(s.save_bytes(id).unwrap()).unwrap();+ let fields = pdfcraft_forms::fields(&saved);+ let widget = |name: &str| saved.get(fields.iter().find(|f| f.name == name).unwrap().widgets[0].obj);+ assert!(widget("b").as_dict().is_some_and(|d| !d.contains(b"AP")), "B has no appearance");+ let n = widget("a").as_dict().and_then(|d| d.get(b"AP").and_then(|ap| saved.resolve(ap).as_dict().and_then(|ap| ap.reference(b"N")))).unwrap();+ let pdfcraft_cos::Object::Stream(n) = &*saved.get(n) else { panic!("A's appearance is a stream") };+ assert_eq!(n.decoded().unwrap().trim_ascii_end(), b"q\nQ", "A keeps its empty appearance");+ // Typing in one field redraws that field only, not the whole form, on each keystroke.+ let builds = |s: &Session| s.get(id).unwrap().editor.as_ref().unwrap().field_appearances.builds();+ let before = builds(&s);+ s.apply(id, Edit::SetFieldValue { name: "a".into(), value: pdfcraft_forms::FieldValue::Text("Typed".into()) }).unwrap();+ assert_eq!(builds(&s), before + 1);++ // Without the flag, the empty appearance is the file's own, and only B is drawn.+ let id = s.open("form.pdf", None, Arc::new(pdf(false)), None).unwrap();+ let (a, b) = (ink(&s, id, 122, 138), ink(&s, id, 62, 78));+ assert!(a == 0 && b > 100, "a {a}, b {b}");+}+ /// Reproducible workload with 3,129 fields and 190 ordered custom calculations.+ /// No external PDF assets are needed; only in-memory contributor-original objects.+ fn synthetic_acroform(field_count: usize, calculation_count: usize) -> Vec<u8> {+ use pdfcraft_cos::{Dict, Object, PdfString};+ let mut doc = pdfcraft_cos::Document::open(Arc::new(fixture(6))).unwrap();+ let mut refs = Vec::new();+ let mut order = Vec::new();+ for i in 0..field_count {+ let name = match i {+ 0 => "ranks".to_string(),+ 1 => "trained".to_string(),+ 2 => "bonus".to_string(),+ _ => format!("field{i}"),+ };+ let mut d = Dict::new();+ d.set(b"Type".to_vec(), Object::name("Annot"));+ d.set(b"Subtype".to_vec(), Object::name("Widget"));+ d.set(b"FT".to_vec(), Object::name(if i == 1 { "Btn" } else { "Tx" }));+ d.set(b"T".to_vec(), PdfString::text(&name));+ d.set(b"V".to_vec(), if i == 1 { Object::name("Off") } else { Object::String(PdfString::text("0")) });+ d.set(b"Rect".to_vec(), Object::Array([20, 20, 100, 40].map(Object::Int).to_vec()));+ d.set(b"P".to_vec(), Object::Ref(pdfcraft_cos::ObjRef::new(4, 0)));+ if (2..calculation_count + 2).contains(&i) {+ let js = if i == 2 {+ "var r = Number(getField('ranks').value); event.value = r + (r > 0 && getField('trained').isBoxChecked(0) ? 3 : 0);".to_string()+ } else {+ format!("event.value = Number(getField('{}').value) + 1;", if i == 3 { "bonus".to_string() } else { format!("field{}", i - 1) })+ };+ let mut a = Dict::new();+ a.set(b"S".to_vec(), Object::name("JavaScript"));+ a.set(b"JS".to_vec(), PdfString::text(&js));+ let mut aa = Dict::new();+ aa.set(b"C".to_vec(), Object::Dict(a));+ d.set(b"AA".to_vec(), Object::Dict(aa));+ }+ let r = doc.add(Object::Dict(d));+ refs.push(Object::Ref(r));+ if (2..calculation_count + 2).contains(&i) {+ order.push(Object::Ref(r));+ }+ }+ doc.update_dict(pdfcraft_cos::ObjRef::new(4, 0), |d| d.set(b"Annots".to_vec(), Object::Array(refs.clone()))).unwrap();+ let mut af = Dict::new();+ af.set(b"Fields".to_vec(), Object::Array(refs));+ af.set(b"CO".to_vec(), Object::Array(order));+ doc.update_dict(doc.root().unwrap(), |d| d.set(b"AcroForm".to_vec(), Object::Dict(af))).unwrap();+ pdfcraft_cos::write_incremental(&doc, &Default::default()).unwrap()+ }++ #[test]+ #[ignore = "manual performance measurement: 3,129 fields, 190 scripts"]+ fn acroform_interaction_benchmark() {+ let bytes = Arc::new(synthetic_acroform(3129, 190));+ // Optional local export for comparing CLI build profiles. Never overwrite an input.+ if let Some(path) = std::env::var_os("PDFCRAFT_BENCH_EXPORT") {+ use std::io::Write;+ let mut file = std::fs::OpenOptions::new().write(true).create_new(true).open(path).unwrap();+ file.write_all(&bytes).unwrap();+ }+ let mut s = Session::new();+ let id = s.open("synthetic-large-form.pdf", None, bytes, None).unwrap();+ let value = |s: &Session, name: &str| s.get(id).unwrap().form.iter().find(|f| f.name == name).unwrap().value.clone();+ for (name, v) in [+ ("ranks", FieldValue::Text("1".into())),+ ("trained", FieldValue::Check(true)),+ ("ranks", FieldValue::Text("2".into())),+ ("trained", FieldValue::Check(false)),+ ("ranks", FieldValue::Text("0".into())),+ ] {+ let started = std::time::Instant::now();+ s.apply(id, Edit::SetFieldValue { name: name.into(), value: v }).unwrap();+ eprintln!("BENCH {name}: {:.3} ms", started.elapsed().as_secs_f64() * 1000.0);+ assert!(s.take_js_output(id).errors.is_empty());+ }+ assert_eq!(value(&s, "bonus"), ["0"]);+ assert_eq!(value(&s, "field191"), ["189"]);+ assert_eq!(value(&s, "field3128"), ["0"]);+ }++ #[test]+ fn checkbox_and_rank_changes_recalculate_ordered_dependents() {+ let mut s = Session::new();+ let id = s.open("skills.pdf", None, Arc::new(synthetic_acroform(8, 4)), None).unwrap();+ for (name, input, bonus) in [+ ("trained", FieldValue::Check(true), "0"),+ ("ranks", FieldValue::Text("1".into()), "4"),+ ("trained", FieldValue::Check(false), "1"),+ ("ranks", FieldValue::Text("2".into()), "2"),+ ("trained", FieldValue::Check(true), "5"),+ ("ranks", FieldValue::Text("0".into()), "0"),+ ] {+ s.apply(id, Edit::SetFieldValue { name: name.into(), value: input }).unwrap();+ let fields = &s.get(id).unwrap().form;+ let value = |name: &str| fields.iter().find(|f| f.name == name).unwrap().value.clone();+ assert_eq!(value("bonus"), [bonus]);+ assert_eq!(value("field5"), [(bonus.parse::<u32>().unwrap() + 3).to_string()]);+ assert_eq!(value("field7"), ["0"]);+ assert!(s.take_js_output(id).errors.is_empty());+ }+ s.undo(id).unwrap();+ assert_eq!(s.get(id).unwrap().form.iter().find(|f| f.name == "bonus").unwrap().value, ["5"]);+ let saved = s.save_bytes(id).unwrap();+ let reopened = s.open("saved.pdf", None, saved, None).unwrap();+ assert_eq!(s.get(reopened).unwrap().form.iter().find(|f| f.name == "bonus").unwrap().value, ["5"]);+ let appearance = |s: &Session| {+ let doc = s.get(id).unwrap();+ let widget = doc.form.iter().find(|f| f.name == "bonus").unwrap().widgets.first().unwrap().obj;+ doc.editor.as_ref().unwrap().cos.get(widget).as_dict().unwrap().get(b"AP").cloned()+ };+ let before = appearance(&s);+ assert!(before.is_some());+ s.apply(id, Edit::SetFieldValue { name: "field7".into(), value: FieldValue::Text("9".into()) }).unwrap();+ assert_eq!(appearance(&s), before, "unchanged calculated values keep their appearance streams");+ }++ #[test]+ fn dynamic_calculation_reads_and_side_effects_reach_later_fields() {+ use pdfcraft_cos::{Dict, Object, PdfString};+ let mut cos = pdfcraft_cos::Document::open(Arc::new(synthetic_acroform(8, 4))).unwrap();+ let fields = pdfcraft_forms::fields(&cos);+ let bonus = fields.iter().find(|f| f.name == "bonus").unwrap();+ let selector = fields.iter().find(|f| f.name == "field7").unwrap();+ cos.update_dict(selector.obj, |d| d.set(b"V".to_vec(), PdfString::text("ranks"))).unwrap();+ let mut a = Dict::new();+ a.set(b"S".to_vec(), Object::name("JavaScript"));+ a.set(b"JS".to_vec(), PdfString::text(+ "var key = getField('field7').value; var v = Number(getField(key).value); getField('field6').value = v * 2; getField('field6').readonly = true; event.value = v + 1;"+ ));+ let mut aa = Dict::new();+ aa.set(b"C".to_vec(), Object::Dict(a));+ cos.update_dict(bonus.obj, |d| d.set(b"AA".to_vec(), Object::Dict(aa))).unwrap();+ let bytes = pdfcraft_cos::write_incremental(&cos, &Default::default()).unwrap();+ let mut s = Session::new();+ let id = s.open("dynamic.pdf", None, Arc::new(bytes), None).unwrap();+ s.apply(id, Edit::SetFieldValue { name: "ranks".into(), value: FieldValue::Text("4".into()) }).unwrap();+ let fields = &s.get(id).unwrap().form;+ let field = |name: &str| fields.iter().find(|f| f.name == name).unwrap();+ assert_eq!(field("bonus").value, ["5"]);+ assert_eq!(field("field5").value, ["8"], "later calculations see the ordered result");+ assert_eq!(field("field6").value, ["8"], "side-effect value applied");+ assert!(field("field6").read_only(), "side-effect property applied");+ assert_eq!(field("field7").value, ["ranks"]);+ assert!(s.take_js_output(id).errors.is_empty());+ }++ #[test]+ fn scripted_display_changes_survive_warm_cache_and_new_edit() {+ use pdfcraft_forms::{FieldEvent, Scripts};+ let mut cos = pdfcraft_cos::Document::open(Arc::new(synthetic_acroform(2, 0))).unwrap();+ for (display, flags) in [(1, 6), (3, 36), (2, 0), (0, 4)] {+ let fields = pdfcraft_forms::fields(&cos);+ let target = fields.iter().find(|f| f.name == "ranks").unwrap();+ let other = fields.iter().find(|f| f.name == "trained").unwrap();+ let old_display = crate::js::field_state(&cos, other).display;+ let mut runner = crate::js::JsRunner::new(&cos, "synthetic.pdf");+ // Populate the display cache before a script writes the same field.+ let warm = runner.run(FieldEvent::Calculate, "event.value = getField('trained').display;", target, "", &fields);+ assert_eq!(warm.value, old_display.to_string());+ let result = runner.run(+ FieldEvent::Calculate,+ &format!("getField('trained').display = {display}; event.value = getField('trained').display;"),+ target,+ "",+ &fields,+ );+ assert_eq!(result.value, display.to_string());+ assert_eq!(result.changes.len(), 1);+ assert_eq!(result.changes.first().unwrap().display, Some(display));+ pdfcraft_forms::apply_script_changes(&mut cos, &result.changes, &mut pdfcraft_forms::NoScripts).unwrap();+ assert_eq!(cos.get(other.widgets.first().unwrap().obj).as_dict().unwrap().int(b"F").unwrap() & 38, flags);+ // Within an edit the original implementation reads an immutable pre-edit COS snapshot.+ let same_edit = runner.run(FieldEvent::Calculate, "event.value = getField('trained').display;", target, "", &fields);+ assert_eq!(same_edit.value, old_display.to_string());+ // The next edit must rebuild its cache from the newly written annotation flags.+ let mut next = crate::js::JsRunner::new(&cos, "synthetic.pdf");+ let read = next.run(FieldEvent::Calculate, "event.value = getField('trained').display;", target, "", &pdfcraft_forms::fields(&cos));+ assert_eq!(read.value, display.to_string());+ assert!(read.changes.is_empty());+ assert!(runner.output.errors.is_empty());+ assert!(next.output.errors.is_empty());+ }+ }diff --cc docs/gaps.mdindex 494de43fa,b201a17fe..96869e3b1--- a/docs/gaps.md+++ b/docs/gaps.md@@@ -1,6 -1,7 +1,8 @@@# Where PdfCraft falls short of Acrobat Pro+> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-19 · **Change:** minor (gap 2: composite fonts with `/ToUnicode /Identity-H` read as Unicode, hayro-interpret patch 44; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)+ > **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** minor (gap 6 #3673: Character encoding CJK mapping routes corrected; no readiness re-estimate)+> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (gap 12: reading order is scored, not just word F1) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-14 · **Change:** minor (M1: raw-deflate fallback preserves decoding-limit errors; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-13 · **Change:** minor (gap 14: Vietnamese catalog shipped; Hindi/Indonesian/Korean and Arabic RTL remain) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)@@@ -387,8 -389,7 +394,9 @@@ update the numbers| Date | Change | Summary ||---|---|---|+| 2026-10-19 | minor | Gap 2: a Type 0 font whose `/ToUnicode` is the name `/Identity-H` or `/Identity-V` (WSCAD) reads its codes as Unicode, so such pages have text to select, find and edit (hayro-interpret patch 44, `view.render-cid-fonts`). Estimates unchanged. |+| 2026-10-15 | minor | Gap 21: the side-by-side view had already shipped; the Compare panel filters text changes and visual differences. Estimate 10–20 h → 8–16 h |+ | 2026-10-20 | minor | Gap 6 #3673: Character encoding accepts Identity-H/V with Adobe CJK collections, or a predefined non-Identity CMap; negative and indirect-reference regressions and a read-only automation test passed after failing before the fix. Per-glyph validation and embedded-font extraction remain separate. Scores and estimates unchanged. || 2026-10-15 | minor | Gap 12: the text oracle scores reading order as well as word F1, which is a bag of words and cannot see order; the first measurement separated 18 improvements from 6 regressions in a change F1 called unchanged on 26 of 29 files. Estimates unchanged. || 2026-10-14 | minor | M1: raw-deflate fallback preserves decoding-limit errors in strict and tolerant decoding; synthetic filter and COS stream regressions. Estimates unchanged. || 2026-10-15 | patch | Gap 24: record localization and installers as partial (unusable Chinese, Telugu and Arabic; unsigned Linux packages) |diff --cc docs/roadmap.mdindex 4d5b97812,2d7a63e32..738dbbda6--- a/docs/roadmap.md+++ b/docs/roadmap.md@@@ -1,20 -1,9 +1,21 @@@# PdfCraft roadmap: milestones and what's next+> **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** minor (M4: initial-view options resolve indirect boolean preferences; estimates unchanged)+> **Last reviewed:** 2026-10-21 · **Last updated:** 2026-10-21 · **Change:** minor (M3, #3808: the Pages inspector has an independent 50–150% thumbnail size slider and buttons; selection and current-page following are retained, with headless ui.set coverage. Estimates unchanged.)+> **Last reviewed:** 2026-10-20 | **Last updated:** 2026-10-20 | **Change:** minor (M2, #3574: named form properties retain page origin and own dictionary boundaries; estimates unchanged)++> **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** minor (M3, #3541/#3620: comment hover follows individual marked lines and original annotation paint order; estimates unchanged)+> **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** patch (PR #3348 review: retain short tracked punctuation in gap estimates; estimates unchanged)++> **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** minor (M2, #3601: missing spacing glyphs in non-embedded Japanese CID substitutes draw as blanks while PDF widths and Unicode stay unchanged; estimates unchanged)+> **Last reviewed:** 2026-10-20 | **Last updated:** 2026-10-20 | **Change:** minor (M10, #3532 partial: vector printing retains existing appearances with absent Subtype; estimates unchanged)+ > **Last reviewed:** 2026-10-20 · **Last updated:** 2026-10-20 · **Change:** minor (M12 #3673: Character encoding accepts Identity-H/V with Adobe CJK collections; estimates unchanged)> **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** minor (M5, PR #1971: bounded nested FDF export excludes source page/page-tree dictionaries; refreshed against upstream 4db6ac4a; estimates unchanged)+> **Last reviewed:** 2026-10-18 · **Last updated:** 2026-10-18 · **Change:** patch (M2 #3086: dotted TOC leaders no longer hide word spaces; estimates unchanged)+> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (M14/#2383 GPU-limit candidate; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)+> **Last reviewed:** 2026-10-20 - **Last updated:** 2026-10-20 - **Change:** minor (M6, #3502: form detection uses the existing content-stream boundary policy; estimates unchanged)> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (M7: the Edit text caret is as tall as the row it is on; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (M6: CSV tab-containing headers; estimates unchanged)> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-18 · **Change:** minor (M4, #1919: repeated page indices accumulate rotations; M4: indirect page rotations refreshed upstream; M13: CLI check visits each directory once through aliases and cycles; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)@@@ -64,10 -50,7 +65,11 @@@> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (Traditional Chinese accessibility semantics and Taiwan form/table terminology; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-12 · **Change:** patch (M1 #1337: exhausted xref hints are repaired; allocation avoids overflow; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M6 #2892: Push-button normal labels are editable per widget through Options and form_set_props, independently of field names; rendering, undo/redo and incremental/full save/reopen are covered. Estimates unchanged)+> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M7 #3187: Added-image automation normalizes extreme signed rotation angles before combining them with the current orientation; integer bounds, history, pixels, save/reopen and MCP have regressions. Estimates unchanged)+> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M12 #2569: Growable multiline XFA text reflows after edits, with undo/redo, save/reopen and print coverage; oversized fields still become read-only page text. Structured-data synchronization warnings retain accepted whitespace without relayout from stale data. Estimates unchanged)+> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M12 #2572: Every repeated page-master button resolves its own field to the shared XFA click script, including print buttons. Estimates unchanged)+> **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M12 #2570: Dynamic XFA rich-text fields carry exData/maxLength into AcroForm MaxLen for reported and enforced Unicode character limits, retained after save/reopen. Estimates unchanged)+ > **Last reviewed:** 2026-10-18 - **Last updated:** 2026-10-18 - **Change:** minor (M4 #3309: bounded iterative named-destination pruning on page deletion; estimates unchanged)Forward-looking: the milestones, the current focus and what comes next. The parity numbers behindit are in [target-app-parity.md](target-app-parity.md), the ranked work list in [gaps.md](gaps.md),@@@ -148,7 -128,7 +150,8 @@@ total matches the parity estimate| M2 | Model, render, text | 200–350 | 15% | 130–230 | hayro bootstrap renderer (vendored patches); inspector predictor scratch is bounded by available input, and JPX sample rescaling handles 1–32 bits safely. Text extraction reaches word-F1 0.98 against pdftotext. Short same-line redraws split before placement rather than interleaving. A custom text match that ends on a reconstructed separator stops before the next glyph (#1315). Missing: model crate, fonts, DisplayList, renderer independent of hayro. Inspector page-label traversal and output are resource-bounded, with physical-number fallback warnings || M2 | Model, render, text | 200–350 | 15% | 130–230 | hayro bootstrap renderer (vendored patches); Lab Bradford adaptation uses LMS white-point ratios, covered by independent neutral/chromatic and direct/Indexed render oracles; inspector predictor scratch is bounded by available input, and JPX sample rescaling handles 1–32 bits safely. Text extraction reaches word-F1 0.98 against pdftotext. Short same-line redraws split before placement rather than interleaving. Missing: model crate, fonts, DisplayList, renderer independent of hayro. Inspector page-label traversal and output are resource-bounded, with physical-number fallback warnings. Literal page-label prefix whitespace is preserved; nine public-inspection cases cover prefix spaces, encodings and empty-prefix controls || M3 | Viewer app (native + web) | 80–150 | 90% | 10–20 | Acrobat-style shell, find, select, panels, tiles, web build, UI control channel for agents (opt-in). Missing: 60 fps test on a 500-page document, snapshot tests of every panel<br>Done since: fit visible, document title in the window; Linux middle-button scrolling; shared three-state theme preferences in the toolbar, View menu and control channel; numeric Linux portal events and idle wakeups completing #881, with native appearance inheritance retained (#446); late browser startup downloads preserve the current document and Save target (#171). |+| M4 | Engine, history, save, organize | 100–180 | 95% | 8–15 | Done:<br>- command registry (menus, shortcuts and palette all use it);<br>- undo/redo; incremental, atomic and encrypted saves;<br>- autosave and crash recovery;<br>- organize, combine, extract, split and insert-from-file, with identical fonts and images stored once;<br>- CLI `edit/combine/extract/split`.<br>Done since: Organize opens directly into the page overview, with checkbox selection, an editable page-range selection (#1092), and per-page rotate/delete controls; Combine files in its own tab (sortable, resizable columns; folders; early warnings; unlocking protected files), bookmark editing, page labels (Number pages), CLI `run`, Set Page Boxes, Crop tool, Duplicate pages, Ctrl+A / Cmd+A to select all pages in Organize, Replace pages, bookmarks from tagged headings. Extract and Split preserve shared Type 3 glyph resource graphs, retaining conservative pruning limits. Undo back to the opened or last saved file is clean; Revert opens that saved file after an undo; a later save appends to it so the saved revision stays in the file (#1310, #1311, #1312). Ctrl-drag (Option on macOS) on a grid thumbnail copies the pages into the drop gap, with a "+" badge and the copies selected (#2997). Initial-view window and interface options resolve indirect boolean preferences. Missing: page transitions, recovery on the web |+ | M4 | Engine, history, save, organize | 100–180 | 95% | 8–15 | Done:<br>- command registry (menus, shortcuts and palette all use it);<br>- undo/redo; incremental, atomic and encrypted saves;<br>- autosave and crash recovery;<br>- organize, combine, extract, split and insert-from-file, with identical fonts and images stored once;<br>- CLI `edit/combine/extract/split`.<br>Done since: Organize opens directly into the page overview, with checkbox selection, an editable page-range selection (#1092), and per-page rotate/delete controls; Combine files in its own tab (sortable, resizable columns; folders; early warnings; unlocking protected files), bookmark editing, page labels (Number pages), CLI `run`, Set Page Boxes, Crop tool, Duplicate pages, Ctrl+A / Cmd+A to select all pages in Organize, Replace pages, bookmarks from tagged headings. Extract and Split preserve shared Type 3 glyph resource graphs, retaining conservative pruning limits. Undo back to the opened or last saved file is clean; Revert opens that saved file after an undo; a later save appends to it so the saved revision stays in the file (#1310, #1311, #1312). Ctrl-drag (Option on macOS) on a grid thumbnail copies the pages into the drop gap, with a "+" badge and the copies selected (#2997). Done since: #3309: Stack-safe named-destination pruning visits shared/cyclic indirect nodes once, without a name-count limit. Synthetic deep-tree and 60,000-name tests verify deletion, surviving targets, undo/redo, both save modes and reopening. Missing: page transitions, recovery on the web || M4 | Engine, history, save, organize | 100–180 | 95% | 8–15 | Done:<br>- command registry (menus, shortcuts and palette all use it);<br>- undo/redo; incremental, atomic and encrypted saves;<br>- autosave and crash recovery;<br>- organize, combine, extract, split and insert-from-file, with identical fonts and images stored once;<br>- CLI `edit/combine/extract/split`.<br>Done since: Organize opens directly into the page overview, with checkbox selection, an editable page-range selection (#1092), and per-page rotate/delete controls; Combine files in its own tab (sortable, resizable columns; folders; early warnings; unlocking protected files), bookmark editing, page labels (Number pages), CLI `run`, Set Page Boxes, Crop tool, Duplicate pages, Ctrl+A / Cmd+A to select all pages in Organize, Replace pages, bookmarks from tagged headings. Extract and Split preserve shared Type 3 glyph resource graphs, retaining conservative pruning limits. Undo back to the opened or last saved file is clean; Revert opens that saved file after an undo; a later save appends to it so the saved revision stays in the file (#1310, #1311, #1312). Rotation queries and edits resolve indirect values on pages and ancestors. Refreshed against upstream `99941daa` (2026-10-15). Repeated page indices accumulate rotations from the latest local value (#1919); saved/reopened regressions retain inherited angles and siblings. Missing: page transitions, recovery on the web || M4 | Engine, history, save, organize | 100–180 | 95% | 8–15 | Done:<br>- command registry (menus, shortcuts and palette all use it);<br>- undo/redo; incremental, atomic and encrypted saves;<br>- autosave and crash recovery;<br>- organize, combine, extract, split and insert-from-file, with identical fonts and images stored once;<br>- CLI `edit/combine/extract/split`.<br>Done since: Organize opens directly into the page overview, with checkbox selection, an editable page-range selection (#1092), and per-page rotate/delete controls; Combine files in its own tab (sortable, resizable columns; folders; early warnings; unlocking protected files), bookmark editing, page labels (Number pages), CLI `run`, Set Page Boxes, Crop tool, Duplicate pages, Ctrl+A / Cmd+A to select all pages in Organize, Replace pages, bookmarks from tagged headings. Extract and Split preserve shared Type 3 glyph resource graphs, retaining conservative pruning limits. Undo back to the opened or last saved file is clean; Revert opens that saved file after an undo; a later save appends to it so the saved revision stays in the file (#1310, #1311, #1312). Rotation queries and edits resolve indirect values on pages and ancestors. Missing: page transitions, recovery on the web || M4 | Engine, history, save, organize | 100–180 | 95% | 8–15 | Done:<br>- command registry (menus, shortcuts and palette all use it);<br>- undo/redo; incremental, atomic and encrypted saves;<br>- autosave and crash recovery;<br>- organize, combine, extract, split and insert-from-file, with identical fonts and images stored once;<br>- CLI `edit/combine/extract/split`.<br>Done since: Organize opens directly into the page overview, with checkbox selection, an editable page-range selection (#1092), and per-page rotate/delete controls; Combine files in its own tab (sortable, resizable columns; folders; early warnings; unlocking protected files), bookmark editing, page labels (Number pages), CLI `run`, Set Page Boxes, Crop tool, Duplicate pages, Ctrl+A / Cmd+A to select all pages in Organize, Replace pages, bookmarks from tagged headings. Extract and Split preserve shared Type 3 glyph resource graphs, retaining conservative pruning limits. Missing: page transitions, recovery on the web M4: Insert-from-file preserves source bookmarks; integration tests retained with current main. |@@@ -170,17 -150,16 +173,19 @@@| M7 | Content editing (text, images, header/footer, watermark) | 250–500 | 20% | 100–180 | Done: header & footer, watermarks, backgrounds, Bates; added text and images that stay editable (move, resize, format, rotate, flip, crop, replace); links (Link tool, Link Properties, create from URLs, remove all). Missing: editing existing text and images in place (the longest pole), image/PDF watermarks || M8 | Security + redaction | 100–180 | 68% | 15–30 | Done: opening protected documents, permissions, Protect Using Password, Remove security; redaction (mark text/areas/pages, Search & Redact with patterns, apply removing glyphs, image pixels, vectors, XObject content, annotations and fields, verification, full rewrite on save); Remove hidden information and Sanitize.<br>Done since: redaction codes (U.S. FOIA and Privacy Act sets as overlay text, in Redaction properties and `redact_mark`). Redaction cleans indirect and form structure references, preserving surviving form tags. Redaction retires inherited resource dictionaries, so a parent `/Pages` can't keep a removed XObject reachable; unredacted pages are left untouched. Image redaction removes alternate images and unsupported masks only on affected images. Changed marked-content spans lose replacement descriptions; untouched spans keep theirs. Hidden-text cleanup retires unused named descriptions across inherited/shared page and form resources (64 focused tests and scoped Rust 1.96 Clippy/wasm checks pass; publication CI pending). Missing: certificate security, custom redaction code sets and pattern locales, DCT re-encoding || M9 | Signatures (PAdES, validation) | 160–280 | 60% | 40–70 | Done: new `sign` crate (DER, X.509, CMS, PKCS #12 on RustCrypto; aws-lc-rs for RSA private keys); PAdES B-B signing (visible, invisible, existing fields, certification with DocMDP); validation with trust store and changes-after-signing classification; self-signed digital IDs; Signatures panel, message bar, sign dialogs; agent tools. Checked with pdfsig and OpenSSL.<br>Done since: macOS Keychain and Windows Current User Personal store signing (software-backed CNG keys), certificate viewer, signed documents protected from rewrites, page validation overlays separate from original signature artwork (baked Not Verified captions remain; #79 open), snapshot tabs that reuse instead of multiplying. Missing: timestamps (B-T), LTV (DSS, OCSP, CRL), FieldMDP, smart cards, PKCS #11 |-| M10 | OCR, create, export, print | 200–350 | 33% | 120–215 | Done: create from blank/text/PNG/JPEG/TIFF (multi-page)/GIF/BMP; export PNG/JPEG/TIFF and text; Print (Acrobat's sizing, n-up, booklet, poster, comments & forms, preview, the CUPS and Windows spoolers, print-ready PDF).<br>Done since: embedded/72/custom DPI choices for image imports; export all images; OCR (searchable image for pages, ranges and multiple files); single-sided cut-and-stack imposition with cut marks, through Print and doc_print; architectural/ANSI/large ISO sheet presets, Match page at 100% and PDF-scale preview (#599 follow-up); Create PDF from multiple files (PDFs, images and text, edited as pages in the grid); OCR can also read pictures on pages that have text, without adding that text twice (#1028). Done since: Word invoice export uses borderless inferred tables, floating positioned text/artwork only where text overlaps an image or is rotated, and per-page sizes, covered by synthetic invoice automation regressions (#773); printing on the web through the browser's print dialog, sheets drawn by PdfCraft (gap 4). Lossless image export applies per-component Decode, including Indexed mapping (#1201 partial). Existing 16-bit precision and color-management limits remain. #3120: Office export reads form XObjects 50 levels deep, as the renderer does, and up to 50 000 a page; pages past that are listed in `truncated_pages`. Missing: OCR languages beyond Latin, editable-text OCR output, full Office layout fidelity/import |+| M10 | OCR, create, export, print | 200–350 | 33% | 120–215 | Done: create from blank/text/PNG/JPEG/TIFF (multi-page)/GIF/BMP; export PNG/JPEG/TIFF and text; Print (Acrobat's sizing, n-up, booklet, poster, comments & forms, preview, the CUPS and Windows spoolers, print-ready PDF).<br>Done since: embedded/72/custom DPI choices for image imports; export all images; OCR (searchable image for pages, ranges and multiple files); single-sided cut-and-stack imposition with cut marks, through Print and doc_print; architectural/ANSI/large ISO sheet presets, Match page at 100% and PDF-scale preview (#599 follow-up); Create PDF from multiple files (PDFs, images and text, edited as pages in the grid); OCR can also read pictures on pages that have text, without adding that text twice (#1028). Done since: Word invoice export uses borderless inferred tables, floating positioned text/artwork only where text overlaps an image or is rotated, and per-page sizes, covered by synthetic invoice automation regressions (#773); printing on the web through the browser's print dialog, sheets drawn by PdfCraft (gap 4). Lossless image export applies per-component Decode, including Indexed mapping (#1201 partial). Existing 16-bit precision and color-management limits remain. #3532 partial: vector printing retains existing appearances with absent Subtype through a print-owned Form copy; source artwork stays unchanged. #3120: Office export reads form XObjects 50 levels deep, as the renderer does, and up to 50 000 a page; pages past that are listed in `truncated_pages`. Missing: OCR languages beyond Latin, editable-text OCR output, full Office layout fidelity/import #2156 candidate: last selected print paper persists across sessions; other print preferences unchanged. || M11 | Optimize, preflight, PDF/A/X/UA, print production | 200–350 | 18% | 80–140 | Done: new `optimize` crate: Reduce File Size and the PDF Optimizer (images measured where drawn, bicubic downsampling, JPEG/ZIP recompression only when smaller, discard objects and user data, Flate clean-up, resource merging, object streams). Missing: fonts and transparency panels, space audit, preflight, PDF/A/X/UA |-| M12 | Accessibility, compare, measure, search, XFA | 200–380 | 30% | 90–160 | Done: new `a11y` crate with the Accessibility Checker (all 32 rules, report, Fix/Skip/Explain, options dialog and results panel, agent tools). Locatable figure, annotation and form findings highlight their page bounds. Character encoding accepts Identity-H/V with Adobe CJK collections and predefined CJK CMaps independently (#3673); per-glyph validation and embedded-font extraction remain separate.<br>Done since: 2D distance, perimeter and area measurements with persistent viewport calibration, snapping, live information and CSV export; a bounded, text-only auto-tag proposal tool for one page. Marking a figure decorative rewrites only that stream (#1324). An XFA radio item whose value contains a space is written back unchanged (#1319). Missing: writing proposed tags and parent tree, field autotag, visual Tags/Order/Content panels, Reading Order tool, compare, geospatial/3D measurement, search index, XFA |+| M12 | Accessibility, compare, measure, search, XFA | 200–380 | 30% | 90–160 | Done: new `a11y` crate with the Accessibility Checker (all 32 rules, report, Fix/Skip/Explain, options dialog and results panel, agent tools). Locatable figure, annotation and form findings highlight their page bounds.<br>Done since: 2D distance, perimeter and area measurements with persistent viewport calibration, snapping, live information and CSV export; a bounded, text-only auto-tag proposal tool for one page. Marking a figure decorative rewrites only that stream (#1324). An XFA radio item whose value contains a space is written back unchanged (#1319). Missing: writing proposed tags and parent tree, field autotag, visual Tags/Order/Content panels, Reading Order tool, compare, geospatial/3D measurement, search index, XFA<br>Reading colours: pending page backgrounds follow the configured colour (#2059). |+| M12 | Accessibility, compare, measure, search, XFA | 200–380 | 30% | 90–160 | Done: new `a11y` crate with the Accessibility Checker (all 32 rules, report, Fix/Skip/Explain, options dialog and results panel, agent tools). Locatable figure, annotation and form findings highlight their page bounds.<br>Done since: 2D distance, perimeter and area measurements with persistent viewport calibration, snapping, live information and CSV export; a bounded, text-only auto-tag proposal tool for one page. Marking a figure decorative rewrites only that stream (#1324). An XFA radio item whose value contains a space is written back unchanged (#1319). Done since: #2569: Growable multiline XFA text reflows after edits, with undo/redo, save/reopen and print coverage; oversized fields still become read-only page text. Structured-data synchronization warnings retain accepted whitespace without relayout from stale data. Done since: #2572: Every repeated page-master button resolves its own field to the shared XFA click script, including print buttons. Done since: #2570: Dynamic XFA rich-text fields carry exData/maxLength into AcroForm MaxLen for reported and enforced Unicode character limits, retained after save/reopen. Missing: writing proposed tags and parent tree, field autotag, visual Tags/Order/Content panels, Reading Order tool, compare, geospatial/3D measurement, search index, XFA || M13 | Automation (MCP, Action Wizard, CLI) + AI providers | 60–120 | 45% | 25–45 | Done: MCP resources (document info, text, page images); headless tool table (123 tools incl. signing, optimizing, initial view, links, stamps, data exchange, comment review, forms authoring and scripts, redaction, sanitize, print, add content), opt-in MCP server over stdio, CLI `run`/`tools` (closed stdout pipes exit cleanly), UI control channel with drag. Missing: Action Wizard, AI providers<br>Done since: CLI run and MCP reject missing, empty, repeated and option-valued --root arguments before any tool/script execution or MCP initialization. A single-hyphen directory name remains valid; synthetic CLI regressions preserve a would-be overwritten file. `text_find` also caps the per-page match ranges it materializes at the remaining result limit plus one continuation match. CLI robustness scans visit each directory once through overlapping roots and symlink aliases. |+| M12 | Accessibility, compare, measure, search, XFA | 200–380 | 30% | 90–160 | Done: new `a11y` crate with the Accessibility Checker (all 32 rules, report, Fix/Skip/Explain, options dialog and results panel, agent tools). Locatable figure, annotation and form findings highlight their page bounds.<br>Done since: 2D distance, perimeter and area measurements with persistent viewport calibration, snapping, live information and CSV export; a bounded text-only auto-tag proposal tool; text-only Apply writes marked content, paragraph tags and a parent tree, then opens the Tags panel for review. Missing: mixed-content and field autotag, heading/list/table/figure classification, Order/Content panels, Reading Order tool, compare, geospatial/3D measurement, search index, XFA<br>Done since: CLI info, text and render use dynamic XFA layout pages, with synthetic count/text/pixel and copy-permission regressions (#1645).<br>Reading colours: pending page backgrounds follow the configured colour (#2059). |++| M12 | Accessibility, compare, measure, search, XFA | 200–380 | 30% | 90–160 | Done: new `a11y` crate with the Accessibility Checker (all 32 rules, report, Fix/Skip/Explain, options dialog and results panel, agent tools). Locatable figure, annotation and form findings highlight their page bounds. Character encoding accepts Identity-H/V with Adobe CJK collections and predefined CJK CMaps independently (#3673); per-glyph validation and embedded-font extraction remain separate.<br>Done since: 2D distance, perimeter and area measurements with persistent viewport calibration, snapping, live information and CSV export; a bounded, text-only auto-tag proposal tool for one page. Marking a figure decorative rewrites only that stream (#1324). An XFA radio item whose value contains a space is written back unchanged (#1319). Missing: writing proposed tags and parent tree, field autotag, visual Tags/Order/Content panels, Reading Order tool, compare, geospatial/3D measurement, search index, XFA |+ | M12 | Accessibility, compare, measure, search, XFA | 200–380 | 30% | 90–160 | Done: new `a11y` crate with the Accessibility Checker (all 32 rules, report, Fix/Skip/Explain, options dialog and results panel, agent tools). Locatable figure, annotation and form findings highlight their page bounds. Character encoding accepts Identity-H/V with Adobe CJK collections and predefined CJK CMaps independently (#3673); per-glyph validation and embedded-font extraction remain separate.<br>Done since: 2D distance, perimeter and area measurements with persistent viewport calibration, snapping, live information and CSV export; a bounded text-only auto-tag proposal tool; text-only Apply writes marked content, paragraph tags and a parent tree, then opens the Tags panel for review. Missing: mixed-content and field autotag, heading/list/table/figure classification, Order/Content panels, Reading Order tool, compare, geospatial/3D measurement, search index, XFA<br>Done since: CLI info, text and render use dynamic XFA layout pages, with synthetic count/text/pixel and copy-permission regressions (#1645). || M13 | Automation (MCP, Action Wizard, CLI) + AI providers | 60–120 | 45% | 25–45 | Done: MCP resources (document info, text, page images); headless tool table (123 tools incl. signing, optimizing, initial view, links, stamps, data exchange, comment review, forms authoring and scripts, redaction, sanitize, print, add content), opt-in MCP server over stdio, CLI `run`/`tools` (closed stdout pipes exit cleanly), UI control channel with drag. Missing: Action Wizard, AI providers<br>Done since: CLI run and MCP reject missing, empty, repeated and option-valued --root arguments before any tool/script execution or MCP initialization. A single-hyphen directory name remains valid; synthetic CLI regressions preserve a would-be overwritten file. `text_find` also caps the per-page match ranges it materializes at the remaining result limit plus one continuation match. |-| M14 | 1.0 polish: performance, localization, installers | 120–250 | 15% | 80–150 | Done: PhotoCraft's translation system (`i18n/`: TSV catalogs, `tl!`, command-id and plural entries, system-language detection, strict catalog tests); every dialog, panel and notice goes through `tl!`. Catalogs of ≈ 2,000–2,140 entries for Japanese, Simplified and Traditional Chinese, Russian, Bulgarian, German, Spanish, French, Telugu, Hungarian, Ukrainian, Brazilian Portuguese and Arabic (logical-order catalog put into display order; layout not yet mirrored); Czech covers the menus. Italian has 2,528 entries: every key of the other catalogs that the code looks up. Signed and notarized macOS builds, signed Windows installers (x64, x86, ARM64), AppImage, deb, rpm, Flatpak and FreeBSD packages. #307 (bounded large-PDF memory): shared resource indexes and parser metadata, lazy inspection, bounded caches; a 9,156-page file inspects in ≈ 1.8 s at ≈ 500 MiB instead of exceeding 10 GiB. Edits let go of the previous working file before writing the next (a 1 GiB file peaks at two copies while editing, not three; gap 13). Shortcut display uses localized modifier/key names across menus, toolbar, palette, Help and tooltips (#496). Lithuanian adds a 2,578-entry catalog and date names, reviewed by a native-speaking contributor. Validated candidate (macOS raster probe; Windows runtime unverified): the Windows policy changes only embedded JetBrains Mono; horizontal alpha-edge energy per ink improves 2.78%, 3.87% and 1.59% at 100%, 125% and 150%, and is down 0.79% at 200%. Inter is pixel-identical; layout hashes, glyph coverage and the 8 MiB atlas are unchanged. Timing and RSS ranges overlap, with no improvement claimed. Estimates unchanged. Candidate #2383 clamps GPU requests to supported limits while retaining the adapter texture extent; synthetic V3D/downlevel and Windows GPU-required tests pass, but Raspberry Pi startup is unverified. Estimates unchanged. Missing: a right-to-left layout, a Chinese UI face in releases, Hindi/Indonesian/Korean/Vietnamese, file-backed input and global memory budgets, performance budgets, keyboard-only operation Linux/Unix UI fallback fonts also use Fontconfig directories, including Nix store paths, with bounded discovery and the existing candidate allowlist; relative includes and digit-prefixed config filtering have isolated regressions. |-| M14 | 1.0 polish: performance, localization, installers | 120–250 | 15% | 80–150 | Done: PhotoCraft's translation system (`i18n/`: TSV catalogs, `tl!`, command-id and plural entries, system-language detection, strict catalog tests); every dialog, panel and notice goes through `tl!`. Catalogs of ≈ 2,000–2,140 entries for Japanese, Simplified and Traditional Chinese, Russian, Bulgarian, German, Spanish, French, Telugu, Hungarian, Ukrainian, Brazilian Portuguese and Arabic (logical-order catalog put into display order; layout not yet mirrored); Czech covers the menus. Italian has 2,528 entries: every key of the other catalogs that the code looks up. Signed and notarized macOS builds, signed Windows installers (x64, x86, ARM64), AppImage, deb, rpm, Flatpak and FreeBSD packages. #307 (bounded large-PDF memory): shared resource indexes and parser metadata, lazy inspection, bounded caches; a 9,156-page file inspects in ≈ 1.8 s at ≈ 500 MiB instead of exceeding 10 GiB. Edits let go of the previous working file before writing the next (a 1 GiB file peaks at two copies while editing, not three; gap 13). Shortcut display uses localized modifier/key names across menus, toolbar, palette, Help and tooltips (#496). Lithuanian adds a 2,578-entry catalog and date names, reviewed by a native-speaking contributor. Validated candidate (macOS raster probe; Windows runtime unverified): the Windows policy changes only embedded JetBrains Mono; horizontal alpha-edge energy per ink improves 2.78%, 3.87% and 1.59% at 100%, 125% and 150%, and is down 0.79% at 200%. Inter is pixel-identical; layout hashes, glyph coverage and the 8 MiB atlas are unchanged. Timing and RSS ranges overlap, with no improvement claimed. Estimates unchanged. Missing: a right-to-left layout, a Chinese UI face in releases, Hindi/Indonesian/Korean/Vietnamese, file-backed input and global memory budgets, performance budgets, keyboard-only operation XDG desktops use the configuration base for preferences with non-overwriting migration and original-data preservation (#1395). |+| M14 | 1.0 polish: performance, localization, installers | 120–250 | 15% | 80–150 | Done: PhotoCraft's translation system (`i18n/`: TSV catalogs, `tl!`, command-id and plural entries, system-language detection, strict catalog tests); every dialog, panel and notice goes through `tl!`. Catalogs of ≈ 2,000–2,140 entries for Japanese, Simplified and Traditional Chinese, Russian, Bulgarian, German, Spanish, French, Telugu, Hungarian, Ukrainian and Arabic (logical-order catalog put into display order; layout not yet mirrored); the 2,674-entry Brazilian Portuguese catalog covers the current key union; Czech covers the menus. Italian has 2,528 entries: every key of the other catalogs that the code looks up. Signed and notarized macOS builds, signed Windows installers (x64, x86, ARM64), AppImage, deb, rpm, Flatpak and FreeBSD packages. #307 (bounded large-PDF memory): shared resource indexes and parser metadata, lazy inspection, bounded caches; a 9,156-page file inspects in ≈ 1.8 s at ≈ 500 MiB instead of exceeding 10 GiB. Edits let go of the previous working file before writing the next (a 1 GiB file peaks at two copies while editing, not three; gap 13). Shortcut display uses localized modifier/key names across menus, toolbar, palette, Help and tooltips (#496). Lithuanian adds a 2,578-entry catalog and date names, reviewed by a native-speaking contributor. Validated candidate (macOS raster probe; Windows runtime unverified): the Windows policy changes only embedded JetBrains Mono; horizontal alpha-edge energy per ink improves 2.78%, 3.87% and 1.59% at 100%, 125% and 150%, and is down 0.79% at 200%. Inter is pixel-identical; layout hashes, glyph coverage and the 8 MiB atlas are unchanged. Timing and RSS ranges overlap, with no improvement claimed. Estimates unchanged. Candidate #2383 clamps GPU requests to supported limits while retaining the adapter texture extent; synthetic V3D/downlevel and Windows GPU-required tests pass, but Raspberry Pi startup is unverified. Estimates unchanged. Missing: a right-to-left layout, a Chinese UI face in releases, Hindi/Indonesian/Korean, file-backed input and global memory budgets, performance budgets, keyboard-only operation Linux/Unix UI fallback fonts also use Fontconfig directories, including Nix store paths, with bounded discovery and the existing candidate allowlist; relative includes and digit-prefixed config filtering have isolated regressions. |+| M14 | 1.0 polish: performance, localization, installers | 120–250 | 15% | 80–150 | Done: PhotoCraft's translation system (`i18n/`: TSV catalogs, `tl!`, command-id and plural entries, system-language detection, strict catalog tests); every dialog, panel and notice goes through `tl!`. Catalogs of ≈ 2,000–2,140 entries for Japanese, Simplified and Traditional Chinese, Russian, Bulgarian, German, Spanish, French, Telugu, Hungarian, Ukrainian and Arabic (logical-order catalog put into display order; layout not yet mirrored); the 2,674-entry Brazilian Portuguese catalog covers the current key union; Czech covers the menus. Italian has 2,528 entries: every key of the other catalogs that the code looks up. Signed and notarized macOS builds, signed Windows installers (x64, x86, ARM64), AppImage, deb, rpm, Flatpak and FreeBSD packages. #307 (bounded large-PDF memory): shared resource indexes and parser metadata, lazy inspection, bounded caches; a 9,156-page file inspects in ≈ 1.8 s at ≈ 500 MiB instead of exceeding 10 GiB. Edits let go of the previous working file before writing the next (a 1 GiB file peaks at two copies while editing, not three; gap 13). Shortcut display uses localized modifier/key names across menus, toolbar, palette, Help and tooltips (#496). Lithuanian adds a 2,578-entry catalog and date names, reviewed by a native-speaking contributor. Validated candidate (macOS raster probe; Windows runtime unverified): the Windows policy changes only embedded JetBrains Mono; horizontal alpha-edge energy per ink improves 2.78%, 3.87% and 1.59% at 100%, 125% and 150%, and is down 0.79% at 200%. Inter is pixel-identical; layout hashes, glyph coverage and the 8 MiB atlas are unchanged. Timing and RSS ranges overlap, with no improvement claimed. Estimates unchanged. Missing: a right-to-left layout, a Chinese UI face in releases, Hindi/Indonesian/Korean, file-backed input and global memory budgets, performance budgets, keyboard-only operation XDG desktops use the configuration base for preferences with non-overwriting migration and original-data preservation (#1395). || M13 | Automation (MCP, Action Wizard, CLI) + AI providers | 60–120 | 45% | 25–45 | Done: MCP resources (document info, text, page images); headless tool table (123 tools incl. signing, optimizing, initial view, links, stamps, data exchange, comment review, forms authoring and scripts, redaction, sanitize, print, add content), opt-in MCP server over stdio, CLI `run`/`tools` (closed stdout pipes exit cleanly), UI control channel with drag. Missing: Action Wizard, AI providers |-| M14 | 1.0 polish: performance, localization, installers | 120–250 | 15% | 80–150 | Done: PhotoCraft's translation system (`i18n/`: TSV catalogs, `tl!`, command-id and plural entries, system-language detection, strict catalog tests); every dialog, panel and notice goes through `tl!`. Catalogs of ≈ 2,000–2,140 entries for Japanese, Simplified and Traditional Chinese, Russian, Bulgarian, German, Spanish, French, Telugu, Hungarian, Ukrainian, Brazilian Portuguese and Arabic (logical-order catalog put into display order; layout not yet mirrored); Czech covers the menus. Italian has 2,528 entries: every key of the other catalogs that the code looks up. Signed and notarized macOS builds, signed Windows installers (x64, x86, ARM64), AppImage, deb, rpm, Flatpak and FreeBSD packages. #307 (bounded large-PDF memory): shared resource indexes and parser metadata, lazy inspection, bounded caches; a 9,156-page file inspects in ≈ 1.8 s at ≈ 500 MiB instead of exceeding 10 GiB. Edits let go of the previous working file before writing the next (a 1 GiB file peaks at two copies while editing, not three; gap 13). Shortcut display uses localized modifier/key names across menus, toolbar, palette, Help and tooltips (#496). Traditional Chinese accessibility statuses, rule semantics and Taiwan form/table terms have catalog regressions. Long main-menu lists scroll in short windows (#3373). Missing: a right-to-left layout, a Chinese UI face in releases, Hindi/Indonesian/Korean/Vietnamese, file-backed input and global memory budgets, performance budgets, keyboard-only operation |+| M14 | 1.0 polish: performance, localization, installers | 120–250 | 15% | 80–150 | Done: PhotoCraft's translation system (`i18n/`: TSV catalogs, `tl!`, command-id and plural entries, system-language detection, strict catalog tests); every dialog, panel and notice goes through `tl!`. Catalogs of ≈ 2,000–2,140 entries for Japanese, Simplified and Traditional Chinese, Russian, Bulgarian, German, Spanish, French, Telugu, Hungarian, Ukrainian and Arabic (logical-order catalog put into display order; layout not yet mirrored); the 2,674-entry Brazilian Portuguese catalog covers the current key union; Czech covers the menus. Italian has 2,528 entries: every key of the other catalogs that the code looks up. Signed and notarized macOS builds, signed Windows installers (x64, x86, ARM64), AppImage, deb, rpm, Flatpak and FreeBSD packages. #307 (bounded large-PDF memory): shared resource indexes and parser metadata, lazy inspection, bounded caches; a 9,156-page file inspects in ≈ 1.8 s at ≈ 500 MiB instead of exceeding 10 GiB. Edits let go of the previous working file before writing the next (a 1 GiB file peaks at two copies while editing, not three; gap 13). Shortcut display uses localized modifier/key names across menus, toolbar, palette, Help and tooltips (#496). Traditional Chinese accessibility statuses, rule semantics and Taiwan form/table terms have catalog regressions. Long main-menu lists scroll in short windows (#3373). Missing: a right-to-left layout, a Chinese UI face in releases, Hindi/Indonesian/Korean, file-backed input and global memory budgets, performance budgets, keyboard-only operation || | **Total** | **2,085–3,840** | **≈ 49% ready** | **≈ 770–1,400** | Area view of the same work: [target-app-parity.md](target-app-parity.md#by-feature-area) |## Upcoming milestones, ranked@@@ -228,14 -205,11 +233,16 @@@ M2 (renderer), M7 (content editing), M1| Date | Change | Summary ||---|---|---|+| 2026-10-20 | minor | M4: initial-view window and interface options resolve indirect boolean ViewerPreferences values; synthetic true/false and save/reopen regressions retain defaults for malformed entries. Estimates unchanged. |+| 2026-10-21 | minor | M3, #3808: the Pages inspector has an independent 50–150% thumbnail size slider and buttons; selection and current-page following are retained, with headless ui.set coverage. Estimates unchanged. || 2026-10-20 | minor | M6: Prepare a form ▸ Calculation order: formulas and values, what is wrong and Fix order, Up/Down, Alt+↑/↓ and drag, links on the page. Estimates unchanged. || 2026-10-20 | minor | M6: `form_calculation_order` reads, checks, fixes and sets the calculation order; an edited formula keeps its place in `/CO`. Estimates unchanged. |+ | 2026-10-20 | minor | M12 #3673: Character encoding accepts Identity-H/V with Adobe CJK collections, or a predefined non-Identity CMap; unknown names and foreign registries do not establish a mapping route. Synthetic checker and read-only automation regressions passed after failing before the fix. Per-glyph validation and embedded-font extraction remain separate; estimates unchanged. || 2026-10-19 | minor | M6: renaming a field renames it in the calculations that read it; `form_set_props` returns `formulas_updated` and Field Properties says how many changed. Estimates unchanged. |+| 2026-10-20 | minor | M6, #3502: form detection preserves comments across content streams; estimates unchanged. |+| 2026-10-20 | minor | M3/#3620: overlapping comment hover follows original annotation indices independently of spatial inspection sorting; a synthetic differing-upper-edge regression covers paint order. Estimates unchanged. |+| 2026-10-20 | minor | M10, #3532 partial: vector printing retains existing appearances with absent Subtype; estimates unchanged. |+ | 2026-10-19 | minor | M4 #3309: named-destination pruning keeps large documents usable; 60,000-name and deep-tree regressions verify targets through undo/redo and both save modes. Estimates unchanged. || 2026-10-18 | minor | M5, PR #1971: nested source `/Page` and `/Pages` dictionaries export as null without traversing page content or the page tree. Synthetic saved/reopened three-page regression retains unrelated metadata and aliases. FDF import semantics, copied-graph limits and estimates unchanged. || 2026-10-15 | minor | M5: budget retained FDF entries before cloning; discovery keeps lazy array owners and annotation positions, with alias/cache-eviction stress fixtures. Limits cover the copied graph; source parsing/page discovery retain existing COS/parser limits, with no total source-memory bound. FDF import semantics and estimates unchanged. || 2026-10-15 | minor | M7: Edit text caret height follows its row, with a kittest regression; estimates unchanged |