Skip to content

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

Merge t13-moppeeer: #253 #832 #753 #754 (a3b97165) #588

aiongg7f0d7f1f32f6
diff --cc ROADMAP.md
index 2a5d8a75a,cc346f9f4..8ed2a0351
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@@ -128,11 -128,9 +128,14 @@@ list) · [roadmap.md](docs/roadmap.md)
Newest first.
+- **2026-10-13** · Text takes gradient swatches: a gradient fill or stroke on characters spans the text frame's box (on a path: the path's), on screen and in PDF. No readiness percentage change.
+- **2026-10-13** · Gradient swatches work on strokes: drawn across the path's box on screen and in PDF (they drew nothing), set with `object.gradient {target: stroke}` and in the Gradient panel when the Stroke box is in front; the stroke's gradient vector moves with the shape and round-trips through IDML. No readiness percentage change.
+- **2026-10-13** · The Gradient panel follows InDesign's layout (thumbnail, Type, Location, Angle, Reverse, ramp with midpoint diamonds) and takes swatches dragged from the Swatches panel: dropped on a stop they colour it, elsewhere they add a stop. Stops keep their CMYK through panel edits; `object.gradient` stops accept a `swatch`. No readiness percentage change.
+- **2026-10-13** · New Swatch works as InDesign's: a gradient made in the Gradient panel becomes "New Gradient Swatch" (still applied), an unnamed colour a listed swatch, a named swatch a "copy" (`swatch.new`); `swatch.create {gradient}` makes a gradient swatch from colour swatches. No readiness percentage change.
+- **2026-10-13** · Radial gradients stretch with the object's box, as InDesign draws them: by default an ellipse reaching the frame's sides (it was a circle reaching only the longer side), and a Gradient Swatch tool drag keeps the box's proportions; on screen and in PDF. No readiness percentage change.
+ - **2026-10-13** · Inner Glow takes a blend mode (Screen by default) and a Technique (Softer or Precise); Basic Feather takes Choke and Corners (Sharp, Rounded, Diffused), in the Effects dialog and `object.effects`. Inner glow and bevel blend modes now mix with the object below them instead of an empty layer. Noise isn't drawn. No readiness percentage change.
+ - **2026-10-13** · Text Frame Options is laid out as InDesign's: General (Columns: Fixed Number or Fixed Width with Number, Width and Gutter; Balance Columns; Inset Spacing with the link button; Vertical Justification; Ignore Text Wrap), Baseline Options (First Baseline Offset and Min) and Column Rules. `object.textFrameOptions` takes `columnWidth` and `firstBaselineMin`. No readiness percentage change.
+ - **2026-10-13** · The Window menu follows InDesign's order (Arrange, Workspace, then the panels alphabetically with Color, Editorial, Object & Layout, Styles… submenus), and Window › Workspace lists the workspaces as InDesign does, now with Essentials Classic: the Control panel and an icon column of named panel groups. No readiness percentage change.
- **2026-10-13** · `.indd` and `.indt` documents open through File › Open, drop, the web inbox, `file.open`, `file.openBytes`, `file.openIdml` and the CLI: [storytold/indd-utils](https://github.com/storytold/indd-utils) converts them to IDML in memory and the IDML importer reads the result, on desktop and web. Converter warnings come first in the open result; an unreadable file is an open error (#21, #114). No readiness percentage change until a real-file corpus measures it.
- **2026-10-13** · macOS: a command chosen with the mouse in the menu bar runs at once. It used to wait for the next mouse move or key press over the window, so File › Open, Place and Save As seemed to take 10–20 seconds to open their dialogs. No readiness percentage change.
- **2026-10-13** · An explicit recovery folder (`file.recovery.save` with `dir`) never overwrites or deletes another running app's checkpoints. Document uids start at 1 in every process, so two apps saving recovery to one chosen folder replaced or removed each other's `<uid>.designcraft`. A run replaces or removes only the entries it wrote or recovered there, refuses an occupied uid, and refuses a folder whose run lock another app holds. No readiness percentage change.
diff --cc crates/idml/src/tests.rs
index ad0ca3053,3e43db880..2deacdc14
--- a/crates/idml/src/tests.rs
+++ b/crates/idml/src/tests.rs
@@@ -3592,19 -3592,28 +3592,45 @@@ fn object_style_effects_import_by_categ
assert!(!fx("Loop").unwrap().drop_shadow.on);
}
+#[test]
+fn a_strokes_gradient_vector_round_trips() {
+ let mut d = designcraft_doc::Document::new(&designcraft_doc::build::NewDocument::default());
+ let id = designcraft_doc::ItemId(d.alloc());
+ let mut it = designcraft_doc::Item::new(
+ id,
+ d.default_layer(),
+ designcraft_doc::Shape::Path,
+ designcraft_geom::shapes::rectangle(designcraft_geom::Rect::new(10.0, 10.0, 110.0, 60.0)),
+ );
+ it.stroke.gradient_vector = Some([10.0, 35.0, 110.0, 35.0]);
+ d.insert_item(designcraft_doc::SpreadRef::Doc(0), it, None).unwrap();
+ let back = crate::import_idml(&crate::export_idml(&d)).unwrap();
+ let v = back.spreads[0].items[0].stroke.gradient_vector.unwrap();
+ assert!(v.iter().zip([10.0, 35.0, 110.0, 35.0]).all(|(a, b)| (a - b).abs() < 1e-6), "{v:?}");
+}
++
+ #[test]
+ fn feather_choke_and_corners_round_trip() {
+ use designcraft_doc::{Effects, FeatherCorners, FeatherOptions, Item, ItemId, ObjectStyle};
+ let mut d = Document::new(&NewDocument::default());
+ let lid = d.default_layer();
+ let feathers = [(6.0, 40.0, FeatherCorners::Sharp), (4.0, 0.0, FeatherCorners::Rounded), (3.0, 12.5, FeatherCorners::Diffused)];
+ let fx = |(w, choke, corners): (f64, f64, FeatherCorners)| Effects {
+ feather: w,
+ feather_options: FeatherOptions { choke, corners },
+ ..Default::default()
+ };
+ for (i, f) in feathers.into_iter().enumerate() {
+ let x = 40.0 + 120.0 * i as f64;
+ let mut it = Item::new(ItemId(d.alloc()), lid, Shape::Rectangle, shapes::rectangle(Rect::new(x, 40.0, x + 100.0, 140.0)));
+ it.effects = fx(f);
+ d.insert_item(SpreadRef::Doc(0), it, None).unwrap();
+ }
+ let styled = fx((5.0, 25.0, FeatherCorners::Rounded));
+ d.styles_mut().object.push(ObjectStyle { name: "Soft".into(), effects: Some(styled.clone()), ..Default::default() });
+ let back = import_idml(&export_idml(&d)).unwrap();
+ let got: Vec<_> = back.spreads[0].items.iter().map(|i| i.effects.clone()).collect();
+ assert_eq!(got, feathers.map(fx));
+ let style = back.styles.object.iter().find(|s| s.name == "Soft").and_then(|s| s.effects.clone()).unwrap();
+ assert_eq!((style.feather, style.feather_options), (styled.feather, styled.feather_options));
+ }
diff --cc crates/render/src/text.rs
index 1a44b28fc,5438e5ac4..547dd9057
--- a/crates/render/src/text.rs
+++ b/crates/render/src/text.rs
@@@ -17,47 -17,8 +17,47 @@@ use vello_cpu::RenderContext
use vello_cpu::kurbo;
use vello_cpu::peniko;
- use crate::{Frame, Renderer, color_of, rect_overlaps};
+ use crate::{Frame, Renderer, color_of, rect_overlaps, screen_color};
+/// A text colour: solid, or a gradient swatch laid across the frame (InDesign spans a gradient on
+/// text across its frame's box).
+#[derive(Clone)]
+enum TextPaint {
+ Solid(peniko::Color),
+ Gradient(designcraft_doc::Fill),
+}
+
+impl TextPaint {
+ fn of(doc: &designcraft_doc::Document, swatch: &str, tint: f32) -> Option<Self> {
+ if designcraft_color::swatch::resolve_gradient(&doc.swatches, swatch).is_some() {
+ return Some(TextPaint::Gradient(designcraft_doc::Fill { swatch: swatch.into(), tint, ..designcraft_doc::Fill::none() }));
+ }
+ doc.resolve_color(swatch, tint).map(|c| TextPaint::Solid(color_of(&c, 1.0)))
+ }
+
+ /// Make this the context's paint; a gradient runs across `area` (text space).
+ fn set(&self, ctx: &mut RenderContext, doc: &designcraft_doc::Document, area: Rect) {
+ match self {
+ TextPaint::Solid(c) => ctx.set_paint(*c),
+ TextPaint::Gradient(fill) => {
+ crate::set_fill_paint(ctx, doc, fill, area);
+ }
+ }
+ }
+}
+
+/// The box a gradient on a frame's text spans: the frame's, in text space (the union of its lines
+/// when the frame is gone).
+fn text_area(doc: &designcraft_doc::Document, ft: &FrameText) -> Rect {
+ if let Some(it) = doc.item(ft.frame) {
+ let local = doc.text_local(it);
+ if local.determinant().abs() > 1e-12 {
+ return local.inverse().transform_rect_bbox(it.inner_bounds());
+ }
+ }
+ ft.lines.iter().filter_map(line_box).reduce(|a, b| a.union(b)).unwrap_or(Rect::new(0.0, 0.0, 1.0, 1.0))
+}
+
/// Cached outlines of one composed line.
pub(crate) struct LineGlyphs {
/// Frame-space bounds of everything drawn for the line (empty lines: `None`).