DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge PR #976
Brandon Thomasf9b4660ca286
diff --cc ROADMAP.mdindex 989572b24,06fcc7e9c..238d5af7e--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -135,12 -132,7 +135,13 @@@ 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-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/engine/src/tests.rsindex a025a5385,01e15ee2d..302163029--- a/crates/engine/src/tests.rs+++ b/crates/engine/src/tests.rs@@@ -878,37 -878,22 +878,57 @@@ fn duplicating_a_page_to_an_index_is_onassert_eq!(widths(&s), [300.0, 400.0, 500.0]);}+#[test]+fn the_type_tool_draws_a_text_frame_over_a_locked_frame() {+ // Adobe's "Set up a modern magazine layout" (4:03): with the page frame locked (Cmd+L), the+ // Type tool draws text frames on top of it; the locked frame stays an empty frame.+ use designcraft_tools::{PointerEvent, PointerKind, SnapView};+ let mut s = Session::new();+ s.execute("file.new", &json!({"width": 612, "height": 792, "facingPages": false})).unwrap();+ let big = s.execute("frame.create", &json!({"rect": [36, 36, 576, 756], "content": "unassigned"})).unwrap()["id"].as_u64().unwrap();+ s.execute("object.stroke", &json!({"ids": [big], "swatch": "[Black]", "weight": 6})).unwrap();+ s.execute("object.lock", &json!({"ids": [big]})).unwrap();+ s.execute("edit.deselectAll", &json!({})).unwrap();+ s.set_tool("type");+ let v = ViewInfo { snap: SnapView::OFF, ..ViewInfo::at_zoom(1.0) };+ let layout = s.layout();+ let at = |x: f64, y: f64| layout.to_canvas(designcraft_doc::SpreadRef::Doc(0), designcraft_geom::Point::new(x, y));+ let (a, b) = (at(100.0, 100.0), at(300.0, 200.0));+ s.pointer(&PointerEvent::new(PointerKind::Down, a.x, a.y), v).unwrap();+ s.pointer(&PointerEvent::new(PointerKind::Drag, 200.0 + a.x - 100.0, a.y + 50.0), v).unwrap();+ s.pointer(&PointerEvent::new(PointerKind::Drag, b.x, b.y), v).unwrap();+ s.pointer(&PointerEvent::new(PointerKind::Up, b.x, b.y), v).unwrap();+ let d = &s.doc().unwrap().doc;+ let it = d.item(designcraft_doc::ItemId(big)).unwrap();+ assert!(matches!(it.content, designcraft_doc::Content::Unassigned), "the locked frame stays empty");+ let frames: Vec<_> = d.spreads[0].items.iter().filter(|i| i.is_text_frame()).collect();+ assert_eq!(frames.len(), 1, "a new text frame");+ let r = frames[0].bounds();+ assert!((r.x0 - 100.0).abs() < 1e-6 && (r.y1 - 200.0).abs() < 1e-6, "{r:?}");+ // The engine refuses to turn a locked empty frame into a text frame.+ assert!(s.execute("text.placeCaret", &json!({"frame": big, "point": [300, 400]})).is_err());+ // Unlocked, a press inside converts it, as before.+ s.execute("object.unlockAll", &json!({})).unwrap();+ s.execute("text.placeCaret", &json!({"frame": big, "point": [300, 400]})).unwrap();+ assert!(s.doc().unwrap().doc.item(designcraft_doc::ItemId(big)).unwrap().is_text_frame());+}+++ /// A line is set when its baseline fits in the frame; its descenders may hang below the frame, as+ /// in InDesign. A 103 pt heading in a 78.5 pt frame (Cap Height first baseline) was overset.+ #[test]+ fn a_line_fits_when_its_baseline_does() {+ let mut s = Session::new();+ s.execute("file.new", &json!({})).unwrap();+ let overset = |s: &mut Session, height: f64| {+ let r = s.execute("frame.create", &json!({"rect": [36, 36, 400, 36.0 + height], "content": "text", "text": "Gyp"})).unwrap();+ s.execute("object.textFrameOptions", &json!({"ids": [r["id"]], "firstBaseline": "capHeight", "inset": 0})).unwrap();+ s.execute("text.select", &json!({"story": r["story"], "anchor": 0, "focus": 3})).unwrap();+ s.execute("type.char", &json!({"attrs": {"size": 103}})).unwrap();+ let st = s.execute("story.get", &json!({"story": r["story"]})).unwrap();+ !st["overset"].is_null()+ };+ // Cap height of the default font at 103 pt is about 70 pt: the baseline fits in 78.5 pt, the+ // descent (about 25 pt more) doesn't.+ assert!(!overset(&mut s, 78.5), "the line is set; its descenders hang below the frame");+ assert!(overset(&mut s, 50.0), "a baseline below the frame still oversets the line");+ }