DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge shaped-text-frames: Text frames: lines follow an oval or polygon frame's shape (#646)
aiongg5b01f90baff6
diff --cc ROADMAP.mdindex 416d28ca8,7c48ff678..226be138f--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -128,43 -129,9 +128,44 @@@ list) · [roadmap.md](docs/roadmap.md)Newest first.+ - **2026-10-12** · Text in oval, polygon and other non-rectangular text frames follows the frame's outline: each line is set in the part of its band inside the shape, one inset away from the outline, in every column and in vertical frames; text wrap still applies on top (#646). No readiness percentage change.+- **2026-10-12** · Colour entry: the Color Picker's hex, R/G/B and C/M/Y/K fields and the Color panel's number fields keep typed text until it is complete; panel and picker values are applied on a fixed scale (`{model, …}` colours in 0..1), so M 1 is 1 %. Picking keeps a CMYK colour CMYK; dialogs leave the page behind them undimmed; colours that round to the same swatch name share one swatch (#323). No readiness percentage change.+- **2026-10-12** · Placed photos show in their own colours: embedded ICC profiles (Adobe RGB, ProPhoto, P3, grey) are converted to sRGB on screen, and CMYK JPEGs (including YCCK), CMYK TIFFs and CMYK PSDs go through their embedded CMYK profile or the working CMYK space with the colour settings' intent and black-point compensation, instead of the profile-free formula. Unreadable profiles are ignored. No readiness percentage change.+- **2026-10-12** · Placed Word documents keep their bullets and numbering (#626): `numbering.xml` levels become bullet or numbered paragraphs with Word's number formats, label text, start numbers, restarts and list indents, also when a paragraph style carries the list. No readiness percentage change.+- **2026-10-12** · Text strokes can sit behind the fill: the stroke lies wholly outside the letters at its full weight on screen, in PNG and in PDF, set from the Properties panel or Character Style Options. IDML `StrokeAlignment` on text imports and exports as this setting, so imported text with outside-aligned strokes keeps its letter shapes (#619). No readiness percentage change.+- **2026-10-12** · Type tool: Option/Alt+Left/Right kerns the pair at the caret (manual kerning) or tracks a selection by the Kerning/Tracking increment (Preferences › Units & Increments, 20/1000 em), five times with Cmd/Ctrl; moving by words is Cmd+Left/Right on macOS and Ctrl+Left/Right elsewhere, and Option/Alt+Shift+Left/Right still selects by words (#621). No readiness percentage change.+- **2026-10-12** · Autoflow on Place threads one frame per page column (right to left in a right-to-left story), so text no longer runs across the gutter; pages Smart Text Reflow adds get a primary frame with the page's columns (#625). No readiness percentage change.+- **2026-10-12** · Vector art copied in Illustrator, VectorCraft, Figma or Inkscape pastes as editable paths, as InDesign pastes Illustrator art: the SVG those apps put on the clipboard becomes paths with their fills, strokes (weight, caps, joins, dashes) and opacity, groups stay groups and text comes in as outlines, centred in the view (`edit.pasteSvg`, `ui.paste`). Edit › Paste reads the system clipboard when nothing was copied in DesignCraft. No readiness percentage change.+- **2026-10-12** · Pages panel: double-clicking a parent shows that parent and selects only its row; parent rows show rendered thumbnails. Commands name parents by id, full name, or a prefix only one parent has; an unknown or ambiguous name is an error instead of clearing the page's parent (#624). No readiness percentage change.+- **2026-10-12** · With the Type tool, dragging a table's column or row border resizes it (the double-arrow cursor shows over a border): later columns and rows move along, Shift keeps the table size, and Shift on the right or bottom edge scales every column or row. A dragged row becomes At Least; one undo step per drag, Esc cancels; works in rotated frames and turned spreads. Scripts use `table.resizeBorder`. No readiness percentage change.+- **2026-10-12** · The Tools panel's Fill/Stroke keys work: D (default fill and stroke), X (fill or stroke in front), Shift+X (swap per object, tints included) and / (Apply None), as `color.*` commands; swap and default are one undo step (`object.swapFillStroke`, `object.defaultFillStroke`); the Color panel follows the proxy's fill/stroke choice. No readiness percentage change.+- **2026-10-12** · With a placed graphic selected (Direct Selection), the Transform values act on the graphic inside its frame, as in InDesign: a tilted frame's image can be straightened to 0°. No readiness percentage change.+- **2026-10-11** · Font menu laid out like InDesign's: filters (classification, favourites,+ recently added), families opening to their styles, the selected text as the sample in three+ sizes, Recently Used fonts, Show Similar Fonts and each font's format.+- **2026-10-12** · The Effects panel shows the level its settings apply to ("Group: Color Dodge 100%") and, as in InDesign, Isolate Blending and Knockout Group for a selected group. No readiness percentage change.+- **2026-10-12** · Edit › Step and Repeat has its InDesign dialog: Repeat (Count, or Rows and Columns with Create as a grid), Offset (Vertical, Horizontal, in ruler units) and Preview, which shows the copies while the dialog is open; Cancel takes them away and OK makes them as one undo step. No readiness percentage change.+- **2026-10-12** · Load Styles: the Paragraph Styles and Character Styles panels load styles from another DesignCraft document or an IDML file, with the styles, swatches and lists they name; a dialog picks the styles and what happens to one the document defines differently (`style.load`). No readiness percentage change.+- **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** · Text threads by hand: click a selected text frame's in or out port to load+ the text cursor, then click a frame to thread it, click empty space for a column-wide frame or+ drag one (it snaps like frame drawing); Shift-click autoflows, Alt-click stays loaded on the+ frame just added; click the linked frame or double-click a port to break the thread.+ `text.thread`, `text.unthread`, `text.removeFromThread` with undo; locked frames and layers+ refuse threads. The alpha gate now waits only on the Primary Text Frame page fixes (#165). No+ readiness percentage change.+- **2026-10-12** · Properties › Transform shows rotation, shear and X/Y scale, and Rotate 90° and Flip Horizontal/Vertical buttons, as InDesign's does. No readiness percentage change.+- **2026-10-12** · Underlines and strikethroughs are drawn as one bar per stretch of text on screen, as in PDF export: a bar per letter left faint seams between the letters. No readiness percentage change.+- **2026-10-12** · The section marker character shows its section's marker text on document pages (nothing when the section has none) instead of the word "Section", which stays on parent pages; editing the marker recomposes (#556). No readiness percentage change.+- **2026-10-12** · IDML import keeps a font family name exactly as written, trailing spaces included, and font lookup falls back to the name without surrounding spaces; `FontStyle="Nothing"` leaves the style to the paragraph (#558). No readiness percentage change.+- **2026-10-12** · Clipping paths saved with images in IDML (Detect Edges, Alpha Channel, Photoshop Path, User-Modified Path, inverted or not) clip the image on screen and in PDF and survive IDML export; `object.clippingPathOptions` reports, inverts or removes one (#450). No readiness percentage change.+- **2026-10-12** · Anchored objects with text wrap push text aside: other stories' text under them and the lines of their own story after the anchor's line (#557). No readiness percentage change.+- **2026-10-12** · Hyphenation Zone applies to the Single-line Composer only, as in InDesign. With the default Paragraph Composer, ragged text hyphenates where InDesign does (aper-natem), giving the same line breaks. No readiness percentage change.+- **2026-10-12** · Text frame auto-size: Height Only, Width Only, Height and Width (also keeping proportions) frames grow and shrink to fit their text after edits and IDML import, around their reference point, with minimum sizes and No Line Breaks, in the same undo step (#180). No readiness percentage change.+- **2026-10-12** · Text Frame Options › Balance Columns (`object.textFrameOptions {balanceColumns}`, IDML `VerticalBalanceColumns`) evens out the columns of the frame a story ends in, from its last column break on; frames the text runs on from fill normally (#609). No readiness percentage change.- **2026-10-12** · macOS Dock Quit uses the same unsaved-document prompts as window and menu Quit. Repeated requests keep the current answers; Cancel retains every tab and unsaved recovery checkpoint, and completed Save/Don't Save answers exit through the ordinary event loop. No readiness percentage change.- **2026-10-12** · Orderly native exit writes the latest recovery state after finalizing current quit approvals; incomplete or stale plans keep their documents, and Undo to the saved state clears stale recovery. Unavailable or failed recovery is reported. Cancelable macOS Dock Quit remains open (#544). No readiness percentage change.+- **2026-10-12** · Windows: dragging the window across monitors with different display scales keeps its size instead of growing until it crashes (winit pinned to its 0.30.x backport of the fix). The GPU surface may be as large as the adapter's largest texture (16384 px on DirectX 12, Vulkan and Metal hardware) instead of 8192, and a wgpu error is logged instead of closing the app. No readiness percentage change.- **2026-10-12** · Recovered documents keep a checkpoint until saved, closed or reverted, including a second crash before autosave. Restarted document IDs and explicit recovery folders preserve other snapshots; failed republishing retains the original. No readiness percentage change.- **2026-10-12** · Book numbering and style updates prepare every chapter before saving. Only closed native chapters are changed; imported IDML remains a read-only style/PDF source. If a later disk write fails, the error names the completed chapters; the batch is not a whole-book transaction. No readiness percentage change.- **2026-10-12** · Desktop write callbacks and CLI raster exports use the atomic writer too; open readers retain the original bytes, while private Unix modes and symlink targets survive replacement. Permanent tests cover both actual callers. No readiness percentage change.diff --cc crates/compose/src/lib.rsindex 3b09100b3,7590681f3..2f7076c42--- a/crates/compose/src/lib.rs+++ b/crates/compose/src/lib.rs@@@ -13,18 -13,12 +13,19 @@@mod bidi;pub mod breaker;mod cache;+pub mod grep;+mod grid;pub mod hyphen;+pub mod kenten;+mod mojikumi;mod notes;+pub mod optical;+ mod outline;mod overlay;+mod parabox;mod ruby;pub mod shape;+pub mod shatai;pub mod table;pub mod vars;mod warichu;@@@ -46,10 -39,10 +47,11 @@@ use designcraft_geom::{Affine, Point, Ruse crate::breaker::{Break, Spacing};pub use crate::cache::Cache;use crate::notes::Notes;-pub use crate::notes::{find_note, hit_note, note_caret};+pub use crate::notes::{find_note, hit_note, hit_note_with, note_caret};+ pub use crate::outline::FrameOutline;+use crate::parabox::ParaBox;use crate::shape::{Glyph, StyleTable, SubstCtx};-pub use crate::table::{PlacedCell, StrokeSeg, TableFrag, cell_caret, find_cell, hit_cell};+pub use crate::table::{BorderHit, PlacedCell, StrokeSeg, TableFrag, cell_caret, find_cell, hit_border, hit_cell, hit_cell_with};/// Character appearance shared by many glyphs (indexed from [`PlacedGlyph::style`]).#[derive(Clone, Debug, PartialEq)]@@@ -555,9 -304,10 +557,12 @@@ pub struct FrameSpec/// area is the turned box.pub vertical: bool,pub exclusions: Vec<Exclusion>,+ /// The frame's outline when it isn't its rectangle (area space): each line's slot is the part+ /// of its band the outline covers, minus the inset.+ pub outline: Option<Arc<FrameOutline>>,pub page_name: Option<String>,+ /// Marker text of the section the frame's page is in (None on parent pages).+ pub section_marker: Option<String>,/// Absolute document page the frame is on (None on parent pages).pub page: Option<usize>,/// Baseline grid in inner space: (first grid line y, increment).@@@ -715,18 -426,25 +720,28 @@@ pub fn frame_specs(doc: &Document, sid}None => (item.text_area(), tf.options.clone()),};+ // A non-rectangular frame keeps the top inset inward from its outline; its rectangular text+ // area (all four insets) still bounds the lines.+ let outline = match &tf.options.path {+ Some(_) => None,+ None => {+ let bp = if item.corners.is_none() { item.path.to_bezpath() } else { designcraft_geom::corners::apply(&item.path, &item.corners) };+ FrameOutline::new(&bp, tf.options.inset[0])+ }+ };// Vertical type: composed in the turned box; wraps and page rects turned with it.let vertical = doc.frame_vertical(item);- let (area, exclusions, grid, page_rect) = if vertical {+ let (area, exclusions, grid, page_rect, outline) = if vertical {let v = designcraft_doc::vertical_text_xf(area).inverse();- let ex = exclusions.into_iter().map(|e| Exclusion { rect: v.transform_rect_bbox(e.rect), ..e }).collect();+ let ex = exclusions+ .into_iter()+ .map(|e| Exclusion { rect: v.transform_rect_bbox(e.rect), contour: e.contour.map(|c| c.transformed(v)), ..e })+ .collect();let pr = page_rect.map(|(a, b)| (v.transform_rect_bbox(a), v.transform_rect_bbox(b)));- (Rect::new(0.0, 0.0, area.height(), area.width()), ex, None, pr)+ let outline = outline.map(|o| o.transformed(v));+ (Rect::new(0.0, 0.0, area.height(), area.width()), ex, None, pr, outline)} else {- (area, exclusions, grid, page_rect)+ (area, exclusions, grid, page_rect, outline)};out.push(FrameSpec {id: fid,@@@ -734,8 -452,8 +749,9 @@@opts,vertical,exclusions: if tf.options.path.is_some() { vec![] } else { exclusions },+ outline: outline.map(Arc::new),page_name,+ section_marker,page,grid,left_page,@@@ -1348,23 -903,19 +1364,30 @@@ fn compose_with_db(doc: &Document, storlet col = if spanning { span_rect(&cols[cur.fi], Rect::new(col.x0, col.y0, col.x1, base.y1), pp.span_columns) } else { col };let col = cur.split_rect(col);// Estimate slots for the breaker with the paragraph's base leading.- let est_asc = base_chars.size * 0.75;+ // A shaped frame's slots change from line to line, so they are estimated with the+ // band the lines are placed with (or a taller one, so no line outgrows its slot).+ let (est_asc, est_band) = if f.outline.is_some() {- let (a, d, _) = line_metrics(&[], &glyphs, g0, base_leading, base_chars.size, db, &base_chars);++ let (a, _, d, _) = line_metrics(&[], &glyphs, g0, mark_leading, mark_chars.size, db, &mark_chars);+ (a, (a.max(base_chars.size * 0.8), d.max(base_chars.size * 0.25)))+ } else {- (base_chars.size * 0.75, (base_chars.size * 0.8, base_chars.size * 0.25))++ (base_chars.size * 0.75, (base_chars.size * 0.8, 0.0))+ };- let est_first = cur.next_baseline(f, col, base_leading, est_asc, &pp);- let slots = estimate_slots(f, col, est_first, base_leading, base_chars.size, est_band, &glyphs[g0..], &pp, line_no);+ let est_tops = Tops { typo_ascent: est_asc, cap: est_asc * 0.72, xh: est_asc * 0.5, em: base_chars.size * 0.88 };+ let est_first =+ if carry.is_empty() { cur.next_baseline(f, col, base_leading, est_asc, est_tops, &pp) } else { carry_baseline + base_leading };+ let est_jump = cur.jump(f, base_leading, est_asc, est_tops);- let slots = estimate_slots(f, col, est_first, est_jump, base_leading, base_chars.size, &glyphs[g0..], rtl, &carry);++ let slots = estimate_slots(f, col, est_first, est_jump, base_leading, base_chars.size, est_band, &glyphs[g0..], rtl, &carry);let width = |j: usize| -> f64 {let (x0, x1) = slots.get(j).copied().unwrap_or((col.x0, col.x1));- let ind = pp.left_indent + pp.right_indent + if line_no + j == 0 { pp.first_line_indent } else { 0.0 };+ // Beside the drop cap (in the column the paragraph starts in), its width; else the+ // first-line indent.+ let ind = pp.left_indent+ + pp.right_indent+ + match &drop_cap {+ Some(dc) if line_no + j < dc.lines && col_first_line == 0 => dc.indent(),+ _ if line_no + j == 0 => pp.first_line_indent,+ _ => 0.0,+ };(x1 - x0 - ind).max(1.0)};let rest = &glyphs[g0..];@@@ -1398,132 -937,41 +1421,132 @@@for (k, b) in breaks.iter().enumerate() {let (s, e) = (g0 + b.start, g0 + b.end);let line_glyphs = &glyphs[s..e.max(s)];- let (asc, desc, lead) = line_metrics(line_glyphs, &glyphs, s, base_leading, base_chars.size, db, &base_chars);- let reference = cjk_line_reference(line_glyphs);- let mut baseline = cur.next_baseline(f, col, lead, asc, &pp);- if cur.last_baseline.is_some() {- baseline += cur.last_reference - reference;- }- // Baseline grid.- if let Some((g_start, inc)) = f.grid- && (pp.grid_align == GridAlign::AllLines || (pp.grid_align == GridAlign::FirstLineOnly && line_no == 0))- && inc > 0.0- {- let n = ((baseline - g_start) / inc - 1e-6).ceil();- baseline = g_start + n * inc;- }- // Wrap: push the line down until a slot exists.+ let (asc, tops, desc, lead) = line_metrics(line_glyphs, &glyphs, s, mark_leading, mark_chars.size, db, &mark_chars);+ let lead = match last_line_mark {+ Some(m) if k + 1 == breaks.len() => lead.max(m),+ _ => lead,+ };+ let (reference, model) = cjk_line_reference(line_glyphs);+ let advance = if cur.last_baseline.is_some() { cur.aki_below.unwrap_or(lead) } else { lead };let (mut x0, mut x1) = (col.x0, col.x1);- if !f.exclusions.is_empty() || f.outline.is_some() {- let mut tries = 0;- loop {- match free_slot(f, col, baseline - asc, baseline + desc, base_size) {- Some((a, b)) => {- x0 = a;- x1 = b;- break;- }+ // A wrap segment that can't hold the line's first word whole stays empty and the+ // text goes on in the next segment or line (a word wider than the column is split+ // wherever it lands).+ let ind = pp.left_indent + pp.right_indent + if line_no == 0 { pp.first_line_indent } else { 0.0 };- let need = if f.exclusions.is_empty() {++ let need = if f.exclusions.is_empty() && f.outline.is_none() {+ 0.0+ } else {+ let w = breaker::first_word_width(glyphs.get(s..).unwrap_or_default(), hyph_after.get(s..).unwrap_or_default(), &spacing);+ if w > col.width() - ind { 0.0 } else { w }+ };+ let holds = |&(a, b): &(f64, f64)| b - a - ind + 0.01 >= need;+ // The line takes the next segment of a line already placed, the one the breaker+ // set it for.+ let mut continues = false;+ let mut baseline = carry_baseline;+ let mut grid_end = None;+ if let Some(i) = carry.iter().position(holds) {+ continues = i == 0;+ grid_end = carry_grid;+ (x0, x1) = carry.get(i).copied().unwrap_or((x0, x1));+ carry.drain(..=i);+ } else {+ carry.clear();+ baseline = cur.next_baseline(f, col, advance, asc, tops, &pp);+ if cur.last_baseline.is_some() {+ baseline += cur.last_reference - reference;+ }+ // Baseline grid: grid alignment and gyoudori (see `grid`).+ let grid = f.grid.filter(|&(_, inc)| {+ inc > 0.0+ && inc.is_finite()+ && (pp.grid_align == GridAlign::AllLines || (pp.grid_align == GridAlign::FirstLineOnly && line_no == 0))+ });+ if let Some((g_start, inc)) = grid {+ let n = pp.grid_gyoudori.min(grid::MAX_GYOUDORI);+ match para_block.filter(|(at, _)| line_no > 0 && *at == (cur.fi, cur.col)) {+ // Inside a paragraph-gyoudori block, lines after the first keep their leading.+ Some((_, end)) => grid_end = Some(end),None => {- let prev = baseline;- baseline += 1.0;- tries += 1;- if baseline > col.y1 || tries > 4000 || baseline == prev || !baseline.is_finite() {- break;+ let r = grid::reference_offset(line_glyphs, pp.grid_reference);+ let block = n > 0 && pp.paragraph_gyoudori && line_no == 0;+ let span = if block {+ // From this line's reference point to the paragraph's last line's.+ let aki_below = |model, lead| (model == designcraft_doc::cjk::LeadingModel::AkiBelow).then_some(lead);+ let (mut down, mut prev, mut prev_aki, mut last_r) = (0.0, reference, aki_below(model, lead), r);+ for (j, nb) in breaks.iter().enumerate().skip(k + 1) {+ let (ns, ne) = (g0 + nb.start, g0 + nb.end);+ let lg = glyphs.get(ns..ne.max(ns)).unwrap_or_default();+ let (_, _, _, nlead) = line_metrics(lg, &glyphs, ns, mark_leading, mark_chars.size, db, &mark_chars);+ let nlead = match last_line_mark {+ Some(m) if j + 1 == breaks.len() => nlead.max(m),+ _ => nlead,+ };+ let (nref, nmodel) = cjk_line_reference(lg);+ down += prev_aki.unwrap_or(nlead) + prev - nref;+ prev = nref;+ prev_aki = aki_below(nmodel, nlead);+ last_r = grid::reference_offset(lg, pp.grid_reference);+ }+ (down + last_r - r).max(0.0)+ } else {+ 0.0+ };+ let lines = if block { grid::lines_for(span, inc, n) } else { n.max(1) };+ let free = cur.grid_next.filter(|(b, _)| cur.last_baseline == Some(*b)).map(|(_, y)| y);+ let band = grid::Band { natural: baseline + r, free, pending: cur.pending, fixed: n > 0, lines, span };+ let (y, end) = grid::place((g_start, inc), pp.grid_reference, band);+ baseline = y - r;+ grid_end = Some(end);+ if block {+ para_block = Some(((cur.fi, cur.col), end));}}}}+ // A line a wrap pushes down moves by whole grid lines, keeping its place in its band.+ let on_grid = baseline;+ let snap = |y: f64| grid.map_or(y, |(_, inc)| on_grid + ((y - on_grid) / inc - 1e-6).ceil().max(0.0) * inc);+ // Wrap: push the line down to the first position with a slot (back on the grid).+ // Segments after the first are carried to the next lines of the paragraph.- if !f.exclusions.is_empty() {++ if !f.exclusions.is_empty() || f.outline.is_some() {+ let jump = cur.jump(f, advance, asc, tops);+ let line_start = glyphs.get(s).map_or(prange.start, |g| g.byte);+ let mut tries = 0;+ loop {- let Some((nb, segs)) = wrap_slot(f, col, baseline, asc, jump, base_size, rtl, line_start, &holds) else {++ let Some((nb, segs)) = wrap_slot(f, col, baseline, asc, desc, jump, base_size, rtl, line_start, &holds) else {+ // No room in this column.+ baseline = baseline.max(col.y1) + 1.0;+ carry.clear();+ break;+ };+ let pushed = nb > baseline;+ baseline = nb;+ if let Some((&first, rest)) = segs.split_first() {+ (x0, x1) = first;+ carry = rest.to_vec();+ }+ tries += 1;+ if !pushed || grid.is_none() || tries > 4000 {+ break;+ }+ baseline = snap(baseline);+ }+ }+ grid_end = grid_end.map(|end| end + baseline - on_grid);+ carry_baseline = baseline;+ carry_grid = grid_end;+ }+ // The breaker set this line for another segment width: re-break the rest of the+ // paragraph from here, starting with this line's segments as they are. A pass+ // re-breaks at its first line only for a new line, whose segments it carries, so+ // every re-break makes progress; their number is capped too.+ if (k > 0 || !continues) && rebreaks < 256 && slots.get(k).is_some_and(|&(a, b)| ((b - a) - (x1 - x0)).abs() > 0.5) {+ rebreaks += 1;+ carry.insert(0, (x0, x1));+ g0 = s;+ moved = true;+ break;}let capped = cur.split.is_none() && line_cap[pi] == Some(line_no) && line_no > col_first_line;// Footnotes referenced on this line need room at the bottom of the column too@@@ -2873,192 -2093,81 +2896,207 @@@ fn line_metricsdesc = desc.max(g.descent - shift.min(0.0));lead = lead.max(g.leading);}- (asc, desc, lead)+ if !own_text {+ // Only a label (an empty list paragraph): as an empty paragraph.+ let face = face();+ tops.typo_ascent = face.typo_ascent * base_size / face.upem;+ tops.em = em_box_top(&face, base_size);+ }+ (asc, tops, desc, lead)+}++/// How a line clears Jump Object wraps. The line occupies `[baseline − top, baseline]` (its leading,+/// or its first baseline offset at the top of a column) and must not overlap the wrap; it may hang its+/// descenders into the wrap. Below a wrap it moves down from its place in whole `step`s until it clears+/// the wrap bottom (`step` 0: its top lands on the wrap bottom).+#[derive(Clone, Copy, Debug)]+struct Jump {+ top: f64,+ step: f64,}-/// Widest free horizontal interval of `col` in the band (inside the frame's outline, outside-/// wraps), or None if blocked.-fn free_slot(f: &FrameSpec, col: Rect, y0: f64, y1: f64, size: f64) -> Option<(f64, f64)> {+/// Slack for float error when a line is tested against a Jump Object wrap's edges.+const JUMP_EPS: f64 = 1e-6;++/// The first baseline at or below `baseline` where a line with ascent `asc` has free segments in+/// `col`, from its top to its baseline, one of which `holds` the line (its first word fits), and+/// the segments from that one on (see [`free_slots`], never empty); None if there are none above+/// the column bottom. `line_start` is the story byte the line starts at (see+/// [`Exclusion::wraps_line`]).+///+/// A line under a Jump Object wrap moves below it as `jump` says. Around a rectangular wrap the+/// free space only grows where one in the line's band ends: the search jumps from one such bottom+/// edge to the next, and a line that clears a wrap has its top exactly on the wrap's bottom. A- /// contour's width changes within its box, so beside one the search moves down 1 pt at a time.++/// contour's width changes within its box, and a shaped frame's along its outline, so beside one++/// the search moves down 1 pt at a time.+#[allow(clippy::too_many_arguments)]+fn wrap_slot(+ f: &FrameSpec,+ col: Rect,+ baseline: f64,+ asc: f64,++ desc: f64,+ jump: Jump,+ size: f64,+ rtl: bool,+ line_start: usize,+ holds: &dyn Fn(&(f64, f64)) -> bool,+) -> Option<(f64, Vec<(f64, f64)>)> {+ let top = jump.top.max(0.0);+ let mut b = baseline;+ // Each step passes at least one wrap; the cap bounds hostile geometry.+ for _ in 0..4000 {+ let jumped = f+ .exclusions+ .iter()+ .filter(|e| e.mode == WrapMode::JumpObject && e.wraps_line(line_start))+ .map(|e| e.rect)+ .filter(|r| r.x0 < col.x1 && r.x1 > col.x0 && b > r.y0 + JUMP_EPS && b - top < r.y1 - JUMP_EPS)+ .fold(f64::NEG_INFINITY, |m, r| m.max(r.y1));+ b = if jumped > f64::NEG_INFINITY {+ if jump.step > 0.0 {+ // Whole steps from the line's own place (at least one step past the line above).+ baseline + ((jumped + top - baseline - JUMP_EPS / 2.0) / jump.step).ceil().max(0.0) * jump.step+ } else {+ jumped + top+ }+ } else {+ // Segments before the first that `holds` the line's first word stay empty.- let segs: Vec<(f64, f64)> = free_slots(f, col, b - asc, b, size, rtl, line_start).into_iter().skip_while(|seg| !holds(seg)).collect();++ let segs: Vec<(f64, f64)> = free_slots(f, col, b - asc, b, desc, size, rtl, line_start).into_iter().skip_while(|seg| !holds(seg)).collect();+ if !segs.is_empty() {+ return Some((b, segs));+ }+ let (y0, y1) = (b - asc, b);+ let in_band = || {+ f.exclusions+ .iter()+ .filter(|e| e.mode != WrapMode::JumpObject && e.wraps_line(line_start))+ .filter(|e| e.rect.y0 < y1 && e.rect.y1 > y0)+ };+ let edge = in_band().fold(f64::INFINITY, |m, e| m.min(e.rect.y1)) + asc;- if in_band().any(|e| e.contour.is_some()) { edge.min(b + 1.0) } else { edge }++ // A contour's or a shaped frame's width changes within the band: 1 pt at a time.++ let next = if f.outline.is_some() || in_band().any(|e| e.contour.is_some()) { edge.min(b + 1.0) } else { edge };++ // No progress (coordinates so large that a point no longer moves the line) or none left.++ if !(next > b) || !next.is_finite() {++ return None;++ }++ next+ };+ if b.is_nan() || b > col.y1 {+ return None;+ }+ }+ None+}++/// Free segments of `col` in the band `y0..y1` (a line's top to its baseline: descenders may reach- /// into the wrap), in the order text fills them (left to right, or- /// right to left for right-to-left paragraphs); empty if the band is blocked. A line beside an++/// into the wrap; a shaped frame's outline holds them too, `desc` below `y1`), in the order text++/// fills them (left to right, or right to left for right-to-left paragraphs); empty if the band is blocked. A line beside an+/// object that lets text through on both sides has a segment on each side. When an object cuts+/// the column, segments narrower than 1.5 em of `size` are skipped (slivers beside it); a column+/// no object reaches is free however narrow (a one-character frame such as an article's closing+/// tombstone). `line_start` is the story byte the line starts at (see [`Exclusion::wraps_line`]).+#[allow(clippy::too_many_arguments)]- fn free_slots(f: &FrameSpec, col: Rect, y0: f64, y1: f64, size: f64, rtl: bool, line_start: usize) -> Vec<(f64, f64)> {- let mut free = vec![(col.x0, col.x1)];- let mut cut = false;++fn free_slots(f: &FrameSpec, col: Rect, y0: f64, y1: f64, desc: f64, size: f64, rtl: bool, line_start: usize) -> Vec<(f64, f64)> {++ // A shaped frame: the parts of the band its outline covers (a concave one can give several),++ // descenders included: they stay inside the frame.+ let mut free = match &f.outline {- Some(o) => o.intervals(col.x0, col.x1, y0, y1),++ Some(o) => o.intervals(col.x0, col.x1, y0, y1 + desc.max(0.0)),+ None => vec![(col.x0, col.x1)],+ };- for ex in &f.exclusions {++ let mut cut = f.outline.is_some();+ for ex in f.exclusions.iter().filter(|e| e.wraps_line(line_start)) {let r = ex.rect;let overlaps_band = r.y0 < y1 && r.y1 > y0;- match ex.mode {- WrapMode::JumpToNextColumn if y1 > r.y0 && r.x0 < col.x1 && r.x1 > col.x0 => return None,- WrapMode::JumpObject if overlaps_band && r.x0 < col.x1 && r.x1 > col.x0 => return None,- WrapMode::BoundingBox | WrapMode::Contour if overlaps_band => {- let mut next = Vec::new();- for (a, b) in free {- if r.x1 <= a || r.x0 >= b {- next.push((a, b));- continue;- }- if r.x0 > a {- next.push((a, r.x0));- }- if r.x1 < b {- next.push((r.x1, b));- }- }- free = next;+ let blocked = match ex.mode {+ WrapMode::JumpToNextColumn if y1 > r.y0 && r.x0 < col.x1 && r.x1 > col.x0 => return vec![],+ WrapMode::BoundingBox | WrapMode::Contour if overlaps_band => match &ex.contour {+ Some(c) => c.band_extent(y0, y1),+ None => Some((r.x0, r.x1)),+ },+ _ => None,+ };+ let Some((a, b)) = blocked.filter(|&(a, b)| a < col.x1 && b > col.x0) else { continue };+ cut = true;+ // One-sided wraps also block the column on the other side of the object.+ let text_left = match ex.side {+ WrapSide::LeftSide => Some(true),+ WrapSide::RightSide => Some(false),+ WrapSide::LargestArea => Some(r.x0 - col.x0 >= col.x1 - r.x1),+ WrapSide::BothSides | WrapSide::TowardsSpine | WrapSide::AwayFromSpine => None,+ };+ let (a, b) = match text_left {+ Some(true) => (a, b.max(col.x1)),+ Some(false) => (a.min(col.x0), b),+ None => (a, b),+ };+ let mut next = Vec::with_capacity(free.len() + 1);+ for (fa, fb) in free {+ if b <= fa || a >= fb {+ next.push((fa, fb));+ continue;+ }+ if a > fa {+ next.push((fa, a));+ }+ if b < fb {+ next.push((b, fb));}- _ => {}}+ free = next;+ }+ if cut {+ free.retain(|(a, b)| b - a >= size * 1.5);}- free.into_iter().filter(|(a, b)| b - a >= size * 1.5).max_by(|x, y| (x.1 - x.0).total_cmp(&(y.1 - y.0)))+ if rtl {+ free.reverse();+ }+ free}+/// Line slots for the breaker: the free segments of each line from baseline `first` down, `lead`- /// apart; `carry` holds segments left on the line above (they come first).++/// apart, for lines with `band` (ascent, descent); `carry` holds segments left on the line above++/// (they come first).#[allow(clippy::too_many_arguments)]fn estimate_slots(f: &FrameSpec,col: Rect,first: f64,+ jump: Jump,lead: f64,size: f64,+ band: (f64, f64),glyphs: &[Glyph],- pp: &ParaProps,- line_no: usize,+ rtl: bool,+ carry: &[(f64, f64)],) -> Vec<(f64, f64)> {- if f.exclusions.is_empty() {- let _ = (pp, line_no);+ if f.exclusions.is_empty() && f.outline.is_none() {return vec![];}// Rough upper bound on lines: total advance / column width × 2.let total: f64 = glyphs.iter().map(|g| g.adv).sum();let n = ((total / (col.width().max(10.0) * 0.5)).ceil() as usize + 2).min(2000);- let mut v = Vec::with_capacity(n);+ let mut v = Vec::with_capacity(n + carry.len());+ v.extend_from_slice(carry);let mut b = first;- for _ in 0..n {- let mut tries = 0;- let slot = loop {- if let Some(s) = free_slot(f, col, b - band.0, b + band.1, size) {- break s;- }- let prev = b;- b += 1.0;- tries += 1;- // `b == prev`: coordinates so large that a point no longer moves the band.- if b > col.y1 || tries > 4000 || b == prev || !b.is_finite() {- break (col.x0, col.x1);+ let mut jump = jump;+ // Own-story anchored objects whose anchor is in these lines wrap only the lines after it: the+ // rest is broken again once that line is set.+ let line_start = glyphs.first().map_or(0, |g| g.byte);+ while v.len() < n + carry.len() {- let slots = match wrap_slot(f, col, b, size * 0.8, jump, size, rtl, line_start, &|_| true) {++ let slots = match wrap_slot(f, col, b, band.0, band.1, jump, size, rtl, line_start, &|_| true) {+ Some((nb, s)) => {+ b = nb;+ s+ }+ None => {+ b = b.max(col.y1);+ vec![(col.x0, col.x1)]}};- v.push(slot);+ v.extend(slots);b += lead;+ jump = Jump { top: lead, step: lead };}v}diff --cc crates/compose/src/notes.rsindex 1dd37d52f,c52419515..2829ec02b--- a/crates/compose/src/notes.rs+++ b/crates/compose/src/notes.rs@@@ -134,8 -101,8 +134,9 @@@ impl Notesopts: TextFrameOptions { first_baseline: o.first_baseline, first_baseline_min: o.first_baseline_min, ..Default::default() },vertical: false,exclusions: vec![],+ outline: None,page_name: f.page_name.clone(),+ section_marker: f.section_marker.clone(),page: f.page,grid: None,left_page: f.left_page,diff --cc crates/compose/src/table.rsindex 56d3deaef,43f3bbfe9..d70ff074a--- a/crates/compose/src/table.rs+++ b/crates/compose/src/table.rs@@@ -128,8 -111,8 +128,9 @@@ fn compose_cell(doc: &Document, cell: &opts: TextFrameOptions::default(),vertical: false,exclusions: vec![],+ outline: None,page_name: opts.page_name.clone(),+ section_marker: opts.section_marker.clone(),page: opts.page,grid: None,left_page,diff --cc crates/compose/src/tests.rsindex 5ff1747ae,ead776f4a..3e33874e6--- a/crates/compose/src/tests.rs+++ b/crates/compose/src/tests.rs@@@ -6648,41 -2772,192 +6648,214 @@@ fn balance_columns_evens_out_the_column}#[test]-fn empty_paragraphs_get_no_bullet_or_number() {- let bullets = ParaAttrs { list_type: Some(designcraft_doc::ListType::Bullets), ..Default::default() };- let (d, sid, _) = doc_with("One\n\nTwo\n", Rect::new(0.0, 0.0, 300.0, 300.0), bullets);+fn balance_columns_leaves_a_frame_the_text_runs_on_from() {+ let rect = Rect::new(0.0, 0.0, 400.0, 150.0);+ let layout = |on: bool| {+ let (mut d, sid, f1) = balance_doc(4, 2, rect, on);+ let lid = d.default_layer();+ let (f2, _) = d.add_text_frame(SpreadRef::Doc(0), Rect::new(0.0, 300.0, 400.0, 700.0), lid, "", ParaFormat::default()).unwrap();+ let o = &mut d.item_mut(f2).unwrap().text_frame_mut().unwrap().options;+ o.columns = 2;+ o.balance_columns = on;+ d.thread(f1, f2).unwrap();+ compose_story(&d, sid, &ComposeOptions::default())+ };+ let (off, on) = (layout(false), layout(true));+ assert!(!on.is_overset());+ let first = |cs: &ComposedStory| cs.frames[0].lines.iter().map(|l| (l.column, l.baseline, l.range.clone())).collect::<Vec<_>>();+ assert_eq!(first(&on), first(&off), "the first frame fills normally");+ let c = column_line_counts(&on.frames[1]);+ assert!(c[1] > 0 && c[0] - c[1] <= 1, "the frame the story ends in is balanced: {c:?}");+}++#[test]+fn balance_columns_starts_after_a_column_break() {+ // The first paragraph ends with a column break: the first column holds it alone and the+ // other two share the rest.+ let text = format!("{LOREM}{}\n{}", designcraft_doc::story::COLUMN_BREAK, [LOREM; 3].join("\n"));+ let (mut d, sid, fid) = doc_with(&text, Rect::new(0.0, 0.0, 540.0, 500.0), ParaAttrs::default());+ let o = &mut d.item_mut(fid).unwrap().text_frame_mut().unwrap().options;+ o.columns = 3;+ o.balance_columns = true;let cs = compose_story(&d, sid, &ComposeOptions::default());- assert_eq!(list_labels(&cs, LABEL_CHARS), ["\u{2022}", "", "\u{2022}", ""]);- // An empty paragraph doesn't use up a number, in a story's own list or a named one.- for name in ["", "Steps"] {- let attrs = ParaAttrs { list_name: Some(name.into()), ..numbered(designcraft_doc::NumberStyle::Arabic, "^#.^t") };- let (mut d, sid, _) = doc_with("One\n\nTwo\n", Rect::new(0.0, 0.0, 300.0, 300.0), attrs);- if !name.is_empty() {- d.settings.lists.push(designcraft_doc::NumberedList { name: name.into(), continue_across_stories: false });- }- let cs = compose_story(&d, sid, &ComposeOptions::default());- assert_eq!(list_labels(&cs, LABEL_CHARS), ["1.", "", "2.", ""], "list `{name}`");- }+ assert!(!cs.is_overset());+ let ft = &cs.frames[0];+ assert_no_overlap(ft);+ assert!(ft.lines.iter().filter(|l| l.column == 0).all(|l| l.para == 0));+ assert!(ft.lines.iter().filter(|l| l.para == 0).all(|l| l.column == 0));+ let c = column_line_counts(ft);+ assert!(c[2] > 0 && c[1] >= c[2] && c[1] - c[2] <= 1, "{c:?}");}++ fn shaped_doc(path: designcraft_geom::PathData, rect: Rect, inset: f64) -> (Document, StoryId, ItemId) {+ let (mut d, sid, fid) = doc_with(&[LOREM; 4].join(" "), rect, ParaAttrs::default());+ let it = d.item_mut(fid).unwrap();+ it.path = path;+ it.text_frame_mut().unwrap().options.inset = [inset; 4];+ (d, sid, fid)+ }++ /// The corners of a line's band (slot ends from its top to its bottom).+ fn line_corners(l: &Line) -> [(f64, f64); 4] {+ let (t, b) = (l.baseline - l.ascent, l.baseline + l.descent);+ [(l.x0, t), (l.x1, t), (l.x0, b), (l.x1, b)]+ }++ /// Is `p` inside the ellipse in `r` (allowing for the Bézier bulge)?+ fn in_ellipse(r: Rect, p: (f64, f64)) -> bool {+ let (c, a, b) = (r.center(), r.width() / 2.0, r.height() / 2.0);+ ((p.0 - c.x) / a).powi(2) + ((p.1 - c.y) / b).powi(2) <= 1.001+ }++ /// Distance from `p` inside the ellipse in `r` to its outline (sampled).+ fn ellipse_clearance(r: Rect, p: (f64, f64)) -> f64 {+ let (c, a, b) = (r.center(), r.width() / 2.0, r.height() / 2.0);+ let inside = ((p.0 - c.x) / a).powi(2) + ((p.1 - c.y) / b).powi(2) <= 1.0 + 1e-9;+ let d = (0..7200)+ .map(|k| {+ let t = k as f64 / 7200.0 * std::f64::consts::TAU;+ (c.x + a * t.cos() - p.0).hypot(c.y + b * t.sin() - p.1)+ })+ .fold(f64::INFINITY, f64::min);+ if inside { d } else { -d }+ }++ #[test]+ fn oval_frame_sets_lines_inside_the_ellipse() {+ let r = Rect::new(0.0, 0.0, 300.0, 200.0);+ let (d, sid, _) = shaped_doc(designcraft_geom::shapes::ellipse(r), r, 0.0);+ let cs = compose_story(&d, sid, &ComposeOptions::default());+ let lines = all_lines(&cs);+ assert!(lines.len() >= 8, "{}", lines.len());+ for l in &lines {+ for p in line_corners(l) {+ assert!(in_ellipse(r, p), "line corner {p:?} outside the oval");+ }+ assert!(l.end_x <= l.x1 + 0.5, "line overflows its slot: {} > {}", l.end_x, l.x1);+ }+ let w = |l: &Line| l.x1 - l.x0;+ let widest = lines.iter().map(|l| w(l)).fold(0.0, f64::max);+ assert!(w(lines[0]) < widest - 50.0, "first {} widest {widest}", w(lines[0]));+ // Bands where the oval is narrower than 1.5 em hold no line.+ assert!(lines.iter().all(|l| w(l) >= 18.0 - 1e-6));+ }++ #[test]+ fn oval_frame_keeps_lines_an_inset_inside_the_outline() {+ let r = Rect::new(0.0, 0.0, 300.0, 240.0);+ let (d, sid, _) = shaped_doc(designcraft_geom::shapes::ellipse(r), r, 10.0);+ let cs = compose_story(&d, sid, &ComposeOptions::default());+ let lines = all_lines(&cs);+ assert!(lines.len() >= 6, "{}", lines.len());+ for l in &lines {+ for p in line_corners(l) {+ assert!(ellipse_clearance(r, p) >= 10.0 - 0.1, "line corner {p:?} closer than the inset: {}", ellipse_clearance(r, p));+ }+ }+ }++ #[test]+ fn triangle_frame_lines_widen_downward() {+ use designcraft_geom::{Anchor, PathData, Point, SubPath};+ let r = Rect::new(0.0, 0.0, 300.0, 300.0);+ let tri = [Point::new(150.0, 0.0), Point::new(300.0, 300.0), Point::new(0.0, 300.0)];+ let path = PathData::single(SubPath { anchors: tri.iter().map(|&p| Anchor::corner(p)).collect(), closed: true });+ let (d, sid, _) = shaped_doc(path, r, 0.0);+ let cs = compose_story(&d, sid, &ComposeOptions::default());+ let lines = all_lines(&cs);+ assert!(lines.len() >= 8, "{}", lines.len());+ for w in lines.windows(2) {+ assert!(w[1].x1 - w[1].x0 > w[0].x1 - w[0].x0, "{} then {}", w[0].x1 - w[0].x0, w[1].x1 - w[1].x0);+ }+ // Every slot end lies inside the triangle: |x - 150| ≤ y / 2 over the whole band.+ for l in &lines {+ for (x, y) in line_corners(l) {+ assert!((x - 150.0).abs() <= y / 2.0 + 1e-6, "({x}, {y}) outside the triangle");+ }+ }+ }++ #[test]+ fn rectangular_frame_paths_keep_the_rectangular_layout() {+ use designcraft_geom::{Anchor, PathData, Point, SubPath};+ let r = Rect::new(20.0, 30.0, 260.0, 400.0);+ let (d, sid, _) = doc_with(&[LOREM; 4].join(" "), r, ParaAttrs::default());+ let plain = compose_story(&d, sid, &ComposeOptions::default());+ // The same rectangle drawn with an extra anchor on its top edge.+ let pts = [(20.0, 30.0), (100.0, 30.0), (260.0, 30.0), (260.0, 400.0), (20.0, 400.0)];+ let path = PathData::single(SubPath { anchors: pts.iter().map(|&(x, y)| Anchor::corner(Point::new(x, y))).collect(), closed: true });+ let (d2, sid2, _) = shaped_doc(path, r, 0.0);+ assert!(frame_specs(&d2, sid2)[0].outline.is_none());+ assert!(frame_specs(&d, sid)[0].outline.is_none());+ let redrawn = compose_story(&d2, sid2, &ComposeOptions::default());+ let key = |cs: &ComposedStory| all_lines(cs).iter().map(|l| (l.range.clone(), l.baseline, l.x0, l.x1)).collect::<Vec<_>>();+ assert_eq!(key(&plain), key(&redrawn));+ }++ #[test]+ fn resizing_an_oval_frame_reflows_its_lines() {+ let r = Rect::new(0.0, 0.0, 240.0, 200.0);+ let (mut d, sid, fid) = shaped_doc(designcraft_geom::shapes::ellipse(r), r, 0.0);+ let cache = Cache::new();+ let small = cache.get(&d, sid, None);+ let big_r = Rect::new(0.0, 0.0, 400.0, 300.0);+ d.item_mut(fid).unwrap().path = designcraft_geom::shapes::ellipse(big_r);+ let big = cache.get(&d, sid, None);+ let (ls, lb) = (all_lines(&small), all_lines(&big));+ assert!(lb.len() > ls.len(), "{} vs {}", lb.len(), ls.len());+ for l in &lb {+ for p in line_corners(l) {+ assert!(in_ellipse(big_r, p), "line corner {p:?} outside the resized oval");+ }+ }+ assert!(lb.iter().map(|l| l.x1 - l.x0).fold(0.0, f64::max) > 300.0);+ }++ #[test]+ fn vertical_oval_frame_sets_columns_inside_the_turned_ellipse() {+ let r = Rect::new(0.0, 0.0, 300.0, 200.0);+ let (mut d, sid, _) = shaped_doc(designcraft_geom::shapes::ellipse(r), r, 0.0);+ d.story_mut(sid).unwrap().vertical = true;+ let cs = compose_story(&d, sid, &ComposeOptions::default());+ let lines = all_lines(&cs);+ assert!(!lines.is_empty());+ // The turned box is 200 wide and 300 tall; the ellipse turns with it.+ let turned = Rect::new(0.0, 0.0, 200.0, 300.0);+ for l in &lines {+ for p in line_corners(l) {+ assert!(in_ellipse(turned, p), "line corner {p:?} outside the turned oval");+ }+ }+ }++ #[test]+ fn oval_frame_columns_each_follow_the_outline() {+ let r = Rect::new(0.0, 0.0, 400.0, 300.0);+ let (mut d, sid, fid) = shaped_doc(designcraft_geom::shapes::ellipse(r), r, 0.0);+ d.item_mut(fid).unwrap().text_frame_mut().unwrap().options.columns = 2;+ let cs = compose_story(&d, sid, &ComposeOptions::default());+ let lines = all_lines(&cs);+ assert!(lines.iter().any(|l| l.column == 1));+ for l in &lines {+ for p in line_corners(l) {+ assert!(in_ellipse(r, p), "line corner {p:?} outside the oval");+ }+ }+ }++ #[test]+ fn degenerate_frame_outlines_compose_without_panicking() {+ use designcraft_geom::{Anchor, PathData, Point, SubPath};+ let tri = |pts: [(f64, f64); 3]| {+ PathData::single(SubPath { anchors: pts.iter().map(|&(x, y)| Anchor::corner(Point::new(x, y))).collect(), closed: true })+ };+ let r = Rect::new(0.0, 0.0, 200.0, 200.0);+ for path in [+ tri([(0.0, 0.0), (100.0, 100.0), (200.0, 200.0)]),+ tri([(0.0, 0.0), (f64::NAN, 100.0), (200.0, 200.0)]),+ designcraft_geom::shapes::ellipse(Rect::new(-1e15, -1e15, 1e15, 1e15)),+ ] {+ let (d, sid, _) = shaped_doc(path, r, 1e300);+ let _ = compose_story(&d, sid, &ComposeOptions::default());+ }+ }diff --cc docs/typography-parity.mdindex 6828f7946,dd5c5fd19..eee75e660--- a/docs/typography-parity.md+++ b/docs/typography-parity.md@@@ -48,9 -47,9 +48,10 @@@ Fidelity: **unmeasured** unless stated| Frame fit / overset | baseline of the last line must fit | descenders must fit | ~ | **differs** (#180): frames go overset where InDesign fits || Baseline grid | document and frame grids | ✓ | ✓ | || Vertical justification | top, centre, bottom, justify, paragraph spacing limit | ✓ | ✓ | |+ | Text in shaped frames | lines follow oval, polygon and freeform frame outlines, one inset from the outline | ✓ | ~ | concave shapes set one slot per line (the widest); vertical justification and paragraph shading use the frame's rectangle (#646) || Columns, span / split columns | ✓ | ✓ | ✓ | split columns within a column (#295); text after a span flows below it (#276) || Column rules | ✓ | ✓ (screen, PDF, IDML) | ~ | no stroke types or overprint (#274) |+| Balance columns | ✓ | ✓ (IDML `VerticalBalanceColumns`) | ✓ | evens out the columns of the frame the story ends in, after its last column break (#609) || Keep options and breaks | keep with next, lines together, start in next column/frame/page/odd/even | ✓ | ✓ | break characters end paragraphs (#285); the line before a break is a last line (#283) || Drop caps, nested, line and GREP styles | ✓ | ✓ | ✓ | || Bullets and numbering | lists, levels, formats, restart, across stories | ✓ | ~ | numbering expressions from IDML (#298); Convert Bullets/Numbering to Text missing |