Skip to content

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

Merge colour-entry: Color Picker and Color panel keep typed values; colours read on a fixed scale (#323)

aiongg283f3f5bbc42
diff --cc ROADMAP.md
index b22996ea0,9d5a14934..416d28ca8
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@@ -128,42 -129,9 +128,43 @@@ list) · [roadmap.md](docs/roadmap.md)
Newest first.
+ - **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/engine/src/cmd/style.rs
index 9dc926317,d5fe5b25e..dde85b88a
--- a/crates/engine/src/cmd/style.rs
+++ b/crates/engine/src/cmd/style.rs
@@@ -181,19 -180,10 +181,19 @@@ pub fn specs() -> Vec<CommandSpec>
"Apply Color",
[],
None,
- "{color: \"#rrggbb\"|{c,m,y,k}(0..100)|[r,g,b](0..255), target?: fill|stroke, text?: bool, ids?} — an unnamed colour (not in the Swatches panel until Add to Swatches) on the selection; `text`: on the selected text, or the text of the selected frames (Formatting Affects Text)",
- "{color: \"#rrggbb\"|{c,m,y,k}(0..100)|[r,g,b](0..255)|{model: rgb|cmyk|gray, r,g,b|c,m,y,k|k}(0..1), target?: fill|stroke, ids?} — an unnamed colour (not in the Swatches panel until Add to Swatches) on the selection",
- super::has_selection,
++ "{color: \"#rrggbb\"|{c,m,y,k}(0..100)|[r,g,b](0..255)|{model: rgb|cmyk|gray, r,g,b|c,m,y,k|k}(0..1), target?: fill|stroke, text?: bool, ids?} — an unnamed colour (not in the Swatches panel until Add to Swatches) on the selection; `text`: on the selected text, or the text of the selected frames (Formatting Affects Text)",
+ |s| super::has_text(s).or_else(|_| super::has_selection(s)),
apply_color
),
+ cmd!(
+ "color.sample",
+ "Sample Color (Eyedropper)",
+ [],
+ None,
+ "{at: [x,y] (spread coords), spread?, target?: fill|stroke, ids?, matchFrom?: id} → {color: \"#rrggbb\", swatch, from: image id} — the Eyedropper on a placed image: the image's colour at the point (an unnamed colour) fills the selected text, else the selected objects. With no opaque image pixel there, `matchFrom` gives the object whose attributes apply instead (object.matchAttributes)",
+ |s| super::has_text(s).or_else(|_| super::has_selection(s)),
+ sample_color
+ ),
cmd!(
"swatch.addToSwatches",
"Add to Swatches",
@@@ -1081,14 -971,16 +1097,21 @@@ fn apply_gradient(s: &mut Session, p: &
fn apply_color(s: &mut Session, p: &Value) -> Result<Value> {
let color = p.get("color").and_then(parse_color).ok_or_else(|| bad("object.color", "missing or bad color"))?;
let stroke = str_param(p, "target") == Some("stroke");
- let ids = super::targets(s, p)?;
- s.edit(|d, _| {
+ let text = (p.get("text").and_then(Value::as_bool).unwrap_or(false) || s.doc()?.selection.text.is_some())
+ && p.get("ids").is_none()
+ && p.get("id").is_none();
+ let (ids, texts) = if text { (vec![], super::text::format_targets_pub(s)) } else { (super::targets(s, p)?, vec![]) };
+ // A caret: the colour is for the next typing (once the swatch exists).
+ let caret = matches!(texts.as_slice(), [t] if t.range.is_empty());
+ let r = s.edit(|d, _| {
- // Reuse a swatch holding exactly this colour, else add an unnamed one.
+ // Reuse a swatch holding this colour to the precision its name shows (whole CMYK percents,
+ // 0-255 RGB), else add an unnamed one: values a fraction of a percent apart would otherwise
+ // add hidden "C=0 M=50 Y=100 K=0 2" twins.
+ let shown = value_name(color);
+ let process = |w: &&Swatch| match &w.value {
+ SwatchValue::Color { color: c, color_type: designcraft_color::ColorType::Process } => Some(*c),
+ _ => None,
+ };
let existing = d
.swatches
.iter()
diff --cc crates/ui-egui/src/dialogs.rs
index fe0c0f6c2,ced768aea..4b1b0bcd3
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@@ -2398,31 -1900,17 +2399,39 @@@ pub fn confirm(app: &mut DesignApp) ->
}
r
}
+ "deleteCharacterStyle" => {
+ let name = d.s("name");
+ let replace = d.s("replaceWith");
+ app.run(
+ "style.character.delete",
+ json!({"name": name, "replaceWith": if replace.is_empty() { json!(designcraft_doc::NO_CHAR_STYLE) } else { json!(replace) }}),
+ )
+ }
+ "swatchOptions" | "colorGroupOptions" | "layerSettings" => {
+ let r = match d.id.as_str() {
+ "swatchOptions" => options::confirm_swatch_options(app, &d),
+ "colorGroupOptions" => options::confirm_color_group_options(app, &d),
+ _ => options::confirm_layer_options(app, &d),
+ };
+ if let Err(e) = &r {
+ // Keep the dialog open with the reason (a taken or empty name).
+ let mut d = d.clone();
+ d.fields.insert("status".into(), json!(e));
+ app.ui.dialog = Some(d);
+ }
+ r
+ }
+ // Nothing edited: OK leaves the fill or stroke as it was (its swatch and tint).
+ "colorPicker" if !d.b("edited") => Ok(Value::Null),
"colorPicker" => {
- let hex = d.s("hex");
- app.run("object.color", json!({"color": hex, "target": d.s("target"), "text": d.b("text")}))
+ let color = if d.s("model") == "cmyk" {
+ let [c, m, y, k] = nums::<4>(&d, "cmyk").ok_or("no colour")?.map(|v| v / 100.0);
+ json!({"model": "cmyk", "c": c, "m": m, "y": y, "k": k})
+ } else {
+ let [r, g, b] = nums::<3>(&d, "rgb").ok_or("no colour")?.map(|v| v / 255.0);
+ json!({"model": "rgb", "r": r, "g": g, "b": b})
+ };
- app.run("object.color", json!({"color": color, "target": d.s("target")}))
++ app.run("object.color", json!({"color": color, "target": d.s("target"), "text": d.b("text")}))
}
"layerOptions" => {
let hidden: Vec<Value> = d.fields.get("layers").and_then(Value::as_array).map(|a| a.iter().filter(|l| l["visible"] == false).map(|l| l["name"].clone()).collect()).unwrap_or_default();
@@@ -5890,302 -4061,109 +5970,444 @@@ mod tests
}
}
+ fn select_all_key() -> egui::Event {
+ egui::Event::Key {
+ key: egui::Key::A,
+ physical_key: None,
+ pressed: true,
+ repeat: false,
+ modifiers: egui::Modifiers { ctrl: true, command: true, ..Default::default() },
+ }
+ }
+
+ /// The Color Picker over a new document's selected frame, a few frames in.
+ fn picker(fields: Value) -> (DesignApp, egui::Context, egui::Rect, u64) {
+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());
+ app.run("file.new", json!({})).unwrap();
+ let id = app.run("frame.create", json!({"rect": [36, 36, 200, 200]})).unwrap()["id"].as_u64().unwrap();
+ app.run("selection.set", json!({"ids": [id]})).unwrap();
+ app.ui.dialog = Some(Dialog::new("colorPicker", fields));
+ let ctx = dialog_context("en");
+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(700.0, 500.0));
+ for _ in 0..3 {
+ dialog_frame(&mut app, &ctx, screen, vec![]);
+ }
+ (app, ctx, screen, id)
+ }
+
+ /// The rightmost painted `text`: the picker's own field, right of egui's colour editor (which
+ /// has R/G/B fields of its own).
+ fn rightmost(labels: &[(String, egui::Rect, egui::Rect)], text: &str) -> egui::Pos2 {
+ labels
+ .iter()
+ .filter(|(t, _, _)| t.trim() == text)
+ .map(|(_, r, _)| r.center())
+ .max_by(|a, b| a.x.total_cmp(&b.x))
+ .unwrap_or_else(|| panic!("{text} is painted"))
+ }
+
+ /// Types `text` one character per frame, with an idle frame after each.
+ fn type_slowly(app: &mut DesignApp, ctx: &egui::Context, screen: egui::Rect, text: &str) {
+ for ch in text.chars() {
+ dialog_frame(app, ctx, screen, vec![egui::Event::Text(ch.into())]);
+ dialog_frame(app, ctx, screen, vec![]);
+ }
+ }
+
+ fn fill(app: &DesignApp, id: u64) -> designcraft_color::Color {
+ let d = &app.session.active().unwrap().doc;
+ d.resolve_color(&d.item(designcraft_doc::ItemId(id)).unwrap().fill.swatch, 1.0).unwrap()
+ }
+
+ #[test]
+ fn the_hex_field_keeps_typed_text_and_commits_a_valid_code() {
+ let (mut app, ctx, screen, _) = picker(json!({"target": "fill", "hex": "#ffffff"}));
+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "ffffff").center());
+ dialog_frame(&mut app, &ctx, screen, vec![select_all_key()]);
+ type_slowly(&mut app, &ctx, screen, "#f5");
+ let d = app.ui.dialog.as_ref().unwrap();
+ assert_eq!((d.s("hexEdit").as_str(), d.s("hex").as_str()), ("#f5", "#ffffff"), "half-typed text stays; the colour waits");
+ type_slowly(&mut app, &ctx, screen, "9019");
+ let d = app.ui.dialog.as_ref().unwrap();
+ assert_eq!((d.s("hexEdit").as_str(), d.s("hex").as_str()), ("#f59019", "#f59019"), "a 7-character #rrggbb commits");
+ // Invalid text is replaced by the colour when focus leaves.
+ dialog_frame(&mut app, &ctx, screen, vec![select_all_key()]);
+ type_slowly(&mut app, &ctx, screen, "zz");
+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "#").center());
+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
+ visible_label(&labels, screen, "f59019");
+ assert_eq!(app.ui.dialog.as_ref().unwrap().s("hex"), "#f59019");
+ }
+
+ #[test]
+ fn typed_channel_values_are_kept_while_typing() {
+ let (mut app, ctx, screen, id) = picker(json!({"target": "fill", "hex": "#010203", "model": "rgb", "rgb": [1, 2, 3]}));
+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
+ click_dialog(&mut app, &ctx, screen, rightmost(&labels, "1"));
+ dialog_frame(&mut app, &ctx, screen, vec![select_all_key()]);
+ type_slowly(&mut app, &ctx, screen, "12.5");
+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
+ assert!(rightmost(&labels, "12.5").x > rightmost(&labels, "2").x - 1.0, "the typed text stays in the R field");
+ assert_eq!(app.ui.dialog.as_ref().unwrap().s("hex"), "#0d0203");
+ confirm(&mut app).unwrap();
- let designcraft_color::Color::Rgb { r, .. } = fill(&app, id) else { panic!("not RGB") };
- assert!((r - 12.5 / 255.0).abs() < 1e-6, "{r}");
++ let designcraft_color::Color::Rgb { r, .. } = fill(&app, id) else { panic!("not RGB") };
++ assert!((r - 12.5 / 255.0).abs() < 1e-6, "{r}");
++ }
++
++ #[test]
++ fn a_cmyk_colour_stays_cmyk_unless_rgb_values_are_typed() {
++ let cmyk = json!({"target": "fill", "hex": "#ff8000", "model": "cmyk", "cmyk": [0, 50, 100, 0]});
++ // Picked by hex: converted to CMYK.
++ let (mut app, ctx, screen, id) = picker(cmyk.clone());
++ let hex = app.ui.dialog.as_ref().unwrap().s("hex");
++ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
++ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, hex.trim_start_matches('#')).center());
++ dialog_frame(&mut app, &ctx, screen, vec![select_all_key()]);
++ type_slowly(&mut app, &ctx, screen, "3366cc");
++ confirm(&mut app).unwrap();
++ assert!(matches!(fill(&app, id), designcraft_color::Color::Cmyk { .. }), "{:?}", fill(&app, id));
++ // A typed C/M/Y/K percent is a percent: M 1 is 1 %.
++ let (mut app, ctx, screen, id) = picker(cmyk.clone());
++ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
++ click_dialog(&mut app, &ctx, screen, rightmost(&labels, "50"));
++ dialog_frame(&mut app, &ctx, screen, vec![select_all_key()]);
++ type_slowly(&mut app, &ctx, screen, "1");
++ confirm(&mut app).unwrap();
++ let designcraft_color::Color::Cmyk { c, m, y, k } = fill(&app, id) else { panic!("not CMYK") };
++ assert!(c == 0.0 && (m - 0.01).abs() < 1e-6 && (y - 1.0).abs() < 1e-6 && k == 0.0, "{c} {m} {y} {k}");
++ // Typed R/G/B values: RGB.
++ let (mut app, ctx, screen, id) = picker(cmyk);
++ let r = app.ui.dialog.as_ref().unwrap().fields["rgb"][0].as_f64().unwrap();
++ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
++ click_dialog(&mut app, &ctx, screen, rightmost(&labels, &r.to_string()));
++ dialog_frame(&mut app, &ctx, screen, vec![select_all_key()]);
++ type_slowly(&mut app, &ctx, screen, "10");
++ confirm(&mut app).unwrap();
++ assert!(matches!(fill(&app, id), designcraft_color::Color::Rgb { .. }), "{:?}", fill(&app, id));
++ }
++
++ #[test]
++ fn ok_without_edits_leaves_the_fill_alone() {
++ let (mut app, _, _, id) = picker(json!({"target": "fill", "hex": "#ff8000", "model": "cmyk", "cmyk": [0, 50, 100, 0]}));
++ let before = app.session.active().unwrap().doc.item(designcraft_doc::ItemId(id)).unwrap().fill.clone();
++ confirm(&mut app).unwrap();
++ assert_eq!(app.session.active().unwrap().doc.item(designcraft_doc::ItemId(id)).unwrap().fill, before);
++ }
++
++ #[test]
++ fn dialogs_do_not_dim_the_page() {
++ let (mut app, ctx, screen, _) = picker(json!({"target": "fill", "hex": "#ff8000"}));
++ let time = ctx.input(|i| i.time) + 1.0 / 60.0;
++ let output = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), time: Some(time), ..Default::default() }, |ui| show(&mut app, ui.ctx()));
++ fn covers(shape: &egui::Shape, screen: egui::Rect) -> bool {
++ match shape {
++ egui::Shape::Rect(r) => r.rect.contains_rect(screen) && r.fill.a() > 0,
++ egui::Shape::Vec(v) => v.iter().any(|s| covers(s, screen)),
++ _ => false,
++ }
++ }
++ assert!(app.ui.dialog.is_some());
++ assert!(!output.shapes.iter().any(|s| covers(&s.shape, screen)), "nothing paints over the whole window");
++ }
++
+ fn draw(app: &mut DesignApp, ctx: &egui::Context) {
+ let input =
+ egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 900.0))), ..Default::default() };
+ let mut out = ctx.run_ui(input, |ui| {
+ app.logic(&ui.ctx().clone());
+ app.ui(ui);
+ });
+ out.textures_delta.clear();
+ }
+
+ /// A paragraph styled "Ruled Child", whose Rule Below comes from its parent "Ruled".
+ fn ruled_paragraph() -> (DesignApp, Value) {
+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());
+ app.run("file.new", json!({})).unwrap();
+ let rule = json!({"on": true, "weight": 3.0, "color": "[Black]", "tint": 0.5, "columnWidth": false, "offset": 4.0, "leftIndent": 6.0, "rightIndent": 2.0});
+ app.run("style.paragraph.create", json!({"name": "Ruled", "para": {"ruleBelow": rule}})).unwrap();
+ app.run("style.paragraph.create", json!({"name": "Ruled Child", "basedOn": "Ruled"})).unwrap();
+ let r = app.run("frame.create", json!({"rect": [72, 72, 300, 400], "content": "text", "text": "One"})).unwrap();
+ app.run("text.select", json!({"story": r["story"], "anchor": 0, "focus": 0})).unwrap();
+ app.run("style.paragraph.apply", json!({"name": "Ruled Child"})).unwrap();
+ (app, rule)
+ }
+
+ fn undo_steps(app: &DesignApp) -> usize {
+ app.session.doc().map_or(0, |st| st.history.undo.len())
+ }
+
+ #[test]
+ fn paragraph_rules_dialog_shows_the_rule_and_applies_one_field() {
+ let (mut app, rule) = ruled_paragraph();
+ let ctx = egui::Context::default();
+ app.run("app.paragraphRulesDialog", json!({"rule": "ruleBelow"})).unwrap();
+ draw(&mut app, &ctx);
+ let d = app.ui.dialog.clone().unwrap();
+ assert_eq!(d.id, "paragraphRules");
+ let current = d.fields["current"].clone();
+ assert_eq!(shown_rule(&d, "", "ruleBelow", &current), rule, "the inherited rule");
+ assert_eq!(shown_rule(&d, "", "ruleAbove", &current)["on"], false);
+ // Pick a colour, as the Color menu does.
+ app.ui.dialog.as_mut().unwrap().fields.insert("ruleBelow.color".into(), json!("[Registration]"));
+ draw(&mut app, &ctx);
+ let before = undo_steps(&app);
+ confirm(&mut app).unwrap();
+ assert_eq!(undo_steps(&app), before + 1, "one undo step");
+ let mut want = rule.clone();
+ want["color"] = json!("[Registration]");
+ assert_eq!(app.run("type.selectionAttrs", json!({})).unwrap()["para"]["ruleBelow"], want);
+ app.run("edit.undo", json!({})).unwrap();
+ assert_eq!(app.run("type.selectionAttrs", json!({})).unwrap()["para"]["ruleBelow"], rule);
+ }
+
+ #[test]
+ fn paragraph_style_options_edit_one_rule_field() {
+ let (mut app, rule) = ruled_paragraph();
+ let ctx = egui::Context::default();
+ app.ui.dialog = Some(Dialog::new("paragraphStyleOptions", json!({"name": "Ruled Child", "section": "rules", "rule": "ruleBelow"})));
+ draw(&mut app, &ctx);
+ let resolved = |app: &DesignApp| serde_json::to_value(app.session.doc().unwrap().doc.styles.resolve_para_style("Ruled Child").0).unwrap();
+ let d = app.ui.dialog.clone().unwrap();
+ assert_eq!(shown_rule(&d, "p.", "ruleBelow", &resolved(&app)), rule, "inherited from the parent style");
+ app.ui.dialog.as_mut().unwrap().fields.insert("p.ruleBelow.weight".into(), json!(1.5));
+ draw(&mut app, &ctx);
+ let before = undo_steps(&app);
+ confirm(&mut app).unwrap();
+ assert_eq!(undo_steps(&app), before + 1, "one undo step");
+ let mut want = rule.clone();
+ want["weight"] = json!(1.5);
+ assert_eq!(resolved(&app)["ruleBelow"], want);
+ assert_eq!(app.run("type.selectionAttrs", json!({})).unwrap()["para"]["ruleBelow"], want, "the paragraph follows its style");
+ app.run("edit.undo", json!({})).unwrap();
+ assert_eq!(resolved(&app)["ruleBelow"], rule);
+ }
+
+ /// Opens Paragraph Style Options on "Ruled Child" at each of `sections`, sets `fields` and
+ /// clicks OK; returns the resolved attributes of the paragraph styled with it.
+ fn style_section_edit(sections: &[&str], fields: Value) -> Value {
+ let (mut app, _) = ruled_paragraph();
+ let ctx = egui::Context::default();
+ app.ui.dialog = Some(Dialog::new("paragraphStyleOptions", json!({"name": "Ruled Child"})));
+ for section in sections {
+ app.ui.dialog.as_mut().unwrap().fields.insert("section".into(), json!(section));
+ draw(&mut app, &ctx);
+ }
+ for (k, v) in fields.as_object().unwrap() {
+ app.ui.dialog.as_mut().unwrap().fields.insert(k.clone(), v.clone());
+ }
+ draw(&mut app, &ctx);
+ let before = undo_steps(&app);
+ confirm(&mut app).unwrap();
+ assert_eq!(undo_steps(&app), before + 1, "one undo step");
+ let style = app.session.doc().unwrap().doc.styles.para("Ruled Child").cloned().unwrap();
+ let own = serde_json::to_value(&style.para).unwrap();
+ for (k, v) in fields.as_object().unwrap() {
+ assert_eq!(own[k.trim_start_matches("p.")], *v, "the style sets {k}");
+ }
+ app.run("type.selectionAttrs", json!({})).unwrap()["para"].clone()
+ }
+
+ #[test]
+ fn paragraph_style_options_keep_and_border_sections_reach_the_styled_paragraph() {
+ let para = style_section_edit(
+ &["keep", "border"],
+ json!({"p.keepWithNext": 2, "p.keepLinesTogether": true, "p.keepAllLines": false, "p.keepFirst": 3,
+ "p.startParagraph": "nextPage", "p.borderOn": true, "p.borderWeights": [2.0, 0.0, 2.0, 0.0]}),
+ );
+ assert_eq!(para["keepWithNext"], 2);
+ assert_eq!(para["keepLinesTogether"], true);
+ assert_eq!(para["keepAllLines"], false);
+ assert_eq!(para["keepFirst"], 3);
+ assert_eq!(para["startParagraph"], "nextPage");
+ assert_eq!(para["borderOn"], true);
+ assert_eq!(para["borderWeights"], json!([2.0, 0.0, 2.0, 0.0]));
+ // Fields not edited keep the resolved value.
+ assert_eq!(para["keepLast"], 2);
+ assert_eq!(para["ruleBelow"]["weight"], 3.0);
+ }
+
+ #[test]
+ fn paragraph_style_options_bullets_and_span_sections_reach_the_styled_paragraph() {
+ let para = style_section_edit(
+ &["bullets", "span"],
+ json!({"p.listType": "numbers", "p.numberStyle": "upperRoman", "p.numberExpression": "^#)^t", "p.startAt": 3,
+ "p.spanColumns": {"kind": "split", "columns": 3}}),
+ );
+ assert_eq!(para["listType"], "numbers");
+ assert_eq!(para["numberStyle"], "upperRoman");
+ assert_eq!(para["numberExpression"], "^#)^t");
+ assert_eq!(para["startAt"], 3);
+ assert_eq!(para["spanColumns"], json!({"kind": "split", "columns": 3}));
+ let props: designcraft_doc::ParaProps = serde_json::from_value(para).unwrap();
+ assert_eq!(props.number_label(3), "III)\t");
+ }
+
+ #[test]
+ fn paragraph_style_options_keep_a_bad_grep_pattern_open_with_the_error() {
+ let (mut app, _) = ruled_paragraph();
+ let ctx = egui::Context::default();
+ app.ui.dialog = Some(Dialog::new("paragraphStyleOptions", json!({"name": "Ruled", "section": "general"})));
+ draw(&mut app, &ctx);
+ app.ui.dialog.as_mut().unwrap().fields.insert("p.grepStyles".into(), json!([{"style": "[None]", "pattern": "(?<=x"}]));
+ let e = confirm(&mut app).unwrap_err();
+ assert!(e.contains("bad GREP"), "{e}");
+ let d = app.ui.dialog.clone().expect("the dialog stays open");
+ assert_eq!((d.s("section").as_str(), d.s("status").contains("bad GREP")), ("grep", true));
+ assert!(app.session.doc().unwrap().doc.styles.para("Ruled").unwrap().para.grep_styles.is_none(), "nothing saved");
+ draw(&mut app, &ctx);
+ }
+
+ /// A frame with two paragraphs of [Basic Paragraph]; the first has a local Word Spacing minimum.
+ fn two_paragraphs() -> (DesignApp, Value) {
+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());
+ app.run("file.new", json!({})).unwrap();
+ let r = app.run("frame.create", json!({"rect": [72, 72, 300, 400], "content": "text", "text": "One\nTwo"})).unwrap();
+ app.run("text.select", json!({"story": r["story"], "anchor": 0, "focus": 0})).unwrap();
+ app.run("type.para", json!({"attrs": {"wordSpaceMin": 0.7}})).unwrap();
+ (app, r["story"].clone())
+ }
+
+ /// The resolved paragraph attribute `key` of the paragraph at byte `at`.
+ fn para_attr(app: &mut DesignApp, story: &Value, at: usize, key: &str) -> Value {
+ app.run("text.select", json!({"story": story, "anchor": at, "focus": at})).unwrap();
+ app.run("type.selectionAttrs", json!({})).unwrap()["para"][key].clone()
+ }
+
+ #[test]
+ fn justification_dialog_applies_to_a_local_paragraph_and_cancel_changes_nothing() {
+ let (mut app, story) = two_paragraphs();
+ let ctx = egui::Context::default();
+ assert!(crate::menus::menu_enabled(&app, "app.justificationDialog"));
+ app.run("app.justificationDialog", json!({})).unwrap();
+ draw(&mut app, &ctx);
+ let d = app.ui.dialog.clone().unwrap();
+ assert_eq!(d.id, "justification");
+ assert_eq!(d.fields["current"]["wordSpaceMin"], 0.7);
+ assert_eq!(d.fields["current"]["wordSpaceDesired"], 1.0);
+ app.ui.dialog.as_mut().unwrap().fields.insert("wordSpaceDesired".into(), json!(1.1));
+ draw(&mut app, &ctx);
+ let before = undo_steps(&app);
+ confirm(&mut app).unwrap();
+ assert_eq!(undo_steps(&app), before + 1, "one undo step");
+ assert_eq!(para_attr(&mut app, &story, 0, "wordSpaceDesired"), 1.1);
+ assert_eq!(para_attr(&mut app, &story, 0, "wordSpaceMin"), 0.7, "unedited fields stay");
+ assert_eq!(para_attr(&mut app, &story, 4, "wordSpaceDesired"), 1.0, "only the selected paragraph");
+ let style = app.session.doc().unwrap().doc.styles.resolve_para_style(designcraft_doc::story::BASIC_PARAGRAPH).0.word_space_desired;
+ assert_eq!(style, 1.0, "the paragraph style keeps its value");
+
+ // Cancel (Escape) leaves the paragraph alone.
+ app.run("text.select", json!({"story": story, "anchor": 0, "focus": 0})).unwrap();
+ app.run("app.justificationDialog", json!({})).unwrap();
+ app.ui.dialog.as_mut().unwrap().fields.insert("wordSpaceDesired".into(), json!(1.2));
+ let before = undo_steps(&app);
+ let escape = egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() };
+ let input = egui::RawInput {
+ screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 900.0))),
+ events: vec![escape],
+ ..Default::default()
+ };
+ let mut out = ctx.run_ui(input, |ui| {
+ app.logic(&ui.ctx().clone());
+ app.ui(ui);
+ });
+ out.textures_delta.clear();
+ assert!(app.ui.dialog.is_none(), "cancelled");
+ assert_eq!(undo_steps(&app), before);
+ assert_eq!(para_attr(&mut app, &story, 0, "wordSpaceDesired"), 1.1);
+
+ app.run("edit.deselectAll", json!({})).unwrap();
+ assert!(!crate::menus::menu_enabled(&app, "app.justificationDialog"), "nothing to justify");
+ assert!(app.run("app.justificationDialog", json!({})).is_err());
+ }
+
+ #[test]
+ fn justification_dialog_leaves_mixed_fields_alone_and_refuses_bad_values() {
+ let (mut app, story) = two_paragraphs();
+ let ctx = egui::Context::default();
+ app.run("text.select", json!({"story": story, "anchor": 0, "focus": 7})).unwrap();
+ app.run("app.justificationDialog", json!({})).unwrap();
+ draw(&mut app, &ctx);
+ let d = app.ui.dialog.clone().unwrap();
+ assert_eq!(d.fields["current"]["wordSpaceMin"], Value::Null, "mixed shows empty");
+ assert_eq!(d.fields["current"]["wordSpaceMax"], 1.33);
+
+ // Out of range, and minimum above desired: an error, the dialog stays open, nothing changes.
+ let before = undo_steps(&app);
+ for (key, v) in [("wordSpaceMax", 20.0), ("glyphScaleMin", 0.2), ("letterSpaceDesired", f64::NAN)] {
+ app.ui.dialog = Some(d.clone());
+ app.ui.dialog.as_mut().unwrap().fields.insert(key.into(), json!(v));
+ assert!(confirm(&mut app).is_err(), "{key} = {v}");
+ assert!(app.ui.dialog.as_ref().is_some_and(|d| d.fields.contains_key("justifyError")), "{key}: the dialog shows why");
+ }
+ app.ui.dialog = Some(d.clone());
+ app.ui.dialog.as_mut().unwrap().fields.insert("letterSpaceMin".into(), json!(0.1));
+ assert!(confirm(&mut app).is_err(), "letter spacing minimum above desired");
+ draw(&mut app, &ctx);
+ assert_eq!(undo_steps(&app), before);
+
+ app.ui.dialog = Some(d);
+ app.ui.dialog.as_mut().unwrap().fields.insert("wordSpaceMax".into(), json!(1.5));
+ confirm(&mut app).unwrap();
+ assert_eq!(undo_steps(&app), before + 1);
+ for (at, min) in [(0, 0.7), (4, 0.8)] {
+ assert_eq!(para_attr(&mut app, &story, at, "wordSpaceMax"), 1.5);
+ assert_eq!(para_attr(&mut app, &story, at, "wordSpaceMin"), min, "each paragraph keeps its own minimum");
+ }
+ }
+
+ fn command_app(id: &str, fields: Value) -> DesignApp {
+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());
+ app.ui.dialog = Some(Dialog::new(&format!("cmd:{id}"), fields));
+ app
+ }
+
+ #[test]
+ fn generic_new_document_preserves_typed_values_and_text_entry() {
+ for pages in [json!(2), json!(" 2 ")] {
+ let mut app = command_app(
+ "file.new",
+ json!({
+ "preset": "A4", "pages": pages, "facingPages": false, "gutter": 0,
+ "margins": {"top": 10, "bottom": 20, "inside": 30, "outside": 40},
+ "title": " ", "status": "internal", "primaryTextFrame": true
+ }),
+ );
+ confirm(&mut app).unwrap();
+ let doc = &app.session.active().unwrap().doc;
+ assert_eq!(doc.page_count(), 2);
+ assert!(!doc.settings.facing_pages);
+ assert!(doc.title.starts_with("Untitled-"));
+ for page in doc.spreads.iter().flat_map(|s| &s.pages) {
+ assert!((page.width - 595.2755905511812).abs() < 0.01);
+ assert!((page.height - 841.8897637795277).abs() < 0.01);
+ assert_eq!(page.columns.gutter, 0.0);
+ assert_eq!(page.margins.top, 10.0);
+ assert_eq!(page.margins.outside, 40.0);
+ }
+ assert!(doc.spreads.iter().all(|s| s.items.is_empty()), "undocumented fields stay excluded");
+ assert!(app.ui.dialog.is_none());
+ }
+ }
+
+ #[test]
+ fn numbering_commands_document_their_fields() {
+ let names = |id: &str| command_fields(designcraft_engine::find_command(id).unwrap().params).into_iter().map(|f| f.key).collect::<Vec<_>>();
+ assert_eq!(names("layout.section"), ["page", "startNumber", "style", "prefix", "includePrefix", "marker", "remove"]);
+ assert_eq!(names("layout.chapterNumbering"), ["style", "start", "source"]);
+ }
+
+ #[test]
+ fn generic_command_preserves_array_geometry() {
+ let mut app = command_app("file.new", json!({}));
+ confirm(&mut app).unwrap();
+ app.ui.dialog = Some(Dialog::new("cmd:frame.create", json!({"rect": [10, 20, 110, 220]})));
+ confirm(&mut app).unwrap();
+ let doc = &app.session.active().unwrap().doc;
+ let item = doc.spreads.iter().flat_map(|s| &s.items).next().unwrap();
+ assert_eq!(item.bounds(), designcraft_geom::Rect::new(10.0, 20.0, 110.0, 220.0));
}
#[test]
diff --cc crates/ui-egui/src/panels/swatches.rs
index eb8f3ae83,79e49d925..0592e75e1
--- a/crates/ui-egui/src/panels/swatches.rs
+++ b/crates/ui-egui/src/panels/swatches.rs
@@@ -259,11 -231,7 +259,9 @@@ pub fn color_panel(app: &mut DesignApp
stroke = k;
}
if resp.double_clicked() {
- let rgb = doc.resolve_color(n, 1.0).map(|c| c.to_rgb()).unwrap_or([0.0; 3]);
- let hex =
- format!("#{:02x}{:02x}{:02x}", (rgb[0] * 255.0).round() as u8, (rgb[1] * 255.0).round() as u8, (rgb[2] * 255.0).round() as u8);
- app.ui.dialog =
- Some(crate::dialogs::Dialog::new("colorPicker", json!({"target": if k { "stroke" } else { "fill" }, "hex": hex, "text": text})));
- app.ui.dialog = Some(crate::dialogs::Dialog::new("colorPicker", picker_fields(doc.resolve_color(n, 1.0), k)));
++ let mut fields = picker_fields(doc.resolve_color(n, 1.0), k);
++ fields["text"] = json!(text);
++ app.ui.dialog = Some(crate::dialogs::Dialog::new("colorPicker", fields));
}
}
ui.label(egui::RichText::new(&name).size(11.0).color(t.text_dim));
@@@ -412,11 -410,8 +437,9 @@@ fn spectrum(app: &mut DesignApp, ui: &m
&& let Some(p) = resp.interact_pointer_pos()
{
let c = at(((p.x - r.min.x) / r.width()).clamp(0.0, 1.0), ((p.y - r.min.y) / r.height()).clamp(0.0, 1.0));
+ let text = super::colors_affect_text(app);
- let _ = app.run(
- "object.color",
- json!({"color": [(c[0] * 255.0).round(), (c[1] * 255.0).round(), (c[2] * 255.0).round()], "target": target, "text": text}),
- );
+ let q = |v: f32| (v * 255.0).round() / 255.0;
- let _ = app.run("object.color", json!({"color": {"model": "rgb", "r": q(c[0]), "g": q(c[1]), "b": q(c[2])}, "target": target}));
++ let _ = app.run("object.color", json!({"color": {"model": "rgb", "r": q(c[0]), "g": q(c[1]), "b": q(c[2])}, "target": target, "text": text}));
}
}
diff --cc docs/target-app-parity.md
index 7241c709d,7a4394dfc..2adb84906
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@@ -293,11 -293,9 +293,11 @@@ It is evidence of breadth: each item ex
- Crash recovery: unsaved documents are written every 30 s into a locked folder owned by that running app and reopened (unsaved, remembering their files) after a crash. Startup takes entries from ended runs and leaves live runs alone; writes and cleanup validate current folder and lock ownership. Failed isolation disables recovery with a warning. Recovered checkpoints remain available through another crash before autosave; restarting IDs and explicit recovery from another folder preserve unopened snapshots. Successful Save, Close or Revert clears the document's checkpoints, including manual recovery while autosave is disabled; failed republishing keeps the original. Concurrent older versions still use unlocked root entries; mixed-version isolation remains open. File › Revert and Save a Copy…; `file.recovery.*`, `file.revert`, `file.saveACopy`.
- Window close, application/menu Quit and macOS Dock Quit ask about every unsaved document. Cancel or a cancelled/failed save keeps all tabs open; Don't Save approvals discard nothing until the complete plan is current. Later edits and new documents are checked before closing. Repeated native requests preserve an active dialog and partial approvals. Control-channel quit remains immediate.
- Graphics backend chosen before the window exists (DirectX 12 on Windows, Vulkan on Linux, Metal on macOS, OpenGL as the fallback; `WGPU_BACKEND` overrides) with a start-up fallback: a backend whose start never showed a frame is skipped at the next start and the status bar says so (`gpu.json`). Found on an AMD hybrid-graphics laptop whose Vulkan driver faulted at the first present.
+- Graphics adapter chosen by the app: the GPU that drives the primary display (Windows `EnumDisplayDevices`, Linux sysfs), then the power preference (`WGPU_POWER_PREF`, `WGPU_ADAPTER_NAME` override). An adapter that fails or hangs while the window starts is left out and the app starts again on the next one, then on the next backend, with software renderers last; wgpu's indirect-call check is off (it lost the Metal device on an Intel Mac, #334); why the app stopped is logged, also when the window never opened (#273). Ported from VectorCraft.
- Edit › Paste Into (copied objects become a frame's content, clipped by it; rendered, PDF and IDML both ways — verified in InDesign 2026); Polygon Settings (sides, star inset; double-click the Polygon tool).
- - Color panel (fill/stroke proxy, CMYK/RGB/Lab sliders with channel ramps, tint slider for swatches, spectrum ramp, Add to Swatches) and Color Picker (double-click the proxy); mixed colours are unnamed (not listed in Swatches until added); `object.color`, `swatch.addToSwatches`, `swatch.addUnnamed`.
+ - Color panel (fill/stroke proxy, CMYK/RGB/Lab sliders with channel ramps, tint slider for swatches, spectrum ramp, Add to Swatches) and Color Picker (double-click the proxy; R/G/B, C/M/Y/K and hex fields; a CMYK colour stays CMYK unless R/G/B values are typed); mixed colours are unnamed (not listed in Swatches until added); `object.color`, `swatch.addToSwatches`, `swatch.addUnnamed`.
-- Place text files: Word (.docx: styles by name with their attributes, bold/italic/underline/size/font, footnotes, tables, tabs, breaks), RTF and plain text, into the insertion point, the selected frame or a new frame; autoflow adds pages and threaded frames until the text fits; Remove Styles option (`designcraft-textimport`).
+- Threading: click a selected text frame's in or out port (overset or not) to load the text cursor, then click a frame to thread it (stories merge), click empty space for a column-wide frame down to the bottom margin, or drag a frame; Shift-click autoflows, Alt-click stays loaded; click the linked frame or double-click a port to break the thread; Esc unloads. Link and unthread cursors show where a click threads or unthreads. `text.thread`, `text.unthread`, `text.removeFromThread`.
+- Place text files: Word (.docx: styles by name with their attributes, bold/italic/underline/size/font, footnotes, tables, tabs, breaks), RTF and plain text, into the insertion point, the selected frame or a new frame; autoflow threads one frame per page column and adds pages until the text fits; Remove Styles option (`designcraft-textimport`).
- Gradient Feather (⇧G tool, `object.gradientFeather`): objects fade along a linear or radial opacity gradient, on screen and as a soft mask in PDF.
- Script Label (`object.label`, `object.findByLabel`), alt text (`object.altText`), Isolate Blending / Knockout Group (`object.transparencyGroup`; on screen, PDF isolates), Table ▸ Sort (`table.sortRows`, numeric-aware, header/footer fixed).
- File ▸ Export Text (`file.exportText`): a story as Text Only or RTF (fonts, styles, alignment, indents, tables as tab-separated rows); Export EPUB now asks for a path in the UI.