Skip to content

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

V: Overprint Preview

Brandon Thomasb10a06f7b8ee
diff --git a/ROADMAP.md b/ROADMAP.md
index d1aa667f6..0778ca82b 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -30,6 +30,7 @@ DesignCraft aims at full Adobe InDesign parity — and to be better: faster, ope
- 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`.
- 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`).
+- View › Overprint Preview (⌥⇧⌘Y): overprinting fills, strokes and 100% [Black] text mix with what's beneath on screen.
- Type on a Path (⇧T tool, `type.onPath`): a story along any line, curve or shape on screen and in PDF; Type on a Path Options (start, flip, baseline/ascender/descender/centre) and Delete Type from Path. On-path caret drawing and IDML TextPath are still to come.
- Preferences › Appearance of Black: 100% K on screen accurately (dark grey) or as rich black (`window.richBlack`); the printing/export side is still to come.
- Spreads of up to 10 pages: Add to Previous Spread and Allow Spread to Shuffle (Pages panel; `layout.pages.toSpread`, `layout.spreadShuffle`); inserted pages go around kept spreads.
diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs
index d87dde655..643b5f672 100644
--- a/crates/render/src/lib.rs
+++ b/crates/render/src/lib.rs
@@ -105,6 +105,8 @@ pub struct RenderOptions {
/// Preferences › Appearance of Black: show 100% K as rich (pure) black instead of the
/// accurate dark grey.
pub rich_black: bool,
+ /// View › Overprint Preview: overprinting inks mix with what's beneath.
+ pub overprint_preview: bool,
}
/// View › Display Performance: how placed graphics and effects are drawn on screen.
@@ -132,6 +134,7 @@ impl Default for RenderOptions {
highlight_missing_fonts: false,
quality: DisplayQuality::High,
rich_black: false,
+ overprint_preview: false,
}
}
}
@@ -453,10 +456,17 @@ impl Renderer {
// Fill.
if !it.fill.is_none() {
ctx.set_transform(f.view * xf);
+ let op = overprints(f, &it.fill.swatch, it.fill.tint, it.fill.overprint);
+ if op {
+ ctx.push_layer(None, Some(BlendMode::new(Mix::Multiply, Compose::SrcOver)), None, None, None);
+ }
if set_fill_paint(ctx, doc, &it.fill, bp.bounding_box()) && it.path.is_closed() {
ctx.fill_path(bp);
}
ctx.reset_paint_transform();
+ if op {
+ ctx.pop_layer();
+ }
}
// Content.
match &it.content {
@@ -479,7 +489,15 @@ impl Renderer {
}
// Stroke.
if !it.stroke.is_none() {
+ let op = overprints(f, &it.stroke.swatch, it.stroke.tint, it.stroke.overprint);
+ if op {
+ ctx.set_transform(f.view * xf);
+ ctx.push_layer(None, Some(BlendMode::new(Mix::Multiply, Compose::SrcOver)), None, None, None);
+ }
self.draw_stroke(ctx, f, it, bp, xf);
+ if op {
+ ctx.pop_layer();
+ }
}
}
@@ -647,6 +665,12 @@ fn set_fill_paint(ctx: &mut RenderContext, doc: &Document, fill: &designcraft_do
}
}
+/// Overprint Preview: does this paint overprint (its own flag, or 100% [Black], which
+/// overprints by default)? It's then multiplied over what's beneath.
+pub(crate) fn overprints(f: &Frame, swatch: &str, tint: f32, flag: bool) -> bool {
+ f.opts.overprint_preview && (flag || (swatch == designcraft_color::swatch::BLACK && tint >= 0.999))
+}
+
pub fn blend_mode(b: DcBlend) -> BlendMode {
use DcBlend as B;
let mix = match b {
@@ -854,6 +878,29 @@ mod tests {
assert!(gap[0] < 80 && gap[2] > 150, "gap {gap:?}");
}
+ #[test]
+ fn overprint_preview_mixes_inks() {
+ let mut d = Document::new(&NewDocument::default());
+ let lid = d.default_layer();
+ for (sw, op) in [("C=0 M=0 Y=100 K=0", false), ("C=0 M=100 Y=0 K=0", true)] {
+ let id = designcraft_doc::ItemId(d.alloc());
+ let mut it =
+ Item::new(id, lid, designcraft_doc::Shape::Rectangle, designcraft_geom::shapes::rectangle(Rect::new(100.0, 100.0, 200.0, 200.0)));
+ it.fill = Fill { overprint: op, ..Fill::swatch(sw) };
+ d.insert_item(SpreadRef::Doc(0), it, None).unwrap();
+ }
+ let cache = Cache::new();
+ let mut r = Renderer::new();
+ r.threads = 0;
+ let px = |on: bool, r: &mut Renderer| {
+ r.render_page(&d, &cache, 0, 1.0, false, &RenderOptions { overprint_preview: on, ..Default::default() }).unwrap().pixel(150, 150)
+ };
+ let off = px(false, &mut r);
+ let on = px(true, &mut r);
+ assert!(off[2] > 100, "magenta knocks out: {off:?}");
+ assert!(on[2] < 60 && on[0] > 180, "magenta over yellow → red: {on:?}");
+ }
+
#[test]
fn appearance_of_black_on_screen() {
let mut d = Document::new(&NewDocument::default());
diff --git a/crates/render/src/text.rs b/crates/render/src/text.rs
index 8247e74d7..ade4201a4 100644
--- a/crates/render/src/text.rs
+++ b/crates/render/src/text.rs
@@ -245,8 +245,22 @@ impl Renderer {
self.stats.glyphs += lg.glyphs;
for (si, bp) in &lg.runs {
if let Some(c) = fill_of(*si) {
+ let st = &cs.styles[*si as usize];
+ let op = crate::overprints(f, &st.fill, st.fill_tint, false);
+ if op {
+ ctx.push_layer(
+ None,
+ Some(vello_cpu::peniko::BlendMode::new(vello_cpu::peniko::Mix::Multiply, vello_cpu::peniko::Compose::SrcOver)),
+ None,
+ None,
+ None,
+ );
+ }
ctx.set_paint(c);
ctx.fill_path(bp);
+ if op {
+ ctx.pop_layer();
+ }
}
let st = &cs.styles[*si as usize];
if st.stroke != designcraft_color::swatch::NONE
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index 42d68e8e8..b38f01153 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -313,6 +313,7 @@ fn render_texture(app: &mut DesignApp, ctx: &egui::Context, rect: Rect, xf: &Xf,
highlight_missing_fonts: !preview,
quality: app.ui.display_quality,
rich_black: app.ui.rich_black,
+ overprint_preview: app.ui.overprint_preview,
..Default::default()
};
(st.doc.clone(), placed, w, h, view, opts)
@@ -417,6 +418,7 @@ fn patch_texture(app: &mut DesignApp, layout: &CanvasLayout, ppp: f64, doc_key:
highlight_missing_fonts: !preview,
quality: app.ui.display_quality,
rich_black: app.ui.rich_black,
+ overprint_preview: app.ui.overprint_preview,
..Default::default()
};
let img = app.canvas.patcher.render(&new, &app.session.cache, &placed, (x1 - x0) as u32, (y1 - y0) as u32, view, &opts);
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 222c20273..f2ced0979 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -89,6 +89,8 @@ pub struct UiState {
pub ui_scale: f32,
/// Preferences › Appearance of Black: 100% K on screen as rich black.
pub rich_black: bool,
+ /// View › Overprint Preview.
+ pub overprint_preview: bool,
/// Edit › Keyboard Shortcuts: command id → shortcut ("" = none), over the defaults.
pub shortcuts: std::collections::BTreeMap<String, String>,
pub control_bar: bool,
@@ -141,6 +143,7 @@ impl Default for UiState {
display_quality: designcraft_render::DisplayQuality::High,
ui_scale: 1.0,
rich_black: false,
+ overprint_preview: false,
shortcuts: Default::default(),
control_bar: false,
tools_double_column: false,
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index 6ec88d304..45f10eee1 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -50,6 +50,7 @@ pub const UI_COMMANDS: &[(&str, &str, Option<&str>, &str)] = &[
("view.baselineGrid", "Show/Hide Baseline Grid", Some("Cmd+Alt+'"), "{}"),
("view.textThreads", "Show/Hide Text Threads", Some("Cmd+Alt+Y"), "{}"),
("view.hiddenCharacters", "Show/Hide Hidden Characters", Some("Cmd+Alt+I"), "{}"),
+ ("view.overprintPreview", "Overprint Preview", Some("Cmd+Alt+Shift+Y"), "{} — show how overprinting inks mix"),
("view.fastDisplay", "Fast Display", Some("Cmd+Alt+Shift+Z"), "{} — placed graphics as grey boxes, no effects"),
("view.typicalDisplay", "Typical Display", Some("Cmd+Alt+Z"), "{} — low-resolution image proxies"),
("view.highQualityDisplay", "High Quality Display", Some("Cmd+Alt+H"), "{} — full-resolution images"),
@@ -390,6 +391,7 @@ pub const MENUS: &[(&str, &[&str])] = &[
"ui:view.actualSize",
"ui:view.entirePasteboard",
"-",
+ "ui:view.overprintPreview",
"ui:view.togglePreview",
">Display Performance",
"ui:view.fastDisplay",
@@ -685,6 +687,10 @@ pub fn run_ui(app: &mut DesignApp, id: &str, p: &Value) -> Option<Result<Value,
Ok(Value::Null)
}
"view.frameEdges" => flag(&mut app.ui.frame_edges),
+ "view.overprintPreview" => {
+ app.canvas.shown = None;
+ flag(&mut app.ui.overprint_preview)
+ }
"view.fastDisplay" | "view.typicalDisplay" | "view.highQualityDisplay" => {
use designcraft_render::DisplayQuality as Q;
app.ui.display_quality = match id {
@@ -1069,6 +1075,7 @@ pub fn checked(app: &DesignApp, id: &str, params: &Value) -> Option<bool> {
Some(match id {
"view.rulers" => app.ui.rulers,
"view.frameEdges" => app.ui.frame_edges,
+ "view.overprintPreview" => app.ui.overprint_preview,
"view.fastDisplay" => app.ui.display_quality == designcraft_render::DisplayQuality::Fast,
"view.typicalDisplay" => app.ui.display_quality == designcraft_render::DisplayQuality::Typical,
"view.highQualityDisplay" => app.ui.display_quality == designcraft_render::DisplayQuality::High,
diff --git a/docs/parity.md b/docs/parity.md
index 8742c2883..bbfa06cb1 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -5,12 +5,12 @@ The summary is generated by `cargo xtask parity` from the table at the bottom of
Each row of the InDesign feature catalogue is scored **D** (done), **P** (partial: works but lacks options or UI) or **M** (missing), weighted by priority (**P0** core = 3, **P1** = 2, **P2** = 1). Out-of-scope rows (Adobe cloud services, plug-ins, Typekit, Flash) are excluded.
<!-- SUMMARY -->
-**Weighted breadth parity: 80%** over 275 features.
+**Weighted breadth parity: 81%** over 275 features.
| Priority | Features | Done | Partial | Missing | Parity |
|---|---|---|---|---|---|
| P0 | 102 | 99 | 3 | 0 | 99% |
-| P1 | 97 | 61 | 26 | 10 | 76% |
+| P1 | 97 | 63 | 26 | 8 | 78% |
| P2 | 76 | 8 | 7 | 61 | 15% |
| Area | Parity |
@@ -20,7 +20,7 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia
| Layers | 95% |
| Frames, shapes & paths | 87% |
| Transform | 93% |
-| Fill, stroke, colour | 76% |
+| Fill, stroke, colour | 81% |
| Effects & transparency | 50% |
| Placing & links | 78% |
| Type & text frames | 85% |
@@ -31,7 +31,7 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia
| Interactivity & digital | 30% |
| Output & production | 68% |
| XML & automation | 39% |
-| View & navigation | 75% |
+| View & navigation | 82% |
| Undo, history, saving | 100% |
| Accessibility | 20% |
@@ -154,7 +154,7 @@ Open P0 items: Preferences, Vector/page formats (PDF/AI/SVG/EPS place), Export t
| Fill, stroke, colour | Stroke panel | P0 | D |
| Fill, stroke, colour | Stroke styles | P1 | P |
| Fill, stroke, colour | Color management | P1 | P |
-| Fill, stroke, colour | Overprint Preview | P1 | M |
+| Fill, stroke, colour | Overprint Preview | P1 | D |
| Fill, stroke, colour | Separations Preview | P2 | M |
| Fill, stroke, colour | Eyedropper | P1 | D |
| Fill, stroke, colour | Appearance of Black prefs | P1 | P |
@@ -300,7 +300,7 @@ Open P0 items: Preferences, Vector/page formats (PDF/AI/SVG/EPS place), Export t
| View & navigation | Power Zoom | P2 | M |
| View & navigation | Animated/scrubby zoom | P1 | D |
| View & navigation | Screen modes | P0 | D |
-| View & navigation | Overprint preview | P1 | M |
+| View & navigation | Overprint preview | P1 | D |
| View & navigation | Rulers, guides, grids toggles | P0 | D |
| View & navigation | Show/hide frame edges, threads, hidden chars | P0 | D |
| View & navigation | Structure / tag markers | P2 | M |