Skip to content

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

Merge main: atomic desktop and CLI exports, staged book updates, recovery checkpoint retention, exit recovery

aiongg527e5cbc0cb5
diff --cc ROADMAP.md
index 0a6f3e6e6,f826a3767..c9da5d25b
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@@ -1,8 -1,8 +1,8 @@@
# DesignCraft roadmap
-**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%)
+**Stage: pre-alpha** · next: alpha, ~5–7 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-12 · **Change:** minor (text threads by hand; the alpha gate waits on Primary Text Frame page fixes; Japanese print, import and table controls localized; Live corners (#186); Optical kerning from outlines (#181); window and menu quit confirmation; failed writes preserve live save and collection state; spring-loaded Zoom navigation) · **Target:** Adobe InDesign 2026
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (orderly native exit recovery) · **Target:** Adobe InDesign 2026
++> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-12 · **Change:** minor (text threads by hand; the alpha gate waits on Primary Text Frame page fixes; Japanese print, import and table controls localized; Live corners (#186); Optical kerning from outlines (#181); window and menu quit confirmation; failed writes preserve live save and collection state; spring-loaded Zoom navigation; orderly native exit recovery) · **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.
@@@ -128,30 -129,10 +128,34 @@@ list) · [roadmap.md](docs/roadmap.md)
Newest first.
+- **2026-10-12** · With the Type tool, dragging a table's column or row border resizes it (the double-arrow cursor shows over a border): later columns and rows move along, Shift keeps the table size, and Shift on the right or bottom edge scales every column or row. A dragged row becomes At Least; one undo step per drag, Esc cancels; works in rotated frames and turned spreads. Scripts use `table.resizeBorder`. No readiness percentage change.
+- **2026-10-12** · The Tools panel's Fill/Stroke keys work: D (default fill and stroke), X (fill or stroke in front), Shift+X (swap per object, tints included) and / (Apply None), as `color.*` commands; swap and default are one undo step (`object.swapFillStroke`, `object.defaultFillStroke`); the Color panel follows the proxy's fill/stroke choice. No readiness percentage change.
+- **2026-10-12** · With a placed graphic selected (Direct Selection), the Transform values act on the graphic inside its frame, as in InDesign: a tilted frame's image can be straightened to 0°. No readiness percentage change.
+- **2026-10-11** · Font menu laid out like InDesign's: filters (classification, favourites,
+ recently added), families opening to their styles, the selected text as the sample in three
+ sizes, Recently Used fonts, Show Similar Fonts and each font's format.
+- **2026-10-12** · The Effects panel shows the level its settings apply to ("Group: Color Dodge 100%") and, as in InDesign, Isolate Blending and Knockout Group for a selected group. No readiness percentage change.
+- **2026-10-12** · Edit › Step and Repeat has its InDesign dialog: Repeat (Count, or Rows and Columns with Create as a grid), Offset (Vertical, Horizontal, in ruler units) and Preview, which shows the copies while the dialog is open; Cancel takes them away and OK makes them as one undo step. No readiness percentage change.
+- **2026-10-12** · Load Styles: the Paragraph Styles and Character Styles panels load styles from another DesignCraft document or an IDML file, with the styles, swatches and lists they name; a dialog picks the styles and what happens to one the document defines differently (`style.load`). No readiness percentage change.
+- **2026-10-12** · On screen, blend modes blend with the objects below and not with the paper, as in InDesign and in PDF export: a Color Dodge or Screen object over blank paper shows as it is. No readiness percentage change.
+- **2026-10-12** · Text threads by hand: click a selected text frame's in or out port to load
+ the text cursor, then click a frame to thread it, click empty space for a column-wide frame or
+ drag one (it snaps like frame drawing); Shift-click autoflows, Alt-click stays loaded on the
+ frame just added; click the linked frame or double-click a port to break the thread.
+ `text.thread`, `text.unthread`, `text.removeFromThread` with undo; locked frames and layers
+ refuse threads. The alpha gate now waits only on the Primary Text Frame page fixes (#165). No
+ readiness percentage change.
+- **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** · The section marker character shows its section's marker text on document pages (nothing when the section has none) instead of the word "Section", which stays on parent pages; editing the marker recomposes (#556). No readiness percentage change.
+- **2026-10-12** · IDML import keeps a font family name exactly as written, trailing spaces included, and font lookup falls back to the name without surrounding spaces; `FontStyle="Nothing"` leaves the style to the paragraph (#558). No readiness percentage change.
+- **2026-10-12** · Clipping paths saved with images in IDML (Detect Edges, Alpha Channel, Photoshop Path, User-Modified Path, inverted or not) clip the image on screen and in PDF and survive IDML export; `object.clippingPathOptions` reports, inverts or removes one (#450). No readiness percentage change.
+- **2026-10-12** · Anchored objects with text wrap push text aside: other stories' text under them and the lines of their own story after the anchor's line (#557). No readiness percentage change.
+- **2026-10-12** · Hyphenation Zone applies to the Single-line Composer only, as in InDesign. With the default Paragraph Composer, ragged text hyphenates where InDesign does (aper-natem), giving the same line breaks. No readiness percentage change.
+ - **2026-10-12** · Orderly native exit writes the latest recovery state after finalizing current quit approvals; incomplete or stale plans keep their documents, and Undo to the saved state clears stale recovery. Unavailable or failed recovery is reported. Cancelable macOS Dock Quit remains open (#544). No readiness percentage change.
+ - **2026-10-12** · Recovered documents keep a checkpoint until saved, closed or reverted, including a second crash before autosave. Restarted document IDs and explicit recovery folders preserve other snapshots; failed republishing retains the original. No readiness percentage change.
+ - **2026-10-12** · Book numbering and style updates prepare every chapter before saving. Only closed native chapters are changed; imported IDML remains a read-only style/PDF source. If a later disk write fails, the error names the completed chapters; the batch is not a whole-book transaction. No readiness percentage change.
+ - **2026-10-12** · Desktop write callbacks and CLI raster exports use the atomic writer too; open readers retain the original bytes, while private Unix modes and symlink targets survive replacement. Permanent tests cover both actual callers. No readiness percentage change.
- **2026-10-12** · Save As, library edits and book collection edits persist prospective values before changing live state; failed writes preserve the document and existing collections. Save a Copy rebases data-source paths for its destination without changing the open document. No readiness percentage change.
- **2026-10-12** · Window close and application/menu Quit ask about unsaved documents; later Cancel keeps every tab open, including earlier Don't Save choices. Approvals are rechecked after edits. Cancelable macOS Dock Quit remains open (#544). No readiness percentage change.
- **2026-10-12** · Each running app keeps recovery data in its own locked folder; current folder and lock ownership are checked before writes and cleanup. Failed isolation disables recovery with a warning instead of sharing document IDs. No readiness percentage change.
diff --cc apps/designcraft-cli/src/main.rs
index 94a1a11ef,c3808f24b..dff5566d7
--- a/apps/designcraft-cli/src/main.rs
+++ b/apps/designcraft-cli/src/main.rs
@@@ -318,9 -280,8 +318,9 @@@ fn export(s: &mut Session, out: &str, p
let img = r
.render_page(&st.doc, &s.cache, page, scale, true, &designcraft_render::RenderOptions { printing_only: true, ..Default::default() })
.ok_or("no such page")?;
- let bytes = if out.ends_with(".jpg") || out.ends_with(".jpeg") { img.to_jpeg(90) } else { img.to_png() };
+ let lower = out.to_lowercase();
+ let bytes = if lower.ends_with(".jpg") || lower.ends_with(".jpeg") { img.to_jpeg(90) } else { img.to_png() };
- std::fs::write(out, bytes).map_err(|e| format!("{out}: {e}"))?;
+ designcraft_engine::atomic::write_atomic(std::path::Path::new(out), &bytes).map_err(|e| format!("{out}: {e}"))?;
eprintln!("wrote {out} ({}×{}, {:.1} ms, {} glyphs)", img.width, img.height, t.elapsed().as_secs_f64() * 1000.0, r.stats.glyphs);
Ok(())
}
diff --cc apps/designcraft/src/main.rs
index def63f9b6,f46812579..c6d8648be
--- a/apps/designcraft/src/main.rs
+++ b/apps/designcraft/src/main.rs
@@@ -85,22 -61,36 +85,45 @@@ impl eframe::App for App
}
fn on_exit(&mut self) {
// A normal exit before the third frame is not a crash.
- if let Some(s) = self.startup.as_mut() {
- s.presented();
- }
+ self.startup.presented();
+ if let Err(e) = preserve_documents_on_exit(&mut self.app) {
+ log::error!("Couldn't preserve documents on exit: {e}");
+ eprintln!("designcraft: couldn't preserve documents on exit: {e}");
+ }
save_prefs(&self.app);
}
}
+/// Tell the macOS input method to drop its composition (the Type tool kept the marked text as
+/// typed). winit's IME toggle only clears its own copy, so the IME would type it again.
+#[cfg(target_os = "macos")]
+fn discard_marked_text() {
+ if let Some(mtm) = objc2::MainThreadMarker::new()
+ && let Some(ic) = objc2_app_kit::NSTextInputContext::currentInputContext(mtm)
+ {
+ ic.discardMarkedText();
+ }
+}
+
+ /// Orderly OS termination can bypass egui's cancelable close event. Finish only a complete,
+ /// current quit plan; otherwise preserve every live document, including edits after the timer.
+ fn preserve_documents_on_exit(app: &mut DesignApp) -> Result<(), String> {
+ app.finish_confirmed_quit()?;
+ if app.session.documents().is_empty() {
+ return Ok(());
+ }
+ if app.session.recovery_dir.is_none() {
+ return if app.session.documents().iter().any(|d| d.is_dirty()) {
+ Err("Recovery is unavailable; unsaved documents could not be preserved on exit".into())
+ } else {
+ Ok(())
+ };
+ }
+ // Also discard stale recovery for clean documents (for example, Undo back to the saved
+ // state after the last timer tick). Never choose a fallback recovery path here.
+ app.run("file.recovery.save", serde_json::json!({})).map(|_| ())
+ }
+
/// `DESIGNCRAFT_NO_PREFS`: read and write nothing in the settings directory (tests, demos).
fn no_prefs() -> bool {
std::env::var_os("DESIGNCRAFT_NO_PREFS").is_some()
@@@ -274,10 -207,9 +297,10 @@@ fn services() -> Services
}
dialog.pick_file().map(|p| p.to_string_lossy().to_string())
})),
- pick_save: Some(Box::new(|name: &str| rfd::FileDialog::new().set_file_name(name).save_file().map(|p| p.to_string_lossy().to_string()))),
+ pick_save: Some(Box::new(pick_save)),
read: Some(Box::new(|p: &str| std::fs::read(p).map_err(|e| e.to_string()))),
- write: Some(Box::new(|p: &str, b: &[u8]| std::fs::write(p, b).map_err(|e| e.to_string()))),
+ write: Some(Box::new(|p: &str, b: &[u8]| designcraft_engine::atomic::write_atomic(std::path::Path::new(p), b).map_err(|e| e.to_string()))),
+ clipboard_text: Some(Box::new(|| arboard::Clipboard::new().and_then(|mut c| c.get_text()).ok())),
..Default::default()
}
}
@@@ -524,21 -373,171 +547,186 @@@ mod tests
assert!(place.len() > 1, "the place dialog keeps a filter for each kind of file");
assert!(place.iter().any(|filter| filter.extensions.contains(&"png")));
let documents = super::open_filters("");
- assert!(documents.iter().any(|filter| filter.extensions.contains(&"designcraft")));
+ for ext in ["designcraft", "idml", "indd", "indt"] {
+ assert!(documents.first().is_some_and(|filter| filter.extensions.contains(&ext)), "{ext} is missing from the first Open filter");
+ }
+ assert!(documents.last().is_some_and(|filter| filter.extensions == [super::ALL_FILES]), "files without an extension can be picked");
+ }
+
+ #[test]
+ fn save_dialog_answers_get_the_suggested_extension() {
+ use std::path::PathBuf;
+ let save = |picked: &str, name: &str| super::picked_save_path(PathBuf::from(picked), super::suggested_extension(name));
+ assert_eq!(save("/d/Brochure", "Untitled.designcraft"), PathBuf::from("/d/Brochure.designcraft"));
+ assert_eq!(save("/d/Brochure.idml", "Untitled.designcraft"), PathBuf::from("/d/Brochure.idml.designcraft"));
+ assert_eq!(save("/d/Brochure.designcraft", "Untitled.designcraft"), PathBuf::from("/d/Brochure.designcraft"));
+ assert_eq!(save("/d/Brochure", "Untitled.pdf"), PathBuf::from("/d/Brochure.pdf"));
+ assert_eq!(save("/d/Brochure.txt", "Untitled.rtf"), PathBuf::from("/d/Brochure.txt"), "another export format is kept");
+ assert_eq!(save("/d/Package", "Untitled 1.2 Folder"), PathBuf::from("/d/Package"), "a folder has no extension");
}
}
+
+ #[cfg(all(test, unix))]
+ mod atomic_writer_tests {
+ #[test]
+ fn desktop_write_preserves_an_existing_reader_and_private_symlink_target() {
+ use std::io::Read;
+ use std::os::unix::fs::{PermissionsExt, symlink};
+ struct Fixture(std::path::PathBuf);
+ impl Drop for Fixture {
+ fn drop(&mut self) {
+ let _ = std::fs::remove_dir_all(&self.0);
+ }
+ }
+ let stamp = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos();
+ let dir = std::env::temp_dir().join(format!("designcraft-desktop-atomic-{}-{stamp}", std::process::id()));
+ std::fs::create_dir(&dir).unwrap();
+ let fixture = Fixture(dir);
+ let target = fixture.0.join(format!("{}.png", "a".repeat(243)));
+ let old = b"previous private export";
+ std::fs::write(&target, old).unwrap();
+ std::fs::set_permissions(&target, std::fs::Permissions::from_mode(0o600)).unwrap();
+ let alias = fixture.0.join("linked.png");
+ symlink(target.file_name().unwrap(), &alias).unwrap();
+ let mut reader = std::fs::File::open(&target).unwrap();
+ let mut write = super::services().write.unwrap();
+ write(alias.to_str().unwrap(), b"complete new export").unwrap();
+ let mut observed = Vec::new();
+ reader.read_to_end(&mut observed).unwrap();
+ assert!(observed == old, "desktop export changed bytes under an existing reader");
+ assert_eq!(std::fs::read(&target).unwrap(), b"complete new export");
+ assert_eq!(std::fs::metadata(&target).unwrap().permissions().mode() & 0o777, 0o600);
+ assert!(std::fs::symlink_metadata(alias).unwrap().file_type().is_symlink());
+ }
+ }
+
+ #[cfg(test)]
+ mod exit_recovery_tests {
+ use super::*;
+ use serde_json::json;
+
+ fn dirty_app(label: &str) -> (DesignApp, std::path::PathBuf) {
+ let mut app = DesignApp::new(Session::new(), Services::default());
+ app.run("file.new", json!({})).unwrap();
+ app.run("frame.create", json!({"rect": [20, 20, 120, 120]})).unwrap();
+ let uid = app.session.active().unwrap().uid;
+ let dir = std::env::temp_dir().join(format!("designcraft-exit-{label}-{}-{uid}", std::process::id()));
+ assert!(!dir.exists());
+ app.session.recovery_dir = Some(dir.clone());
+ (app, dir)
+ }
+
+ fn close_frame(app: &mut DesignApp, ctx: &egui::Context, close: bool) {
+ let mut raw = egui::RawInput::default();
+ if close {
+ raw.viewports.entry(egui::ViewportId::ROOT).or_default().events.push(egui::ViewportEvent::Close);
+ }
+ let mut out = ctx.run_ui(raw, |ui| app.logic(ui.ctx()));
+ out.textures_delta.clear();
+ }
+
+ #[test]
+ fn exit_recovery_preserves_latest_dirty_document_without_mutating_it() {
+ let (mut app, dir) = dirty_app("latest");
+ app.run("file.recovery.save", json!({})).unwrap();
+ app.run("frame.create", json!({"rect": [200, 200, 300, 300]})).unwrap();
+ let d = app.session.active().unwrap();
+ let (uid, revision, saved_revision, doc, selection, undo, redo) =
+ (d.uid, d.revision, d.saved_revision, d.doc.clone(), d.selection.items.clone(), d.history.undo.len(), d.history.redo.len());
+ preserve_documents_on_exit(&mut app).unwrap();
+ let current = app.session.active().unwrap();
+ assert_eq!(
+ (current.uid, current.revision, current.saved_revision, &current.selection.items, current.history.undo.len(), current.history.redo.len()),
+ (uid, revision, saved_revision, &selection, undo, redo)
+ );
+ assert!(std::sync::Arc::ptr_eq(&current.doc, &doc));
+ assert!(current.is_dirty());
+ let recovered = designcraft_engine::cmd::from_bytes(&std::fs::read(dir.join(format!("{uid}.designcraft"))).unwrap()).unwrap();
+ assert_eq!(serde_json::to_value(&recovered).unwrap(), serde_json::to_value(doc.as_ref()).unwrap());
+ std::fs::remove_dir_all(dir).unwrap();
+ }
+
+ #[test]
+ fn exit_recovery_removes_stale_data_after_undo_to_saved_state() {
+ let (mut app, dir) = dirty_app("clean");
+ let uid = app.session.active().unwrap().uid;
+ app.run("file.recovery.save", json!({})).unwrap();
+ let entry = dir.join(format!("{uid}.designcraft"));
+ assert!(entry.exists());
+ app.run("edit.undo", json!({})).unwrap();
+ assert!(!app.session.active().unwrap().is_dirty());
+ let doc = app.session.active().unwrap().doc.clone();
+ preserve_documents_on_exit(&mut app).unwrap();
+ assert!(!entry.exists(), "clean exit must not resurrect the pre-Undo edits");
+ assert!(std::sync::Arc::ptr_eq(&app.session.active().unwrap().doc, &doc));
+ std::fs::remove_dir_all(dir).unwrap();
+ }
+
+ #[test]
+ fn exit_recovery_reports_unavailable_or_failed_storage_without_changing_documents() {
+ let (mut app, dir) = dirty_app("failure");
+ let doc = app.session.active().unwrap().doc.clone();
+ app.session.recovery_dir = None;
+ assert!(preserve_documents_on_exit(&mut app).unwrap_err().contains("unavailable"));
+ std::fs::create_dir(&dir).unwrap();
+ let blocked = dir.join("not-a-directory");
+ std::fs::write(&blocked, b"preserve this file").unwrap();
+ app.session.recovery_dir = Some(blocked.clone());
+ assert!(preserve_documents_on_exit(&mut app).is_err());
+ assert_eq!(std::fs::read(&blocked).unwrap(), b"preserve this file");
+ assert!(std::sync::Arc::ptr_eq(&app.session.active().unwrap().doc, &doc));
+ assert!(app.session.active().unwrap().is_dirty());
+ assert_eq!(app.session.documents().len(), 1);
+ std::fs::remove_dir_all(dir).unwrap();
+ }
+
+ #[test]
+ fn exit_recovery_respects_complete_incomplete_stale_and_new_document_quit_plans() {
+ for case in ["complete", "incomplete", "stale", "new"] {
+ let (mut app, dir) = dirty_app(case);
+ if case == "incomplete" {
+ app.run("file.new", json!({})).unwrap();
+ app.run("frame.create", json!({"rect": [20, 20, 120, 120]})).unwrap();
+ }
+ app.run("file.recovery.save", json!({})).unwrap();
+ let first_uid = app.session.documents()[0].uid;
+ let ctx = egui::Context::default();
+ close_frame(&mut app, &ctx, true);
+ app.ui.dialog.as_mut().unwrap().fields.insert("discard".into(), json!(true));
+ designcraft_ui_egui::dialogs::confirm(&mut app).unwrap();
+ close_frame(&mut app, &ctx, false);
+ if case == "stale" {
+ app.run("frame.create", json!({"rect": [200, 200, 300, 300]})).unwrap();
+ } else if case == "new" {
+ app.run("file.new", json!({})).unwrap();
+ app.run("frame.create", json!({"rect": [20, 20, 120, 120]})).unwrap();
+ }
+ let active = app.session.active().unwrap().uid;
+ let before: Vec<_> = app
+ .session
+ .documents()
+ .iter()
+ .map(|d| (d.uid, d.revision, d.doc.clone(), d.selection.items.clone(), d.history.undo.len(), d.history.redo.len()))
+ .collect();
+ preserve_documents_on_exit(&mut app).unwrap();
+ if case == "complete" {
+ assert!(app.session.documents().is_empty());
+ assert!(!dir.join(format!("{first_uid}.designcraft")).exists(), "accepted Don't Save must not be recovered");
+ } else {
+ assert_eq!(app.session.documents().len(), before.len(), "{case}");
+ assert_eq!(app.session.active().unwrap().uid, active, "{case}");
+ for (d, (uid, revision, doc, selection, undo, redo)) in app.session.documents().iter().zip(before) {
+ assert_eq!(
+ (d.uid, d.revision, &d.selection.items, d.history.undo.len(), d.history.redo.len()),
+ (uid, revision, &selection, undo, redo),
+ "{case}"
+ );
+ assert!(std::sync::Arc::ptr_eq(&d.doc, &doc), "{case}");
+ let recovered = designcraft_engine::cmd::from_bytes(&std::fs::read(dir.join(format!("{uid}.designcraft"))).unwrap()).unwrap();
+ assert_eq!(serde_json::to_value(&recovered).unwrap(), serde_json::to_value(doc.as_ref()).unwrap(), "{case}");
+ }
+ }
+ std::fs::remove_dir_all(dir).unwrap();
+ }
+ }
+ }
diff --cc crates/engine/src/cmd/book.rs
index f68db243d,fbf80ed9e..1997e6e8b
--- a/crates/engine/src/cmd/book.rs
+++ b/crates/engine/src/cmd/book.rs
@@@ -45,24 -45,178 +45,189 @@@ fn load(path: &str) -> Result<designcra
vec![]
};
if path.to_lowercase().ends_with(".idml") {
- return designcraft_idml::import_idml(&bytes).map_err(|e| EngineError::Other(format!("{path}: {e}")));
+ let mut d = designcraft_idml::import_idml(&bytes).map_err(|e| EngineError::Other(format!("{path}: {e}")))?;
+ super::interchange::resolve_pdf_crops(&mut d);
+ return Ok(d);
}
- super::file::from_bytes(&bytes)
+ super::file::from_bytes(&bytes).map_err(|e| EngineError::Other(format!("{path}: {e}")))
}
- fn store(path: &str, d: &designcraft_doc::Document) -> Result<()> {
- #[cfg(not(target_arch = "wasm32"))]
- return crate::atomic::write_file(path, &super::file::to_bytes(d));
- #[cfg(target_arch = "wasm32")]
- {
- let _ = (path, d);
- Err(EngineError::Other("books need a file system".into()))
+ #[cfg(not(target_arch = "wasm32"))]
+ const MAX_BATCH_CHAPTERS: usize = 4096;
+
+ /// A batch keeps only bounded path records in memory. Chapter snapshots live in a private
+ /// temporary directory; only one document and serialized blob are live while staging.
+ #[cfg(not(target_arch = "wasm32"))]
+ struct ChapterBatch {
+ directory: tempfile::TempDir,
+ chapters: Vec<(String, tempfile::TempPath)>,
+ command: &'static str,
+ }
+
+ #[cfg(not(target_arch = "wasm32"))]
+ impl ChapterBatch {
+ fn new(chapters: usize, command: &'static str) -> Result<Self> {
+ if chapters > MAX_BATCH_CHAPTERS {
+ return Err(bad(command, format!("a book update supports at most {MAX_BATCH_CHAPTERS} chapters")));
+ }
+ let directory = tempfile::Builder::new()
+ .prefix(".designcraft-book-")
+ .tempdir()
+ .map_err(|e| EngineError::Other(format!("{command}: cannot stage chapter changes: {e}")))?;
+ Ok(Self { directory, chapters: Vec::with_capacity(chapters), command })
+ }
+
+ fn stage(&mut self, path: &str, doc: &designcraft_doc::Document) -> Result<()> {
+ use std::io::Write;
+
+ // Propagate serialization errors; an empty fallback must never replace a chapter.
+ let bytes = designcraft_format::save(doc).map_err(|e| EngineError::Other(format!("{path}: {e}")))?;
+ let mut file = tempfile::Builder::new()
+ .prefix("chapter-")
+ .tempfile_in(self.directory.path())
+ .map_err(|e| EngineError::Other(format!("{path}: cannot stage changes: {e}")))?;
+ file.write_all(&bytes).map_err(|e| EngineError::Other(format!("{path}: cannot stage changes: {e}")))?;
+ self.chapters.push((path.to_string(), file.into_temp_path()));
+ Ok(())
}
+
+ fn commit(self) -> Result<()> {
+ self.commit_with(write_staged_chapter)
+ }
+
+ fn commit_with(self, mut write: impl FnMut(&std::path::Path, &std::path::Path) -> std::io::Result<()>) -> Result<()> {
+ let mut completed = Vec::with_capacity(self.chapters.len());
+ for (path, staged) in self.chapters {
+ if let Err(e) = write(std::path::Path::new(&path), &staged) {
+ // Each file is atomic; the whole book is not. Keep the successful prefix visible
+ // rather than pretending that an error undid earlier chapter replacements.
+ return Err(EngineError::Other(format!(
+ "{}: failed to save chapter {path}: {e}; completed chapter paths: {completed:?}",
+ self.command
+ )));
+ }
+ completed.push(path);
+ }
+ Ok(())
+ }
+ }
+
+ #[cfg(not(target_arch = "wasm32"))]
+ fn write_staged_chapter(path: &std::path::Path, staged: &std::path::Path) -> std::io::Result<()> {
+ let mut input = std::fs::File::open(staged)?;
+ crate::atomic::write_atomic_with(path, |file| std::io::copy(&mut input, file).map(|_| ()))
}
+ /// Batch commands only write closed native chapters. IDML is an imported source, and an open
+ /// chapter's model (including unsaved edits) cannot be reconciled by a disk-only book update.
+ #[cfg(not(target_arch = "wasm32"))]
+ fn writable_chapter(s: &Session, path: &str, command: &'static str) -> Result<()> {
+ use std::path::Path;
+
+ if Path::new(path).extension().and_then(|ext| ext.to_str()).is_some_and(|ext| ext.eq_ignore_ascii_case("idml")) {
+ return Err(bad(command, format!("cannot change imported IDML chapter {path}; convert it to a native DesignCraft document first")));
+ }
+ let target = std::fs::canonicalize(path).map_err(|e| EngineError::Other(format!("{path}: {e}")))?;
+ if s.docs.iter().any(|doc| doc.path.as_ref().is_some_and(|open| std::fs::canonicalize(open).is_ok_and(|open| open == target))) {
+ return Err(bad(command, format!("chapter {path} is open; close it before updating the book")));
+ }
+ if !std::fs::metadata(&target).is_ok_and(|metadata| metadata.is_file()) {
+ return Err(bad(command, format!("chapter {path} is not a regular file")));
+ }
+ // Check both the file and its resolved parent without truncating it. Replacement needs a
+ // writable directory even when an in-place write would be permitted.
+ std::fs::OpenOptions::new().write(true).open(&target).map_err(|e| EngineError::Other(format!("{path}: {e}")))?;
+ let parent = target.parent().ok_or_else(|| bad(command, format!("chapter {path} has no parent folder")))?;
+ tempfile::Builder::new().prefix(".designcraft-book-check-").tempfile_in(parent).map_err(|e| EngineError::Other(format!("{path}: {e}")))?;
+ Ok(())
+ }
+
+ #[cfg(not(target_arch = "wasm32"))]
+ fn paginate(s: &Session) -> Result<Value> {
+ let b = s.book.as_ref().ok_or_else(no_book)?;
+ if b.documents.is_empty() {
- return Ok(json!({"pages": 0}));
++ return Ok(json!({"pages": 0, "chapters": []}));
+ }
+ let mut batch = ChapterBatch::new(b.documents.len(), "book.paginate")?;
+ let mut next = 1u32;
++ let mut chapter = 0u32;
++ let mut chapters = Vec::with_capacity(b.documents.len());
+ for path in &b.documents {
+ writable_chapter(s, path, "book.paginate")?;
+ let mut d = load(path)?;
+ start_at(&mut d, next);
+ let pages = u32::try_from(d.page_count()).map_err(|_| bad("book.paginate", "too many pages for continuous numbering"))?;
+ next = next.checked_add(pages).ok_or_else(|| bad("book.paginate", "too many pages for continuous numbering"))?;
++ chapter = match d.settings.chapter_source {
++ designcraft_doc::ChapterSource::Automatic => chapter.saturating_add(1),
++ designcraft_doc::ChapterSource::UserDefined => d.settings.chapter_number.max(1),
++ designcraft_doc::ChapterSource::SameAsPrevious => chapter.max(1),
++ };
++ d.settings.chapter_number = chapter;
++ chapters.push(d.chapter_label());
+ batch.stage(path, &d)?;
+ }
+ batch.commit()?;
- Ok(json!({"pages": next - 1}))
++ Ok(json!({"pages": next - 1, "chapters": chapters}))
+ }
+
+ #[cfg(not(target_arch = "wasm32"))]
+ fn sync_styles(s: &Session) -> Result<Value> {
+ let b = s.book.as_ref().ok_or_else(no_book)?;
+ let mut batch = ChapterBatch::new(b.documents.len(), "book.syncStyles")?;
+ let src_path = b.documents.get(b.style_source).ok_or_else(|| bad("book.syncStyles", "the book is empty"))?;
+ let src = load(src_path)?;
+ let styles = src.styles.clone();
+ let swatches = src.swatches.clone();
+ drop(src);
+ let mut n = 0;
+ for (i, path) in b.documents.iter().enumerate() {
+ if i == b.style_source {
+ continue;
+ }
+ writable_chapter(s, path, "book.syncStyles")?;
+ let mut d = load(path)?;
+ {
+ let st = d.styles_mut();
+ for ps in &styles.paragraph {
+ st.paragraph.retain(|x| x.name != ps.name);
+ st.paragraph.push(ps.clone());
+ }
+ for cs in &styles.character {
+ st.character.retain(|x| x.name != cs.name);
+ st.character.push(cs.clone());
+ }
+ }
+ for sw in &swatches {
+ match d.swatches.iter_mut().find(|w| w.name == sw.name) {
+ Some(w) if !w.locked => *w = sw.clone(),
+ Some(_) => {}
+ None => d.swatches.push(sw.clone()),
+ }
+ }
+ batch.stage(path, &d)?;
+ n += 1;
+ }
+ batch.commit()?;
+ Ok(json!({"synced": n}))
+ }
+
+ #[cfg(target_arch = "wasm32")]
+ fn paginate(_: &Session) -> Result<Value> {
+ Err(EngineError::Other("books need a file system".into()))
+ }
+
+ #[cfg(target_arch = "wasm32")]
+ fn sync_styles(_: &Session) -> Result<Value> {
+ Err(EngineError::Other("books need a file system".into()))
+ }
+
+ #[cfg(all(test, not(target_arch = "wasm32")))]
+ #[path = "book/safety_tests.rs"]
+ mod safety_tests;
+
/// Make page numbering of `d` start at `n` (the first section).
+ #[cfg(not(target_arch = "wasm32"))]
fn start_at(d: &mut designcraft_doc::Document, n: u32) {
if !d.sections.iter().any(|x| x.start == 0) {
d.sections.insert(
@@@ -153,58 -307,11 +318,11 @@@ pub fn specs() -> Vec<CommandSpec>
}
Ok(json!({"path": b.path, "styleSource": b.style_source, "documents": docs}))
}),
- cmd!(noundo "book.paginate", "Update Numbering", [], None, "{} — each document starts numbering where the previous one ended (files are saved)", has_book, |s, _| {
+ cmd!(noundo "book.paginate", "Update Numbering", [], None, "{} — each document starts numbering where the previous one ended, and takes its chapter number (automatic: one more than the previous document's; same as previous; or its own start) (files are saved) → {pages, chapters}", has_book, |s, _| {
- let b = s.book.clone().ok_or_else(no_book)?;
- let mut next = 1u32;
- let mut chapter = 0u32;
- let mut chapters = Vec::new();
- for p in &b.documents {
- let mut d = load(p)?;
- start_at(&mut d, next);
- next = next.saturating_add(u32::try_from(d.page_count()).unwrap_or(u32::MAX));
- chapter = match d.settings.chapter_source {
- designcraft_doc::ChapterSource::Automatic => chapter.saturating_add(1),
- designcraft_doc::ChapterSource::UserDefined => d.settings.chapter_number.max(1),
- designcraft_doc::ChapterSource::SameAsPrevious => chapter.max(1),
- };
- d.settings.chapter_number = chapter;
- chapters.push(d.chapter_label());
- store(p, &d)?;
- }
- Ok(json!({"pages": next.saturating_sub(1), "chapters": chapters}))
+ paginate(s)
}),
cmd!(noundo "book.syncStyles", "Synchronize Book", [], None, "{} — paragraph and character styles and swatches of the style source go into every document (by name)", has_book, |s, _| {
- let b = s.book.clone().ok_or_else(no_book)?;
- let src_path = b.documents.get(b.style_source).ok_or_else(|| bad("book.syncStyles", "the book is empty"))?;
- let src = load(src_path)?;
- let mut n = 0;
- for (i, p) in b.documents.iter().enumerate() {
- if i == b.style_source {
- continue;
- }
- let mut d = load(p)?;
- {
- let st = d.styles_mut();
- for ps in &src.styles.paragraph {
- st.paragraph.retain(|x| x.name != ps.name);
- st.paragraph.push(ps.clone());
- }
- for cs in &src.styles.character {
- st.character.retain(|x| x.name != cs.name);
- st.character.push(cs.clone());
- }
- }
- for sw in &src.swatches {
- match d.swatches.iter_mut().find(|w| w.name == sw.name) {
- Some(w) if !w.locked => *w = sw.clone(),
- Some(_) => {}
- None => d.swatches.push(sw.clone()),
- }
- }
- store(p, &d)?;
- n += 1;
- }
- Ok(json!({"synced": n}))
+ sync_styles(s)
}),
cmd!(noundo "book.exportPdf", "Export Book to PDF…", [], None, "{path?} — every document in order as one PDF → {path, bytes, pages} (no path: {base64, …})", has_book, |s, p| {
let b = s.book.clone().ok_or_else(no_book)?;
diff --cc crates/engine/src/cmd/file.rs
index c19a9ca53,692c363e8..e065ab4e5
--- a/crates/engine/src/cmd/file.rs
+++ b/crates/engine/src/cmd/file.rs
@@@ -818,10 -652,9 +820,8 @@@ fn file_revert(s: &mut Session, _: &Val
let mut fresh = DocState::new(d, Some(path.clone()));
fresh.fonts = fonts;
fresh.uid = uid;
- *st = fresh;
- if let Some(dir) = &s.recovery_dir {
- crate::recovery::discard(dir, uid);
- }
- fresh.revision = s.doc()?.revision + 1;
+ crate::recovery::discard_document(s, index, recovery_dir.as_deref());
+ *s.doc_mut()? = fresh;
Ok(json!({"path": path}))
}
#[cfg(target_arch = "wasm32")]
diff --cc crates/engine/src/recovery.rs
index ea885dcf8,85308be3b..40137c1b6
--- a/crates/engine/src/recovery.rs
+++ b/crates/engine/src/recovery.rs
@@@ -550,15 -704,31 +704,31 @@@ pub fn open(s: &mut Session, dir: &Path
st.fonts = fonts;
// Unsaved: the copy on disk (if any) is older than what was recovered.
st.saved_doc = std::sync::Arc::new((*st.doc).clone());
- st.revision += 1;
+ st.bump_revision();
let index = s.add_document(st);
opened.push(index);
- // An entry that can't be rewritten stays under its old uid: a duplicate on the next
- // recovery is better than a lost document.
- match s.docs.get(index).map(|d| write_entry(dir, d)) {
- Some(Ok(())) => discard(dir, uid),
- Some(Err(e)) => log::warn!("recovery entry {uid} kept: {e}"),
- None => {}
+ // New uids are published without replacement, and the original is consumed only after
+ // both files succeed. Track a published primary even if metadata fails, so Save/Close can
+ // clean up every snapshot this document actually owns rather than an unrelated same uid.
+ if let Some(state) = s.docs.get_mut(index) {
+ let (document, metadata) = files(&destination, state.uid);
+ let publish = designcraft_format::save(state.doc.as_ref())
+ .map_err(|e| EngineError::Other(e.to_string()))
+ .and_then(|bytes| publish_recovery_file(&document, &bytes, false));
+ match publish {
+ Ok(()) => {
+ state.recovery_entries.push((destination.clone(), state.uid));
+ let meta = json!({"path": state.path, "title": state.title(), "saved": designcraft_doc::vars::now()});
+ match publish_recovery_file(&metadata, meta.to_string().as_bytes(), false) {
+ Ok(()) => {
+ discard(dir, uid);
+ state.recovery_entries = vec![(destination.clone(), state.uid)];
+ }
+ Err(e) => log::warn!("recovery entry {uid} kept: {e}"),
+ }
+ }
+ Err(e) => log::warn!("recovery entry {uid} kept: {e}"),
+ }
}
}
Ok(opened)
diff --cc docs/gaps.md
index 08116c5ce,ebd2d7da5..dfb3a3f00
--- 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-12 · **Change:** minor (gap 0 shrunk: text threads by hand; threading gaps added; Optical kerning from outlines (#181); gap 6: macOS lists fonts that font services and managers activate; shared print spooler; image clipping paths from IDML; Tabs panel listed as present (#343)) · **Target:** Adobe InDesign 2026 (21.6)
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (book chapter update safety) · **Target:** Adobe InDesign 2026 (21.6)
++> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (gap 0 shrunk: text threads by hand; threading gaps added; Optical kerning from outlines (#181); gap 6: macOS lists fonts that font services and managers activate; shared print spooler; image clipping paths from IDML; Tabs panel listed as present (#343); book chapter update safety) · **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/target-app-parity.md
index 2c56ca673,9095faf50..75bbb494e
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@@ -1,6 -1,6 +1,6 @@@
# DesignCraft parity with Adobe InDesign
- > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (text threads by hand; image clipping paths from IDML; anchored objects wrap text; Tabs panel listed as present (#343); spring-loaded Zoom navigation) · **Target:** Adobe InDesign 2026 (21.6.0.57, macOS)
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (recovery checkpoint retention) · **Target:** Adobe InDesign 2026 (21.6.0.57, macOS)
++> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (text threads by hand; image clipping paths from IDML; anchored objects wrap text; Tabs panel listed as present (#343); spring-loaded Zoom navigation; recovery checkpoint retention) · **Target:** Adobe InDesign 2026 (21.6.0.57, macOS)
The authoritative assessment of how close DesignCraft is to Adobe InDesign. [ROADMAP.md](../ROADMAP.md)
summarizes it; [gaps.md](gaps.md) lists every known shortfall one at a time; the feature-by-feature
@@@ -288,15 -288,13 +288,15 @@@ It is evidence of breadth: each item ex
- Missing fonts: highlighted pink on screen (never in output), listed by Preflight; Type › Find/Replace Font (fonts in the document, missing first; replace in text, cells, footnotes and styles); `font.list` / `font.replace`.
- Missing glyphs, as in InDesign: a character the applied font lacks is drawn as that font's missing-glyph box (its .notdef; a drawn box when the font's is empty), on screen and in PDF (as a path, so PDF/A and PDF/UA exports take it), and Preflight lists the characters by font. Preferences › Composition › Draw Missing Glyphs from Fallback Fonts (`document.preferences {glyphFallback}`, stored with the document) draws them from other fonts instead; it is off in new documents and IDML imports, on in documents saved before it existed. A missing font's substitute always uses fallback fonts.
- Damage-region repaint: after an edit the canvas re-renders only the frames whose composed text (or the items that) changed and patches its texture — pixel-identical to a full render; typing in a frame repaints in under a millisecond instead of a full-viewport render (22 ms measured on the sample).
- - Native engine saves, Save a Copy, snippets, books, libraries, swatches and engine/MCP exports use same-folder atomic replacement. Failed writes before replacement retain the original; existing Unix permissions apply before staging document bytes. Desktop Services writes and CLI raster exports still need this routing. Parent-folder flushing is best effort, so this is not a power-loss durability guarantee.
+ - Native engine saves, Save a Copy, snippets, books, libraries, swatches and engine/MCP exports use same-folder atomic replacement, as do desktop Services writes and CLI raster exports. Failed writes before replacement retain the original; existing Unix permissions apply before staging document bytes, and already-open readers retain the old bytes. Parent-folder flushing is best effort, so this is not a power-loss durability guarantee.
- Save As prepares destination-relative data-source paths before writing and installs them only after a successful save. Failed Save As retains the document, saved state and history; Save a Copy rebases only the saved copy. Library and book collection edits likewise update live values only after persistence succeeds.
- - Crash recovery: unsaved documents are written every 30 s into a locked folder owned by that running app and reopened (unsaved, remembering their files) after a crash. Startup takes entries from ended runs and leaves live runs alone; writes and cleanup validate current folder and lock ownership. Failed isolation disables recovery with a warning. Concurrent older versions still use unlocked root entries; mixed-version isolation remains open. File › Revert and Save a Copy…; `file.recovery.*`, `file.revert`, `file.saveACopy`.
+ - Crash recovery: unsaved documents are written every 30 s into a locked folder owned by that running app and reopened (unsaved, remembering their files) after a crash. Startup takes entries from ended runs and leaves live runs alone; writes and cleanup validate current folder and lock ownership. Failed isolation disables recovery with a warning. Recovered checkpoints remain available through another crash before autosave; restarting IDs and explicit recovery from another folder preserve unopened snapshots. Successful Save, Close or Revert clears the document's checkpoints, including manual recovery while autosave is disabled; failed republishing keeps the original. Concurrent older versions still use unlocked root entries; mixed-version isolation remains open. File › Revert and Save a Copy…; `file.recovery.*`, `file.revert`, `file.saveACopy`.
- Window close and application/menu Quit ask about every unsaved document. Cancel or a cancelled/failed save keeps all tabs open; Don't Save approvals discard nothing until the complete plan is current. Later edits and new documents are checked before closing. Control-channel quit remains immediate; a cancelable macOS Dock Quit prompt is still missing (#544).
- Graphics backend chosen before the window exists (DirectX 12 on Windows, Vulkan on Linux, Metal on macOS, OpenGL as the fallback; `WGPU_BACKEND` overrides) with a start-up fallback: a backend whose start never showed a frame is skipped at the next start and the status bar says so (`gpu.json`). Found on an AMD hybrid-graphics laptop whose Vulkan driver faulted at the first present.
+- Graphics adapter chosen by the app: the GPU that drives the primary display (Windows `EnumDisplayDevices`, Linux sysfs), then the power preference (`WGPU_POWER_PREF`, `WGPU_ADAPTER_NAME` override). An adapter that fails or hangs while the window starts is left out and the app starts again on the next one, then on the next backend, with software renderers last; wgpu's indirect-call check is off (it lost the Metal device on an Intel Mac, #334); why the app stopped is logged, also when the window never opened (#273). Ported from VectorCraft.
- Edit › Paste Into (copied objects become a frame's content, clipped by it; rendered, PDF and IDML both ways — verified in InDesign 2026); Polygon Settings (sides, star inset; double-click the Polygon tool).
- Color panel (fill/stroke proxy, CMYK/RGB/Lab sliders with channel ramps, tint slider for swatches, spectrum ramp, Add to Swatches) and Color Picker (double-click the proxy); mixed colours are unnamed (not listed in Swatches until added); `object.color`, `swatch.addToSwatches`, `swatch.addUnnamed`.
+- Threading: click a selected text frame's in or out port (overset or not) to load the text cursor, then click a frame to thread it (stories merge), click empty space for a column-wide frame down to the bottom margin, or drag a frame; Shift-click autoflows, Alt-click stays loaded; click the linked frame or double-click a port to break the thread; Esc unloads. Link and unthread cursors show where a click threads or unthreads. `text.thread`, `text.unthread`, `text.removeFromThread`.
- Place text files: Word (.docx: styles by name with their attributes, bold/italic/underline/size/font, footnotes, tables, tabs, breaks), RTF and plain text, into the insertion point, the selected frame or a new frame; autoflow adds pages and threaded frames until the text fits; Remove Styles option (`designcraft-textimport`).
- Gradient Feather (⇧G tool, `object.gradientFeather`): objects fade along a linear or radial opacity gradient, on screen and as a soft mask in PDF.
- Script Label (`object.label`, `object.findByLabel`), alt text (`object.altText`), Isolate Blending / Knockout Group (`object.transparencyGroup`; on screen, PDF isolates), Table ▸ Sort (`table.sortRows`, numeric-aware, header/footer fixed).
@@@ -352,9 -349,9 +352,10 @@@
- Edit ▸ Menus (`window.hideMenuItem`): hide menu items; menus with hidden items end in Show All Menu Items.
- View ▸ Separations Preview (`view.separations`): one process plate as ink density, or areas over an ink limit in red (a GCR preview of the rendered view; spot plates and the flattener preview aren't there).
- Separations Preview plates now come from each object's own colour (CMYK as authored; RGB and images through the colour settings, images via a cached 17³ table), so pure black shows only on the black plate.
-- Language (Character panel ▸ Language, Properties ▸ Character, `type.char {language}`): text in other languages isn't hyphenated or spell-checked with the English dictionaries, typographer's quotes follow the language (German „…“, French and Russian «…», Swiss, Spanish, Dutch, Nordic, Japanese and Traditional Chinese 「…」, Simplified Chinese “…”), the font's localized forms (OpenType `locl`: Turkish i, Bulgarian Cyrillic, Japanese / Chinese / Korean glyph variants) follow it too, and so does the fallback for CJK characters the font lacks (with Draw Missing Glyphs from Fallback Fonts on): Japanese, Simplified Chinese, Traditional Chinese and Korean each try their own installed system fonts (Japanese starts with the craft-fonts Japanese faces, Mincho first, when built with them; Hangul, kana and Bopomofo pick their language's fonts whatever the language). Language names from IDML keep their spelling; locale codes as InDesign writes them for some languages (`de_DE_2006`, `nl_NL_2005`; any `ll`, `ll_CC`, `ll-CC`) are their language and region for all of the above, and Chinese is also recognised in its common spellings ("Simplified Chinese", "Chinese (Traditional)", `zh_CN`, `zh-Hant`). Spanish is hyphenated with Javier Bezos's Liang patterns (`hyph-es.tex` 5.0, MIT) and Portuguese with hyph-utf8's `hyph-pt.tex` 1.4 (BSD-3-Clause), both through the `hypher` crate; hyphenation for other languages isn't bundled yet.
-- Books (`book.new/open/add/remove/list/styleSource/paginate/syncStyles/exportPdf`, Book panel): `.dcbook` files, continuous page numbering, style sync from a style source, one merged PDF.
+- Language (Character panel ▸ Language, Properties ▸ Character, `type.char {language}`): text in other languages isn't hyphenated or spell-checked with the English dictionaries, typographer's quotes follow the language (German „…“, French and Russian «…», Swiss, Spanish, Dutch, Nordic, Japanese and Traditional Chinese 「…」, Simplified Chinese “…”), the font's localized forms (OpenType `locl`: Turkish i, Bulgarian Cyrillic, Japanese / Chinese / Korean glyph variants) follow it too, and so does the fallback for CJK characters the font lacks (with Draw Missing Glyphs from Fallback Fonts on): Japanese, Simplified Chinese, Traditional Chinese and Korean each try their own installed system fonts (Japanese starts with the craft-fonts Japanese faces, Mincho first, when built with them; Hangul, kana and Bopomofo pick their language's fonts whatever the language). Language names from IDML keep their spelling; locale codes as InDesign writes them for some languages (`de_DE_2006`, `nl_NL_2005`; any `ll`, `ll_CC`, `ll-CC`) are their language and region for all of the above, and Chinese is also recognised in its common spellings ("Simplified Chinese", "Chinese (Traditional)", `zh_CN`, `zh-Hant`). Spanish is hyphenated with Javier Bezos's Liang patterns (`hyph-es.tex` 5.0, MIT), Portuguese with hyph-utf8's `hyph-pt.tex` 1.4 (BSD-3-Clause) and Norwegian with hyph-utf8's `hyph-no.tex` (permissive), all through the `hypher` crate; hyphenation for other languages isn't bundled yet.
+- Books (`book.new/open/add/remove/list/styleSource/paginate/syncStyles/exportPdf`, Book panel): `.dcbook` files, continuous page numbering, chapter numbers resolved in book order (Automatic, Start Chapter Numbering at, Same as Previous Document; `layout.chapterNumbering`, with a style for Chapter Number variables and cross-references), style sync from a style source, one merged PDF. Section prefixes follow InDesign's rule (up to 8 characters, no + or comma).
+- Numbering & Section Options window as in InDesign (Start Section, automatic or explicit page numbering up to 99999, prefix, style, marker, Include Prefix; the document's chapter numbering and its book); OK applies both in one undo step (`layout.numberingOptions`).
+ - Book numbering/style updates validate and serialize all targets before changing the first chapter. They write only closed native chapters, checking canonical paths for open aliases; IDML remains a read-only style source and PDF input. Snapshots are staged on disk with at most 4,096 chapter records in memory. Each replacement is atomic; a later write failure explicitly lists completed chapters rather than claiming whole-book rollback. Import/serialization memory limits and advanced book TOC/index work remain separate.
- Track Changes (`changes.track/list/acceptAll/rejectAll`, Type ▸ Track Changes): typing is marked added (highlighted on screen), deletions are kept but hidden from layout and exports until accepted or rejected. Per-change accept/reject and authors aren't there yet.
- Track Changes: per-change Accept / Reject (`changes.accept`, `changes.reject`) and a Track Changes panel listing every change.
- Move table rows and columns (`table.moveRow`, `table.moveColumn`, Table panel buttons; with whole rows or columns selected, drag them with the Type tool — `table.dropCells`).