Skip to content

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

Merge #1704: Text frames: a custom baseline grid keeps its start and increment through IDML

aiongge79da41ce9b9
diff --cc ROADMAP.md
index 001523158,43e8060d3..92786365f
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@@ -350,8 -350,7 +350,9 @@@ list) · [roadmap.md](docs/roadmap.md)
Newest first.
+- **2026-10-24** · The baseline grid's Relative To setting applies: with Top Margin, the grid starts at each page's own top margin in text composition, on the canvas and for snapping. It started at the page top, so grid-aligned text sat on the wrong lines and a page could fit one line fewer. No readiness percentage change.
+- **2026-10-24** · Custom-positioned anchored objects honour Relative to Spine (`anchored.options {spineRelative}`, IDML `SpineRelative`): the settings describe a left-hand page and mirror on a right-hand page, so marginal notes stay in the outside margin on both pages of a spread. On right-hand pages they took the left-hand placement and landed in the inside margin, across the spine or over the body text. No readiness percentage change.
+ - **2026-10-24** · Text frames: a custom baseline grid (Text Frame Options › Baseline Options) from an IDML file sets lines from its start by its increment. The composer read the two values in the other order, so lines landed on the wrong grid. No readiness percentage change.
- **2026-10-23** · Save and export dialogs (Save As, Save a Copy, Export PDF and the other exports, Package, libraries and books) start in the active document's folder once it has been saved, and for a document never saved in the folder of the last file saved or exported, remembered across sessions (#1653). A folder deleted since falls back to the system's choice. No readiness percentage change.
- **2026-10-22** · Autoflow (Shift-click with the loaded text cursor, autoflow on Place, `text.thread {autoflow}`) fills the pages that follow before it adds any, as InDesign does: one frame per column on each following page, whatever else the page holds, then new pages at the end of the document. It inserted pages right after the story's last frame, in front of the document's own pages. Frames it set past the end of the text go again; a page the document had stays, and a page autoflow added only for such a frame goes with it. Smart Text Reflow of the primary text frame is unchanged. No readiness percentage change.
- **2026-10-16** · Edit › Keyboard Shortcuts imports a set saved by InDesign's Show Set (.txt, Windows or Mac key names, UTF-8 or UTF-16): matched commands take its Default shortcuts or lose theirs, other commands give up keys it takes, and a report lists what it changed and the items it could not match (`window.importShortcuts`, #1180). Tool keys stay fixed. No readiness percentage change.
diff --cc crates/compose/src/lib.rs
index 248e4d99c,56b79de7b..947e765a8
--- a/crates/compose/src/lib.rs
+++ b/crates/compose/src/lib.rs
@@@ -701,22 -696,26 +701,22 @@@ pub fn frame_specs(doc: &Document, sid
(Some(designcraft_doc::SpreadRef::Parent(_)), Some(sp)) => {
let prefix = sp.parent.as_ref().map(|p| p.prefix.clone()).unwrap_or_else(|| "A".into());
// The side of the parent page under the frame, so a folio there aligns to the spine of its own page.
- let under = sp.page_at_x(item.bounds().center().x).and_then(|pi| sp.pages.get(pi));
- let left = under.is_some_and(|p| p.side == designcraft_doc::PageSide::Left);
- (Some(prefix), None, left)
+ let under = sp.page_at_x(center_x).and_then(|pi| sp.pages.get(pi));
+ (Some(prefix), None, under.map(|p| p.side))
}
- _ => (None, None, false),
+ _ => (None, None, None),
};
+ let left_page = side == Some(designcraft_doc::PageSide::Left);
+ let right_page = side == Some(designcraft_doc::PageSide::Right);
let section_marker = page.map(|abs| section_marker(doc, abs));
- // The page under the frame and its margins, in inner space (bounding boxes).
- let page_rect = match (spread_ref, spread) {
- (_, Some(sp)) => sp
- .page_at_x(item.bounds().center().x)
- .and_then(|pi| sp.pages.get(pi))
- .map(|pg| (inv.transform_rect_bbox(pg.bounds()), inv.transform_rect_bbox(pg.margin_rect()))),
- _ => None,
- };
+ // The page under the frame, and its bounds and margins in inner space (bounding boxes).
+ let under = spread.and_then(|sp| sp.page_at_x(center_x).and_then(|pi| sp.pages.get(pi)));
+ let page_rect = under.map(|pg| (inv.transform_rect_bbox(pg.bounds()), inv.transform_rect_bbox(pg.margin_rect())));
let g = &doc.settings.baseline_grid;
- let (inc, start) = tf.options.baseline_grid.unwrap_or((g.increment, under.map_or(g.start, |pg| g.origin(pg))));
- let (start, inc) = tf.options.baseline_grid.map_or((g.start, g.increment), |f| (f.start, f.increment));
++ let (start, inc) = tf.options.baseline_grid.map_or((under.map_or(g.start, |pg| g.origin(pg)), g.increment), |f| (f.start, f.increment));
// Grid lines are at spread y = start + n·inc (page tops are y = 0); map into inner space (translation only).
let ty = xf.translation().y;
- let grid = (inc > 0.0).then_some((start - ty, inc));
+ let grid = (inc > 0.0 && inc.is_finite() && start.is_finite()).then_some((start - ty, inc));
// Type on a path: one line as long as the path (from the start offset).
let (area, opts) = match &tf.options.path {
Some(pt) => {
diff --cc crates/idml/src/tests.rs
index d00c76e74,431491efe..970567e7c
--- a/crates/idml/src/tests.rs
+++ b/crates/idml/src/tests.rs
@@@ -10,7 -10,7 +10,8 @@@ use super::*
mod assets;
mod clipping;
mod decorations;
+mod facing_ltr;
+ mod frame_grid;
mod index_sort;
mod liquid_guides;
mod object_styles;