DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge PR #977
Brandon Thomas7ed56979c7ea
diff --cc ROADMAP.mdindex 238d5af7e,a800b9078..6a412a42f--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -135,13 -132,7 +135,14 @@@ list) · [roadmap.md](docs/roadmap.md)Newest first.+- **2026-10-14** · The Type tool draws a new text frame over a locked empty frame, as InDesign does, instead of turning the locked frame into a text frame. No readiness percentage change.+- **2026-10-14** · 100% black shows as pure black on screen by default, as InDesign's Appearance of Black does out of the box (Display All Blacks as Rich Black); Preferences › Appearance of Black › Display All Blacks Accurately still shows it as the dark grey it prints, and a saved choice is kept. No readiness percentage change.+- **2026-10-14** · Pathfinder keeps the frontmost object, as InDesign does: a photo placed over shapes and intersected with them shows through the shapes (it was dropped, and the shapes kept their black fill); Add, Exclude Overlap and Minus Back take the front object's fill too, Subtract still keeps the back one. No readiness percentage change.+- **2026-10-14** · The Color panel's Tint field keeps what is typed while it has focus and applies it on Enter or when it loses focus, clamped to 0–100 %. Typing 60 over 100 % no longer snaps back to 100 after the first digit (10060), and a typed tint is no longer ignored. No readiness percentage change.+- **2026-10-15** · IDML: ruler guides import and export (they were dropped). Each page's guides come in measured from the document's ruler origin (spread, page or spine), with Fit to Page, Locked and their layer, parent pages' included, and go out again under their pages. No readiness percentage change.+- **2026-10-15** · Find Font no longer reports a style missing when it differs from the installed one only in spacing or case (InDesign files can name `Regular ` with a trailing space); the text was already drawn in the right face. No readiness percentage change.+- **2026-10-15** · A line of text is set when its baseline fits in the frame, as in InDesign: descenders may hang below the frame's bottom. A frame sized to the cap height of a big heading (103 pt in a 2.77 cm frame, as Zero2Graphic's magazine tutorial draws them) no longer oversets. No readiness percentage change.+ - **2026-10-15** · A story that ends with a return is no longer overset when only its empty last paragraph doesn't fit, as in InDesign (Preflight said "Overset text: 0 characters" for a caption InDesign shows with no errors). No readiness percentage change.- **2026-10-13** · Object › Fitting has InDesign's shortcuts: Fill Frame Proportionally ⌘⌥⇧C, Fit Content Proportionally ⌘⌥⇧E, Fit Frame to Content ⌘⌥C, Fit Content to Frame ⌘⌥E, Center Content ⌘⇧E. No readiness percentage change.- **2026-10-13** · Gradients between process colours blend as inks, as InDesign shows them: magenta to cyan passes through C 50 M 50 (a light lilac) on screen instead of the darker RGB mix, and a midpoint between CMYK or grey stops no longer turns the PDF shading RGB. No readiness percentage change.- **2026-10-14** · The Swatches panel has InDesign's header: a Fill/Stroke proxy, Formatting Affects Container/Text and the Tint of the colour in front (a tint alone keeps each object's own swatch). Clicking a swatch applies it to the fill or stroke in front (of the text, when formatting affects text), and the bottom row has New Color Group, New Swatch and Delete Swatch. No readiness percentage change.diff --cc crates/compose/src/tests.rsindex ce1d6363b,b226c15fd..25ee06ed8--- a/crates/compose/src/tests.rs+++ b/crates/compose/src/tests.rs@@@ -4183,61 -4061,18 +4183,77 @@@ fn empty_paragraphs_get_no_bullet_or_nu}}+#[test]+fn cache_recomposes_when_the_baseline_grid_changes() {+ let para = ParaAttrs { grid_align: Some(GridAlign::AllLines), ..Default::default() };+ let (mut d, sid, _) = doc_with(LOREM, Rect::new(0.0, 0.0, 200.0, 600.0), para);+ let cache = Cache::new();+ let a = cache.get(&d, sid, None);+ d.settings.baseline_grid.increment = 30.0;+ let b = cache.get(&d, sid, None);+ assert!(!Arc::ptr_eq(&a, &b));+ let (la, lb) = (&a.frames[0].lines[1], &b.frames[0].lines[1]);+ assert!((la.baseline - lb.baseline).abs() > 1.0, "{} {}", la.baseline, lb.baseline);+}++#[test]+fn cache_recomposes_when_a_wrap_layer_is_hidden() {+ let (mut d, sid, _) = doc_with(&[LOREM; 2].join(" "), Rect::new(0.0, 0.0, 300.0, 800.0), ParaAttrs::default());+ let lid = d.default_layer();+ let id = ItemId(d.alloc());+ let mut it =+ designcraft_doc::Item::new(id, lid, designcraft_doc::Shape::Rectangle, designcraft_geom::shapes::rectangle(Rect::new(0.0, 0.0, 120.0, 60.0)));+ it.wrap.mode = WrapMode::BoundingBox;+ d.insert_item(SpreadRef::Doc(0), it, None).unwrap();+ let cache = Cache::new();+ let a = cache.get(&d, sid, None);+ assert!(a.frames[0].lines[0].x0 >= 120.0 - 1e-6);+ d.layer_mut(lid).unwrap().visible = false;+ let b = cache.get(&d, sid, None);+ assert!(!Arc::ptr_eq(&a, &b));+ assert!(b.frames[0].lines[0].x0 < 1.0, "{}", b.frames[0].lines[0].x0);+}++#[test]+fn cache_recomposes_page_numbers_when_a_section_is_renumbered() {+ let text = story::PAGE_NUMBER.to_string();+ let (mut d, sid, _) = doc_with(&text, Rect::new(0.0, 0.0, 300.0, 100.0), ParaAttrs::default());+ let cache = Cache::new();+ let a = cache.get(&d, sid, None);+ assert_eq!(a.frames[0].lines[0].glyphs.len(), 1);+ d.sections[0].start_number = Some(1000);+ let b = cache.get(&d, sid, None);+ assert!(!Arc::ptr_eq(&a, &b));+ assert_eq!(b.frames[0].lines[0].glyphs.len(), 4);+}++#[test]+fn spaces_at_the_end_of_a_paragraph_take_no_room() {+ // A frame as wide as "2 VOOR" also holds "2 VOOR " on one line: the trailing space hangs.+ let (d, sid, _) = doc_with("2 VOOR", Rect::new(0.0, 0.0, 500.0, 100.0), ParaAttrs::default());+ let cs = compose_story(&d, sid, &ComposeOptions::default());+ let l = all_lines(&cs)[0];+ let width = l.end_x - l.x0;+ for text in ["2 VOOR ", "2 VOOR ", "2 VOOR \u{2028}more"] {+ let (d, sid, _) = doc_with(text, Rect::new(0.0, 0.0, width + 0.02, 100.0), ParaAttrs::default());+ let cs = compose_story(&d, sid, &ComposeOptions::default());+ let first = all_lines(&cs)[0];+ assert_eq!(&text[first.range.clone()].trim_end(), &"2 VOOR", "{text:?}");+ }+}+++ /// A story that ends with a return isn't overset when only its empty last paragraph doesn't fit,+ /// as in InDesign (Montilla Design's file: a caption fitted to its three lines, "No errors"). Text+ /// that doesn't fit still is.+ #[test]+ fn an_empty_last_paragraph_isnt_overset() {+ // 12 pt, 14.4 leading: two lines fit in 35 pt, a third (baseline ~40) doesn't.+ let (d, sid, _) = doc_with("One\nTwo\n", Rect::new(0.0, 0.0, 200.0, 35.0), ParaAttrs::default());+ let cs = compose_story(&d, sid, &ComposeOptions::default());+ assert_eq!(all_lines(&cs).len(), 2);+ assert!(!cs.is_overset(), "only the empty paragraph after the last return is left");+ let (d, sid, _) = doc_with("One\nTwo\nThree", Rect::new(0.0, 0.0, 200.0, 35.0), ParaAttrs::default());+ assert!(compose_story(&d, sid, &ComposeOptions::default()).is_overset());+ let (d, sid, _) = doc_with("One\nTwo\n\n", Rect::new(0.0, 0.0, 200.0, 35.0), ParaAttrs::default());+ assert!(compose_story(&d, sid, &ComposeOptions::default()).is_overset(), "an empty paragraph before the last one is text");+ }