DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
W: Preferences — Dictionary, Spelling (dynamic spelling), Autocorrect, Notes, Track Changes, Story Editor, File Handling
Brandon Thomas23098f0bd391
diff --git a/ROADMAP.md b/ROADMAP.mdindex c6629b195..844fef4cf 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -98,6 +98,7 @@ DesignCraft aims at full Adobe InDesign parity — and to be better: faster, ope- Page transitions (`page.transition/transitions`, Page Transitions panel): twelve transition types with speed and direction per spread, written into exported PDFs as `/Trans` entries through an incremental update.- PDF/X-4 export (`file.exportPdf {standard: "x4"}`): an output intent with our own Generic CMYK ICC profile (lut16 tables generated from the parametric press model), GTS_PDFXVersion in Info and XMP, and built-in PDF/X-4 checks reported as warnings. qpdf finds no errors in the result.- EPS place: placed at its (high-resolution) bounding box and shown, printed and exported through its TIFF preview, or a placeholder when it has none. PostScript itself isn't interpreted.+- Preferences: Dictionary (user dictionary; `spelling.setWords/words`), Spelling (Dynamic Spelling: red squiggles on the canvas, also Edit ▸ Spelling), Autocorrect (word list, applied as you type), Notes, Track Changes, Story Editor Display and File Handling (recovery interval) sections.- Drag and drop text editing: drag selected text to move it (Alt copies) with its formatting (`text.release`).- Image Import Options: place any page of a multi-page PDF (`file.place {pdfPage}`; the app asks which page), shown on screen and embedded as that page in PDF export.- Define Lists: named numbered lists that continue across stories in page order (`list.define`, paragraph `listName` / `startAt`), round-tripped through IDML; `null` in `type.para` / `type.char` now removes an override.@@ -155,7 +156,7 @@ four agents in parallel on separate crates:| Work | Estimate ||---|---|-| Open P0 (3: full PDF/X-4 validation against a certified checker, EPS place, remaining Preferences sections) | 9 h |+| Open P0 (2: PDF/X-4 validation against a certified checker, PostScript interpretation for EPS) | 8 h || Open P1 (5: New Window, colour management, language support, UI keyboard navigation, …) | 15 h || Open P2 (37: 12 missing — spread rotation, page transitions, vertical/RTL type, math, video/audio, split window, localization, flattener, placed-file layers — and 25 partial) | 110 h || Depth and pixel fidelity of every dialog, panel and menu against InDesign 2026 | 90 h |diff --git a/crates/engine/src/cmd/spelling.rs b/crates/engine/src/cmd/spelling.rsindex c84ffaf9f..5d8980f57 100644--- a/crates/engine/src/cmd/spelling.rs+++ b/crates/engine/src/cmd/spelling.rs@@ -41,6 +41,24 @@ pub fn specs() -> Vec<CommandSpec> {})}),cmd!(query "hyphenation.list", "Hyphenation Exceptions", [], None, "{} → [word]", has_doc, |s, _| Ok(serde_json::to_value(&s.doc()?.doc.hyphenation_exceptions).unwrap_or_default())),+ cmd!("spelling.setWords", "User Dictionary", [], None, "{words: [word]} — replace the document's user dictionary", has_doc, |s, p| {+ let mut words: Vec<String> = p+ .get("words")+ .and_then(Value::as_array)+ .ok_or_else(|| bad("spelling.setWords", "`words` required"))?+ .iter()+ .filter_map(Value::as_str)+ .map(|w| w.trim().to_lowercase())+ .filter(|w| !w.is_empty())+ .collect();+ words.sort();+ words.dedup();+ s.edit(|d, _| {+ d.user_words = words.clone();+ Ok(json!({"words": words.len()}))+ })+ }),+ cmd!(query "spelling.words", "User Dictionary Words", [], None, "{} → [word]", has_doc, |s, _| Ok(json!(s.doc()?.doc.user_words))),cmd!("spelling.addWord", "Add to Dictionary", ["Edit", "Spelling"], None, "{word}", has_doc, |s, p| {let w = str_param(p, "word").ok_or_else(|| bad("spelling.addWord", "missing word"))?.to_lowercase();s.edit(|d, _| {@@ -142,6 +160,36 @@ pub fn suggest(dict: &Dictionary, w: &str) -> Vec<String> {out}+/// Misspelled words of a story: byte ranges (acronyms skipped; the user dictionary counts).+pub fn misspellings(story: &designcraft_doc::Story, user: &[String]) -> Vec<std::ops::Range<usize>> {+ let dict = Dictionary::en_us();+ let text = &story.text;+ let bytes: Vec<(usize, char)> = text.char_indices().collect();+ let mut out = Vec::new();+ let mut i = 0;+ while i < bytes.len() {+ if !bytes[i].1.is_alphabetic() {+ i += 1;+ continue;+ }+ let start = bytes[i].0;+ let mut j = i;+ while j < bytes.len()+ && (bytes[j].1.is_alphabetic() || ((bytes[j].1 == '\'' || bytes[j].1 == '’') && j + 1 < bytes.len() && bytes[j + 1].1.is_alphabetic()))+ {+ j += 1;+ }+ let end = bytes.get(j).map(|b| b.0).unwrap_or(text.len());+ let word = &text[start..end];+ let acronym = word.chars().all(|c| c.is_uppercase()) && word.chars().count() <= 5;+ if !acronym && !known(dict, user, &word.to_lowercase()) {+ out.push(start..end);+ }+ i = j.max(i + 1);+ }+ out+}+fn check(s: &mut Session, p: &Value) -> Result<Value> {let st = s.doc()?;let d = &st.doc;@@ -154,32 +202,10 @@ fn check(s: &mut Session, p: &Value) -> Result<Value> {let mut out = Vec::new();for sid in stories {let Some(story) = d.story(sid) else { continue };- let text = &story.text;- let mut i = 0;- let bytes: Vec<(usize, char)> = text.char_indices().collect();- while i < bytes.len() {- if !bytes[i].1.is_alphabetic() {- i += 1;- continue;- }- let start = bytes[i].0;- let mut j = i;- while j < bytes.len()- && (bytes[j].1.is_alphabetic()- || ((bytes[j].1 == '\'' || bytes[j].1 == '’') && j + 1 < bytes.len() && bytes[j + 1].1.is_alphabetic()))- {- j += 1;- }- let end = bytes.get(j).map(|b| b.0).unwrap_or(text.len());- let word = &text[start..end];- let lower = word.to_lowercase();- // Skip words with digits around them and all-caps acronyms.- let acronym = word.chars().all(|c| c.is_uppercase()) && word.chars().count() <= 5;- if !acronym && !known(dict, &d.user_words, &lower) {- let sugg = if want_sugg { suggest(dict, &lower) } else { vec![] };- out.push(json!({"story": sid.0, "start": start, "end": end, "word": word, "suggestions": sugg}));- }- i = j.max(i + 1);+ for r in misspellings(story, &d.user_words) {+ let word = &story.text[r.clone()];+ let sugg = if want_sugg { suggest(dict, &word.to_lowercase()) } else { vec![] };+ out.push(json!({"story": sid.0, "start": r.start, "end": r.end, "word": word, "suggestions": sugg}));}}Ok(Value::Array(out))@@ -203,6 +229,18 @@ mod tests {assert!(known(d, &["designcraft".into()], "designcraft"));}+ #[test]+ fn user_dictionary_replaces_and_counts() {+ let mut s = Session::new();+ s.execute("file.new", &serde_json::json!({})).unwrap();+ s.execute("spelling.setWords", &serde_json::json!({"words": ["Zorbo", " zorbo", "", "Quux"]})).unwrap();+ assert_eq!(s.execute("spelling.words", &serde_json::json!({})).unwrap(), serde_json::json!(["quux", "zorbo"]));+ let mut story = designcraft_doc::Story::new(designcraft_doc::StoryId(1));+ story.insert(0, "zorbo qwzx");+ let bad = misspellings(&story, &s.doc().unwrap().doc.user_words);+ assert_eq!(bad, vec![6..10]);+ }+#[test]fn check_finds_misspellings() {let mut s = Session::new();diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rsindex fe03dde9a..f55b93636 100644--- a/crates/engine/src/cmd/text.rs+++ b/crates/engine/src/cmd/text.rs@@ -287,11 +287,34 @@ fn insert(s: &mut Session, p: &Value) -> Result<Value> {let raw = p.get("raw").and_then(Value::as_bool).unwrap_or(false);let text = if s.prefs.typographers_quotes && !raw { smart_quotes(s, &text) } else { text };let tracking = s.doc()?.doc.settings.track_changes;+ let autocorrect = (s.prefs.autocorrect && !tracking && !raw).then(|| s.prefs.autocorrect_list.clone());s.edit(|d, sel| {let t = sel.text.ok_or_else(|| bad("text.insert", "no insertion point"))?;let st = d.text_story_mut(t.story, t.cell).ok_or(designcraft_doc::DocError::NoStory(t.story))?;let r = t.range();- let r = r.start.min(st.len())..r.end.min(st.len());+ let mut r = r.start.min(st.len())..r.end.min(st.len());+ // Autocorrect: a word ended by a space or punctuation is looked up.+ if let Some(list) = &autocorrect+ && r.is_empty()+ && text.chars().count() == 1+ && text.chars().all(|c| c.is_whitespace() || c.is_ascii_punctuation())+ {+ let before = &st.text[..r.start];+ let ws = before.char_indices().rev().take_while(|(_, c)| c.is_alphabetic()).last().map(|(i, _)| i);+ if let Some(ws) = ws {+ let word = &before[ws..];+ if let Some((_, to)) = list.iter().find(|(from, _)| from.eq_ignore_ascii_case(word)) {+ let to = if word.chars().next().is_some_and(char::is_uppercase) {+ let mut c = to.chars();+ c.next().map(|f| f.to_uppercase().chain(c).collect()).unwrap_or_default()+ } else {+ to.clone()+ };+ st.replace(ws..r.start, &to);+ r = ws + to.len()..ws + to.len();+ }+ }+ }// Typing next to a table anchor starts a paragraph of its own.let mut text = text.clone();let mut trail = 0;@@ -1036,3 +1059,32 @@ mod border_tests {);}}++#[cfg(test)]+mod autocorrect_tests {+ use serde_json::json;++ use crate::Session;++ #[test]+ fn autocorrect_fixes_the_word_before_a_space() {+ let mut s = Session::new();+ s.execute("file.new", &json!({})).unwrap();+ let r = s.execute("frame.create", &json!({"rect": [72, 72, 400, 200], "content": "text", "text": ""})).unwrap();+ let sid = designcraft_doc::StoryId(r["story"].as_u64().unwrap());+ s.execute("text.select", &json!({"story": sid.0, "anchor": 0, "focus": 0})).unwrap();+ let text = |s: &Session| s.doc().unwrap().doc.stories[&sid].text.clone();+ // Off by default.+ for c in ["t", "e", "h", " "] {+ s.execute("text.insert", &json!({"text": c})).unwrap();+ }+ assert_eq!(text(&s), "teh ");+ s.execute("prefs.set", &json!({"autocorrect": true})).unwrap();+ for c in ["T", "e", "h", " ", "c", "a", "t", "."] {+ s.execute("text.insert", &json!({"text": c})).unwrap();+ }+ assert_eq!(text(&s), "teh The cat.");+ // The caret ends after the inserted punctuation.+ assert_eq!(s.doc().unwrap().selection.text.unwrap().focus, "teh The cat.".len());+ }+}diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rsindex 3221aaae2..98170e577 100644--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@ -152,6 +152,37 @@ pub struct Prefs {/// Preferences › Type › Smart Text Reflow: pages follow the primary text frame's story/// (added while it oversets, empty ones at the end removed).pub smart_text_reflow: bool,+ /// Preferences › Autocorrect: typing a space or punctuation after a listed word replaces it.+ pub autocorrect: bool,+ /// Misspelled word → correction (lowercase; the correction follows the typed capitalisation).+ pub autocorrect_list: Vec<(String, String)>,+ /// Preferences › Track Changes › Show: added text highlighted on screen.+ pub show_added_text: bool,+ /// Preferences › Notes: note anchors shown in layout view.+ pub show_note_anchors: bool,+ /// Preferences › File Handling: minutes between document recovery saves.+ pub recovery_minutes: f64,+}++/// A starter autocorrect list (common English typing slips).+pub fn default_autocorrect() -> Vec<(String, String)> {+ [+ ("teh", "the"),+ ("adn", "and"),+ ("taht", "that"),+ ("recieve", "receive"),+ ("seperate", "separate"),+ ("occured", "occurred"),+ ("untill", "until"),+ ("wich", "which"),+ ("becuase", "because"),+ ("definately", "definitely"),+ ("thier", "their"),+ ("alot", "a lot"),+ ]+ .iter()+ .map(|(a, b)| (a.to_string(), b.to_string()))+ .collect()}impl Default for Prefs {@@ -172,6 +203,11 @@ impl Default for Prefs {rich_black_output: false,favorite_fonts: Vec::new(),smart_text_reflow: true,+ autocorrect: false,+ autocorrect_list: default_autocorrect(),+ show_added_text: true,+ show_note_anchors: true,+ recovery_minutes: 0.5,}}}diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rsindex d0a2bd93b..def9ea276 100644--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@ -257,6 +257,9 @@ pub fn show(app: &mut DesignApp, ui: &mut egui::Ui) {if app.ui.hidden_characters {draw_hidden_characters(app, &painter, &xf, &doc, &layout);}+ if app.ui.dynamic_spelling && !preview {+ draw_dynamic_spelling(app, ui.ctx(), &painter, &xf, &doc, &layout);+ }}let sel_rect = draw_selection(app, &painter, &xf, &doc, &layout);draw_tool_overlays(app, &painter, &xf);@@ -356,8 +359,8 @@ fn render_texture(app: &mut DesignApp, ctx: &egui::Context, rect: Rect, xf: &Xf,highlight_missing_fonts: !preview && app.session.prefs.highlight_substituted_fonts,highlight_hj: !preview && app.session.prefs.highlight_hj,condition_indicators: !preview,- note_indicators: !preview,- change_markup: !preview,+ note_indicators: !preview && app.session.prefs.show_note_anchors,+ change_markup: !preview && app.session.prefs.show_added_text,highlight_keeps: !preview && app.session.prefs.highlight_keeps,highlight_custom_tracking: !preview && app.session.prefs.highlight_custom_tracking,quality: app.ui.display_quality,@@ -467,8 +470,8 @@ fn patch_texture(app: &mut DesignApp, layout: &CanvasLayout, ppp: f64, doc_key:highlight_missing_fonts: !preview && app.session.prefs.highlight_substituted_fonts,highlight_hj: !preview && app.session.prefs.highlight_hj,condition_indicators: !preview,- note_indicators: !preview,- change_markup: !preview,+ note_indicators: !preview && app.session.prefs.show_note_anchors,+ change_markup: !preview && app.session.prefs.show_added_text,highlight_keeps: !preview && app.session.prefs.highlight_keeps,highlight_custom_tracking: !preview && app.session.prefs.highlight_custom_tracking,quality: app.ui.display_quality,@@ -1412,6 +1415,46 @@ fn draw_hidden_characters(app: &DesignApp, painter: &egui::Painter, xf: &Xf, doc}}+/// Edit › Spelling › Dynamic Spelling: red squiggles under misspelled words (checked once per+/// story version).+fn draw_dynamic_spelling(app: &DesignApp, ctx: &egui::Context, painter: &egui::Painter, xf: &Xf, doc: &Document, layout: &CanvasLayout) {+ for story in doc.stories.values() {+ let key = egui::Id::new(("dyn_spell", std::sync::Arc::as_ptr(story) as usize, doc.user_words.len()));+ let bad: std::sync::Arc<Vec<std::ops::Range<usize>>> = match ctx.data(|d| d.get_temp(key)) {+ Some(v) => v,+ None => {+ let v = std::sync::Arc::new(designcraft_engine::cmd::spelling::misspellings(story, &doc.user_words));+ ctx.data_mut(|d| d.insert_temp(key, v.clone()));+ v+ }+ };+ if bad.is_empty() {+ continue;+ }+ let cs = app.session.cache.get(doc, story.id, None);+ let red = Stroke::new(1.0, Color32::from_rgb(230, 30, 30));+ for ft in &cs.frames {+ let (Some((a, _)), Some(it)) = (item_canvas_xf(doc, layout, ft.frame), doc.item(ft.frame)) else { continue };+ let m = a * it.xf;+ for l in &ft.lines {+ for r in bad.iter().filter(|r| r.start < l.range.end && r.end > l.range.start) {+ let gs: Vec<_> = l.glyphs.iter().filter(|g| g.len > 0 && g.byte >= r.start && g.byte < r.end).collect();+ let (Some(x0), Some(x1)) = (gs.iter().map(|g| g.x).reduce(f64::min), gs.iter().map(|g| g.x + g.adv).reduce(f64::max)) else {+ continue;+ };+ let y = l.baseline + l.descent * 0.5;+ let (p0, p1) = (xf.to_screen(m * Point::new(x0, y)), xf.to_screen(m * Point::new(x1, y)));+ // A zigzag 2 px high, 4 px per wave.+ let n = ((p1.x - p0.x) / 2.0).max(1.0) as usize;+ let pts: Vec<Pos2> =+ (0..=n).map(|k| pos2(p0.x + (p1.x - p0.x) * k as f32 / n as f32, p0.y + if k % 2 == 0 { 0.0 } else { 2.0 })).collect();+ painter.add(egui::Shape::line(pts, red));+ }+ }+ }+ }+}+/// Plain text of the current text selection (story markers resolved to readable characters).pub fn selected_text(app: &DesignApp) -> Option<String> {let st = app.session.active()?;diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rsindex f260783b6..1826af0e9 100644--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -378,11 +378,30 @@ fn preferences(ui: &mut egui::Ui, d: &mut Dialog) {("units", "Units & Increments"),("grids", "Grids"),("guides", "Guides & Pasteboard"),+ ("dictionary", "Dictionary"),+ ("spelling", "Spelling"),+ ("autocorrect", "Autocorrect"),+ ("notes", "Notes"),+ ("trackChanges", "Track Changes"),+ ("storyEditor", "Story Editor Display"),("display", "Display Performance"),("black", "Appearance of Black"),+ ("files", "File Handling"),]} else {- &[("general", "General"), ("interface", "Interface"), ("type", "Type"), ("composition", "Composition"), ("display", "Display Performance")]+ &[+ ("general", "General"),+ ("interface", "Interface"),+ ("type", "Type"),+ ("composition", "Composition"),+ ("spelling", "Spelling"),+ ("autocorrect", "Autocorrect"),+ ("notes", "Notes"),+ ("trackChanges", "Track Changes"),+ ("storyEditor", "Story Editor Display"),+ ("display", "Display Performance"),+ ("files", "File Handling"),+ ]};let cur = d.s("section");ui.horizontal_top(|ui| {@@ -401,6 +420,66 @@ fn preferences(ui: &mut egui::Ui, d: &mut Dialog) {ui.vertical(|ui| {ui.set_min_width(300.0);match cur.as_str() {+ "dictionary" => {+ ui.label(egui::RichText::new("User Dictionary (this document)").font(semibold(12.0)));+ ui.label("Words, one per line:");+ let mut t = d.s("userWords");+ if egui::ScrollArea::vertical()+ .max_height(170.0)+ .show(ui, |ui| ui.add(egui::TextEdit::multiline(&mut t).desired_rows(8).desired_width(280.0)))+ .inner+ .changed()+ {+ d.fields.insert("userWords".into(), json!(t));+ }+ }+ "spelling" => {+ ui.label(egui::RichText::new("Dynamic Spelling").font(semibold(12.0)));+ check(ui, d, "dynamicSpelling", "Enable Dynamic Spelling (underline misspelled words)");+ }+ "autocorrect" => {+ ui.label(egui::RichText::new("Options").font(semibold(12.0)));+ check(ui, d, "autocorrect", "Enable Autocorrect");+ ui.add_space(6.0);+ ui.label("Misspelled word → Correction (one per line):");+ let mut t = d.s("autocorrectText");+ if egui::ScrollArea::vertical()+ .max_height(150.0)+ .show(ui, |ui| ui.add(egui::TextEdit::multiline(&mut t).desired_rows(8).desired_width(280.0)))+ .inner+ .changed()+ {+ d.fields.insert("autocorrectText".into(), json!(t));+ }+ }+ "notes" => {+ ui.label(egui::RichText::new("Options").font(semibold(12.0)));+ check(ui, d, "showNoteAnchors", "Show Note Anchors in Layout View");+ }+ "trackChanges" => {+ ui.label(egui::RichText::new("Show").font(semibold(12.0)));+ check(ui, d, "showAddedText", "Added Text (highlighted)");+ }+ "storyEditor" => {+ ui.label(egui::RichText::new("Text Display Options").font(semibold(12.0)));+ ui.horizontal(|ui| {+ ui.label("Font Size:");+ let mut v = d.n("storyEditorSize").unwrap_or(14.0);+ if ui.add(egui::Slider::new(&mut v, 8.0..=36.0).step_by(1.0).suffix(" pt")).changed() {+ d.fields.insert("storyEditorSize".into(), json!(v));+ }+ });+ }+ "files" => {+ ui.label(egui::RichText::new("Document Recovery Data").font(semibold(12.0)));+ ui.horizontal(|ui| {+ ui.label("Save recovery data every:");+ let mut v = d.n("recoveryMinutes").unwrap_or(0.5);+ if ui.add(egui::DragValue::new(&mut v).range(0.1..=60.0).speed(0.1).suffix(" min")).changed() {+ d.fields.insert("recoveryMinutes".into(), json!(v));+ }+ });+ }"type" => {ui.label(egui::RichText::new("Type Options").font(semibold(12.0)));check(ui, d, "typographersQuotes", "Use Typographer's Quotes");@@ -1220,8 +1299,21 @@ pub fn confirm(app: &mut DesignApp) -> Result<Value, String> {"preferences" => {app.run("prefs.set",- json!({"scaleStrokes": d.b("scaleStrokes"), "dimensionsIncludeStroke": d.b("dimensionsIncludeStroke"), "transformationsAreTotals": d.b("transformationsAreTotals"), "absolutePageNumbers": d.b("absolutePageNumbers"), "highlightHj": d.b("highlightHj"), "highlightKeeps": d.b("highlightKeeps"), "highlightCustomTracking": d.b("highlightCustomTracking"), "highlightSubstitutedFonts": d.b("highlightSubstitutedFonts"), "richBlackOutput": d.b("richBlackOutput"), "typographersQuotes": d.b("typographersQuotes"), "smartTextReflow": d.b("smartTextReflow")}),+ json!({"scaleStrokes": d.b("scaleStrokes"), "dimensionsIncludeStroke": d.b("dimensionsIncludeStroke"), "transformationsAreTotals": d.b("transformationsAreTotals"), "absolutePageNumbers": d.b("absolutePageNumbers"), "highlightHj": d.b("highlightHj"), "highlightKeeps": d.b("highlightKeeps"), "highlightCustomTracking": d.b("highlightCustomTracking"), "highlightSubstitutedFonts": d.b("highlightSubstitutedFonts"), "richBlackOutput": d.b("richBlackOutput"), "typographersQuotes": d.b("typographersQuotes"), "smartTextReflow": d.b("smartTextReflow"),+ "autocorrect": d.b("autocorrect"), "showAddedText": d.b("showAddedText"), "showNoteAnchors": d.b("showNoteAnchors"),+ "recoveryMinutes": d.n("recoveryMinutes").unwrap_or(0.5),+ "autocorrectList": d.s("autocorrectText").lines().filter_map(|l| {+ let (a, b) = l.split_once('→').or_else(|| l.split_once("->"))?;+ let (a, b) = (a.trim().to_lowercase(), b.trim().to_string());+ (!a.is_empty() && !b.is_empty()).then(|| json!([a, b]))+ }).collect::<Vec<_>>()}),)?;+ app.ui.dynamic_spelling = d.b("dynamicSpelling");+ if d.fields.contains_key("userWords") {+ let words: Vec<String> = d.s("userWords").lines().map(str::to_string).collect();+ app.run("spelling.setWords", json!({"words": words}))?;+ }+ app.ui.story_editor_size = d.n("storyEditorSize").unwrap_or(14.0) as f32;// Highlight options change the screen view only.app.canvas.shown = None;let view = match d.s("displayQuality").as_str() {diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 19412aab7..bdf47ddc0 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -103,6 +103,10 @@ pub struct UiState {/// Edit › Menus: hidden menu items (`menu/label`), and Show Full Menus.pub hidden_menu_items: Vec<String>,pub show_full_menus: bool,+ /// Edit › Spelling › Dynamic Spelling: misspelled words underlined on the canvas.+ pub dynamic_spelling: bool,+ /// Preferences › Story Editor Display: text size (points).+ pub story_editor_size: f32,/// Edit › Interface Language: "" (English), "de", "fr", "es" or "ja".pub language: String,/// Edit › Transparency Flattener Presets: "" (none), "high", "medium" or "low" for PDF export.@@ -174,6 +178,8 @@ impl Default for UiState {tagged_frames: false,hidden_menu_items: Vec::new(),show_full_menus: false,+ story_editor_size: 14.0,+ dynamic_spelling: false,language: String::new(),flattener: String::new(),separation: None,@@ -501,7 +507,7 @@ impl DesignApp {let now = ctx.input(|i| i.time);// Crash recovery: unsaved documents are written to the recovery folder every 30 s.#[cfg(not(target_arch = "wasm32"))]- if self.session.recovery_dir.is_some() && now - self.last_recovery > 30.0 {+ if self.session.recovery_dir.is_some() && now - self.last_recovery > (self.session.prefs.recovery_minutes * 60.0).max(5.0) {self.last_recovery = now;if self.session.documents().iter().any(|d| d.is_dirty())&& let Err(e) = self.session.execute("file.recovery.save", &json!({}))diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex ec563ddbb..2e823f099 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -26,6 +26,7 @@ pub const UI_COMMANDS: &[(&str, &str, Option<&str>, &str)] = &[("app.fittingOptions", "Frame Fitting Options…", None, "{} — the dialog for object.fittingOptions"),("app.menus", "Menus…", None, "{} — show or hide menu items"),("window.hideMenuItem", "Hide Menu Item", None, "{item: \"Menu/Label\", hidden?: bool}"),+ ("edit.dynamicSpelling", "Dynamic Spelling", None, "{on?: bool} — underline misspelled words on the canvas"),("app.language", "Interface Language", None, "{lang: \"\"|de|fr|es|ja} — menus and panel names (the macOS menu bar follows on the next launch)"),("app.flattener",@@ -170,6 +171,7 @@ pub const MENUS: &[(&str, &[&str])] = &["-",">Spelling","cmd:spelling.check",+ "ui:edit.dynamicSpelling","cmd:spelling.addWord","ui:app.userDictionary","<",@@ -843,6 +845,9 @@ pub fn run_ui(app: &mut DesignApp, id: &str, p: &Value) -> Option<Result<Value,f[format!("adv.{k}")] = json!(format!("{}", doc["advancedType"][k].as_f64().unwrap_or(0.0)));}f["verticalUnits"] = doc["verticalUnits"].clone();+ let words = app.session.execute("spelling.words", &json!({})).unwrap_or_default();+ f["userWords"] =+ json!(words.as_array().map(|a| a.iter().filter_map(Value::as_str).collect::<Vec<_>>().join("\n")).unwrap_or_default());let inc = doc["keyboardIncrement"].as_f64().unwrap_or(1.0);f["keyboardIncrement"] = json!(designcraft_geom::format_measure(inc, designcraft_geom::Unit::Points));let units = app.session.active().map(|d| d.doc.settings.horizontal_units).unwrap_or_default();@@ -871,6 +876,10 @@ pub fn run_ui(app: &mut DesignApp, id: &str, p: &Value) -> Option<Result<Value,});f["uiScale"] = json!((app.ui.ui_scale * 100.0).round());f["richBlack"] = json!(app.ui.rich_black);+ f["dynamicSpelling"] = json!(app.ui.dynamic_spelling);+ f["storyEditorSize"] = json!(app.ui.story_editor_size);+ let list = app.session.prefs.autocorrect_list.iter().map(|(a, b)| format!("{a} → {b}")).collect::<Vec<_>>().join("\n");+ f["autocorrectText"] = json!(list);f["section"] = json!("general");app.ui.dialog = Some(crate::dialogs::Dialog::new("preferences", f));Ok(Value::Null)@@ -1039,6 +1048,7 @@ pub fn run_ui(app: &mut DesignApp, id: &str, p: &Value) -> Option<Result<Value,Ok(json!({"floating": app.ui.floating.iter().map(|(p, _)| p.clone()).collect::<Vec<_>>()}))}"window.controlBar" => flag(&mut app.ui.control_bar),+ "edit.dynamicSpelling" => flag(&mut app.ui.dynamic_spelling),"window.split" | "window.newWindow" => {let on = if id == "window.newWindow" { true } else { p.get("on").and_then(Value::as_bool).unwrap_or(!app.split) };app.split = on;@@ -1430,6 +1440,7 @@ pub fn checked(app: &DesignApp, id: &str, params: &Value) -> Option<bool> {"changes.track" => app.session.active().is_some_and(|d| d.doc.settings.track_changes),"window.controlBar" => app.ui.control_bar,"window.split" => app.split,+ "edit.dynamicSpelling" => app.ui.dynamic_spelling,"app.language" => app.ui.language == params.get("lang").and_then(Value::as_str).unwrap_or(""),"app.flattener" => app.ui.flattener == params.get("preset").and_then(Value::as_str).unwrap_or(""),"window.taskBar" => app.ui.task_bar,diff --git a/crates/ui-egui/src/story_editor.rs b/crates/ui-egui/src/story_editor.rsindex d0eacd1df..fa1d0c963 100644--- a/crates/ui-egui/src/story_editor.rs+++ b/crates/ui-egui/src/story_editor.rs@@ -46,7 +46,7 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {let mut text = story.text.clone();let r = ui.add(egui::TextEdit::multiline(&mut text)- .font(egui::FontId::proportional(14.0))+ .font(egui::FontId::proportional(app.ui.story_editor_size.clamp(8.0, 36.0))).desired_width(f32::INFINITY).desired_rows(20).frame(egui::Frame::NONE),diff --git a/docs/parity.md b/docs/parity.mdindex ce054580e..65c0498e5 100644--- a/docs/parity.md+++ b/docs/parity.md@@ -9,13 +9,13 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia| Priority | Features | Done | Partial | Missing | Parity ||---|---|---|---|---|---|-| P0 | 102 | 99 | 3 | 0 | 99% |+| P0 | 102 | 100 | 2 | 0 | 99% || P1 | 97 | 92 | 5 | 0 | 97% || P2 | 76 | 41 | 29 | 6 | 73% || Area | Parity ||---|---|-| Application shell & workspace | 92% |+| Application shell & workspace | 96% || Documents, pages, spreads | 96% || Layers | 95% || Frames, shapes & paths | 100% |@@ -35,7 +35,7 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia| Undo, history, saving | 100% || Accessibility | 70% |-Open P0 items: Preferences, Vector/page formats (PDF/AI/SVG/EPS place), Export to PDF (print).+Open P0 items: Vector/page formats (PDF/AI/SVG/EPS place), Export to PDF (print).## Rows@@ -55,7 +55,7 @@ Open P0 items: Preferences, Vector/page formats (PDF/AI/SVG/EPS place), Export t| Application shell & workspace | Menu customization | P2 | D || Application shell & workspace | Show Full Menus | P2 | D || Application shell & workspace | Recovery / autosave | P0 | D |-| Application shell & workspace | Preferences | P0 | P |+| Application shell & workspace | Preferences | P0 | D || Application shell & workspace | Localization | P2 | P || Application shell & workspace | Scripting (own API: commands, scripts, MCP) | P2 | D || Documents, pages, spreads | New Document dialog | P0 | D |