diff --git a/Cargo.lock b/Cargo.lock index d780911c11..8a06417e08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1227,7 +1227,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=9101c4fc226f5f111b5a890a6c5c19bf3991fd76#9101c4fc226f5f111b5a890a6c5c19bf3991fd76" +source = "git+https://github.com/storytold/craft-libs?rev=a7fb55eaf9a15c21e8ce0b13cf605dc54fd15f57#a7fb55eaf9a15c21e8ce0b13cf605dc54fd15f57" dependencies = [ "thiserror 2.0.21", ] diff --git a/Cargo.toml b/Cargo.toml index 891cce208d..316200fcfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "a499742a9 # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "a499742a9389f47d10cdc61e4cdbf4e5f07f48cd" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "9101c4fc226f5f111b5a890a6c5c19bf3991fd76" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "a7fb55eaf9a15c21e8ce0b13cf605dc54fd15f57" } craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "a499742a9389f47d10cdc61e4cdbf4e5f07f48cd" } # WMF, EMF and EMF+ reader (craft-libs#778). craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "a499742a9389f47d10cdc61e4cdbf4e5f07f48cd" } diff --git a/apps/vectorcraft/src/main.rs b/apps/vectorcraft/src/main.rs index adc52f9d8c..4f8e326981 100644 --- a/apps/vectorcraft/src/main.rs +++ b/apps/vectorcraft/src/main.rs @@ -591,14 +591,15 @@ fn main() -> std::process::ExitCode { created.created(&cc.egui_ctx); if !gpu::skipped().is_empty() { // A processor chosen in Settings can be the one that can't show the window. - let hint = if chosen_gpu { - " (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display)" + if chosen_gpu { + app.status(format!( + "The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display)" + )); } else { - "" - }; - app.status(format!( - "The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary}{hint}" - )); + app.status(format!( + "The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary}" + )); + } } else if let Some(crash) = &crash { app.status(match crash { gpu::Crash::Adapter { name, .. } => format!( diff --git a/apps/vectorcraft/src/presentation.rs b/apps/vectorcraft/src/presentation.rs index 3910984c93..7c2f1dc48a 100644 --- a/apps/vectorcraft/src/presentation.rs +++ b/apps/vectorcraft/src/presentation.rs @@ -54,6 +54,7 @@ fn flag_value(flag: &str, arg: &str, args: &mut impl Iterator) -> impl Overrides { /// Whether a flag or a variable set the present mode or the frame latency. + #[cfg_attr(target_os = "macos", allow(dead_code))] // its one caller, in `main`, is not built on macOS pub fn is_set(&self) -> bool { *self != Self::default() } diff --git a/apps/vectorcraft/src/printing.rs b/apps/vectorcraft/src/printing.rs index 74e05e698f..db3518c26e 100644 --- a/apps/vectorcraft/src/printing.rs +++ b/apps/vectorcraft/src/printing.rs @@ -9,9 +9,8 @@ impl PrintService for SystemPrint { system::printers() } fn print(&mut self, job: &PrintJob) -> Result { - let result = system::print(job); - let to = job.printer.unwrap_or("the default printer"); - result.map(|note| format!("Sent “{}” to {to}{note}", job.title)) + let note = system::print(job)?; + Ok(sent(job.title, job.printer, ¬e)) } fn shared_print(&self) -> Option { Some(std::sync::Arc::new(|job| SystemPrint.print(job))) @@ -29,6 +28,15 @@ impl PrintService for SystemPrint { } } +/// The status after the job `title` went to `printer` (the default one without a name), with the +/// spooler's `note` when it gave one. Each message has text between its values, so a catalog can +/// match it and translate it. The note follows as its own sentence: a printer name can end in +/// parentheses ("HP LaserJet (Copy 1)"), and a note in parentheses would match that name. +fn sent(title: &str, printer: Option<&str>, note: &str) -> String { + let to = printer.unwrap_or("the default printer"); + if note.is_empty() { format!("Sent “{title}” to {to}") } else { format!("Sent “{title}” to {to}. The spooler replied: {note}") } +} + mod system { use super::{Command, PrintJob, Printer}; pub fn printers() -> Vec { @@ -38,7 +46,7 @@ mod system { // Copies, layout, marks and colour management are already in the PDF. Preserve its // physical sheet size and the queue's duplex default without printing copies twice. let settings = craft_print::Job { printer: job.printer.map(str::to_string), title: job.title.into(), ..Default::default() }; - craft_print::submit(job.pdf, &settings).map(|note| if note.is_empty() { note } else { format!(" ({note})") }).map_err(|e| e.to_string()) + craft_print::submit(job.pdf, &settings).map_err(|e| e.to_string()) } #[cfg(windows)] pub(crate) fn setup_command(printer: Option<&str>, default_printer: Option<&str>) -> Command { @@ -127,9 +135,28 @@ mod tests { #[cfg(test)] mod turn_tests { - use super::SystemPrint; + use super::{SystemPrint, sent}; use vectorcraft_ui_egui::print::PrintService; + #[test] + fn the_sent_status_names_the_job_the_printer_and_the_note() { + assert_eq!(sent("Poster", None, ""), "Sent “Poster” to the default printer"); + assert_eq!(sent("Poster", Some("Office Laser"), ""), "Sent “Poster” to Office Laser"); + assert_eq!(sent("Poster", Some("Office Laser"), "job 12"), "Sent “Poster” to Office Laser. The spooler replied: job 12"); + } + + #[test] + fn a_printer_name_ending_in_parentheses_stays_whole_in_a_translation() { + use vectorcraft_ui_egui::i18n::{Lang, message}; + let Some(de) = Lang::from_code("de") else { panic!("no German catalog") }; + let printer = Some("HP LaserJet (Copy 1)"); + assert_eq!(message(de, &sent("Poster", printer, "")), "“Poster” an HP LaserJet (Copy 1) gesendet"); + assert_eq!( + message(de, &sent("Poster", printer, "job 12")), + "“Poster” an HP LaserJet (Copy 1) gesendet. Antwort der Druckwarteschlange: job 12" + ); + } + #[test] fn only_macos_queues_need_landscape_pages_turned() { assert_eq!(SystemPrint.turns_landscape(), !cfg!(target_os = "macos")); diff --git a/crates/doc/src/live.rs b/crates/doc/src/live.rs index 6b16973cf1..28fd1dc632 100644 --- a/crates/doc/src/live.rs +++ b/crates/doc/src/live.rs @@ -65,7 +65,9 @@ pub use expand::{ #[cfg(test)] use mesh::grid_eval; pub use mesh::{Coons, GradientMesh, MeshAppearance, MeshPiece, MeshPoint, MeshQuad, default_fidelity, grid_points, nodes_bounds}; -pub use warp::{WARP_NET, WarpNet, WarpStyle, fit_piece, map_nonlinear, map_nonlinear_within, pieces, uses_net, warp_point, warp_version}; +pub use warp::{ + WARP_NET, WarpNet, WarpStyle, fit_piece, map_nonlinear, map_nonlinear_within, map_smooth_within, pieces, uses_net, warp_point, warp_version, +}; #[cfg(test)] mod tests { @@ -88,6 +90,30 @@ mod tests { } } + /// The smooth map takes each handle along the map's derivative, also far from the origin, + /// where a fixed sampling step would round away (#7069): the identity map keeps a curve's + /// handles there. + #[test] + fn map_smooth_within_keeps_handles_far_from_the_origin() { + for at in [0.0, 1e13] { + let o = Point::new(at, at); + let curve = PathData::single(vectorcraft_geom::SubPath::new( + vec![ + vectorcraft_geom::Anchor::with_handles(o, o, o + vectorcraft_geom::Vec2::new(0.2, 0.0)), + vectorcraft_geom::Anchor::with_handles( + o + vectorcraft_geom::Vec2::new(1.0, 0.5), + o + vectorcraft_geom::Vec2::new(0.8, 0.5), + o + vectorcraft_geom::Vec2::new(1.0, 0.5), + ), + ], + false, + )); + let out = map_smooth_within(&curve, 10.0, usize::MAX, |p| p); + let (a, b) = (&curve.subpaths[0].anchors, &out.subpaths[0].anchors); + assert!(a[0].h_out.distance(b[0].h_out) < 0.01 && a[1].h_in.distance(b[1].h_in) < 0.01, "at {at}: {:?} {:?}", b[0].h_out, b[1].h_in); + } + } + /// #3578: a non-linear map within an anchor budget splits its segments into longer pieces, /// down to one a segment, and matches the plain map where the budget leaves room. #[test] diff --git a/crates/doc/src/live/warp.rs b/crates/doc/src/live/warp.rs index 08bef91140..dd48e8ef65 100644 --- a/crates/doc/src/live/warp.rs +++ b/crates/doc/src/live/warp.rs @@ -497,6 +497,37 @@ pub fn map_nonlinear(path: &PathData, max_piece: f64, f: impl Fn(Point) -> Point /// where pieces of `max_piece` would make more, the pieces grow until they don't ([`fit_piece`]), /// a coarser approximation of the image curve. Geometry effects map within their anchor budget. pub fn map_nonlinear_within(path: &PathData, max_piece: f64, max: usize, f: impl Fn(Point) -> Point) -> PathData { + map_pieces_within(path, max_piece, max, &f, |_, h| f(h)) +} + +/// [`map_nonlinear_within`] with each handle mapped along `f`'s derivative at its point +/// ([`mapped_handle`]) rather than as a point of its own: where `f` turns quickly (Twist), handles +/// mapped as points point different ways on the two sides of a join and the curve kinks there +/// (#7069); along the derivative, the pieces on both sides leave each join in one direction. +pub fn map_smooth_within(path: &PathData, max_piece: f64, max: usize, f: impl Fn(Point) -> Point) -> PathData { + map_pieces_within(path, max_piece, max, &f, |p, h| mapped_handle(&f, p, h)) +} + +/// Handle `h` of point `p` mapped through `f`: `f(p)` plus `f`'s derivative at `p` along `h - p` +/// (a central difference), so the image curve leaves `f(p)` the way `f` takes the curve. +fn mapped_handle(f: &impl Fn(Point) -> Point, p: Point, h: Point) -> Point { + let v = h - p; + let len = v.hypot(); + // A retracted handle stays retracted, and a non-finite one has no direction to follow. + if len.is_nan() || len <= 0.0 || len.is_infinite() { + return f(p); + } + // A thousandth of the handle, or more where the coordinates are so large that so short a + // step would round away (#7069): the samples stay a billionth of the coordinates apart, and + // at most at the handle's own end. + let size = p.x.abs().max(p.y.abs()).max(1.0); + let step = (1e-3f64).max(size * 1e-9 / len).min(1.0); + let d = (f(p + v * step) - f(p - v * step)) / (2.0 * step); + f(p) + d +} + +/// [`map_nonlinear_within`]'s pieces, with `handle(point, handle)` giving each mapped handle. +fn map_pieces_within(path: &PathData, max_piece: f64, max: usize, f: &impl Fn(Point) -> Point, handle: impl Fn(Point, Point) -> Point) -> PathData { let mut max_piece = max_piece.max(1e-3); // Each segment adds one anchor per piece past its first. let room = max.saturating_sub(path.anchor_count()); @@ -516,20 +547,20 @@ pub fn map_nonlinear_within(path: &PathData, max_piece: f64, max: usize, f: impl let mut pending_in: Option = None; for i in 0..n { let a = &sp.anchors[i]; - let h_in = pending_in.take().unwrap_or_else(|| f(a.h_in)); - res.push(Anchor { p: f(a.p), h_in, h_out: f(a.h_out), kind: a.kind }); + let h_in = pending_in.take().unwrap_or_else(|| handle(a.p, a.h_in)); + res.push(Anchor { p: f(a.p), h_in, h_out: handle(a.p, a.h_out), kind: a.kind }); if i < segs { let c = seg_cubic(sp, i); let k = pieces(poly_len(&c), max_piece, MAX_PIECES); for j in 0..k { let sub = c.subsegment((j as f64 / k as f64)..((j + 1) as f64 / k as f64)); if let Some(last) = res.last_mut() { - last.h_out = f(sub.p1); + last.h_out = handle(sub.p0, sub.p1); } if j + 1 < k { - res.push(Anchor { p: f(sub.p3), h_in: f(sub.p2), h_out: f(sub.p3), kind: Default::default() }); + res.push(Anchor { p: f(sub.p3), h_in: handle(sub.p3, sub.p2), h_out: f(sub.p3), kind: Default::default() }); } else { - pending_in = Some(f(sub.p2)); + pending_in = Some(handle(sub.p3, sub.p2)); } } } diff --git a/crates/effects/src/distort.rs b/crates/effects/src/distort.rs index a5bc941b16..7a03a2f3aa 100644 --- a/crates/effects/src/distort.rs +++ b/crates/effects/src/distort.rs @@ -5,7 +5,9 @@ use vectorcraft_geom::kurbo::ParamCurveArclen; use vectorcraft_geom::{Affine, Anchor, ParamCurve, PathData, Point, Rect, SubPath, Vec2}; use vectorcraft_pathops::addons::pathtools::insert_at; -use crate::util::{catmull_rom, fit_piece, flag, map_nonlinear_within, mean_size, noise, normal_at, num, pieces, seed, seg_cubic, smooth_points}; +use crate::util::{ + catmull_rom, fit_piece, flag, map_nonlinear_within, map_smooth_within, mean_size, noise, normal_at, num, pieces, seed, seg_cubic, smooth_points, +}; fn diag(b: Rect) -> f64 { b.width().hypot(b.height()).max(1e-6) @@ -325,8 +327,8 @@ pub fn tweak(path: &PathData, b: Rect, p: &Value) -> PathData { } /// Twist: rotation that is strongest at the centre and fades to zero at the bounding circle, -/// clockwise on the page for a positive `angle`, making at most `max` anchors -/// ([`map_nonlinear_within`]). +/// clockwise on the page for a positive `angle`, making at most `max` anchors. Its handles follow +/// the rotation's derivative ([`map_smooth_within`]), so the pieces join without kinks (#7069). pub fn twist(path: &PathData, b: Rect, angle: f64, max: usize) -> PathData { let ang = angle.clamp(-3600.0, 3600.0).to_radians(); if ang == 0.0 { @@ -343,7 +345,7 @@ pub fn twist(path: &PathData, b: Rect, angle: f64, max: usize) -> PathData { c + Vec2::new(d.x * co - d.y * s, d.x * s + d.y * co) }; let piece = (r / 8.0).min(r / (1.0 + ang.abs() * 2.0)); - map_nonlinear_within(path, piece, max, f) + map_smooth_within(path, piece, max, f) } const ZIGZAG_ARCLEN_ACCURACY: f64 = 1e-4; diff --git a/crates/effects/src/tests.rs b/crates/effects/src/tests.rs index ac340224c6..52b38f986d 100644 --- a/crates/effects/src/tests.rs +++ b/crates/effects/src/tests.rs @@ -1687,6 +1687,27 @@ fn twist_turns_clockwise_for_positive_angles() { assert!(turned(-45.0).y < 49.5, "{:?}", turned(-45.0)); } +/// Twist turns a line into a smooth spiral: the points it adds join their pieces without a kink, +/// however far it turns (#7069). +#[test] +fn twist_joins_its_pieces_smoothly() { + let line = PathData::single(SubPath::polyline(&[Point::new(40.0, 30.0), Point::new(60.0, 30.0)], false)); + let bounds = Rect::new(40.0, 30.0, 60.0, 30.0); + for angle in [90.0, 400.0, -720.0] { + let out = apply_geometry(&[fx("distort.twist", json!({"angle": angle}))], &line, bounds); + let anchors = &out.subpaths[0].anchors; + assert!(anchors.len() > 8, "{angle}°: {} anchors", anchors.len()); + for a in anchors.iter().skip(1).take(anchors.len() - 2) { + let (into, out) = (a.p - a.h_in, a.h_out - a.p); + if into.hypot() < 1e-9 || out.hypot() < 1e-9 { + continue; + } + let kink = (into.x * out.y - into.y * out.x).atan2(into.dot(out)).to_degrees().abs(); + assert!(kink < 1.0, "{angle}°: a kink of {kink:.1}° at {:?}", a.p); + } + } +} + #[test] fn twist_fixes_the_outer_circle_and_rotates_inside() { let out = run("distort.twist", json!({"angle": 0}), &square()); diff --git a/crates/effects/src/util.rs b/crates/effects/src/util.rs index ec8cb4cba8..de203b4955 100644 --- a/crates/effects/src/util.rs +++ b/crates/effects/src/util.rs @@ -71,7 +71,7 @@ pub fn seg_cubic(sp: &SubPath, i: usize) -> CubicBez { /// Non-linear path mapping (shared with live envelopes in `vectorcraft-doc`), and the split of /// segments into pieces within an anchor budget. -pub use vectorcraft_doc::live::{fit_piece, map_nonlinear_within, pieces}; +pub use vectorcraft_doc::live::{fit_piece, map_nonlinear_within, map_smooth_within, pieces}; /// About how many lines the renderer flattens `path` into at 1 px/pt: one for a straight /// segment, and for a curve the count Wang's formula gives at vello's tolerance of 0.25 px, diff --git a/crates/engine/src/cmd/create.rs b/crates/engine/src/cmd/create.rs index c5d3d70fd2..932527a397 100644 --- a/crates/engine/src/cmd/create.rs +++ b/crates/engine/src/cmd/create.rs @@ -53,7 +53,7 @@ pub fn specs() -> Vec { "Flare", [], None, - "{cx, cy, diameter=100, opacity=50 (%), brightness=30 (%), growth=20 (%), fuzziness=50 (%), rays=15, longest=300 (%), rayFuzziness=100 (%), rotation=0 (deg, turns the rays clockwise), x2?, y2? (ring end; else pathLength at direction), pathLength=300, rings=10, largest=50 (%), direction=45 (deg counter-clockwise from 3 o'clock: where the rings run from the centre), seed?, ringSeed? (whole number below 2^53: places the rings along the path anew, keeping their count and sizes)} → {id}", + "{cx, cy, diameter=100, opacity=50 (%), brightness=30 (%), growth=20 (%), fuzziness=50 (%), rays=15, longest=300 (%), rayFuzziness=100 (%), rotation=0 (deg, turns the rays clockwise), x2?, y2? (ring end; else pathLength at direction), pathLength=300, rings=10, largest=50 (%), direction=45 (deg counter-clockwise from 3 o'clock: where the rings run from the centre), seed?, ringSeed? (whole number below 2^53: deterministically places every ring along the path, including the first for small seed values, keeping their count and sizes)} → {id}", has_doc, flare ), @@ -565,7 +565,7 @@ fn flare(s: &mut Session, p: &Value) -> Result { None | Some(Value::Null) => Ok(None), Some(v) => v.as_u64().map(Some).ok_or_else(|| bad("shape.flare", format!("`{key}` must be a whole number of at least 0, not {v}"))), }; - // The generator's state is odd (never 0). + // Xorshift64. Both streams start from a nonzero state. let random = |mut state: u64| { move || { state ^= state << 13; @@ -580,7 +580,13 @@ fn flare(s: &mut Session, p: &Value) -> Result { Some(r) if r >= 1 << 53 => return Err(bad("shape.flare", format!("`ringSeed` must be below 2^53, not {r}"))), r => r, }; - let mut ring_at = ring_seed.map(|r| random((r << 1) | 1)); + let mut ring_at = ring_seed.map(|r| { + // SplitMix64 initializes the ring-position stream. + let mut z = r.wrapping_add(0x9e37_79b9_7f4a_7c15); + z = (z ^ (z >> 30)).wrapping_mul(0xbf58_476d_1ce4_e5b9); + z = (z ^ (z >> 27)).wrapping_mul(0x94d0_49bb_1331_11eb); + random(z ^ (z >> 31)) + }); let stop = |offset: f32, opacity: f32| GradientStop { opacity, ..GradientStop::new(offset, vectorcraft_color::Color::WHITE) }; let radial = |centre: Point, radius: f64, stops: Vec| { let mut g = GradientPaint::new(Gradient::new(GradientKind::Radial, stops)); diff --git a/crates/engine/src/cmd/fileio/pdf.rs b/crates/engine/src/cmd/fileio/pdf.rs index 75e2dba02b..36b0845aa1 100644 --- a/crates/engine/src/cmd/fileio/pdf.rs +++ b/crates/engine/src/cmd/fileio/pdf.rs @@ -417,9 +417,13 @@ fn encode_carrying_at( } let (flat, flattened) = flatten_for(cmd, doc, set, p)?; vectorcraft_doc::cancel::check()?; - if flattened { + if let Some(o) = flattened { let kind = if set.standard.flattens() { set.standard.label() } else { set.compatibility.label() }; - notes.push(Note::loss(format!("transparency is flattened into opaque art and images ({kind} files have none): see the flattener preset"))); + let line_ppi = o.line_art_ppi.round() as u32; + let grad_ppi = o.gradient_ppi.round() as u32; + notes.push(Note::loss(format!( + "transparency is flattened into opaque art and images ({kind} files have none) at {line_ppi} ppi line art and text, {grad_ppi} ppi gradients and meshes: see the flattener preset" + ))); } let r = super::super::rasterfx::export_pdf_with_report(flat.as_ref().unwrap_or(doc), &opts).map_err(|e| pdf_error(cmd, e))?; notes.extend(r.warnings.into_iter().map(Note::loss)); @@ -438,9 +442,9 @@ pub const DEFAULT_FLATTENER: &str = "High Resolution"; /// discarded overprints are dropped. Layers the pages leave out (non-printing ones, unless asked /// for) are left out of the flattening, hidden. → the document to write (`None`: `doc` as it is) /// and whether its transparency was flattened. -fn flatten_for(cmd: &str, doc: &Document, set: &PdfSettings, p: &Value) -> Result<(Option, bool)> { +fn flatten_for(cmd: &str, doc: &Document, set: &PdfSettings, p: &Value) -> Result<(Option, Option)> { if !set.pdf13() { - return Ok((None, false)); + return Ok((None, None)); } let printed = if set.include_non_printing || set.create_layers { None } else { without_non_printing(&doc.layers) }; let shown = printed.map(|layers| { @@ -456,8 +460,8 @@ fn flatten_for(cmd: &str, doc: &Document, set: &PdfSettings, p: &Value) -> Resul // its art: it is clipped to its regions (opaque inside them). o.clip_complex_regions = true; Ok(match flatten_document(shown.as_ref().unwrap_or(doc), &o)? { - Some(flat) => (Some(flat), true), - None => (shown, false), + Some(flat) => (Some(flat), Some(o)), + None => (shown, None), }) } diff --git a/crates/engine/src/cmd/params.rs b/crates/engine/src/cmd/params.rs index a487b0d657..8dc29b9704 100644 --- a/crates/engine/src/cmd/params.rs +++ b/crates/engine/src/cmd/params.rs @@ -664,18 +664,28 @@ fn pdf_option_tree() -> Value { tree } +/// The parameter error of command `id` for `key`, a key with the objects it is in (`marks.ofset`), +/// when a key those objects take is near it: `near`, written the same way (`marks.offset`). Each +/// is one value of the message, so a catalog can match the message and translate it. +fn misspelled(id: &str, key: &str, near: &str) -> crate::EngineError { + bad(id, format!("unknown parameter `{key}`; did you mean `{near}`?")) +} + /// `given`, the object at `within` (`marks.`), has only keys of `schema`, the objects inside it too. fn check_option_tree(id: &str, within: &str, given: &serde_json::Map, schema: &serde_json::Map) -> Result<()> { for (key, value) in given { match (schema.get(key), value) { (None, _) => { let keys: Vec<&str> = schema.keys().map(String::as_str).collect(); - let why = match nearest(key, &keys) { - Some(near) => format!("did you mean `{within}{near}`?"), - None => format!("`{}` takes: {}", within.trim_end_matches('.'), keys.join(", ")), - }; - let key = shown_key(key); - return Err(bad(id, format!("unknown parameter `{within}{key}`; {why}"))); + let near = nearest(key, &keys); + let key = format!("{within}{}", shown_key(key)); + return Err(match near { + Some(near) => misspelled(id, &key, &format!("{within}{near}")), + None => { + let (object, keys) = (within.trim_end_matches('.'), keys.join(", ")); + bad(id, format!("unknown parameter `{key}`; `{object}` takes: {keys}")) + } + }); } (Some(Value::Object(inner)), Value::Object(value)) => check_option_tree(id, &format!("{within}{key}."), value, inner)?, _ => {} @@ -692,14 +702,11 @@ fn check_option_keys(id: &str, within: &str, given: &serde_json::Map format!("unknown parameter `{within}{key}`; did you mean `{within}{near}`?"), - None => format!("unknown parameter `{within}{key}`; {why_not}"), - }, - )); + let key = format!("{within}{}", shown_key(key)); + return Err(match near { + Some(near) => misspelled(id, &key, &format!("{within}{near}")), + None => bad(id, format!("unknown parameter `{key}`; {why_not}")), + }); } if let (Some(Value::Object(schema)), Value::Object(value)) = (trees.get(key), value) { check_option_tree(id, &format!("{within}{key}."), value, schema)?; @@ -798,12 +805,15 @@ fn check_screen_rows(id: &str, within: &str, p: &serde_json::Map) let formats = screen_formats(); for (format, options) in settings { if !formats.contains(&format.as_str()) { - let why = match nearest(format, &formats) { - Some(near) => format!("did you mean `{within}settings.{near}`?"), - None => format!("`{within}settings` takes: {}", formats.join(", ")), - }; - let format = shown_key(format); - return Err(bad(id, format!("unknown parameter `{within}settings.{format}`; {why}"))); + let near = nearest(format, &formats); + let key = format!("{within}settings.{}", shown_key(format)); + return Err(match near { + Some(near) => misspelled(id, &key, &format!("{within}settings.{near}")), + None => { + let (object, keys) = (format!("{within}settings"), formats.join(", ")); + bad(id, format!("unknown parameter `{key}`; `{object}` takes: {keys}")) + } + }); } if let Value::Object(options) = options { check_option_keys(id, &format!("{within}settings.{format}."), options, &keys, NO_FORMAT, trees)?; diff --git a/crates/engine/src/cmd/rasterfx/report.rs b/crates/engine/src/cmd/rasterfx/report.rs index f26db6db68..90f2ad2771 100644 --- a/crates/engine/src/cmd/rasterfx/report.rs +++ b/crates/engine/src/cmd/rasterfx/report.rs @@ -66,11 +66,13 @@ impl FlattenReport { lowest .into_iter() .map(|r| { - let name = r.name.map(|name| format!(" ({name})")).unwrap_or_default(); - format!( - "raster effects on object {}{name}: requested {:.1} ppi, achieved {:.1} ppi due to the 64 million pixel cap", - r.id.0, self.requested_ppi, r.achieved_ppi - ) + // The id and the name are one value of the message, so a catalog can match it. + let object = match r.name { + Some(name) => format!("{} ({name})", r.id.0), + None => r.id.0.to_string(), + }; + let (requested, achieved) = (self.requested_ppi, r.achieved_ppi); + format!("raster effects on object {object}: requested {requested:.1} ppi, achieved {achieved:.1} ppi due to the 64 million pixel cap") }) .collect() } @@ -127,4 +129,23 @@ mod tests { assert_eq!(warnings.len(), 1); assert!(warnings[0].contains(&format!("object {}", original.id.0)), "{:?}", warnings); } + + #[test] + fn a_warning_names_the_object_by_its_id_and_its_name() { + let mut doc = Document::new(100.0, 100.0); + doc.raster_effects_ppi = 300.0; + let mut named = Node::group(NodeId(7), vec![]); + named.name = Some("Logo".into()); + let unnamed = Node::group(NodeId(8), vec![]); + let mut report = FlattenReport::new(Which::All, &doc); + report.record(&named, &image(72.0)); + report.record(&unnamed, &image(150.0)); + assert_eq!( + report.warnings(), + [ + "raster effects on object 7 (Logo): requested 300.0 ppi, achieved 72.0 ppi due to the 64 million pixel cap", + "raster effects on object 8: requested 300.0 ppi, achieved 150.0 ppi due to the 64 million pixel cap", + ] + ); + } } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 2b711976ef..e6c622963a 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -3313,6 +3313,26 @@ fn flare_ring_seed_moves_only_the_rings() { assert_eq!(s.doc().unwrap().history.undo.len(), undo); } +#[test] +fn flare_small_ring_seeds_spread_the_first_ring_along_the_path() { + let mut s = session(); + let mut positions = Vec::new(); + for seed in [0, 1, 2, 5, 11, (1u64 << 53) - 1] { + let p = json!({"cx": 20, "cy": 30, "x2": 1020, "y2": 30, "rays": 0, "rings": 1, "ringSeed": seed}); + let id = NodeId(s.execute("shape.flare", &p).unwrap()["id"].as_u64().unwrap()); + let NodeKind::Group { children, .. } = &s.doc().unwrap().doc.node(id).unwrap().kind else { panic!("flare is a group") }; + let ring = children.iter().find(|n| n.name.as_deref() == Some("Ring")).unwrap(); + let center = ring.geometric_bounds().unwrap().center(); + assert!((20.0..=1020.0).contains(¢er.x), "seed {seed}: {center:?}"); + assert!((center.y - 30.0).abs() < 1e-9); + positions.push(center.x); + } + assert!((positions[0] - positions[1]).abs() > 1.0, "neighboring small seeds visibly move the first ring: {positions:?}"); + let lo = positions[..5].iter().copied().fold(f64::INFINITY, f64::min); + let hi = positions[..5].iter().copied().fold(f64::NEG_INFINITY, f64::max); + assert!(hi - lo > 250.0, "small seeds spread the first ring along the path: {positions:?}"); +} + /// `shape.ellipse` without `anchors`, or with 4, draws the live ellipse it always drew. #[test] fn ellipse_with_four_anchors_is_the_live_ellipse() { diff --git a/crates/engine/tests/import_fuzz.rs b/crates/engine/tests/import_fuzz.rs index 058476d071..ca766a64f4 100644 --- a/crates/engine/tests/import_fuzz.rs +++ b/crates/engine/tests/import_fuzz.rs @@ -3827,6 +3827,83 @@ fn editing_text() -> String { ) } +/// The range of [`ai_written_meshes_never_panic`]'s cuts and edits: past the end of [`meshes_text`]. +const MESHES_FUZZ_CHARS: usize = 24_000; + +/// The editing data VectorCraft writes for a document with two gradient meshes: 2 × 3 patches whose +/// rows of points are RGB, CMYK and gray, at half opacity and named; a 1 × 1 mesh with a point at +/// 40% opacity; and an instance of a symbol whose art is a 2 × 1 mesh. +fn meshes_text() -> &'static str { + static TEXT: std::sync::OnceLock = std::sync::OnceLock::new(); + TEXT.get_or_init(|| { + use vectorcraft_color::Color; + use vectorcraft_doc::live::{GradientMesh, MeshPoint, grid_points, smooth_handles}; + use vectorcraft_doc::{Node, NodeKind}; + use vectorcraft_geom::Rect; + let mesh = |r: Rect, rows: u32, cols: u32, color: &dyn Fn(usize) -> Color| { + let pts = grid_points(r, rows, cols); + let handles = smooth_handles(rows, cols, &pts); + let width = cols as usize + 1; + let points = pts + .iter() + .zip(handles) + .enumerate() + .map(|(i, (p, h))| MeshPoint { p: *p, color: color(i / width), opacity: 1.0, handles: h }) + .collect(); + GradientMesh { rows, cols, points } + }; + let mut doc = Document::new(300.0, 200.0); + let layer = doc.layers[0].id; + let sheet = mesh(Rect::new(20.0, 20.0, 200.0, 120.0), 2, 3, &|row| match row { + 0 => Color::rgb(1.0, 0.5, 0.0), + 1 => Color::cmyk(0.1, 0.6, 0.2, 0.05), + _ => Color::gray(0.4), + }); + let mut sheet = Node::new(doc.alloc_id(), NodeKind::Mesh(sheet)); + (sheet.name, sheet.opacity) = (Some("Sheet".into()), 0.5); + doc.insert(Some(layer), usize::MAX, sheet).unwrap(); + let mut small = mesh(Rect::new(220.0, 20.0, 280.0, 80.0), 1, 1, &|row| Color::rgb(0.0, 0.3, 0.3 + 0.5 * row as f32)); + small.points[1].opacity = 0.4; + let small = Node::new(doc.alloc_id(), NodeKind::Mesh(small)); + doc.insert(Some(layer), usize::MAX, small).unwrap(); + let patch = mesh(Rect::new(0.0, 0.0, 40.0, 30.0), 2, 1, &|row| Color::rgb(0.2 * row as f32, 0.6, 0.1)); + let patch = Node::new(doc.alloc_id(), NodeKind::Mesh(patch)); + doc.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Patch".into(), art: std::sync::Arc::new(patch) }); + let instance = + Node::new(doc.alloc_id(), NodeKind::SymbolInstance { symbol: "Patch".into(), xf: vectorcraft_geom::Affine::translate((20.0, 140.0)) }); + doc.insert(Some(layer), usize::MAX, instance).unwrap(); + let out = vectorcraft_eps::export_ai_editing(&doc, &vectorcraft_eps::AiEditingOptions::default()).unwrap(); + String::from_utf8(out.program).unwrap() + }) +} + +/// The data [`ai_written_meshes_never_panic`] damages, as it is, opens with both meshes, the symbol +/// with its mesh and its instance, and the property's cuts and edits reach all of it. +#[test] +fn the_written_meshes_fuzz_data_opens_as_meshes() { + use vectorcraft_doc::NodeKind; + let text = meshes_text(); + assert!(text.chars().count() < MESHES_FUZZ_CHARS, "{}", text.chars().count()); + for mark in ["%AI14_BeginSymbol", "%AI5_BeginLayer", "/Mesh X!", "%_[2 3] /Size X#", "%_/DeviceCMYK /CS X#", "/End X!", "/SymbolInstance :"] { + assert!(text.replace("\r\n", "\n").contains(mark), "{mark}"); + } + let private = [b"%AI24_ZStandard_Data".as_slice(), &zstd(text)].concat(); + let (d, warnings, layered) = vectorcraft_eps::layered_ai(&private, Document::new(300.0, 200.0), vec![], false, true, 1.0); + assert!(layered, "{warnings:?}"); + let art = d.layers[0].children().unwrap(); + let kinds: Vec<&str> = art + .iter() + .map(|n| match n.kind { + NodeKind::Mesh(_) => "mesh", + NodeKind::SymbolInstance { .. } => "instance", + _ => "other", + }) + .collect(); + assert_eq!(kinds, ["mesh", "mesh", "instance"], "{warnings:?}"); + let patch = d.symbols.iter().find(|s| s.name == "Patch").map(|s| &s.art.kind); + assert!(matches!(patch, Some(NodeKind::Mesh(_))), "{patch:?}"); +} + fn zstd(text: &str) -> Vec { ruzstd::encoding::compress_to_vec(text.as_bytes(), ruzstd::encoding::CompressionLevel::Fastest) } @@ -4482,6 +4559,17 @@ proptest! { survive("mutated .ai editing data", || Some(vectorcraft_eps::layered_ai(&private, Document::new(100.0, 100.0), vec![], false, false, 1.0).0))?; } + /// A `.ai` whose gradient meshes, as the writer writes them, are damaged: the record's type, + /// size, places, color spaces and corners on `%_` lines, its `/Mesh X!` and `/End X!`, and the + /// mesh's transparency and name, cut short or edited. + #[test] + fn ai_written_meshes_never_panic(cut in 0usize..MESHES_FUZZ_CHARS, edits in prop::collection::vec((0usize..MESHES_FUZZ_CHARS, prop::sample::select(vec!['0', '1', '2', '9', '-', '.', 'e', ' ', '\n', '[', ']', '(', ')', '/', '%', '_', 'X', '!', '#', 'N', 'P', 'E'])), 0..12)) { + let text = mutate_text(meshes_text(), cut, &edits); + let private = [b"%AI24_ZStandard_Data".as_slice(), &zstd(&text)].concat(); + survive("mutated .ai meshes", || Some(vectorcraft_eps::layered_ai(&private, Document::new(300.0, 200.0), vec![], false, false, 1.0).0))?; + survive("mutated .ai meshes, trusted", || Some(vectorcraft_eps::layered_ai(&private, Document::new(300.0, 200.0), vec![], false, true, 1.0).0))?; + } + /// The active artboard that a restored `.ai` opens on, read from damaged or hostile editing data. #[test] fn ai_active_artboard_never_panics(cut in 0usize..600, edits in prop::collection::vec((0usize..600, prop::sample::select(vec!['0', '9', '-', ' ', '\n', '/', ':', ';', ',', '%', '_'])), 0..12)) { diff --git a/crates/eps/src/ai_editing.rs b/crates/eps/src/ai_editing.rs index 6d0db3d08e..17177671cf 100644 --- a/crates/eps/src/ai_editing.rs +++ b/crates/eps/src/ai_editing.rs @@ -120,7 +120,9 @@ //! and opacity mask and a state block as a group's with its opacity and blending mode (an //! instance with isolation, knockout or knockout shape of its own is written as its art). The //! definitions are at most the reader's 4,096. In a symbol's art, an instance's matrix and -//! a gradient's take the art to the canvas's space turned y up about art space's origin there. +//! a gradient's take the art to the canvas's space turned y up about art space's origin there, +//! and a gradient mesh's corners are in that space; an envelope's contents in its dictionary are +//! in the canvas's space with y down. //! - Art styles, as the reader reads them (`style.rs`, `read/ops.rs`): a path, compound path or //! group with live effects or linked to a graphic style is written as its drawn look (`u`, its //! vector art as its geometry effects leave it, without shadows, glows or feathers, `U`, its @@ -147,6 +149,13 @@ //! reader reads back as the same graph ([`crate::ai_graph`]) is written as its group between //! `%_Gs`, its functional records and `%_GS`, each series' group tagged `Go` right after its end; //! any other graph, and a graph with art left out, as its art, with a warning. +//! - Gradient meshes, as the reader reads them (`mesh.rs`): `/Mesh X!`, `2 /Version`, the grid's type +//! and size, `/Data` (the reader passes over the version and `/Data`), and each patch's place, color +//! space and four corners (color, opacity, point and handles) as `X#` entries on `%_` lines, +//! `/End X!`; the mesh's transparency before it, its name and opacity mask after it +//! (`writer::meshes`). A mesh is written as it is only when the reader reads it back so, when every +//! patch turns the same way (a reflected mesh's columns are written in reverse order), and outside +//! pattern tiles, art cut to a clipping object and a large canvas. //! - Blends, as the reader reads them (`blend.rs`): the blend's key objects and spine as a group on //! `%_` lines, each key's `/ArtDictionary` naming it a key and its id and the spine's naming it the //! spine (written when the blend has a spine of its own); its steps drawn, a group; @@ -182,7 +191,9 @@ //! and instances of //! symbols past 4,096 as their art (symbol art past [`vectorcraft_doc::MAX_SYMBOL_NODES`] objects //! in all left out), instances of symbols the document doesn't have as empty groups, symbols' 9-slice -//! guides, export types and dynamic type left out, blends the reader wouldn't read back live as +//! guides, export types and dynamic type left out, gradient meshes the reader wouldn't read back as +//! they are, folded meshes, meshes in pattern tiles and in art cut to a clipping object and every mesh +//! on a large canvas as their drawn look, blends the reader wouldn't read back live as //! their steps, other live objects (placed documents included) as their art, //! strokes a plain line can't draw and the object's art style doesn't hold //! as their filled outlines, several fills or strokes as a group of a path for each, freeform @@ -328,6 +339,7 @@ fn export_held(source: &Document, o: &AiEditingOptions, max_objects: usize, keep // On a large canvas the layers' symbol instances are written as their art. w.symbols_live = scale == 1.0; w.brushes_live = scale == 1.0; + w.meshes_live = scale == 1.0; w.blends_live = scale == 1.0; w.unbaked_blends = unbaked_blends; w.symbol_doc = symbol_doc; diff --git a/crates/eps/src/ai_editing/tests.rs b/crates/eps/src/ai_editing/tests.rs index 2fd1851fe6..47c4b57f39 100644 --- a/crates/eps/src/ai_editing/tests.rs +++ b/crates/eps/src/ai_editing/tests.rs @@ -1090,6 +1090,7 @@ fn counted() -> Vec<(&'static str, Document)> { ("blends", blends_document()), ("brushes", brushes_document()), ("envelopes", envelopes_document()), + ("meshes", meshes_document()), ("wrap bounds", wrap_bounds_doc()), ] } @@ -11090,7 +11091,7 @@ fn envelopes_are_read_back_live() { } /// An envelope that is a symbol's art is written live in the symbol's definition, and the symbol -/// opens with it as a live envelope. +/// opens with it as a live envelope, its contents where they were. #[test] fn an_envelope_in_a_symbol_is_read_back_live() { use vectorcraft_doc::live::EnvelopeOptions; @@ -11107,15 +11108,103 @@ fn an_envelope_in_a_symbol_is_read_back_live() { let (back, notes) = crate::ai_alone(&p.data).unwrap(); let symbol = back.symbols.iter().find(|s| s.name == "Bent").unwrap_or_else(|| panic!("{name}: {:?}", back.symbols)); let mut envelopes = vec![]; + let mut boxes = vec![]; symbol.art.walk(&mut |n| { - if let NodeKind::Envelope { kind, .. } = &n.kind { + if let NodeKind::Envelope { kind, content, .. } = &n.kind { envelopes.push((**kind).clone()); + boxes.extend(content.iter().map(|c| c.geometric_bounds())); } }); assert!(matches!(envelopes.as_slice(), [k] if same_envelope_kind(&kind, k)), "{name}: {envelopes:?} {notes:?}"); + let near = |a: Option, b: Rect| { + a.is_some_and(|a| (a.x0 - b.x0).abs() + (a.y0 - b.y0).abs() + (a.x1 - b.x1).abs() + (a.y1 - b.y1).abs() < 1e-6) + }; + let want = [Rect::new(40.0, 20.0, 100.0, 80.0), Rect::new(100.0, 20.0, 160.0, 80.0)]; + assert!(boxes.len() == 2 && boxes.iter().zip(want).all(|(a, b)| near(*a, b)), "{name}: {boxes:?}"); } } +/// A gradient-filled path in the contents of an envelope in a symbol's art opens with its gradient +/// where it was on the path. +#[test] +fn a_gradient_in_an_envelopes_contents_in_a_symbol_keeps_its_place() { + use vectorcraft_color::gradient::GradientGeom; + use vectorcraft_doc::live::{EnvelopeKind, EnvelopeOptions}; + let mut doc = Document::new(200.0, 100.0); + let kind = EnvelopeKind::Mesh { rows: 2, cols: 3, points: envelope_points(2, 3), handles: vec![] }; + let mut art = envelope_node(&mut doc, kind, 50.0, false, EnvelopeOptions::NEW); + let geom = GradientGeom { start: (50.0, 30.0).into(), end: (90.0, 70.0).into(), aspect: 1.0, focal: None }; + let fill = gradient_paint(sunset(), Some(geom), None); + let shaded = painted(&mut doc, shapes::rectangle(Rect::new(40.0, 20.0, 100.0, 80.0)), vec![AppearanceItem::Fill(FillLayer::new(fill))]); + if let NodeKind::Envelope { content, .. } = &mut art.kind { + content[0] = Arc::new(shaded); + } + doc.symbols.push(Symbol { dynamic: false, name: "Bent".into(), art: Arc::new(art) }); + let instance = Node::new(doc.alloc_id(), NodeKind::SymbolInstance { symbol: "Bent".into(), xf: Affine::translate((10.0, 5.0)) }); + let layer = doc.layers[0].id; + doc.insert(Some(layer), usize::MAX, instance).unwrap(); + let back = read_back(&doc); + let symbol = back.symbols.iter().find(|s| s.name == "Bent").unwrap_or_else(|| panic!("{:?}", back.symbols)); + let mut geoms = vec![]; + symbol.art.walk(&mut |n| { + if let NodeKind::Envelope { content, .. } = &n.kind { + for c in content { + if let Paint::Gradient(g) = c.appearance.fill_paint() { + geoms.push(g.geom); + } + } + } + }); + let near = |a: vectorcraft_geom::Point, b: vectorcraft_geom::Point| (a - b).hypot() < 1e-6; + assert!(matches!(geoms.as_slice(), [Some(g)] if near(g.start, geom.start) && near(g.end, geom.end)), "{geoms:?}, want {geom:?}"); +} + +/// The contents of an envelope in a symbol's art are written in the canvas's space with y down: +/// about the canvas point of art space's origin. +#[test] +fn an_envelopes_contents_in_a_symbol_are_written_in_the_canvas_space() { + use vectorcraft_doc::live::{EnvelopeKind, EnvelopeOptions}; + let mut doc = Document::new(200.0, 100.0); + let kind = EnvelopeKind::Mesh { rows: 2, cols: 3, points: envelope_points(2, 3), handles: vec![] }; + let art = envelope_node(&mut doc, kind, 50.0, false, EnvelopeOptions::NEW); + doc.symbols.push(Symbol { dynamic: false, name: "Bent".into(), art: Arc::new(art) }); + let instance = Node::new(doc.alloc_id(), NodeKind::SymbolInstance { symbol: "Bent".into(), xf: Affine::translate((10.0, 5.0)) }); + let layer = doc.layers[0].id; + doc.insert(Some(layer), usize::MAX, instance).unwrap(); + let p = program(&doc); + let t: Vec = p.lines().find_map(|l| l.strip_prefix("%AI3_TemplateBox: ")).unwrap().split(' ').map(|v| v.parse().unwrap()).collect(); + let (ox, oy) = (f64::from(CANVAS_SIZE) / 2.0 - t[0], f64::from(CANVAS_SIZE) / 2.0 + t[1]); + let def = &p[p.find("%AI14_BeginSymbol\n(Bent)\n").unwrap()..]; + let block = &def[def.find("%_X=\n").unwrap()..]; + let moves: Vec<&str> = block.lines().filter_map(|l| l.trim_start_matches("%_").strip_suffix(" m")).collect(); + // The red square's points are the rectangle 40 20 to 100 80, in the symbol's space. + let xs: Vec = moves.first().unwrap().split(' ').map(|v| v.parse().unwrap()).collect(); + assert!([40.0, 100.0].iter().any(|x| (xs[0] - (x + ox)).abs() < 1e-6), "{xs:?}, origin {ox} {oy}"); + assert!([20.0, 80.0].iter().any(|y| (xs[1] - (y + oy)).abs() < 1e-6), "{xs:?}, origin {ox} {oy}"); +} + +/// The grid of an envelope in a symbol's art is written in the space a gradient mesh's corners are +/// written in there: about the canvas point of art space's origin, y up. +#[test] +fn an_envelopes_grid_in_a_symbol_is_written_about_the_canvas_point_of_the_origin() { + use vectorcraft_doc::live::{EnvelopeKind, EnvelopeOptions}; + let mut doc = Document::new(200.0, 100.0); + let kind = EnvelopeKind::Mesh { rows: 2, cols: 3, points: envelope_points(2, 3), handles: vec![] }; + let art = envelope_node(&mut doc, kind, 50.0, false, EnvelopeOptions::NEW); + doc.symbols.push(Symbol { dynamic: false, name: "Bent".into(), art: Arc::new(art) }); + let instance = Node::new(doc.alloc_id(), NodeKind::SymbolInstance { symbol: "Bent".into(), xf: Affine::translate((10.0, 5.0)) }); + let layer = doc.layers[0].id; + doc.insert(Some(layer), usize::MAX, instance).unwrap(); + let p = program(&doc); + let t: Vec = p.lines().find_map(|l| l.strip_prefix("%AI3_TemplateBox: ")).unwrap().split(' ').map(|v| v.parse().unwrap()).collect(); + let (ox, oy) = (f64::from(CANVAS_SIZE) / 2.0 - t[0], f64::from(CANVAS_SIZE) / 2.0 + t[1]); + let def = &p[p.find("%AI14_BeginSymbol\n(Bent)\n").unwrap()..]; + let first = def.lines().find(|l| l.ends_with(" /N X#")).unwrap(); + // The grid's top left point, at 30 10. + let want = format!("[0 1 {} {} ", ps::num(30.0 - ox), ps::num(oy - 10.0)); + assert!(first.trim_start_matches("%_").starts_with(&want), "{first}, want {want}"); +} + /// An envelope with an opacity mask comes back live with its mask, and the plugin's `XP` follows /// the envelope's dictionary rather than its mask's art. #[test] @@ -14239,3 +14328,621 @@ fn a_large_canvas_writes_blends_as_their_steps() { assert!(out.warnings.iter().any(|w| w == writer::BLENDS), "{:?}", out.warnings); assert!(matches!(read_back(&doc).layers[0].children().unwrap()[0].kind, NodeKind::Group { .. })); } + +// ---------- gradient meshes ---------- + +use vectorcraft_doc::live::{GradientMesh, H_DOWN, H_RIGHT, MeshPoint, grid_points, smooth_handles}; + +/// A mesh over `r` of `rows` × `cols` patches: its points on a grid with smooth handles, each +/// colored `color(row, col)` and opaque. +fn grid_mesh(r: Rect, rows: u32, cols: u32, color: impl Fn(usize, usize) -> Color) -> GradientMesh { + let pts = grid_points(r, rows, cols); + let handles = smooth_handles(rows, cols, &pts); + let width = cols as usize + 1; + let points = pts + .iter() + .zip(handles) + .enumerate() + .map(|(i, (p, h))| MeshPoint { p: *p, color: color(i / width, i % width), opacity: 1.0, handles: h }) + .collect(); + GradientMesh { rows, cols, points } +} + +fn mesh_node(doc: &mut Document, m: GradientMesh) -> Node { + Node::new(doc.alloc_id(), NodeKind::Mesh(m)) +} + +/// The gradient meshes in `doc`'s layers, in order (groups and clipping groups included). +fn meshes_in(doc: &Document) -> Vec> { + fn walk(nodes: &[Arc], out: &mut Vec>) { + for n in nodes { + if matches!(n.kind, NodeKind::Mesh(_)) { + out.push(n.clone()); + } else if let Some(c) = n.children() { + walk(c, out); + } + } + } + let mut out = vec![]; + walk(&doc.layers, &mut out); + out +} + +fn mesh_of(n: &Node) -> &GradientMesh { + match &n.kind { + NodeKind::Mesh(m) => m, + _ => panic!("not a mesh: {n:?}"), + } +} + +/// A 400 × 400 document with gradient meshes: `Sheet`, 2 × 3 patches over 20 20 200 120, its top row +/// of points RGB, its middle row CMYK and its bottom row gray, its middle point moved with handles of +/// its own, its top left point's handle to the right bent up, two points part transparent, at 60% +/// in Multiply, followed by a path at 80%; a hidden, locked 1 × 1 gray mesh `Shy` in a group `Box`; +/// `Masked`, 1 × 2 with an inverted, unlinked opacity mask, knockout shape, isolation and knockout; +/// and a mesh in a clipping group. +fn meshes_document() -> Document { + let mut doc = Document::new(400.0, 400.0); + let layer = doc.layers[0].id; + let mut sheet = grid_mesh(Rect::new(20.0, 20.0, 200.0, 120.0), 2, 3, |r, c| match r { + 0 => Color::rgb(1.0, 0.5 * c as f32 / 3.0, 0.0), + 1 => Color::cmyk(0.1 * c as f32, 0.6, 0.2, 0.05), + _ => Color::gray(0.2 + 0.2 * c as f32), + }); + let middle = &mut sheet.points[5]; + middle.p += vectorcraft_geom::Vec2::new(7.0, -5.0); + middle.handles[H_RIGHT] = vectorcraft_geom::Vec2::new(20.0, 8.0); + middle.handles[H_DOWN] = vectorcraft_geom::Vec2::new(-4.0, 12.0); + sheet.points[0].handles[H_RIGHT] = vectorcraft_geom::Vec2::new(15.0, -10.0); + sheet.points[2].opacity = 0.4; + sheet.points[11].opacity = 0.0; + let mut sheet = mesh_node(&mut doc, sheet); + (sheet.name, sheet.opacity, sheet.blend) = (Some("Sheet".into()), 0.6, BlendMode::Multiply); + doc.insert(Some(layer), usize::MAX, sheet).unwrap(); + let mut after = Node::path( + doc.alloc_id(), + shapes::rectangle(Rect::new(240.0, 20.0, 260.0, 40.0)), + Appearance::basic(solid(Color::rgb(0.0, 1.0, 0.0)), Paint::None, 0.0), + ); + after.opacity = 0.8; + doc.insert(Some(layer), usize::MAX, after).unwrap(); + let mut shy = mesh_node(&mut doc, grid_mesh(Rect::new(20.0, 150.0, 80.0, 190.0), 1, 1, |_, c| Color::gray(0.25 + 0.5 * c as f32))); + (shy.name, shy.visible, shy.locked) = (Some("Shy".into()), false, true); + let mut group = Node::group(doc.alloc_id(), vec![Arc::new(shy)]); + group.name = Some("Box".into()); + doc.insert(Some(layer), usize::MAX, group).unwrap(); + let mut masked = mesh_node(&mut doc, grid_mesh(Rect::new(120.0, 150.0, 220.0, 190.0), 1, 2, |r, _| Color::rgb(0.0, 0.3, 0.3 + 0.5 * r as f32))); + masked.name = Some("Masked".into()); + // Knockout shape is a mesh's own; isolation and knockout are a group's. + (masked.knockout_shape, masked.isolate, masked.knockout) = (true, true, vectorcraft_doc::Knockout::On); + let mask_art = Node::path( + doc.alloc_id(), + shapes::rectangle(Rect::new(120.0, 150.0, 170.0, 190.0)), + Appearance::basic(solid(Color::WHITE), Paint::None, 0.0), + ); + masked.extras_mut().mask = Some(Box::new(OpacityMask { art: Arc::new(mask_art), clip: true, invert: true, disabled: false, linked: false })); + doc.insert(Some(layer), usize::MAX, masked).unwrap(); + let clip = Node::path(doc.alloc_id(), shapes::ellipse(Rect::new(250.0, 150.0, 350.0, 250.0)), Appearance::default()); + let inside = mesh_node(&mut doc, grid_mesh(Rect::new(250.0, 150.0, 350.0, 250.0), 2, 2, |r, c| Color::rgb(0.5 * r as f32, 0.5 * c as f32, 1.0))); + let clipped = Node::new(doc.alloc_id(), NodeKind::Group { children: vec![Arc::new(clip), Arc::new(inside)], clip: true }); + doc.insert(Some(layer), usize::MAX, clipped).unwrap(); + doc +} + +/// How far a coordinate, color channel or opacity written to 4 decimals may move: half the last +/// decimal, and a little for the arithmetic. +const MESH_ROUNDING: f64 = 5e-5 + 1e-9; + +/// `read` is `want` as written, checked without the writer's own test: the same grid; each point +/// within [`MESH_ROUNDING`] of its place along each axis; each handle that points into the grid +/// ending within it of where `want`'s ends, and each handle on the mesh's outside edge read as +/// none (the reader gives those none, and they draw nothing); each color in the same model with +/// each channel within it of `want`'s clamped to 0 to 1; each opacity within it. +fn assert_mesh_exact(read: &GradientMesh, want: &GradientMesh, what: &str) { + use vectorcraft_doc::live::H_LEFT; + use vectorcraft_doc::live::H_UP; + assert_eq!((read.rows, read.cols, read.points.len()), (want.rows, want.cols, want.points.len()), "{what}: the grid"); + let (rows, cols) = (want.rows as usize, want.cols as usize); + let close = |a: f64, b: f64| (a - b).abs() <= MESH_ROUNDING; + let channels = |c: &Color| -> (u8, Vec) { + match *c { + Color::Gray { k } => (0, vec![f64::from(k)]), + Color::Rgb { r, g, b } => (1, vec![f64::from(r), f64::from(g), f64::from(b)]), + Color::Cmyk { c, m, y, k } => (2, vec![f64::from(c), f64::from(m), f64::from(y), f64::from(k)]), + Color::Lab { .. } => (3, vec![]), + } + }; + for (i, (a, b)) in read.points.iter().zip(&want.points).enumerate() { + let (r, c) = (i / (cols + 1), i % (cols + 1)); + assert!(close(a.p.x, b.p.x) && close(a.p.y, b.p.y), "{what}: point {i} at {:?}, want {:?}", a.p, b.p); + for (h, inside) in [(H_RIGHT, c < cols), (H_LEFT, c > 0), (H_DOWN, r < rows), (H_UP, r > 0)] { + if inside { + let (ea, eb) = (a.p + a.handles[h], b.p + b.handles[h]); + assert!(close(ea.x, eb.x) && close(ea.y, eb.y), "{what}: point {i}'s handle {h} ends at {ea:?}, want {eb:?}"); + } else { + assert_eq!(a.handles[h], vectorcraft_geom::Vec2::ZERO, "{what}: point {i}'s outside handle {h}"); + } + } + let ((ma, ca), (mb, cb)) = (channels(&a.color), channels(&b.color)); + assert_eq!(ma, mb, "{what}: point {i}'s color model: {:?}, want {:?}", a.color, b.color); + assert!(ca.iter().zip(&cb).all(|(x, y)| close(*x, y.clamp(0.0, 1.0))), "{what}: point {i}'s color {:?}, want {:?}", a.color, b.color); + assert!(close(f64::from(a.opacity), f64::from(b.opacity.clamp(0.0, 1.0))), "{what}: point {i}'s opacity {}, want {}", a.opacity, b.opacity); + } +} + +/// Each mesh of `doc` comes back from the editing data alone as a mesh: the same grid, points, +/// handles, colors in their own models and opacities ([`assert_mesh_exact`]), name, transparency +/// (opacity, blending mode and knockout shape; isolation and knockout are a group's and are written +/// off, as for a path), lock and hidden state, and opacity mask (its flags and its art's kind and +/// box). +fn assert_meshes_read_back(doc: &Document) { + let back = read_back(doc); + let (ours, theirs) = (meshes_in(doc), meshes_in(&back)); + assert_eq!(theirs.len(), ours.len(), "{:#?}", back.layers[0]); + for (a, b) in ours.iter().zip(&theirs) { + assert_mesh_exact(mesh_of(b), mesh_of(a), &format!("{:?}", a.name)); + assert_eq!((&b.name, b.opacity, b.blend, b.visible, b.locked), (&a.name, a.opacity, a.blend, a.visible, a.locked)); + // Isolation and knockout are written off (`Xy`); a mesh read keeps a new object's. + let fresh = Node::new(b.id, NodeKind::Mesh(mesh_of(b).clone())); + assert_eq!((b.knockout_shape, b.isolate, b.knockout), (a.knockout_shape, fresh.isolate, fresh.knockout), "{:?}'s knockout", a.name); + match (&a.extras().mask, &b.extras().mask) { + (None, None) => {} + (Some(ma), Some(mb)) => { + assert_eq!((mb.clip, mb.invert, mb.disabled, mb.linked), (ma.clip, ma.invert, ma.disabled, ma.linked), "{:?}'s mask flags", a.name); + assert_eq!(std::mem::discriminant(&mb.art.kind), std::mem::discriminant(&ma.art.kind), "{:?}'s mask art", a.name); + let (ba, bb) = (ma.art.geometric_bounds().unwrap(), mb.art.geometric_bounds().unwrap()); + assert!( + (ba.x0 - bb.x0).abs() < 1e-3 && (ba.y0 - bb.y0).abs() < 1e-3 && (ba.x1 - bb.x1).abs() < 1e-3 && (ba.y1 - bb.y1).abs() < 1e-3, + "{:?}'s mask art box {bb:?}, want {ba:?}", + a.name + ); + } + (want, got) => panic!("{:?}'s opacity mask: {} read back, want {}", a.name, got.is_some(), want.is_some()), + } + } +} + +#[test] +fn meshes_are_read_back_as_they_are() { + let doc = meshes_document(); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(!out.warnings.iter().any(|w| w == writer::MESHES || w == writer::LIVE), "{:?}", out.warnings); + assert_eq!(program(&doc).matches("/Mesh X!\n").count(), 4); + assert_meshes_read_back(&doc); + let back = read_back(&doc); + let art = back.layers[0].children().unwrap(); + assert_eq!((art[1].opacity, matches!(art[1].kind, NodeKind::Path { .. })), (0.8, true), "the path after the mesh keeps its own opacity"); + // The moved point keeps its place and handles exactly (to the 4 decimals written). + let sheet = mesh_of(&art[0]); + assert!((sheet.points[5].p - vectorcraft_geom::Point::new(87.0, 65.0)).hypot() < 1e-4, "{:?}", sheet.points[5].p); + assert!((sheet.points[5].handles[H_RIGHT] - vectorcraft_geom::Vec2::new(20.0, 8.0)).hypot() < 1e-4); +} + +/// A mesh is `/Mesh X!`, its version (2: corners with an opacity), type and size, `/Data`, each +/// patch row by row with its place, the color space where it changes and four corners (from the +/// top left point down, right and up: color, opacity, point, the handle towards the next corner and +/// the one before it, in art space), `/End X!`; its transparency before it, its name after it, then +/// `0 0 Xd` and `6 () XW`. Gray is written as lightness. +#[test] +fn meshes_are_written_in_their_form() { + let doc = meshes_document(); + let text = program(&doc); + let start = text.find("/Mesh X!\n").unwrap(); + let end = start + text[start..].find("/End X!\n").unwrap() + "/End X!\n".len(); + let sheet = &text[start..end]; + assert!( + sheet.starts_with("/Mesh X!\n%_2 /Version X#\n%_/Cartesian /Type X#\n%_[2 3] /Size X#\n%_/Data X#\n%_[0 0] /P X#\n%_/DeviceRGB /CS X#\n"), + "{sheet}" + ); + let places: Vec<&str> = sheet.lines().filter(|l| l.ends_with(" /P X#")).collect(); + assert_eq!(places, ["%_[0 0] /P X#", "%_[0 1] /P X#", "%_[0 2] /P X#", "%_[1 0] /P X#", "%_[1 1] /P X#", "%_[1 2] /P X#"]); + // The top left point, at 20 20 (art 20 -20): its handle down a third of the way to the next row, + // its handle to the right bent up. + let corners: Vec<&str> = sheet.lines().filter(|l| l.ends_with(" /N X#")).collect(); + assert_eq!(corners.len(), 24); + assert_eq!(corners[0], "%_[1 0 0 1 20 -20 20 -36.6667 1 35 -10 1] /N X#"); + // The color space only where it changes. + let spaces: Vec<&str> = sheet.lines().filter(|l| l.ends_with(" /CS X#")).collect(); + assert!(spaces.windows(2).all(|w| w[0] != w[1]), "{spaces:?}"); + assert!(spaces.contains(&"%_/DeviceCMYK /CS X#") && spaces.contains(&"%_/DeviceGray /CS X#"), "{spaces:?}"); + // Gray 0.2 of ink is 0.8 of lightness: the bottom left point, the second corner of the second row's first patch. + assert!(corners[13].starts_with("%_[0.8 1 20 -120 "), "{}", corners[13]); + // Only what the reader reads: no `/R` entries. + assert!(!sheet.contains("/R X#"), "{sheet}"); + // Its transparency before it; its name, then its state block, after it. + assert!(text[..start].ends_with("0 XR\n1 0.6 0 0 0 Xy\n"), "{}", &text[start.saturating_sub(80)..start]); + let rest = &text[end..]; + assert!(rest.starts_with("%_/ArtDictionary :\n%_/XMLUID : (Sheet) ; (AI10_ArtUID) ,\n%_;\n%_\n0 0 Xd\n6 () XW\n"), "{}", &rest[..200]); +} + +/// A document with meshes is written as the same bytes again, and what the reader reads back is +/// written with the same layers. +#[test] +fn meshes_write_the_same_bytes_again() { + let doc = meshes_document(); + let first = export_ai_editing(&doc, &opts()).unwrap(); + assert_eq!(first.program, export_ai_editing(&doc, &opts()).unwrap().program); + let again = String::from_utf8(export_ai_editing(&read_back(&doc), &opts()).unwrap().program).unwrap(); + let first = String::from_utf8(first.program).unwrap(); + let (again, first) = (mesh_layer_lines(&again), mesh_layer_lines(&first)); + let differ = again.iter().zip(&first).enumerate().find(|(_, (a, b))| a != b); + assert_eq!(differ, None, "the first line that differs"); + assert_eq!(again.len(), first.len()); +} + +/// The lines of the layers, `%AI5_BeginLayer` to the end. +fn mesh_layer_lines(program: &str) -> Vec<&str> { + program.lines().skip_while(|l| !l.starts_with("%AI5_BeginLayer")).collect() +} + +/// A document holding one mesh made by `make`, on a 400 × 400 page. +fn mesh_document(make: impl FnOnce(&mut Document) -> Node) -> Document { + let mut doc = Document::new(400.0, 400.0); + let layer = doc.layers[0].id; + let n = make(&mut doc); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + doc +} + +/// Whether `doc` holds a gradient mesh anywhere: on its layers (opacity masks' art included), in a +/// symbol's art or in a pattern's tile. +fn holds_a_mesh(doc: &Document) -> bool { + fn any(n: &Node) -> bool { + matches!(n.kind, NodeKind::Mesh(_)) + || n.extras().mask.as_ref().is_some_and(|m| any(&m.art)) + || n.children().is_some_and(|c| c.iter().any(|c| any(c))) + } + doc.layers.iter().any(|n| any(n)) || doc.symbols.iter().any(|s| any(&s.art)) || doc.patterns.iter().any(|p| p.art.iter().any(|n| any(n))) +} + +/// The box and color of each path with a solid fill in `nodes` and what they hold. +fn filled_paths(nodes: &[Arc], out: &mut Vec<(Rect, Color)>) { + for n in nodes { + if let NodeKind::Path { .. } = n.kind { + for item in &n.appearance.items { + if let AppearanceItem::Fill(f) = item + && let Paint::Solid { color, .. } = &f.paint + && let Some(b) = n.geometric_bounds() + { + out.push((b, *color)); + } + } + } else if let Some(c) = n.children() { + filled_paths(c, out); + } + } +} + +/// Meshes the reader wouldn't read back as they are, and meshes in places where the writer doesn't +/// write them as meshes, are written as their drawn look, with a warning: a point in a Lab color; +/// more than 128 rows (129); more than 128 columns (129); a mesh whose points all lie in one place +/// (the reader takes its rows for columns); a folded mesh, whose patches turn different ways; a +/// patch folded at one corner, by a point dragged across it or by handles that cross; a mesh +/// in art cut to a clipping object; and a mesh on a large canvas. The drawn look reads back as +/// filled paths in more than one color covering the mesh's box, and no mesh. +#[test] +fn meshes_the_reader_cant_read_are_written_as_their_drawn_look() { + let r = Rect::new(20.0, 20.0, 120.0, 120.0); + let mut cases: Vec<(&str, Document)> = vec![ + ( + "Lab point", + mesh_document(|doc| { + let mut m = grid_mesh(r, 1, 1, |_, _| Color::rgb(0.2, 0.4, 0.6)); + m.points[3].color = MINT; + mesh_node(doc, m) + }), + ), + ( + "129 rows", + mesh_document(|doc| mesh_node(doc, grid_mesh(Rect::new(20.0, 20.0, 120.0, 300.0), 129, 1, |r, _| Color::gray(r as f32 / 129.0)))), + ), + ( + "129 columns", + mesh_document(|doc| mesh_node(doc, grid_mesh(Rect::new(20.0, 20.0, 300.0, 120.0), 1, 129, |_, c| Color::gray(c as f32 / 129.0)))), + ), + ( + "folded", + mesh_document(|doc| { + let mut m = grid_mesh(r, 1, 2, |_, c| Color::rgb(0.5 * c as f32, 0.0, 0.0)); + // The right column's points fold back over the left patch; the edges are straight. + for row in 0..2 { + m.points[row * 3 + 2].p = vectorcraft_geom::Point::new(40.0, m.points[row * 3 + 2].p.y); + } + for p in &mut m.points { + p.handles = [vectorcraft_geom::Vec2::ZERO; 4]; + } + mesh_node(doc, m) + }), + ), + ( + "folded at a corner", + mesh_document(|doc| { + let mut m = grid_mesh(r, 1, 1, |_, c| Color::rgb(0.5 * c as f32, 0.0, 0.0)); + // The bottom right point is dragged across the patch's diagonal; its top left corner + // still turns as before. + m.points[3].p = vectorcraft_geom::Point::new(30.0, 30.0); + for p in &mut m.points { + p.handles = [vectorcraft_geom::Vec2::ZERO; 4]; + } + mesh_node(doc, m) + }), + ), + ( + "handles crossed", + mesh_document(|doc| { + let mut m = grid_mesh(r, 1, 1, |_, c| Color::rgb(0.5 * c as f32, 0.0, 0.0)); + // The top left point's handles cross inside the patch: the one towards the point + // below leans right of the one towards the point beside it. The corners stay put. + for p in &mut m.points { + p.handles = [vectorcraft_geom::Vec2::ZERO; 4]; + } + m.points[0].handles[vectorcraft_doc::live::H_DOWN] = vectorcraft_geom::Vec2::new(30.0, 10.0); + m.points[0].handles[vectorcraft_doc::live::H_RIGHT] = vectorcraft_geom::Vec2::new(10.0, 30.0); + mesh_node(doc, m) + }), + ), + ( + "collapsed", + mesh_document(|doc| { + let mut m = grid_mesh(r, 2, 2, |r, c| Color::rgb(0.5 * r as f32, 0.5 * c as f32, 0.0)); + for p in &mut m.points { + (p.p, p.handles) = (vectorcraft_geom::Point::new(50.0, 50.0), [vectorcraft_geom::Vec2::ZERO; 4]); + } + mesh_node(doc, m) + }), + ), + ( + "art cut to a clipping object", + mesh_document(|doc| { + let square = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(20.0, 20.0, 80.0, 80.0)), Appearance::default()); + let clipper = Node::group(doc.alloc_id(), vec![Arc::new(square)]); + let m = mesh_node(doc, grid_mesh(r, 1, 1, |_, c| Color::rgb(c as f32, 0.0, 0.0))); + Node::new(doc.alloc_id(), NodeKind::Group { children: vec![Arc::new(clipper), Arc::new(m)], clip: true }) + }), + ), + ]; + let mut large = Document::new(20000.0, 400.0); + let layer = large.layers[0].id; + let m = mesh_node(&mut large, grid_mesh(Rect::new(1000.0, 20.0, 1600.0, 320.0), 2, 2, |r, c| Color::rgb(0.5 * r as f32, 0.5 * c as f32, 0.5))); + large.insert(Some(layer), usize::MAX, m).unwrap(); + cases.push(("large canvas", large)); + let mut failed = vec![]; + for (name, doc) in &cases { + let out = export_ai_editing(doc, &opts()).unwrap(); + let warned = out.warnings.iter().any(|w| w == writer::MESHES); + let written = String::from_utf8(out.program).unwrap(); + let back = read_back(doc); + let mut paths = vec![]; + filled_paths(&back.layers, &mut paths); + let mut want = mesh_of(&meshes_in(doc)[0]).bounds().unwrap(); + if *name == "art cut to a clipping object" { + // Its drawn look is cut to the clipping object. + want = want.intersect(Rect::new(20.0, 20.0, 80.0, 80.0)); + } + let got = paths.iter().fold(None, |acc: Option, (b, _)| Some(acc.map_or(*b, |a| a.union(*b)))); + let colors = paths.iter().map(|(_, c)| format!("{c:?}")).collect::>().len(); + // The collapsed mesh has no area to cover. + let covers = *name == "collapsed" + || got.is_some_and(|g| { + (g.x0 - want.x0).abs() < 0.5 && (g.y0 - want.y0).abs() < 0.5 && (g.x1 - want.x1).abs() < 0.5 && (g.y1 - want.y1).abs() < 0.5 + }); + if !(warned && !written.contains("/Mesh X!") && !holds_a_mesh(&back) && covers && (*name == "collapsed" || colors > 1)) { + failed.push(format!("{name}: warned {warned}, box {got:?} want {want:?}, {colors} colors")); + } + } + assert!(failed.is_empty(), "written as meshes, without a warning or not as their drawn look: {failed:#?}"); +} + +/// A reflected mesh, mirrored across or along, is written as a mesh with its columns in reverse +/// order, without a warning, and reads back as that mesh: each row's points from the last to the +/// first, with their handles to the right and left swapped. +#[test] +fn a_reflected_mesh_is_written_with_its_columns_reversed() { + use vectorcraft_doc::live::{H_LEFT, H_RIGHT}; + let r = Rect::new(20.0, 20.0, 120.0, 120.0); + for (name, mirror) in [("across", Affine::new([-1.0, 0.0, 0.0, 1.0, 140.0, 0.0])), ("along", Affine::new([1.0, 0.0, 0.0, -1.0, 0.0, 140.0]))] { + let mut m = grid_mesh(r, 2, 3, |r, c| Color::rgb(0.5 * r as f32, c as f32 / 3.0, 0.2)); + m.points[5].p += vectorcraft_geom::Vec2::new(4.0, -3.0); + m.points[5].opacity = 0.5; + m.transform(mirror); + let doc = mesh_document(|doc| mesh_node(doc, m.clone())); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(!out.warnings.iter().any(|w| w == writer::MESHES), "{name}: {:?}", out.warnings); + let back = meshes_in(&read_back(&doc)); + assert_eq!(back.len(), 1, "{name}: {back:#?}"); + let width = m.cols as usize + 1; + let mut want = m.clone(); + want.points = m + .points + .chunks(width) + .flat_map(|row| { + row.iter().rev().map(|p| { + let mut p = p.clone(); + p.handles.swap(H_RIGHT, H_LEFT); + p + }) + }) + .collect(); + assert_mesh_exact(mesh_of(&back[0]), &want, name); + // It draws the same mesh: each patch's points and opacity, sampled across it, are where they + // were, in the patch at the other end of its row with u running the other way. + let got = mesh_of(&back[0]); + let cols = m.cols as usize; + let steps = [0.0, 0.25, 0.5, 0.75, 1.0]; + for r in 0..m.rows as usize { + for c in 0..cols { + for (u, v) in steps.iter().flat_map(|u| steps.iter().map(move |v| (*u, *v))) { + let (a, b) = (m.eval(r, c, u, v), got.eval(r, cols - 1 - c, 1.0 - u, v)); + assert!((a - b).hypot() < 1e-3, "{name}: patch ({r}, {c}) at ({u}, {v}): {a:?} read back as {b:?}"); + let (oa, ob) = (m.color_at(r, c, u, v).1, got.color_at(r, cols - 1 - c, 1.0 - u, v).1); + assert!((oa - ob).abs() < 1e-3, "{name}: patch ({r}, {c}) at ({u}, {v}): opacity {oa} read back as {ob}"); + } + } + } + } +} + +/// Meshes in pattern tiles, a symbol's pattern tile among them, are written as their drawn look with +/// a warning: the tile reads back with filled paths and no mesh. +#[test] +fn meshes_in_pattern_tiles_are_written_as_their_drawn_look() { + let tile = |doc: &mut Document| { + let m = mesh_node(doc, grid_mesh(Rect::new(0.0, 0.0, 60.0, 40.0), 1, 1, |_, c| Color::rgb(0.5 * c as f32, 0.2, 0.5))); + doc.patterns.push(vectorcraft_doc::PatternDef { + tile: Rect::new(0.0, 0.0, 60.0, 40.0), + ..vectorcraft_doc::PatternDef::new("Patches", vec![Arc::new(m)]) + }); + Node::path( + doc.alloc_id(), + shapes::rectangle(Rect::new(20.0, 100.0, 180.0, 180.0)), + Appearance::basic(Paint::Pattern { pattern: "Patches".into(), xf: Affine::IDENTITY }, Paint::None, 0.0), + ) + }; + let on_layer = mesh_document(tile); + let in_symbol = mesh_document(|doc| { + let art = tile(doc); + doc.symbols.push(Symbol { dynamic: false, name: "Tiled".into(), art: Arc::new(art) }); + instance(doc, "Tiled", Affine::translate((20.0, 20.0))) + }); + for (name, doc) in [("on a layer", &on_layer), ("in a symbol", &in_symbol)] { + let out = export_ai_editing(doc, &opts()).unwrap(); + assert!(out.warnings.iter().any(|w| w == writer::MESHES), "{name}: {:?}", out.warnings); + let written = String::from_utf8(out.program).unwrap(); + assert!(!written.contains("/Mesh X!"), "{name}"); + // The reader doesn't read a symbol whose art has a pattern fill whole, whatever the tile + // holds: the drawn look is checked in the program there. + if name == "in a symbol" { + assert!(written.contains("%AI3_BeginPattern: (Patches)"), "{name}"); + continue; + } + let back = read_back(doc); + assert!(!holds_a_mesh(&back), "{name}"); + let tile = back.patterns.iter().find(|p| p.name == "Patches").unwrap(); + let mut paths = vec![]; + filled_paths(&tile.art, &mut paths); + assert!(!paths.is_empty(), "{name}: {:#?}", tile.art); + } +} + +/// Meshes in an opacity mask's art, a symbol's art, an opacity mask in a symbol's art, and a +/// symbol's art in a document of several artboards (which moves the canvas's center) are written +/// as meshes and come back as meshes. +#[test] +fn meshes_in_masks_and_symbols_are_read_back() { + let r = Rect::new(0.0, 0.0, 60.0, 40.0); + let colors = |r: usize, c: usize| Color::rgb(0.5 * c as f32, 0.2, 0.5 * r as f32); + let square_with = |doc: &mut Document, fill: Paint| { + Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(20.0, 100.0, 180.0, 180.0)), Appearance::basic(fill, Paint::None, 0.0)) + }; + let mask_of = |n: &Node| n.extras().mask.as_ref().unwrap().art.clone(); + // Opacity mask. + let doc = mesh_document(|doc| { + let m = mesh_node(doc, grid_mesh(Rect::new(20.0, 100.0, 180.0, 180.0), 1, 2, colors)); + let mut n = square_with(doc, solid(Color::BLACK)); + n.extras_mut().mask = Some(Box::new(OpacityMask { art: Arc::new(m), clip: false, invert: false, disabled: false, linked: true })); + n + }); + assert!(!export_ai_editing(&doc, &opts()).unwrap().warnings.iter().any(|w| w == writer::MESHES)); + let back = read_back(&doc); + assert_mesh_exact(mesh_of(&mask_of(&back.layers[0].children().unwrap()[0])), mesh_of(&mask_of(&doc.layers[0].children().unwrap()[0])), "mask"); + // Symbol, on one artboard and with a second artboard far to the right and below. + for boards in [1, 2] { + let mut doc = mesh_document(|doc| { + let m = mesh_node(doc, grid_mesh(r, 2, 1, colors)); + doc.symbols.push(Symbol { dynamic: false, name: "Patch".into(), art: Arc::new(m) }); + instance(doc, "Patch", Affine::translate((20.0, 20.0))) + }); + if boards == 2 { + let id = doc.artboards[0].id + 1; + doc.artboards.push(Artboard { id, rect: Rect::new(3000.0, 2000.0, 3400.0, 2600.0), ..doc.artboards[0].clone() }); + } + assert!(!export_ai_editing(&doc, &opts()).unwrap().warnings.iter().any(|w| w == writer::MESHES)); + let back = read_back(&doc); + let sym = back.symbols.iter().find(|s| s.name == "Patch").unwrap(); + assert_mesh_exact(mesh_of(&sym.art), mesh_of(&doc.symbols[0].art), &format!("symbol, {boards} artboards")); + } + // An opacity mask in a symbol's art. + let doc = mesh_document(|doc| { + let m = mesh_node(doc, grid_mesh(r, 1, 2, colors)); + let mut n = square_with(doc, solid(Color::BLACK)); + n.extras_mut().mask = Some(Box::new(OpacityMask { art: Arc::new(m), clip: false, invert: false, disabled: false, linked: true })); + doc.symbols.push(Symbol { dynamic: false, name: "Masked".into(), art: Arc::new(n) }); + instance(doc, "Masked", Affine::translate((20.0, 20.0))) + }); + assert!(!export_ai_editing(&doc, &opts()).unwrap().warnings.iter().any(|w| w == writer::MESHES)); + let back = read_back(&doc); + let sym = back.symbols.iter().find(|s| s.name == "Masked").unwrap(); + assert_mesh_exact(mesh_of(&mask_of(&sym.art)), mesh_of(&mask_of(&doc.symbols[0].art)), "mask in a symbol"); +} + +/// In a symbol's art a mesh's corners are written about the canvas point of art space's origin, y +/// up, as an image's matrix there is (the template box's center is the canvas's). +#[test] +fn a_mesh_in_a_symbol_is_written_about_the_canvas_point_of_the_origin() { + let doc = mesh_document(|doc| { + let m = mesh_node(doc, grid_mesh(Rect::new(0.0, 0.0, 60.0, 40.0), 2, 1, |r, c| Color::rgb(0.5 * c as f32, 0.2, 0.5 * r as f32))); + doc.symbols.push(Symbol { dynamic: false, name: "Patch".into(), art: Arc::new(m) }); + instance(doc, "Patch", Affine::translate((20.0, 20.0))) + }); + let p = program(&doc); + let t: Vec = p.lines().find_map(|l| l.strip_prefix("%AI3_TemplateBox: ")).unwrap().split(' ').map(|v| v.parse().unwrap()).collect(); + let (ox, oy) = (f64::from(CANVAS_SIZE) / 2.0 - t[0], f64::from(CANVAS_SIZE) / 2.0 + t[1]); + let def = &p[p.find("%AI14_BeginSymbol\n(Patch)\n").unwrap()..]; + let first = def.lines().find(|l| l.ends_with(" /N X#")).unwrap(); + // The top left point, at 0 0: its handle down a third of the way to the next row, its handle + // to the right a third of the way to the next column. + let want = format!( + "%_[0 0.2 0 1 {} {} {} {} 1 {} {} 1] /N X#", + ps::num(-ox), + ps::num(oy), + ps::num(-ox), + ps::num(oy - 20.0 / 3.0), + ps::num(20.0 - ox), + ps::num(oy) + ); + assert_eq!(first, want); +} + +/// A mesh eight levels down in art written in place of symbol instances (where deeper art is left +/// out) is written as a mesh: it holds no objects of its own. A folded one there is written as its +/// drawn look, whose paths hold nothing either. +#[test] +fn a_mesh_eight_levels_down_is_written_as_a_mesh() { + let nested = |fold: bool| { + mesh_document(|doc| { + let mut m = grid_mesh(Rect::new(0.0, 0.0, 60.0, 40.0), 1, 2, |_, c| Color::rgb(0.5 * c as f32, 0.0, 0.0)); + if fold { + // The right column's points fold back over the left patch. + for row in 0..2 { + m.points[row * 3 + 2].p.x = 10.0; + } + } + let m = mesh_node(doc, m); + doc.symbols.push(Symbol { dynamic: false, name: "S0".into(), art: Arc::new(m) }); + for i in 1..8 { + let mut inner = instance(doc, &format!("S{}", i - 1), Affine::IDENTITY); + inner.isolate = true; + doc.symbols.push(Symbol { dynamic: false, name: format!("S{i}"), art: Arc::new(inner) }); + } + let mut top = instance(doc, "S7", Affine::translate((20.0, 20.0))); + top.isolate = true; + top + }) + }; + let folded = nested(true); + let out = export_ai_editing(&folded, &opts()).unwrap(); + assert!(out.warnings.iter().any(|w| w == writer::MESHES), "{:?}", out.warnings); + let back = read_back(&folded); + let mut paths = vec![]; + filled_paths(&back.layers, &mut paths); + assert!(!holds_a_mesh(&back) && paths.len() > 1, "{:#?}", back.layers); + let doc = nested(false); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(!out.warnings.iter().any(|w| w == writer::MESHES), "{:?}", out.warnings); + assert!(mesh_layer_lines(std::str::from_utf8(&out.program).unwrap()).contains(&"/Mesh X!")); + let back = meshes_in(&read_back(&doc)); + let mut want = mesh_of(&doc.symbols[0].art).clone(); + want.transform(Affine::translate((20.0, 20.0))); + assert_eq!(back.len(), 1, "{back:#?}"); + assert_mesh_exact(mesh_of(&back[0]), &want, "eight levels down"); +} diff --git a/crates/eps/src/ai_editing/writer.rs b/crates/eps/src/ai_editing/writer.rs index 35925a3962..cc44503373 100644 --- a/crates/eps/src/ai_editing/writer.rs +++ b/crates/eps/src/ai_editing/writer.rs @@ -19,6 +19,7 @@ mod blends; mod brushes; mod envelopes; mod images; +mod meshes; mod paints; mod styles; mod symbols; @@ -32,6 +33,8 @@ pub(super) use blends::unbaked_blends; pub(super) use brushes::BRUSHES; #[cfg(test)] pub(super) use envelopes::ENVELOPES; +#[cfg(test)] +pub(super) use meshes::MESHES; pub(super) use styles::{LARGE_CANVAS_STYLES, style_links, styled_definitions, styled_objects}; #[cfg(test)] pub(super) use styles::{PANEL_EMPTY, PANEL_STYLES, STYLE_LINKS, WARPED_IMAGES, same_appearance}; @@ -62,7 +65,7 @@ pub(super) const PATTERN_TILES: &str = "pattern fills with more tiles than a fil pub(super) const CLIPPING: &str = "clipping groups and clipping layers whose clipping object isn't a path, and the clipping groups inside them, are written as their art cut to that object in the editing data for other apps"; pub(super) const CLIP_PAINT: &str = "the fills and strokes of clipping paths that a plain fill and line can't draw are written as paths of their own inside the clipping (fills under the clipped art, strokes over it) in the editing data for other apps"; pub(super) const CLIP_PAINT_MASKS: &str = "the opacity masks of clipping paths whose fills and strokes are written as paths of their own stay on the clipping path, not on those paths, in the editing data for other apps"; -pub(super) const LIVE: &str = "meshes, repeats, placed documents and intertwines are written as their art in the editing data for other apps"; +pub(super) const LIVE: &str = "repeats, placed documents and intertwines are written as their art in the editing data for other apps"; pub(super) const GRAPHS: &str = "graphs are written as their art, without their data or settings, in the editing data for other apps"; pub(super) const STROKES: &str = "strokes a plain line can't draw (inside or outside the path, variable width, dots, dashes fitted to corners, gradients, patterns, arrowheads) are written as filled outlines, and brushed strokes as their brush's art, in the editing data for other apps"; pub(super) const ITEM_TRANSPARENCY: &str = @@ -308,6 +311,9 @@ pub(super) struct Writer<'a> { brush_set: brushes::Brushes, /// Brushes may be written; false on a large canvas, where they are left out. pub(super) brushes_live: bool, + /// Gradient meshes may be written as meshes; false on a large canvas, where they are written as + /// their drawn look. + pub(super) meshes_live: bool, /// The object just written is an envelope's distorted art, which the plugin's `XP` follows /// ([`Self::envelope`]). deform: bool, @@ -407,6 +413,7 @@ impl<'a> Writer<'a> { wrap_moved: false, brush_set: brushes::Brushes::default(), brushes_live: true, + meshes_live: true, deform: false, checks_left: crate::import::ENVELOPE_CHECKS, objects: 0, @@ -739,6 +746,11 @@ impl<'a> Writer<'a> { return self.styled_object(n, &orig, &name); } self.effects(n); + // A gradient mesh the reader reads as it is; else it is written as its drawn look. + let mut mesh = match &n.kind { + NodeKind::Mesh(m) => self.mesh_record(m), + _ => None, + }; self.state(n.locked, !n.visible); let mut xy = Xy::of(n); if masked_warp_pieces(n) { @@ -754,6 +766,11 @@ impl<'a> Writer<'a> { let charged = self.charges(); match &n.kind { NodeKind::Layer { .. } => {} + NodeKind::Mesh(_) if mesh.is_some() => { + if let Some(record) = mesh.take() { + self.write_mesh(&record, xy); + } + } NodeKind::Group { children, clip: true } => self.clip_group(children, xy), NodeKind::Group { children, clip: false } => { if self.open_group("u") { @@ -856,9 +873,10 @@ impl<'a> Writer<'a> { } NodeKind::Envelope { .. } if self.envelope(n, xy) => {} NodeKind::Envelope { .. } => self.drawn_art(n, xy, Some(envelopes::ENVELOPES), true), + NodeKind::Mesh(_) => self.drawn_art(n, xy, Some(meshes::MESHES), true), NodeKind::Blend { .. } if self.blend(n, xy) => {} NodeKind::Blend { .. } => self.drawn_art(n, xy, Some(blends::BLENDS), true), - NodeKind::Mesh(_) | NodeKind::Repeat(_) | NodeKind::PlacedDocument(_) | NodeKind::Intertwine { .. } => { + NodeKind::Repeat(_) | NodeKind::PlacedDocument(_) | NodeKind::Intertwine { .. } => { self.drawn_art(n, xy, Some(LIVE), true); } // Ruler guides are kept in the document's native copy only. @@ -937,7 +955,8 @@ impl<'a> Writer<'a> { self.warn(w); } let moved = bounds && self.wrap_on_bounds(n, state); - if self.nest < MAX_NEST { + // A gradient mesh's drawn look is paths, which hold nothing: it is written at any depth. + if self.nest < MAX_NEST || matches!(n.kind, NodeKind::Mesh(_)) { let g = vectorcraft_effects::expand_live_deep(Some(self.doc), n); self.nest += 1; self.drawn += 1; diff --git a/crates/eps/src/ai_editing/writer/envelopes.rs b/crates/eps/src/ai_editing/writer/envelopes.rs index 8b4ebc880d..72966faf81 100644 --- a/crates/eps/src/ai_editing/writer/envelopes.rs +++ b/crates/eps/src/ai_editing/writer/envelopes.rs @@ -5,7 +5,8 @@ //! Contents (`AIDeformEditModeKey`), a warp's style, bend, distortions and orientation //! (`DeformStyle`, `DeformValue`, `DeformHoriz`, `DeformVert`, `Rotate`), with Distort Appearance //! the size of the box the contents map from (`AIDeformArtWidthKey`, `AIDeformArtHeightKey`), the -//! contents in an `X=` … `X+` block (while they are edited, the grid) as `AIDeformArtKey`, and the +//! contents in an `X=` … `X+` block (in a symbol's art, in the canvas's space with y down; while +//! they are edited, the grid) as `AIDeformArtKey`, and the //! kind (`AIDeformStyle`: 1 a warp, 2 a mesh, 3 a top object); then the distorted art on plain //! lines, and the plugin's `XP` after it. A top object's outline is the edge of the grid written //! for it, one grid edge to each segment of its sides, a side with fewer segments than the side @@ -401,7 +402,13 @@ impl Writer<'_> { if *editing { self.grid(record.grid.as_ref()); } else if self.open_group("u") { + // In a symbol's art, the contents in the dictionary are in the canvas's space, y down. + let to_art = self.to_art; + if self.in_symbol { + self.to_art = Affine::translate(self.canvas_origin) * to_art; + } self.contents(content, true); + self.to_art = to_art; self.end_group("U", Xy::PLAIN); } let block = std::mem::replace(&mut self.body, outer); @@ -448,15 +455,17 @@ impl Writer<'_> { /// An envelope's grid, when it has one, as a gray gradient mesh (`/Mesh X!` … `/End X!`): its /// size (`[cols rows] /Size`), then each patch's place (`[col row] /P`), its four corners /// (`/N`: gray, opacity, the point, the handle towards the next corner and a weight, the handle - /// towards the previous one and a weight, in art space), from its top left one down, across and - /// up, and `/E`. One object. + /// towards the previous one and a weight, in art space; in a symbol's art, in the space a + /// gradient mesh's corners are written in there), from its top left one down, across and up, + /// and `/E`. One object. fn grid(&mut self, grid: Option<&(usize, usize, Vec)>) { let Some((rows, cols, pts)) = grid else { return }; if !self.take_objects(1) { return; } let (rows, cols, width) = (*rows, *cols, cols + 1); - let to_art = self.to_art; + // In a symbol's art, corners are written in the space a gradient mesh's are written in there. + let to_art = if self.in_symbol { self.instance_space } else { self.to_art }; let s = &mut self.body; let _ = writeln!(s, "/Mesh X!\n2 /Version X#\n/Cartesian /Type X#\n[{cols} {rows}] /Size X#\n/Data X#\n/DeviceGray /CS X#"); let num = |s: &mut String, v: f64| { diff --git a/crates/eps/src/ai_editing/writer/meshes.rs b/crates/eps/src/ai_editing/writer/meshes.rs new file mode 100644 index 0000000000..b0f3a8766c --- /dev/null +++ b/crates/eps/src/ai_editing/writer/meshes.rs @@ -0,0 +1,256 @@ +//! Gradient meshes: a mesh as the `.ai` reader reads one ([`crate::import`]'s `.ai` reader, +//! `mesh.rs` and `read/art.rs`' `end_mesh`). +//! +//! `/Mesh X!`, then on `%_` lines `value /key X#` entries: `2 /Version` (corners with an opacity), +//! `/Cartesian /Type`, `[rows cols] /Size`, `/Data` (the patches follow), and for each patch, row by +//! row, its place `[row col] /P`, the color space (`/DeviceGray`, +//! `/DeviceRGB` or `/DeviceCMYK`) with `/CS` where it changes, its four corners with `/N` and `/E`; +//! then `/End X!`. A corner is `[color… opacity x y nx ny 1 px py 1]` in art space (in a symbol's +//! art, in the canvas's space turned y up about art space's origin there, as an image's matrix in +//! it is): its color (gray as lightness), its opacity, the point, the +//! handle towards the next corner and the handle towards the one before it, each with a weight of 1. +//! The corners go from the patch's top left mesh point to the one below it, then to the right, then +//! up: the first index of `/P` runs along the first edge. The mesh's transparency is set before it +//! (`0 XR`, `Xy`), its name and opacity mask follow `/End X!` in an `/ArtDictionary`, then `0 0 Xd` +//! and `6 () XW`. +//! +//! Each record is read back with the reader's mesh reading ([`crate::import::mesh_reads`], the +//! patches and how they join; not the rest of the `.ai` reader) before it is written: a mesh it +//! would read otherwise is written as its drawn look, as are folded meshes (patches whose corners +//! turn different ways, along the handles there, or a corner with no angle), meshes in pattern +//! tiles and in art cut to a clipping object, and every mesh on a large canvas. A reflected mesh, +//! whose patches all turn the negative way, is written with its columns in reverse order: it draws +//! the same patches, and reads back with each row's points in reverse order. + +use std::fmt::Write; + +use vectorcraft_color::Color; +use vectorcraft_doc::live::{GradientMesh, H_DOWN, H_LEFT, H_RIGHT, H_UP, MeshPoint}; +use vectorcraft_geom::{Affine, Point, Vec2}; + +use super::{Writer, Xy}; +use crate::ai_ops::unit; +use crate::import::{MAX_MESH_SIDE, mesh_reads}; +use crate::ps; + +pub(in crate::ai_editing) const MESHES: &str = "gradient meshes with a point in a Lab color, with more than 128 rows or columns, folded meshes, meshes that would not open as they are drawn, meshes in pattern tiles and in art cut to a clipping object, and every gradient mesh on a large canvas are written as their drawn look in the editing data for other apps"; + +/// How far (in the document's units, at a scale of 1) a written point or handle's end may move: +/// coordinates are written to 4 decimals, which moves a point at most 0.00005 along each axis. +const SETTLE_POINT: f64 = 1e-4; +/// How far a written color channel or opacity may move: they are written to 4 decimals too. +const SETTLE_COLOR: f32 = 1e-4; + +/// The color space a corner's color is written in. +#[derive(Clone, Copy, PartialEq)] +enum Space { + Gray, + Rgb, + Cmyk, +} + +impl Space { + fn name(self) -> &'static str { + match self { + Space::Gray => "/DeviceGray", + Space::Rgb => "/DeviceRGB", + Space::Cmyk => "/DeviceCMYK", + } + } +} + +impl Writer<'_> { + /// Mesh `m`'s record as the reader reads it, or `None` when it would read it otherwise (the + /// mesh is then written as its drawn look). + pub(super) fn mesh_record(&self, m: &GradientMesh) -> Option { + // Art cut to a clipping object is written cut, which a mesh can't be. Meshes in pattern + // tiles and on a large canvas are written as their drawn look too. (A mesh holds no objects, + // so it is written as a mesh however deep it is nested.) A grid the reader doesn't read as + // one mesh is left before its record is built. + if !self.meshes_live + || self.clip.is_some() + || !self.defining.is_empty() + || !m.is_valid() + || m.rows as usize > MAX_MESH_SIDE + || m.cols as usize > MAX_MESH_SIDE + { + return None; + } + // In a symbol's art, corners are written in the space an image's matrix is written in there. + let to_art = if self.in_symbol { self.instance_space } else { self.to_art }; + // Every patch turns the positive way where it is written: from its first corner, the second + // (below it) then the fourth (beside it) go anticlockwise, y up. A reflected mesh, whose + // patches all turn the other way, is written with its columns in reverse order, which turns + // each of them the positive way and draws the same mesh; any other mesh with a patch that + // doesn't turn the positive way is written as its drawn look. + let reversed; + let m = match turns(m, to_art)? { + true => m, + false => { + reversed = columns_reversed(m); + &reversed + } + }; + let (rows, cols) = (m.rows as usize, m.cols as usize); + let at = |r: usize, c: usize| m.points.get(r * (cols + 1) + c); + // Version 2: each corner has an opacity. + let mut s = String::from("/Mesh X!\n%_2 /Version X#\n%_/Cartesian /Type X#\n"); + let _ = writeln!(s, "%_[{rows} {cols}] /Size X#\n%_/Data X#"); + let mut space = None; + for r in 0..rows { + for c in 0..cols { + let _ = writeln!(s, "%_[{r} {c}] /P X#"); + // From the top left point down, right and up; each with its handles towards the + // next corner and the one before it. + for (p, next, prev) in + [(at(r, c)?, H_DOWN, H_RIGHT), (at(r + 1, c)?, H_RIGHT, H_UP), (at(r + 1, c + 1)?, H_UP, H_LEFT), (at(r, c + 1)?, H_LEFT, H_DOWN)] + { + corner(&mut s, &mut space, to_art, p, next, prev)?; + } + s.push_str("%_/E X#\n"); + } + } + s.push_str("/End X!\n"); + let read = mesh_reads(s.as_bytes(), to_art.inverse())?; + same_mesh(&read, m, SETTLE_POINT * to_art.inverse().determinant().abs().sqrt().max(1.0)).then_some(s) + } + + /// Mesh `n` written as `record`: its transparency before it (`xy`), the record, and the block + /// its name and opacity mask go before ([`Self::node`]). The mesh is one object + /// ([`Self::take_objects`]); nothing is written when there is no room for it. + pub(super) fn write_mesh(&mut self, record: &str, xy: Xy) { + if !self.take_objects(1) { + return; + } + self.set_object_xy(xy.object()); + self.body.push_str(record); + self.block_start = self.body.len(); + self.line("0 0 Xd\n6 () XW"); + self.block_end = self.body.len(); + } +} + +/// Which way every patch of `m` turns where `to_art` takes it, at each of its four corners, from +/// its top left point to the one below it, then right and up, y up: `Some(true)` when all turn +/// anticlockwise, `Some(false)` when all turn clockwise, and `None` when they differ (a patch +/// folded across itself, or patches folded over each other) or a corner has no angle. Each corner +/// is measured twice: along the straight lines to the next corners, and along its handles (towards +/// the next corners where a handle is zero), where the patch's edges leave it. +fn turns(m: &GradientMesh, to_art: Affine) -> Option { + let (rows, cols) = (m.rows as usize, m.cols as usize); + let at = |r: usize, c: usize| m.points.get(r * (cols + 1) + c); + let mut way = None; + for r in 0..rows { + for c in 0..cols { + // Each corner with the slots of its handles towards the next corner and the one before it. + let corners = + [(at(r, c)?, H_DOWN, H_RIGHT), (at(r + 1, c)?, H_RIGHT, H_UP), (at(r + 1, c + 1)?, H_UP, H_LEFT), (at(r, c + 1)?, H_LEFT, H_DOWN)]; + for i in 0..4 { + let (before, (here, next, prev), after) = (corners[(i + 3) % 4].0, corners[i], corners[(i + 1) % 4].0); + let line = |to: &MeshPoint| to_art * to.p - to_art * here.p; + let along = |h: usize, to: &MeshPoint| -> Option { + let h = *here.handles.get(h)?; + Some(if h == Vec2::ZERO { line(to) } else { to_art * (here.p + h) - to_art * here.p }) + }; + for cross in [line(after).cross(line(before)), along(next, after)?.cross(along(prev, before)?)] { + let positive = match cross { + x if x > 0.0 => true, + x if x < 0.0 => false, + _ => return None, + }; + if *way.get_or_insert(positive) != positive { + return None; + } + } + } + } + } + way +} + +/// `m` with its columns in reverse order: each row's points from the last to the first, each +/// point's handles to the right and left swapped. It draws the same mesh. +fn columns_reversed(m: &GradientMesh) -> GradientMesh { + let width = m.cols as usize + 1; + let points = m + .points + .chunks(width) + .flat_map(|row| { + row.iter().rev().map(|p| { + let mut p = p.clone(); + p.handles.swap(H_RIGHT, H_LEFT); + p + }) + }) + .collect(); + GradientMesh { rows: m.rows, cols: m.cols, points } +} + +/// A corner `p` of a patch: its color space when it changes (in `space`), then `[color… opacity x y +/// nx ny 1 px py 1] /N X#` with its handles `next` and `prev`, `to_art` taking the document to the +/// space the corners are written in. +fn corner(s: &mut String, space: &mut Option, to_art: Affine, p: &MeshPoint, next: usize, prev: usize) -> Option<()> { + let (sp, values): (Space, Vec) = match p.color { + // The format's gray is lightness. + Color::Gray { k } => (Space::Gray, vec![1.0 - unit(k)]), + Color::Rgb { r, g, b } => (Space::Rgb, vec![unit(r), unit(g), unit(b)]), + Color::Cmyk { c, m, y, k } => (Space::Cmyk, vec![unit(c), unit(m), unit(y), unit(k)]), + // The reader reads no Lab mesh colors. + Color::Lab { .. } => return None, + }; + if *space != Some(sp) { + let _ = writeln!(s, "%_{} /CS X#", sp.name()); + *space = Some(sp); + } + let art = |q: Point| to_art * q; + let (at, n, b) = (art(p.p), art(p.p + *p.handles.get(next)?), art(p.p + *p.handles.get(prev)?)); + s.push_str("%_["); + for v in values { + ps::push_num(s, f64::from(v)); + s.push(' '); + } + ps::push_num(s, f64::from(unit(p.opacity))); + for v in [at.x, at.y, n.x, n.y] { + s.push(' '); + ps::push_num(s, v); + } + s.push_str(" 1"); + for v in [b.x, b.y] { + s.push(' '); + ps::push_num(s, v); + } + s.push_str(" 1] /N X#\n"); + Some(()) +} + +/// Whether `read` is `m` as written: the same grid, each point within `tol` of its place, each +/// handle that points into the grid within `tol` (the reader gives the others none, and they draw +/// nothing), each color in the same model and within [`SETTLE_COLOR`] a channel, and each opacity +/// within it. +fn same_mesh(read: &GradientMesh, m: &GradientMesh, tol: f64) -> bool { + if (read.rows, read.cols) != (m.rows, m.cols) || read.points.len() != m.points.len() { + return false; + } + let (rows, cols) = (m.rows as usize, m.cols as usize); + let near = |a: Point, b: Point| (a - b).hypot() <= tol * (1.0 + 1e-9 * a.to_vec2().hypot()); + read.points.iter().zip(&m.points).enumerate().all(|(i, (a, b))| { + let (r, c) = (i / (cols + 1), i % (cols + 1)); + let inside = [c < cols, c > 0, r < rows, r > 0]; + let handles = [H_RIGHT, H_LEFT, H_DOWN, H_UP].iter().zip(inside).all(|(&h, inside)| { + !inside || near(a.p + a.handles.get(h).copied().unwrap_or(Vec2::ZERO), b.p + b.handles.get(h).copied().unwrap_or(Vec2::ZERO)) + }); + near(a.p, b.p) && handles && same_color(&a.color, &b.color) && (a.opacity - unit(b.opacity)).abs() <= SETTLE_COLOR + }) +} + +/// Whether `a` is `b` as written: the same model, each channel within [`SETTLE_COLOR`] of `b`'s +/// clamped to 0 to 1. +fn same_color(a: &Color, b: &Color) -> bool { + let close = |x: &[f32], y: &[f32]| x.iter().zip(y).all(|(x, y)| (x - unit(*y)).abs() <= SETTLE_COLOR); + match (a, b) { + (Color::Gray { k }, Color::Gray { k: k2 }) => close(&[*k], &[*k2]), + (Color::Rgb { r, g, b }, Color::Rgb { r: r2, g: g2, b: b2 }) => close(&[*r, *g, *b], &[*r2, *g2, *b2]), + (Color::Cmyk { c, m, y, k }, Color::Cmyk { c: c2, m: m2, y: y2, k: k2 }) => close(&[*c, *m, *y, *k], &[*c2, *m2, *y2, *k2]), + _ => false, + } +} diff --git a/crates/eps/src/import.rs b/crates/eps/src/import.rs index fa2b9ef733..0d451ec9da 100644 --- a/crates/eps/src/import.rs +++ b/crates/eps/src/import.rs @@ -91,9 +91,9 @@ pub use ai::NameEncoding; pub(crate) use ai::objects_read; pub(crate) use ai::{ BLEND_BUDGET, BLEND_PLUGIN, BRUSH_MANAGER, BrushesRead, DEFORM_PLUGIN, EnvelopeGridPoint, MAX_BLEND_KEYS, MAX_BLEND_OBJECTS, - MAX_CHECKED as ENVELOPE_CHECKS, MAX_EDITING_OBJECTS, MAX_GRADIENT_STOPS, MAX_LISTED, MAX_LISTED_NAME, MAX_SYMBOLS, blend_reads, - brush_plugin_name, brushes_kept, envelope_outline, envelope_upright, read_art_style, read_brush_object, read_style_list, style_moves_with, - symbol_art_member, turn_brush_art_over, warp_number, + MAX_CHECKED as ENVELOPE_CHECKS, MAX_EDITING_OBJECTS, MAX_GRADIENT_STOPS, MAX_LISTED, MAX_LISTED_NAME, MAX_MESH_SIDE, MAX_SYMBOLS, blend_reads, + brush_plugin_name, brushes_kept, envelope_outline, envelope_upright, mesh_reads, read_art_style, read_brush_object, read_style_list, + style_moves_with, symbol_art_member, turn_brush_art_over, warp_number, }; #[cfg(test)] pub(crate) use ai::{ENVELOPE_DRAWN, ENVELOPE_TYPE_DRAWN}; diff --git a/crates/eps/src/import/ai.rs b/crates/eps/src/import/ai.rs index 7241ddef28..78990f9db7 100644 --- a/crates/eps/src/import/ai.rs +++ b/crates/eps/src/import/ai.rs @@ -47,6 +47,7 @@ pub(crate) use envelope::{WARPED_TYPE_DRAWN, WarpedType}; #[cfg(test)] pub(crate) use frames::TEXT_FRAME_SCANS; pub(crate) use frames::text_frames; +pub(crate) use mesh::{MAX_SIDE as MAX_MESH_SIDE, mesh_reads}; pub use obj::{NameEncoding, Names}; pub(crate) use paint::MAX_STOPS as MAX_GRADIENT_STOPS; #[cfg(test)] diff --git a/crates/eps/src/import/ai/mesh.rs b/crates/eps/src/import/ai/mesh.rs index 91e8975e90..9e8a77e5dc 100644 --- a/crates/eps/src/import/ai/mesh.rs +++ b/crates/eps/src/import/ai/mesh.rs @@ -25,7 +25,7 @@ const MAX_PATCHES: usize = 16_384; const MAX_POINTS: usize = MAX_PATCHES * 16; /// The largest grid `/Size` read as one mesh, a side. -const MAX_SIDE: usize = 128; +pub(crate) const MAX_SIDE: usize = 128; /// The most inks of an `/NChannel` colour space read. const MAX_INKS: usize = 32; /// The most rows or columns a mesh stitched from its patches may have once the lines through the @@ -556,6 +556,14 @@ impl Path { /// `a` towards `b` by `t`, in their own colour model where they share one. fn mix(a: &Color, b: &Color, t: f32) -> Color { + // At either end, that end's own color in its own model: a mesh point of a patch whose corners + // differ in model keeps its color. + if t <= 0.0 { + return *a; + } + if t >= 1.0 { + return *b; + } let l = |x: f32, y: f32| x + (y - x) * t; match (a, b) { (Color::Rgb { r, g, b: bl }, Color::Rgb { r: r2, g: g2, b: b2 }) => Color::rgb(l(*r, *r2), l(*g, *g2), l(*bl, *b2)), @@ -565,6 +573,51 @@ fn mix(a: &Color, b: &Color, t: f32) -> Color { } } +/// The most values one entry of [`mesh_reads`]' record holds (a corner of [`MAX_INKS`] inks has +/// 41). +const MAX_ENTRY: usize = 64; + +/// The gradient mesh the reader reads from `record`, a mesh's lines (`/Mesh X!` … `/End X!`, +/// entries on `%_` lines or not), with `to_doc` taking art space to the document: one mesh, or +/// `None` where the reader would read none or a group of its patches. +pub(crate) fn mesh_reads(record: &[u8], to_doc: Affine) -> Option { + use super::lex::{Lexer, Tok}; + let mut lex = Lexer::new(record); + let mut m: Option = None; + let mut stack: Vec = vec![]; + let mut marks: Vec = vec![]; + while let Some(t) = lex.next_token() { + match t.tok { + Tok::Num(v) => stack.push(V::Num(v)), + Tok::Name(n) => stack.push(V::Name(super::obj::text(n))), + Tok::Str(s) | Tok::Hex(s) => stack.push(V::Str(s)), + Tok::Word(b"[") => marks.push(stack.len()), + Tok::Word(b"]") => { + let at = marks.pop()?; + let items = stack.split_off(at.min(stack.len())); + stack.push(V::Arr(items)); + } + Tok::Word(b"X!") => match (stack.last().and_then(V::text).as_deref(), m.take()) { + (Some("Mesh"), None) => m = Some(MeshReader::default()), + (Some("End"), Some(read)) => { + if read.unread || read.patches.is_empty() { + return None; + } + return read.one_mesh().ok(); + } + _ => return None, + }, + Tok::Word(b"X#") => m.as_mut()?.entry(&std::mem::take(&mut stack), to_doc), + Tok::Comment(_) => {} + _ => return None, + } + if stack.len() > MAX_ENTRY { + return None; + } + } + None +} + #[cfg(test)] mod tests { use super::*; @@ -885,6 +938,51 @@ mod tests { assert!(!reader.unread && reader.patches[0].points[0].color == Color::gray(1.0)); } + /// `/Version` and `/Data` entries, before or after the patches, are passed over: corners with + /// and without an opacity are read by their count of values either way. + #[test] + fn version_and_data_entries_are_passed_over() { + for (with_opacity, data_first) in [(true, true), (false, true), (true, false), (false, false)] { + let mut reader = MeshReader::default(); + for (value, key) in [(V::Name("Cartesian".into()), "Type"), (nums(&[1.0, 1.0]), "Size")] { + reader.entry(&[value, V::Name(key.into())], Affine::IDENTITY); + } + if data_first { + reader.entry(&[V::Num(2.0), V::Name("Version".into())], Affine::IDENTITY); + reader.entry(&[V::Name("Data".into())], Affine::IDENTITY); + } + reader.entry(&[nums(&[0.0, 0.0]), V::Name("P".into())], Affine::IDENTITY); + let colors: [&[f64]; 4] = + if with_opacity { [&[0.5, 0.25], &[0.5, 0.25], &[0.5, 0.25], &[0.5, 0.25]] } else { [&[0.5], &[0.5], &[0.5], &[0.5]] }; + square(&mut reader, colors, Default::default()); + if !data_first { + reader.entry(&[V::Name("Data".into())], Affine::IDENTITY); + reader.entry(&[V::Num(1.0), V::Name("Version".into())], Affine::IDENTITY); + } + assert!(!reader.unread, "{with_opacity} {data_first}"); + let mesh = reader.one_mesh().unwrap(); + let want = if with_opacity { 0.25 } else { 1.0 }; + assert!(mesh.points.iter().all(|p| p.opacity == want), "{with_opacity} {data_first}: {mesh:?}"); + } + } + + /// A patch whose corners differ in color space keeps each corner's color in its own model when + /// the patches are stitched into one mesh. + #[test] + fn stitched_corners_keep_their_own_color_models() { + let cs = |n: &str| (V::Name(n.into()), "CS"); + let mut reader = MeshReader::default(); + let first = vec![(nums(&[1.0, 1.0]), "Size"), (nums(&[0.0, 0.0]), "P"), cs("DeviceRGB")]; + square( + &mut reader, + [&[1.0, 0.0, 0.0], &[0.25], &[0.0, 1.0, 0.0, 0.0], &[0.0, 0.0, 1.0]], + [first, vec![cs("DeviceGray")], vec![cs("DeviceCMYK")], vec![cs("DeviceRGB")]], + ); + let mesh = reader.one_mesh().unwrap(); + let colors: Vec = mesh.points.iter().map(|p| p.color).collect(); + assert_eq!(colors, [Color::rgb(1.0, 0.0, 0.0), Color::rgb(0.0, 0.0, 1.0), Color::gray(0.75), Color::cmyk(0.0, 1.0, 0.0, 0.0)]); + } + /// A named colour (`[c m y k /DeviceCMYK (name) /Process]`) paints at each corner's tint, 1 its /// full colour; `/NChannel` inks overprint at their tints. Ones that don't add up stay unread. #[test] diff --git a/crates/eps/src/import/ai/read.rs b/crates/eps/src/import/ai/read.rs index b045dd128f..27a10033db 100644 --- a/crates/eps/src/import/ai/read.rs +++ b/crates/eps/src/import/ai/read.rs @@ -97,7 +97,9 @@ //! have is the object's own appearance, not a link. //! //! - Symbols: `%AI14_BeginSymbol` (or `%AI10_`), `(name)`, `0 A 0 Xw 0 Ae`, the art (in the -//! symbol's space, y down), a dictionary whose `AI13PatternRegistrationType` is the registration +//! symbol's space, y down; an image's matrix and a gradient mesh's corners in the canvas's space +//! turned y up about art space's origin there, an envelope's contents in its dictionary in the +//! canvas's space, y down), a dictionary whose `AI13PatternRegistrationType` is the registration //! point (1 to 9, from the top left, row by row), `%AI10_EndSymbol`; each is read by a reader of //! its own into the document's symbols. `%AI24_BeginSymbolList` (or `%AI10_`) lists their names //! in the Symbols panel's order. An instance: `/SymbolInstance : (name) /SymbolRef , a b c d tx diff --git a/crates/eps/src/import/ai/read/art.rs b/crates/eps/src/import/ai/read/art.rs index a5e222b12f..4e7b5adc92 100644 --- a/crates/eps/src/import/ai/read/art.rs +++ b/crates/eps/src/import/ai/read/art.rs @@ -277,6 +277,18 @@ impl<'a> Reader<'a> { Ok(()) } + /// A gradient mesh's `X#` entry `vals`. In a symbol's art, corners are in the space an image's + /// matrix is in there; a mesh there in a file that doesn't say where the canvas is is unread. + pub(super) fn mesh_entry(&mut self, vals: &[V]) { + let to_doc = self.image_space(); + if let Some((m, _)) = self.mesh.as_mut() { + match to_doc { + Some(to_doc) => m.entry(vals, to_doc), + None => m.unread = true, + } + } + } + /// `/End X!`: the gradient mesh read, as one object. pub(super) fn end_mesh(&mut self) -> Result<(), String> { let Some((m, hidden)) = self.mesh.take() else { return Ok(()) }; @@ -351,11 +363,15 @@ impl<'a> Reader<'a> { pub(super) fn set_instance(&mut self, i: &Instance) { let mut to_doc = self.space(); // In a pattern's definition a gradient's `Xm` and `Bm` are written y down about the canvas point of art space's - // origin, as the file's PDF part draws them; in a symbol's, as the instances in its art are. + // origin, as the file's PDF part draws them; in a symbol's, as the instances in its art are, an envelope's + // contents' included (which `space` moves alone). if (self.pattern.is_some() || self.symbol.is_some()) && i.has_matrix() && let Some(t) = self.template { + if self.pattern.is_none() && !self.envelope_blocks.is_empty() { + to_doc = Affine::IDENTITY; + } let (cx, cy) = ((t[0] + t[2]) / 2.0, (t[1] + t[3]) / 2.0); to_doc *= Affine::new([1.0, 0.0, 0.0, -1.0, CANVAS_CENTRE - cx, CANVAS_CENTRE + cy]); } diff --git a/crates/eps/src/import/ai/read/document.rs b/crates/eps/src/import/ai/read/document.rs index 258d7d584b..f3684f3882 100644 --- a/crates/eps/src/import/ai/read/document.rs +++ b/crates/eps/src/import/ai/read/document.rs @@ -923,12 +923,17 @@ impl<'a> Reader<'a> { } /// Art space → where the art being read goes: the document, or while a pattern's definition is - /// read, the pattern's space (y down). A symbol's definition is written in the symbol's space. + /// read, the pattern's space (y down). A symbol's definition is written in the symbol's space, + /// except an envelope's contents in its dictionary (its `AIDeformArtKey` block), which are in the + /// canvas's space, y down (in the symbol's space in a file without a template box). pub(crate) fn space(&mut self) -> Affine { if self.pattern.is_some() { FLIP } else if self.symbol.is_some() { - Affine::IDENTITY + match self.canvas_origin() { + Some(o) if !self.envelope_blocks.is_empty() => Affine::translate(-o.to_vec2()), + _ => Affine::IDENTITY, + } } else { self.ensure_space() } diff --git a/crates/eps/src/import/ai/read/ops.rs b/crates/eps/src/import/ai/read/ops.rs index 721a6988ba..7369c9f938 100644 --- a/crates/eps/src/import/ai/read/ops.rs +++ b/crates/eps/src/import/ai/read/ops.rs @@ -226,10 +226,7 @@ impl<'a> Reader<'a> { } ("X!", Some("End")) if self.mesh.is_some() => return self.end_mesh(), ("X#", _) => { - let to_doc = self.space(); - if let Some((m, _)) = self.mesh.as_mut() { - m.entry(&vals, to_doc); - } + self.mesh_entry(&vals); return Ok(()); } _ if self.mesh.is_some() => return Ok(()), diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index fd50eadae4..8174644020 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -5251,6 +5251,62 @@ fn an_image_in_a_symbols_art_is_placed_from_the_canvas() { assert_eq!(r.unread.len(), 1, "{:?}", r.warnings); } +#[test] +fn a_mesh_in_a_symbols_art_is_placed_from_the_canvas() { + // The template box's center is (100.5, 50.5): art space's origin is at canvas (8091, 8242). A + // mesh's corners in a symbol's art are in the canvas's space turned y up about that point, as an + // image's matrix there is: (-8096, 8244.5) is (-5, -2.5) in the symbol's art. + let corners: String = [(-8096.0, 8244.5), (-8096.0, 8239.5), (-8086.0, 8239.5), (-8086.0, 8244.5)] + .iter() + .map(|(x, y)| format!("%_[0.5 1 {x} {y} {x} {y} 1 {x} {y} 1] /N X#\n")) + .collect(); + let mesh = format!( + "/Mesh X!\n%_2 /Version X#\n%_/Cartesian /Type X#\n%_[1 1] /Size X#\n%_/Data X#\n%_[0 0] /P X#\n%_/DeviceGray /CS X#\n{corners}%_/E X#\n/End X!\n" + ); + let doc = read_ok(&format!("%AI3_TemplateBox: 100.5 50.5 100.5 50.5\n{}{}", symbols(&symbol("Patch", &mesh, 5)), layer(""))).doc; + assert_eq!(doc.symbols.len(), 1); + let mut found = vec![]; + let mut stack = vec![doc.symbols[0].art.clone()]; + while let Some(n) = stack.pop() { + match &n.kind { + NodeKind::Mesh(m) => found.push(m.points.iter().map(|p| p.p).collect::>()), + _ => stack.extend(n.children().into_iter().flatten().cloned()), + } + } + assert_eq!(found.len(), 1, "{:?}", doc.symbols[0].art); + let want = [Point::new(-5.0, -2.5), Point::new(5.0, -2.5), Point::new(-5.0, 2.5), Point::new(5.0, 2.5)]; + assert!(want.iter().all(|w| found[0].iter().any(|p| (*p - *w).hypot() < 1e-9)), "{:?}", found[0]); + // Without a template box the mesh can't be placed, as an image there can't: the symbol isn't read + // whole and its instance comes in as the page draws it. + let group = format!("0 Ae\nu\n{}{RED}{}f\nU\n", instance("Patch", [1.0, 0.0, 0.0, -1.0, 20.0, 50.0]), rect_path(10.0, 0.0, 14.0, 4.0)); + let r = read_ok(&(symbols(&symbol("Patch", &mesh, 5)) + &layer(&group))); + assert!(r.doc.symbols.is_empty(), "{:?}", r.doc.symbols.iter().map(|s| &s.name).collect::>()); + assert!(!r.unread.is_empty(), "{:?}", r.warnings); +} + +#[test] +fn an_envelope_in_a_symbols_art_is_read_from_the_canvas() { + // An envelope's grid in a symbol's art is read in the space a gradient mesh's corners are read + // in there. A grid and contents written in the symbol's own space, as earlier VectorCraft builds + // wrote them, don't meet there: the envelope opens as the art it draws. + let drawn = format!("{RED}{}f\n", rect_path(30.0, 10.0, 170.0, 90.0)); + let env = envelope_of(&straight_mesh(1, 1, (120.0, 60.0)), ENVELOPE_KEYS, &envelope_content(), 2, &drawn); + let doc = read_ok(&format!("%AI3_TemplateBox: 100.5 50.5 100.5 50.5\n{}{}", symbols(&symbol("Bent", &env, 5)), layer(""))).doc; + assert_eq!(doc.symbols.len(), 1); + let mut envelopes = 0; + doc.symbols[0].art.walk(&mut |n| envelopes += usize::from(matches!(n.kind, NodeKind::Envelope { .. }))); + assert_eq!(envelopes, 0, "{:?}", doc.symbols[0].art); + let mut paths = 0; + doc.symbols[0].art.walk(&mut |n| paths += usize::from(matches!(n.kind, NodeKind::Path { .. }))); + assert!(paths > 0, "{:?}", doc.symbols[0].art); + // Without a template box the grid can't be placed, as a gradient mesh there can't: the symbol + // isn't read whole and its instance comes in as the page draws it. + let group = format!("0 Ae\nu\n{}{RED}{}f\nU\n", instance("Bent", [1.0, 0.0, 0.0, -1.0, 20.0, 50.0]), rect_path(10.0, 0.0, 14.0, 4.0)); + let r = read_ok(&(symbols(&symbol("Bent", &env, 5)) + &layer(&group))); + assert!(r.doc.symbols.is_empty(), "{:?}", r.doc.symbols.iter().map(|s| &s.name).collect::>()); + assert!(!r.unread.is_empty(), "{:?}", r.warnings); +} + #[test] fn an_instance_keeps_its_hide_lock_transparency_and_clip() { let m = [1.0, 0.0, 0.0, -1.0, 20.0, 50.0]; diff --git a/crates/pdf/src/settings.rs b/crates/pdf/src/settings.rs index c2f5487cbb..e1dca94b3d 100644 --- a/crates/pdf/src/settings.rs +++ b/crates/pdf/src/settings.rs @@ -465,9 +465,14 @@ impl Default for SecuritySettings { } } -/// `v` lies in `lo..=hi` (and is a number). +/// `v` lies in `lo..=hi` (and is a number). The error names the range with its unit as one value +/// (`72–2400 ppi`), so a catalog can match the message and translate it. pub(crate) fn within(name: &str, v: f64, lo: f64, hi: f64, unit: &str) -> Result<(), PdfError> { - if (lo..=hi).contains(&v) { Ok(()) } else { Err(PdfError::BadSetting(format!("{name} must be {lo}–{hi}{unit} (got {v})"))) } + if (lo..=hi).contains(&v) { + return Ok(()); + } + let range = format!("{lo}–{hi}{unit}"); + Err(PdfError::BadSetting(format!("{name} must be {range} (got {v})"))) } impl PdfSettings { diff --git a/crates/trace/src/quantize/cut_edge.rs b/crates/trace/src/quantize/cut_edge.rs index 61a9db4c8e..4e32856ef1 100644 --- a/crates/trace/src/quantize/cut_edge.rs +++ b/crates/trace/src/quantize/cut_edge.rs @@ -607,7 +607,7 @@ pub(crate) fn settle_cut_edges(q: &mut Quantized, img: &Raster, gray: bool) -> V let edge = cut_edge(img); let mut changed = false; let mut stack: Vec<(usize, usize)> = Vec::new(); - for i in 0..w * h { + for (i, blend) in blended.iter_mut().enumerate() { let mine = q.labels[i]; if mine == TRANSPARENT || !edge.get(i).copied().unwrap_or(false) { continue; @@ -630,7 +630,7 @@ pub(crate) fn settle_cut_edges(q: &mut Quantized, img: &Raster, gray: bool) -> V } } }); - blended[i] = !near.is_empty(); + *blend = !near.is_empty(); if keep || near.is_empty() { continue; } diff --git a/crates/ui-egui/src/dialogs/save_pdf.rs b/crates/ui-egui/src/dialogs/save_pdf.rs index 9a4cbfa364..af047a4cc2 100644 --- a/crates/ui-egui/src/dialogs/save_pdf.rs +++ b/crates/ui-egui/src/dialogs/save_pdf.rs @@ -761,7 +761,18 @@ fn advanced(app: &VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { } }); }); - if !flat { + if flat { + let name = get(d, "flattenerPreset").as_str().map(str::trim).filter(|n| !n.is_empty()).unwrap_or(pdf::DEFAULT_FLATTENER); + let preset_opts = FlattenOptions::for_export(Some(name), d.fields.get("flattener"), &app.session.prefs.flattener_presets).unwrap_or_default(); + let line_ppi = preset_opts.line_art_ppi.round() as u32; + let grad_ppi = preset_opts.gradient_ppi.round() as u32; + note( + ui, + &crate::i18n::fmt( + tl!("Raster resolution: {line_ppi} ppi line art and text, {grad_ppi} ppi gradient and mesh"), + &[("line_ppi", &line_ppi.to_string()), ("grad_ppi", &grad_ppi.to_string())], + ), + ); note(ui, tl!("PDF 1.3 files have no transparency: the preset flattens it.")); } } diff --git a/crates/ui-egui/src/dialogs/save_pdf/tests.rs b/crates/ui-egui/src/dialogs/save_pdf/tests.rs index 656d88b870..91442f111c 100644 --- a/crates/ui-egui/src/dialogs/save_pdf/tests.rs +++ b/crates/ui-egui/src/dialogs/save_pdf/tests.rs @@ -607,3 +607,63 @@ fn pdf_1_3_takes_a_flattener_preset_in_advanced() { let saved = app.session.prefs.pdf_presets.iter().find(|p| p.name == "Old").unwrap(); assert_eq!((saved.settings.compatibility, saved.settings.flattener_preset.as_str()), (Compatibility::Pdf13, "Low Resolution")); } + +#[test] +fn save_pdf_flattens_transparent_document_without_modal_prompt() { + let (mut app, written, _) = app(); + // Add transparent artwork to the document + app.run("transparency.set", json!({"opacity": 50})).unwrap(); + + app.run("ui.savePdfDialog", json!({"path": "/tmp/transparent.pdf", "compatibility": "1.3"})).unwrap(); + assert_eq!(app.ui.dialog.as_ref().unwrap().kind, KIND); + + // Clicking Save PDF goes ahead without stopping at a confirmation prompt + super::super::confirm(&mut app).unwrap(); + assert!(app.ui.dialog.is_none(), "Save PDF closes without a modal prompt"); + assert_eq!(written.borrow().len(), 1); + assert!(written.borrow()[0].1.starts_with(b"%PDF-1.3")); +} + +#[test] +fn summary_warnings_include_flattener_resolutions_when_flattening_transparency() { + let (mut app, _, _) = app(); + app.run("transparency.set", json!({"opacity": 50})).unwrap(); + + app.run("ui.savePdfDialog", json!({"path": "/tmp/out.pdf", "compatibility": "1.3"})).unwrap(); + let p = params(app.ui.dialog.as_ref().unwrap()); + let v = summary_of(&mut app, &egui::Context::default(), &p).unwrap(); + let warnings = v["warnings"].as_array().unwrap(); + assert!( + warnings.iter().any(|w| { + let s = w.as_str().unwrap(); + s.contains("transparency is flattened into opaque art and images") + && s.contains("at 1200 ppi line art and text, 300 ppi gradients and meshes") + }), + "{warnings:?}" + ); + + // With a custom flattener override, the resolution in the warning reflects the options + set_field(&mut app, "flattener.lineArtPpi", json!(600)); + set_field(&mut app, "flattener.gradientPpi", json!(200)); + let p2 = params(app.ui.dialog.as_ref().unwrap()); + let v2 = summary_of(&mut app, &egui::Context::default(), &p2).unwrap(); + let warnings2 = v2["warnings"].as_array().unwrap(); + assert!( + warnings2.iter().any(|w| { + let s = w.as_str().unwrap(); + s.contains("at 600 ppi line art and text, 200 ppi gradients and meshes") + }), + "{warnings2:?}" + ); +} + +#[test] +fn advanced_section_shows_raster_resolution_note() { + let (mut app, _, _) = app(); + app.run("ui.savePdfDialog", json!({"path": "/tmp/out.pdf", "compatibility": "1.3"})).unwrap(); + set_field(&mut app, "__section", json!("Advanced")); + set_field(&mut app, "flattener.lineArtPpi", json!(600)); + set_field(&mut app, "flattener.gradientPpi", json!(200)); + frame(&mut app); + assert!(app.ui.dialog.is_some()); +} diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index d54ea0178a..24578b18b2 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -683,8 +683,10 @@ const MESSAGE_DEPTH: usize = 5; /// parts of them (file names, numbers, a reason with no entry, a JSON object or array such as /// `{"objects": [...]}`, a value the message quotes in `"…"`, `“…”`, `'…'` or backticks, such as a /// symbol's or a script property's name, and an `{ident}` placeholder's value, a script identifier), -/// stay as they are. A part that starts with `{` is translated only when it is a whole message with -/// an exact entry. A part that starts with `[` is translated when it has an exact entry, such as +/// stay as they are. A `{to}` placeholder's value that is not quoted, a printer's name such as +/// `Office Laser (Floor 2)`, is translated only when it has an exact entry, such as +/// `the default printer`. A part that starts with `{` is translated only when it is a whole message +/// with an exact entry. A part that starts with `[` is translated when it has an exact entry, such as /// `[x, y] (two numbers)`, or when it fits a template that starts with `[` and an index of digits, /// such as an effect's refusal ``[0] `id`: {why}``. pub fn message(lang: Lang, s: &str) -> String { @@ -727,6 +729,7 @@ fn fill_message(lang: Lang, s: &str, found: Option<(&[String], catalog::Captures (Some((tool, _)), "_1") => (k, tool.clone()), (Some((_, kinds)), "_2") => (k, kinds.clone()), (_, "ident") => (k, v.to_string()), + (_, "to") if !quoted(v) => (k, exact_translation(lang.catalog(), v).unwrap_or_else(|| v.to_string())), _ => (k, nested(v)), }) .collect(); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index f70e91d2a8..bb039bb08e 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5470,6 +5470,19 @@ lighting Light Светлина Transform Objects Трансформиране на обекти @msg unknown parameter `{key}`; did you mean `{near}`? неизвестен параметър `{key}`; имахте ли предвид `{near}`? @msg unknown parameter `{key}`; the command takes no parameters неизвестен параметър `{key}`; командата не приема параметри +@msg unknown parameter `{key}`; `{object}` takes: {keys} неизвестен параметър `{key}`; `{object}` приема: {keys} +@msg unknown parameter `{key}`; {why_not} неизвестен параметър `{key}`; {why_not} +@msg no format takes it (see document.formats) никой формат не го приема (вижте document.formats) +@msg no save format takes it (see file.formatOptions) никой формат за записване не го приема (вижте file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF не го приема (вижте document.formats) +@msg EPS doesn't take it (see document.formats) EPS не го приема (вижте document.formats) +@msg DXF doesn't take it (see document.formats) DXF не го приема (вижте document.formats) +@msg {name} must be {range} (got {v}) {name} трябва да бъде {range} (получено {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Първият опит на графичния процесор да покаже прозореца не успя, затова VectorCraft стартира отново на {summary} (Настройки › Производителност › Графичен процесор › Автоматично използва този, който управлява вашия дисплей) +@msg Sent “{title}” to {to} “{title}” е изпратено към {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” е изпратено към {to}. Отговор на опашката за печат: {note} +@msg the default printer принтера по подразбиране +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap растерни ефекти върху обект {object}: поискани {requested} ppi, постигнати {achieved} ppi заради ограничението от 64 милиона пиксела @msg unknown parameter `{key}`; the command takes: {keys} неизвестен параметър `{key}`; командата приема: {keys} 1 Layer 1 слой 1 bit 1 бит diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 34d58f465b..99f23d313c 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -5985,6 +5985,19 @@ mark-style Japanese Japanski Transform Objects Transformiši objekte @msg unknown parameter `{key}`; did you mean `{near}`? nepoznat parametar `{key}`; da li ste mislili `{near}`? @msg unknown parameter `{key}`; the command takes no parameters nepoznat parametar `{key}`; naredba ne prima parametre +@msg unknown parameter `{key}`; `{object}` takes: {keys} nepoznat parametar `{key}`; `{object}` prima: {keys} +@msg unknown parameter `{key}`; {why_not} nepoznat parametar `{key}`; {why_not} +@msg no format takes it (see document.formats) nijedan format ga ne prima (pogledajte document.formats) +@msg no save format takes it (see file.formatOptions) nijedan format za spremanje ga ne prima (pogledajte file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF ga ne prima (pogledajte document.formats) +@msg EPS doesn't take it (see document.formats) EPS ga ne prima (pogledajte document.formats) +@msg DXF doesn't take it (see document.formats) DXF ga ne prima (pogledajte document.formats) +@msg {name} must be {range} (got {v}) {name} mora biti {range} (dobiveno {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Grafički procesor koji je prvi pokušan nije mogao prikazati prozor, pa se VectorCraft ponovo pokrenuo na {summary} (Postavke › Performanse › Grafički procesor › Automatski koristi onaj koji pokreće vaš ekran) +@msg Sent “{title}” to {to} “{title}” je poslano na {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” je poslano na {to}. Odgovor reda za štampanje: {note} +@msg the default printer zadani štampač +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap rasterski efekti na objektu {object}: traženo {requested} ppi, postignuto {achieved} ppi zbog ograničenja od 64 miliona piksela @msg unknown parameter `{key}`; the command takes: {keys} nepoznat parametar `{key}`; naredba prima: {keys} Load EPS into Clipboard Učitaj EPS u međuspremnik @msg an image of {w} × {h} pixels is too large to draw slika od {w} × {h} piksela prevelika je za crtanje diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 90944f45f6..c54311799d 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -6785,6 +6785,19 @@ liquify-list-end {0}, {1} {0} i {1} @msg panels can't be shown in Presentation Mode els panells no es poden mostrar en el mode de presentació @msg unknown parameter `{key}`; did you mean `{near}`? paràmetre desconegut `{key}`; volies dir `{near}`? @msg unknown parameter `{key}`; the command takes no parameters paràmetre desconegut `{key}`; l’ordre no admet cap paràmetre +@msg unknown parameter `{key}`; `{object}` takes: {keys} paràmetre desconegut `{key}`; `{object}` admet: {keys} +@msg unknown parameter `{key}`; {why_not} paràmetre desconegut `{key}`; {why_not} +@msg no format takes it (see document.formats) cap format no l’admet (vegeu document.formats) +@msg no save format takes it (see file.formatOptions) cap format de desament no l’admet (vegeu file.formatOptions) +@msg PDF doesn't take it (see document.formats) el PDF no l’admet (vegeu document.formats) +@msg EPS doesn't take it (see document.formats) l’EPS no l’admet (vegeu document.formats) +@msg DXF doesn't take it (see document.formats) el DXF no l’admet (vegeu document.formats) +@msg {name} must be {range} (got {v}) {name} ha de ser {range} (rebut {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) El processador gràfic provat primer no ha pogut mostrar la finestra, així que VectorCraft s’ha iniciat de nou amb {summary} (Configuració › Rendiment › Processador gràfic › Automàtic fa servir el que controla la pantalla) +@msg Sent “{title}” to {to} S’ha enviat “{title}” a {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} S’ha enviat “{title}” a {to}. Resposta de la cua d’impressió: {note} +@msg the default printer la impressora per defecte +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap efectes de ràster a l’objecte {object}: s’han demanat {requested} ppi i s’han obtingut {achieved} ppi a causa del límit de 64 milions de píxels @msg unknown parameter `{key}`; the command takes: {keys} paràmetre desconegut `{key}`; l’ordre admet: {keys} @msg the params must be an object, not {got} els paràmetres han de ser un objecte, no {got} @msg unknown parameter `{path}`; the object takes no keys paràmetre desconegut `{path}`; l’objecte no admet claus diff --git a/crates/ui-egui/src/i18n/catalog.rs b/crates/ui-egui/src/i18n/catalog.rs index 01d88af108..6f2176be3e 100644 --- a/crates/ui-egui/src/i18n/catalog.rs +++ b/crates/ui-egui/src/i18n/catalog.rs @@ -194,6 +194,26 @@ pub fn parse_entries(text: &str) -> (Vec, Vec) { (entries, errors) } +/// Whether a message can be matched against the template `source`: it has literal text and no two +/// placeholders in a row. +#[cfg(test)] +pub fn matchable(source: &str) -> bool { + Template::parse(source, Vec::new(), false).is_some() +} + +/// The sources of the `@msg` and `@msgplural` rows of a catalog file that [`Catalog::parse`] leaves +/// out, because no message can be matched against them. The interface shows the messages of such a +/// row in English. +#[cfg(test)] +pub fn unmatchable_rows(text: &str) -> Vec { + let left_out = |(ctx, src, _): &Entry| match ctx.as_str() { + "@msg" => src.contains(['{', '}']) && !matchable(src), + "@msgplural" => src.split('|').any(|english| !matchable(english)), + _ => false, + }; + parse_entries(text).0.into_iter().filter(left_out).map(|(_, src, _)| src).collect() +} + impl Catalog { pub fn parse(text: &str) -> Catalog { let mut c = Catalog::default(); diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 12329012e5..a5d7bb948a 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -6398,6 +6398,19 @@ mark-style Japanese Japonské Transform Objects Transformovat objekty @msg unknown parameter `{key}`; did you mean `{near}`? neznámý parametr `{key}`; mysleli jste `{near}`? @msg unknown parameter `{key}`; the command takes no parameters neznámý parametr `{key}`; příkaz nemá žádné parametry +@msg unknown parameter `{key}`; `{object}` takes: {keys} neznámý parametr `{key}`; `{object}` přijímá: {keys} +@msg unknown parameter `{key}`; {why_not} neznámý parametr `{key}`; {why_not} +@msg no format takes it (see document.formats) žádný formát jej nepřijímá (viz document.formats) +@msg no save format takes it (see file.formatOptions) žádný formát pro ukládání jej nepřijímá (viz file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF jej nepřijímá (viz document.formats) +@msg EPS doesn't take it (see document.formats) EPS jej nepřijímá (viz document.formats) +@msg DXF doesn't take it (see document.formats) DXF jej nepřijímá (viz document.formats) +@msg {name} must be {range} (got {v}) {name} musí být {range} (zadáno {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Grafický procesor zkoušený jako první nedokázal zobrazit okno, proto se VectorCraft znovu spustil na {summary} (Nastavení › Výkon › Grafický procesor › Automaticky použije ten, který obsluhuje váš displej) +@msg Sent “{title}” to {to} “{title}” odesláno do {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” odesláno do {to}. Odpověď tiskové fronty: {note} +@msg the default printer výchozí tiskárny +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap rastrové efekty na objektu {object}: požadováno {requested} ppi, dosaženo {achieved} ppi kvůli limitu 64 milionů pixelů @msg unknown parameter `{key}`; the command takes: {keys} neznámý parametr `{key}`; příkaz přijímá: {keys} @msg the params must be an object, not {got} parametry musí být objekt, nikoli {got} @msg unknown parameter `{path}`; the object takes no keys neznámý parametr `{path}`; objekt nepřijímá žádné klíče @@ -9711,8 +9724,6 @@ breakText Glyphs Glyfy @msg unknown panel neznámý panel @msg unknown panel `{panel}` neznámý panel `{panel}` @msg unknown parameter `{key}` neznámý parametr `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} neznámý parametr `{within}settings.{format}`; {why} -@msg unknown parameter `{within}{key}`; {why} neznámý parametr `{within}{key}`; {why} @msg unknown pieLegend `{v}` (none, standard or wedges) neznámé pieLegend `{v}` (none, standard nebo wedges) @msg unknown piePosition `{v}` (even, ratio or stacked) neznámé piePosition `{v}` (even, ratio nebo stacked) @msg unknown pieSort `{v}` (none, all or first) neznámé pieSort `{v}` (none, all nebo first) @@ -9840,7 +9851,6 @@ breakText Glyphs Glyfy @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name} je vestavěné a nelze ho odstranit @msg {name} must be a number {name} musí být číslo -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} musí být {lo}–{hi}{unit} (zadáno {v}) @msg {name}: CRC or size mismatch {name}: nesouhlasí CRC nebo velikost @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: z tohoto souboru Affinity šlo přečíst jen vložený náhled; pomocí Soubor › Otevřít ho zobrazíte s varováním, nebo před umístěním exportujte SVG či PDF z Affinity @msg {name}: {e} {name}: {e} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 92e755911e..08100f593f 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -8380,6 +8380,19 @@ mark-style Japanese Japansk Transform Objects Transformér objekter @msg unknown parameter `{key}`; did you mean `{near}`? ukendt parameter `{key}`; mente du `{near}`? @msg unknown parameter `{key}`; the command takes no parameters ukendt parameter `{key}`; kommandoen tager ingen parametre +@msg unknown parameter `{key}`; `{object}` takes: {keys} ukendt parameter `{key}`; `{object}` tager: {keys} +@msg unknown parameter `{key}`; {why_not} ukendt parameter `{key}`; {why_not} +@msg no format takes it (see document.formats) intet format tager den (se document.formats) +@msg no save format takes it (see file.formatOptions) intet arkivformat tager den (se file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF tager den ikke (se document.formats) +@msg EPS doesn't take it (see document.formats) EPS tager den ikke (se document.formats) +@msg DXF doesn't take it (see document.formats) DXF tager den ikke (se document.formats) +@msg {name} must be {range} (got {v}) {name} skal være {range} (fik {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Den grafikprocessor, der blev prøvet først, kunne ikke vise vinduet, så VectorCraft startede igen med {summary} (Indstillinger › Ydeevne › Grafikprocessor › Automatisk bruger den, der driver din skærm) +@msg Sent “{title}” to {to} Sendte “{title}” til {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} Sendte “{title}” til {to}. Svar fra udskriftskøen: {note} +@msg the default printer standardprinteren +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap rastereffekter på objekt {object}: anmodet om {requested} ppi, opnåede {achieved} ppi på grund af grænsen på 64 millioner pixel @msg unknown parameter `{key}`; the command takes: {keys} ukendt parameter `{key}`; kommandoen tager: {keys} Load EPS into Clipboard Indlæs EPS i udklipsholderen @msg an image of {w} × {h} pixels is too large to draw et billede på {w} × {h} pixels er for stort til at tegne diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index c903dc4fa5..10147b2d45 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -5971,6 +5971,19 @@ lighting Light Licht Transform Objects Objekte transformieren @msg unknown parameter `{key}`; did you mean `{near}`? unbekannter Parameter `{key}`; meinten Sie `{near}`? @msg unknown parameter `{key}`; the command takes no parameters unbekannter Parameter `{key}`; der Befehl hat keine Parameter +@msg unknown parameter `{key}`; `{object}` takes: {keys} unbekannter Parameter `{key}`; `{object}` akzeptiert: {keys} +@msg unknown parameter `{key}`; {why_not} unbekannter Parameter `{key}`; {why_not} +@msg no format takes it (see document.formats) kein Format akzeptiert ihn (siehe document.formats) +@msg no save format takes it (see file.formatOptions) kein Speicherformat akzeptiert ihn (siehe file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF akzeptiert ihn nicht (siehe document.formats) +@msg EPS doesn't take it (see document.formats) EPS akzeptiert ihn nicht (siehe document.formats) +@msg DXF doesn't take it (see document.formats) DXF akzeptiert ihn nicht (siehe document.formats) +@msg {name} must be {range} (got {v}) {name} muss {range} sein (erhalten: {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Der zuerst verwendete Grafikprozessor konnte das Fenster nicht anzeigen, daher wurde VectorCraft auf {summary} neu gestartet (Einstellungen › Leistung › Grafikprozessor › Automatisch verwendet den, der Ihren Bildschirm ansteuert) +@msg Sent “{title}” to {to} “{title}” an {to} gesendet +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” an {to} gesendet. Antwort der Druckwarteschlange: {note} +@msg the default printer den Standarddrucker +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap Rastereffekte auf Objekt {object}: {requested} ppi angefordert, {achieved} ppi erreicht wegen der Obergrenze von 64 Millionen Pixeln @msg unknown parameter `{key}`; the command takes: {keys} unbekannter Parameter `{key}`; der Befehl akzeptiert: {keys} @msg the params must be an object, not {got} die Parameter müssen ein Objekt sein, nicht {got} @msg unknown parameter `{path}`; the object takes no keys unbekannter Parameter `{path}`; das Objekt akzeptiert keine Schlüssel @@ -7881,8 +7894,6 @@ breakText Glyphs Glyphen @msg unknown dither `{d}` (diffusion, pattern, noise or none) unbekanntes Dithering `{d}` (diffusion, pattern, noise oder none) @msg unknown panel `{panel}` unbekanntes Bedienfeld `{panel}` @msg unknown parameter `{key}` unbekannter Parameter `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} unbekannter Parameter `{within}settings.{format}`; {why} -@msg unknown parameter `{within}{key}`; {why} unbekannter Parameter `{within}{key}`; {why} @msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) unbekannte Reduzierung `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform oder document) @msg unmatched ')' ')' ohne Gegenstück @msg unterminated character class nicht abgeschlossene Zeichenklasse @@ -9303,7 +9314,6 @@ breakText Glyphs Glyphen @msg {label} must be a number from 1 to 10000 {label} muss eine Zahl von 1 bis 10000 sein @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name} ist integriert und kann nicht gelöscht werden -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} muss {lo}–{hi}{unit} sein (erhalten: {v}) @msg {name}: CRC or size mismatch {name}: CRC oder Größe stimmt nicht überein @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: nur die eingebettete Vorschau dieser Affinity-Datei konnte gelesen werden; verwenden Sie Datei › Öffnen, um sie mit ihrer Warnung zu sehen, oder exportieren Sie vor dem Platzieren SVG oder PDF aus Affinity @msg {name}: {e} {name}: {e} diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 8d9aa619c1..1ebf6e5684 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5786,6 +5786,19 @@ digits Malayalam Μαλαγιάλαμ Transform Objects Μετασχηματισμός αντικειμένων @msg unknown parameter `{key}`; did you mean `{near}`? άγνωστη παράμετρος `{key}`· μήπως εννοείτε `{near}`; @msg unknown parameter `{key}`; the command takes no parameters άγνωστη παράμετρος `{key}`· η εντολή δεν δέχεται παραμέτρους +@msg unknown parameter `{key}`; `{object}` takes: {keys} άγνωστη παράμετρος `{key}`· το `{object}` δέχεται: {keys} +@msg unknown parameter `{key}`; {why_not} άγνωστη παράμετρος `{key}`· {why_not} +@msg no format takes it (see document.formats) καμία μορφή δεν τη δέχεται (δείτε document.formats) +@msg no save format takes it (see file.formatOptions) καμία μορφή αποθήκευσης δεν τη δέχεται (δείτε file.formatOptions) +@msg PDF doesn't take it (see document.formats) το PDF δεν τη δέχεται (δείτε document.formats) +@msg EPS doesn't take it (see document.formats) το EPS δεν τη δέχεται (δείτε document.formats) +@msg DXF doesn't take it (see document.formats) το DXF δεν τη δέχεται (δείτε document.formats) +@msg {name} must be {range} (got {v}) το {name} πρέπει να είναι {range} (δόθηκε {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Ο αρχικός επεξεργαστής γραφικών δεν μπόρεσε να εμφανίσει το παράθυρο και το VectorCraft επανεκκίνησε στον {summary} (Ρυθμίσεις › Επιδόσεις › Επεξεργαστής γραφικών › Αυτόματο: χρησιμοποιεί αυτόν που οδηγεί την οθόνη σας) +@msg Sent “{title}” to {to} Το “{title}” στάλθηκε: {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} Το “{title}” στάλθηκε: {to}. Απάντηση της ουράς εκτύπωσης: {note} +@msg the default printer προεπιλεγμένος εκτυπωτής +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap εφέ ράστερ στο αντικείμενο {object}: ζητήθηκαν {requested} ppi, επιτεύχθηκαν {achieved} ppi λόγω του ορίου των 64 εκατομμυρίων pixel @msg unknown parameter `{key}`; the command takes: {keys} άγνωστη παράμετρος `{key}`· η εντολή δέχεται: {keys} @msg the params must be an object, not {got} οι παράμετροι πρέπει να είναι αντικείμενο, όχι {got} @msg unknown parameter `{path}`; the object takes no keys άγνωστη παράμετρος `{path}`· το αντικείμενο δεν δέχεται κλειδιά diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 8e79de7aee..a456910a16 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -6366,6 +6366,19 @@ mark-style Japanese Japonesas Transform Objects Transformar objetos @msg unknown parameter `{key}`; did you mean `{near}`? parámetro desconocido `{key}`; ¿quiso decir `{near}`? @msg unknown parameter `{key}`; the command takes no parameters parámetro desconocido `{key}`; el comando no tiene parámetros +@msg unknown parameter `{key}`; `{object}` takes: {keys} parámetro desconocido `{key}`; `{object}` acepta: {keys} +@msg unknown parameter `{key}`; {why_not} parámetro desconocido `{key}`; {why_not} +@msg no format takes it (see document.formats) ningún formato lo acepta (consulte document.formats) +@msg no save format takes it (see file.formatOptions) ningún formato de guardado lo acepta (consulte file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF no lo acepta (consulte document.formats) +@msg EPS doesn't take it (see document.formats) EPS no lo acepta (consulte document.formats) +@msg DXF doesn't take it (see document.formats) DXF no lo acepta (consulte document.formats) +@msg {name} must be {range} (got {v}) {name} debe ser {range} (se recibió {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) El procesador gráfico probado primero no pudo mostrar la ventana, así que VectorCraft se inició de nuevo con {summary} (Ajustes › Rendimiento › Procesador gráfico › Automático usa el que controla su pantalla) +@msg Sent “{title}” to {to} Se envió “{title}” a {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} Se envió “{title}” a {to}. Respuesta de la cola de impresión: {note} +@msg the default printer la impresora predeterminada +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap efectos de rasterizado en el objeto {object}: se solicitaron {requested} ppi y se alcanzaron {achieved} ppi debido al límite de 64 millones de píxeles @msg unknown parameter `{key}`; the command takes: {keys} parámetro desconocido `{key}`; el comando acepta: {keys} @msg the params must be an object, not {got} los parámetros deben ser un objeto, no {got} @msg unknown parameter `{path}`; the object takes no keys parámetro desconocido `{path}`; el objeto no acepta claves diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index ca31405019..bff46fc0d7 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -6307,6 +6307,19 @@ mark-style Japanese Japanilainen Transform Objects Muunna objekteja @msg unknown parameter `{key}`; did you mean `{near}`? tuntematon parametri `{key}`; tarkoititko `{near}`? @msg unknown parameter `{key}`; the command takes no parameters tuntematon parametri `{key}`; komento ei ota parametreja +@msg unknown parameter `{key}`; `{object}` takes: {keys} tuntematon parametri `{key}`; kohteen `{object}` avaimet: {keys} +@msg unknown parameter `{key}`; {why_not} tuntematon parametri `{key}`; {why_not} +@msg no format takes it (see document.formats) mikään muoto ei käytä sitä (katso document.formats) +@msg no save format takes it (see file.formatOptions) mikään tallennusmuoto ei käytä sitä (katso file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF ei käytä sitä (katso document.formats) +@msg EPS doesn't take it (see document.formats) EPS ei käytä sitä (katso document.formats) +@msg DXF doesn't take it (see document.formats) DXF ei käytä sitä (katso document.formats) +@msg {name} must be {range} (got {v}) arvon {name} on oltava {range} (saatiin {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Ensin kokeiltu grafiikkasuoritin ei pystynyt näyttämään ikkunaa, joten VectorCraft käynnistyi uudelleen: {summary} (Asetukset › Suorituskyky › Grafiikkasuoritin › Automaattinen käyttää näyttöäsi ohjaavaa suoritinta) +@msg Sent “{title}” to {to} “{title}” lähetettiin kohteeseen {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” lähetettiin kohteeseen {to}. Tulostusjonon vastaus: {note} +@msg the default printer oletustulostin +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap rasteritehosteet objektissa {object}: pyydettiin {requested} ppi, saatiin {achieved} ppi 64 miljoonan pikselin rajan vuoksi @msg unknown parameter `{key}`; the command takes: {keys} tuntematon parametri `{key}`; komennon parametrit: {keys} @msg the params must be an object, not {got} parametrien on oltava objekti, ei {got} @msg unknown parameter `{path}`; the object takes no keys tuntematon parametri `{path}`; objekti ei ota avaimia diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index f58e367ede..3be3497f97 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -5966,6 +5966,19 @@ lighting Light Lumière Transform Objects Transformer les objets @msg unknown parameter `{key}`; did you mean `{near}`? paramètre inconnu `{key}` ; vouliez-vous dire `{near}` ? @msg unknown parameter `{key}`; the command takes no parameters paramètre inconnu `{key}` ; la commande n’a aucun paramètre +@msg unknown parameter `{key}`; `{object}` takes: {keys} paramètre inconnu `{key}` ; `{object}` accepte : {keys} +@msg unknown parameter `{key}`; {why_not} paramètre inconnu `{key}` ; {why_not} +@msg no format takes it (see document.formats) aucun format ne l’accepte (voir document.formats) +@msg no save format takes it (see file.formatOptions) aucun format d’enregistrement ne l’accepte (voir file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF ne l’accepte pas (voir document.formats) +@msg EPS doesn't take it (see document.formats) EPS ne l’accepte pas (voir document.formats) +@msg DXF doesn't take it (see document.formats) DXF ne l’accepte pas (voir document.formats) +@msg {name} must be {range} (got {v}) {name} doit valoir {range} (reçu : {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Le processeur graphique essayé en premier n’a pas pu afficher la fenêtre : VectorCraft a redémarré sur {summary} (Réglages › Performances › Processeur graphique › Automatique utilise celui qui pilote votre écran) +@msg Sent “{title}” to {to} “{title}” envoyé vers {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” envoyé vers {to}. Réponse de la file d’impression : {note} +@msg the default printer l’imprimante par défaut +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap effets de pixellisation sur l’objet {object} : {requested} ppi demandés, {achieved} ppi obtenus en raison de la limite de 64 millions de pixels @msg unknown parameter `{key}`; the command takes: {keys} paramètre inconnu `{key}` ; la commande accepte : {keys} @msg the params must be an object, not {got} les paramètres doivent être un objet, pas {got} @msg unknown parameter `{path}`; the object takes no keys paramètre inconnu `{path}` ; l’objet n’accepte aucune clé @@ -9567,8 +9580,6 @@ breakText Glyphs Glyphes @msg unknown panel panneau inconnu @msg unknown panel `{panel}` panneau inconnu `{panel}` @msg unknown parameter `{key}` paramètre inconnu `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} paramètre inconnu `{within}settings.{format}` ; {why} -@msg unknown parameter `{within}{key}`; {why} paramètre inconnu `{within}{key}` ; {why} @msg unknown pieLegend `{v}` (none, standard or wedges) pieLegend inconnu `{v}` (none, standard ou wedges) @msg unknown piePosition `{v}` (even, ratio or stacked) piePosition inconnu `{v}` (even, ratio ou stacked) @msg unknown pieSort `{v}` (none, all or first) pieSort inconnu `{v}` (none, all ou first) @@ -9695,7 +9706,6 @@ breakText Glyphs Glyphes @msg {label} must be a number from 1 to 10000 {label} doit être un nombre compris entre 1 et 10000 @msg {name} `{s}`: {ids} {name} `{s}` : {ids} @msg {name} is built in and can't be deleted {name} est intégré et ne peut pas être supprimé -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} doit être compris entre {lo} et {hi}{unit} (reçu : {v}) @msg {name}: CRC or size mismatch {name} : CRC ou taille incohérents @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name} : seul l’aperçu incorporé de ce fichier Affinity a pu être lu ; utilisez Fichier › Ouvrir pour l’afficher avec son avertissement, ou exportez en SVG ou PDF depuis Affinity avant de l’importer @msg {name}: {e} {name} : {e} diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index dbf4c2ded9..cbfb4f51d1 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -6165,7 +6165,7 @@ antiAlias Sharp शार्प @msg {label}… {label}... @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name} बनाया गया है और इसे हटाया नहीं जा सकता है। -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} को {lo}-{hi}{unit} ({v}) होना चाहिए। +@msg {name} must be {range} (got {v}) {name} को {range} होना चाहिए ({v} मिला) @msg {name}: {e} {name}: {e} @msg {name}: CRC mismatch {name}: CRC mismatch @msg {name}: CRC or size mismatch {name}: CRC या आकार मेल नहीं खाता @@ -8906,6 +8906,18 @@ liquify-list-end {0}, {1} {0} और {1} @msg panels can't be shown in Presentation Mode प्रस्तुति मोड में पैनल्स नहीं दिखाए जा सकते @msg unknown parameter `{key}`; did you mean `{near}`? अज्ञात पैरामीटर `{key}`; क्या आपको `{near}` का मतलब है? @msg unknown parameter `{key}`; the command takes no parameters अज्ञात पैरामीटर `{key}`; कमांड कोई पैरामीटर नहीं लेता है +@msg unknown parameter `{key}`; `{object}` takes: {keys} अज्ञात पैरामीटर `{key}`; `{object}` लेता है: {keys} +@msg unknown parameter `{key}`; {why_not} अज्ञात पैरामीटर `{key}`; {why_not} +@msg no format takes it (see document.formats) कोई फ़ॉर्मैट इसे नहीं लेता (document.formats देखें) +@msg no save format takes it (see file.formatOptions) कोई सेव फ़ॉर्मैट इसे नहीं लेता (file.formatOptions देखें) +@msg PDF doesn't take it (see document.formats) PDF इसे नहीं लेता (document.formats देखें) +@msg EPS doesn't take it (see document.formats) EPS इसे नहीं लेता (document.formats देखें) +@msg DXF doesn't take it (see document.formats) DXF इसे नहीं लेता (document.formats देखें) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) पहले आज़माया गया ग्राफिक्स प्रोसेसर विंडो नहीं दिखा सका, इसलिए VectorCraft फिर से {summary} पर शुरू हुआ (सेटिंग्स › प्रदर्शन › ग्राफिक्स प्रोसेसर › स्वचालित उस प्रोसेसर का उपयोग करता है जो आपका डिस्प्ले चलाता है) +@msg Sent “{title}” to {to} “{title}” को {to} पर भेजा गया +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” को {to} पर भेजा गया। प्रिंट कतार का उत्तर: {note} +@msg the default printer डिफ़ॉल्ट प्रिंटर +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap ऑब्जेक्ट {object} पर रास्टर इफ़ेक्ट: {requested} ppi माँगा गया, 64 मिलियन पिक्सेल की सीमा के कारण {achieved} ppi मिला @msg unknown parameter `{key}`; the command takes: {keys} अज्ञात पैरामीटर `{key}`; कमांड लेता है: {keys} @msg the params must be an object, not {got} पैरामीटर एक ऑब्जेक्ट होने चाहिए, {got} नहीं @msg unknown parameter `{path}`; the object takes no keys अज्ञात पैरामीटर `{path}`; ऑब्जेक्ट कोई कुंजी नहीं लेता diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 8cff443416..0f81a72036 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -6382,6 +6382,19 @@ liquify-list-end {0}, {1} {0} és {1} Transform Objects Objektumok transzformálása @msg unknown parameter `{key}`; did you mean `{near}`? ismeretlen paraméter: `{key}`; erre gondolt: `{near}`? @msg unknown parameter `{key}`; the command takes no parameters ismeretlen paraméter: `{key}`; a parancsnak nincs paramétere +@msg unknown parameter `{key}`; `{object}` takes: {keys} ismeretlen paraméter: `{key}`; a(z) `{object}` ezeket fogadja el: {keys} +@msg unknown parameter `{key}`; {why_not} ismeretlen paraméter: `{key}`; {why_not} +@msg no format takes it (see document.formats) egyik formátum sem fogadja el (lásd: document.formats) +@msg no save format takes it (see file.formatOptions) egyik mentési formátum sem fogadja el (lásd: file.formatOptions) +@msg PDF doesn't take it (see document.formats) a PDF nem fogadja el (lásd: document.formats) +@msg EPS doesn't take it (see document.formats) az EPS nem fogadja el (lásd: document.formats) +@msg DXF doesn't take it (see document.formats) a DXF nem fogadja el (lásd: document.formats) +@msg {name} must be {range} (got {v}) a(z) {name} értéke {range} lehet (kapott érték: {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Az először kipróbált grafikus processzor nem tudta megjeleníteni az ablakot, ezért a VectorCraft újraindult ezen: {summary} (Beállítások › Teljesítmény › Grafikus processzor › Automatikus: azt használja, amelyik a kijelzőt hajtja) +@msg Sent “{title}” to {to} “{title}” elküldve ide: {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” elküldve ide: {to}. A nyomtatási sor válasza: {note} +@msg the default printer alapértelmezett nyomtató +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap raszteres effektusok a(z) {object} objektumon: kért felbontás {requested} ppi, elért felbontás {achieved} ppi a 64 millió képpontos korlát miatt @msg unknown parameter `{key}`; the command takes: {keys} ismeretlen paraméter: `{key}`; a parancs ezeket fogadja el: {keys} @msg the params must be an object, not {got} a paramétereknek objektumnak kell lenniük, nem ez: {got} @msg unknown parameter `{path}`; the object takes no keys ismeretlen paraméter: `{path}`; az objektum nem fogad el kulcsokat @@ -9581,8 +9594,6 @@ breakText Glyphs Glifák @msg unknown panel ismeretlen panel @msg unknown panel `{panel}` ismeretlen panel: `{panel}` @msg unknown parameter `{key}` ismeretlen paraméter: `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} ismeretlen paraméter: `{within}settings.{format}`; {why} -@msg unknown parameter `{within}{key}`; {why} ismeretlen paraméter: `{within}{key}`; {why} @msg unknown pieLegend `{v}` (none, standard or wedges) ismeretlen pieLegend: `{v}` (none, standard vagy wedges) @msg unknown piePosition `{v}` (even, ratio or stacked) ismeretlen piePosition: `{v}` (even, ratio vagy stacked) @msg unknown pieSort `{v}` (none, all or first) ismeretlen pieSort: `{v}` (none, all vagy first) @@ -9710,7 +9721,6 @@ breakText Glyphs Glifák @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name}: beépített elem, nem törölhető @msg {name} must be a number {name}: szám kell -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name}: {lo}–{hi}{unit} kell (kapott érték: {v}) @msg {name}: CRC or size mismatch {name}: a CRC vagy a méret nem egyezik @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: ennek az Affinity-fájlnak csak a beágyazott előnézete volt olvasható; a Fájl › Megnyitás paranccsal megnézheted a figyelmeztetésével együtt, vagy az elhelyezés előtt exportálj SVG-t vagy PDF-et az Affinityből @msg {name}: {e} {name}: {e} diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 40dae4c1dd..28ea2b5ab3 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5624,6 +5624,19 @@ mark-style Japanese Jepang Transform Objects Transformasikan objek @msg unknown parameter `{key}`; did you mean `{near}`? parameter `{key}` tidak dikenal; apakah maksud Anda `{near}`? @msg unknown parameter `{key}`; the command takes no parameters parameter `{key}` tidak dikenal; perintah tidak menerima parameter +@msg unknown parameter `{key}`; `{object}` takes: {keys} parameter `{key}` tidak dikenal; `{object}` menerima: {keys} +@msg unknown parameter `{key}`; {why_not} parameter `{key}` tidak dikenal; {why_not} +@msg no format takes it (see document.formats) tidak ada format yang menerimanya (lihat document.formats) +@msg no save format takes it (see file.formatOptions) tidak ada format penyimpanan yang menerimanya (lihat file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF tidak menerimanya (lihat document.formats) +@msg EPS doesn't take it (see document.formats) EPS tidak menerimanya (lihat document.formats) +@msg DXF doesn't take it (see document.formats) DXF tidak menerimanya (lihat document.formats) +@msg {name} must be {range} (got {v}) {name} harus {range} (diperoleh {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Prosesor grafis yang dicoba pertama kali tidak dapat menampilkan jendela, jadi VectorCraft memulai ulang dengan {summary} (Pengaturan › Kinerja › Prosesor grafis › Otomatis menggunakan prosesor yang menjalankan layar Anda) +@msg Sent “{title}” to {to} “{title}” dikirim ke {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” dikirim ke {to}. Balasan antrean cetak: {note} +@msg the default printer printer bawaan +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap efek raster pada objek {object}: diminta {requested} ppi, tercapai {achieved} ppi karena batas 64 juta piksel @msg unknown parameter `{key}`; the command takes: {keys} parameter `{key}` tidak dikenal; perintah menerima: {keys} Load EPS into Clipboard Muat EPS ke papan klip @msg an image of {w} × {h} pixels is too large to draw gambar {w} × {h} piksel terlalu besar untuk digambar diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index fa27956034..8f2ed3216c 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -6015,6 +6015,19 @@ lighting Light Luce Transform Objects Trasforma oggetti @msg unknown parameter `{key}`; did you mean `{near}`? parametro sconosciuto `{key}`; forse intendevate `{near}`? @msg unknown parameter `{key}`; the command takes no parameters parametro sconosciuto `{key}`; il comando non ha parametri +@msg unknown parameter `{key}`; `{object}` takes: {keys} parametro sconosciuto `{key}`; `{object}` accetta: {keys} +@msg unknown parameter `{key}`; {why_not} parametro sconosciuto `{key}`; {why_not} +@msg no format takes it (see document.formats) nessun formato lo accetta (vedere document.formats) +@msg no save format takes it (see file.formatOptions) nessun formato di salvataggio lo accetta (vedere file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF non lo accetta (vedere document.formats) +@msg EPS doesn't take it (see document.formats) EPS non lo accetta (vedere document.formats) +@msg DXF doesn't take it (see document.formats) DXF non lo accetta (vedere document.formats) +@msg {name} must be {range} (got {v}) {name} deve essere {range} (ricevuto {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Il processore grafico provato per primo non è riuscito a mostrare la finestra, quindi VectorCraft è stato riavviato con {summary} (Impostazioni › Prestazioni › Processore grafico › Automatico usa quello che gestisce lo schermo) +@msg Sent “{title}” to {to} “{title}” inviato a: {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” inviato a: {to}. Risposta della coda di stampa: {note} +@msg the default printer stampante predefinita +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap effetti raster sull'oggetto {object}: richiesti {requested} ppi, ottenuti {achieved} ppi a causa del limite di 64 milioni di pixel @msg unknown parameter `{key}`; the command takes: {keys} parametro sconosciuto `{key}`; il comando accetta: {keys} @msg the params must be an object, not {got} i parametri devono essere un oggetto, non {got} @msg unknown parameter `{path}`; the object takes no keys parametro sconosciuto `{path}`; l'oggetto non accetta chiavi @@ -7931,7 +7944,6 @@ breakText Glyphs Glifi @msg unknown dither `{d}` (diffusion, pattern, noise or none) dithering sconosciuto `{d}` (diffusion, pattern, noise o none) @msg unknown panel `{panel}` pannello sconosciuto `{panel}` @msg unknown parameter `{key}` parametro sconosciuto `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} parametro sconosciuto `{within}settings.{format}`; {why} @msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) riduzione sconosciuta `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform o document) @msg unmatched ')' ')' senza corrispondenza @msg unterminated character class classe di caratteri non terminata @@ -9490,9 +9502,7 @@ breakText Glyphs Glifi @msg the spacing makes more than {MAX_GROMMETS} grommets la spaziatura produce più di {MAX_GROMMETS} occhielli @msg there is no banner to mark non c'è nessuno striscione da contrassegnare @msg turn on at least one side attiva almeno un lato -@msg unknown parameter `{within}{key}`; {why} parametro sconosciuto `{within}{key}`; {why} @msg with no hem and no grommets there is nothing to mark senza orlo e senza occhielli non c'è nulla da contrassegnare -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} deve essere {lo}–{hi}{unit} (ricevuto {v}) @msg {saving} failed: {e} {saving} non riuscito: {e} Banner Hems and Grommets… Orli e occhielli per striscioni… Banner Hems and Grommets Orli e occhielli per striscioni diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index d50e53c366..c429f204a1 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -6059,6 +6059,19 @@ lighting Light ライト Transform Objects オブジェクトの変形 @msg unknown parameter `{key}`; did you mean `{near}`? `{key}` は不明なパラメーターです。`{near}` のことですか? @msg unknown parameter `{key}`; the command takes no parameters `{key}` は不明なパラメーターです。このコマンドにパラメーターはありません +@msg unknown parameter `{key}`; `{object}` takes: {keys} `{key}` は不明なパラメーターです。`{object}` で使えるキー: {keys} +@msg unknown parameter `{key}`; {why_not} `{key}` は不明なパラメーターです。{why_not} +@msg no format takes it (see document.formats) このオプションを使う形式はありません (document.formats を参照) +@msg no save format takes it (see file.formatOptions) このオプションを使う保存形式はありません (file.formatOptions を参照) +@msg PDF doesn't take it (see document.formats) PDF では使えません (document.formats を参照) +@msg EPS doesn't take it (see document.formats) EPS では使えません (document.formats を参照) +@msg DXF doesn't take it (see document.formats) DXF では使えません (document.formats を参照) +@msg {name} must be {range} (got {v}) {name} は {range} にしてください (指定値: {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) 最初に試したグラフィックスプロセッサーではウィンドウを表示できなかったため、{summary} で VectorCraft を再起動しました (環境設定 › パフォーマンス › グラフィックプロセッサー › 自動 では、ディスプレイを駆動しているプロセッサーを使います) +@msg Sent “{title}” to {to} “{title}” を {to} に送信しました +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” を {to} に送信しました。印刷キューの応答: {note} +@msg the default printer デフォルトのプリンター +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap オブジェクト {object} のラスター効果: 要求は {requested} ppi ですが、6400 万ピクセルの上限により {achieved} ppi になりました @msg unknown parameter `{key}`; the command takes: {keys} `{key}` は不明なパラメーターです。このコマンドで使えるパラメーター: {keys} @msg the params must be an object, not {got} パラメーターはオブジェクトにしてください ({got} は使えません) @msg unknown parameter `{path}`; the object takes no keys `{path}` は不明なパラメーターです。このオブジェクトにはキーを指定できません @@ -7085,8 +7098,6 @@ axis Y Axis Y 軸 @msg unknown dither `{d}` (diffusion, pattern, noise or none) `{d}` は不明なディザの指定です (diffusion、pattern、noise、none のいずれか) @msg unknown panel `{panel}` `{panel}` は不明なパネルです @msg unknown parameter `{key}` `{key}` は不明なパラメーターです -@msg unknown parameter `{within}settings.{format}`; {why} `{within}settings.{format}` は不明なパラメーターです。{why} -@msg unknown parameter `{within}{key}`; {why} `{within}{key}` は不明なパラメーターです。{why} @msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) `{reduction}` は不明な減色の指定です (selective、perceptual、adaptive、web、gray、blackWhite、uniform、document のいずれか) @msg unmatched ')' 対応していない ')' があります @msg unterminated character class 文字クラスが閉じられていません @@ -8507,7 +8518,6 @@ axis Y Axis Y 軸 @msg {label} must be a number from 1 to 10000 {label} には 1 から 10000 までの数値を指定してください @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name} は組み込みのため、削除できません -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} には {lo}–{hi}{unit} を指定してください (指定値: {v}) @msg {name}: CRC or size mismatch {name}: CRC またはサイズが一致しません @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: この Affinity ファイルは埋め込みプレビューしか読み込めませんでした。「ファイル › 開く」で警告とともに表示するか、配置する前に Affinity から SVG または PDF を書き出してください @msg {name}: {e} {name}: {e} diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 775771803e..414f45171c 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -1807,8 +1807,6 @@ @msg unknown panel უცნობი პანელი @msg unknown panel `{panel}` უცნობი პანელი `{panel}` @msg unknown parameter `{key}` უცნობი პარამეტრი `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} უცნობი პარამეტრი `{within}settings.{format}`; {why} -@msg unknown parameter `{within}{key}`; {why} უცნობი პარამეტრი `{within}{key}`; {why} @msg unknown pieLegend `{v}` (none, standard or wedges) უცნობი pieLegend `{v}` (none, standard ან wedges) @msg unknown piePosition `{v}` (even, ratio or stacked) უცნობი piePosition `{v}` (even, ratio ან stacked) @msg unknown pieSort `{v}` (none, all or first) უცნობი pieSort `{v}` (none, all ან first) @@ -1941,7 +1939,6 @@ @msg {name} is not a CMYK profile {name} CMYK პროფილი არ არის @msg {name} is not an RGB profile {name} RGB პროფილი არ არის @msg {name} must be a number {name} რიცხვი უნდა იყოს -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} უნდა იყოს {lo}–{hi}{unit} (მიღებულია {v}) @msg {name}: CRC or size mismatch {name}: CRC ან ზომა არ ემთხვევა @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: Affinity-ის ამ ფაილიდან მხოლოდ ჩაშენებული წინასწარი ხედის წაკითხვა მოხერხდა; გაფრთხილებასთან ერთად მის სანახავად გამოიყენეთ ფაილი › გახსნა, ან განთავსებამდე Affinity-დან გააკეთეთ SVG-ის ან PDF-ის ექსპორტი @msg {name}: {e} {name}: {e} @@ -7813,6 +7810,19 @@ font-technology Variable ცვლადი Transform Objects ობიექტების გარდაქმნა @msg unknown parameter `{key}`; did you mean `{near}`? უცნობი პარამეტრი `{key}`; იქნებ `{near}` იგულისხმეთ? @msg unknown parameter `{key}`; the command takes no parameters უცნობი პარამეტრი `{key}`; ბრძანება პარამეტრებს არ იღებს +@msg unknown parameter `{key}`; `{object}` takes: {keys} უცნობი პარამეტრი `{key}`; `{object}` იღებს: {keys} +@msg unknown parameter `{key}`; {why_not} უცნობი პარამეტრი `{key}`; {why_not} +@msg no format takes it (see document.formats) არცერთი ფორმატი არ იღებს მას (იხილეთ document.formats) +@msg no save format takes it (see file.formatOptions) არცერთი შენახვის ფორმატი არ იღებს მას (იხილეთ file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF არ იღებს მას (იხილეთ document.formats) +@msg EPS doesn't take it (see document.formats) EPS არ იღებს მას (იხილეთ document.formats) +@msg DXF doesn't take it (see document.formats) DXF არ იღებს მას (იხილეთ document.formats) +@msg {name} must be {range} (got {v}) {name} უნდა იყოს {range} (მიღებულია {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) პირველად ნაცდმა გრაფიკულმა პროცესორმა ფანჯარა ვერ აჩვენა, ამიტომ VectorCraft ხელახლა გაეშვა: {summary} (პარამეტრები › წარმადობა › გრაფიკული პროცესორი › ავტომატური იყენებს იმას, რომელიც თქვენს ეკრანს მართავს) +@msg Sent “{title}” to {to} “{title}” გაგზავნილია: {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” გაგზავნილია: {to}. ბეჭდვის რიგის პასუხი: {note} +@msg the default printer ნაგულისხმევი პრინტერი +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap რასტრული ეფექტები ობიექტზე {object}: მოთხოვნილია {requested} ppi, მიღწეულია {achieved} ppi 64 მილიონი პიქსელის ლიმიტის გამო @msg unknown parameter `{key}`; the command takes: {keys} უცნობი პარამეტრი `{key}`; ბრძანება იღებს: {keys} @msg the params must be an object, not {got} პარამეტრები უნდა იყოს ობიექტი და არა {got} @msg unknown parameter `{path}`; the object takes no keys უცნობი პარამეტრი `{path}`; ობიექტი გასაღებებს არ იღებს diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 34b9d70651..dbda53243f 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5977,6 +5977,19 @@ lighting Light 광원 Transform Objects 개체 변형 @msg unknown parameter `{key}`; did you mean `{near}`? 알 수 없는 매개변수 `{key}`: `{near}`을(를) 의미하셨습니까? @msg unknown parameter `{key}`; the command takes no parameters 알 수 없는 매개변수 `{key}`: 이 명령에는 매개변수가 없습니다 +@msg unknown parameter `{key}`; `{object}` takes: {keys} 알 수 없는 매개변수 `{key}`: `{object}`이(가) 받는 키: {keys} +@msg unknown parameter `{key}`; {why_not} 알 수 없는 매개변수 `{key}`: {why_not} +@msg no format takes it (see document.formats) 이 옵션을 받는 형식이 없습니다(document.formats 참조) +@msg no save format takes it (see file.formatOptions) 이 옵션을 받는 저장 형식이 없습니다(file.formatOptions 참조) +@msg PDF doesn't take it (see document.formats) PDF는 이 옵션을 받지 않습니다(document.formats 참조) +@msg EPS doesn't take it (see document.formats) EPS는 이 옵션을 받지 않습니다(document.formats 참조) +@msg DXF doesn't take it (see document.formats) DXF는 이 옵션을 받지 않습니다(document.formats 참조) +@msg {name} must be {range} (got {v}) {name}은(는) {range}이어야 합니다({v} 입력됨) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) 처음 시도한 그래픽 프로세서가 창을 표시하지 못해 {summary}에서 VectorCraft를 다시 시작했습니다(설정 › 성능 › 그래픽 프로세서 › 자동은 디스플레이를 구동하는 프로세서를 사용합니다) +@msg Sent “{title}” to {to} “{title}”을(를) {to}(으)로 보냈습니다 +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}”을(를) {to}(으)로 보냈습니다. 인쇄 대기열 응답: {note} +@msg the default printer 기본 프린터 +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap 개체 {object}의 래스터 효과: {requested} ppi를 요청했지만 6,400만 픽셀 한도 때문에 {achieved} ppi가 되었습니다 @msg unknown parameter `{key}`; the command takes: {keys} 알 수 없는 매개변수 `{key}`: 이 명령이 받는 매개변수: {keys} @msg the params must be an object, not {got} 매개변수는 객체여야 합니다({got} 사용 불가) @msg unknown parameter `{path}`; the object takes no keys 알 수 없는 매개변수 `{path}`: 이 객체는 키를 받지 않습니다 @@ -9316,8 +9329,6 @@ breakText Glyphs 글리프 @msg unknown panel 알 수 없는 패널 @msg unknown panel `{panel}` 알 수 없는 패널 `{panel}` @msg unknown parameter `{key}` 알 수 없는 매개변수 `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} 알 수 없는 매개변수 `{within}settings.{format}`: {why} -@msg unknown parameter `{within}{key}`; {why} 알 수 없는 매개변수 `{within}{key}`: {why} @msg unknown pieLegend `{v}` (none, standard or wedges) 알 수 없는 pieLegend `{v}`(none, standard 또는 wedges) @msg unknown piePosition `{v}` (even, ratio or stacked) 알 수 없는 piePosition `{v}`(even, ratio 또는 stacked) @msg unknown pieSort `{v}` (none, all or first) 알 수 없는 pieSort `{v}`(none, all 또는 first) @@ -9446,7 +9457,6 @@ breakText Glyphs 글리프 @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name}은(는) 기본 제공 항목이라 삭제할 수 없습니다 @msg {name} must be a number {name}은(는) 숫자여야 합니다 -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name}은(는) {lo}–{hi}{unit}여야 합니다({v} 입력됨) @msg {name}: CRC or size mismatch {name}: CRC 또는 크기가 일치하지 않습니다 @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: 이 Affinity 파일은 포함된 미리 보기만 읽을 수 있었습니다. 경고와 함께 보려면 파일 › 열기를 사용하거나, 가져오기 전에 Affinity에서 SVG 또는 PDF로 내보내세요 @msg {name}: {e} {name}: {e} diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index a09dc37538..69aef91cfc 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -8160,6 +8160,19 @@ mark-style Japanese Japans Transform Objects Objecten transformeren @msg unknown parameter `{key}`; did you mean `{near}`? onbekende parameter `{key}`; bedoelde je `{near}`? @msg unknown parameter `{key}`; the command takes no parameters onbekende parameter `{key}`; de opdracht accepteert geen parameters +@msg unknown parameter `{key}`; `{object}` takes: {keys} onbekende parameter `{key}`; `{object}` accepteert: {keys} +@msg unknown parameter `{key}`; {why_not} onbekende parameter `{key}`; {why_not} +@msg no format takes it (see document.formats) geen enkele indeling accepteert deze (zie document.formats) +@msg no save format takes it (see file.formatOptions) geen enkele opslagindeling accepteert deze (zie file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF accepteert deze niet (zie document.formats) +@msg EPS doesn't take it (see document.formats) EPS accepteert deze niet (zie document.formats) +@msg DXF doesn't take it (see document.formats) DXF accepteert deze niet (zie document.formats) +@msg {name} must be {range} (got {v}) {name} moet {range} zijn (kreeg {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) De grafische processor die eerst werd geprobeerd, kon het venster niet weergeven, dus VectorCraft is opnieuw gestart met {summary} (Instellingen › Prestaties › Grafische processor › Automatisch gebruikt de processor die je beeldscherm aanstuurt) +@msg Sent “{title}” to {to} “{title}” verzonden naar {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” verzonden naar {to}. Antwoord van de afdrukwachtrij: {note} +@msg the default printer de standaardprinter +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap rastereffecten op object {object}: {requested} ppi gevraagd, {achieved} ppi bereikt vanwege de limiet van 64 miljoen pixels @msg unknown parameter `{key}`; the command takes: {keys} onbekende parameter `{key}`; de opdracht accepteert: {keys} Load EPS into Clipboard EPS in het klembord laden @msg an image of {w} × {h} pixels is too large to draw een afbeelding van {w} × {h} pixels is te groot om te tekenen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 6af64a9b47..0147515ffe 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -6237,6 +6237,19 @@ mark-style Japanese Japońskie Transform Objects Przekształć obiekty @msg unknown parameter `{key}`; did you mean `{near}`? nieznany parametr `{key}`; czy chodziło o `{near}`? @msg unknown parameter `{key}`; the command takes no parameters nieznany parametr `{key}`; polecenie nie przyjmuje parametrów +@msg unknown parameter `{key}`; `{object}` takes: {keys} nieznany parametr `{key}`; `{object}` przyjmuje: {keys} +@msg unknown parameter `{key}`; {why_not} nieznany parametr `{key}`; {why_not} +@msg no format takes it (see document.formats) żaden format go nie przyjmuje (zobacz document.formats) +@msg no save format takes it (see file.formatOptions) żaden format zapisu go nie przyjmuje (zobacz file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF go nie przyjmuje (zobacz document.formats) +@msg EPS doesn't take it (see document.formats) EPS go nie przyjmuje (zobacz document.formats) +@msg DXF doesn't take it (see document.formats) DXF go nie przyjmuje (zobacz document.formats) +@msg {name} must be {range} (got {v}) {name} musi wynosić {range} (podano {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Pierwszy wypróbowany procesor graficzny nie mógł wyświetlić okna, więc VectorCraft uruchomił się ponownie na {summary} (Ustawienia › Wydajność › Procesor graficzny › Automatycznie używa tego, który obsługuje ekran) +@msg Sent “{title}” to {to} Wysłano “{title}” do: {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} Wysłano “{title}” do: {to}. Odpowiedź kolejki wydruku: {note} +@msg the default printer drukarka domyślna +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap efekty rastrowe na obiekcie {object}: żądano {requested} ppi, uzyskano {achieved} ppi z powodu limitu 64 milionów pikseli @msg unknown parameter `{key}`; the command takes: {keys} nieznany parametr `{key}`; polecenie przyjmuje: {keys} @msg the params must be an object, not {got} parametry muszą być obiektem, a nie {got} @msg unknown parameter `{path}`; the object takes no keys nieznany parametr `{path}`; obiekt nie przyjmuje kluczy @@ -8173,8 +8186,6 @@ breakText Glyphs Glify @msg unknown dither `{d}` (diffusion, pattern, noise or none) nieznane rozpraszanie `{d}` (diffusion, pattern, noise lub none) @msg unknown panel `{panel}` nieznany panel `{panel}` @msg unknown parameter `{key}` nieznany parametr `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} nieznany parametr `{within}settings.{format}`; {why} -@msg unknown parameter `{within}{key}`; {why} nieznany parametr `{within}{key}`; {why} @msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) nieznana redukcja `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform lub document) @msg unmatched ')' niesparowany znak ')' @msg unterminated character class niezakończona klasa znaków @@ -9590,7 +9601,6 @@ breakText Glyphs Glify @msg {label} must be a number from 1 to 10000 {label} musi być liczbą od 1 do 10000 @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name} jest wbudowane i nie można go usunąć -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} musi wynosić {lo}–{hi}{unit} (podano {v}) @msg {name}: CRC or size mismatch {name}: niezgodność CRC lub rozmiaru @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: udało się odczytać tylko osadzony podgląd tego pliku Affinity; użyj polecenia Plik › Otwórz, aby zobaczyć go wraz z ostrzeżeniem, albo przed umieszczeniem wyeksportuj SVG lub PDF z programu Affinity @msg {name}: {e} {name}: {e} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 6130764f9e..8201db7ab6 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -4966,6 +4966,19 @@ axis Both Ambos Transform Objects Transformar objetos @msg unknown parameter `{key}`; did you mean `{near}`? parâmetro desconhecido `{key}`; você quis dizer `{near}`? @msg unknown parameter `{key}`; the command takes no parameters parâmetro desconhecido `{key}`; o comando não tem parâmetros +@msg unknown parameter `{key}`; `{object}` takes: {keys} parâmetro desconhecido `{key}`; `{object}` aceita: {keys} +@msg unknown parameter `{key}`; {why_not} parâmetro desconhecido `{key}`; {why_not} +@msg no format takes it (see document.formats) nenhum formato o aceita (consulte document.formats) +@msg no save format takes it (see file.formatOptions) nenhum formato de salvamento o aceita (consulte file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF não o aceita (consulte document.formats) +@msg EPS doesn't take it (see document.formats) EPS não o aceita (consulte document.formats) +@msg DXF doesn't take it (see document.formats) DXF não o aceita (consulte document.formats) +@msg {name} must be {range} (got {v}) {name} deve ser {range} (recebido {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) O processador gráfico tentado primeiro não conseguiu exibir a janela, então o VectorCraft reiniciou em {summary} (Configurações › Desempenho › Processador Gráfico › Automático usa o que controla sua tela) +@msg Sent “{title}” to {to} “{title}” enviado para {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” enviado para {to}. Resposta da fila de impressão: {note} +@msg the default printer a impressora padrão +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap efeitos de rasterização no objeto {object}: solicitados {requested} ppi, obtidos {achieved} ppi devido ao limite de 64 milhões de pixels @msg unknown parameter `{key}`; the command takes: {keys} parâmetro desconhecido `{key}`; o comando aceita: {keys} @msg the params must be an object, not {got} os parâmetros devem ser um objeto, não {got} @msg unknown parameter `{path}`; the object takes no keys parâmetro desconhecido `{path}`; o objeto não aceita chaves @@ -9772,8 +9785,6 @@ swatch Yellow Green Verde-amarelado @msg unknown panel painel desconhecido @msg unknown panel `{panel}` painel desconhecido `{panel}` @msg unknown parameter `{key}` parâmetro desconhecido `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} parâmetro desconhecido `{within}settings.{format}`; {why} -@msg unknown parameter `{within}{key}`; {why} parâmetro desconhecido `{within}{key}`; {why} @msg unknown pieLegend `{v}` (none, standard or wedges) pieLegend desconhecido `{v}` (none, standard ou wedges) @msg unknown piePosition `{v}` (even, ratio or stacked) piePosition desconhecido `{v}` (even, ratio ou stacked) @msg unknown pieSort `{v}` (none, all or first) pieSort desconhecido `{v}` (none, all ou first) @@ -9902,7 +9913,6 @@ swatch Yellow Green Verde-amarelado @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name} é integrado e não pode ser excluído @msg {name} must be a number {name} deve ser um número -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} deve ser {lo}–{hi}{unit} (recebido {v}) @msg {name}: CRC or size mismatch {name}: CRC ou tamanho não confere @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: só foi possível ler a prévia incorporada deste arquivo do Affinity; use Arquivo › Abrir para vê-la com o aviso, ou exporte SVG ou PDF pelo Affinity antes de colocar @msg {name}: {e} {name}: {e} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 858f684750..d1593508d3 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -6011,6 +6011,19 @@ lighting Light Свет Transform Objects Трансформировать объекты @msg unknown parameter `{key}`; did you mean `{near}`? неизвестный параметр `{key}`; возможно, имелся в виду `{near}`? @msg unknown parameter `{key}`; the command takes no parameters неизвестный параметр `{key}`; у команды нет параметров +@msg unknown parameter `{key}`; `{object}` takes: {keys} неизвестный параметр `{key}`; `{object}` принимает: {keys} +@msg unknown parameter `{key}`; {why_not} неизвестный параметр `{key}`; {why_not} +@msg no format takes it (see document.formats) ни один формат его не принимает (см. document.formats) +@msg no save format takes it (see file.formatOptions) ни один формат сохранения его не принимает (см. file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF его не принимает (см. document.formats) +@msg EPS doesn't take it (see document.formats) EPS его не принимает (см. document.formats) +@msg DXF doesn't take it (see document.formats) DXF его не принимает (см. document.formats) +@msg {name} must be {range} (got {v}) {name} должен быть {range} (получено {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Графический процессор, выбранный первым, не смог показать окно, поэтому VectorCraft запустился снова на {summary} (Настройки › Производительность › Графический процессор › Автоматически использует тот, к которому подключён дисплей) +@msg Sent “{title}” to {to} “{title}” отправлено: {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” отправлено: {to}. Ответ очереди печати: {note} +@msg the default printer принтер по умолчанию +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap растровые эффекты объекта {object}: запрошено {requested} ppi, получено {achieved} ppi из-за ограничения в 64 миллиона пикселей @msg unknown parameter `{key}`; the command takes: {keys} неизвестный параметр `{key}`; команда принимает: {keys} @msg the params must be an object, not {got} параметры должны быть объектом, а не {got} @msg unknown parameter `{path}`; the object takes no keys неизвестный параметр `{path}`; объект не принимает ключей @@ -9694,8 +9707,6 @@ shape Open Открытый @msg unknown panel неизвестная панель @msg unknown panel `{panel}` неизвестная панель `{panel}` @msg unknown parameter `{key}` неизвестный параметр `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} неизвестный параметр `{within}settings.{format}`; {why} -@msg unknown parameter `{within}{key}`; {why} неизвестный параметр `{within}{key}`; {why} @msg unknown pieLegend `{v}` (none, standard or wedges) неизвестное значение pieLegend `{v}` (none, standard или wedges) @msg unknown piePosition `{v}` (even, ratio or stacked) неизвестное значение piePosition `{v}` (even, ratio или stacked) @msg unknown pieSort `{v}` (none, all or first) неизвестное значение pieSort `{v}` (none, all или first) @@ -9825,7 +9836,6 @@ shape Open Открытый @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name} встроен, его нельзя удалить @msg {name} must be a number {name} должно быть числом -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} должно быть {lo}–{hi}{unit} (получено {v}) @msg {name}: CRC or size mismatch {name}: несовпадение CRC или размера @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: удалось прочитать только встроенный предпросмотр этого файла Affinity; используйте «Файл › Открыть», чтобы увидеть его с предупреждением, или перед помещением экспортируйте SVG или PDF из Affinity @msg {name}: {e} {name}: {e} diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 4ef57fa56d..5c0420fcd3 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5888,6 +5888,18 @@ lighting Light Ljus Transform Objects Transformera objekt @msg unknown parameter `{key}`; did you mean `{near}`? okänd parameter `{key}`; menade du `{near}`? @msg unknown parameter `{key}`; the command takes no parameters okänd parameter `{key}`; kommandot tar inga parametrar +@msg unknown parameter `{key}`; `{object}` takes: {keys} okänd parameter `{key}`; `{object}` tar: {keys} +@msg unknown parameter `{key}`; {why_not} okänd parameter `{key}`; {why_not} +@msg no format takes it (see document.formats) inget format tar den (se document.formats) +@msg no save format takes it (see file.formatOptions) inget sparformat tar den (se file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF tar den inte (se document.formats) +@msg EPS doesn't take it (see document.formats) EPS tar den inte (se document.formats) +@msg DXF doesn't take it (see document.formats) DXF tar den inte (se document.formats) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Grafikprocessorn som prövades först kunde inte visa fönstret, så VectorCraft startade om med {summary} (Inställningar › Prestanda › Grafikprocessor › Automatisk använder den som driver din skärm) +@msg Sent “{title}” to {to} Skickade “{title}” till {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} Skickade “{title}” till {to}. Svar från utskriftskön: {note} +@msg the default printer standardskrivaren +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap rastereffekter på objekt {object}: begärde {requested} ppi, uppnådde {achieved} ppi på grund av gränsen på 64 miljoner pixlar @msg unknown parameter `{key}`; the command takes: {keys} okänd parameter `{key}`; kommandot tar: {keys} @msg the params must be an object, not {got} parametrarna måste vara ett objekt, inte {got} @msg unknown parameter `{path}`; the object takes no keys okänd parameter `{path}`; objektet tar inga nycklar @@ -7905,7 +7917,7 @@ digits Hindi Hindi @msg {LABEL} produced an empty result {LABEL} gav ett tomt resultat @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name} är inbyggd och kan inte tas bort -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} måste vara {lo}–{hi}{unit} (fick {v}) +@msg {name} must be {range} (got {v}) {name} måste vara {range} (fick {v}) @msg {name}: {e} {name}: {e} @msg {name}: CRC or size mismatch {name}: CRC eller storlek stämmer inte @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: endast den inbäddade förhandsgranskningen i den här Affinity-filen kunde läsas; använd Arkiv › Öppna för att se den med dess varning, eller exportera SVG eller PDF från Affinity innan du placerar den diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index b65a17bb56..97fccd9167 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -1,4 +1,4 @@ -use super::catalog::{Catalog, parse_entries, placeholders}; +use super::catalog::{Catalog, matchable, parse_entries, placeholders, unmatchable_rows}; use super::*; const ZH: fn() -> Lang = || Lang::from_code("zh-hant").expect("zh-hant registered"); @@ -1944,8 +1944,7 @@ fn untranslated_report() { for code in COMPLETE_MESSAGES { let lang = Lang::from_code(code).expect("registered"); - let (entries, _) = parse_entries(lang.0.source); - let rows: BTreeSet<&str> = entries.iter().filter(|(ctx, _, _)| ctx == "@msg").map(|(_, src, _)| src.as_str()).collect(); + let rows = message_rows(lang.0.source); add(code, "messages", messages.iter().filter(|m| !rows.contains(m.as_str())).cloned().collect::>()); let meanings = vectorcraft_eps::POSTSCRIPT_ERRORS.iter().filter(|(_, m)| message(lang, m) == *m).map(|(_, m)| m.to_string()); add(code, "PostScript error meanings", meanings.collect()); @@ -2652,6 +2651,145 @@ fn package_status_message_templates_parse() { assert!(Catalog::parse("@msg\tPackaged {n} file(s) in {folder}{note}\tbad\n").message("Packaged 1 file(s) in /a b").is_none()); } +/// The sources of the `@msg` rows of the catalog file `text` that its catalog shows. A row the +/// catalog leaves out ([`unmatchable_rows`]) is not one: its messages are shown in English. +fn message_rows(text: &str) -> std::collections::BTreeSet { + let left_out = unmatchable_rows(text); + let (entries, _) = parse_entries(text); + entries.into_iter().filter(|(ctx, src, _)| ctx == "@msg" && !left_out.contains(src)).map(|(_, src, _)| src).collect() +} + +/// [`untranslated_report`] lists a message as missing when the catalog leaves its row out. +#[test] +fn a_row_the_catalog_leaves_out_does_not_count_as_translated() { + let text = concat!( + "@msg\t{name} must be {lo}–{hi}{unit} (got {v})\t{name}: {lo}–{hi}{unit}, {v}\n", + "@msg\t{name} must be {range} (got {v})\t{name}: {range}, {v}\n", + "@msg\t{e}\t{e}\n", + "@msg\tnothing selected\tnada seleccionado\n", + "@msgplural\t{n}{what} left|{n} {what} left\t{n} {what}|{n} {what}\n", + ); + assert_eq!(unmatchable_rows(text), ["{name} must be {lo}–{hi}{unit} (got {v})", "{e}", "{n}{what} left|{n} {what} left"]); + assert_eq!(message_rows(text).into_iter().collect::>(), ["nothing selected", "{name} must be {range} (got {v})"]); +} + +/// Every `@msg` and `@msgplural` row of the bundled catalogs has a source that messages can be +/// matched against: text, and no two placeholders in a row. +#[test] +fn bundled_catalogs_have_no_message_row_they_leave_out() { + for l in &LANGUAGES { + let left_out = unmatchable_rows(l.source); + assert!(left_out.is_empty(), "{}: no message matches these rows (two placeholders in a row, or no text): {left_out:?}", l.code); + } +} + +/// The status messages the desktop app makes (`apps/vectorcraft/src`, test modules aside), read as +/// [`message_literals`] reads the crates'. [`untranslated_report`] does not list them. +fn desktop_app_messages() -> std::collections::BTreeSet { + let mut out = std::collections::BTreeSet::new(); + let mut stack = vec![std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../apps/vectorcraft/src")]; + while let Some(d) = stack.pop() { + for entry in std::fs::read_dir(&d).into_iter().flatten().flatten() { + let path = entry.path(); + let name = path.file_name().and_then(|n| n.to_str()).unwrap_or(""); + if path.is_dir() { + if name != "tests" { + stack.push(path); + } + } else if name.ends_with(".rs") && !name.starts_with("tests") && !name.ends_with("_tests.rs") { + let text = std::fs::read_to_string(&path).unwrap_or_default(); + out.extend(source_messages(without_test_module(&text), &[], &std::collections::BTreeMap::new())); + } + } + } + out +} + +/// Every status and error message is made with text between its placeholders, so a catalog row +/// can match it: values that stand side by side (a key and the object it is in, a range and its +/// unit) are joined into one value before the message is made. +#[test] +fn message_templates_have_text_between_their_placeholders() { + let app = desktop_app_messages(); + assert!(app.iter().any(|m| m.starts_with("The graphics processor tried first")), "the desktop app scan found {} messages", app.len()); + let mut messages = message_literals(); + messages.extend(app); + // A message that is one value alone (`{e}`) passes another message on. + let passes_on = |m: &str| m.starts_with('{') && m.ends_with('}') && m.matches('{').count() == 1; + let unmatchable: Vec<&String> = messages.iter().filter(|m| m.contains('{') && !passes_on(m) && !matchable(m)).collect(); + assert!(unmatchable.is_empty(), "no catalog row can match these messages; join the values that stand side by side first: {unmatchable:#?}"); +} + +/// Messages whose side-by-side values are joined before the message is made (a key with the +/// objects it is in, a range with its unit, an object's id with its name) are translated whole in +/// every complete-message language, the reason a key is refused for included. +#[test] +fn messages_with_joined_values_translate_whole() { + use serde_json::json; + let refusal = |id: &str, params: serde_json::Value| vectorcraft_engine::cmd::params::check_params(id, ¶ms).expect_err("refused").to_string(); + let setting = |checked: Result<(), vectorcraft_pdf::PdfError>| checked.expect_err("refused").to_string(); + let mut marks = vectorcraft_pdf::PdfSettings::default(); + marks.marks.weight = 9.0; + let gpu = "The graphics processor tried first couldn't show the window, so VectorCraft started again on Fast GPU"; + // Each message with the values it keeps and English words its translations do not. + let messages: Vec<(String, Vec<&str>, Vec<&str>)> = vec![ + (refusal("document.exportPdf", json!({"marks": {"ofset": 1}})), vec!["`marks.ofset`", "`marks.offset`"], vec!["unknown", "mean"]), + (refusal("document.exportPdf", json!({"marks": {"zz": 1}})), vec!["`marks.zz`", "`marks`", "weight"], vec!["unknown", "takes"]), + (refusal("document.exportForScreens", json!({"settings": {"zz": {}}})), vec!["`settings.zz`", "`settings`"], vec!["unknown", "takes"]), + (refusal("document.export", json!({"noSuchOption": 1})), vec!["`noSuchOption`", "document.formats"], vec!["unknown", "takes"]), + ( + refusal("document.save", json!({"path": "a.pdf", "options": {"noSuchOption": 1}})), + vec!["`options.noSuchOption`", "file.formatOptions"], + vec!["unknown", "takes"], + ), + ( + refusal("document.exportPdf", json!({"noSuchOption": 1})), + vec!["`noSuchOption`", "PDF", "document.formats"], + vec!["unknown", "doesn", "take"], + ), + ( + refusal("document.exportEps", json!({"noSuchOption": 1})), + vec!["`noSuchOption`", "EPS", "document.formats"], + vec!["unknown", "doesn", "take"], + ), + ( + refusal("document.exportDxf", json!({"noSuchOption": 1})), + vec!["`noSuchOption`", "DXF", "document.formats"], + vec!["unknown", "doesn", "take"], + ), + (setting(vectorcraft_pdf::PrintSettings { copies: 0, ..Default::default() }.check()), vec!["copies", "1–999", "0"], vec!["must", "got"]), + (setting(marks.check_values()), vec!["marks.weight", "0.05–2 pt", "9"], vec!["must", "got"]), + (gpu.to_string(), vec!["Fast GPU"], vec!["tried", "started"]), + ( + format!("{gpu} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display)"), + vec!["Fast GPU"], + vec!["tried", "started", "uses", "drives"], + ), + ("Sent “Poster” to the default printer".to_string(), vec!["“Poster”"], vec!["Sent", "default"]), + ("Sent “Poster” to Office Laser".to_string(), vec!["“Poster”", "Office Laser"], vec!["Sent"]), + ( + "Sent “Poster” to Office Laser (Floor 2). The spooler replied: job 12".to_string(), + vec!["“Poster”", "Office Laser (Floor 2)", "job 12"], + vec!["Sent", "spooler", "replied"], + ), + ("`canceled` is not an available name".to_string(), vec!["`canceled`"], vec![]), + ("a graphic style named `canceled` already exists".to_string(), vec!["`canceled`"], vec![]), + ( + "raster effects on object 7 (Logo): requested 300.0 ppi, achieved 72.0 ppi due to the 64 million pixel cap".to_string(), + vec!["7", "Logo", "300.0", "72.0"], + vec!["requested", "achieved"], + ), + ]; + for code in COMPLETE_MESSAGES { + let lang = Lang::from_code(code).expect("registered"); + for (english, kept, words) in &messages { + let shown = message(lang, english); + assert!(kept.iter().all(|value| shown.contains(value)), "{code}: {english} -> {shown}"); + assert!(shown.split(|c: char| !c.is_alphabetic()).all(|w| !words.contains(&w)), "{code}: {english} -> {shown}"); + } + } +} + /// A placeholder that occurs twice in a template matches the same text both times, so a template /// that ends with the name it starts with does not swallow a line that wraps its message. #[test] diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 847c8982d1..910a7fc5b1 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5744,6 +5744,19 @@ lighting Light Işık Transform Objects Nesneleri Dönüştür @msg unknown parameter `{key}`; did you mean `{near}`? bilinmeyen parametre `{key}`; `{near}` mi demek istediniz? @msg unknown parameter `{key}`; the command takes no parameters bilinmeyen parametre `{key}`; komut hiçbir parametre almaz +@msg unknown parameter `{key}`; `{object}` takes: {keys} bilinmeyen parametre `{key}`; `{object}` şunları alır: {keys} +@msg unknown parameter `{key}`; {why_not} bilinmeyen parametre `{key}`; {why_not} +@msg no format takes it (see document.formats) hiçbir biçim bunu almaz (bkz. document.formats) +@msg no save format takes it (see file.formatOptions) hiçbir kaydetme biçimi bunu almaz (bkz. file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF bunu almaz (bkz. document.formats) +@msg EPS doesn't take it (see document.formats) EPS bunu almaz (bkz. document.formats) +@msg DXF doesn't take it (see document.formats) DXF bunu almaz (bkz. document.formats) +@msg {name} must be {range} (got {v}) {name} {range} olmalıdır ({v} verildi) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) İlk önce denenen grafik işlemcisi pencereyi gösteremedi, bu yüzden VectorCraft {summary} üzerinde yeniden başladı (Ayarlar › Performans › Grafik İşlemcisi › Otomatik, ekranınızı süren işlemciyi kullanır) +@msg Sent “{title}” to {to} “{title}” şuraya gönderildi: {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” şuraya gönderildi: {to}. Yazdırma kuyruğunun yanıtı: {note} +@msg the default printer varsayılan yazıcı +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap {object} nesnesindeki raster efektleri: {requested} ppi istendi, 64 milyon piksel sınırı nedeniyle {achieved} ppi elde edildi @msg unknown parameter `{key}`; the command takes: {keys} bilinmeyen parametre `{key}`; komut şunları alır: {keys} @msg the params must be an object, not {got} parametreler bir nesne olmalıdır, {got} değil @msg unknown parameter `{path}`; the object takes no keys bilinmeyen parametre `{path}`; nesne anahtar almaz diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index b060de8119..dbd6d2609e 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -5995,6 +5995,19 @@ lighting Light Світло Transform Objects Трансформувати об’єкти @msg unknown parameter `{key}`; did you mean `{near}`? невідомий параметр `{key}`; можливо, ви мали на увазі `{near}`? @msg unknown parameter `{key}`; the command takes no parameters невідомий параметр `{key}`; команда не має параметрів +@msg unknown parameter `{key}`; `{object}` takes: {keys} невідомий параметр `{key}`; `{object}` приймає: {keys} +@msg unknown parameter `{key}`; {why_not} невідомий параметр `{key}`; {why_not} +@msg no format takes it (see document.formats) жоден формат його не приймає (див. document.formats) +@msg no save format takes it (see file.formatOptions) жоден формат збереження його не приймає (див. file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF його не приймає (див. document.formats) +@msg EPS doesn't take it (see document.formats) EPS його не приймає (див. document.formats) +@msg DXF doesn't take it (see document.formats) DXF його не приймає (див. document.formats) +@msg {name} must be {range} (got {v}) {name} має бути {range} (отримано {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Графічний процесор, обраний першим, не зміг показати вікно, тому VectorCraft запустився знову на {summary} (Налаштування › Продуктивність › Графічний процесор › Автоматично використовує той, до якого під’єднано дисплей) +@msg Sent “{title}” to {to} “{title}” відправлено: {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} “{title}” відправлено: {to}. Відповідь черги друку: {note} +@msg the default printer принтер за замовчуванням +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap растрові ефекти об’єкта {object}: запитано {requested} ppi, отримано {achieved} ppi через обмеження у 64 мільйони пікселів @msg unknown parameter `{key}`; the command takes: {keys} невідомий параметр `{key}`; команда приймає: {keys} @msg the params must be an object, not {got} параметри мають бути об'єктом, а не {got} @msg unknown parameter `{path}`; the object takes no keys невідомий параметр `{path}`; об'єкт не приймає ключів @@ -9305,8 +9318,6 @@ breakText Glyphs Гліфи @msg unknown panel невідома панель @msg unknown panel `{panel}` невідома панель `{panel}` @msg unknown parameter `{key}` невідомий параметр `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} невідомий параметр `{within}settings.{format}`; {why} -@msg unknown parameter `{within}{key}`; {why} невідомий параметр `{within}{key}`; {why} @msg unknown pieLegend `{v}` (none, standard or wedges) невідомий pieLegend `{v}` (none, standard або wedges) @msg unknown piePosition `{v}` (even, ratio or stacked) невідомий piePosition `{v}` (even, ratio або stacked) @msg unknown pieSort `{v}` (none, all or first) невідомий pieSort `{v}` (none, all або first) @@ -9432,7 +9443,6 @@ breakText Glyphs Гліфи @msg {label} must be a number from 1 to 10000 {label} має бути числом від 1 до 10000 @msg {name} `{s}`: {ids} {name} `{s}`: {ids} @msg {name} is built in and can't be deleted {name} є вбудованим, його не можна видалити -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} має бути {lo}–{hi}{unit} (отримано {v}) @msg {name}: CRC or size mismatch {name}: невідповідність CRC або розміру @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: вдалося прочитати лише вбудований попередній перегляд цього файлу Affinity; скористайтеся командою Файл › Відкрити, щоб побачити його з попередженням, або перед розміщенням експортуйте SVG чи PDF з Affinity @msg {name}: {e} {name}: {e} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 3f2c2db581..519c5d8f0d 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5938,6 +5938,19 @@ liquify-list-end {0}, {1} {0} và {1} @msg panels can't be shown in Presentation Mode không thể hiển thị bảng trong chế độ trình bày @msg unknown parameter `{key}`; did you mean `{near}`? tham số không xác định `{key}`; ý bạn là `{near}`? @msg unknown parameter `{key}`; the command takes no parameters tham số không xác định `{key}`; lệnh này không nhận tham số +@msg unknown parameter `{key}`; `{object}` takes: {keys} tham số không xác định `{key}`; `{object}` nhận: {keys} +@msg unknown parameter `{key}`; {why_not} tham số không xác định `{key}`; {why_not} +@msg no format takes it (see document.formats) không định dạng nào nhận tham số này (xem document.formats) +@msg no save format takes it (see file.formatOptions) không định dạng lưu nào nhận tham số này (xem file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF không nhận tham số này (xem document.formats) +@msg EPS doesn't take it (see document.formats) EPS không nhận tham số này (xem document.formats) +@msg DXF doesn't take it (see document.formats) DXF không nhận tham số này (xem document.formats) +@msg {name} must be {range} (got {v}) {name} phải là {range} (nhận được {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) Bộ xử lý đồ họa thử trước không hiển thị được cửa sổ, VectorCraft đã khởi động lại trên {summary} (Cài đặt › Hiệu suất › Bộ xử lý đồ họa › Tự động dùng bộ xử lý đang điều khiển màn hình của bạn) +@msg Sent “{title}” to {to} Đã gửi “{title}” đến {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} Đã gửi “{title}” đến {to}. Phản hồi của hàng đợi in: {note} +@msg the default printer máy in mặc định +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap hiệu ứng raster trên đối tượng {object}: yêu cầu {requested} ppi, đạt {achieved} ppi do giới hạn 64 triệu điểm ảnh @msg unknown parameter `{key}`; the command takes: {keys} tham số không xác định `{key}`; lệnh nhận: {keys} @msg the params must be an object, not {got} các tham số phải là một đối tượng, không phải {got} @msg unknown parameter `{path}`; the object takes no keys tham số không xác định `{path}`; đối tượng không nhận khóa nào diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index e5a2c7c3d9..c6696a9ec6 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -6270,6 +6270,19 @@ lighting Light 光源 Transform Objects 变换对象 @msg unknown parameter `{key}`; did you mean `{near}`? 未知参数 `{key}`;您是否想输入 `{near}`? @msg unknown parameter `{key}`; the command takes no parameters 未知参数 `{key}`;该命令没有参数 +@msg unknown parameter `{key}`; `{object}` takes: {keys} 未知参数 `{key}`;`{object}` 接受:{keys} +@msg unknown parameter `{key}`; {why_not} 未知参数 `{key}`;{why_not} +@msg no format takes it (see document.formats) 没有格式接受它 (参见 document.formats) +@msg no save format takes it (see file.formatOptions) 没有存储格式接受它 (参见 file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF 不接受它 (参见 document.formats) +@msg EPS doesn't take it (see document.formats) EPS 不接受它 (参见 document.formats) +@msg DXF doesn't take it (see document.formats) DXF 不接受它 (参见 document.formats) +@msg {name} must be {range} (got {v}) {name} 必须为 {range} (实际为 {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) 首先尝试的图形处理器无法显示窗口,因此 VectorCraft 已在 {summary} 上重新启动 (设置 › 性能 › 图形处理器 › 自动 会使用驱动显示器的处理器) +@msg Sent “{title}” to {to} 已将 “{title}” 发送到 {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} 已将 “{title}” 发送到 {to}。打印队列的回复:{note} +@msg the default printer 默认打印机 +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap 对象 {object} 上的栅格效果:请求 {requested} ppi,受 6400 万像素上限限制,实际为 {achieved} ppi @msg unknown parameter `{key}`; the command takes: {keys} 未知参数 `{key}`;该命令接受:{keys} @msg the params must be an object, not {got} 参数必须是对象,而不是 {got} @msg unknown parameter `{path}`; the object takes no keys 未知参数 `{path}`;该对象不接受任何键 @@ -8156,8 +8169,6 @@ breakText Glyphs 字形 @msg unknown dither `{d}` (diffusion, pattern, noise or none) 未知的仿色 `{d}` (diffusion、pattern、noise 或 none) @msg unknown panel `{panel}` 未知的面板 `{panel}` @msg unknown parameter `{key}` 未知的参数 `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} 未知的参数 `{within}settings.{format}`;{why} -@msg unknown parameter `{within}{key}`; {why} 未知的参数 `{within}{key}`;{why} @msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) 未知的减色方式 `{reduction}` (selective、perceptual、adaptive、web、gray、blackWhite、uniform 或 document) @msg unmatched ')' 不匹配的 ')' @msg unterminated character class 字符类没有结束 @@ -9578,7 +9589,6 @@ breakText Glyphs 字形 @msg {label} must be a number from 1 to 10000 {label} 必须是 1 到 10000 之间的数字 @msg {name} `{s}`: {ids} {name} `{s}`:{ids} @msg {name} is built in and can't be deleted {name} 是内置项,不能删除 -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} 必须为 {lo}–{hi}{unit} (实际为 {v}) @msg {name}: CRC or size mismatch {name}:CRC 或大小不匹配 @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}:只能读取此 Affinity 文件的嵌入预览;请使用 文件 › 打开 查看预览及其警告,或在置入前先从 Affinity 导出 SVG 或 PDF @msg {name}: {e} {name}:{e} diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 44bdef3d15..1480422931 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -6106,6 +6106,19 @@ lighting Light 光源 Transform Objects 變形物件 @msg unknown parameter `{key}`; did you mean `{near}`? 未知的參數 `{key}`;您是指 `{near}` 嗎? @msg unknown parameter `{key}`; the command takes no parameters 未知的參數 `{key}`;此指令沒有參數 +@msg unknown parameter `{key}`; `{object}` takes: {keys} 未知的參數 `{key}`;`{object}` 接受:{keys} +@msg unknown parameter `{key}`; {why_not} 未知的參數 `{key}`;{why_not} +@msg no format takes it (see document.formats) 沒有格式接受它 (請參閱 document.formats) +@msg no save format takes it (see file.formatOptions) 沒有儲存格式接受它 (請參閱 file.formatOptions) +@msg PDF doesn't take it (see document.formats) PDF 不接受它 (請參閱 document.formats) +@msg EPS doesn't take it (see document.formats) EPS 不接受它 (請參閱 document.formats) +@msg DXF doesn't take it (see document.formats) DXF 不接受它 (請參閱 document.formats) +@msg {name} must be {range} (got {v}) {name} 必須為 {range} (收到 {v}) +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} (Settings › Performance › Graphics Processor › Automatic uses the one that drives your display) 最先嘗試的圖形處理器無法顯示視窗,因此 VectorCraft 已改在 {summary} 上重新啟動 (設定 › 效能 › 圖形處理器 › 自動 會使用驅動顯示器的處理器) +@msg Sent “{title}” to {to} 已將 “{title}” 傳送至 {to} +@msg Sent “{title}” to {to}. The spooler replied: {note} 已將 “{title}” 傳送至 {to}。列印佇列的回覆:{note} +@msg the default printer 預設印表機 +@msg raster effects on object {object}: requested {requested} ppi, achieved {achieved} ppi due to the 64 million pixel cap 物件 {object} 上的點陣效果:要求 {requested} ppi,受 6400 萬像素上限限制,實際為 {achieved} ppi @msg unknown parameter `{key}`; the command takes: {keys} 未知的參數 `{key}`;此指令接受:{keys} @msg the params must be an object, not {got} 參數必須是物件,而不是 {got} @msg unknown parameter `{path}`; the object takes no keys 未知的參數 `{path}`;此物件不接受任何鍵 @@ -8085,8 +8098,6 @@ breakText Glyphs 字符 @msg unknown dither `{d}` (diffusion, pattern, noise or none) 未知的仿色 `{d}` (diffusion、pattern、noise 或 none) @msg unknown panel `{panel}` 未知的面板 `{panel}` @msg unknown parameter `{key}` 未知的參數 `{key}` -@msg unknown parameter `{within}settings.{format}`; {why} 未知的參數 `{within}settings.{format}`;{why} -@msg unknown parameter `{within}{key}`; {why} 未知的參數 `{within}{key}`;{why} @msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) 未知的縮減 `{reduction}` (selective、perceptual、adaptive、web、gray、blackWhite、uniform 或 document) @msg unmatched ')' 不成對的 ')' @msg unterminated character class 字元類別未結束 @@ -9508,7 +9519,6 @@ breakText Glyphs 字符 @msg {label} must be a number from 1 to 10000 {label} 必須是 1 到 10000 之間的數字 @msg {name} `{s}`: {ids} {name} `{s}`:{ids} @msg {name} is built in and can't be deleted {name} 是內建項目,無法刪除 -@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} 必須是 {lo}–{hi}{unit} (收到 {v}) @msg {name}: CRC or size mismatch {name}:CRC 或大小不相符 @msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}:只能讀取此 Affinity 檔案的內嵌預視;請使用「檔案 › 開啟」查看它及其警告,或在置入前先從 Affinity 匯出 SVG 或 PDF @msg {name}: {e} {name}:{e} diff --git a/docs/development.md b/docs/development.md index d12c22bb17..508c0aea06 100644 --- a/docs/development.md +++ b/docs/development.md @@ -297,7 +297,11 @@ other `sv-*` locale resolve to it), Georgian (`ka`, complete; `ka-GE` and `ka_GE control channel, MCP and tests read them) and are translated only where the status bar draws them (`i18n::msg`). `@msg` catalog rows hold a whole message or a template such as `Couldn't open {name}: {e}`; `{_1}`, `{_2}` … stand for the format string's `{}`, and the values in the - placeholders are translated in turn (the reason after `: {e}` is often a message too). A value that starts with + placeholders are translated in turn (the reason after `: {e}` is often a message too). A template needs text + between any two placeholders, since the catalog cannot tell where `{a}{b}` splits: make the message with the + side-by-side values joined into one (`unknown parameter `{key}``, where `key` is `marks.ofset`). The catalog + leaves out a row whose template has two placeholders in a row or no text; `i18n::tests` fails on such a row + and on such a message, and the untranslated report counts it as missing. A value that starts with `{` is translated only when it has an exact row, so a JSON object stays as it is; a value that starts with `[` is also matched against a template that starts with `[` and an index of digits, such as an effect's refusal ``[{j}] `{_1}`: {why}``, so its reason is translated while a JSON array stays as it is. A literal brace in a diff --git a/docs/effects-parity.md b/docs/effects-parity.md index 4bc558341f..cb857e15cd 100644 --- a/docs/effects-parity.md +++ b/docs/effects-parity.md @@ -1,6 +1,6 @@ # Effects parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (Extrude & Bevel, Inflate and Rotate seams have round joins under a white light and in the 3D (Classic) effects too, no longer reaching past the solid as thorns; previously: Effect Gallery: a thumbnail for each filter and an in-dialog preview on an original drawing; the 1–2 h for those is done; Extrude & Bevel, Inflate and Rotate merge contours that cross, touch or overlap, as type often draws a glyph, before building a solid; previously: Extrude & Bevel, Inflate and Rotate apply to groups and layers, their objects turning about one shared axis (#4506); the Transform effect's copies of a path with a fill and a stroke (or several fills and strokes, an even-odd fill, or a partly transparent one) are drawn each above the one before, as Expand Appearance makes them (#5920); Expand Appearance makes each copy of a path's Transform effect an object of its own (#5612); previously: Pixelate › Color Halftone: Max Radius in pixels of the Document Raster Effects resolution, 4–127 px, with older documents converted on opening and radii written back in points for older app versions (#3260); Effect dialogs clamp bounded length inputs immediately on commit and flash rejection on invalid input (#4638); previously: Drop Shadow Darkness uses fixed RGB subtraction and CMYK black addition; scores unchanged; Pathfinder › Trap: the Pathfinder panel's Trap… and Effect › Pathfinder › Trap… add an overprinting strip of the lighter colour where two solid colours meet; recounted with Hard Mix (#3061) and Soft Mix already in the catalogue: Pathfinder 13/13, Illustrator effects 49/50) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-17 · **Change:** minor (Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: Extrude & Bevel, Inflate and Rotate seams have round joins under a white light and in the 3D (Classic) effects too, no longer reaching past the solid as thorns; previously: Effect Gallery: a thumbnail for each filter and an in-dialog preview on an original drawing; the 1–2 h for those is done; Extrude & Bevel, Inflate and Rotate merge contours that cross, touch or overlap, as type often draws a glyph, before building a solid; previously: Extrude & Bevel, Inflate and Rotate apply to groups and layers, their objects turning about one shared axis (#4506); the Transform effect's copies of a path with a fill and a stroke (or several fills and strokes, an even-odd fill, or a partly transparent one) are drawn each above the one before, as Expand Appearance makes them (#5920); Expand Appearance makes each copy of a path's Transform effect an object of its own (#5612); previously: Pixelate › Color Halftone: Max Radius in pixels of the Document Raster Effects resolution, 4–127 px, with older documents converted on opening and radii written back in points for older app versions (#3260); Effect dialogs clamp bounded length inputs immediately on commit and flash rejection on invalid input (#4638); previously: Drop Shadow Darkness uses fixed RGB subtraction and CMYK black addition; scores unchanged; Pathfinder › Trap: the Pathfinder panel's Trap… and Effect › Pathfinder › Trap… add an overprinting strip of the lighter colour where two solid colours meet; recounted with Hard Mix (#3061) and Soft Mix already in the catalogue: Pathfinder 13/13, Illustrator effects 49/50) · **Target:** Adobe Illustrator 2026 (30.x) Every entry of Illustrator's Effect menu, by its public feature name, against VectorCraft's effects catalogue (`effect_catalog()` in `crates/effects/src/lib.rs`) and the Effect menu built from it @@ -22,7 +22,7 @@ Part of [target-app-parity.md](target-app-parity.md); open work is in [gaps.md]( |---|---|---:|---| | Convert to Shape | Rectangle, Rounded Rectangle, Ellipse | 3/3 | — | | Crop Marks | Crop Marks | 1/1 | — | -| Distort & Transform | Free Distort, Pucker & Bloat, Roughen, Transform, Tweak, Twist, Zig Zag | 7/7 | Free Distort's dialog has a handle on each corner of the object's bounds, moved by dragging or with the arrow keys; Zig Zag's ridges are evenly spaced along each segment (#1558), and Smooth points make a continuous wave whose peaks and valleys have handles along the path (#2343); Roughen with Smooth keeps turn-backs smooth instead of cusps that draw as spikes (#1646); Expand Appearance of a path whose Transform effect makes copies gives a group of one object per copy, each painted as the path, and a second Transform effect's copies nest in a group per copy of the first (#5612); drawn, each copy of a path with a fill and a stroke (or several, an even-odd fill or a partly transparent one) paints below the one before, the fills above covering the strokes of the copies below, instead of one path of every copy (#5920), and a group's copies each hold all its members except guides, the original group on top (#6316); a clipping group, a group with a fill or stroke of its own, a group whose type is kept as type, and a group with a member that carries a geometry, Pathfinder or 3D effect copy each member in its place | +| Distort & Transform | Free Distort, Pucker & Bloat, Roughen, Transform, Tweak, Twist, Zig Zag | 7/7 | Free Distort's dialog has a handle on each corner of the object's bounds, moved by dragging or with the arrow keys; Zig Zag's ridges are evenly spaced along each segment (#1558), and Smooth points make a continuous wave whose peaks and valleys have handles along the path (#2343); Roughen with Smooth keeps turn-backs smooth instead of cusps that draw as spikes (#1646); Expand Appearance of a path whose Transform effect makes copies gives a group of one object per copy, each painted as the path, and a second Transform effect's copies nest in a group per copy of the first (#5612); drawn, each copy of a path with a fill and a stroke (or several, an even-odd fill or a partly transparent one) paints below the one before, the fills above covering the strokes of the copies below, instead of one path of every copy (#5920), and a group's copies each hold all its members except guides, the original group on top (#6316); a clipping group, a group with a fill or stroke of its own, a group whose type is kept as type, and a group with a member that carries a geometry, Pathfinder or 3D effect copy each member in its place; Twist's handles follow the rotation's derivative, so a strongly twisted path is a smooth spiral without kinks where its pieces join (#7069, `twist_joins_its_pieces_smoothly`). | | Path | Offset Path, Outline Object, Outline Stroke | 3/3 | With Use Preview Bounds on, Align, Distribute and the Transform panel still measure type that carries Outline Object by its layout box (preview bounds leave out effects) | | Pathfinder | Add, Intersect, Exclude, Subtract, Minus Back, Divide, Trim, Merge, Crop, Outline, Hard Mix, Soft Mix, Trap | 13/13 | Trap traps only solid fills (gradients and patterns hide what is below them but don't trap) and spreads each colour's visible area as a whole; the public page gives no default values, so Trap's 0.25 pt, 100% and 40% are VectorCraft's own | | Rasterize | Rasterize… (as a live effect) | 1/1 | — | @@ -193,6 +193,7 @@ angular cut caps, exact visibility, the rest of 3D Classic (Map Art), Turntable) | Date | Change | Summary | |---|---|---| +| 2026-11-17 | minor | Distort & Transform › Twist: handles follow the rotation's derivative, so a strongly twisted path is a smooth spiral instead of pieces meeting at kinks (#7069; `twist_joins_its_pieces_smoothly` in `crates/effects/src/tests.rs`). Scores and estimates unchanged. | | 2026-11-12 | minor | The seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins (the seams of Revolve and of colored lights, and 3D (Classic) Wireframe edges, were already round): no thorns on edge-on facets, and facets with no neighbor now have rounded convex corners ([three-d.md](three-d.md#seams)); scores and estimates unchanged | | 2026-11-10 | minor | Effect Gallery: each filter has a thumbnail, and the dialog has a preview of the visible stack (or the browsed filter when the stack is empty). Both are an original landscape drawing passed through the filter ([Filter Gallery overview](https://helpx.adobe.com/photoshop/desktop/effects-filters/get-started-with-filters/filter-gallery.html)). The canvas preview and one-undo OK are unchanged. Remaining hours for the gallery's thumbnails and in-dialog preview: 1–2 → none. Counts unchanged (57/57). | | 2026-11-08 | minor | Extrude & Bevel, Inflate and Rotate merge contours that cross, touch or overlap (a glyph's arm across its stem) before building a solid, so the solid follows the shape as it is filled; others are built as drawn ([three-d.md](three-d.md)); scores and estimates unchanged | diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 8ac21ef37f..198f36f3f2 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -146,7 +146,13 @@ private editing data. VectorCraft: effects or a group's own fills and strokes, blends in opacity masks, pattern tiles, symbols and art cut to a clipping object or nested eight levels deep in art written in place of other objects (symbol instances, live objects, brushed strokes), blends whose art would pass the most objects VectorCraft's reader reads, and every blend - on a large canvas. + on a large canvas. Gradient meshes are written as meshes: each mesh point's place, color, opacity and handles, patch by + patch; a reflected mesh is written with its columns in reverse order, and opens with each row's points in reverse + order. Meshes with a point in a Lab color, with + more than 128 rows or columns, folded meshes (patches whose corners turn different ways), meshes VectorCraft's reader + wouldn't open as they are drawn, meshes in pattern tiles and in art cut to a clipping object, and every mesh on a + large canvas are written as their drawn look with a warning. In a symbol's art, an envelope's contents are written in + the canvas's space with y down. Point type, area type (with its rows, columns, gutters and first baseline, threaded frames included) and type on a path are written as text: a text object for each, naming its story in the text document, with the characters, fonts, sizes, leading, tracking, baseline shift, @@ -161,7 +167,7 @@ private editing data. VectorCraft: clipping object, mirrored type, turned or unevenly scaled area type and type on a path, area type in an open frame, type on an open path whose ends meet, area type whose wrap cannot be reconstructed from plain saved paths, compound paths or groups, type of only white space, threads of type on a path, threads whose frames differ in orientation, type and stories past the sizes VectorCraft's reader reads, and - type with inline graphics, ruby, gradient or pattern paint or an appearance or opacity mask of its own, other patterns, other clipping objects and live + type with inline graphics, ruby, gradient or pattern paint or an appearance or opacity mask of its own, other patterns, other clipping objects and other live objects (placed documents included) are written as plain filled and stroked paths, and freeform gradients, gradients along or across a stroke and gradients without stops, with more than 256 stops or without extent as their average color, each with a warning. Gradients that dither are written without dither's noise, Perceptual gradients and @@ -300,6 +306,8 @@ An object in a pattern's art or in a brush's art takes the file's art styles in Names in the editing data that aren't UTF-8 (layers, objects, artboards, colors, gradients, patterns, graphic styles, swatches, brushes, symbols, variables and data sets) are read as Windows-1252 unless `legacyNameEncoding` (`convert --legacy-name-encoding`) picks `macintosh`, `windows-949`, `shift_jis`, `gbk` or `big5`; the open result's warnings list the first three such names as read and count the rest. The text values of data sets are read in the same encoding. +Gradient meshes in the editing data keep each point's own color where a patch's corners differ in color model. In a symbol's art, a gradient mesh's corners and an envelope's grid are read in the space an image's matrix is read in there, and an envelope's contents in its dictionary in the canvas's space with y down. In a file without a template box such a mesh or grid is not read, and its symbol's instances open as the page draws them, as with an image there. An envelope in a symbol's art whose grid and contents are in the symbol's own space, as earlier VectorCraft builds wrote them, opens as the art it draws. + ## Format by format | Format | Illustrator | Ours: open/place | Ours: save/export | Fidelity and tests | diff --git a/docs/mcp.md b/docs/mcp.md index a27f99feba..092faabc4c 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -11508,7 +11508,9 @@ it while the drag sizes the halo: the halo's radius keeps the ratio to the point went down, through `growth` within 0 to 300 %. Letting the key go sizes the center with the drag again, and the flare keeps the new `growth`. While the rings' end point is placed, Up and Down Arrow add and remove rings (0 to 50; with Rings off they do nothing), and each press of backquote (the ~ key; a pointer event's `backquote` turning true) sends a -new `ringSeed`, which moves the rings along the path and keeps their count and sizes. Each new flare starts from the +new `ringSeed`, which moves the rings along the path and keeps their count and sizes. In VectorCraft, small seed +values, including 0, distribute the first ring along the path; the same seed and parameters reproduce the same +positions. Each new flare starts from the options' counts and growth, without a `ringSeed`. The Artboard tool's are the active artboard's Artboard Options (dialog `artboardOptions`; the Artboard tool's active artboard while it is in use, else the window's; its `x` and `y` are the artboard's top-left corner in document points, while the dialog shows X and Y at the reference point the diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 29dc7f85f4..2b33e447fc 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-17 · **Change:** minor (Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-17 · **Change:** minor (Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) > > Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5). > @@ -61,6 +61,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-17 | minor | Distort & Transform › Twist: handles follow the rotation's derivative, so a strongly twisted path is a smooth spiral instead of pieces meeting at kinks (#7069; `twist_joins_its_pieces_smoothly` in `crates/effects/src/tests.rs`). Scores and estimates unchanged. | | 2026-11-17 | minor | PDF import (#8300): a glyph filled only (text rendering mode 0) right after one filled and stroked (mode 2) joined the stroked run and came in stroked too: `2 Tr (B) Tj 0 Tr (C) Tj` came in as `BC` stroked throughout. A glyph filled only now joins only a run drawn alike, so it starts a run of its own, filled only, in the same type object, and takes a stroke only when the file draws one over it (the #8015 matching); a word filled whole then stroked whole, and fill and stroke rendering glyph by glyph, still come in as one run filled and stroked. Tests: `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`, `glyphs_filled_and_stroked_one_by_one_stay_one_run`; scores and estimates unchanged. | | 2026-11-17 | minor | PDF import (#8015 follow-up): type filled and stroked at less than full opacity is no longer joined into one type object, since the file composites the fill and the stroke apiece, darker where they overlap, while one object's opacity applies to both together; it stays a filled object and a stroked one, as a fill and stroke at different opacities already did. An upright glyph (vertical type) filled and stroked is no longer kept as an outline for a line that comes in as its outlines, as glyphs filled only weren't, so such a line can't lose them. The #8015 entries now say what is left: translucent type filled and stroked, and a `TJ` whose kerning starts a new line part way through, still come in as two objects. Tests: `translucent_fill_and_stroke_text_stays_two_objects`, `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled`; scores and estimates unchanged. | | 2026-11-16 | minor | PDF import: fill and stroke rendering (text rendering modes 2 and 6) draws all the glyphs of a text-showing operator (`Tj`, `TJ`, `'`, `"`) filled, then the same glyphs stroked, so a word shown at once came in as two type objects: a stroke-only copy over a fill-only one. Each stroke is now matched, in order, to the glyph filled with the same placement (where, how large, how wide, slanted and turned) in the same font with the same text on the line, and only that glyph takes the stroke, so the word comes in as one type object, filled and stroked; glyphs stroked with another join part way through still split into runs of their own, and stroked type over no filled glyph (modes 1 and 5) stays stroke only (#8015; `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`, `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs`). Scores and estimates unchanged. | @@ -1064,6 +1065,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The errors of the parameter checks that many commands share show in the status bar in the interface language: a value that is not a number where a number goes (`object.move` with `"dx": "60 mm"`, and `object.rotate`, `object.setBounds` and the other commands that call `check_numbers`), a missing number or index, `ids` that are not a list of object ids, an object id that is not a non-negative integer or names no object, and a date that is not Unix seconds. Each has a row in every catalog that translates all status and error messages, and in Bulgarian, Danish, Indonesian and Dutch (`shared_param_check_errors_are_translated`). - File Info's (`file.info`) error for a value with control characters shows in the status bar in the interface language for every field: "description has control characters" for Description and Copyright Notice, which take line breaks and tabs, and "title has control characters or line breaks" for the other text fields and each keyword in a list. Each is its own message with a row in every catalog that translates all status and error messages, and the field's key stays as written (`file_info_control_character_refusals_translate_in_every_complete_catalog`, `control_characters_are_refused_with_the_field_rule`). - A parameter schema's errors show in the status bar with what the value must be in the interface language, for every type a schema has (a number with each kind of range and with a unit, an integer and its range, true or false, a string, a list of names, an object id, a list of object ids, a color, a point, an object and a list), in every catalog that translates all status and error messages; the path, the refused value, the bounds, the unit and the names stay as the English gives them. The error for a value that is not one of its names is also translated in Bulgarian, Bosnian, Danish, Indonesian and Dutch (`parameter_schema_expected_phrases_are_translated`, `bracketed_message_parts_translate_only_as_exact_messages`). + - The error for an unknown key inside an options object (`marks.ofset` in `document.exportPdf`, a format under `settings` in `document.exportForScreens`), a PDF or print setting outside its range (`marks.weight must be 0.05–2 pt (got 9)`), the raster effect resolution warning for a named object, the note that VectorCraft started again on another graphics processor and the status after a print job is sent show in the status bar in the interface language, in every catalog: each message is made with one value for the key path, the range with its unit or the object with its name, so a catalog row can match it, and the English stays as before (`messages_with_joined_values_translate_whole`). A message or catalog row with two placeholders in a row fails `message_templates_have_text_between_their_placeholders` or `bundled_catalogs_have_no_message_row_they_leave_out`, and the untranslated report counts a row the catalog cannot use as missing. - A script's error about answers in `answers` that it did not use, and Liquify's warning about the objects under the brush that it left as they were, show in the status bar in the interface language for one answer or object as well as for several, with the count's own form in each catalog that translates all status and error messages; the English the commands return stays as it was (`messages_with_one_or_several_items_translate_in_every_complete_catalog`, `unused_answers_are_counted_in_the_singular_and_the_plural`, `liquify_warns_about_one_or_several_skipped_objects`). - In that Liquify warning, the tool's name and each kind of object it left (graphs, type, symbols, images, meshes, envelopes, repeats, placed documents, blends) are shown in the interface language too, in the order the command lists them and joined as the language joins a list, in each catalog that translates all status and error messages (`liquify-tool`, `liquify-kind` and `liquify-list-*` rows); a kind that Liquify does not list leaves the tool and the list in English (`liquify_warning_translates_its_tool_and_kinds_in_every_complete_catalog`). - An effect a plug-in's output or an importer plug-in's objects carry that VectorCraft refuses (``[0] `id`: reason``) shows in the status bar with its reason in the interface language inside `plug-in output: …` and `can't open …`, in every catalog that translates all status and error messages; the index and the effect id stay as they are, and a JSON array in a message stays as it is (`nested_effect_refusals_translate_with_their_reason`, `bracketed_message_parts_translate_only_as_exact_messages`). @@ -1130,6 +1132,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - While Alt (Option on macOS) is held, the Flare Tool Options' Cancel button reads Reset, which puts every option back to the Flare tool's default and leaves the dialog open (`ui.dialogReset`). - An Alt-click (Option-click on macOS) with the Flare tool draws a flare centered at the click at once, without opening the Flare Tool Options, as [the help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) describes for a default flare. As VectorCraft's own rules, the flare takes the tool's current options (the defaults until they are changed), Alt counts when it is held as the button goes down, a drag with Alt still draws the flare in two stages, and on the active perspective plane the flare is the one the click dialog's OK draws there (`alt_click_draws_a_flare_with_the_options_at_once`, `alt_click_draws_on_the_active_perspective_plane`, `an_alt_click_with_the_flare_tool_draws_the_flare_the_click_dialog_draws`). - While a flare's center is dragged out, Ctrl (Command on macOS) keeps the center's size and the drag sizes the halo; while its rings' end point is placed, Up/Down Arrow add and remove rings and ~ places them anew (`shape.flare`'s `ringSeed`) ([Draw and edit flares](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-and-edit-flares.html); `flare_arrows_change_the_rays_then_the_rings`, `flare_tilde_places_the_rings_anew`, `flare_ctrl_keeps_the_center_and_the_drag_sizes_the_halo`). + - Flare ring placement accepts small `ringSeed` values, including 0, without concentrating the first ring at the center; the same seed and parameters reproduce the same positions. This seed mapping is VectorCraft's own (`flare_small_ring_seeds_spread_the_first_ring_along_the_path`, `flare_ring_seed_moves_only_the_rings`). - A plain step of a number field (Up/Down or a wheel notch) goes to the next whole unit in its direction and a Ctrl/Cmd step goes to the next tenth, so 5.1 mm steps up to 6 mm and down to 5 mm (#2881). A Shift step adds or takes ten and keeps the fraction. - In the number, text and color fields of the panels and the Control bar, Shift+Enter (Shift+Return) applies the value and keeps the field active with its value selected; a text box of several lines takes it as a line break. In a dialog, Shift+Enter applies the value and confirms the dialog, as Enter does. - The Pattern Options panel's Name field and the name fields that a double-click opens in the Layers, Artboards and Asset Export panels take Shift+Enter (Shift+Return) the same way: it applies the name and keeps the field active with the name selected. @@ -1937,6 +1940,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur An envelope whose contents hold type keeps the type editable in that `.ai`: the editing copy writes the type as type in the envelope's contents, in the form the `.ai` reader opens as a live envelope of type (`TypedEnvelope` in `crates/eps/src/import/ai/envelope.rs`), so the file opens with the type shown and editable in the envelope's contents, with Edit Contents off or on. An envelope of type in a symbol's art, and one whose type is threaded, has text wrap options or is written as its outlines (mirrored type, for example), is written as its distorted art, as before (`an_envelope_of_type_is_read_back_live_with_its_type`, `an_envelope_of_type_written_as_its_art_leaves_no_story` and `an_envelope_of_type_in_a_symbol_or_a_thread_is_written_as_its_art` in `crates/eps/src/ai_editing/tests.rs`). A PDF-compatible `.ai` saved with Include Editing Data for Other Apps keeps blends live: its editing copy holds each blend's key objects, its spine when it has one of its own, its drawn steps, and its spacing (Smooth Color, Specified Steps, Specified Distance) and orientation (Align to Page, Align to Path) ([Blend Options](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blend-options-overview.html), [blends and their spine](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=260)), in the form VectorCraft's `.ai` blend reader reads (`crates/eps/src/import/ai/blend.rs`), so the file opens with the same live blend laying out the same steps. Each blend is checked with that reader before it is written; blends it wouldn't open with their settings or as they are drawn are written as their steps with a warning ([file-format-parity.md](file-format-parity.md) lists them) (`blends_are_read_back_live`, `blends_of_compound_paths_groups_and_62_keys_are_read_back_live` and `blends_the_reader_cant_read_are_written_as_their_steps` in `crates/eps/src/ai_editing/tests.rs`). A top object whose top and bottom sides, or left and right sides, have different numbers of segments is also saved live: the side with fewer segments is split into as many as the side across from it has (each segment into equal spans of its curve, a straight one at even steps), up to the 50 a side the grid holds, so the file opens with the same corners and the same mapping of the contents, its outline holding the added anchors. Where the split side would share out the contents another way, as a side of two curves that aren't one curve can, or a side has more than 50 segments, the envelope is written as its distorted art, with the warning (`a_top_object_with_uneven_sides_is_read_back_live`, `a_top_object_split_to_the_grids_limit_is_read_back_live` and `a_top_object_whose_split_side_would_map_another_way_is_written_as_its_art` in `crates/eps/src/ai_editing/tests.rs`). + A PDF-compatible `.ai` saved with Include Editing Data for Other Apps keeps gradient meshes editable ([gradient meshes](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=200), [opacity of mesh points](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=203)): its editing copy writes each mesh point's place, color (gray, RGB or CMYK), opacity and handles patch by patch, with the mesh's transparency, name and opacity mask, in the form VectorCraft's `.ai` mesh reader reads (`crates/eps/src/import/ai/mesh.rs`), so the file opens with the same mesh. A reflected mesh is written with its columns in reverse order. Meshes with a point in a Lab color, with more than 128 rows or columns, folded meshes, meshes the reader would open otherwise, meshes in pattern tiles and in art cut to a clipping object, and every mesh on a large canvas are written as their drawn look, with a warning (`meshes_are_read_back_as_they_are`, `meshes_in_masks_and_symbols_are_read_back`, `a_reflected_mesh_is_written_with_its_columns_reversed` and `meshes_the_reader_cant_read_are_written_as_their_drawn_look` in `crates/eps/src/ai_editing/tests.rs`). A PDF-compatible `.ai` saved with Include Editing Data for Other Apps writes eligible paths, compound paths and groups with live effects with an art style when the writer supports their appearance and effects (not a filled path that uses the even-odd rule, and none on a large canvas), which VectorCraft's `.ai` reader opens as the same appearance with its effects live (`objects_with_live_effects_are_read_back` and `every_effect_setting_written_on_an_object_is_read_back` in `crates/eps/src/ai_editing/tests.rs`; [file-format-parity.md](file-format-parity.md) lists the objects written without one and the effects they lose). The same holds for the objects of an opacity mask's art, a mask inside another mask's art and a hidden art root included, so a mask whose art has Offset Path opens drawing the image it masks as it did, with the effect live; geometry effects that no art style holds on a mask's art, such as Roughen, are written applied to the art, which opens drawing what it drew (`a_masked_image_with_live_offset_path_round_trips`, `hidden_and_nested_mask_art_keep_live_offset_path` and `a_masks_art_with_an_effect_no_style_holds_is_written_as_it_draws` in `crates/eps/src/ai_editing/tests.rs`). Opacity masks in a symbol's art and in a pattern's tile are written the same way, so a symbol or pattern whose mask art has Offset Path opens with the effect live in its definition, and its instances and pattern fills draw as they did; each definition's mask art keeps its own style, and mask art linked to a graphic style opens still linked to it (`a_symbols_mask_art_keeps_live_offset_path`, `a_pattern_tiles_mask_art_keeps_live_offset_path`, `mask_art_styles_stay_with_their_own_art` and `opacity_mask_art_keeps_its_graphic_style_link` in `crates/eps/src/ai_editing/tests.rs`).