Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Merge #452: M6: Adopt craft-print and support Windows PDF printing

aiongg978a9b9b983b
diff --cc Cargo.toml
index 0fe2ca16a,4fcbfd625..072dd9831
--- a/Cargo.toml
+++ b/Cargo.toml
@@@ -66,9 -66,7 +66,12 @@@ krilla = { version = "0.8", features =
hayro = "0.7"
quick-xml = "0.38"
zip = { version = "3", default-features = false, features = ["deflate"] }
+# INDD/INDT → IDML conversion for File › Open (indd-utils, tracking its main branch; MIT OR Apache-2.0, no dependencies).
+indd = { git = "https://github.com/aiongg/indd-utils", branch = "main" }
+
++# File › Print through the system print spooler (craft-libs).
++craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d991bf6792f8ade99c51358bf3c1d902c8cd96b5" }
+
# ui
# Shared frontend components; keep this dependency above the engine boundary.
craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5c874d51eeb3de70e735c8ce87a59a7dedd47675", features = ["serde"] }
diff --cc ROADMAP.md
index f26bc6a19,82a42cf18..02bd401da
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@@ -2,7 -2,7 +2,7 @@@
**Stage: pre-alpha** · next: alpha, ~0% and ~15–25 h away; beta ~28 points and ~420–750 h beyond that (the core-workflow gate, not the percentage: ready for real work is already ~47%)
- > **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-11 · **Change:** minor (Japanese print, import and table controls localized; Live corners (#186); Optical kerning from outlines (#181); macOS lists fonts that font services and managers activate) · **Target:** Adobe InDesign 2026
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (shared print spooler; Windows CI passes) · **Target:** Adobe InDesign 2026
++> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-11 · **Change:** minor (Japanese print, import and table controls localized; Live corners (#186); Optical kerning from outlines (#181); macOS lists fonts that font services and managers activate; shared print spooler; Windows CI passes) · **Target:** Adobe InDesign 2026
DesignCraft aims at full Adobe InDesign parity, and to be better: faster, open (documented JSON
format + IDML), scriptable by agents (MCP), and available on the web.
@@@ -129,38 -129,8 +129,39 @@@ list) · [roadmap.md](docs/roadmap.md)
Newest first.
+- **2026-10-12** · Properties › Transform shows rotation, shear and X/Y scale, and Rotate 90° and Flip Horizontal/Vertical buttons, as InDesign's does. No readiness percentage change.
+- **2026-10-12** · Underlines and strikethroughs are drawn as one bar per stretch of text on screen, as in PDF export: a bar per letter left faint seams between the letters. No readiness percentage change.
+- **2026-10-12** · Words in capitals hyphenate like capitalized words (FERRUM COM-MODI), as in InDesign; Hyphenate Capitalized Words off keeps them whole. No readiness percentage change.
+ - **2026-10-11 (printing):** `file.printers` and `file.print` use craft-libs/craft-print for CUPS and Windows. DesignCraft retains PDF export, page selection, spreads, marks and bleed; dry runs create no temporary PDF or print job. Windows selects matching or default driver paper and shrinks oversized sheets without enlarging smaller ones; queue duplex defaults are preserved. Headless tests exercise exported bytes, job settings, dry runs and refusals; shared native Windows CI passes, including paused-queue submission and cleanup. PostScript, production print controls and physical output validation remain open. No readiness percentage change.
-
+- **2026-10-11** · The View menu follows InDesign's: proofing first, then zoom, Rotate Spread, Screen Mode, Display Performance, rulers, Extras, Grids & Guides and Structure; the view items that sat at the end of the Type menu moved there. No readiness percentage change.
+- **2026-10-11** · Properties › Appearance's Fill and Stroke menus gain InDesign's Tint field and, for a text frame, Apply To: Frame / Text. No readiness percentage change.
+- **2026-10-11** · `story.replaceRange`, `story.setText`, notes, footnotes, endnotes, type on a path and table cells read `\r` and `\r\n` as paragraph returns, as `frame.create` and `text.insert` already did. No readiness percentage change.
+- **2026-10-11** · Corner Options keep curved sides curved and round every corner point, including where an arc meets a line (a Pathfinder quarter circle with rounded corners stayed a triangle). No readiness percentage change.
+- **2026-10-11:** Type › Justification… (Cmd+Alt+Shift+J, also in the Paragraph panel menu) sets word and letter spacing, glyph scaling and the composer on the selected paragraphs, sharing the Paragraph Style Options section (#531). No readiness percentage change.
+- **2026-10-11** · Properties gains InDesign's Pathfinder section (Add, Subtract, Intersect, Exclude Overlap, Minus Back) with several objects selected; section titles and icon buttons have accessible names. No readiness percentage change.
+- **2026-10-11** · `transform.move {copy}`, Edit › Duplicate and Step and Repeat return the copies' ids, so a script can go on with them. No readiness percentage change.
+- **2026-10-11** · `object.fill` and `object.stroke` refuse a swatch name the document doesn't have (it painted nothing) and suggest the name meant (`Paper` → `[Paper]`). No readiness percentage change.
+- **2026-10-11** · Japanese captions now cover print ranges, imported style handling and table
+ row/column movement, including row-height distribution. Existing translation and RTL helpers
+ handle the display; command IDs, stored option values and user-defined style names are unchanged.
+- **2026-10-11** · Moving a sheared and rotated text frame no longer leaves trails of text behind: canvas repaints cover the frame's whole text box, not just its outline. No readiness percentage change.
+- **2026-10-11** · Live corners: the yellow widget on a selected rectangle frame shows corner
+ diamonds; dragging one rounds the corners, Alt-click steps the corner shape (#186).
+- **2026-10-11** · Optical kerning (#181): pairs are spaced from their outlines (ink gap per band,
+ pulled towards the font's stem gap, bounded) instead of silently using the font's kern pairs.
+- **2026-10-11** · New Document laid out like InDesign's (#325): Recent, Saved, Print, Web and
+ Mobile preset tabs beside the preset's details; saved document presets live in the engine
+ (`file.savePreset`, `file.deletePreset`, `file.new {preset}`); `file.new` takes intent, units,
+ start page and per-edge bleed and slug.
+- **2026-10-11** · macOS: fonts that font services and managers activate (Adobe Fonts,
+ RightFont) are listed, read from the files CoreText has available (#261, #327).
+- **2026-10-11:** Document pages take their parent page's margins and columns (left or right parent page by side) and follow its changes unless they have their own; parent ruler guides draw and snap on the pages based on it. IDML import marks a page margin preference that differs from its parent as the page's own. No readiness percentage change.
+- **2026-10-11** · Document Setup laid out like InDesign's: Page Size, Margins (new: every
+ page's, `layout.documentSetup {margins}`), Bleed and Slug with links, Adjust Layout.
+- **2026-10-11** · IDML reads and writes a spread's view rotation (Rotate Spread) as the
+ rotation part of the spread transform (#484).
+- **2026-10-11** · The document grid is drawn (View ▸ Grids & Guides ▸ Show/Hide Document Grid,
+ ⌘'), on the lines Snap to Document Grid uses, behind or in front of page items (#530).
- **2026-10-10 (UI.4–UI.5):** Panel tabs can move into other groups, split the dock, float, resize and return to their saved locations through shared docking transactions. Layouts persist in custom workspaces; UI and control commands share the same validated action path. Shared pane geometry and widget-state theme application retain all five palettes and local fonts. Split panes send keyboard input only to the focused canvas and scope contextual toolbar IDs per pane. No readiness percentage change.
- **2026-10-10** · Version 0.6.0; releases add a Linux riscv64 tar.gz (cross-compiled, CLI
smoke-tested under QEMU).
diff --cc crates/engine/src/cmd/print.rs
index cfb953a12,659b520e8..4f79f13ad
--- a/crates/engine/src/cmd/print.rs
+++ b/crates/engine/src/cmd/print.rs
@@@ -85,20 -42,30 +42,30 @@@ fn print(s: &mut Session, p: &Value) -
}
#[cfg(not(target_arch = "wasm32"))]
- fn secure_print_file() -> Result<tempfile::NamedTempFile> {
- let file = tempfile::Builder::new()
- .prefix("designcraft-print-")
- .suffix(".pdf")
- .tempfile()
- .map_err(|e| EngineError::Other(format!("temporary print file: {e}")))?;
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- file.as_file()
- .set_permissions(std::fs::Permissions::from_mode(0o600))
- .map_err(|e| EngineError::Other(format!("{}: {e}", file.path().display())))?;
+ fn print_with(
+ s: &mut Session,
+ p: &Value,
+ submit: impl FnOnce(&[u8], &craft_print::Job) -> std::result::Result<String, craft_print::Error>,
+ ) -> Result<Value> {
+ let d = &s.doc()?.doc;
+ let opts = super::export::options(p, d.page_count())?;
+ let copies = p.get("copies").and_then(Value::as_u64).unwrap_or(1).clamp(1, 999) as u32;
+ let job = craft_print::Job {
+ printer: str_param(p, "printer").map(str::to_string),
+ copies,
+ scaling: craft_print::Scaling::ShrinkToFit,
+ title: d.title.clone(),
+ ..craft_print::Job::default()
+ };
+ let dry = p.get("dryRun").and_then(Value::as_bool).unwrap_or(false);
- let pdf = designcraft_pdf::export_pdf(d, &s.cache, &opts).map_err(|e| EngineError::Other(e.to_string()))?;
++ let pdf = designcraft_pdf::export_pdf(&super::interchange::with_pdf_boxes(d), &s.cache, &opts).map_err(|e| EngineError::Other(e.to_string()))?;
+ let command = craft_print::command_preview(&job).map_err(|e| bad("file.print", e.to_string()))?;
+ let pages = opts.pages.as_ref().map_or(d.page_count(), |v| v.len());
+ let out = json!({"printer": job.printer, "copies": copies, "pages": pages, "command": command, "bytes": pdf.len()});
+ if !dry {
+ submit(&pdf, &job).map_err(|e| bad("file.print", e.to_string()))?;
}
- Ok(file)
+ Ok(out)
}
#[cfg(all(test, not(target_arch = "wasm32")))]
@@@ -122,28 -91,32 +91,32 @@@ mod tests
assert!(s.execute("file.printers", &json!({})).unwrap()["printers"].is_array());
}
- #[cfg(not(target_arch = "wasm32"))]
- #[test]
- fn print_uses_distinct_ephemeral_files() {
- let first = super::secure_print_file().unwrap();
- let second = super::secure_print_file().unwrap();
- let first_path = first.path().to_path_buf();
- let second_path = second.path().to_path_buf();
- assert_ne!(first_path, second_path);
- drop((first, second));
- assert!(!first_path.exists());
- assert!(!second_path.exists());
- }
-
- #[cfg(all(not(target_arch = "wasm32"), unix))]
#[test]
- fn print_file_is_private_and_removed_on_drop() {
- use std::os::unix::fs::PermissionsExt;
-
- let file = super::secure_print_file().unwrap();
- let path = file.path().to_path_buf();
- assert_eq!(file.as_file().metadata().unwrap().permissions().mode() & 0o777, 0o600);
- drop(file);
- assert!(!path.exists());
+ fn print_submits_the_selected_export_and_reports_refusal() {
+ let mut s = Session::new();
+ s.execute("file.new", &json!({"pages": 4})).unwrap();
+ let params = json!({"printer": "Office (east)", "copies": 2, "pages": "2-3", "marks": true, "bleed": true});
+ let expected = {
+ let d = &s.doc().unwrap().doc;
+ let options = super::super::export::options(&params, d.page_count()).unwrap();
- designcraft_pdf::export_pdf(d, &s.cache, &options).unwrap()
++ designcraft_pdf::export_pdf(&super::super::interchange::with_pdf_boxes(d), &s.cache, &options).unwrap()
+ };
+ let r = print_with(&mut s, &params, |pdf, job| {
+ // The production export options and full bytes reach the shared spooler boundary.
+ assert_eq!(pdf, expected);
+ assert!(pdf.starts_with(b"%PDF-"));
+ assert_eq!(job.printer.as_deref(), Some("Office (east)"));
+ assert_eq!(job.copies, 2);
+ assert_eq!(job.duplex, None);
+ assert_eq!(job.scaling, craft_print::Scaling::ShrinkToFit);
+ assert!(!job.title.is_empty());
+ Ok("request id is Office-1".into())
+ })
+ .unwrap();
+ assert_eq!(r["pages"], 2);
+ let refusal = print_with(&mut s, &params, |_, _| Err(craft_print::Error::Spool("printer offline".into()))).unwrap_err();
+ assert!(refusal.to_string().contains("printer offline"));
+ print_with(&mut s, &json!({"dryRun": true}), |_, _| panic!("dry runs must not spool")).unwrap();
+ assert!(print_with(&mut s, &json!({"pages": "9"}), |_, _| panic!("invalid ranges must not spool")).is_err());
}
}
diff --cc docs/gaps.md
index ca82ea732,6f92c5500..c94c533a1
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@@ -1,6 -1,6 +1,6 @@@
# Where DesignCraft falls short of InDesign
- > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (Optical kerning from outlines (#181); gap 6: macOS lists fonts that font services and managers activate) · **Target:** Adobe InDesign 2026 (21.6)
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (shared print spooler; Windows CI passes) · **Target:** Adobe InDesign 2026 (21.6)
++> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (Optical kerning from outlines (#181); gap 6: macOS lists fonts that font services and managers activate; shared print spooler; Windows CI passes) · **Target:** Adobe InDesign 2026 (21.6)
Every known shortfall against InDesign 2026, one entry each, ranked by how much it stops an
InDesign professional from doing real work. This is the work list: agents pick from the top.
diff --cc docs/hardware-parity.md
index d3e4cb7fe,fb92c587a..8bee7331d
--- a/docs/hardware-parity.md
+++ b/docs/hardware-parity.md
@@@ -1,6 -1,6 +1,6 @@@
# Hardware and platform parity
- > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (font managers on macOS) · **Target:** Adobe InDesign 2026 (21.6)
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (shared print spooler; Windows CI passes) · **Target:** Adobe InDesign 2026 (21.6)
++> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (font managers on macOS; shared print spooler; Windows CI passes) · **Target:** Adobe InDesign 2026 (21.6)
What InDesign does with hardware, per platform, against DesignCraft. Layout is not a
GPU-hungry workload, so this dimension carries little weight, but a start that fails on a