From 604ac6ddb2cef50e1cc0fd637ac839cee1d8d4db Mon Sep 17 00:00:00 2001 From: LQRD <86525503+LQRD@users.noreply.github.com> Date: Wed, 4 Nov 2026 19:29:12 +0500 Subject: [PATCH] #641: print N-up sheets and folded booklets (#3916) Co-Authored-By: Claude Opus 5.5 --- ROADMAP.md | 5 +- crates/engine/src/cmd/file.rs | 2 +- crates/engine/src/print.rs | 87 +++++++++- crates/pdf/src/export.rs | 118 +++++++++++--- crates/pdf/src/exporter.rs | 4 +- crates/pdf/src/exporter/nav.rs | 15 +- crates/pdf/src/imposition.rs | 190 ++++++++++++++++++++++ crates/pdf/src/lib.rs | 4 + crates/pdf/src/options.rs | 12 +- crates/pdf/src/tests.rs | 109 ++++++++++++- crates/ui-egui/src/i18n/audit.rs | 2 +- crates/ui-egui/src/print_page.rs | 160 +++++++++++++----- crates/ui-egui/src/printing.rs | 12 +- crates/ui-egui/src/tests.rs | 2 +- crates/ui-egui/tests/it/native_print.rs | 207 ++++++++++++++++++++++-- docs/control-protocol.md | 14 ++ docs/gaps.md | 7 +- docs/hardware-parity.md | 7 +- docs/ui-parity.md | 5 +- 19 files changed, 857 insertions(+), 105 deletions(-) create mode 100644 crates/pdf/src/imposition.rs diff --git a/ROADMAP.md b/ROADMAP.md index c321422a5f..d5f218116e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -4,7 +4,7 @@ **Stage: alpha** · next: beta, ~15 points (60% → 75% ready for real work) and ~150–230 h away -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** trivial (Print Markup comment discovery walks paragraph objects once, #3614); previously trivial (progress log: the dialogs of the mirrored Arabic interface read right to left: label-and-field rows, tables (list columns, the Models table), tile galleries and the Add/Remove arrows follow the reading direction, through one `rtl::Table` helper that draws exactly as before in English; no ranked gap closed, readiness estimates unchanged); previously trivial (progress log: fonts that aren't installed are flagged in the font box and status bar); previously trivial (progress log: Options › Language redesign, CP4.3); previously trivial (progress log: the missing-pack bar on a fresh install, the caret's typing language, and the spelling menu heading in the interface language, CP4.3); previously trivial (progress log: Language pack languages in every language list, CP4.3); previously trivial (progress log: craft-proof pin, French elision and Valencian, CP4.3); previously trivial (progress log: a long comment's card and balloon stop at ten lines, #3382); previously trivial (progress log: a pasted text box story is charged for the formatting it copies); previously trivial (progress log: a .doc table row keeps one override per cell); previously trivial (progress log: a .doc file's sections find their paragraphs by index); previously minor (Arabic interface language with mirrored UI, #1195); previously trivial (progress log: Replace and Remove Table of Contents with Word's title above a section break, #4041); previously trivial (progress log: a password-protected file named on the command line asks for its password after the startup document is replaced, #5299); previously trivial (progress log: language-packs-2 published and pinned, 75 Language packs); previously trivial (progress log: language-packs-1 published and pinned, CP4.4); previously trivial (progress log: Language packs, CP4);; previously trivial (DOCX table rows and cells inside selected alternate-content branches survive open and repeated saves (#5219); broader corpus qualification and readiness estimates unchanged); previously trivial (progress log: a list inside a Markdown block quote stays quoted); previously trivial (progress log: arrowheads keep their kind, width and length and are drawn at Word's sizes); previously trivial (progress log: the line between columns for selected text, #5178); previously trivial (progress log: .doc standard font, #5066); previously trivial (progress log: a table row doesn't split off a picture that doesn't fit, #4272); previously trivial (progress log: a middle or bottom cell of a row split across pages lines up on the first page); previously trivial (progress log: tab leader dots spaced and placed as in Word); previously trivial (progress log: a list level above counts its first number at the first deeper item); previously trivial (progress log: paragraph side borders lie outside the text, #5036); previously trivial (progress log: a paragraph naming an undefined style is formatted as Normal, #5077); previously trivial (progress log: TOC page numbers as PAGEREF fields, #5097); previously trivial (progress log: Backstage keytips, #4960); previously trivial (Progress log: only the printer's PDF leaves out links; Save these pages as PDF keeps them, #4734); previously trivial (progress log: Chinese and Japanese text counts a word per character, #4547; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (progress log: corporate authors in bibliographies, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (progress log: Table Properties follows the selection, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion walks reference offsets and formatting runs together, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (progress log: RTF pictures stored as Windows or Enhanced Metafiles are imported, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (progress log: Insert › Shapes icon grid, #4349); previously trivial (progress log: AutoCorrect Options with no document open, #4585); previously trivial (progress log: window fallback geometry and equation symbol tooltips); previously trivial (progress log: window titles omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (progress log: Custom document properties dialog, #2982; previously trivial: progress log: View › New Window; previously trivial: progress log: interface translations come from storytold/craft-i18n through the `craft-i18n` crate; previously trivial: progress log: disabled-control reasons translated in every interface language, #2678; previously trivial: progress log: mail merge record navigation and record ranges for printing, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: group connector rerouting preserves rotated and flipped free or unresolved endpoints under nonuniform group scaling; readiness estimates unchanged; previously trivial: progress log: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: progress log: a relationship the markup names without the prefix is read as it wrote, and an ordinary `id` names no part; previously trivial: progress log: a document with many relationships opens in the time its part takes, and an id the text only mentions is not a reference, #3411; previously trivial: progress log: read only and comments-only protection grey out edits; previously trivial: progress log: an empty paragraph with a hidden mark shows nothing, not even its list number, #3982; previously trivial: progress log: "NaN" in the Font dialog's Size box no longer closes the app, #3663; previously trivial: progress log: a table cell span from a `.json` file no longer overflows, #3637; previously trivial: progress log: a click in the footer while editing the header moves there; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Slovenian interface catalog, 2,614 entries; previously trivial: Insert Table of Figures dialog for any caption label, #3013; previously trivial: progress log: Home › Underline drop-down, #2738; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: progress log: the scrollbar page tip stays on one line, #3341; previously trivial: progress log: forms protection greys out the control buttons; previously trivial: progress log: a document with many content controls saves in the time the controls take, #13; previously trivial: progress log: Word signature lines kept on save; previously trivial: a Thai run with Latin finds one installed font covering it all on Linux too, #1549; previously trivial: progress log: closing the header returns to the body selection, #3331; previously trivial: progress log: saving to a NAS share mounted by GVFS, #3003; previously trivial: progress log: a picture dragged near the bottom of a page lands there, #3169; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: progress log: inline pictures drag to an insertion cursor and stay inline, #2233, #2234; previously trivial: progress log: a text file saved over itself closes without asking, #2376; previously trivial: progress log: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: fixed font inputs in four layout controls; previously trivial: typing no longer starts render threads on every repaint, #3027; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: progress log: banded rows shade as in Word, #3415; previously trivial: progress log: the table handles show while the caret is in the table, #2428; previously trivial: progress log: a click below a floating table reaches the text after it, #2038; previously trivial: progress log: Delete on selected table cells leaves one empty paragraph in each, #2802; previously trivial: progress log: lam-alef in exported PDFs extracts whole with fonts that draw it as two glyphs, #2310; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: progress log: a text box that keeps the keyboard no longer resets the input method every frame, #2986; previously trivial: progress log: recovery copies and .json files store pictures as base64, #586 follow-up; previously trivial: progress log: legacy menu keys, #1697; previously trivial: progress log: shape gradients and transparency, #1500; previously trivial: progress log: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: progress log: text above a float's anchor wraps around it, #2048; previously trivial: progress log: File › Recover follows the app theme, #3243; previously trivial: progress log: formatting toolbar with the text context menu, #2959; previously trivial: progress log: caret inside ligatures, #1974; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: progress log: a header-cell picture watermark sits behind the text, #1775; previously trivial: symbols keep their font when the text font changes, #2036; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: Add Font imports every selected font file, #1789); previously trivial (RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: Read Aloud speaks each sentence in its own language, #1843; previously trivial: hint-reliant CJK outlines; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: progress log: Turkish case mapping in AutoCorrect, #1923; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: progress log: Hebrew field results and smart quotes, #1670; previously trivial: Backspace removes a selected table, rows or columns, #1844; previously trivial: progress log: mixed Hebrew/Latin text keeps its order in Word, #1543; previously trivial: progress log: web typing in non-Latin text no longer repeats, #1480; previously trivial: progress log: font family caches bounded and math font lookups follow font changes, #1354; previously trivial: `-->` AutoCorrect replacement, #2223; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: progress log: Columns on selected text, #2024; previously trivial: progress log: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: progress log: Indonesian proofing, #498; previously trivial: progress log: DOCX glossary documents (building blocks); previously trivial: progress log: Read Mode keeps the keyboard and shows whole, unobscured columns, #1772); previously trivial: progress log: font list entries of tall-ascent fonts no longer cut off, #2570); previously trivial: progress log: Split Cells and Convert Text to Table dialogs follow the Word check, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout fills the window width, #1876; previously trivial: progress log: Different First Page headers reachable from page 1, #2826; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: progress log: web preferences kept between visits, #2132; previously trivial: progress log: undrawable private-use list bullets show the level's default bullet, #1683; previously trivial: progress log: `w:eastAsianLayout` kept on save; previously trivial: table style editor formats every part, #714); previously trivial: VML freeforms read and kept on save; previously trivial: progress log: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: progress log: grouped `flowChartOr` shapes draw their circle and crossing spokes; previously trivial: progress log: copies keep their formatting in other programs, #1523; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** trivial (N-up and booklet printing, #641; readiness unchanged); previously trivial (Print Markup comment discovery walks paragraph objects once, #3614); previously trivial (progress log: the dialogs of the mirrored Arabic interface read right to left: label-and-field rows, tables (list columns, the Models table), tile galleries and the Add/Remove arrows follow the reading direction, through one `rtl::Table` helper that draws exactly as before in English; no ranked gap closed, readiness estimates unchanged); previously trivial (progress log: fonts that aren't installed are flagged in the font box and status bar); previously trivial (progress log: Options › Language redesign, CP4.3); previously trivial (progress log: the missing-pack bar on a fresh install, the caret's typing language, and the spelling menu heading in the interface language, CP4.3); previously trivial (progress log: Language pack languages in every language list, CP4.3); previously trivial (progress log: craft-proof pin, French elision and Valencian, CP4.3); previously trivial (progress log: a long comment's card and balloon stop at ten lines, #3382); previously trivial (progress log: a pasted text box story is charged for the formatting it copies); previously trivial (progress log: a .doc table row keeps one override per cell); previously trivial (progress log: a .doc file's sections find their paragraphs by index); previously minor (Arabic interface language with mirrored UI, #1195); previously trivial (progress log: Replace and Remove Table of Contents with Word's title above a section break, #4041); previously trivial (progress log: a password-protected file named on the command line asks for its password after the startup document is replaced, #5299); previously trivial (progress log: language-packs-2 published and pinned, 75 Language packs); previously trivial (progress log: language-packs-1 published and pinned, CP4.4); previously trivial (progress log: Language packs, CP4);; previously trivial (DOCX table rows and cells inside selected alternate-content branches survive open and repeated saves (#5219); broader corpus qualification and readiness estimates unchanged); previously trivial (progress log: a list inside a Markdown block quote stays quoted); previously trivial (progress log: arrowheads keep their kind, width and length and are drawn at Word's sizes); previously trivial (progress log: the line between columns for selected text, #5178); previously trivial (progress log: .doc standard font, #5066); previously trivial (progress log: a table row doesn't split off a picture that doesn't fit, #4272); previously trivial (progress log: a middle or bottom cell of a row split across pages lines up on the first page); previously trivial (progress log: tab leader dots spaced and placed as in Word); previously trivial (progress log: a list level above counts its first number at the first deeper item); previously trivial (progress log: paragraph side borders lie outside the text, #5036); previously trivial (progress log: a paragraph naming an undefined style is formatted as Normal, #5077); previously trivial (progress log: TOC page numbers as PAGEREF fields, #5097); previously trivial (progress log: Backstage keytips, #4960); previously trivial (Progress log: only the printer's PDF leaves out links; Save these pages as PDF keeps them, #4734); previously trivial (progress log: Chinese and Japanese text counts a word per character, #4547; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (progress log: corporate authors in bibliographies, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (progress log: Table Properties follows the selection, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion walks reference offsets and formatting runs together, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (progress log: RTF pictures stored as Windows or Enhanced Metafiles are imported, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (progress log: Insert › Shapes icon grid, #4349); previously trivial (progress log: AutoCorrect Options with no document open, #4585); previously trivial (progress log: window fallback geometry and equation symbol tooltips); previously trivial (progress log: window titles omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (progress log: Custom document properties dialog, #2982; previously trivial: progress log: View › New Window; previously trivial: progress log: interface translations come from storytold/craft-i18n through the `craft-i18n` crate; previously trivial: progress log: disabled-control reasons translated in every interface language, #2678; previously trivial: progress log: mail merge record navigation and record ranges for printing, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: group connector rerouting preserves rotated and flipped free or unresolved endpoints under nonuniform group scaling; readiness estimates unchanged; previously trivial: progress log: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: progress log: a relationship the markup names without the prefix is read as it wrote, and an ordinary `id` names no part; previously trivial: progress log: a document with many relationships opens in the time its part takes, and an id the text only mentions is not a reference, #3411; previously trivial: progress log: read only and comments-only protection grey out edits; previously trivial: progress log: an empty paragraph with a hidden mark shows nothing, not even its list number, #3982; previously trivial: progress log: "NaN" in the Font dialog's Size box no longer closes the app, #3663; previously trivial: progress log: a table cell span from a `.json` file no longer overflows, #3637; previously trivial: progress log: a click in the footer while editing the header moves there; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Slovenian interface catalog, 2,614 entries; previously trivial: Insert Table of Figures dialog for any caption label, #3013; previously trivial: progress log: Home › Underline drop-down, #2738; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: progress log: the scrollbar page tip stays on one line, #3341; previously trivial: progress log: forms protection greys out the control buttons; previously trivial: progress log: a document with many content controls saves in the time the controls take, #13; previously trivial: progress log: Word signature lines kept on save; previously trivial: a Thai run with Latin finds one installed font covering it all on Linux too, #1549; previously trivial: progress log: closing the header returns to the body selection, #3331; previously trivial: progress log: saving to a NAS share mounted by GVFS, #3003; previously trivial: progress log: a picture dragged near the bottom of a page lands there, #3169; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: progress log: inline pictures drag to an insertion cursor and stay inline, #2233, #2234; previously trivial: progress log: a text file saved over itself closes without asking, #2376; previously trivial: progress log: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: fixed font inputs in four layout controls; previously trivial: typing no longer starts render threads on every repaint, #3027; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: progress log: banded rows shade as in Word, #3415; previously trivial: progress log: the table handles show while the caret is in the table, #2428; previously trivial: progress log: a click below a floating table reaches the text after it, #2038; previously trivial: progress log: Delete on selected table cells leaves one empty paragraph in each, #2802; previously trivial: progress log: lam-alef in exported PDFs extracts whole with fonts that draw it as two glyphs, #2310; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: progress log: a text box that keeps the keyboard no longer resets the input method every frame, #2986; previously trivial: progress log: recovery copies and .json files store pictures as base64, #586 follow-up; previously trivial: progress log: legacy menu keys, #1697; previously trivial: progress log: shape gradients and transparency, #1500; previously trivial: progress log: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: progress log: text above a float's anchor wraps around it, #2048; previously trivial: progress log: File › Recover follows the app theme, #3243; previously trivial: progress log: formatting toolbar with the text context menu, #2959; previously trivial: progress log: caret inside ligatures, #1974; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: progress log: a header-cell picture watermark sits behind the text, #1775; previously trivial: symbols keep their font when the text font changes, #2036; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: Add Font imports every selected font file, #1789); previously trivial (RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: Read Aloud speaks each sentence in its own language, #1843; previously trivial: hint-reliant CJK outlines; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: progress log: Turkish case mapping in AutoCorrect, #1923; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: progress log: Hebrew field results and smart quotes, #1670; previously trivial: Backspace removes a selected table, rows or columns, #1844; previously trivial: progress log: mixed Hebrew/Latin text keeps its order in Word, #1543; previously trivial: progress log: web typing in non-Latin text no longer repeats, #1480; previously trivial: progress log: font family caches bounded and math font lookups follow font changes, #1354; previously trivial: `-->` AutoCorrect replacement, #2223; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: progress log: Columns on selected text, #2024; previously trivial: progress log: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: progress log: Indonesian proofing, #498; previously trivial: progress log: DOCX glossary documents (building blocks); previously trivial: progress log: Read Mode keeps the keyboard and shows whole, unobscured columns, #1772); previously trivial: progress log: font list entries of tall-ascent fonts no longer cut off, #2570); previously trivial: progress log: Split Cells and Convert Text to Table dialogs follow the Word check, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout fills the window width, #1876; previously trivial: progress log: Different First Page headers reachable from page 1, #2826; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: progress log: web preferences kept between visits, #2132; previously trivial: progress log: undrawable private-use list bullets show the level's default bullet, #1683; previously trivial: progress log: `w:eastAsianLayout` kept on save; previously trivial: table style editor formats every part, #714); previously trivial: VML freeforms read and kept on save; previously trivial: progress log: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: progress log: grouped `flowChartOr` shapes draw their circle and crossing spokes; previously trivial: progress log: copies keep their formatting in other programs, #1523; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 > **Printing update:** 2026-10-12 · direct desktop printing through craft-print; details below. WordCraft aims for complete parity with Microsoft Word, then goes further on speed, openness and @@ -258,6 +258,7 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-29 | A NUL in a document title no longer reaches the native window title, which panicked on X11 (#3634): displayed titles and suggested file names drop NUL characters and fall back to the untitled name when empty; the stored title is unchanged | | 2026-10-28 | The Traditional Chinese interface draws hanzi to the Taiwan standard: on the desktop an installed Traditional Chinese font (PingFang TC on macOS, Microsoft JhengHei on Windows, Noto Sans CJK TC on Linux) comes before the embedded Noto Sans CJK SC, which drew 說, 這, 為, 戶 in mainland shapes; without one, and on the web, nothing changes. | | 2026-10-17 | macOS launch arguments (`-psn_*`, `-NS*`, `-Apple*`) are no longer opened as files, and a file that fails to open names the file and the real cause on the status bar and in the log (#1103). The reported "corrupt" error could not be reproduced. | +| 2026-10-23 | File > Print: N-up physical sheets and left/right-bound booklets, shared preview/PDF geometry and padded copies (#641); printer jobs keep upstream’s link-annotation fix. | | 2026-10-17 | Password-protected Word files from Word 2007 (Standard encryption: AES-128/192/256, SHA-1) open with their password, also when named `.doc` or `.dot`; a wrong or missing password is reported as for newer files. Word 97-2003 files with an AES header, which the public spec doesn't define, are refused with a clear message (gap 9) | | 2026-10-27 | Connector rerouting indexes laid-out object positions once per batch, preserving page hints, first-match order and same-page glue; synthetic equivalence, geometry and scaling regressions (#3631); routing policy and readiness estimates unchanged | | 2026-10-28 | Markdown import bounds nested undefined reference-label work within the existing link allowance; literal source and normal reference matching are preserved (#4658). | @@ -267,6 +268,8 @@ Imported Word 97–2003 `.doc`/`.dot` files now ask for a supported DOCX target | 2026-10-25 | #4085 review: highlight toggling checks the full target with constant resolved-run storage; a different colour after 10,000 runs prevents clearing. | | 2026-10-24 | #4085: Ctrl+Alt+H toggles the last chosen highlight colour; explicit colour setters remain idempotent. Mixed, inherited and pending formatting and Undo/Redo covered by command/key regressions. | | 2026-10-23 | Comment times show in the user's own time zone, as in Word: the Comments pane converts them (it showed the file's UTC time) and the balloons show them under each author (they showed none). The file's UTC time (Word's `w16cex:dateUtc`) wins over `w:date`, a time naming its zone is converted, and one without a zone shows as written (#2322, #2337) | +| 2026-11-01 | trivial | N-up and booklet print imposition (#641): integrate current print-job link handling (#4734), preserve markup preview and sheet/copy planning; readiness estimates unchanged. | +| 2026-11-01 | trivial | Printing (#641): pin booklet page order and blank left/right slots for every count from five through nine pages and both bindings; integrate current main. Readiness estimates unchanged. | | 2026-10-22 | Compare results opened as new or revised untitled documents start without the previous document's version snapshots. A comparison or mailing result rejected by protection keeps the snapshots and save target with the original document. | | 2026-10-20 | The Document Inspector's removals are refused while the document tracks changes: they delete straight from the document, so the text would go with no revision to show for it and the revision trail would be broken behind the user's back | | 2026-10-20 | A version snapshot belongs to the document it was taken from: the snapshots went with the document, so a restore can only ever bring back a version of the document that is open | diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index ead7bd7f2c..4c2c4c14a7 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -128,7 +128,7 @@ pub fn specs() -> Vec { .pure(), CommandSpec::new("file.printPdf", "Print to PDF", "File › Print", crate::print::print_pdf_to_file) .params( - r#"{"path": string, "range"?: "all" | "current" | "selection" (the pages the selection touches) | "custom", "pages"?: "1-3,5" (implies custom), "parity"?: "all" | "odd" | "even", "copies"?: 1-999, "collate"?: bool (default true), "paper"?: "none" | "Letter" | "Legal" | "A4" | … (a Layout › Size name: scale every page to this paper, centred; the document keeps its size)}"#, + r#"{"path": string, "pagesPerSheet"?: 1 | 2 | 4 | 6 | 9 | 16 | "booklet" | "bookletReverse", "range"?: "all" | "current" | "selection" (the pages the selection touches) | "custom", "pages"?: "1-3,5" (implies custom), "parity"?: "all" | "odd" | "even", "copies"?: 1-999, "collate"?: bool (default true), "paper"?: "none" | "Letter" | "Legal" | "A4" | … (a Layout › Size name: scale every page to this paper, centred; the document keeps its size)}"#, ) .pure(), CommandSpec::new("file.print", "Print", "File", |s, _| { diff --git a/crates/engine/src/print.rs b/crates/engine/src/print.rs index 420cc61854..9beb516748 100644 --- a/crates/engine/src/print.rs +++ b/crates/engine/src/print.rs @@ -2,7 +2,8 @@ //! //! WordCraft prints through a PDF (the host opens it in the system's print flow), so the settings //! that can be delivered are the ones that shape the PDF: the page range, odd/even pages, copies -//! and collation. Printer choice, duplex and pages per sheet belong to the OS print dialog. +//! and collation. Physical sheet imposition is shared with the preview; printer choice and duplex +//! are handled by the host. //! //! Page ranges and copies come from users and control channels, so they are bounded: a range //! text is at most [`MAX_SPEC_CHARS`] long, copies are clamped to [`MAX_COPIES`], and the @@ -10,6 +11,7 @@ use serde_json::{Value, json}; use wordcraft_layout::DocLayout; +pub use wordcraft_pdf::imposition::Imposition; use crate::{CmdError, Session, p}; @@ -146,6 +148,47 @@ pub fn paper(v: &Value) -> Result, CmdError> { } } +/// Validate the physical sheet layout without touching document page setup. +pub fn imposition(v: &Value) -> Result { + match v.get("pagesPerSheet") { + None => Ok(Imposition::Single), + Some(Value::Number(n)) => match n.as_u64() { + Some(1) => Ok(Imposition::Single), + Some(n @ (2 | 4 | 6 | 9 | 16)) => Ok(Imposition::NUp(n as u8)), + _ => Err(CmdError::Params("pagesPerSheet must be 1, 2, 4, 6, 9, 16, booklet or bookletReverse".into())), + }, + Some(Value::String(s)) if s == "booklet" || s == "bookletReverse" => Ok(Imposition::Booklet { reverse: s == "bookletReverse" }), + _ => Err(CmdError::Params("pagesPerSheet must be 1, 2, 4, 6, 9, 16, booklet or bookletReverse".into())), + } +} + +/// Resolve physical paper orientation for imposed jobs; ordinary export keeps its existing policy. +fn imposed_paper(v: &Value, lay: &DocLayout, pages: &[usize]) -> Result, CmdError> { + let paper = paper(v)?.map(|(_, w, h)| (w, h)); + if imposition(v)? == Imposition::Single { + return Ok(paper); + } + let own = pages.first().and_then(|p| lay.pages.get(*p)).map(|p| (p.w - p.markup, p.h)); + let Some((w, h)) = paper.or(own) else { return Ok(paper) }; + match v.get("orientation").and_then(Value::as_str).unwrap_or("auto") { + "auto" => Ok(paper), + "portrait" => Ok(Some((w.min(h), w.max(h)))), + "landscape" => Ok(Some((w.max(h), w.min(h)))), + _ => Err(CmdError::Params("orientation must be auto, portrait or landscape".into())), + } +} + +/// Plan physical sheet sides for one copy, using the same selection and geometry as printing. +pub fn sheets(v: &Value, lay: &DocLayout, current: (usize, usize)) -> Result, CmdError> { + if !v.is_object() { + return Err(CmdError::Params("print settings must be an object".into())); + } + let mut single = v.clone(); + single["copies"] = json!(1); + let pages = plan(&single, lay.pages.len(), current)?.pages; + imposition(v)?.sheets(lay, &pages, imposed_paper(v, lay, &pages)?).map_err(|e| CmdError::Failed(e.to_string())) +} + impl Session { /// The pages the caret (or selection) is on, in the output layout: (first, last). pub fn current_pages(&self, lay: &DocLayout) -> (usize, usize) { @@ -169,14 +212,24 @@ impl Session { self.print_pdf_with(v, false) } + /// Render a shared sheet plan for a saved PDF or an annotation-free printer job. fn print_pdf_with(&self, v: &Value, links: bool) -> Result<(Vec, PrintPlan), CmdError> { + if !v.is_object() { + return Err(CmdError::Params("print settings must be an object".into())); + } // Print Markup (File › Print) decides whether tracked changes and comments print. let markup = crate::cmd::file::export_options(self, v); let lay = self.export_layout_with(markup.markup); let plan = plan(v, lay.pages.len(), self.current_pages(&lay))?; - let paper = paper(v)?.map(|(_, w, h)| (w, h)); + let mut single = v.clone(); + single["copies"] = json!(1); + let single_plan = self::plan(&single, lay.pages.len(), self.current_pages(&lay))?; + let paper = imposed_paper(v, &lay, &single_plan.pages)?; let opts = wordcraft_pdf::PdfOptions { - pages: Some(plan.pages.clone()), + pages: Some(single_plan.pages), + imposition: imposition(v)?, + sheet_copies: plan.copies, + sheet_collate: p::bool(v, "collate").unwrap_or(true), // Repeated pages would repeat the structure tree's entries too. tagged: plan.copies <= 1, include_markup: markup.markup, @@ -340,3 +393,31 @@ mod tests { let _ = std::fs::remove_dir_all(&base); } } + +#[cfg(test)] +mod imposition_tests { + use super::*; + /// Sheet printing leaves document bytes, dirty state, selection and undo history untouched. + #[test] + fn print_imposition_is_pure_and_rejects_hostile_modes() { + let s = Session::new(wordcraft_doc::Document::from_text("one\u{c}two\u{c}three\u{c}four\u{c}five")); + let before = (s.rev(), s.dirty, s.sel.clone(), serde_json::to_value(&s.doc).unwrap()); + for (mode, sides) in + [(json!(2), 3), (json!(4), 2), (json!(6), 1), (json!(9), 1), (json!(16), 1), (json!("booklet"), 4), (json!("bookletReverse"), 4)] + { + let params = json!({"pagesPerSheet":mode, "copies":2}); + let lay = s.export_layout(); + assert_eq!(sheets(¶ms, &lay, s.current_pages(&lay)).unwrap().len(), sides); + let (bytes, plan) = s.print_pdf(¶ms).unwrap(); + assert_eq!(plan.copies, 2); + assert_eq!(String::from_utf8_lossy(&bytes).matches("/MediaBox[").count(), sides * 2); + } + for bad in [json!(0), json!(3), json!(-1), json!(1.5), json!(true), json!(null), json!({}), json!("2"), json!("x".repeat(10000))] { + assert!(s.print_pdf(&json!({"pagesPerSheet":bad})).is_err()); + } + for params in [json!(null), json!([]), json!(false)] { + assert!(s.print_pdf(¶ms).is_err()); + } + assert_eq!((s.rev(), s.dirty, s.sel.clone(), serde_json::to_value(&s.doc).unwrap()), before); + } +} diff --git a/crates/pdf/src/export.rs b/crates/pdf/src/export.rs index 8d8ba6c9bc..78e575c5b5 100644 --- a/crates/pdf/src/export.rs +++ b/crates/pdf/src/export.rs @@ -1,10 +1,10 @@ use super::exporter::Exporter; use super::metadata::metadata; use super::options::{PdfError, PdfOptions}; -use super::paint::{clamp_side, ok}; +use super::paint::{clamp_side, ok, rect_path}; use super::{ - DocLayout, Document, HashMap, HashSet, KrillaError, LayoutCache, LayoutOptions, Page, PageSettings, Size, Transform, WriteError, Writer, krilla, - layout, write, + DocLayout, Document, FillRule, HashMap, HashSet, KrillaError, LayoutCache, LayoutOptions, Page, PageSettings, Rect, Size, Transform, WriteError, + Writer, imposition, krilla, layout, write, }; /// Lay out `doc` and write it as PDF. Without markup the layout is the final text: tracked @@ -23,7 +23,11 @@ pub fn export_layout(doc: &Document, lay: &DocLayout, opts: &PdfOptions) -> Resu write::guard(|| export_layout_inner(doc, lay, opts)) } +/// Validate selected pages and retry embedding failures with outlined fonts. fn export_layout_inner(doc: &Document, lay: &DocLayout, opts: &PdfOptions) -> Result, PdfError> { + let mut adjusted = opts.clone(); + adjusted.tagged &= adjusted.sheet_copies <= 1; + let opts = &adjusted; let pages: Vec = match &opts.pages { Some(v) => { if let Some(bad) = v.iter().find(|p| **p >= lay.pages.len()) { @@ -60,7 +64,28 @@ enum Attempt { BadFont(u32, String), } +/// Serialize physical sheet sides while mapping link and outline destinations onto their cells. fn write_attempt(doc: &Document, lay: &DocLayout, opts: &PdfOptions, pages: &[usize], outlined: &HashSet) -> Result { + let one_copy = opts.imposition.sheets(lay, pages, opts.paper)?; + let copies = opts.sheet_copies.clamp(1, 999) as usize; + if (opts.imposition != imposition::Imposition::Single || copies > 1) && one_copy.len().checked_mul(copies).is_none_or(|n| n > 5000) { + return Err(PdfError::Write("the print job exceeds 5000 sheet sides".into())); + } + let sheets: Vec<_> = if opts.sheet_collate { + (0..copies).flat_map(|_| one_copy.iter()).collect() + } else if matches!(opts.imposition, imposition::Imposition::Booklet { .. }) { + // A booklet's front/back pair must remain one physical sheet even without collation. + one_copy.chunks(2).flat_map(|pair| (0..copies).flat_map(move |_| pair.iter())).collect() + } else { + one_copy.iter().flat_map(|s| std::iter::repeat_n(s, copies)).collect() + }; + let mut destinations = HashMap::new(); + for (output, sheet) in sheets.iter().enumerate() { + for slot in &sheet.slots { + let page = lay.pages.get(slot.page).ok_or(PdfError::BadPage(slot.page.saturating_add(1)))?; + destinations.entry(slot.page).or_insert((output, Fit::in_slot(page, *slot))); + } + } let settings = krilla::SerializeSettings { compress_content_streams: opts.compress, enable_tagging: opts.tagged, ..Default::default() }; let language = doc.styles.default_chr.lang.clone().filter(|l| !l.is_empty() && l.is_ascii()); let mut writer = Writer::new_with_language(settings, metadata(doc, opts), language); @@ -70,7 +95,7 @@ fn write_attempt(doc: &Document, lay: &DocLayout, opts: &PdfOptions, pages: &[us doc, lay, opts, - out_index: pages.iter().enumerate().map(|(o, p)| (*p, o)).collect(), + out_index: destinations, fonts: HashMap::new(), font_error: None, outlined, @@ -85,29 +110,32 @@ fn write_attempt(doc: &Document, lay: &DocLayout, opts: &PdfOptions, pages: &[us if let Some(o) = ex.outline(pages) { pdf.set_outline(o); } - for &pi in pages { - let Some(page) = lay.pages.get(pi) else { return Err(PdfError::BadPage(pi.saturating_add(1))) }; - let fit = Fit::of(page, opts.paper); - let size = Size::from_wh(clamp_side(fit.paper_w), clamp_side(fit.paper_h)).ok_or(PdfError::NoPages)?; + for sheet in sheets { + let size = Size::from_wh(clamp_side(sheet.width), clamp_side(sheet.height)).ok_or(PdfError::NoPages)?; let mut kp = pdf.start_page_with(PageSettings::new(size)); - let mut s = kp.surface(); - ex.links.clear(); - // A page with a markup area is scaled down to fit its paper with the area beside it; a - // print on other paper is scaled to it and centred. - let scaled = fit.k != 1.0 || fit.dx != 0.0 || fit.dy != 0.0; - if scaled { - s.push_transform(&Transform::from_row(fit.k, 0.0, 0.0, fit.k, fit.dx, fit.dy)); - } - // `page_w` is the document page's width: the page colour and watermark stay off the markup area. - ex.page(&mut s, page, clamp_side(fit.page_w), clamp_side(page.h)); - if scaled { - s.pop(); - } - s.finish(); - if opts.links { - for a in ex.annotations(fit) { - kp.add_annotation(a); + let mut annotations = Vec::new(); + let mut surface = kp.surface(); + for slot in &sheet.slots { + let page = lay.pages.get(slot.page).ok_or(PdfError::BadPage(slot.page.saturating_add(1)))?; + let fit = Fit::in_slot(page, *slot); + ex.links.clear(); + let clip = rect_path(&Rect::new(slot.x, slot.y, slot.width, slot.height)); + if let Some(clip) = &clip { + surface.push_clip_path(clip, &FillRule::NonZero); } + surface.push_transform(&Transform::from_row(fit.k, 0.0, 0.0, fit.k, fit.dx, fit.dy)); + ex.page(&mut surface, page, clamp_side(fit.page_w), clamp_side(page.h)); + surface.pop(); + if clip.is_some() { + surface.pop(); + } + if opts.links { + annotations.extend(ex.annotations(fit)); + } + } + surface.finish(); + for annotation in annotations { + kp.add_annotation(annotation); } kp.finish(); } @@ -150,6 +178,26 @@ pub(crate) struct Fit { } impl Fit { + /// The physical output page dimensions, shared with the imposition planner. + pub(crate) fn paper_size(self) -> (f32, f32) { + (self.paper_w, self.paper_h) + } + + /// Fit the complete logical page (including markup) within one fixed sheet cell. + fn in_slot(page: &Page, slot: imposition::Slot) -> Self { + let own = Self::of(page, None); + let k = (slot.width / page.w).min(slot.height / page.h); + Self { + paper_w: slot.width, + paper_h: slot.height, + page_w: own.page_w, + k, + dx: slot.x + (slot.width - page.w * k) / 2.0, + dy: slot.y + (slot.height - page.h * k) / 2.0, + } + } + + /// Map one document page and its markup area onto its requested paper. pub(crate) fn of(page: &Page, paper: Option<(f32, f32)>) -> Fit { let paper_w = page.w - page.markup; let own = if page.markup > 0.0 && ok(page.markup) && ok(page.w) && paper_w > 1.0 { @@ -168,3 +216,23 @@ impl Fit { (x * self.k + self.dx, y * self.k + self.dy) } } + +#[cfg(test)] +mod tests { + use super::*; + + /// N-up fits the whole markup page once, with the same centering as the physical-sheet preview. + #[test] + fn imposed_markup_pages_fit_the_slot_without_double_scaling() { + let page = wordcraft_layout::Page { w: 732.0, h: 792.0, markup: 120.0, ..Default::default() }; + for (width, height, scale) in [(1000.0, 396.0, 0.5), (183.0, 1000.0, 0.25)] { + let slot = imposition::Slot { page: 0, x: 17.0, y: 23.0, width, height }; + let fit = Fit::in_slot(&page, slot); + assert!((fit.k - scale).abs() < 0.00001); + assert!((fit.dx - (17.0 + (width - 732.0 * scale) / 2.0)).abs() < 0.00001); + assert!((fit.dy - (23.0 + (height - 792.0 * scale) / 2.0)).abs() < 0.00001); + assert_eq!(fit.page_w, 612.0, "the unscaled document width excludes the balloon area"); + assert_eq!((fit.paper_w, fit.paper_h), (width, height)); + } + } +} diff --git a/crates/pdf/src/exporter.rs b/crates/pdf/src/exporter.rs index 327aab4517..aef7853a21 100644 --- a/crates/pdf/src/exporter.rs +++ b/crates/pdf/src/exporter.rs @@ -19,8 +19,8 @@ pub(crate) struct Exporter<'a> { pub(crate) doc: &'a Document, pub(crate) lay: &'a DocLayout, pub(crate) opts: &'a PdfOptions, - /// Layout page index → output page index. - pub(crate) out_index: HashMap, + /// Layout page index to the first output sheet side and its placement transform. + pub(crate) out_index: HashMap, /// Embedded fonts by face id (`None`: krilla can't read it). pub(crate) fonts: HashMap)>, pub(crate) font_error: Option, diff --git a/crates/pdf/src/exporter/nav.rs b/crates/pdf/src/exporter/nav.rs index 1924748dfc..fa03f8dd60 100644 --- a/crates/pdf/src/exporter/nav.rs +++ b/crates/pdf/src/exporter/nav.rs @@ -17,7 +17,7 @@ impl Exporter<'_> { }); let pos = exact.get(name).or_else(|| folded.get(&name.to_ascii_lowercase()))?.clone(); if let Some(c) = self.lay.caret(&pos) - && let Some(out) = self.out_index.get(&c.page) + && let Some((out, fit)) = self.out_index.get(&c.page) { // The left edge of the paragraph's piece on that page, at the top of the line. let x = self @@ -32,7 +32,7 @@ impl Exporter<'_> { _ => None, }) .unwrap_or(c.x); - let (x, y) = self.lay.pages.get(c.page).map(|p| Fit::of(p, self.opts.paper).point(x, c.top)).unwrap_or((x, c.top)); + let (x, y) = fit.point(x, c.top); return Some((*out, x, y)); } self.locate(pos.story, &pos.path) @@ -42,10 +42,10 @@ impl Exporter<'_> { fn locate(&self, story: StoryRef, path: &DocPath) -> Option<(usize, f32, f32)> { let places = self.lay.index.get(&(story, path.clone()))?; for (pi, ii) in places { - let Some(out) = self.out_index.get(pi) else { continue }; + let Some((out, fit)) = self.out_index.get(pi) else { continue }; let Some(page) = self.lay.pages.get(*pi) else { continue }; let (x, y) = match page.items.get(*ii) { - Some(Placed::Lines { x, y, .. }) => Fit::of(page, self.opts.paper).point(*x, *y), + Some(Placed::Lines { x, y, .. }) => fit.point(*x, *y), _ => (0.0, 0.0), }; return Some((*out, x, y)); @@ -78,7 +78,8 @@ impl Exporter<'_> { /// The outline from body headings (outline levels 1–9) on the exported pages. pub(crate) fn outline(&self, pages: &[usize]) -> Option { let mut flat: Vec<(u8, String, usize, f32, f32)> = Vec::new(); - for (out, pi) in pages.iter().enumerate() { + for pi in pages { + let Some((out, fit)) = self.out_index.get(pi) else { continue }; let Some(page) = self.lay.pages.get(*pi) else { continue }; for it in &page.items { let Placed::Lines { story: StoryRef::Body, path, para, l0, l1, x, y, .. } = it else { continue }; @@ -105,8 +106,8 @@ impl Exporter<'_> { if title.is_empty() { continue; } - let (x, y) = Fit::of(page, self.opts.paper).point(*x, *y + line.top - piece.top); - flat.push((level.min(8), title, out, x, y)); + let (x, y) = fit.point(*x, *y + line.top - piece.top); + flat.push((level.min(8), title, *out, x, y)); } } if flat.is_empty() { diff --git a/crates/pdf/src/imposition.rs b/crates/pdf/src/imposition.rs new file mode 100644 index 0000000000..d620e4c0e8 --- /dev/null +++ b/crates/pdf/src/imposition.rs @@ -0,0 +1,190 @@ +//! Physical sheet planning shared by PDF printing and the print preview. +use crate::PdfError; +use wordcraft_layout::DocLayout; + +/// How logical pages are placed on each physical side of a sheet. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum Imposition { + /// Keep one logical page per PDF page. + #[default] + Single, + /// Fill a fixed grid in row order; supported counts are 2, 4, 6, 9 and 16. + NUp(u8), + /// Pad to a multiple of four and pair outer/inner pages for duplex folding. + Booklet { reverse: bool }, +} + +/// One logical page's location on a physical sheet side, in points. +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct Slot { + /// Zero-based logical layout page. + pub page: usize, + /// Cell left edge. + pub x: f32, + /// Cell top edge. + pub y: f32, + /// Available width in points. + pub width: f32, + /// Available height in points. + pub height: f32, +} + +/// One PDF page representing a physical sheet side; empty slots stay white. +#[derive(Clone, Debug, PartialEq)] +pub struct Sheet { + /// Available width in points. + pub width: f32, + /// Available height in points. + pub height: f32, + /// Occupied cells only, in drawing order. + pub slots: Vec, +} + +impl Imposition { + /// Plan one copy, keeping selected page order and padding only after its last page. + /// Paper defaults to the first selected page. Two-up and booklets use landscape sheets. + pub fn sheets(self, lay: &DocLayout, pages: &[usize], paper: Option<(f32, f32)>) -> Result, PdfError> { + if pages.is_empty() { + return Err(PdfError::NoPages); + } + if self != Self::Single && pages.len() > 5000 { + return Err(PdfError::Write("a print job may contain at most 5000 logical pages".into())); + } + for &index in pages { + if lay.pages.get(index).is_none() { + return Err(PdfError::BadPage(index.saturating_add(1))); + } + } + if self == Self::Single { + return pages + .iter() + .map(|&page| { + let pg = lay.pages.get(page).ok_or(PdfError::BadPage(page.saturating_add(1)))?; + let (width, height) = super::export::Fit::of(pg, paper).paper_size(); + Ok(Sheet { width, height, slots: vec![Slot { page, x: 0.0, y: 0.0, width, height }] }) + }) + .collect(); + } + let first = lay.pages.get(*pages.first().ok_or(PdfError::NoPages)?).ok_or(PdfError::NoPages)?; + let (mut width, mut height) = paper.unwrap_or((first.w - first.markup, first.h)); + if !width.is_finite() || !height.is_finite() || width <= 0.0 || height <= 0.0 || width > 14400.0 || height > 14400.0 { + return Err(PdfError::Write("invalid print sheet dimensions".into())); + } + let (cols, rows) = match self { + Self::Single => (1, 1), + Self::NUp(2) | Self::Booklet { .. } => { + if width < height { + std::mem::swap(&mut width, &mut height); + } + (2, 1) + } + Self::NUp(4) => (2, 2), + Self::NUp(6) => (2, 3), + Self::NUp(9) => (3, 3), + Self::NUp(16) => (4, 4), + Self::NUp(_) => return Err(PdfError::Write("pages per sheet must be 1, 2, 4, 6, 9 or 16".into())), + }; + let ordered: Vec> = match self { + Self::Booklet { reverse } => { + let padded = pages.len().div_ceil(4) * 4; + let mut out = Vec::with_capacity(padded); + for side in 0..padded / 2 { + let pair = if side % 2 == 0 { [padded - 1 - side, side] } else { [side, padded - 1 - side] }; + for index in if reverse { [pair[1], pair[0]] } else { pair } { + out.push(pages.get(index).copied()); + } + } + out + } + _ => pages.iter().copied().map(Some).collect(), + }; + Ok(ordered + .chunks(cols * rows) + .map(|chunk| { + let slots = chunk + .iter() + .enumerate() + .filter_map(|(i, page)| { + page.map(|page| Slot { + page, + x: (i % cols) as f32 * width / cols as f32, + y: (i / cols) as f32 * height / rows as f32, + width: width / cols as f32, + height: height / rows as f32, + }) + }) + .collect(); + Sheet { width, height, slots } + }) + .collect()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + /// Folding eight pages yields 8/1, 2/7, 6/3, 4/5, with mirrored pairs for right binding. + #[test] + fn booklet_pairs_padding_ranges_and_reverse() { + let doc = wordcraft_doc::Document::from_text("1\u{c}2\u{c}3\u{c}4\u{c}5\u{c}6\u{c}7\u{c}8"); + let lay = wordcraft_layout::layout(&doc, &mut Default::default(), &Default::default()); + assert_eq!(lay.pages.len(), 8); + for (pages, expected) in [ + (vec![0, 1, 2, 3, 4, 5, 6, 7], vec![vec![7, 0], vec![1, 6], vec![5, 2], vec![3, 4]]), + (vec![1, 3, 5, 7, 0], vec![vec![1], vec![3], vec![5], vec![7, 0]]), + ] { + let sheets = Imposition::Booklet { reverse: false }.sheets(&lay, &pages, None).unwrap(); + assert_eq!(sheets.iter().map(|s| s.slots.iter().map(|p| p.page).collect::>()).collect::>(), expected); + let reverse = Imposition::Booklet { reverse: true }.sheets(&lay, &pages, None).unwrap(); + for (a, b) in sheets.iter().zip(reverse) { + for slot in &a.slots { + let r = b.slots.iter().find(|p| p.page == slot.page).unwrap(); + assert_eq!(r.x, a.width - slot.x - slot.width); + } + } + } + } + /// #641: independent folding sequences pin blank positions for both bindings at 5–9 pages. + #[test] + fn booklet_five_through_nine_pages_keep_blank_slot_positions() { + let doc = wordcraft_doc::Document::from_text("1\u{c}2\u{c}3\u{c}4\u{c}5\u{c}6\u{c}7\u{c}8\u{c}9"); + let lay = wordcraft_layout::layout(&doc, &mut Default::default(), &Default::default()); + assert_eq!(lay.pages.len(), 9); + let cases = [ + (5, vec![[None, Some(0)], [Some(1), None], [None, Some(2)], [Some(3), Some(4)]]), + (6, vec![[None, Some(0)], [Some(1), None], [Some(5), Some(2)], [Some(3), Some(4)]]), + (7, vec![[None, Some(0)], [Some(1), Some(6)], [Some(5), Some(2)], [Some(3), Some(4)]]), + (8, vec![[Some(7), Some(0)], [Some(1), Some(6)], [Some(5), Some(2)], [Some(3), Some(4)]]), + (9, vec![[None, Some(0)], [Some(1), None], [None, Some(2)], [Some(3), Some(8)], [Some(7), Some(4)], [Some(5), Some(6)]]), + ]; + for (count, expected) in cases { + for reverse in [false, true] { + let pages: Vec = (0..count).collect(); + let sheets = Imposition::Booklet { reverse }.sheets(&lay, &pages, None).unwrap(); + assert_eq!(sheets.len(), expected.len(), "page count {count}, reverse {reverse}"); + let actual: Vec<_> = sheets + .iter() + .map(|side| { + assert!(side.width >= side.height); + assert!(side.slots.len() <= 2); + let mut cells = [None, None]; + for slot in &side.slots { + assert_eq!(slot.width, side.width / 2.0); + assert_eq!(slot.height, side.height); + assert_eq!(slot.y, 0.0); + let col = usize::from(slot.x != 0.0); + assert_eq!(slot.x, col as f32 * side.width / 2.0); + assert!(cells[col].replace(slot.page).is_none()); + } + cells + }) + .collect(); + let wanted: Vec<_> = expected.iter().map(|&[left, right]| if reverse { [right, left] } else { [left, right] }).collect(); + assert_eq!(actual, wanted, "page count {count}, reverse {reverse}"); + let mut occupied: Vec<_> = actual.into_iter().flatten().flatten().collect(); + occupied.sort_unstable(); + assert_eq!(occupied, pages, "every selected page occurs exactly once"); + } + } + } +} diff --git a/crates/pdf/src/lib.rs b/crates/pdf/src/lib.rs index 739108e1b8..404f097774 100644 --- a/crates/pdf/src/lib.rs +++ b/crates/pdf/src/lib.rs @@ -22,6 +22,8 @@ #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] #![forbid(unsafe_code)] +pub mod imposition; + use std::collections::{HashMap, HashSet}; use std::num::NonZeroU16; use std::sync::Arc; @@ -61,6 +63,8 @@ mod paint; mod picture; mod tags; +#[cfg(test)] +use export::Fit; pub use export::{export, export_layout}; #[cfg(test)] use exporter::Exporter; diff --git a/crates/pdf/src/options.rs b/crates/pdf/src/options.rs index deb2301154..f8cef7ba04 100644 --- a/crates/pdf/src/options.rs +++ b/crates/pdf/src/options.rs @@ -1,4 +1,4 @@ -use super::{NumeralMode, WriteError}; +use super::{NumeralMode, WriteError, imposition}; #[derive(Debug, Clone, PartialEq, thiserror::Error)] pub enum PdfError { @@ -19,6 +19,12 @@ impl From for PdfError { /// Export options. #[derive(Clone, Debug)] pub struct PdfOptions { + /// Physical sheet layout used only by printing. + pub imposition: imposition::Imposition, + /// Repeat complete sheet plans (padding never spills into another copy). + pub sheet_copies: u32, + /// Collate physical sheet sides when repeating a print job. + pub sheet_collate: bool, /// Pages to export (0-based layout page indexes, in output order); `None` = all. pub pages: Option>, /// Title / author overrides (default: the document properties). @@ -47,8 +53,12 @@ pub struct PdfOptions { } impl Default for PdfOptions { + /// Keep ordinary document export unchanged unless a print layout is requested. fn default() -> Self { PdfOptions { + imposition: Default::default(), + sheet_copies: 1, + sheet_collate: true, pages: None, title: None, author: None, diff --git a/crates/pdf/src/tests.rs b/crates/pdf/src/tests.rs index 5ebc05d362..39da16b3d8 100644 --- a/crates/pdf/src/tests.rs +++ b/crates/pdf/src/tests.rs @@ -1343,6 +1343,7 @@ fn metafile_text_records_are_drawn_as_text() { /// #455: a link to a bookmark after a page break inside its paragraph goes to the page the /// bookmark is on, not the paragraph's first page. +/// A bookmark after a page break targets its laid-out start, independent of paragraph origin. #[test] fn bookmark_destination_is_the_page_of_its_start() { let mut d = Document::new(); @@ -1360,7 +1361,7 @@ fn bookmark_destination_is_the_page_of_its_start() { doc: &d, lay: &lay, opts: &PdfOptions::default(), - out_index: pages.iter().enumerate().map(|(o, p)| (*p, o)).collect(), + out_index: pages.iter().enumerate().map(|(o, p)| (*p, (o, Fit::of(&lay.pages[*p], None)))).collect(), fonts: HashMap::new(), font_error: None, outlined: &outlined, @@ -2457,6 +2458,112 @@ fn borders_are_dashed_with_words_patterns() { assert!(raw.contains("[3 1 1 1]0 d") || raw.contains("[3 1 1 1] 0 d"), "the dash-dot border"); } +/// Exported text remains selectable; copies repeat complete padded sheet plans. +#[test] +fn imposed_pdf_keeps_text_sheet_geometry_and_copy_boundaries() { + use crate::imposition::Imposition; + let d = Document::from_text("PAGEONE\u{c}PAGETWO\u{c}PAGETHREE\u{c}PAGEFOUR\u{c}PAGEFIVE"); + for (mode, expected) in [ + (Imposition::NUp(2), vec!["PAGEONEPAGETWO", "PAGETHREEPAGEFOUR", "PAGEFIVE"]), + (Imposition::NUp(4), vec!["PAGEONEPAGETWOPAGETHREEPAGEFOUR", "PAGEFIVE"]), + (Imposition::Booklet { reverse: false }, vec!["PAGEONE", "PAGETWO", "PAGETHREE", "PAGEFOURPAGEFIVE"]), + (Imposition::Booklet { reverse: true }, vec!["PAGEONE", "PAGETWO", "PAGETHREE", "PAGEFIVEPAGEFOUR"]), + ] { + for collate in [true, false] { + let opts = PdfOptions { + imposition: mode, + sheet_copies: 2, + sheet_collate: collate, + tagged: false, + paper: Some((612.0, 792.0)), + ..Default::default() + }; + let bytes = export(&d, &opts).unwrap(); + let actual: Vec<_> = extract_text(&bytes).iter().map(|s| s.split_whitespace().collect::()).collect(); + let want: Vec<_> = if collate { + expected.iter().chain(expected.iter()).copied().collect() + } else if matches!(mode, Imposition::Booklet { .. }) { + expected.chunks(2).flat_map(|pair| pair.iter().chain(pair.iter())).copied().collect() + } else { + expected.iter().flat_map(|p| [*p, *p]).collect() + }; + assert_eq!(actual, want, "{mode:?}, collate={collate}"); + let pdf = hayro_syntax::Pdf::new(bytes).unwrap(); + assert_eq!(pdf.pages().len(), want.len()); + } + } +} + +/// Every supported grid preserves chosen page order and stays within the sheet. +#[test] +fn imposed_grids_are_bounded_and_invalid_modes_fail() { + use crate::imposition::Imposition; + let doc = Document::from_text("a\u{c}b\u{c}c\u{c}d\u{c}e"); + let lay = layout(&doc, &mut Default::default(), &Default::default()); + for n in [2, 4, 6, 9, 16] { + let sheets = Imposition::NUp(n).sheets(&lay, &[4, 1, 3, 0, 2], Some((595.0, 842.0))).unwrap(); + assert_eq!(sheets.len(), 5usize.div_ceil(n as usize)); + assert_eq!(sheets.iter().flat_map(|s| &s.slots).map(|s| s.page).collect::>(), [4, 1, 3, 0, 2]); + for sheet in sheets { + for slot in sheet.slots { + assert!(slot.x >= 0.0 && slot.y >= 0.0 && slot.x + slot.width <= sheet.width + 0.01 && slot.y + slot.height <= sheet.height + 0.01); + } + } + } + for n in [0, 1, 3, 255] { + assert!(Imposition::NUp(n).sheets(&lay, &[0], None).is_err()); + } + assert!(Imposition::NUp(2).sheets(&lay, &[usize::MAX], None).is_err()); + for paper in [(f32::NAN, 3.0), (0.0, 4.0), (1.0, f32::INFINITY), (20000.0, 2.0)] { + assert!(Imposition::NUp(2).sheets(&lay, &[0], Some(paper)).is_err()); + } +} + +/// A one-page booklet retains its blank back, and tags remain valid on multi-page sheet sides. +#[test] +fn imposed_tagged_pdf_and_blank_booklet_backs_are_valid() { + use crate::imposition::Imposition; + let doc = Document::from_text("Front cover"); + let bytes = export(&doc, &PdfOptions { imposition: Imposition::Booklet { reverse: false }, ..Default::default() }).unwrap(); + assert_eq!(extract_text(&bytes), ["Front cover".to_owned(), String::new()]); + let pdf = hayro_syntax::Pdf::new(bytes).unwrap(); + assert_eq!(pdf.pages().len(), 2); + for mode in [Imposition::NUp(2), Imposition::NUp(16), Imposition::Booklet { reverse: false }] { + let bytes = export(&sample(), &PdfOptions { imposition: mode, ..Default::default() }).unwrap(); + assert!(String::from_utf8_lossy(&bytes).contains("/StructTreeRoot")); + assert!(squash(&extract_text(&bytes).concat()).contains("Second page")); + } +} + +/// Internal links and heading outlines point to physical sheet pages after imposition. +#[test] +fn imposed_links_and_outlines_target_physical_sheets() { + use crate::imposition::Imposition; + use hayro_syntax::object::{Array, Dict}; + let bytes = export(&sample(), &PdfOptions { imposition: Imposition::NUp(2), ..Default::default() }).unwrap(); + let pdf = hayro_syntax::Pdf::new(bytes).unwrap(); + assert_eq!(pdf.pages().len(), 1); + let physical = pdf.pages()[0].raw(); + let annotations = physical.get::(b"Annots").unwrap(); + let mut internal = 0; + for annotation in annotations.iter::() { + if let Some(dest) = annotation.get::(b"Dest") { + assert_eq!(dest.raw_iter().next().unwrap().as_obj_ref().map(Into::into), physical.obj_id()); + internal += 1; + } + } + assert!(internal > 0); + let root = pdf.xref().get::(pdf.xref().root_id()).unwrap(); + let mut entry = root.get::(b"Outlines").unwrap().get::(b"First"); + let mut headings = 0; + while let Some(e) = entry { + assert_eq!(e.get::(b"Dest").unwrap().raw_iter().next().unwrap().as_obj_ref().map(Into::into), physical.obj_id()); + headings += 1; + entry = e.get::(b"Next"); + } + assert!(headings >= 2); +} + #[test] fn only_safe_link_targets_become_annotations() { use hayro_syntax::object::{Array, Dict, String as PdfString}; diff --git a/crates/ui-egui/src/i18n/audit.rs b/crates/ui-egui/src/i18n/audit.rs index a5680c94f7..b0afe864af 100644 --- a/crates/ui-egui/src/i18n/audit.rs +++ b/crates/ui-egui/src/i18n/audit.rs @@ -710,7 +710,7 @@ fn the_arabic_interface_is_mirrored_and_never_panics() { for width in [1600.0, 1100.0] { let drawn = frame_at(&ctx, &mut app, width); let settings = x_of(&drawn, "Save these pages as PDF…"); - let indicator = super::tr(ar, "Page {page} of {pages}").split('{').next().unwrap_or_default(); + let indicator = super::tr(ar, "Sheet {page} of {pages}").split('{').next().unwrap_or_default(); // (The status bar's page count is drawn under the page too, at the right: take the leftmost.) let preview = drawn.iter().filter(|(t, _)| t.starts_with(indicator)).map(|(_, x)| *x).fold(f32::MAX, f32::min); assert!(preview < f32::MAX, "the preview's page indicator is drawn"); diff --git a/crates/ui-egui/src/print_page.rs b/crates/ui-egui/src/print_page.rs index 920f571784..cb4f372ee4 100644 --- a/crates/ui-egui/src/print_page.rs +++ b/crates/ui-egui/src/print_page.rs @@ -23,7 +23,7 @@ pub struct PrintSettings { pub parity: String, pub copies: u32, pub collate: bool, - /// The page shown in the preview (0-based). + /// The physical sheet side shown in the planned print job (0-based). pub preview: usize, /// `auto`, `portrait` or `landscape`. pub orientation: String, @@ -32,9 +32,12 @@ pub struct PrintSettings { /// Scale to paper size (#2108): `none` prints the document's page sizes, a Layout › Size /// name scales every page onto that paper. The document itself is unchanged. pub paper: String, + /// Physical grid size or booklet binding, independent of document page setup. + pub pages_per_sheet: String, } impl Default for PrintSettings { + /// Start with one page per sheet and the document's paper size. fn default() -> Self { PrintSettings { range: "all".into(), @@ -46,6 +49,7 @@ impl Default for PrintSettings { zoom: None, orientation: "auto".into(), paper: NO_SCALING.into(), + pages_per_sheet: "1".into(), } } } @@ -59,6 +63,7 @@ impl PrintSettings { "copies": self.copies, "collate": self.collate, "orientation": self.orientation, + "pagesPerSheet": self.pages_per_sheet.parse::().map_or_else(|_| json!(self.pages_per_sheet), |n| json!(n)), }); if self.range == "custom" { v["pages"] = json!(self.pages); @@ -113,25 +118,27 @@ fn choice_named(ui: &mut Ui, salt: &str, current: &mut String, items: &[(&str, & changed } -/// The output layout, kept while the document is unchanged (laying out every frame would be slow). +/// The output layout, kept while the document and Print Markup setting are unchanged. fn layout_of(app: &WordApp, ctx: &egui::Context) -> Arc { let id = egui::Id::unique("print_page_layout"); let rev = app.session.rev(); - if let Some((r, l)) = ctx.data(|d| d.get_temp::<(u64, Arc)>(id)) + let markup = app.session.prefs.print_markup; + if let Some((r, m, l)) = ctx.data(|d| d.get_temp::<(u64, bool, Arc)>(id)) && r == rev + && m == markup { return l; } - let l = app.session.export_layout(); - ctx.data_mut(|d| d.insert_temp(id, (rev, l.clone()))); + let l = app.session.export_layout_with(markup); + ctx.data_mut(|d| d.insert_temp(id, (rev, markup, l.clone()))); l } -/// The texture of one page, re-rendered only when the document, page or size changes. -fn page_texture(app: &WordApp, ctx: &egui::Context, lay: &DocLayout, page: usize, width: f32) -> Option { - let id = egui::Id::unique("print_page_texture"); - let key = (app.session.rev(), page, width as u32, (ctx.pixels_per_point() * 100.0) as u32); - if let Some((k, t)) = ctx.data(|d| d.get_temp::<((u64, usize, u32, u32), TextureHandle)>(id)) +/// A bounded per-cell texture cache, refreshed when the page, scale or Print Markup changes. +fn page_texture(app: &WordApp, ctx: &egui::Context, lay: &DocLayout, page: usize, cache_slot: usize, width: f32) -> Option { + let id = egui::Id::unique(("print_page_texture", cache_slot)); + let key = (app.session.rev(), app.session.prefs.print_markup, page, width as u32, (ctx.pixels_per_point() * 100.0) as u32); + if let Some((k, t)) = ctx.data(|d| d.get_temp::<((u64, bool, usize, u32, u32), TextureHandle)>(id)) && k == key { return Some(t); @@ -187,9 +194,6 @@ pub fn show(app: &mut WordApp, ui: &mut Ui) { app.ui.print.copies = app.printing.settings.copies; } else if hook { ui.label(tl!("Send the document straight to the system print dialog, or save a copy in another format below.")); - ui.label( - egui::RichText::new(tl!("The printer, two-sided printing and pages per sheet are chosen in that dialog.")).color(t.text_dim), - ); } else { ui.label(tl!("Save a copy in another format. Printing goes through a PDF you can print from any viewer.")); } @@ -220,20 +224,50 @@ pub fn show(app: &mut WordApp, ui: &mut Ui) { let pages_label = ui.label(egui::RichText::new(tl!("Pages")).font(medium(13.0))); if choice(ui, "print_range", &mut app.ui.print.range, &RANGES, &pages_label) { // Show the first page that will print. - app.ui.print.preview = if app.ui.print.range == "all" { 0 } else { current.0.min(total.saturating_sub(1)) }; + app.ui.print.preview = 0; } - if app.ui.print.range == "custom" { - ui.add( - egui::TextEdit::singleline(&mut app.ui.print.pages) - .hint_text(tl!("Pages like 1-3, 5")) - .desired_width(260.0) - .char_limit(wordcraft_engine::print::MAX_SPEC_CHARS), - ) - .labelled_by(pages_label.id); + if app.ui.print.range == "custom" + && ui + .add( + egui::TextEdit::singleline(&mut app.ui.print.pages) + .hint_text(tl!("Pages like 1-3, 5")) + .desired_width(260.0) + .char_limit(wordcraft_engine::print::MAX_SPEC_CHARS), + ) + .labelled_by(pages_label.id) + .changed() + { + app.ui.print.preview = 0; + } + if choice_named(ui, "print_parity", &mut app.ui.print.parity, &PARITIES, tl!("Pages in the range")) { + app.ui.print.preview = 0; } - choice_named(ui, "print_parity", &mut app.ui.print.parity, &PARITIES, tl!("Pages in the range")); let orientation_label = ui.label(egui::RichText::new(tl!("Orientation")).font(medium(13.0))); - choice(ui, "print_orientation", &mut app.ui.print.orientation, &ORIENTATIONS, &orientation_label); + if app.ui.print.pages_per_sheet == "2" || app.ui.print.pages_per_sheet.starts_with("booklet") { + ui.label(tl!("Landscape")); + } else { + choice(ui, "print_orientation", &mut app.ui.print.orientation, &ORIENTATIONS, &orientation_label); + } + let pages_per_sheet_label = ui.label(egui::RichText::new(tl!("Pages per sheet")).font(medium(13.0))); + choice( + ui, + "print_pages_per_sheet", + &mut app.ui.print.pages_per_sheet, + &[ + ("1", "1"), + ("2", "2"), + ("4", "4"), + ("6", "6"), + ("9", "9"), + ("16", "16"), + ("booklet", "Booklet (left binding)"), + ("bookletReverse", "Booklet (right binding)"), + ], + &pages_per_sheet_label, + ); + if app.ui.print.pages_per_sheet.starts_with("booklet") { + ui.label(tl!("Booklets: duplex on the short edge. Blank pages are added at the end.")); + } // Word: Pages per sheet › Scale to paper size. Only the printout changes. let paper_label = ui.label(egui::RichText::new(tl!("Scale to paper size")).font(medium(13.0))); let papers: Vec<(&str, &str)> = @@ -273,7 +307,7 @@ pub fn show(app: &mut WordApp, ui: &mut Ui) { ui.scope_builder(egui::UiBuilder::new().max_rect(settings_rect).layout(layout), |ui| settings(app, ui)); // A window too narrow for a usable preview shows the settings alone. if preview_rect.width() >= MIN_PREVIEW_WIDTH { - ui.scope_builder(egui::UiBuilder::new().max_rect(preview_rect).layout(layout), |ui| preview(app, ui, &lay, total)); + ui.scope_builder(egui::UiBuilder::new().max_rect(preview_rect).layout(layout), |ui| preview(app, ui, &lay)); } ui.allocate_rect(room, Sense::hover()); return; @@ -281,7 +315,7 @@ pub fn show(app: &mut WordApp, ui: &mut Ui) { crate::rtl::horizontal_top(ui, |ui| { crate::rtl::vertical(ui, |ui| settings(app, ui)); ui.add_space(SETTINGS_GAP); - crate::rtl::vertical(ui, |ui| preview(app, ui, &lay, total)); + crate::rtl::vertical(ui, |ui| preview(app, ui, &lay)); }); } @@ -304,20 +338,28 @@ fn zoom_step(z: f32, up: bool) -> f32 { /// The preview (#1156): the page fills the pane, a bar below pages through the document and /// zooms; zoomed in, the page scrolls both ways. -fn preview(app: &mut WordApp, ui: &mut Ui, lay: &DocLayout, total: usize) { +fn preview(app: &mut WordApp, ui: &mut Ui, lay: &DocLayout) { let t = Tokens::get(ui.ctx()); let ctx = ui.ctx().clone(); - let page = app.ui.print.preview; - let (page_w, page_h) = lay.pages.get(page).map_or((612.0, 792.0), |p| (p.w.max(1.0), p.h.max(1.0))); - // Scale to paper size: the sheet is the chosen paper with the page scaled and centred on it. - let sheet = app.ui.print.paper_size().map(|(w, h)| wordcraft_geom::fit_to_paper(page_w, page_h, w, h)); - let (pw, ph) = sheet.map_or((page_w, page_h), |f| (f.paper_w, f.paper_h)); + let sheets = match wordcraft_engine::print::sheets(&app.ui.print.params(), lay, app.session.current_pages(lay)) { + Ok(sheets) => sheets, + Err(error) => { + ui.label(error.to_string()); + return; + } + }; + let total = sheets.len(); + let page = app.ui.print.preview.min(total.saturating_sub(1)); + app.ui.print.preview = page; + let Some(sheet) = sheets.get(page) else { return }; + let (pw, ph) = (sheet.width, sheet.height); let pane = vec2(ui.available_width().max(120.0), (ui.available_height() - PREVIEW_BAR).max(120.0)); // Screen points per page point. let fit = ((pane.x - 2.0 * PREVIEW_MARGIN) / pw).min((pane.y - 2.0 * PREVIEW_MARGIN) / ph).max(0.01); let scale = app.ui.print.zoom.map_or(fit, |z| z * crate::canvas::PX_PER_PT); let size = vec2(pw * scale, ph * scale); - let label = crate::i18n::fmt(tl!("Page {page} of {pages}"), &[("page", &(page + 1).to_string()), ("pages", &total.to_string())]); + // Navigate the imposed sheet views rather than the logical document pages. + let label = crate::i18n::fmt(tl!("Sheet {page} of {pages}"), &[("page", &(page + 1).to_string()), ("pages", &total.to_string())]); egui::ScrollArea::both().id_salt("print_preview").auto_shrink(false).max_width(pane.x).max_height(pane.y).show(ui, |ui| { let room = vec2((size.x + 2.0 * PREVIEW_MARGIN).max(ui.available_width()), (size.y + 2.0 * PREVIEW_MARGIN).max(ui.available_height())); let (area, _) = ui.allocate_exact_size(room, Sense::hover()); @@ -326,9 +368,14 @@ fn preview(app: &mut WordApp, ui: &mut Ui, lay: &DocLayout, total: usize) { resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Image, true, &label)); ui.painter().rect_filled(r.translate(vec2(2.0, 3.0)), 0.0, t.page_shadow); ui.painter().rect(r, 0.0, egui::Color32::WHITE, Stroke::new(1.0, t.border_strong), egui::StrokeKind::Inside); - let on_sheet = sheet.map_or(r, |f| Rect::from_min_size(r.min + vec2(f.dx, f.dy) * scale, vec2(page_w, page_h) * f.k * scale)); - if let Some(tex) = page_texture(app, &ctx, lay, page, on_sheet.width()) { - ui.painter().image(tex.id(), on_sheet, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), egui::Color32::WHITE); + for (cache_slot, slot) in sheet.slots.iter().enumerate() { + let Some(pg) = lay.pages.get(slot.page) else { continue }; + let k = (slot.width / pg.w).min(slot.height / pg.h); + let offset = vec2(slot.x + (slot.width - pg.w * k) / 2.0, slot.y + (slot.height - pg.h * k) / 2.0); + let on_sheet = Rect::from_min_size(r.min + offset * scale, vec2(pg.w, pg.h) * k * scale); + if let Some(tex) = page_texture(app, &ctx, lay, slot.page, cache_slot, on_sheet.width()) { + ui.painter().image(tex.id(), on_sheet, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), egui::Color32::WHITE); + } } }); let rtl = crate::rtl::flows(ui); @@ -344,11 +391,11 @@ fn preview(app: &mut WordApp, ui: &mut Ui, lay: &DocLayout, total: usize) { icons::paint(ui.painter(), r.shrink(4.0), icon, col, col); enabled && resp.on_hover_text(tip).clicked() }; - if nav(ui, if rtl { "chevronRight" } else { "chevronLeft" }, tl!("Previous Page"), page > 0) { + if nav(ui, if rtl { "chevronRight" } else { "chevronLeft" }, tl!("Previous sheet"), page > 0) { app.ui.print.preview = page - 1; } ui.label(egui::RichText::new(&label).font(regular(13.0))); - if nav(ui, if rtl { "chevronLeft" } else { "chevronRight" }, tl!("Next Page"), page + 1 < total) { + if nav(ui, if rtl { "chevronLeft" } else { "chevronRight" }, tl!("Next sheet"), page + 1 < total) { app.ui.print.preview = page + 1; } ui.with_layout(crate::rtl::far_side(ui, egui::Align::Center), |ui| { @@ -407,3 +454,40 @@ pub fn export_formats(app: &mut WordApp, ui: &mut Ui) { ui.add_space(4.0); } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::Services; + use wordcraft_engine::Session; + + /// Print Markup changes layout and pixels without changing the document revision. + #[test] + fn preview_refreshes_layout_and_texture_when_print_markup_toggles() { + let mut session = Session::new(wordcraft_doc::Document::from_text("Synthetic print preview")); + session.run("select.text", &json!({"text": "preview"})).unwrap(); + session.run("review.newComment", &json!({"text": "Synthetic printed comment"})).unwrap(); + session.prefs.markup.comments = true; + let mut app = WordApp::new(session, Services::default()); + let ctx = egui::Context::default(); + let rev = app.session.rev(); + let dirty = app.session.dirty; + let mut previous = None; + for markup in [false, true, false] { + app.session.run("file.printMarkup", &json!({"value": markup})).unwrap(); + let layout = layout_of(&app, &ctx); + assert_eq!(layout.pages[0].markup > 0.0, markup); + assert!(Arc::ptr_eq(&layout, &layout_of(&app, &ctx)), "unchanged layout is reused"); + // Keep width fixed: an accidental scale change must not mask a stale texture. + let texture = page_texture(&app, &ctx, &layout, 0, 0, 300.0).unwrap(); + assert_eq!(texture.id(), page_texture(&app, &ctx, &layout, 0, 0, 300.0).unwrap().id()); + if let Some((old_layout, old_texture)) = previous.take() { + assert!(!Arc::ptr_eq(&layout, &old_layout)); + assert_ne!(texture.id(), old_texture); + } + previous = Some((layout, texture.id())); + assert_eq!(app.session.rev(), rev); + assert_eq!(app.session.dirty, dirty); + } + } +} diff --git a/crates/ui-egui/src/printing.rs b/crates/ui-egui/src/printing.rs index 79f9c9df0b..93aab7de39 100644 --- a/crates/ui-egui/src/printing.rs +++ b/crates/ui-egui/src/printing.rs @@ -9,7 +9,7 @@ pub type Submit = Box, Settings, bool, Vec<(String, String)>) -> pub fn commands(app: &crate::WordApp) -> Vec { use serde_json::json; let enabled = if app.services.print_native.is_some() { app.printing.ready() } else { app.services.print.is_some() }; - let submit_params = "range?: all|current|selection|custom; pages?: string (1-3,5); parity?: all|odd|even; copies?: integer 1..999; collate?: bool; orientation?: auto|portrait|landscape; paper?: none|Letter|Legal|A4|… (Layout › Size names: Scale to paper size, every page scaled onto that paper and centred; the document is unchanged). Native uses the selected printer, duplex and grayscale from ui.printSettings; omitted copies/collation use current settings. Browser printing opens its dialog. Submits only when explicitly executed."; + let submit_params = "pagesPerSheet?: 1|2|4|6|9|16|booklet|bookletReverse; range?: all|current|selection|custom; pages?: string (1-3,5); parity?: all|odd|even; copies?: integer 1..999; collate?: bool; orientation?: auto|portrait|landscape; paper?: none|Letter|Legal|A4|… (Layout › Size names: Scale to paper size, every page scaled onto that paper and centred; the document is unchanged). Native uses the selected printer, duplex and grayscale from ui.printSettings; omitted copies/collation use current settings. Browser printing opens its dialog. Submits only when explicitly executed."; vec![ json!({"id":"ui.printSettings", "label":"Print settings", "location":"File › Print", "shortcut":null, "params":"printer?: discovered name; copies?: integer 1..999; duplex?: printerDefault|off|longEdge|shortEdge|null; grayscale?: bool; refresh?: bool. Empty params inspect printer/copies/duplex/grayscale, printers, busy/discovering/ready and status/detail. Updates are atomic; refresh discovers only on native hosts. Never submits or opens a dialog.", @@ -190,7 +190,15 @@ pub fn submit(app: &mut crate::WordApp, params: &serde_json::Value) -> Result s.height) + } else if orientation == "landscape" { true } else if orientation == "portrait" { false diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 5a57da9414..3cef6dc5c8 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -3532,7 +3532,7 @@ fn the_print_preview_fills_the_pane_zooms_and_scrolls_both_ways() { let page = |h: &egui_kittest::Harness<'_, WordApp>| h.get(By::new().role(Role::Image)).rect(); let fit = page(&h); assert!(fit.height() > 650.0, "the page fills the pane's height: {fit:?}"); - assert!(h.query(By::new().role(Role::Label).label("Page 1 of 1")).is_some(), "the page indicator stays"); + assert!(h.query(By::new().role(Role::Label).label("Sheet 1 of 1")).is_some(), "the sheet indicator stays"); for _ in 0..5 { h.get_by_label("Zoom In").click(); diff --git a/crates/ui-egui/tests/it/native_print.rs b/crates/ui-egui/tests/it/native_print.rs index 26fea600fa..eb54a959be 100644 --- a/crates/ui-egui/tests/it/native_print.rs +++ b/crates/ui-egui/tests/it/native_print.rs @@ -309,26 +309,199 @@ fn native_print_scales_to_the_chosen_paper() { assert_eq!((app.session.doc.last_section.page_w, app.session.doc.last_section.page_h), page, "the document is unchanged"); } +/// Native copies stay in the spooler; booklet pairing and padding happen once in its PDF. +#[test] +fn native_booklet_uses_landscape_sheets_without_multiplying_copies() { + let mut app = WordApp::new(Session::new(wordcraft_doc::Document::from_text("1\u{c}2\u{c}3\u{c}4\u{c}5")), Services::default()); + let jobs = Rc::new(RefCell::new(Vec::new())); + let observed = jobs.clone(); + app.services.print_native = Some(Box::new(move |bytes, settings, collate, options| { + observed.borrow_mut().push((bytes, settings, collate, options)); + let (tx, rx) = std::sync::mpsc::channel(); + tx.send(Ok("test spooler".into())).unwrap(); + rx + })); + app.printing.printers.push(Printer { name: "Queue".into(), label: String::new(), default: true }); + app.run("ui.printSettings", json!({"printer":"Queue","copies":2,"duplex":"shortEdge"})).unwrap(); + app.run("ui.printSubmit", json!({"pagesPerSheet":"booklet"})).unwrap(); + let jobs = jobs.borrow(); + let (bytes, settings, collate, options) = &jobs[0]; + assert_eq!(settings.copies, 2); + assert_eq!(settings.duplex, Some(Duplex::ShortEdge)); + assert!(*collate); + assert_eq!(String::from_utf8_lossy(bytes).matches("/MediaBox[").count(), 4); + assert!(options.contains(&("orientation-requested".into(), "4".into()))); +} + +/// Real combo-box input changes both the submitted parameters and physical preview page count. +#[test] +fn print_booklet_choice_updates_sheet_preview() { + use egui_kittest::kittest::{By, Queryable}; + let mut app = WordApp::new(Session::new(wordcraft_doc::Document::from_text("1\u{c}2\u{c}3\u{c}4\u{c}5")), Services::default()); + app.ui.language = "en".into(); + app.run("file.print", json!({})).unwrap(); + let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1440.0, 1000.0)).with_pixels_per_point(1.0).build_ui_state( + |ui, app: &mut WordApp| { + let ctx = ui.ctx().clone(); + app.logic(&ctx); + app.ui(ui); + }, + app, + ); + for _ in 0..4 { + let mut raw = std::mem::take(h.input_mut()); + let ctx = h.ctx.clone(); + h.state_mut().raw_input_hook(&ctx, &mut raw); + *h.input_mut() = raw; + h.step(); + } + h.get(By::new().role(egui::accesskit::Role::ComboBox).value("1")).click(); + h.run_steps(2); + h.get_by_label("Booklet (left binding)").click(); + h.run_steps(4); + assert_eq!(h.state().ui.print.params()["pagesPerSheet"], "booklet"); + assert!(h.query(By::new().role(egui::accesskit::Role::Image).label("Sheet 1 of 4")).is_some()); + h.get_by_label("Next sheet").click(); + h.run_steps(3); + assert!(h.query(By::new().role(egui::accesskit::Role::Image).label("Sheet 2 of 4")).is_some()); + h.get(By::new().role(egui::accesskit::Role::ComboBox).value("Booklet (left binding)")).click(); + h.run_steps(2); + h.get_by_label("4").click(); + h.run_steps(4); + assert_eq!(h.state().ui.print.params()["pagesPerSheet"], 4); + assert!(h.query(By::new().role(egui::accesskit::Role::Image).label("Sheet 2 of 2")).is_some()); +} + +/// Changing a late-page range opens its first physical sheet in single-page and N-up previews. +#[test] +fn print_range_changes_start_at_the_first_planned_sheet() { + use egui::{Event, Key, Modifiers}; + use egui_kittest::kittest::{By, Queryable}; + for (range, label, selection, per_sheet, sheets) in + [("selection", "Selected pages", "3\u{c}4\u{c}5", "1", 3), ("custom", "Custom range", "9", "2", 5), ("custom", "Custom range", "9", "4", 3)] + { + let mut app = WordApp::new( + Session::new(wordcraft_doc::Document::from_text("1\u{c}2\u{c}3\u{c}4\u{c}5\u{c}6\u{c}7\u{c}8\u{c}9\u{c}10")), + Services::default(), + ); + app.ui.language = "en".into(); + app.run("select.text", json!({"text": selection})).unwrap(); + assert!(app.session.current_pages(&app.session.export_layout()).0 >= 2); + app.run("file.print", json!({})).unwrap(); + app.ui.print.pages = "2-10".into(); + app.ui.print.pages_per_sheet = per_sheet.into(); + app.ui.print.preview = 8; + let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1440.0, 1000.0)).build_ui_state( + |ui, app: &mut WordApp| { + app.logic(ui.ctx()); + app.ui(ui); + }, + app, + ); + for _ in 0..4 { + let mut raw = std::mem::take(h.input_mut()); + let ctx = h.ctx.clone(); + h.state_mut().raw_input_hook(&ctx, &mut raw); + *h.input_mut() = raw; + h.step(); + } + h.get(By::new().role(egui::accesskit::Role::ComboBox).value("All pages")).click(); + h.run_steps(2); + h.get_by_label(label).click(); + h.run_steps(4); + assert_eq!(h.state().ui.print.range, range); + assert_eq!(h.state().ui.print.preview, 0, "{range}, {per_sheet} pages per sheet"); + let preview_label = format!("Sheet 1 of {sheets}"); + assert!(h.query(By::new().role(egui::accesskit::Role::Image).label(&preview_label)).is_some()); + if range == "custom" { + h.state_mut().ui.print.preview = (sheets - 1) as usize; + h.run_steps(2); + h.get(By::new().role(egui::accesskit::Role::TextInput).label("Pages")).click(); + h.run_steps(2); + h.input_mut().events.push(Event::Key { key: Key::A, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::COMMAND }); + h.step(); + h.input_mut().events.extend([ + Event::Key { key: Key::A, physical_key: None, pressed: false, repeat: false, modifiers: Modifiers::NONE }, + Event::Text("2-9".into()), + ]); + h.run_steps(4); + assert_eq!(h.state().ui.print.pages, "2-9", "the real text input changed the range"); + assert_eq!(h.state().ui.print.preview, 0, "editing the custom range starts at its first sheet"); + if per_sheet == "2" { + h.state_mut().ui.print.preview = 3; + h.run_steps(2); + h.get(By::new().role(egui::accesskit::Role::ComboBox).value("All pages in the range")).click(); + h.run_steps(2); + h.get_by_label("Odd pages only").click(); + h.run_steps(4); + assert_eq!(h.state().ui.print.parity, "odd"); + assert_eq!(h.state().ui.print.preview, 0, "filtering the selected pages starts at its first sheet"); + } + } + } +} + +/// Native N-up accepts comment balloons and custom ranges from preferences or an explicit markup override. +#[test] +fn native_imposed_print_accepts_comment_markup_and_explicit_overrides() { + use wordcraft_doc::{Comment, Document, InlineObject, Paragraph, PartKind, Pos, para_block}; + let mut doc = Document::from_text("First page\u{c}Second page\u{c}Third page"); + let part = doc.add_part(PartKind::Comment, vec![para_block(Paragraph::with_text("Check these totals", Default::default()))]); + doc.comments.insert(0, Comment { author: "Synthetic reviewer".into(), part, ..Default::default() }); + doc.insert_object(&Pos::body(0, 0), InlineObject::CommentStart { id: 0 }, &Default::default()).unwrap(); + for explicit_override in [false, true] { + let mut app = WordApp::new(Session::new(doc.clone()), Services::default()); + app.session.prefs.print_markup = !explicit_override; + app.session.prefs.markup.comments = true; + let marked = app.session.export_layout_with(true); + let plain = app.session.export_layout_with(false); + assert!(marked.pages[0].w > plain.pages[0].w && marked.pages[0].markup > 0.0, "the fixture includes actual balloon geometry"); + let pages = marked.pages.len(); + assert!(pages >= 3); + let jobs = Rc::new(RefCell::new(Vec::new())); + let observed = jobs.clone(); + app.services.print_native = Some(Box::new(move |bytes, _, _, options| { + observed.borrow_mut().push((bytes, options)); + let (tx, rx) = std::sync::mpsc::channel(); + tx.send(Ok("test spooler".into())).unwrap(); + rx + })); + app.printing.printers.push(Printer { name: "Queue".into(), label: String::new(), default: true }); + app.run("ui.printSettings", json!({"printer":"Queue"})).unwrap(); + let mut params = json!({"range":"custom","pages":format!("1-{pages}"),"pagesPerSheet":2}); + if explicit_override { + params["markup"] = json!(true); + } + app.run("ui.printSubmit", params).unwrap(); + let jobs = jobs.borrow(); + assert_eq!(jobs.len(), 1); + assert_eq!(String::from_utf8_lossy(&jobs[0].0).matches("/MediaBox[").count(), pages.div_ceil(2)); + assert!(jobs[0].1.contains(&("orientation-requested".into(), "4".into()))); + } +} + /// #4734: the job sent to the printer has no link annotations, which a printer driver can't fit /// to the paper ("flatten page annotations before using shrink-to-fit"); `file.printPdf` (Save /// these pages as PDF) keeps them. #[test] fn native_print_job_leaves_out_link_annotations() { - let mut app = WordApp::new(Session::new(wordcraft_doc::Document::new()), Services::default()); - app.run("insert.link", json!({"url": "https://example.com", "text": "a link"})).unwrap(); - app.printing.printers.push(Printer { name: "Queue".into(), label: String::new(), default: true }); - app.run("ui.printSettings", json!({"printer":"Queue"})).unwrap(); - let jobs = Rc::new(RefCell::new(Vec::new())); - let observed = jobs.clone(); - app.services.print_native = Some(Box::new(move |bytes, _, _, _| { - observed.borrow_mut().push(bytes); - let (sender, receiver) = std::sync::mpsc::channel(); - sender.send(Ok("queued".into())).unwrap(); - receiver - })); - let annots = |bytes: &[u8]| String::from_utf8_lossy(bytes).contains("/Annots"); - app.run("ui.printSubmit", json!({"paper": "A4"})).unwrap(); - assert!(!annots(&jobs.borrow()[0]), "the printer gets no link annotations"); - let (saved, _) = app.session.print_pdf(&json!({"paper": "A4"})).unwrap(); - assert!(annots(&saved), "a saved print PDF keeps its links"); + for mode in [json!(1), json!(2), json!("booklet"), json!("bookletReverse")] { + let mut app = WordApp::new(Session::new(wordcraft_doc::Document::new()), Services::default()); + app.run("insert.link", json!({"url": "https://example.com", "text": "a link"})).unwrap(); + app.printing.printers.push(Printer { name: "Queue".into(), label: String::new(), default: true }); + app.run("ui.printSettings", json!({"printer":"Queue"})).unwrap(); + let jobs = Rc::new(RefCell::new(Vec::new())); + let observed = jobs.clone(); + app.services.print_native = Some(Box::new(move |bytes, _, _, _| { + observed.borrow_mut().push(bytes); + let (sender, receiver) = std::sync::mpsc::channel(); + sender.send(Ok("queued".into())).unwrap(); + receiver + })); + let annots = |bytes: &[u8]| String::from_utf8_lossy(bytes).contains("/Annots"); + app.run("ui.printSubmit", json!({"paper": "A4", "pagesPerSheet": mode})).unwrap(); + assert!(!annots(&jobs.borrow()[0]), "the printer gets no link annotations"); + let (saved, _) = app.session.print_pdf(&json!({"paper": "A4", "pagesPerSheet": mode})).unwrap(); + assert!(annots(&saved), "a saved print PDF keeps its links"); + } } diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 4118919729..e1ce130e3d 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -181,3 +181,17 @@ and their parameter documentation. Search is case-insensitive across IDs, labels and parameter descriptions. Listing commands never discovers printers, submits a job or opens a dialog. Settings inspection is always available; submission becomes enabled when the native printer is ready, or when the browser host provides its print flow. + +### Physical print sheet layout + +`ui.printSubmit`, `ui.print` and `file.printPdf` accept `pagesPerSheet`: the integer +1 (default), 2, 4, 6, 9 or 16, or `"booklet"` / `"bookletReverse"` for left/right binding. +These settings change only the print PDF, leaving document Page Setup unchanged. +Selection/range/parity are applied first. N-up fills cells in row order; booklet mode +pads the selected pages to a multiple of four and pairs outer/inner pages. Copies +repeat complete sheet plans, preserving blank slots at copy boundaries. Native copies +remain a spooler setting. Two-up and booklet sheets are landscape. Use duplex on the +short edge for folded booklets; this does not configure a printer's duplex capability. +The preview shows physical sheet sides, before copies, using the same sheet plan. +Explicit `paper` chooses the physical sheet; otherwise the first selected page supplies +its size. Independent Page Setup multiple-page modes (#2414) are not required. diff --git a/docs/gaps.md b/docs/gaps.md index 76453e23b4..d4e1aa51ef 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where WordCraft falls short of Word -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** trivial (Print Markup comment discovery walks paragraph objects once, #3614); previously trivial (#11: the dialogs of the mirrored Arabic interface read right to left: label-and-field rows, tables (list columns, the Models table), tile galleries and the Add/Remove arrows follow the reading direction, through one `rtl::Table` helper that draws exactly as before in English; no ranked gap closed, readiness estimates unchanged); previously trivial (#4: fonts that aren't installed are flagged in the font box and status bar); previously trivial (#8: Options › Language lists Your languages and Add a language… replaces the Language packs table); previously trivial (#8: the missing-pack bar works on a fresh install and counts the caret's language); previously trivial (#8: Language pack languages are in Set Proofing Language, Review › Language and the status bar; built-in proofing is named as such); previously trivial (#20: layout resource caps and linear-time passes (#3867, #3866)); previously trivial (#3 narrowed: a pasted text box story is charged for the formatting it copies); previously trivial (#3 narrowed: a .doc table row keeps one override per cell); previously trivial (#3 narrowed: a .doc file's sections find their paragraphs by index); previously minor (#11: Arabic interface with mirrored shell landed, #1195; hi/id/pt-PT and Hebrew UI remain); previously trivial (#8: language-packs-2 is published and pinned: 75 packs, adding Danish, German (Germany, Austria, Switzerland), Esperanto, Estonian, Persian, Croatian, Hungarian, Norwegian (Bokmål, Nynorsk), Dutch and Swedish (Sweden, Finland); no ranked gap changed); previously trivial (#8: language-packs-1 is published and pinned, 61 packs: Lithuanian, Romanian, Catalan, French, Greek, Slovak, Serbian and Latvian install as Language packs; Dutch, German and the other compounding languages wait on craft-proof; no ranked gap changed); previously minor (#8: Language packs: every other language's spelling and hyphenation installs from File › Options › Language or the missing-pack bar, through the font store; Lithuanian and Romanian are available as a Language pack once language-packs-1 is published; Dutch, Catalan, French, Greek, Slovak, Serbian and Latvian packs wait on craft-proof engine support); previously trivial (gap 8: English spelling reads SCOWL 2026, one dictionary per English, #40, #520, #5205; no ranked gap changed);; previously trivial (DOCX table rows and cells inside selected alternate-content branches survive open and repeated saves (#5219); broader corpus qualification and readiness estimates unchanged); previously trivial (#26 narrowed: MHT opens and `w:altChunk` content is brought in on open; saving MHT remains) previously trivial (gap 8 points at craft-proof in craft-libs, its data in craft-i18n, #5202; no ranked gap changed); previously trivial (arrowheads keep their kind, width and length and are drawn at Word's sizes; no ranked gap changed); previously trivial (.doc default font from the stylesheet's standard font, #5066; no ranked gap changed); previously trivial (a middle or bottom cell of a row split across pages lines up on the first page; no ranked gap changed); previously trivial (tab leader dots spaced and placed as in Word; no ranked gap changed); previously trivial (a list level above counts its first number at the first deeper item; no ranked gap changed); previously trivial (only the PDF sent to the printer leaves out link annotations; Save these pages as PDF keeps them, #4734; no ranked gap changed); previously trivial (documents with links print: the print job leaves out link annotations, #4734; no ranked gap changed; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion reference-run membership uses one ordered walk, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (gap 19: RTF reads and writes WMF and EMF pictures, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (View windows: several open documents and Switch Windows in the engine; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: text mini toolbar available with the right-click menu, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: tracked table/row/cell/section property changes record in WordCraft, narrowing gap 5; previously trivial: a document with many content controls saves in the time the controls take, #13; previously trivial: Format Page Numbers dialog carries Word's number formats and Continue from previous section / Start at, #1113; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: fixed font inputs in four layout controls; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: #8: English dialects — en-GB, en-CA, en-AU… flag each other's spellings, #1281; previously trivial: #1: shape gradients and transparency, #1500; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: line breaking: a slash opening a word travels whole to the next line, #2963; previously trivial: recipient list search and merged-only view, #1576; previously trivial: #2 impact restated: only ink rendering and OLE editing remain; previously trivial: #2 narrowed: native ink nested in groups and drawing canvases kept on save; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: automatic Asian/Latin and Asian/number spacing laid out, #2358; previously trivial: hint-reliant CJK outlines; previously trivial: numbered headings, #1793; previously trivial: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: #8 narrowed: Indonesian proofing from the installed Hunspell dictionary, #498; previously trivial: glossary/building blocks closed; previously trivial: Split Cells and Convert Text to Table follow the Word check, #2592; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: #29: a copied equation also goes in the MathML clipboard formats, #1297; previously trivial: #24: the Spike, Ctrl+F3 and Ctrl+Shift+F3; previously trivial: VML freeforms read and kept on save; previously trivial: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: floating-table overlap ignores empty line-break lines; previously trivial: copies keep their formatting on the clipboard as HTML, #1523; previously trivial: sample-text formulas on Enter, #1067; previously trivial: #29: copied equations as MathML, OMML open as #1297, #816; previously trivial: the Font list no longer keeps every previewed font in memory, #848; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw Table and Eraser landed, #303; previously minor: beta distance restated: ~15 points, ~150–230 h; previously: first version; every known shortfall from the 2026-10-10 re-measure, ranked) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** trivial (N-up and booklet printing, #641; readiness unchanged); previously trivial (Print Markup comment discovery walks paragraph objects once, #3614); previously trivial (#11: the dialogs of the mirrored Arabic interface read right to left: label-and-field rows, tables (list columns, the Models table), tile galleries and the Add/Remove arrows follow the reading direction, through one `rtl::Table` helper that draws exactly as before in English; no ranked gap closed, readiness estimates unchanged); previously trivial (#4: fonts that aren't installed are flagged in the font box and status bar); previously trivial (#8: Options › Language lists Your languages and Add a language… replaces the Language packs table); previously trivial (#8: the missing-pack bar works on a fresh install and counts the caret's language); previously trivial (#8: Language pack languages are in Set Proofing Language, Review › Language and the status bar; built-in proofing is named as such); previously trivial (#20: layout resource caps and linear-time passes (#3867, #3866)); previously trivial (#3 narrowed: a pasted text box story is charged for the formatting it copies); previously trivial (#3 narrowed: a .doc table row keeps one override per cell); previously trivial (#3 narrowed: a .doc file's sections find their paragraphs by index); previously minor (#11: Arabic interface with mirrored shell landed, #1195; hi/id/pt-PT and Hebrew UI remain); previously trivial (#8: language-packs-2 is published and pinned: 75 packs, adding Danish, German (Germany, Austria, Switzerland), Esperanto, Estonian, Persian, Croatian, Hungarian, Norwegian (Bokmål, Nynorsk), Dutch and Swedish (Sweden, Finland); no ranked gap changed); previously trivial (#8: language-packs-1 is published and pinned, 61 packs: Lithuanian, Romanian, Catalan, French, Greek, Slovak, Serbian and Latvian install as Language packs; Dutch, German and the other compounding languages wait on craft-proof; no ranked gap changed); previously minor (#8: Language packs: every other language's spelling and hyphenation installs from File › Options › Language or the missing-pack bar, through the font store; Lithuanian and Romanian are available as a Language pack once language-packs-1 is published; Dutch, Catalan, French, Greek, Slovak, Serbian and Latvian packs wait on craft-proof engine support); previously trivial (gap 8: English spelling reads SCOWL 2026, one dictionary per English, #40, #520, #5205; no ranked gap changed);; previously trivial (DOCX table rows and cells inside selected alternate-content branches survive open and repeated saves (#5219); broader corpus qualification and readiness estimates unchanged); previously trivial (#26 narrowed: MHT opens and `w:altChunk` content is brought in on open; saving MHT remains) previously trivial (gap 8 points at craft-proof in craft-libs, its data in craft-i18n, #5202; no ranked gap changed); previously trivial (arrowheads keep their kind, width and length and are drawn at Word's sizes; no ranked gap changed); previously trivial (.doc default font from the stylesheet's standard font, #5066; no ranked gap changed); previously trivial (a middle or bottom cell of a row split across pages lines up on the first page; no ranked gap changed); previously trivial (tab leader dots spaced and placed as in Word; no ranked gap changed); previously trivial (a list level above counts its first number at the first deeper item; no ranked gap changed); previously trivial (only the PDF sent to the printer leaves out link annotations; Save these pages as PDF keeps them, #4734; no ranked gap changed); previously trivial (documents with links print: the print job leaves out link annotations, #4734; no ranked gap changed; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion reference-run membership uses one ordered walk, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (gap 19: RTF reads and writes WMF and EMF pictures, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (View windows: several open documents and Switch Windows in the engine; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: text mini toolbar available with the right-click menu, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: tracked table/row/cell/section property changes record in WordCraft, narrowing gap 5; previously trivial: a document with many content controls saves in the time the controls take, #13; previously trivial: Format Page Numbers dialog carries Word's number formats and Continue from previous section / Start at, #1113; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: fixed font inputs in four layout controls; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: #8: English dialects — en-GB, en-CA, en-AU… flag each other's spellings, #1281; previously trivial: #1: shape gradients and transparency, #1500; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: line breaking: a slash opening a word travels whole to the next line, #2963; previously trivial: recipient list search and merged-only view, #1576; previously trivial: #2 impact restated: only ink rendering and OLE editing remain; previously trivial: #2 narrowed: native ink nested in groups and drawing canvases kept on save; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: automatic Asian/Latin and Asian/number spacing laid out, #2358; previously trivial: hint-reliant CJK outlines; previously trivial: numbered headings, #1793; previously trivial: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: #8 narrowed: Indonesian proofing from the installed Hunspell dictionary, #498; previously trivial: glossary/building blocks closed; previously trivial: Split Cells and Convert Text to Table follow the Word check, #2592; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: #29: a copied equation also goes in the MathML clipboard formats, #1297; previously trivial: #24: the Spike, Ctrl+F3 and Ctrl+Shift+F3; previously trivial: VML freeforms read and kept on save; previously trivial: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: floating-table overlap ignores empty line-break lines; previously trivial: copies keep their formatting on the clipboard as HTML, #1523; previously trivial: sample-text formulas on Enter, #1067; previously trivial: #29: copied equations as MathML, OMML open as #1297, #816; previously trivial: the Font list no longer keeps every previewed font in memory, #848; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw Table and Eraser landed, #303; previously minor: beta distance restated: ~15 points, ~150–230 h; previously: first version; every known shortfall from the 2026-10-10 re-measure, ranked) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 > **Highlight update:** 2026-10-25 · Highlight shortcut toggles the last chosen colour off when the whole selection has it; explicit colour commands remain setters (#4085). Readiness estimates unchanged. > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-29 · **Change:** trivial (aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (#15: bibliography sources keep a corporate author, #4848); previously trivial (Table Properties applies to the selected rows, columns and cells, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (#7: Custom Document Properties dialog, #2982; previously trivial: egui 0.37 migration: the interface catalogs stay shared and pinned by `craft-i18n.rev` at `9205108cfdced5177706264038848b68b2422d2b` (27 languages, English fallback); input-method handling has new regressions but managed CI passed, and native IME acceptance plus native-speaker catalog review remain open; previously trivial: Markdown code spans keep line-broken text literal, #3738; previously trivial: small follow-ups from the field, table and AutoFormat batch, #4232; previously trivial: highlight target includes selected paragraph marks, #4085; previously trivial: full-target highlight check beyond 10,000 runs, #4085; previously trivial: Exact-spacing table contact uses the specified line height rather than paragraph-mark metrics (#3977); previously trivial: cu20we: restrict pre-spacing float origins to paragraph anchors; document cap helpers and regressions; previously trivial: a command that changes nothing is not an edit: no undo step, no unsaved changes, no relayout, and the redo stack survives it; previously minor: #8 narrowed: Spanish proofing (Spain, Mexico, Latin America, Uruguay) from the installed Hunspell dictionaries, #3360, #3553; previously trivial: gap 10: group connector rerouting preserves transformed free and unresolved endpoints under nonuniform scaling; obstacle routing still missing; readiness estimates unchanged; previously trivial: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: the ranked gap list held two rows each for #19, #20 and #21; each gap appears once now; a document with many relationships opens in the time its part takes, #3411; previously trivial: the file commands that change the document are checked on a protected document, the protection of a protected document needs an explicit stop, the session author can't change through `file.setAuthor` under protection (the CLI's `--author` uses the same protection check), and the post-check compares the settings and the metadata; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: text mini toolbar available with the right-click menu, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: tracked table/row/cell/section property changes record in WordCraft, narrowing gap 5; previously trivial: a document with many content controls saves in the time the controls take, #13; previously trivial: Format Page Numbers dialog carries Word's number formats and Continue from previous section / Start at, #1113; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: fixed font inputs in four layout controls; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: #8: English dialects — en-GB, en-CA, en-AU… flag each other's spellings, #1281; previously trivial: #1: shape gradients and transparency, #1500; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: line breaking: a slash opening a word travels whole to the next line, #2963; previously trivial: recipient list search and merged-only view, #1576; previously trivial: #2 impact restated: only ink rendering and OLE editing remain; previously trivial: #2 narrowed: native ink nested in groups and drawing canvases kept on save; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: automatic Asian/Latin and Asian/number spacing laid out, #2358; previously trivial: hint-reliant CJK outlines; previously trivial: numbered headings, #1793; previously trivial: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: #8 narrowed: Indonesian proofing from the installed Hunspell dictionary, #498; previously trivial: glossary/building blocks closed; previously trivial: Split Cells and Convert Text to Table follow the Word check, #2592; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: #29: a copied equation also goes in the MathML clipboard formats, #1297; previously trivial: #24: the Spike, Ctrl+F3 and Ctrl+Shift+F3; previously trivial: VML freeforms read and kept on save; previously trivial: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: floating-table overlap ignores empty line-break lines; previously trivial: copies keep their formatting on the clipboard as HTML, #1523; previously trivial: sample-text formulas on Enter, #1067; previously trivial: #29: copied equations as MathML, OMML open as #1297, #816; previously trivial: the Font list no longer keeps every previewed font in memory, #848; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw Table and Eraser landed, #303; previously minor: beta distance restated: ~15 points, ~150–230 h; previously: first version; every known shortfall from the 2026-10-10 re-measure, ranked) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 Recovery discovery no longer interrupts an explicitly created or opened document. Older copies remain in File › Recover, whose buttons use the interface palette. See [local recovery](recovery.md). @@ -70,7 +70,7 @@ Text context menus now include the existing formatting mini toolbar (#2959), inc | 4 | **Pagination differs from Word**: Aptos has no metric-matched substitute; legacy compatibility options only partially covered; no page-by-page comparison harness | B | SECTIONPAGES now counts shared continuous-section pages in body and header/footer fields; legacy same-style cell spacing preserved for measured modes 11/12/14, with mode 15 and non-cell controls; Contextual spacing corrected in body/header probes and repeated table-cell runs; [layout-parity.md](layout-parity.md); [typing-parity.md](typing-parity.md) Known gaps; non-overlapping body floating tables clear header tables; stray labels on page-break-only list paragraphs fixed multi-paragraph field-code blank lines fixed; centred numbered heading labels after leading page breaks fixed (#2964); Arial Unicode MS no longer selects monospace substitutes; a slash opening a word travels whole to the next line (#2963) A right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, so a TOC entry's page number keeps its leader (#1840). Fonts the document uses that aren't installed are flagged in the font box and status bar, except those drawn in a metric-compatible substitute (Carlito for Calibri, Liberation Sans for Arial) and symbol-font text (Symbol, Wingdings, Webdings), so the user knows when line breaks can differ from where the document was made; `font.missing` lists the substituted fonts in the text the current view lays out (capped, for hostile documents), marking the metric-compatible ones `metricCompatible`. | Page counts and line breaks differ, which matters for forms, legal and academic work | 30–50 + owner (font) | [layout-parity.md](layout-parity.md) | | 2 | **Word's native ink is not drawn from its strokes**; OLE objects show only their picture | B | Every native ink form is preserved: drawing-level ink with its optional picture fallback, direct run-level content parts, and ink members of groups and drawing canvases (kept in their place among the members, drawn from their fallback picture). Drawing canvases are read and written (#344); group shapes (`wpg`) read and written (#267). Charts and SmartArt are drawn (#292) and, with OLE objects, written back with all their parts on save (#319) | Pen notes from Word show only as their picture and can't be edited; OLE objects can't be opened | 45–70 to render and edit charts and SmartArt (#13) | [file-format-parity.md](file-format-parity.md) | | 5 | **Content controls** landed (#381): `w:sdt` kept, shown and edited (Developer tab, Design Mode, Properties). Move tracking landed (#400): `w:moveFrom`/`w:moveTo` with their named ranges round-trip, a tracked cut and paste of a paragraph or sentence records a move, either end accepts/rejects both, green double strike/underline markup and "Moved from/to" balloons; Track Changes Options has the Moves rows (Moved from / Moved to mark and colour) and `w:doNotTrackMoves` (Track moves off: a cut and paste is a deletion and an insertion) round-trips; still missing: drag-and-drop moves (no text drag yet). Formatting revisions landed (#41): `w:rPrChange`/`w:pPrChange`/`w:tblPrChange`/`w:trPrChange`/`w:tcPrChange`/`w:sectPrChange`/`w:numberingChange` round-trip, are recorded while tracking, accepted/rejected and shown in balloons; still missing: tracked style-definition changes (table, row, cell and section property changes now record in WordCraft too, #41 follow-up). Opaque custom XML backing stores now survive saves; binding evaluation remains absent. Replace All now checks content-control locks before editing any match; a refused batch preserves the document and undo history. | B | List-label pitch corrected in synthetic metric controls; Issues #41, #400; source grep | Legal and editorial review workflows; templates with form controls | 5–8 | [file-format-parity.md](file-format-parity.md) | -| 6 | **Print dialog depth**: desktop printer choice, copies, collation, duplex and grayscale submit through craft-print; File › Print retains preview, page ranges and odd/even (#641) and scales pages to another paper size (#2108); driver tray/options and pages per sheet remain; web prints through the browser (#209) | B | `ui.print` → `apps/wordcraft/src/print.rs`; issue #15 | Everyone who prints | 5–8 | [hardware-parity.md](hardware-parity.md) | +| 6 | **Print dialog depth**: desktop printer choice, copies, collation, duplex and grayscale submit through craft-print; File › Print retains preview, page ranges and odd/even (#641) and scales pages to another paper size (#2108); print-only N-up and booklets are available; driver tray/options remain; web prints through the browser (#209) | B | `ui.print` → `apps/wordcraft/src/print.rs`; issue #15 | Everyone who prints | 5–8 | [hardware-parity.md](hardware-parity.md) | | 7 | **Dialog depth**: Word-observed spelling/grammar task pane added (shared review commands, current-story traversal; see [spelling-review.md](spelling-review.md)); 61 modal dialogs vs Word's ~100 (Custom Document Properties from File › Info, #2982; Drop Cap Options matches Word's menu and dialog; Split Cells and Convert Text to Table match Word's observed limits and defaults; Format Page Numbers carries Word's number formats and Continue from previous section / Start at, #1113) | B | `Dialog` enum in `crates/ui-egui/src/dialogs.rs`; Cell Margins (#1960) now opens with current defaults and applies only confirmed edits | Power users reach for dialogs the ribbon alone doesn't cover | 11–19 | [ui-parity.md](ui-parity.md) | | 9 | **Password-protected `.doc` files with an AES header in the Word 97-2003 format** can't be opened: [MS-OFFCRYPTO] defines AES only for encrypted packages, so these are refused with a clear message. Encrypted packages open under any Word extension (`.docx`, `.doc`, `.dot`…) with either agile (Word 2010+) or Standard (Word 2007, AES-ECB) encryption; protected `.docx` saves with agile encryption (#55, #281, gap 9) | | `crates/docx/src/crypt.rs` (agile and Standard); `crates/docbin/src/crypt.rs` opens XOR/RC4/RC4 CryptoAPI `.doc` with a password (#1079). All synthetic fixtures; untested on Word-written files | Corporate and legal users with old files | 0 (refused by design; nothing left to build) | [file-format-parity.md](file-format-parity.md) | | 8 | **Built-in proofing covers English, Polish, Portuguese, Italian, Croatian, Turkish, Russian, Czech, Indonesian and Spanish only**; the other languages Word proofs get spelling and their own hyphenation only from an installed Language pack (without one their text is left unmarked and hyphenated with the English patterns; Bulgarian and German have their own), and none of them has grammar rules | | craft-proof (storytold/craft-libs `crates/proof`, data in craft-i18n `language-data/`) `ProofLang::PROOFED`: English (American, British-spelling and Canadian, each checked against its own SCOWL 2026 dictionary and flagging the other's spellings, #1281, #40, #520), Polish, Portuguese (pt-BR via the installed VERO dictionary, #797), Italian (it-IT via the installed Hunspell dictionary), Croatian (hr-HR, 2026-10-13), Turkish (tr_TR spelling, grammar, TDK hyphenation, 2026-10-13) Russian (the installed `ru_RU` dictionary, 2026-10-12) Indonesian (the installed `id_ID` dictionary, #498, 2026-10-16) and Spanish (es-ES, es-MX, es-419 and es-UY via the installed RLA-ES dictionaries, Uruguayan `vos` forms, #3360, #3553, 2026-10-22), a language per run; Bulgarian (#826) and German (TeX patterns, 2026-10-14) have hyphenation only; open PRs add Danish (#723), Russian (#894) and Czech (#1048); Word ships 120 proofing tools; issues #25, #100 open. **Language packs** (CP4, 2026-11-01): a pack per locale (spelling dictionary, hyphenation, licence texts) installs from File › Options › Language or the missing-pack bar through the font store and is read at once (the bar offers a language before the list is fetched, and the caret's typing language counts); language-packs-1 (pinned, 61 packs) has Lithuanian [#4707](https://github.com/storytold/wordcraft/issues/4707), Romanian [#3438](https://github.com/storytold/wordcraft/issues/3438), Catalan [#2895](https://github.com/storytold/wordcraft/issues/2895)/[#4947](https://github.com/storytold/wordcraft/issues/4947), French [#1325](https://github.com/storytold/wordcraft/issues/1325), Greek [#2561](https://github.com/storytold/wordcraft/issues/2561), Slovak [#3806](https://github.com/storytold/wordcraft/issues/3806), Serbian [#4968](https://github.com/storytold/wordcraft/issues/4968) and Latvian [#4438](https://github.com/storytold/wordcraft/issues/4438), with Polish, Portuguese, Italian, Russian, Czech, Spanish, Bulgarian, Bosnian, Slovenian and the rest; Dutch [#4145](https://github.com/storytold/wordcraft/issues/4145)/[#2505](https://github.com/storytold/wordcraft/issues/2505), German, Danish, Swedish, Norwegian, Hungarian and the other compounding languages are packs in language-packs-2 (craft-proof's flag-based compounding, storytold/craft-libs#497); Mongolian waits on faster suggestions, Thai on word segmentation, and Basque, Ukrainian and Uyghur are excluded on licence grounds (see [installing languages](spelling-dictionaries.md#language-packs)) | Every writer outside English, Polish, Portuguese, Italian, Croatian, Turkish, Russian, Czech, Indonesian and Spanish | 20–40 | [localization-parity.md](localization-parity.md) | @@ -143,6 +143,8 @@ Small follow-ups from the 2026-10-25 field, table and AutoFormat batch (#4232): Recipient label generation (#4880) now includes all selected recipients across as many sheets as needed, retaining filtered/sorted order and the chosen product geometry. This fixes the one-sheet omission; Update Labels and Finish & Merge template behavior remain separate, and gap 21 remains open. Readiness estimates are unchanged. +File > Print offers 2, 4, 6, 9 or 16 logical pages per physical sheet side and left/right-bound booklets (#641). Preview and print PDF share the sheet plan, selected pages, parity, copy padding and markup geometry. Custom-range changes reset the preview to the first sheet; Print Markup invalidates preview layout and textures. Native jobs omit link annotations as required by upstream #4734, while saved print PDFs keep their remapped links. Native printing submits copies to the spooler without multiplying them in the PDF. Ordinary PDF export remains single-page by default. Translations are reviewed separately in craft-i18n#38. Physical-printer qualification and driver-specific options remain unverified. + Table rows and cells inside `mc:AlternateContent` use the same selected-branch policy as paragraphs and runs (#5219), rather than disappearing on open and save. Original synthetic fixtures cover Choice/Fallback selection, namespace aliases, mixed requirements, row/cell order and nested content controls through two DOCX saves. This fixes a focused preservation case; native Word and broader real-world corpus qualification remain open. ## Revision history @@ -194,6 +196,7 @@ Table rows and cells inside `mc:AlternateContent` use the same selected-branch p | 2026-10-29 | trivial | Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880). Filtered/sorted order, product geometry and single-label mode retained; readiness estimates unchanged. | | 2026-10-29 | trivial | HTML import keeps preformatted lines with CR, CRLF or LF input newlines (#4810); numeric character references retain their separate meaning; readiness estimates unchanged. | | 2026-10-26 | minor | Word-observed Proofing task pane uses shared review commands; clicking a suggestion corrects and advances; context, suggestion cards and ignore/dictionary links follow the Windows reference; inspected previews prompted a full-width context and scrollable three-card list; exact selected spelling takes priority over overlapping grammar, with command/pane regressions and integration workflow paths; readiness estimates unchanged | +| 2026-11-01 | trivial | N-up and booklet print imposition (#641): integrate current print-job link handling (#4734), preserve markup preview and sheet/copy planning; readiness estimates unchanged. | | 2026-10-22 | trivial | View windows: several open documents and Switch Windows in the engine | | 2026-10-25 | trivial | egui 0.37 migration: interface catalogs remain pinned by `craft-i18n.rev` (`9205108…`; 27 languages, English fallback); IME surrounding deletions and composition resets are implemented with regressions, but managed CI passed; native IME acceptance and native-speaker catalog review remain open; no gap or readiness change | | 2026-10-17 | trivial | Gap 9 narrowed: Standard (Word 2007, AES-ECB) encrypted packages open with a password under any Word extension; AES headers in Word 97-2003 files are outside the public spec and refused with a clear message; estimate 3–5 → 0 h, since the remaining AES-in-`.doc` case is refused by design | diff --git a/docs/hardware-parity.md b/docs/hardware-parity.md index bf62281b0f..43f13f4838 100644 --- a/docs/hardware-parity.md +++ b/docs/hardware-parity.md @@ -1,6 +1,6 @@ # Hardware parity with Microsoft Word -> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-30 · **Change:** trivial (only the PDF sent to the printer has no link annotations; Save these pages as PDF keeps them, #4734); previously trivial (a document with links prints: the print job's PDF has no link annotations, #4734; previously trivial: Pen / stylus row: two-stroke and closed-head arrows; previously trivial: Pen / stylus row: ink, eraser and Ink to Shape incl. arrows landed; previously trivial: a window too big for its screen shrinks to fit when it opens, #1215; previously trivial: 32-bit Windows starts on OpenGL; previously major: first version) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 and Word for Windows +> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-11-01 · **Change:** trivial (only the PDF sent to the printer has no link annotations; Save these pages as PDF keeps them, #4734); previously trivial (a document with links prints: the print job's PDF has no link annotations, #4734; previously trivial: Pen / stylus row: two-stroke and closed-head arrows; previously trivial: Pen / stylus row: ink, eraser and Ink to Shape incl. arrows landed; previously trivial: a window too big for its screen shrinks to fit when it opens, #1215; previously trivial: 32-bit Windows starts on OpenGL; previously major: first version) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 and Word for Windows > **Printing update:** 2026-10-12 · direct desktop printing through craft-print; details below. @@ -12,7 +12,7 @@ pens, microphones (Dictate) and speakers (Read Aloud), and displays. | Hardware | Word | WordCraft macOS | Windows | Linux / BSD | Web | Parity | Hours | |---|---|---|---|---|---|---|---| -| Printers: native print dialog, printer choice, copies, duplex, page ranges, tray, scaling | ✅ (`WordPDE.plugin` print-dialog extension on Mac) | 🟡 Direct CUPS printing; printer, copies, collation, duplex, ranges, grayscale and scale to paper size; on every desktop the PDF sent to the printer leaves out link annotations, which the spooler can't fit to the paper; Save these pages as PDF keeps them (#4734) | 🟡 Direct spooler printing; printer, copies, collation, duplex, ranges, grayscale and scale to paper size; on every desktop the PDF sent to the printer leaves out link annotations, which the spooler can't fit to the paper; Save these pages as PDF keeps them (#4734) | 🟡 Direct spooler printing; printer, copies, collation, duplex, ranges, grayscale and scale to paper size; on every desktop the PDF sent to the printer leaves out link annotations, which the spooler can't fit to the paper; Save these pages as PDF keeps them (#4734) | ✅ browser print dialog (#209) | 35% | 5–8 | +| Printers: native print dialog, printer choice, copies, duplex, page ranges, tray, scaling | ✅ (`WordPDE.plugin` print-dialog extension on Mac) | 🟡 Direct CUPS printing; printer, copies, collation, duplex, ranges, grayscale, scale to paper size, N-up and booklets; on every desktop the PDF sent to the printer leaves out link annotations, which the spooler can't fit to the paper; Save these pages as PDF keeps them (#4734) | 🟡 Direct spooler printing; printer, copies, collation, duplex, ranges, grayscale, scale to paper size, N-up and booklets; on every desktop the PDF sent to the printer leaves out link annotations, which the spooler can't fit to the paper; Save these pages as PDF keeps them (#4734) | 🟡 Direct spooler printing; printer, copies, collation, duplex, ranges, grayscale, scale to paper size, N-up and booklets; on every desktop the PDF sent to the printer leaves out link annotations, which the spooler can't fit to the paper; Save these pages as PDF keeps them (#4734) | ✅ browser print dialog (#209) | 35% | 5–8 | | GPU rendering, HiDPI/Retina, pixel-aligned text | ✅ | ✅ wgpu + vello_cpu rasteriser, whole-pixel text (#110, #165) | ✅ DirectX 12 default (#50), OpenGL when DirectX 12 has no GPU driver (#316) or on 32-bit; startup crash on Intel UHD (#170) | ✅ (soft text on KDE at some zooms, #140) | ✅ | 80% | 3–5 (bugs) | | Pen / stylus: ink, pressure, eraser, ink to shape/math | ✅ (Draw tab, `InkRender.bundle`) | 🟡 ink, stroke eraser, Ink to Shape incl. one- and two-stroke arrows with open or closed heads (#307, #395); pressure and Ink to Math missing | 🟡 same | 🟡 same | 🟡 same | 50% | (Draw tab, 15–25) | | Multiple monitors, per-monitor DPI, remembered window position, a window that fits its screen | ✅ | ✅ (#38, #76, #1215) | ✅ (winit DPI fix pending, #155) | ✅ | — | 85% | 1 | @@ -21,10 +21,13 @@ pens, microphones (Dictate) and speakers (Read Aloud), and displays. | Touch screens and touchpads: pinch zoom, inertial scroll | ✅ | ✅ pinch (#179) | ✅ | ✅ inertial scroll (#252) | ✅ | 85% | 0–1 | | Scanners/cameras (Insert from device / Continuity Camera on Mac) | ✅ | ❌ | ❌ | ❌ | ❌ | 0% | 2–4 | +File > Print offers 2, 4, 6, 9 or 16 logical pages per physical sheet side and left/right-bound booklets (#641). Preview and print PDF share the sheet plan, selected pages, parity, copy padding and markup geometry. Custom-range changes reset the preview to the first sheet; Print Markup invalidates preview layout and textures. Native jobs omit link annotations as required by upstream #4734, while saved print PDFs keep their remapped links. Native printing submits copies to the spooler without multiplying them in the PDF. Ordinary PDF export remains single-page by default. Translations are reviewed separately in craft-i18n#38. Physical-printer qualification and driver-specific options remain unverified. + ## Revision history | Date | Change | Summary | |---|---|---| +| 2026-11-01 | trivial | N-up and booklet print imposition (#641): integrate current print-job link handling (#4734), preserve markup preview and sheet/copy planning; readiness estimates unchanged. | | 2026-10-30 | trivial | Only the PDF sent to the printer leaves out link annotations; Save these pages as PDF (`file.printPdf`) keeps them (#4734) | | 2026-10-29 | trivial | A document with links prints: the print job's PDF leaves out link annotations, which the spooler refused to fit to the paper (#4734) | | 2026-10-15 | trivial | Pen / stylus row: Ink to Shape also makes two-stroke arrows and arrows with a closed triangle head | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index fab30db9dc..a2c29a4501 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity with Microsoft Word -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** trivial (missing fonts flagged in the font box and status bar, read from what layout drew; metric-compatible substitutes and symbol fonts not flagged); previously minor (Options › Language redesign: Your languages, Add a language…, Set as default; the Dictionaries folder moved from Proofing); previously trivial (a long comment's card and balloon stop at ten lines, #3382); previously minor (Arabic mirrored interface: ribbon, panes, File page, dialogs, menus; document canvas independent, #1195); previously trivial (Alt, F badges the Backstage pages; Alt, F, P and V open Print, #4960); previously trivial (View › Macros opens a Macros dialog with Run, Delete and Record, #4327); previously trivial (aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (Table Properties: row, column and cell settings apply to the selected rows, columns and cells; mixed row check boxes, #4857); previously trivial (Insert › Shapes shows the basic shapes as a grid of drawn icon tiles, #4349); previously trivial (File › Options › Proofing › AutoCorrect Options opens with no document open, #4585); previously trivial (the Shading buttons show the last picked colour, #4412); previously trivial (a blank User Name in File › Options stays blank after a restart, #4368); previously trivial (window size falls back to the screen rectangle when the reported inner size is invalid; equation symbol tooltips no longer repeat a missing glyph's name); previously trivial (window titles and suggested file names omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (Custom Document Properties dialog from File › Info › Properties › Advanced Properties…, #2982; previously trivial: View › Window › New Window opens another window on the document, each with its own caret and view; previously trivial: mail merge: First Record, Last Record and a record number box in Preview Results; Finish & Merge asks which records to merge or print, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: read only and comments-only protection grey out edits; previously trivial: the Font dialog previews "NaN" or "inf" in the Size box at 12 pt, #3663; previously trivial: File › Options disables the User name field while Restrict Editing is active; previously trivial: while editing a header or footer, a click in the other one edits it there without scrolling; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Insert Table of Figures dialog: any caption label, #3013; previously trivial: Home › Underline drop-down shows its lines, #2738; previously trivial: the text context menu includes the formatting mini toolbar, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: the scrollbar page tip stays on one line as the page number grows, #3341; previously trivial: File › Home and New: templates and recent documents are buttons named for screen readers, #3176; previously trivial: forms protection greys out the Developer tab's control buttons and Properties; previously trivial: AltGr doesn't open KeyTips, #2388; previously trivial: closing the header or footer puts the caret back where it was in the body, #3331; previously trivial: Format Page Numbers dialog: number format and Continue from previous section / Start at, #1113; previously trivial: inline pictures drag to a dashed insertion cursor and stay inline, #2233, #2234; previously trivial: Save Changes prompt: a text file saved over itself closes, #2376; previously trivial: the equation being edited is framed as in Word: an outline as tall as its line, a grip, an options strip that opens its menu, and its current argument shaded; previously trivial: the table handles show while the caret is in the table, #2428; previously trivial: legacy menu keys, #1697; previously trivial: Shape Fill › Gradient and the Format Shape pane, #1500; previously trivial: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: the text pointer over the page is drawn black or white on Windows, #1746; previously trivial: a click in the header/footer band from the body no longer scrolls to the body text, #2103; previously trivial: File › Recover follows the app theme, #3243; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: dragging the vertical scrollbar names the page at the top of the window, #2551; previously trivial: Add Font imports every selected font file, #1789); previously trivial (File › Close keeps the window, #1712; previously trivial: the Spike: Ctrl+F3 and Ctrl+Shift+F3; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: the tab strip never draws tabs over Comments / Editing / Share, #2026; previously trivial: Columns on selected text, #2024; previously trivial: Different First Page headers reachable from page 1, #2826; previously trivial: a copied equation also goes in the clipboard's MathML formats, #1297; previously trivial: Read Mode keeps the keyboard, shows whole columns and keeps text clear of the page-turn bar, #1772); previously trivial: font list entries of tall-ascent fonts sit in their row, not cut off, #2570); previously trivial: Split Cells and Convert Text to Table dialogs follow Word's merged-cell limits and Initial column width, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout text fills the window width, #1876; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717)); previously trivial: comment balloons readable in the dark theme, #2045; previously trivial: Recently Used Fonts section at the top of the font list, #2068; previously trivial: web preferences kept between visits, #2132; previously trivial: dialog close control: a Windows-style box at the title bar's right end, the whole box clickable, red on hover, #1885); previously trivial (Modify Table Style formats every table style part, #714); previously trivial: a click on the ribbon chrome hands the keyboard to the page in the same frame, #1093 follow-up; previously trivial: Page Setup vertical alignment, #1320; previously trivial: the app opens on the Home tab every launch, as in Word; previously trivial: no document behind the Start screen, #1129; previously trivial: equation pictures share a few textures, #1002; previously trivial: selection bar in the left margin, #856; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously major: first version; ribbon, dialogs, shortcuts and on-canvas interaction measured from `crates/ui-egui` and the command registry) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** trivial (N-up and booklet printing, #641; readiness unchanged); previously trivial (missing fonts flagged in the font box and status bar, read from what layout drew; metric-compatible substitutes and symbol fonts not flagged); previously minor (Options › Language redesign: Your languages, Add a language…, Set as default; the Dictionaries folder moved from Proofing); previously trivial (a long comment's card and balloon stop at ten lines, #3382); previously minor (Arabic mirrored interface: ribbon, panes, File page, dialogs, menus; document canvas independent, #1195); previously trivial (Alt, F badges the Backstage pages; Alt, F, P and V open Print, #4960); previously trivial (View › Macros opens a Macros dialog with Run, Delete and Record, #4327); previously trivial (aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (Table Properties: row, column and cell settings apply to the selected rows, columns and cells; mixed row check boxes, #4857); previously trivial (Insert › Shapes shows the basic shapes as a grid of drawn icon tiles, #4349); previously trivial (File › Options › Proofing › AutoCorrect Options opens with no document open, #4585); previously trivial (the Shading buttons show the last picked colour, #4412); previously trivial (a blank User Name in File › Options stays blank after a restart, #4368); previously trivial (window size falls back to the screen rectangle when the reported inner size is invalid; equation symbol tooltips no longer repeat a missing glyph's name); previously trivial (window titles and suggested file names omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (Custom Document Properties dialog from File › Info › Properties › Advanced Properties…, #2982; previously trivial: View › Window › New Window opens another window on the document, each with its own caret and view; previously trivial: mail merge: First Record, Last Record and a record number box in Preview Results; Finish & Merge asks which records to merge or print, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: read only and comments-only protection grey out edits; previously trivial: the Font dialog previews "NaN" or "inf" in the Size box at 12 pt, #3663; previously trivial: File › Options disables the User name field while Restrict Editing is active; previously trivial: while editing a header or footer, a click in the other one edits it there without scrolling; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Insert Table of Figures dialog: any caption label, #3013; previously trivial: Home › Underline drop-down shows its lines, #2738; previously trivial: the text context menu includes the formatting mini toolbar, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: the scrollbar page tip stays on one line as the page number grows, #3341; previously trivial: File › Home and New: templates and recent documents are buttons named for screen readers, #3176; previously trivial: forms protection greys out the Developer tab's control buttons and Properties; previously trivial: AltGr doesn't open KeyTips, #2388; previously trivial: closing the header or footer puts the caret back where it was in the body, #3331; previously trivial: Format Page Numbers dialog: number format and Continue from previous section / Start at, #1113; previously trivial: inline pictures drag to a dashed insertion cursor and stay inline, #2233, #2234; previously trivial: Save Changes prompt: a text file saved over itself closes, #2376; previously trivial: the equation being edited is framed as in Word: an outline as tall as its line, a grip, an options strip that opens its menu, and its current argument shaded; previously trivial: the table handles show while the caret is in the table, #2428; previously trivial: legacy menu keys, #1697; previously trivial: Shape Fill › Gradient and the Format Shape pane, #1500; previously trivial: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: the text pointer over the page is drawn black or white on Windows, #1746; previously trivial: a click in the header/footer band from the body no longer scrolls to the body text, #2103; previously trivial: File › Recover follows the app theme, #3243; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: dragging the vertical scrollbar names the page at the top of the window, #2551; previously trivial: Add Font imports every selected font file, #1789); previously trivial (File › Close keeps the window, #1712; previously trivial: the Spike: Ctrl+F3 and Ctrl+Shift+F3; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: the tab strip never draws tabs over Comments / Editing / Share, #2026; previously trivial: Columns on selected text, #2024; previously trivial: Different First Page headers reachable from page 1, #2826; previously trivial: a copied equation also goes in the clipboard's MathML formats, #1297; previously trivial: Read Mode keeps the keyboard, shows whole columns and keeps text clear of the page-turn bar, #1772); previously trivial: font list entries of tall-ascent fonts sit in their row, not cut off, #2570); previously trivial: Split Cells and Convert Text to Table dialogs follow Word's merged-cell limits and Initial column width, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout text fills the window width, #1876; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717)); previously trivial: comment balloons readable in the dark theme, #2045; previously trivial: Recently Used Fonts section at the top of the font list, #2068; previously trivial: web preferences kept between visits, #2132; previously trivial: dialog close control: a Windows-style box at the title bar's right end, the whole box clickable, red on hover, #1885); previously trivial (Modify Table Style formats every table style part, #714); previously trivial: a click on the ribbon chrome hands the keyboard to the page in the same frame, #1093 follow-up; previously trivial: Page Setup vertical alignment, #1320; previously trivial: the app opens on the Home tab every launch, as in Word; previously trivial: no document behind the Start screen, #1129; previously trivial: equation pictures share a few textures, #1002; previously trivial: selection bar in the left margin, #856; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously major: first version; ribbon, dialogs, shortcuts and on-canvas interaction measured from `crates/ui-egui` and the command registry) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 Recovery discovery no longer interrupts an explicitly created or opened document. Older copies remain in File › Recover, whose buttons use the interface palette. See [local recovery](recovery.md). @@ -82,6 +82,8 @@ Aligned copy drags keep their locked document coordinate when middle-button scro Labels → New Document with “One label per recipient” includes all filtered/sorted recipients across product-sized sheets (#4880). The last sheet keeps unused labels blank. Fixed text and Single label still produce one sheet. Native Windows interaction and comparison with Microsoft Word remain unverified; this change does not add Update Labels or change Finish & Merge templates. +File > Print offers 2, 4, 6, 9 or 16 logical pages per physical sheet side and left/right-bound booklets (#641). Preview and print PDF share the sheet plan, selected pages, parity, copy padding and markup geometry. Custom-range changes reset the preview to the first sheet; Print Markup invalidates preview layout and textures. Native jobs omit link annotations as required by upstream #4734, while saved print PDFs keep their remapped links. Native printing submits copies to the spooler without multiplying them in the PDF. Ordinary PDF export remains single-page by default. Translations are reviewed separately in craft-i18n#38. Physical-printer qualification and driver-specific options remain unverified. + ## Spelling and grammar correction Review › Spelling & Grammar, Home › Editor and F7 open a right-side Proofing task pane. Black-box observation of Word for Windows on 2026-10-26 established the arrangement: issue category, dictionary explanation, sentence context with the issue underlined, a bordered stack of suggestion cards, then Ignore Once, Ignore All and Add to Dictionary links. Clicking a suggestion applies it and advances. The pane uses WordCraft's existing title/docking/close host and its own icons and palette; no Microsoft assets are copied. The suggestion menu exposes supported manual replacement and AutoCorrect actions; Word's synonyms, spelling-out and Change All are not implemented here. No pixel-identical claim is made until the rendered comparison is inspected. @@ -112,6 +114,7 @@ Right-click and Shift+F10 keep the compact suggestions menu. The pane is shared | 2026-10-26 | trivial | Layout › Arrange › Group stays on while a group is selected, so Ungroup in its menu can be reached; it was greyed out because one object has nothing to group (#4229) | | 2026-10-27 | trivial | Port the existing Proofing pane and navigation/selection regressions to extracted engine/UI modules on main `436d444`; preserve compact context menus; new-SHA validation pending, readiness unchanged | | 2026-10-26 | minor | Word-observed Proofing task pane uses shared review commands; clicking a suggestion corrects and advances; context, suggestion cards and ignore/dictionary links follow the Windows reference; inspected previews prompted a full-width context and scrollable three-card list; exact selected spelling takes priority over overlapping grammar, with command/pane regressions and integration workflow paths; readiness estimates unchanged | +| 2026-11-01 | trivial | N-up and booklet print imposition (#641): integrate current print-job link handling (#4734), preserve markup preview and sheet/copy planning; readiness estimates unchanged. | | 2026-10-22 | trivial | View › Window › New Window opens another window on the document, focused and cascaded; two windows on one document are titled `Name:1` and `Name:2` (one window: the plain name). Each window keeps its own selection, scroll position, zoom, view mode, ruler and panes; the text, undo history, unsaved state and file are the document's, so an edit or Undo in either window shows in both, and a caret in text the other window deleted moves to the nearest place left. Closing one of a document's windows asks nothing; closing its last asks about unsaved changes, and quitting asks once per document. Switch Windows lists every window. The web app keeps one window | | 2026-10-22 | trivial | One native window per open document on the desktop (the web app keeps one window): New and Open open the document in a window of its own, focused and cascaded from the last; Open replaces an untouched blank document in its window and brings an already-open file's window forward; each window keeps its own ribbon tab, File page, dialogs, panes and composition; View › Window › Switch Windows lists the windows and brings the chosen one forward; File › Close and the window's close button close the window (asking about unsaved changes) and the window focused before comes forward, while the last window stays open with no document; quitting asks Save / Don't Save / Cancel about each document in its own window | | 2026-10-22 | trivial | Several open documents in one window (one window per document comes next): View › Window › Switch Windows lists the open documents, the shown one marked and unsaved ones dotted, and shows the one chosen, with its own scroll position, zoom, comment drafts and AutoSave file; File › New, Open, Envelopes, Labels, Finish & Merge and personal templates open beside the open documents without asking about unsaved changes; File › Close shows the next open document; the window's close button asks Save / Don't Save / Cancel about each document with unsaved changes, showing it, and Cancel keeps the app open. Untitled documents are numbered (Document2) in the interface language |