DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge PR #591 (new head 183feade3): double-click a handle to fit the frame
aionggd4e4b9ad1331
diff --cc ROADMAP.mdindex f26825ebf,d84bf7cc7..be66e5e88--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -537,7 -443,6 +537,7 @@@ Newest first- **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** · A gradient feather on a group fades the group as one, on screen and in PDF. Before, the screen ignored it, and PDF masked the group with a box of zero size because a group has no path of its own. No readiness percentage change.- **2026-10-12** · In a CMYK transparency blend space (print documents), blend modes blend in CMYK on screen as in InDesign. Color Dodge with 100% K text turns coloured areas under it white and leaves the paper alone, where RGB blending changed almost nothing. PDF export already did this. No readiness percentage change.- - **2026-10-12** · Double-clicking a frame handle fits the frame to its content as in InDesign (a corner fits both sides, an edge only its own). Object › Fitting › Fit Frame to Content now fits text frames to their text too, growing them for overset text. No readiness percentage change.++- **2026-10-12** · Double-clicking a frame handle fits the frame to its content as in InDesign (a corner fits both sides, an edge only its own). Object › Fitting › Fit Frame to Content now fits text frames to their text too, growing them for overset text; fitting leaves locked objects and objects on locked layers as they are. No readiness percentage change.- **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-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-12** · Load Swatches refuses an `.ase` file with more than 100,000 colors, and `swatch.load` merges a file of 100,000 colors in under 0.1 s (it took 9.6 s of CPU in a test build). No readiness percentage change.diff --cc crates/engine/src/cmd/object.rsindex 352ad0e39,e9e511c2f..efd04d528--- a/crates/engine/src/cmd/object.rs+++ b/crates/engine/src/cmd/object.rs@@@ -2825,6 -2115,13 +2830,13 @@@ fn fit_text_height}}rect.y1 = rect.y0 + high;+ // A line is set when its baseline is within 0.01 pt of the bottom, so the search stops just- // short of the lowest baseline. The bottom goes onto it (plus the inset), as InDesign's does:- // the frame then fits its text exactly and still does when it is scaled up.++ // short of the lowest baseline. The bottom goes onto it (plus the inset): the frame then fits++ // its text exactly and still does when it is scaled up.+ let lowest = compose(rect).frame(id).and_then(|ft| ft.lines.iter().map(|l| l.baseline).reduce(f64::max));+ if let Some(b) = lowest.map(|b| b + inset_bottom).filter(|b| b.is_finite() && *b > rect.y1 && *b - rect.y1 <= 0.02) {+ rect.y1 = b;+ }Ok(rect)}@@@ -4731,7 -3616,12 +4743,11 @@@ mod fit_text_frame_testsassert!(b.x0 == 100.0 && b.width() > 100.0 && b.width() < 250.0, "{b:?}");let d = s.doc().unwrap().doc.clone();let sid = d.item(id).unwrap().text_frame().unwrap().story;- assert!(!s.cache.get(&d, sid, None).is_overset(), "still fits");+ let cs = s.cache.get(&d, sid, None);+ assert!(!cs.is_overset(), "still fits");- // The bottom is on the baseline (Dansky's Exclude Overlap tutorial, 1:56: 70 pt Kanji_PA- // fits to 18.521 mm, its ascent), so a frame scaled up with its text still fits.++ // The bottom is on the baseline, so a frame scaled up with its text still fits.+ let baseline = cs.frame(id).unwrap().lines[0].baseline;+ assert!((b.y1 - baseline).abs() < 1e-9, "{b:?} {baseline}");}#[test]