From 630b36eaa77d42d3e3c06805f533c7863f4b109e Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 13 Nov 2026 02:19:23 -0500 Subject: [PATCH 001/226] Twist: handles follow the rotation's derivative, so its pieces join without kinks (#7069) --- crates/doc/src/live.rs | 4 +++- crates/doc/src/live/warp.rs | 37 ++++++++++++++++++++++++++++++----- crates/effects/src/distort.rs | 10 ++++++---- crates/effects/src/tests.rs | 21 ++++++++++++++++++++ crates/effects/src/util.rs | 2 +- docs/effects-parity.md | 5 +++-- docs/target-app-parity.md | 3 ++- 7 files changed, 68 insertions(+), 14 deletions(-) diff --git a/crates/doc/src/live.rs b/crates/doc/src/live.rs index b4c0f9fdd8..1926d58b89 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 { diff --git a/crates/doc/src/live/warp.rs b/crates/doc/src/live/warp.rs index 08bef91140..2f33e670a5 100644 --- a/crates/doc/src/live/warp.rs +++ b/crates/doc/src/live/warp.rs @@ -497,6 +497,33 @@ 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); + } + const STEP: f64 = 1e-3; + 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 +543,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 56f9d40633..3c333cd0a0 100644 --- a/crates/effects/src/tests.rs +++ b/crates/effects/src/tests.rs @@ -1662,6 +1662,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[1..anchors.len() - 1] { + 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/docs/effects-parity.md b/docs/effects-parity.md index 0eb68c7e25..b4ed0f41c8 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-10 · **Change:** minor (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-13 · **Change:** minor (Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; 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-13 | 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-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 | | 2026-11-06 | minor | Extrude & Bevel, Inflate and Rotate apply to a group or layer: a solid for every path, compound path and type in it, all turned about one shared axis as the public documentation describes for groups ([three-d.md](three-d.md#groups), #4506); scores and estimates unchanged | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 3984b49491..7dc426fce8 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-13 · **Change:** minor (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-13 · **Change:** minor (Twist: a strongly twisted path joins its pieces without kinks, #7069; 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) > > Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865). > @@ -53,6 +53,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-13 | 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-13 | minor | Library panels (swatch, Color Book, brush, symbol and graphic style libraries): in a panel made taller the list fills the space above the footer instead of scrolling inside 220 or 280 pt (#2992; `the_list_fills_a_tall_panel_above_its_footer` in `crates/ui-egui/src/panels/library_panel/tests.rs`). Scores and estimates unchanged. | | 2026-11-13 | minor | Swatches: in a panel made taller the swatch list fills the space above the footer instead of scrolling inside 150 or 200 pt (#1638; `the_list_fills_a_tall_panel_above_its_footer` in `crates/ui-egui/src/panels/swatches/tests.rs`). Scores and estimates unchanged. | | 2026-11-13 | minor | Swatches panel: its menu's Show Recent Colors hides and shows the panel's Recent Colors row, checked by default and kept between sessions apart from the Color panel's (#6617); scores unchanged. | From 128ba86be3c147e28d9dcc98d3e62d6f2a826b94 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 13 Nov 2026 03:25:35 -0500 Subject: [PATCH 002/226] Twist (#7069): the derivative's step grows with the coordinates so it doesn't round away --- crates/doc/src/live.rs | 24 ++++++++++++++++++++++++ crates/doc/src/live/warp.rs | 8 ++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/crates/doc/src/live.rs b/crates/doc/src/live.rs index 5768d26cac..946f1534c7 100644 --- a/crates/doc/src/live.rs +++ b/crates/doc/src/live.rs @@ -90,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 2f33e670a5..dd48e8ef65 100644 --- a/crates/doc/src/live/warp.rs +++ b/crates/doc/src/live/warp.rs @@ -517,8 +517,12 @@ fn mapped_handle(f: &impl Fn(Point) -> Point, p: Point, h: Point) -> Point { if len.is_nan() || len <= 0.0 || len.is_infinite() { return f(p); } - const STEP: f64 = 1e-3; - let d = (f(p + v * STEP) - f(p - v * STEP)) / (2.0 * STEP); + // 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 } From 06e02f3fd8f00181fef79d2e45144c29e89abcb5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 11:10:38 -0800 Subject: [PATCH 003/226] .ai save: Lab colors and type paints are written in the working RGB space The reader reads the RGB values of plain colors, gradient stops and type paints as working RGB. Lab colors (plain, in gradient stops and as the full color of a spot stop), type's RGB and Lab fills and strokes in the text document, and the average color written for a freeform gradient, a gradient along a stroke or a gradient that can't be placed were written as display sRGB. With a working RGB space other than sRGB, a reopened file showed different colors. They are now converted into the working RGB space, and type's RGB paints keep their own values. The legacy writer's Lab inks and freeform fills get the same conversion. A Lab color outside sRGB is clipped to sRGB before the conversion, as Cms::from_lab does. --- crates/eps/src/ai_editing/tests.rs | 240 +++++++++++++++++++++ crates/eps/src/ai_editing/writer.rs | 4 +- crates/eps/src/ai_editing/writer/paints.rs | 4 +- crates/eps/src/ai_editing/writer/texts.rs | 6 +- crates/eps/src/ai_ops.rs | 13 +- crates/eps/src/legacy_ai/tests.rs | 57 +++++ crates/eps/src/legacy_ai/writer.rs | 5 +- 7 files changed, 314 insertions(+), 15 deletions(-) diff --git a/crates/eps/src/ai_editing/tests.rs b/crates/eps/src/ai_editing/tests.rs index 1321188f12..d7d7ddd0e6 100644 --- a/crates/eps/src/ai_editing/tests.rs +++ b/crates/eps/src/ai_editing/tests.rs @@ -386,6 +386,246 @@ fn rgb_values_are_written_again_unchanged_in_a_wide_gamut_working_space() { same_lines(&again.lines().map(String::from).collect::>(), &first.lines().map(String::from).collect::>()); } +/// With a working RGB space other than sRGB, type's RGB fill and stroke are written in the text +/// document with their working RGB values, so they read back as the same colors. +#[test] +fn type_rgb_paints_read_back_unchanged_in_a_wide_gamut_working_space() { + const CHILD: &str = "VECTORCRAFT_TEST_AI_EDITING_WIDE_GAMUT_TYPE"; + if std::env::var_os(CHILD).is_none() { + // Color settings are process-wide: exercise this profile in a separate test process. + let output = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "ai_editing::tests::type_rgb_paints_read_back_unchanged_in_a_wide_gamut_working_space", "--nocapture"]) + .env(CHILD, "1") + .output() + .unwrap(); + let stdout = String::from_utf8_lossy(&output.stdout); + assert!( + output.status.success() && stdout.contains("test result: ok. 1 passed; 0 failed;"), + "isolated color profile test failed:\n{stdout}\n{}", + String::from_utf8_lossy(&output.stderr), + ); + return; + } + use vectorcraft_color::cms; + use vectorcraft_doc::{CharStyle, TextObject}; + cms::set_active(&cms::ColorSettings { rgb: cms::WIDE_GAMUT_RGB.into(), ..Default::default() }).unwrap(); + assert!(!cms::active().rgb_is_srgb()); + let mut doc = Document::new(300.0, 200.0); + let layer = doc.layers[0].id; + let (fill, stroke) = (Color::rgb(0.8, 0.4, 0.2), Color::rgb(0.1, 0.7, 0.3)); + let st = CharStyle { stroke: solid(stroke), stroke_width: 1.0, ..style(14.0, fill) }; + let n = text_node(&mut doc, TextObject::point(vectorcraft_geom::Point::new(20.0, 40.0), "Wide", st)); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + let back = read_back(&doc); + let paints: Vec<(Paint, Paint)> = back.layers[0] + .children() + .unwrap() + .iter() + .filter_map(|n| if let NodeKind::Text(t) = &n.kind { Some(t) } else { None }) + .flat_map(|t| t.runs.iter().map(|r| (r.style.fill.clone(), r.style.stroke.clone()))) + .collect(); + assert!(!paints.is_empty(), "the type is read back as type"); + let near = |p: &Paint, want: Color| match (p, want) { + (Paint::Solid { color: Color::Rgb { r, g, b }, .. }, Color::Rgb { r: wr, g: wg, b: wb }) => { + (r - wr).abs() < 1e-4 && (g - wg).abs() < 1e-4 && (b - wb).abs() < 1e-4 + } + _ => false, + }; + for (f, s) in &paints { + assert!(near(f, fill), "fill {f:?} reads back as {fill:?}"); + assert!(near(s, stroke), "stroke {s:?} reads back as {stroke:?}"); + } +} + +/// With a working RGB space other than sRGB, a Lab fill, a Lab gradient stop, type filled with a +/// Lab color and a freeform gradient's average color are written as RGB values in the working RGB +/// space, so they read back as RGB colors that show as the colors they were written for. +#[test] +fn lab_paints_read_back_as_the_same_color_in_a_wide_gamut_working_space() { + const CHILD: &str = "VECTORCRAFT_TEST_AI_EDITING_WIDE_GAMUT_LAB"; + if std::env::var_os(CHILD).is_none() { + // Color settings are process-wide: exercise this profile in a separate test process. + let output = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "ai_editing::tests::lab_paints_read_back_as_the_same_color_in_a_wide_gamut_working_space", "--nocapture"]) + .env(CHILD, "1") + .output() + .unwrap(); + let stdout = String::from_utf8_lossy(&output.stdout); + assert!( + output.status.success() && stdout.contains("test result: ok. 1 passed; 0 failed;"), + "isolated color profile test failed:\n{stdout}\n{}", + String::from_utf8_lossy(&output.stderr), + ); + return; + } + use vectorcraft_color::cms; + use vectorcraft_doc::TextObject; + cms::set_active(&cms::ColorSettings { rgb: cms::WIDE_GAMUT_RGB.into(), ..Default::default() }).unwrap(); + assert!(!cms::active().rgb_is_srgb()); + let (fill, stop, ink) = (Color::lab(60.0, 20.0, -30.0), Color::lab(45.0, -25.0, 15.0), Color::lab(70.0, 10.0, 40.0)); + let mut doc = Document::new(300.0, 200.0); + let layer = doc.layers[0].id; + let n = square(&mut doc, Rect::new(10.0, 10.0, 30.0, 30.0), fill); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + let stops = vec![GradientStop::new(0.0, Color::rgb(0.1, 0.7, 0.3)), GradientStop::new(1.0, stop)]; + let paint = gradient_paint(Gradient::new(GradientKind::Linear, stops), None, None); + let n = painted(&mut doc, shapes::rectangle(Rect::new(40.0, 10.0, 60.0, 30.0)), vec![AppearanceItem::Fill(FillLayer::new(paint))]); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + let n = text_node(&mut doc, TextObject::point(vectorcraft_geom::Point::new(20.0, 80.0), "Lab", style(14.0, ink))); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + // A freeform gradient is written as the average of its stops' display colors. + let (a, b) = (Color::rgb(0.9, 0.2, 0.1), Color::lab(50.0, -40.0, -20.0)); + let free = ramp(GradientKind::Freeform, &[(0.0, a, 1.0, 0.5), (1.0, b, 1.0, 0.5)]); + let n = painted( + &mut doc, + shapes::rectangle(Rect::new(70.0, 10.0, 90.0, 30.0)), + vec![AppearanceItem::Fill(FillLayer::new(gradient_paint(free, None, None)))], + ); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + let average = { + let (a, b) = (a.to_rgb(), b.to_rgb()); + [0, 1, 2].map(|i| (a[i] + b[i]) / 2.0) + }; + let back = read_back(&doc); + let shows_as = |got: Color, want: [f32; 3], what: &str| { + assert!(matches!(got, Color::Rgb { .. }), "{what} reads back as RGB: {got:?}"); + let g = got.to_rgb(); + assert!(g.iter().zip(want).all(|(a, b)| (a - b).abs() < 2e-3), "{what} {got:?} shows as {g:?}, not {want:?}"); + }; + let mut solids = vec![(fill.to_rgb(), "fill"), (average, "freeform gradient's average")].into_iter(); + let (mut stops, mut runs) = (0, 0); + for n in back.layers[0].children().unwrap() { + match (&n.kind, n.appearance.fill_paint()) { + (NodeKind::Text(t), _) => { + for r in &t.runs { + let Paint::Solid { color, .. } = r.style.fill else { panic!("type fill {:?}", r.style.fill) }; + shows_as(color, ink.to_rgb(), "type fill"); + runs += 1; + } + } + (_, Paint::Solid { color, .. }) => { + let Some((want, what)) = solids.next() else { panic!("unexpected solid {color:?}") }; + shows_as(color, want, what); + } + (_, Paint::Gradient(g)) => { + let last = g.gradient.stops.last().unwrap(); + shows_as(last.color, stop.to_rgb(), "gradient stop"); + stops += 1; + } + (_, p) => panic!("unexpected paint {p:?}"), + } + } + assert_eq!((solids.len(), stops), (0, 1)); + assert!(runs > 0, "the type is read back as type"); +} + +/// With a working RGB space other than sRGB, the average color written for a gradient along a +/// stroke and for a gradient that can't be placed, a stop of a spot color defined in Lab and type +/// stroked with a Lab color are written as RGB values in the working RGB space, so each reads back +/// as an RGB color that shows as the color it was written for. +#[test] +fn averages_lab_spot_stops_and_lab_type_strokes_read_back_as_the_same_color_in_a_wide_gamut_working_space() { + const CHILD: &str = "VECTORCRAFT_TEST_AI_EDITING_WIDE_GAMUT_AVERAGES"; + if std::env::var_os(CHILD).is_none() { + // Color settings are process-wide: exercise this profile in a separate test process. + let output = std::process::Command::new(std::env::current_exe().unwrap()) + .args([ + "--exact", + "ai_editing::tests::averages_lab_spot_stops_and_lab_type_strokes_read_back_as_the_same_color_in_a_wide_gamut_working_space", + "--nocapture", + ]) + .env(CHILD, "1") + .output() + .unwrap(); + let stdout = String::from_utf8_lossy(&output.stdout); + assert!( + output.status.success() && stdout.contains("test result: ok. 1 passed; 0 failed;"), + "isolated color profile test failed:\n{stdout}\n{}", + String::from_utf8_lossy(&output.stderr), + ); + return; + } + use vectorcraft_color::cms; + use vectorcraft_color::gradient::GradientGeom; + use vectorcraft_doc::{CharStyle, TextObject}; + cms::set_active(&cms::ColorSettings { rgb: cms::WIDE_GAMUT_RGB.into(), ..Default::default() }).unwrap(); + assert!(!cms::active().rgb_is_srgb()); + let shows_as = |got: Color, want: [f32; 3], what: &str| { + assert!(matches!(got, Color::Rgb { .. }), "{what} reads back as RGB: {got:?}"); + let g = got.to_rgb(); + assert!(g.iter().zip(want).all(|(a, b)| (a - b).abs() < 2e-3), "{what} {got:?} shows as {g:?}, not {want:?}"); + }; + let (a, b) = (Color::rgb(0.9, 0.2, 0.1), Color::lab(50.0, -40.0, -20.0)); + let average = { + let (a, b) = (a.to_rgb(), b.to_rgb()); + [0, 1, 2].map(|i| (a[i] + b[i]) / 2.0) + }; + // Every solid paint of the art read back, in order. + let solids = |doc: &Document| { + let mut out = vec![]; + read_back(doc).walk(|n| { + if matches!(n.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }) { + out.extend(n.appearance.items.iter().filter_map(|i| match i.paint() { + Paint::Solid { color, .. } => Some(*color), + _ => None, + })); + } + }); + out + }; + // A gradient along a stroke: the stroke's outline in its average color. + let mut doc = Document::new(200.0, 100.0); + let layer = doc.layers[0].id; + let mut st = StrokeLayer::new(gradient_paint(ramp(GradientKind::Linear, &[(0.0, a, 1.0, 0.5), (1.0, b, 1.0, 0.5)]), None, None), 4.0); + st.gradient_mode = vectorcraft_doc::StrokeGradientMode::Along; + let n = painted(&mut doc, shapes::rectangle(Rect::new(10.0, 10.0, 30.0, 30.0)), vec![AppearanceItem::Stroke(st)]); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + let [got] = solids(&doc)[..] else { panic!("one solid paint: {:?}", solids(&doc)) }; + shows_as(got, average, "a gradient along a stroke"); + // A radial gradient flattened to a line: its average color. + let flat = GradientGeom { start: (20.0, 20.0).into(), end: (40.0, 20.0).into(), aspect: 0.0, focal: None }; + let radial = ramp(GradientKind::Radial, &[(0.0, a, 1.0, 0.5), (1.0, b, 1.0, 0.5)]); + let doc = one_object( + shapes::rectangle(Rect::new(10.0, 10.0, 50.0, 50.0)), + vec![AppearanceItem::Fill(FillLayer::new(gradient_paint(radial, Some(flat), None)))], + ); + let [got] = solids(&doc)[..] else { panic!("one solid paint: {:?}", solids(&doc)) }; + shows_as(got, average, "a gradient that can't be placed"); + // A stop of a spot color defined in Lab, at full strength. + let moss = Color::lab(55.0, -30.0, 20.0); + let mut doc = Document::new(200.0, 100.0); + let mut swatches: Vec = doc.swatches.iter().cloned().collect(); + swatches.push(Swatch { name: "Moss".into(), paint: solid(moss), global: true, spot: true }); + doc.swatches = swatches.into(); + let layer = doc.layers[0].id; + let stops = vec![GradientStop::new(0.0, Color::rgb(0.1, 0.2, 0.3)), GradientStop { swatch: Some("Moss".into()), ..GradientStop::new(1.0, moss) }]; + let fill = gradient_paint(Gradient::new(GradientKind::Linear, stops), None, None); + let n = painted(&mut doc, shapes::rectangle(Rect::new(10.0, 10.0, 30.0, 30.0)), vec![AppearanceItem::Fill(FillLayer::new(fill))]); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + let back = read_back(&doc); + let Paint::Gradient(g) = back.layers[0].children().unwrap()[0].appearance.fill_paint() else { panic!("a gradient") }; + shows_as(g.gradient.stops.last().unwrap().color, moss.to_rgb(), "a Lab spot color's stop"); + // Type stroked with a Lab color. + let ink = Color::lab(40.0, 30.0, -50.0); + let mut doc = Document::new(200.0, 100.0); + let layer = doc.layers[0].id; + let st = CharStyle { stroke: solid(ink), stroke_width: 1.0, ..style(14.0, Color::rgb(0.8, 0.4, 0.2)) }; + let n = text_node(&mut doc, TextObject::point(vectorcraft_geom::Point::new(20.0, 40.0), "Lab", st)); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + let back = read_back(&doc); + let mut runs = 0; + for n in back.layers[0].children().unwrap() { + if let NodeKind::Text(t) = &n.kind { + for r in &t.runs { + let Paint::Solid { color, .. } = r.style.stroke else { panic!("type stroke {:?}", r.style.stroke) }; + shows_as(color, ink.to_rgb(), "type stroke"); + runs += 1; + } + } + } + assert!(runs > 0, "the type is read back as type"); +} + /// A gradient stop of a Lab spot color writes the RGB values of the Lab values as written (to four /// decimals, clamped to the range a reader reads), the same Lab values its CMYK equivalent and the /// palette's definition come from: for Lab values of many decimals and for Lab values out of range. diff --git a/crates/eps/src/ai_editing/writer.rs b/crates/eps/src/ai_editing/writer.rs index 7db5d11896..b44f66e647 100644 --- a/crates/eps/src/ai_editing/writer.rs +++ b/crates/eps/src/ai_editing/writer.rs @@ -1378,8 +1378,8 @@ impl<'a> Writer<'a> { self.plain_color(*color, stroke); } - /// A color that names no swatch: `g` (gray), `k` (CMYK), else `c m y k r g b Xa` (RGB in the - /// working RGB space, and Lab as display RGB), with its CMYK equivalent (an RGB color's from its + /// A color that names no swatch: `g` (gray), `k` (CMYK), else `c m y k r g b Xa` (RGB, and Lab + /// as RGB, in the working RGB space), with its CMYK equivalent (an RGB color's from its /// values as written, a Lab color's from its Lab values). fn plain_color(&mut self, color: Color, stroke: bool) { let s = &mut self.body; diff --git a/crates/eps/src/ai_editing/writer/paints.rs b/crates/eps/src/ai_editing/writer/paints.rs index f1b52dd91b..a56170596d 100644 --- a/crates/eps/src/ai_editing/writer/paints.rs +++ b/crates/eps/src/ai_editing/writer/paints.rs @@ -391,8 +391,8 @@ impl Writer<'_> { /// A stop's color and its style: gray `lightness 0`, CMYK `c m y k 1`, RGB (and Lab, as RGB) /// `c m y k r g b 2` with its CMYK equivalent; a spot color its full color's CMYK equivalent, /// then its RGB values when it isn't CMYK, its name and how much lighter than the full color, - /// then `3` (CMYK), or `1 4` (RGB, and Lab as RGB). RGB values are an RGB color's own (in the - /// working RGB space) and a Lab color's display RGB ([`ai_ops::rgb_values`]). An RGB color's CMYK + /// then `3` (CMYK), or `1 4` (RGB, and Lab as RGB). RGB values are in the working RGB space: an + /// RGB color's own and a Lab color's converted ([`ai_ops::rgb_values`]). An RGB color's CMYK /// equivalent is converted from its values as written ([`ai_ops::as_written`]), a Lab color's /// from its Lab values, and a spot color's CMYK equivalent and RGB values both come from its full /// color as the palette writes it. diff --git a/crates/eps/src/ai_editing/writer/texts.rs b/crates/eps/src/ai_editing/writer/texts.rs index b161ec636f..a9c4601dc7 100644 --- a/crates/eps/src/ai_editing/writer/texts.rs +++ b/crates/eps/src/ai_editing/writer/texts.rs @@ -26,7 +26,7 @@ use vectorcraft_doc::{ }; use vectorcraft_geom::{Affine, PathData, Point}; -use crate::ps; +use crate::{ai_ops, ps}; /// What the text document holds of type, and what it leaves out. pub(in crate::ai_editing) const TYPE_ATTRIBUTES: &str = "attributes of type other than its font, size, leading, tracking, baseline shift, horizontal and vertical scale, solid fill, solid stroke and its weight, cap, join and miter limit, capitals, small capitals at the document's size, Tate-chu-yoko, Standard Vertical Roman Alignment, paragraph alignment, indents, space before and after, hyphenation on or off and right-to-left direction (for example underline, kerning, OpenType features, swatch links of its colors, character and paragraph styles, tabs, lists, optical margin alignment, area type's inset spacing, vertical alignment and flow, a minimum first baseline with the Ascent first baseline, and type on a path's effect, alignment and spacing and an end bracket at the very end of an open path) are left out of the editing data for other apps"; @@ -170,11 +170,13 @@ fn set(resources: Vec, display: bool) -> V { } /// A paint: kind 0 gray (`[alpha, lightness]`), 1 RGB, 2 CMYK, as the reader's `paint` reads them. +/// RGB values are an RGB color's own (in the working RGB space) and a Lab color's converted into +/// the working RGB space ([`ai_ops::rgb_values`]). fn paint(c: &Color) -> V { let (kind, values) = match *c { Color::Gray { k } => (0, vec![1.0 - f64::from(k.clamp(0.0, 1.0))]), Color::Cmyk { c, m, y, k } => (2, [c, m, y, k].iter().map(|v| f64::from(v.clamp(0.0, 1.0))).collect()), - Color::Rgb { .. } | Color::Lab { .. } => (1, c.to_rgb().iter().map(|v| f64::from(v.clamp(0.0, 1.0))).collect()), + Color::Rgb { .. } | Color::Lab { .. } => (1, ai_ops::rgb_values(*c).iter().map(|v| f64::from(*v)).collect()), }; let values: Vec = std::iter::once(1.0).chain(values).collect(); dict(vec![(99, V::Name("SimplePaint")), (0, dict(vec![(0, V::Int(kind)), (1, reals(&values))]))]) diff --git a/crates/eps/src/ai_ops.rs b/crates/eps/src/ai_ops.rs index 3b2bdd88d8..34c43ebc18 100644 --- a/crates/eps/src/ai_ops.rs +++ b/crates/eps/src/ai_ops.rs @@ -115,20 +115,23 @@ pub(crate) fn as_written(color: Color) -> Color { } } -/// The RGB values written for `color`, clamped to 0..1: an RGB color's own values (in the working -/// RGB space, as a reader reads them back), any other color's display RGB. +/// The RGB values written for `color`, clamped to 0..1, in the working RGB space, as a reader +/// reads them back: an RGB color's own values, any other color's display RGB converted into the +/// working RGB space. pub(crate) fn rgb_values(color: Color) -> [f32; 3] { match color { Color::Rgb { r, g, b } => [r, g, b].map(unit), - c => c.to_rgb().map(unit), + c => vectorcraft_color::cms::active().srgb_to_rgb(c.to_rgb()).map(unit), } } -/// The average colour of a gradient's stops (in RGB). +/// The average color of a gradient's stops: the average of their display RGB, as an RGB color in +/// the working RGB space. pub(crate) fn average(g: &Gradient) -> Color { let n = g.stops.len().max(1) as f32; let sum = g.stops.iter().map(|s| s.color.to_rgb()).fold([0.0f32; 3], |a, c| [a[0] + c[0], a[1] + c[1], a[2] + c[2]]); - Color::rgb(unit(sum[0] / n), unit(sum[1] / n), unit(sum[2] / n)) + let [r, green, b] = vectorcraft_color::cms::active().srgb_to_rgb(sum.map(|v| v / n)).map(unit); + Color::rgb(r, green, b) } /// The stroke's width, cap, join, miter limit and dashes: `w J j M d`. diff --git a/crates/eps/src/legacy_ai/tests.rs b/crates/eps/src/legacy_ai/tests.rs index 6b2f8335b8..e50c9c5c82 100644 --- a/crates/eps/src/legacy_ai/tests.rs +++ b/crates/eps/src/legacy_ai/tests.rs @@ -817,6 +817,63 @@ fn rgb_stops_are_written_again_unchanged() { assert_eq!(again, first); } +/// With a working RGB space other than sRGB, a Lab fill and a freeform gradient's average color +/// are written as RGB values in the working RGB space, so they read back as RGB colors that show as +/// the colors they were written for. +#[test] +fn a_lab_fill_reads_back_as_the_same_color_in_a_wide_gamut_working_space() { + const CHILD: &str = "VECTORCRAFT_TEST_LEGACY_AI_WIDE_GAMUT_LAB"; + if std::env::var_os(CHILD).is_none() { + // Color settings are process-wide: exercise this profile in a separate test process. + let output = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "legacy_ai::tests::a_lab_fill_reads_back_as_the_same_color_in_a_wide_gamut_working_space", "--nocapture"]) + .env(CHILD, "1") + .output() + .unwrap(); + let stdout = String::from_utf8_lossy(&output.stdout); + assert!( + output.status.success() && stdout.contains("test result: ok. 1 passed; 0 failed;"), + "isolated color profile test failed:\n{stdout}\n{}", + String::from_utf8_lossy(&output.stderr), + ); + return; + } + use vectorcraft_color::cms; + cms::set_active(&cms::ColorSettings { rgb: cms::WIDE_GAMUT_RGB.into(), ..Default::default() }).unwrap(); + assert!(!cms::active().rgb_is_srgb()); + let lab = Color::lab(60.0, 20.0, -30.0); + let mut doc = Document::new(100.0, 100.0); + let n = shape(&mut doc, shapes::rectangle(Rect::new(10.0, 10.0, 50.0, 50.0)), Paint::solid(lab), Paint::None); + let layer = doc.layers[0].id; + doc.insert(Some(layer), usize::MAX, n).unwrap(); + // A freeform gradient is written as the average of its stops' display colors. + let (a, b) = (Color::rgb(0.9, 0.2, 0.1), Color::lab(50.0, -40.0, -20.0)); + let stops = vec![GradientStop::new(0.0, a), GradientStop::new(1.0, b)]; + let free = Paint::Gradient(Box::new(GradientPaint::new(Gradient::new(GradientKind::Freeform, stops)))); + let n = shape(&mut doc, shapes::rectangle(Rect::new(60.0, 10.0, 90.0, 50.0)), free, Paint::None); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + let average = { + let (a, b) = (a.to_rgb(), b.to_rgb()); + [0, 1, 2].map(|i| (a[i] + b[i]) / 2.0) + }; + // Written without [`write`]'s printed comparison, which paints a gradient in its first stop's + // color and not in the average color the writer writes for a freeform gradient. + let back = crate::import(&export_legacy_ai(&doc, &LegacyAiOptions::default()).unwrap().bytes).unwrap().document; + let mut read = vec![]; + back.walk(|n| { + if let NodeKind::Path { .. } = n.kind { + read.push(n.appearance.fill_paint()); + } + }); + let [Paint::Solid { color: got @ Color::Rgb { .. }, .. }, Paint::Solid { color: avg @ Color::Rgb { .. }, .. }] = read.as_slice() else { + panic!("two RGB fills: {read:?}") + }; + for (got, w, what) in [(got, lab.to_rgb(), "Lab fill"), (avg, average, "freeform gradient's average")] { + let g = got.to_rgb(); + assert!(g.iter().zip(w).all(|(a, b)| (a - b).abs() < 2e-3), "{what} {got:?} shows as {g:?}, not {w:?}"); + } +} + /// A gradient from white to #1b2a6b, the colors of #2687's circle, placed at `geom` (None: fitted /// to the object). fn white_to_navy(kind: GradientKind, geom: Option) -> Paint { diff --git a/crates/eps/src/legacy_ai/writer.rs b/crates/eps/src/legacy_ai/writer.rs index 20f8b32b96..7a14d5ec50 100644 --- a/crates/eps/src/legacy_ai/writer.rs +++ b/crates/eps/src/legacy_ai/writer.rs @@ -648,10 +648,7 @@ impl<'a> Writer<'a> { Color::Cmyk { c, m, y, k } => Ink::Cmyk([c, m, y, k].map(unit)), // The CMYK equivalent of the RGB values as written. Color::Rgb { r, g, b } => Ink::Rgb(self.cms.to_cmyk(&ai_ops::as_written(*color), intent).map(unit), [r, g, b].map(unit)), - Color::Lab { .. } => { - let rgb = color.to_rgb().map(unit); - Ink::Rgb(self.cms.to_cmyk(color, intent).map(unit), rgb) - } + Color::Lab { .. } => Ink::Rgb(self.cms.to_cmyk(color, intent).map(unit), ai_ops::rgb_values(*color)), } } From 447e1f898e9148a26f043d0ad9bf326512c5fde5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 15:39:31 -0800 Subject: [PATCH 004/226] Blob Brush: path.blob rejects invalid fidelity, angle and roundness path.blob used to clamp a supplied angle to -180..180, a roundness to 0..100 and a fidelity to 0.01..100 pt, so a value such as 200 or -1 painted with a different value than the one given. It now returns an invalid-parameters error for a value outside its range, before the document changes, and records no undo step. A key left out or null still takes its default: 0 degrees, 100% and no fitting. path.freehand (and brush.freehand) treated any style other than "brush" as "pencil", and any extend end other than "start" as "end". It now rejects an unknown style or extend end with an error, as it already did for connect end; left out or null, they keep their defaults. The new messages have rows in every complete-message catalog, and the connect end message gets rows in the catalogs that lacked one. Docs: path.blob and path.freehand params text, docs/mcp.md, docs/target-app-parity.md. --- crates/engine/src/cmd/draw2/commands.rs | 4 +- crates/engine/src/cmd/draw2/freehand.rs | 38 +++++++---- crates/engine/src/tests/draw2.rs | 88 ++++++++++++++++++++++++- crates/ui-egui/src/i18n/ca.tsv | 6 ++ crates/ui-egui/src/i18n/cs.tsv | 6 ++ crates/ui-egui/src/i18n/de.tsv | 6 ++ crates/ui-egui/src/i18n/el.tsv | 6 ++ crates/ui-egui/src/i18n/es.tsv | 6 ++ crates/ui-egui/src/i18n/fi.tsv | 6 ++ crates/ui-egui/src/i18n/fr.tsv | 6 ++ crates/ui-egui/src/i18n/hi.tsv | 8 ++- crates/ui-egui/src/i18n/hu.tsv | 6 ++ crates/ui-egui/src/i18n/it.tsv | 6 ++ crates/ui-egui/src/i18n/ja.tsv | 6 ++ crates/ui-egui/src/i18n/ka.tsv | 6 ++ crates/ui-egui/src/i18n/ko.tsv | 6 ++ crates/ui-egui/src/i18n/nl.tsv | 6 ++ crates/ui-egui/src/i18n/pl.tsv | 6 ++ crates/ui-egui/src/i18n/pt-br.tsv | 6 ++ crates/ui-egui/src/i18n/ru.tsv | 6 ++ crates/ui-egui/src/i18n/sv.tsv | 6 +- crates/ui-egui/src/i18n/tests.rs | 57 ++++++++++++++++ crates/ui-egui/src/i18n/tr.tsv | 6 ++ crates/ui-egui/src/i18n/uk.tsv | 6 ++ crates/ui-egui/src/i18n/vi.tsv | 6 ++ crates/ui-egui/src/i18n/zh-hans.tsv | 6 ++ crates/ui-egui/src/i18n/zh-hant.tsv | 6 ++ docs/mcp.md | 10 ++- docs/target-app-parity.md | 1 + 29 files changed, 317 insertions(+), 21 deletions(-) diff --git a/crates/engine/src/cmd/draw2/commands.rs b/crates/engine/src/cmd/draw2/commands.rs index 53949fdaf0..9b8a648411 100644 --- a/crates/engine/src/cmd/draw2/commands.rs +++ b/crates/engine/src/cmd/draw2/commands.rs @@ -11,7 +11,7 @@ pub fn specs() -> Vec { "Pencil", [], None, - "{points: [[x,y]…] or [[x,y,pressure]…] or [[x,y,pressure,tiltX,tiltY,rotation]…] (pen pressure 0..1: the stroke keeps it, for Calligraphic and Scatter brushes with Pressure variation; a point without one presses fully. Pen tilt in degrees, each −90..90, x positive leaning right and y leaning down the page, and barrel rotation in degrees clockwise: the stroke keeps how far the pen leaned, which way and how far its barrel turned, for brushes with Tilt, Bearing and Rotation variation; null for what a point lacks), fidelity?: pt (1.5; from 0.000015625 (0.01 / 640) to 100 / 0.0313 (about 3194.89), the Pencil's and the Paintbrush's 0.01 to 100 px Fidelity at the highest and the lowest zoom; a value outside that range is an error. The tools send their Fidelity in pixels divided by the zoom, kept within the range), fit?: bool (true; false: the points are joined by straight segments, as the Pencil previews a stroke with Live curve fitting off), closed?, style?: \"pencil\"|\"brush\", fill?: bool, keepSelected?: bool (true: the drawn or continued path is selected; false: a new path leaves nothing selected, and a continued or redrawn one is deselected while the rest of the selection stays), extend?: {id, end: \"start\"|\"end\"}, connect?: {id, end: \"start\"|\"end\"}, redraw?: {id, within?: pt (12)}} fit a freehand stroke → {id}. extend continues the path from that end; with connect, the stroke ends on that end of another path's last open subpath and joins it on, in one path with the extended path's appearance (the other path is removed when nothing of it is left); redraw (Edit Selected Paths) replaces the section of the path between where the stroke starts and ends, each within `within` of one subpath (the shorter way round a closed one), and draws a new path when the stroke doesn't end on it", + "{points: [[x,y]…] or [[x,y,pressure]…] or [[x,y,pressure,tiltX,tiltY,rotation]…] (pen pressure 0..1: the stroke keeps it, for Calligraphic and Scatter brushes with Pressure variation; a point without one presses fully. Pen tilt in degrees, each −90..90, x positive leaning right and y leaning down the page, and barrel rotation in degrees clockwise: the stroke keeps how far the pen leaned, which way and how far its barrel turned, for brushes with Tilt, Bearing and Rotation variation; null for what a point lacks), fidelity?: pt (1.5; from 0.000015625 (0.01 / 640) to 100 / 0.0313 (about 3194.89), the Pencil's and the Paintbrush's 0.01 to 100 px Fidelity at the highest and the lowest zoom; a value outside that range is an error. The tools send their Fidelity in pixels divided by the zoom, kept within the range), fit?: bool (true; false: the points are joined by straight segments, as the Pencil previews a stroke with Live curve fitting off), closed?, style?: \"pencil\" (default) | \"brush\", fill?: bool, keepSelected?: bool (true: the drawn or continued path is selected; false: a new path leaves nothing selected, and a continued or redrawn one is deselected while the rest of the selection stays), extend?: {id, end?: \"end\" (default) | \"start\"}, connect?: {id, end: \"start\"|\"end\"}, redraw?: {id, within?: pt (12)}} fit a freehand stroke → {id}. extend continues the path from that end; with connect, the stroke ends on that end of another path's last open subpath and joins it on, in one path with the extended path's appearance (the other path is removed when nothing of it is left); redraw (Edit Selected Paths) replaces the section of the path between where the stroke starts and ends, each within `within` of one subpath (the shorter way round a closed one), and draws a new path when the stroke doesn't end on it. Any other style, extend end or connect end is an error, and nothing changes", has_doc, freehand ), @@ -128,7 +128,7 @@ pub fn specs() -> Vec { "Blob Brush", [], None, - "{points: [[x,y]…] or [[x,y,pressure]…] (pen pressure 0..1), size?: pt (10), sizeMode?: \"fixed\" (default) | \"pressure\" (Blob Brush Tool Options' Size set to Pressure: the brush is size − sizeVariation wide at the lightest pen pressure and size + sizeVariation at the heaviest, at least 0.1 pt; a stroke without pressure keeps the size), sizeVariation?: pt (0), angle?: ° (0, kept within −180–180: the tip's long axis counter-clockwise from horizontal, kept on the page along the stroke), roundness?: % (100, kept within 0–100: the tip's short axis in percent of its long one, 100 round; 0 is drawn as 0.1), fidelity?: pt (0.01–100; the brush follows the stroke fitted at this tolerance as path.freehand fits a Pencil stroke, and a higher value gives a smoother shape; without it the brush follows every point), merge?: true, mergeOnlySelection?: bool (false: merge with any touching same-color blob; true: only with selected ones), keepSelected?: bool (false: the drawn or merged path is not selected, and the rest of the selection stays; true: it is selected)} filled brush shape, merged with the topmost touching same-color blob and the touching ones next to it in stacking order in its group or layer → {id}", + "{points: [[x,y]…] or [[x,y,pressure]…] (pen pressure 0..1), size?: pt (10), sizeMode?: \"fixed\" (default) | \"pressure\" (Blob Brush Tool Options' Size set to Pressure: the brush is size − sizeVariation wide at the lightest pen pressure and size + sizeVariation at the heaviest, at least 0.1 pt; a stroke without pressure keeps the size), sizeVariation?: pt (0), angle?: ° (0, −180–180: the tip's long axis counter-clockwise from horizontal, kept on the page along the stroke), roundness?: % (100, 0–100: the tip's short axis in percent of its long one, 100 round; 0 is drawn as 0.1), fidelity?: pt (0.01–100; the brush follows the stroke fitted at this tolerance as path.freehand fits a Pencil stroke, and a higher value gives a smoother shape; without it the brush follows every point), merge?: true, mergeOnlySelection?: bool (false: merge with any touching same-color blob; true: only with selected ones), keepSelected?: bool (false: the drawn or merged path is not selected, and the rest of the selection stays; true: it is selected)} filled brush shape, merged with the topmost touching same-color blob and the touching ones next to it in stacking order in its group or layer → {id}. An angle, roundness or fidelity outside its range is rejected with an error, and nothing changes", has_doc, blob ), diff --git a/crates/engine/src/cmd/draw2/freehand.rs b/crates/engine/src/cmd/draw2/freehand.rs index 31e184e195..645fad27f8 100644 --- a/crates/engine/src/cmd/draw2/freehand.rs +++ b/crates/engine/src/cmd/draw2/freehand.rs @@ -159,12 +159,20 @@ pub(super) fn freehand(s: &mut Session, p: &Value) -> Result { // The tolerance the stroke is fitted at; with `fit: false` it is not fitted. let fit_tol = switch_or(p, "fit", true, C)?.then_some(tol); let closed = switch_or(p, "closed", false, C)?; - let brush = str_param(p, "style") == Some("brush"); + let brush = match p.get("style").filter(|v| !v.is_null()).map(Value::as_str) { + None | Some(Some("pencil")) => false, + Some(Some("brush")) => true, + Some(_) => return Err(bad(C, "style must be \"pencil\" or \"brush\"")), + }; let keep_selected = switch_or(p, "keepSelected", true, C)?; let filled = switch_or(p, "fill", false, C)?; if let Some(ext) = p.get("extend").filter(|v| !v.is_null()) { let id = object_param(ext, "id", C)?.ok_or_else(|| bad(C, "extend needs id"))?; - let at_start = str_param(ext, "end") == Some("start"); + let at_start = match ext.get("end").filter(|v| !v.is_null()).map(Value::as_str) { + None | Some(Some("end")) => false, + Some(Some("start")) => true, + Some(_) => return Err(bad(C, "extend end must be \"start\" or \"end\"")), + }; let (pd, _) = path_of(&s.doc()?.doc, id)?; let si = pd.subpaths.iter().rposition(|s| !s.closed && !s.anchors.is_empty()).ok_or_else(|| bad(C, "path has no open end"))?; let mut sp = pd.subpaths[si].clone(); @@ -391,12 +399,23 @@ pub(super) fn blob(s: &mut Session, p: &Value) -> Result { return Err(bad(C, "size must be positive")); } let angle = number_or(p, "angle", 0.0, C)?; + if !(-180.0..=180.0).contains(&angle) { + return Err(bad(C, "`angle` must be from -180 to 180 degrees")); + } let roundness = number_or(p, "roundness", 100.0, C)?; - if !angle.is_finite() || !roundness.is_finite() { - return Err(bad(C, "angle and roundness must be finite")); + if !(0.0..=100.0).contains(&roundness) { + return Err(bad(C, "`roundness` must be from 0 to 100%")); + } + // With `fidelity` (pt), the brush follows the stroke fitted by [`fit_freehand`], as a Pencil + // stroke is fitted. Without it, or when the fitted stroke has no length (a short stroke back to + // its start), the brush follows every point. + let fidelity = match p.get("fidelity") { + None | Some(Value::Null) => None, + Some(_) => Some(number_or(p, "fidelity", 0.0, C)?), + }; + if fidelity.is_some_and(|f| !(vectorcraft_tools::draw2::MIN_FIDELITY..=100.0).contains(&f)) { + return Err(bad(C, "`fidelity` must be from 0.01 to 100 pt")); } - let angle = angle.clamp(-180.0, 180.0); - let roundness = roundness.clamp(0.0, 100.0); let tip = vectorcraft_tools::draw2::blob_tip(angle, roundness); let squash = tip.inverse(); // Width profiles use distance along the spine, so measure pressure on the same squashed @@ -418,13 +437,6 @@ pub(super) fn blob(s: &mut Session, p: &Value) -> Result { let mapped_pts: Vec = mapped_samples.into_iter().map(|s| s.pt).collect(); // The widest the brush gets: the area merges look in. let reach = pressure.as_ref().map_or(size, |(_, v)| size + v); - // With `fidelity` (pt), the brush follows the stroke fitted by [`fit_freehand`], as a Pencil - // stroke is fitted. Without it, or when the fitted stroke has no length (a short stroke back to - // its start), the brush follows every point. - let fidelity = match p.get("fidelity") { - None | Some(Value::Null) => None, - Some(_) => Some(number_or(p, "fidelity", 0.0, C)?.clamp(vectorcraft_tools::draw2::MIN_FIDELITY, 100.0)), - }; let spine = |tol: Option| { let path = match tol { Some(tol) => PathData::single(fit_freehand(&pts, tol, false)), diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index 79dbd366f6..3a4ec30ab5 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -86,8 +86,57 @@ fn blob_tip_zero_and_invalid_values_are_safe() { p[key] = value; assert!(s.execute("path.blob", &p).is_err(), "{key}: {p}"); } - s.execute("path.blob", &json!({"points": [[100, 200], [300, 200]], "angle": 1e300, "roundness": -1e300, "merge": false})).unwrap(); - assert!(paths(&s)[1].1.control_bounds().unwrap().height().is_finite()); + let stroke = json!({"points": [[100, 200], [300, 200]], "merge": false}); + refuses_with(&mut s, "path.blob", &with(&stroke, json!({"angle": 1e300})), "`angle` must be from -180 to 180 degrees"); + refuses_with(&mut s, "path.blob", &with(&stroke, json!({"roundness": -1e300})), "`roundness` must be from 0 to 100%"); + assert_eq!(paths(&s).len(), 1); +} + +/// `path.blob` refuses an `angle`, `roundness` or `fidelity` outside its range and changes nothing; +/// each end of a range paints, and a key left out or null takes its default (0°, 100% and no fitting). +#[test] +fn blob_brush_rejects_out_of_range_tip_and_fidelity_without_edit() { + let mut s = session(); + let stroke = json!({"points": [[100, 100], [300, 100]], "size": 20, "merge": false}); + let angle = "`angle` must be from -180 to 180 degrees"; + let roundness = "`roundness` must be from 0 to 100%"; + let fidelity = "`fidelity` must be from 0.01 to 100 pt"; + for (extra, want) in [ + (json!({"angle": -180.5}), angle), + (json!({"angle": 181}), angle), + (json!({"angle": 1e300}), angle), + (json!({"roundness": -0.5}), roundness), + (json!({"roundness": 101}), roundness), + (json!({"fidelity": 0.005}), fidelity), + (json!({"fidelity": 0}), fidelity), + (json!({"fidelity": -1}), fidelity), + (json!({"fidelity": 101}), fidelity), + (json!({"fidelity": 1e300}), fidelity), + (json!({"angle": 45, "roundness": 50, "fidelity": 100.5}), fidelity), + ] { + refuses_with(&mut s, "path.blob", &with(&stroke, extra), want); + } + assert!(paths(&s).is_empty()); + let painted = |s: &mut Session, extra: serde_json::Value| { + let id = NodeId(s.execute("path.blob", &with(&stroke, extra)).unwrap()["id"].as_u64().unwrap()); + path(s, id) + }; + for extra in [ + json!({"angle": -180}), + json!({"angle": 180}), + json!({"roundness": 0}), + json!({"roundness": 100}), + json!({"fidelity": 0.01}), + json!({"fidelity": 100}), + ] { + let pd = painted(&mut s, extra.clone()); + assert!(pd.control_bounds().is_some_and(|b| b.height().is_finite() && b.height() > 0.0), "{extra}: {pd:?}"); + } + let defaults = painted(&mut s, json!({})); + let nulls = painted(&mut s, json!({"angle": null, "roundness": null, "fidelity": null})); + let given = painted(&mut s, json!({"angle": 0, "roundness": 100})); + assert_eq!(nulls, defaults); + assert_eq!(given, defaults); } #[test] @@ -311,6 +360,41 @@ fn pencil_connect_keeps_the_rest_of_a_compound_path_and_refuses_the_extended_pat assert!(s.execute("path.freehand", &json!({"points": points, "extend": {"id": a.0}, "connect": {"id": a.0}})).is_err()); } +/// `path.freehand` refuses a `style` other than "pencil" or "brush" and an `extend` end other than +/// "start" or "end" and changes nothing; left out or null, the style is "pencil" and the stroke +/// continues the path from its end. +#[test] +fn pencil_refuses_an_unknown_style_or_extend_end() { + let mut s = session(); + let a = line(&mut s, 100.0, 100.0, 200.0, 100.0); + let stroke = json!({"points": [[100, 300], [200, 320], [300, 300]]}); + for style in [json!("calligraphic"), json!("Brush"), json!(""), json!(1), json!(true)] { + refuses_with(&mut s, "path.freehand", &with(&stroke, json!({ "style": style })), "style must be \"pencil\" or \"brush\""); + } + let from_end = json!({"points": [[200, 100], [250, 150], [300, 100]]}); + for end in [json!("middle"), json!("START"), json!(""), json!(0), json!(false)] { + let p = with(&from_end, json!({"extend": {"id": a.0, "end": end}})); + refuses_with(&mut s, "path.freehand", &p, "extend end must be \"start\" or \"end\""); + } + assert_eq!((paths(&s).len(), path(&s, a).anchor_count()), (1, 2), "refused: nothing changed"); + for style in [json!("pencil"), json!("brush"), json!(null)] { + s.execute("path.freehand", &with(&stroke, json!({ "style": style }))).unwrap(); + } + assert_eq!(paths(&s).len(), 4); + for end in [json!(null), json!("end")] { + let mut s = session(); + let a = line(&mut s, 100.0, 100.0, 200.0, 100.0); + s.execute("path.freehand", &with(&from_end, json!({"extend": {"id": a.0, "end": end}}))).unwrap(); + let sp = &path(&s, a).subpaths[0]; + assert_eq!((sp.anchors[0].p, sp.anchors[sp.anchors.len() - 1].p), (Point::new(100.0, 100.0), Point::new(300.0, 100.0)), "{end}"); + } + let mut s = session(); + let a = line(&mut s, 100.0, 100.0, 200.0, 100.0); + s.execute("path.freehand", &json!({"points": [[100, 100], [50, 150], [0, 100]], "extend": {"id": a.0, "end": "start"}})).unwrap(); + let ends: Vec = path(&s, a).subpaths[0].anchors.iter().map(|x| x.p).collect(); + assert!(ends.contains(&Point::new(0.0, 100.0)) && ends.contains(&Point::new(200.0, 100.0)), "continued from its start: {ends:?}"); +} + /// With Keep selected off, a compound path whose direct-selected anchors all lie on the subpath /// that connect joins on is no longer selected, and Delete then has nothing to delete. #[test] diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 9dfc5458b5..aa5ee3510f 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7457,6 +7457,12 @@ breakText Glyphs Glifs @msg No bridge of this width fits across the selected art Cap pont d’aquesta amplada no cap a la il·lustració seleccionada @msg Some islands could not be joined to the area around the art Algunes illes no s’han pogut unir a l’àrea que envolta la il·lustració @msg `width` must be from {lo} to {hi} pt `width` ha d’estar entre {lo} i {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` ha d’estar entre -180 i 180 graus +@msg `roundness` must be from 0 to 100% `roundness` ha d’estar entre 0 i 100% +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` ha d’estar entre 0.01 i 100 pt +@msg style must be "pencil" or "brush" style ha de ser "pencil" o "brush" +@msg extend end must be "start" or "end" l’extrem d’extend ha de ser "start" o "end" +@msg connect end must be "start" or "end" l’extrem de connect ha de ser "start" o "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` ha de ser un nombre enter d’1 a {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Caixa i línies de pelat… Weed Box and Lines Caixa i línies de pelat diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index edaad350a0..2ff4359d18 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7476,6 +7476,12 @@ breakText Glyphs Glyfy @msg No bridge of this width fits across the selected art Přes vybranou kresbu se nevejde žádný můstek této šířky @msg Some islands could not be joined to the area around the art Některé ostrůvky nebylo možné připojit k oblasti kolem kresby @msg `width` must be from {lo} to {hi} pt `width` musí být od {lo} do {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` musí být od -180 do 180 stupňů +@msg `roundness` must be from 0 to 100% `roundness` musí být od 0 do 100 % +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` musí být od 0.01 do 100 pt +@msg style must be "pencil" or "brush" style musí být "pencil" nebo "brush" +@msg extend end must be "start" or "end" konec extend musí být "start" nebo "end" +@msg connect end must be "start" or "end" konec connect musí být "start" nebo "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` musí být celé číslo od 1 do {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Rámeček a linie pro vybírání… Weed Box and Lines Rámeček a linie pro vybírání diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index cd6a428631..345c772d9e 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7072,6 +7072,12 @@ breakText Glyphs Glyphen @msg No bridge of this width fits across the selected art Kein Steg dieser Breite passt über das ausgewählte Bildmaterial @msg Some islands could not be joined to the area around the art Einige Inseln konnten nicht mit der Fläche um das Bildmaterial verbunden werden @msg `width` must be from {lo} to {hi} pt `width` muss zwischen {lo} und {hi} pt liegen +@msg `angle` must be from -180 to 180 degrees `angle` muss zwischen -180 und 180 Grad liegen +@msg `roundness` must be from 0 to 100% `roundness` muss zwischen 0 und 100 % liegen +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` muss zwischen 0.01 und 100 pt liegen +@msg style must be "pencil" or "brush" style muss "pencil" oder "brush" sein +@msg extend end must be "start" or "end" Das Ende von extend muss "start" oder "end" sein +@msg connect end must be "start" or "end" Das Ende von connect muss "start" oder "end" sein @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` muss eine ganze Zahl von 1 bis {MAX_BRIDGES_PER_ISLAND} sein Weed Box and Lines… Entgitterrahmen und -linien… Weed Box and Lines Entgitterrahmen und -linien diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index fc76658c72..2a3c947e76 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7429,6 +7429,12 @@ breakText Glyphs Γλύφοι @msg No bridge of this width fits across the selected art Καμία γέφυρα αυτού του πλάτους δεν χωράει στο επιλεγμένο γραφικό @msg Some islands could not be joined to the area around the art Ορισμένες νησίδες δεν ήταν δυνατό να συνδεθούν με την περιοχή γύρω από το γραφικό @msg `width` must be from {lo} to {hi} pt Το `width` πρέπει να είναι από {lo} έως {hi} pt +@msg `angle` must be from -180 to 180 degrees Το `angle` πρέπει να είναι από -180 έως 180 μοίρες +@msg `roundness` must be from 0 to 100% Το `roundness` πρέπει να είναι από 0 έως 100% +@msg `fidelity` must be from 0.01 to 100 pt Το `fidelity` πρέπει να είναι από 0.01 έως 100 pt +@msg style must be "pencil" or "brush" Το style πρέπει να είναι "pencil" ή "brush" +@msg extend end must be "start" or "end" Το άκρο του extend πρέπει να είναι "start" ή "end" +@msg connect end must be "start" or "end" Το άκρο του connect πρέπει να είναι "start" ή "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} Το `count` πρέπει να είναι ακέραιος από 1 έως {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Πλαίσιο και γραμμές αφαίρεσης περισσευμάτων… Weed Box and Lines Πλαίσιο και γραμμές αφαίρεσης περισσευμάτων diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index c7c9c8bc1e..070238b7a0 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7420,6 +7420,12 @@ breakText Glyphs Glifos @msg No bridge of this width fits across the selected art Ningún puente de este ancho cabe en la ilustración seleccionada @msg Some islands could not be joined to the area around the art Algunas islas no se pudieron unir al área que rodea la ilustración @msg `width` must be from {lo} to {hi} pt `width` debe estar entre {lo} y {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` debe estar entre -180 y 180 grados +@msg `roundness` must be from 0 to 100% `roundness` debe estar entre 0 y 100 % +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` debe estar entre 0.01 y 100 pt +@msg style must be "pencil" or "brush" style debe ser "pencil" o "brush" +@msg extend end must be "start" or "end" el extremo de extend debe ser "start" o "end" +@msg connect end must be "start" or "end" el extremo de connect debe ser "start" o "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` debe ser un número entero entre 1 y {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Caja y líneas de pelado… Weed Box and Lines Caja y líneas de pelado diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 126e7854f9..70c6851636 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7511,6 +7511,12 @@ breakText Glyphs Merkit @msg No bridge of this width fits across the selected art Näin leveä silta ei mahdu valitun grafiikan poikki @msg Some islands could not be joined to the area around the art Joitakin saarekkeita ei voitu yhdistää grafiikkaa ympäröivään alueeseen @msg `width` must be from {lo} to {hi} pt `width`-arvon on oltava {lo}–{hi} pt +@msg `angle` must be from -180 to 180 degrees `angle`-arvon on oltava -180–180 astetta +@msg `roundness` must be from 0 to 100% `roundness`-arvon on oltava 0–100 % +@msg `fidelity` must be from 0.01 to 100 pt `fidelity`-arvon on oltava 0.01–100 pt +@msg style must be "pencil" or "brush" style-arvon on oltava "pencil" tai "brush" +@msg extend end must be "start" or "end" extend-pään on oltava "start" tai "end" +@msg connect end must be "start" or "end" connect-pään on oltava "start" tai "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` on oltava kokonaisluku 1–{MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Karsintakehys ja -viivat… Weed Box and Lines Karsintakehys ja -viivat diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3941bf0497..8c90ad7233 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7471,6 +7471,12 @@ breakText Glyphs Glyphes @msg No bridge of this width fits across the selected art Aucun pont de cette largeur ne tient en travers de l’illustration sélectionnée @msg Some islands could not be joined to the area around the art Certains îlots n’ont pas pu être reliés à la zone autour de l’illustration @msg `width` must be from {lo} to {hi} pt `width` doit être compris entre {lo} et {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` doit être compris entre -180 et 180 degrés +@msg `roundness` must be from 0 to 100% `roundness` doit être compris entre 0 et 100 % +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` doit être compris entre 0.01 et 100 pt +@msg style must be "pencil" or "brush" style doit être "pencil" ou "brush" +@msg extend end must be "start" or "end" l’extrémité de extend doit être "start" ou "end" +@msg connect end must be "start" or "end" l’extrémité de connect doit être "start" ou "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` doit être un nombre entier compris entre 1 et {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Cadre et lignes d’échenillage… Weed Box and Lines Cadre et lignes d’échenillage diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index bf2f223fc0..f0e45ef79c 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -6386,7 +6386,6 @@ antiAlias Sharp शार्प @msg anchor `{key}` must be a number एंकर `{key}` को एक नंबर होना चाहिए @msg anchor `smooth` must be true or false एंकर का `smooth` true या false होना चाहिए @msg anchor must name a registered panel anchor किसी पंजीकृत पैनल का नाम होना चाहिए -@msg angle and roundness must be finite कोण और गोलाई परिमित होना चाहिए @msg angles must be a list as long as pins (degrees or null) angles पिन जितनी लंबी सूची होनी चाहिए (डिग्री या null) @msg Angles require two straight segments कोणों को दो सीधे खंडों की आवश्यकता होती है @msg antiAlias `{id}`: none, art or type antiAlias `{id}`: none, art या type @@ -6569,7 +6568,7 @@ antiAlias Sharp शार्प @msg compound paths can only contain paths यौगिक पाथ में केवल पाथ हो सकते हैं @msg compound shapes take paths, compound paths, groups, compound shapes, type, blends and envelopes कंपाउंड शेप पाथ, कंपाउंड पाथ, समूह, कंपाउंड शेप, टाइप, ब्लेंड और एन्वेलप लेते हैं @msg compressed (RLE) bitmaps can't be read yet संकुचित (RLE) bitmaps अभी तक पढ़ा नहीं जा सकता है -@msg connect end must be "start" or "end" कनेक्ट अंत "start" या "end" होना चाहिए +@msg connect end must be "start" or "end" connect अंत "start" या "end" होना चाहिए @msg connect needs a path other than the one extended connect के लिए बढ़ाए गए पाथ के अलावा कोई दूसरा पाथ चाहिए @msg connect needs id connect के लिए id चाहिए @msg connect path has no open end कनेक्ट पाथ का कोई खुला अंत नहीं है @@ -8868,6 +8867,11 @@ theme Appearance अपीयरेंस @msg No bridge of this width fits across the selected art इस चौड़ाई का कोई ब्रिज चुने गए आर्टवर्क के पार नहीं आता @msg Some islands could not be joined to the area around the art कुछ आइलैंड आर्टवर्क के आसपास के क्षेत्र से नहीं जोड़े जा सके @msg `width` must be from {lo} to {hi} pt `width` {lo} से {hi} pt तक होना चाहिए +@msg `angle` must be from -180 to 180 degrees `angle` -180 से 180 डिग्री तक होना चाहिए +@msg `roundness` must be from 0 to 100% `roundness` 0 से 100% तक होना चाहिए +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` 0.01 से 100 pt तक होना चाहिए +@msg style must be "pencil" or "brush" style "pencil" या "brush" होना चाहिए +@msg extend end must be "start" or "end" extend अंत "start" या "end" होना चाहिए @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` 1 से {MAX_BRIDGES_PER_ISLAND} तक पूरी संख्या होना चाहिए Weed Box and Lines… वीड बॉक्स और लाइनें… Weed Box and Lines वीड बॉक्स और लाइनें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 969b923a1c..939ccb6912 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7460,6 +7460,12 @@ breakText Glyphs Glifák @msg No bridge of this width fits across the selected art Ilyen széles híd nem fér el a kijelölt grafikán @msg Some islands could not be joined to the area around the art Egyes szigeteket nem sikerült összekötni a grafikát körülvevő területtel @msg `width` must be from {lo} to {hi} pt A `width` értéke {lo} és {hi} pt között lehet +@msg `angle` must be from -180 to 180 degrees Az `angle` értéke -180 és 180 fok között lehet +@msg `roundness` must be from 0 to 100% A `roundness` értéke 0 és 100% között lehet +@msg `fidelity` must be from 0.01 to 100 pt A `fidelity` értéke 0.01 és 100 pt között lehet +@msg style must be "pencil" or "brush" A style értéke "pencil" vagy "brush" lehet +@msg extend end must be "start" or "end" Az extend vége "start" vagy "end" lehet +@msg connect end must be "start" or "end" A connect vége "start" vagy "end" lehet @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count`: 1 és {MAX_BRIDGES_PER_ISLAND} közötti egész szám kell Weed Box and Lines… Gyomláló keret és vonalak… Weed Box and Lines Gyomláló keret és vonalak diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index ea10433ebd..bb7dda9ee7 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7106,6 +7106,12 @@ breakText Glyphs Glifi @msg No bridge of this width fits across the selected art Nessun ponte di questa larghezza entra nella grafica selezionata @msg Some islands could not be joined to the area around the art Non è stato possibile collegare alcune isole all’area intorno alla grafica @msg `width` must be from {lo} to {hi} pt `width` deve essere compreso tra {lo} e {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` deve essere compreso tra -180 e 180 gradi +@msg `roundness` must be from 0 to 100% `roundness` deve essere compreso tra 0 e 100% +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` deve essere compreso tra 0.01 e 100 pt +@msg style must be "pencil" or "brush" style deve essere "pencil" o "brush" +@msg extend end must be "start" or "end" l’estremità di extend deve essere "start" o "end" +@msg connect end must be "start" or "end" l’estremità di connect deve essere "start" o "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` deve essere un numero intero compreso tra 1 e {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Riquadro e linee di spellicolatura… Weed Box and Lines Riquadro e linee di spellicolatura diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index ca80ba3a83..cb7b962a42 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -7172,6 +7172,12 @@ breakText Glyphs 字形 @msg No bridge of this width fits across the selected art この幅のブリッジは選択したアートワークに収まりません @msg Some islands could not be joined to the area around the art 一部のアイランドをアートワークの周囲の領域につなげられませんでした @msg `width` must be from {lo} to {hi} pt `width` は {lo}~{hi} pt の範囲で指定してください +@msg `angle` must be from -180 to 180 degrees `angle` は -180~180 度の範囲で指定してください +@msg `roundness` must be from 0 to 100% `roundness` は 0~100% の範囲で指定してください +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` は 0.01~100 pt の範囲で指定してください +@msg style must be "pencil" or "brush" style は "pencil" または "brush" を指定してください +@msg extend end must be "start" or "end" extend の端は "start" または "end" を指定してください +@msg connect end must be "start" or "end" connect の端は "start" または "end" を指定してください @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` には 1 から {MAX_BRIDGES_PER_ISLAND} の整数を指定してください Weed Box and Lines… カス取り枠とライン… Weed Box and Lines カス取り枠とライン diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 0778b2e405..06dbf93110 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -7590,6 +7590,12 @@ font-script Japanese იაპონური @msg No bridge of this width fits across the selected art ამ სიგანის ხიდი მონიშნულ ნახატზე არ ეტევა @msg Some islands could not be joined to the area around the art ზოგიერთი კუნძული ვერ დაუკავშირდა ნახატის გარშემო არეს @msg `width` must be from {lo} to {hi} pt `width` უნდა იყოს {lo}-დან {hi} pt-მდე +@msg `angle` must be from -180 to 180 degrees `angle` უნდა იყოს -180-დან 180 გრადუსამდე +@msg `roundness` must be from 0 to 100% `roundness` უნდა იყოს 0-დან 100%-მდე +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` უნდა იყოს 0.01-დან 100 pt-მდე +@msg style must be "pencil" or "brush" style უნდა იყოს "pencil" ან "brush" +@msg extend end must be "start" or "end" extend-ის ბოლო უნდა იყოს "start" ან "end" +@msg connect end must be "start" or "end" connect-ის ბოლო უნდა იყოს "start" ან "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` უნდა იყოს მთელი რიცხვი 1-დან {MAX_BRIDGES_PER_ISLAND}-მდე Weed Box and Lines… ნარჩენის მოსაცილებელი ჩარჩო და ხაზები… Weed Box and Lines ნარჩენის მოსაცილებელი ჩარჩო და ხაზები diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index d0e5750000..59e2f4cda0 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -7067,6 +7067,12 @@ breakText Glyphs 글리프 @msg No bridge of this width fits across the selected art 이 너비의 브리지가 선택한 아트워크에 들어가지 않습니다 @msg Some islands could not be joined to the area around the art 일부 섬을 아트워크 주변 영역에 연결할 수 없습니다 @msg `width` must be from {lo} to {hi} pt `width`는 {lo}에서 {hi}pt 사이여야 합니다 +@msg `angle` must be from -180 to 180 degrees `angle`는 -180도에서 180도 사이여야 합니다 +@msg `roundness` must be from 0 to 100% `roundness`는 0%에서 100% 사이여야 합니다 +@msg `fidelity` must be from 0.01 to 100 pt `fidelity`는 0.01에서 100pt 사이여야 합니다 +@msg style must be "pencil" or "brush" style은 "pencil" 또는 "brush"여야 합니다 +@msg extend end must be "start" or "end" extend 끝은 "start" 또는 "end"여야 합니다 +@msg connect end must be "start" or "end" connect 끝은 "start" 또는 "end"여야 합니다 @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count`는 1에서 {MAX_BRIDGES_PER_ISLAND} 사이의 정수여야 합니다 Weed Box and Lines… 위딩 상자 및 선… Weed Box and Lines 위딩 상자 및 선 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 0d4ceaf795..a414c66bae 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -526,6 +526,12 @@ @msg No bridge of this width fits across the selected art Geen brug van deze breedte past over de geselecteerde illustratie @msg Some islands could not be joined to the area around the art Sommige eilanden konden niet worden verbonden met het gebied rond de illustratie @msg `width` must be from {lo} to {hi} pt `width` moet van {lo} tot {hi} pt zijn +@msg `angle` must be from -180 to 180 degrees `angle` moet van -180 tot 180 graden zijn +@msg `roundness` must be from 0 to 100% `roundness` moet van 0 tot 100% zijn +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` moet van 0.01 tot 100 pt zijn +@msg style must be "pencil" or "brush" style moet "pencil" of "brush" zijn +@msg extend end must be "start" or "end" het einde van extend moet "start" of "end" zijn +@msg connect end must be "start" or "end" het einde van connect moet "start" of "end" zijn @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` moet een geheel getal van 1 tot {MAX_BRIDGES_PER_ISLAND} zijn File Bestand diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 7911a22071..61ef1e88e0 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7333,6 +7333,12 @@ breakText Glyphs Glify @msg No bridge of this width fits across the selected art Żaden mostek o tej szerokości nie mieści się w zaznaczonej grafice @msg Some islands could not be joined to the area around the art Niektórych wysp nie udało się połączyć z obszarem wokół grafiki @msg `width` must be from {lo} to {hi} pt `width` musi mieścić się w zakresie od {lo} do {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` musi mieścić się w zakresie od -180 do 180 stopni +@msg `roundness` must be from 0 to 100% `roundness` musi mieścić się w zakresie od 0 do 100% +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` musi mieścić się w zakresie od 0.01 do 100 pt +@msg style must be "pencil" or "brush" style musi mieć wartość "pencil" lub "brush" +@msg extend end must be "start" or "end" koniec extend musi mieć wartość "start" lub "end" +@msg connect end must be "start" or "end" koniec connect musi mieć wartość "start" lub "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` musi być liczbą całkowitą od 1 do {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Ramka i linie do wybierania… Weed Box and Lines Ramka i linie do wybierania diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index c2349359ed..63ea51a16e 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7549,6 +7549,12 @@ swatch Yellow Green Verde-amarelado @msg No bridge of this width fits across the selected art Nenhuma ponte desta largura cabe na arte selecionada @msg Some islands could not be joined to the area around the art Algumas ilhas não puderam ser unidas à área ao redor da arte @msg `width` must be from {lo} to {hi} pt `width` deve estar entre {lo} e {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` deve estar entre -180 e 180 graus +@msg `roundness` must be from 0 to 100% `roundness` deve estar entre 0 e 100% +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` deve estar entre 0.01 e 100 pt +@msg style must be "pencil" or "brush" style deve ser "pencil" ou "brush" +@msg extend end must be "start" or "end" a extremidade de extend deve ser "start" ou "end" +@msg connect end must be "start" or "end" a extremidade de connect deve ser "start" ou "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` deve ser um número inteiro de 1 a {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Caixa e Linhas de Descasque… Weed Box and Lines Caixa e Linhas de Descasque diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index f878461da5..7ae5d6619f 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -7565,6 +7565,12 @@ shape Open Открытый @msg No bridge of this width fits across the selected art Мостик такой ширины не помещается поперёк выделенной графики @msg Some islands could not be joined to the area around the art Некоторые островки не удалось соединить с областью вокруг графики @msg `width` must be from {lo} to {hi} pt `width` должно быть от {lo} до {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` должно быть от -180 до 180 градусов +@msg `roundness` must be from 0 to 100% `roundness` должно быть от 0 до 100% +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` должно быть от 0.01 до 100 pt +@msg style must be "pencil" or "brush" style должен быть "pencil" или "brush" +@msg extend end must be "start" or "end" конец extend должен быть "start" или "end" +@msg connect end must be "start" or "end" конец connect должен быть "start" или "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` должно быть целым числом от 1 до {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Рамка и линии выборки… Weed Box and Lines Рамка и линии выборки diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 70efcf795f..b4cbebf383 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7766,7 +7766,6 @@ digits Hindi Hindi @msg anchor `{key}` must be [x, y] ankarpunktens `{key}` måste vara [x, y] @msg anchor `{key}` must be a number ankarpunktens `{key}` måste vara ett tal @msg anchor `smooth` must be true or false ankarpunktens `smooth` måste vara true eller false -@msg angle and roundness must be finite vinkel och rundhet måste vara ändliga @msg angles must be a list as long as pins (degrees or null) angles måste vara en lista lika lång som pins (grader eller null) @msg appearance must be flat|center|edge appearance måste vara flat|center|edge @msg apply is "fill" or "stroke", not `{other}` apply är "fill" eller "stroke", inte `{other}` @@ -8915,6 +8914,11 @@ digits Hindi Hindi @msg No bridge of this width fits across the selected art Ingen brygga med den här bredden får plats över den markerade teckningen @msg Some islands could not be joined to the area around the art Vissa öar kunde inte förbindas med området runt teckningen @msg `width` must be from {lo} to {hi} pt `width` måste vara från {lo} till {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` måste vara från -180 till 180 grader +@msg `roundness` must be from 0 to 100% `roundness` måste vara från 0 till 100 % +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` måste vara från 0.01 till 100 pt +@msg style must be "pencil" or "brush" style måste vara "pencil" eller "brush" +@msg extend end must be "start" or "end" extend end måste vara "start" eller "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` måste vara ett heltal från 1 till {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Rensningsram och rensningslinjer… Weed Box and Lines Rensningsram och rensningslinjer diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 6c9deb97d0..634c7fa84e 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -2335,6 +2335,63 @@ fn three_d_refusals_translate_with_their_values() { assert_eq!(message(de(), &errors[1].0), "ungültige Parameter für `effect.apply`: Licht: intensity muss eine Zahl von 0 bis 100 sein"); } +/// The Blob Brush's range refusals (`path.blob` `angle`, `roundness` and `fidelity`) show in every +/// complete-message language with the key and the range numbers as given; the error the command +/// returns stays English. +#[test] +fn blob_brush_range_refusals_translate_with_their_values() { + use serde_json::json; + let mut s = vectorcraft_engine::Session::new(); + s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); + let refusals = [ + (json!({"angle": 200}), "`angle`", ["-180", "180"]), + (json!({"roundness": 101}), "`roundness`", ["0", "100"]), + (json!({"fidelity": 0}), "`fidelity`", ["0.01", "100"]), + ]; + for (extra, key, numbers) in &refusals { + let mut p = json!({"points": [[10, 10], [60, 10]]}); + p.as_object_mut().unwrap().extend(extra.as_object().unwrap().clone()); + let e = s.execute("path.blob", &p).unwrap_err().to_string(); + assert!(e.starts_with("invalid parameters for `path.blob`: ") && e.contains(key) && e.contains(" must be from "), "{e}"); + assert_eq!(message(Lang::EN, &e), e); + for code in COMPLETE_MESSAGES { + let shown = message(Lang::from_code(code).expect("registered"), &e); + assert!(!shown.contains(" must be from ") && shown.contains("`path.blob`") && shown.contains(key), "{code}: {e} -> {shown}"); + assert!(numbers.iter().all(|n| shown.contains(n)), "{code}: {e} -> {shown}"); + } + } + assert_eq!( + message(de(), &s.execute("path.blob", &json!({"points": [[10, 10], [60, 10]], "angle": -181})).unwrap_err().to_string()), + "ungültige Parameter für `path.blob`: `angle` muss zwischen -180 und 180 Grad liegen" + ); +} + +/// `path.freehand`'s refusals of an unknown `style`, `extend` end or `connect` end show in every +/// complete-message language with the key and the accepted values as given. +#[test] +fn freehand_choice_refusals_translate_with_their_values() { + use serde_json::json; + let mut s = vectorcraft_engine::Session::new(); + s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); + let a = s.execute("path.create", &json!({"d": "M10 10 L20 10"})).unwrap()["id"].clone(); + let b = s.execute("path.create", &json!({"d": "M10 50 L20 50"})).unwrap()["id"].clone(); + let points = json!([[20, 10], [30, 30], [20, 50]]); + let refusals = [ + (json!({"points": points, "style": "ink"}), ["style", "\"pencil\"", "\"brush\""]), + (json!({"points": points, "extend": {"id": a, "end": "middle"}}), ["extend", "\"start\"", "\"end\""]), + (json!({"points": points, "extend": {"id": a}, "connect": {"id": b, "end": "middle"}}), ["connect", "\"start\"", "\"end\""]), + ]; + for (p, words) in &refusals { + let e = s.execute("path.freehand", p).unwrap_err().to_string(); + assert!(e.starts_with("invalid parameters for `path.freehand`: ") && e.contains(" must be "), "{e}"); + for code in COMPLETE_MESSAGES { + let shown = message(Lang::from_code(code).expect("registered"), &e); + assert!(!shown.contains(" must be ") && shown.contains("`path.freehand`"), "{code}: {e} -> {shown}"); + assert!(words.iter().all(|w| shown.contains(w)), "{code}: {e} -> {shown}"); + } + } +} + /// A value a message quotes is a name and is shown as written, even when a catalog row translates /// the same text: a symbol called Rotate stays Rotate while the effect's name is translated. #[test] diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index ff88601736..20d27c1c3a 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -7432,6 +7432,12 @@ breakText Glyphs Glifler @msg No bridge of this width fits across the selected art Bu genişlikte bir köprü seçili çizime sığmıyor @msg Some islands could not be joined to the area around the art Bazı adalar çizimin çevresindeki alana bağlanamadı @msg `width` must be from {lo} to {hi} pt `width` {lo} ile {hi} pt arasında olmalıdır +@msg `angle` must be from -180 to 180 degrees `angle` -180 ile 180 derece arasında olmalıdır +@msg `roundness` must be from 0 to 100% `roundness` %0 ile %100 arasında olmalıdır +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` 0.01 ile 100 pt arasında olmalıdır +@msg style must be "pencil" or "brush" style "pencil" veya "brush" olmalıdır +@msg extend end must be "start" or "end" extend ucu "start" veya "end" olmalıdır +@msg connect end must be "start" or "end" connect ucu "start" veya "end" olmalıdır @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` 1 ile {MAX_BRIDGES_PER_ISLAND} arasında bir tam sayı olmalıdır Weed Box and Lines… Ayıklama Kutusu ve Çizgileri… Weed Box and Lines Ayıklama Kutusu ve Çizgileri diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index a7b3ea2c2e..aa6e956bdb 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7086,6 +7086,12 @@ breakText Glyphs Гліфи @msg No bridge of this width fits across the selected art Місток такої ширини не вміщується впоперек виділеної графіки @msg Some islands could not be joined to the area around the art Деякі острівці не вдалося з’єднати з областю навколо графіки @msg `width` must be from {lo} to {hi} pt `width` має бути від {lo} до {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` має бути від -180 до 180 градусів +@msg `roundness` must be from 0 to 100% `roundness` має бути від 0 до 100% +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` має бути від 0.01 до 100 pt +@msg style must be "pencil" or "brush" style має бути "pencil" або "brush" +@msg extend end must be "start" or "end" кінець extend має бути "start" або "end" +@msg connect end must be "start" or "end" кінець connect має бути "start" або "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` має бути цілим числом від 1 до {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Рамка й лінії вибірки… Weed Box and Lines Рамка й лінії вибірки diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 518d89e4b6..f7962427f5 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7087,6 +7087,12 @@ breakText Glyphs Glyph @msg No bridge of this width fits across the selected art Không có cầu nối nào rộng như vậy vừa với hình vẽ đã chọn @msg Some islands could not be joined to the area around the art Không thể nối một số đảo với vùng xung quanh hình vẽ @msg `width` must be from {lo} to {hi} pt `width` phải từ {lo} đến {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` phải từ -180 đến 180 độ +@msg `roundness` must be from 0 to 100% `roundness` phải từ 0 đến 100% +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` phải từ 0.01 đến 100 pt +@msg style must be "pencil" or "brush" style phải là "pencil" hoặc "brush" +@msg extend end must be "start" or "end" đầu extend phải là "start" hoặc "end" +@msg connect end must be "start" or "end" đầu connect phải là "start" hoặc "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` phải là số nguyên từ 1 đến {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Khung và đường bóc phần thừa… Weed Box and Lines Khung và đường bóc phần thừa diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 26fb9e0c1b..45f2ffaede 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7315,6 +7315,12 @@ breakText Glyphs 字形 @msg No bridge of this width fits across the selected art 此宽度的连接桥无法放入所选图稿 @msg Some islands could not be joined to the area around the art 部分孤岛无法连接到图稿周围的区域 @msg `width` must be from {lo} to {hi} pt `width` 必须介于 {lo} 到 {hi} pt 之间 +@msg `angle` must be from -180 to 180 degrees `angle` 必须介于 -180 到 180 度之间 +@msg `roundness` must be from 0 to 100% `roundness` 必须介于 0 到 100% 之间 +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` 必须介于 0.01 到 100 pt 之间 +@msg style must be "pencil" or "brush" style 必须为 "pencil" 或 "brush" +@msg extend end must be "start" or "end" extend 的端点必须为 "start" 或 "end" +@msg connect end must be "start" or "end" connect 的端点必须为 "start" 或 "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` 必须是 1 到 {MAX_BRIDGES_PER_ISLAND} 之间的整数 Weed Box and Lines… 除废框和除废线… Weed Box and Lines 除废框和除废线 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 5685430cc8..2639252539 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -7122,6 +7122,12 @@ breakText Glyphs 字符 @msg No bridge of this width fits across the selected art 此寬度的連接橋無法放入所選圖稿 @msg Some islands could not be joined to the area around the art 部分孤島無法連接到圖稿周圍的區域 @msg `width` must be from {lo} to {hi} pt `width` 必須介於 {lo} 到 {hi} pt 之間 +@msg `angle` must be from -180 to 180 degrees `angle` 必須介於 -180 到 180 度之間 +@msg `roundness` must be from 0 to 100% `roundness` 必須介於 0 到 100% 之間 +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` 必須介於 0.01 到 100 pt 之間 +@msg style must be "pencil" or "brush" style 必須為 "pencil" 或 "brush" +@msg extend end must be "start" or "end" extend 的端點必須為 "start" 或 "end" +@msg connect end must be "start" or "end" connect 的端點必須為 "start" 或 "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` 必須是介於 1 到 {MAX_BRIDGES_PER_ISLAND} 的整數 Weed Box and Lines… 除廢框與除廢線… Weed Box and Lines 除廢框與除廢線 diff --git a/docs/mcp.md b/docs/mcp.md index 912ac32562..cc6524bf53 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3111,7 +3111,10 @@ already walks Image Trace. Short agent entry points: divided by the zoom (0.0313 to 640) and kept within that range, so a stroke is fitted at the same tolerance on screen at every zoom. A stroke that continues a path (`extend`) closes it when it ends within four times the Fidelity of the path's other end, at - least 6 pt and at most 400 pt. The Blob Brush's `path.blob` Fidelity stays in points, 0.01 to 100 pt. + least 6 pt and at most 400 pt. The Blob Brush's `path.blob` Fidelity stays in points, 0.01 to 100 pt, and is + not used when left out or null. `path.blob` rejects a `fidelity` outside 0.01 to 100 pt, an `angle` outside -180° to + 180° and a `roundness` outside 0% to 100% with an error such as `` `angle` must be from -180 to 180 degrees ``; the + document does not change and no undo step is recorded. These ranges are VectorCraft's own values. - Variables: `variable.list`, `variable.define {name, kind: text|visibility|image|graph}`, `variable.bind {variable, ids?}`, `variable.makeTextDynamic`, `variable.makeVisibilityDynamic`, `variable.makeImageDynamic`, `variable.makeGraphDynamic` (`variable.bind` and `variable.makeTextDynamic` refuse type that already has another text variable and name it), @@ -5167,6 +5170,11 @@ These commands refuse a string, a number or another value that is not true or fa in `path.curvatureEdit`; `perpendicular` in `path.reshapeSegment`; and `keepSelected`, `mergeOnlySelection` and `merge` in `path.blob`. A null is read as a key left out. +`path.freehand` (and `brush.freehand`, which runs it) refuses a `style` other than "pencil" or "brush" with +`style must be "pencil" or "brush"`, and an `end` of `extend` other than "start" or "end" with +`extend end must be "start" or "end"`; the document does not change and no undo step is recorded. Left out or null, +`style` is "pencil" and the `end` of `extend` is "end". + A `pointer_gesture` with `mods: {cmd: true}` held at the press, with any tool but the selection tools (Command on macOS, Ctrl elsewhere), drags with the selection tool chosen last (`select_tool`), or Direct Selection with the Pen, Curvature and anchor tools until one is chosen; the release gives the tool back as it was, so the Pen goes on drawing diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 26681e5b7f..ece6f7356b 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1148,6 +1148,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur The Blob Brush Tool Options also have Angle and Roundness, as the reference app's [Blob Brush options](https://web.archive.org/web/20261012042029/https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/blob-brush-options-and-best-practices.html) list them: Angle from −180° to 180° (0° by default) and Roundness from 0% to 100% (100%, a round tip, by default). The elliptical tip keeps its angle on the page along a stroke, a 0% tip is drawn 0.1% as wide as it is long, and the dialog shows the tip and three dabs of it. The values are kept with the tool's options (`path.blob` `angle` and `roundness`). Not done: the Random and pen-driven variations of Angle and Roundness. The Blob Brush Tool Options' tip preview is the Angle slider for screen readers, with the Angle in degrees as its value: a click or a drag in it points the Angle at the pointer and gives it the keyboard focus, Tab reaches it after the Roundness field, and the arrow keys step the Angle by 1° (10° with Shift, Home and End to −180° and 180°). The Blob Brush Tool Options also have Fidelity, which the reference app's [Blob Brush options](https://web.archive.org/web/20261012042029/https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/blob-brush-options-and-best-practices.html) list as setting how far the pointer moves before the path gets a new anchor point. The range and default are VectorCraft's own values: the Pencil's logarithmic slider from Accurate (0.01 pt) to Smooth (20 pt) and its field (up to 100 pt), 1.5 pt by default and kept with the tool's options. The brush follows the stroke fitted at the Fidelity, as a Pencil stroke is fitted: a low value follows the drag closely, jitter included, and a higher one gives smoother curves (`path.blob` `fidelity`). + `path.blob` rejects an Angle outside −180° to 180°, a Roundness outside 0% to 100% and a Fidelity outside 0.01 to 100 pt with an error and leaves the document unchanged; a key left out or null takes its default (0°, 100% and no fitting). A Blob Brush stroke merges with the topmost path of its fill color and no stroke that it touches, and with the other such paths it touches in the same group or layer that are next to that path in stacking order with no other kind of object between them; matching paths in other groups or layers are left alone, as the Blob Brush tool guidelines in [Paint with fills and strokes](https://web.archive.org/web/20241219085603/https://helpx.adobe.com/illustrator/using/painting-fills-strokes.html) describe (`path.blob`). - **Ruler guides as layer objects:** a guide goes on the current layer, shows, hides, locks and is deleted with it, is listed in the Layers panel (its row selects it) and moves to another layer (`guide.setLayer`, or its row dragged onto that layer's rows); guides on a hidden or locked layer can't be selected, moved or deleted, Duplicate copies a layer's guides and Merge Selected and Flatten Artwork keep them on the merged layer; guides from files saved before guides had layers go on the top visible, unlocked layer when the document opens. A guide's row has its own eye and lock, which hide or lock that guide alone in one undo step and take part in a drag down either column ([help page](https://helpx.adobe.com/in_hi/tutorial-builder/user-guide/illustrator-tutorial-builder/-ai--examples-of-common-coach-marks.html) lists a Guide among the Layers panel's items); a hidden guide is not drawn and does not snap, a locked one is drawn and snaps but can't be selected, moved or deleted, and its own state is kept through save and reopen and while its layer is hidden or locked (`layer.setProps` on its `guide.list` id). Object › Lock › Selection and Object › Hide › Selection lock or hide a selected guide with the selected art, and Unlock All and Show All unlock or show such guides and select them ([help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) for Lock and Hide Selection). A guide row dropped on the panel's trash deletes its guide, the trash deletes a guide its row selected, and after a click on a guide row Delete deletes the guide rather than the rows highlighted before ([help page](https://helpx.adobe.com/illustrator/desktop/measure-and-align/grids-and-guides/align-graphic-objects-with-guides.html) for deleting a selected guide). Not done: guides stacked among the art of their layer (they are listed above it). Lock Guides also locks the objects made into guides: they can't be selected, moved or deleted (#1543); they are drawn in the guide colour and style of Preferences, and a dragged selection snaps to ruler guides with Smart Guides on (#1583, fixes #1534). Preferences › Guides & Grid › Lock Guides by Default locks guides when the app starts; it is off by default, and new guides can still be dragged out of a ruler while guides are locked. The Transform panel shows a selected ruler guide's X or Y, and typing a value moves it (#1659, part of #1597). This is not established by the documentation we could find: the public help pages on guides, rulers and the Transform, Control and Properties panels (read again on 2026-10-14) describe selecting and dragging unlocked guides and the panels' X and Y for a selection, not a guide's position in a panel, and the one public statement of it is a user's [community answer](https://community.adobe.com/questions-652/adding-a-new-custom-guide-785586), which is not documentation. It is kept as a convenience pending the owner's decision, with no parity claim and nothing counted towards a score. - **Releasing ruler guides:** View › Guides › Release Guides turns the selected ruler guides into paths with no fill or stroke. An artboard guide becomes a line across its artboard, and a canvas guide becomes a line across the artboards (`view.guides.release {index?, ids?}`). A Cmd/Ctrl+Shift double-click with the Selection, Direct Selection or Group Selection tool releases the ruler guide or guide path under the pointer. From 5b591ca96e6e63cc231025887c58a7f6e3f23494 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 16:26:54 -0800 Subject: [PATCH 005/226] i18n: messages with values side by side can be translated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The catalog cannot match a template with two placeholders in a row, so it dropped those rows, and the messages showed in English where no other row matched them. The messages now join such values into one before they are made, so a catalog row for each one is kept, and the English text is unchanged: - An unknown key inside an options object names the key with the objects it is in (`marks.ofset`) as one value, and its suggestion too. - A PDF or print setting outside its range names the range with its unit (`0.05–2 pt`) as one value. - The raster effect resolution warning names the object's id and name as one value. - The desktop app's graphics processor fallback status and the status after a print job is sent are separate whole messages with and without their hint or spooler note. Every catalog gets rows for these messages, and the Hindi and Swedish range rows that the catalog dropped are replaced. New tests fail when a message or a bundled catalog row has two placeholders in a row or no text, and the untranslated report counts a row the catalog drops as missing instead of translated. --- apps/vectorcraft/src/main.rs | 15 +-- apps/vectorcraft/src/printing.rs | 24 +++- crates/engine/src/cmd/params.rs | 50 ++++---- crates/engine/src/cmd/rasterfx/report.rs | 31 ++++- crates/pdf/src/settings.rs | 9 +- crates/ui-egui/src/i18n/bg.tsv | 13 +++ crates/ui-egui/src/i18n/bs.tsv | 13 +++ crates/ui-egui/src/i18n/ca.tsv | 13 +++ crates/ui-egui/src/i18n/catalog.rs | 27 ++++- crates/ui-egui/src/i18n/cs.tsv | 13 +++ crates/ui-egui/src/i18n/da.tsv | 13 +++ crates/ui-egui/src/i18n/de.tsv | 13 +++ crates/ui-egui/src/i18n/el.tsv | 13 +++ crates/ui-egui/src/i18n/es.tsv | 13 +++ crates/ui-egui/src/i18n/fi.tsv | 13 +++ crates/ui-egui/src/i18n/fr.tsv | 13 +++ crates/ui-egui/src/i18n/hi.tsv | 14 ++- crates/ui-egui/src/i18n/hu.tsv | 13 +++ crates/ui-egui/src/i18n/id.tsv | 13 +++ crates/ui-egui/src/i18n/it.tsv | 13 +++ crates/ui-egui/src/i18n/ja.tsv | 13 +++ crates/ui-egui/src/i18n/ka.tsv | 13 +++ crates/ui-egui/src/i18n/ko.tsv | 13 +++ crates/ui-egui/src/i18n/nl.tsv | 13 +++ crates/ui-egui/src/i18n/pl.tsv | 13 +++ crates/ui-egui/src/i18n/pt-br.tsv | 13 +++ crates/ui-egui/src/i18n/ru.tsv | 13 +++ crates/ui-egui/src/i18n/sv.tsv | 14 ++- crates/ui-egui/src/i18n/tests.rs | 138 ++++++++++++++++++++++- crates/ui-egui/src/i18n/tr.tsv | 13 +++ crates/ui-egui/src/i18n/uk.tsv | 13 +++ crates/ui-egui/src/i18n/vi.tsv | 13 +++ crates/ui-egui/src/i18n/zh-hans.tsv | 13 +++ crates/ui-egui/src/i18n/zh-hant.tsv | 13 +++ docs/development.md | 6 +- docs/target-app-parity.md | 1 + 36 files changed, 608 insertions(+), 46 deletions(-) diff --git a/apps/vectorcraft/src/main.rs b/apps/vectorcraft/src/main.rs index 7594bc2344..7d66ee24be 100644 --- a/apps/vectorcraft/src/main.rs +++ b/apps/vectorcraft/src/main.rs @@ -539,14 +539,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/printing.rs b/apps/vectorcraft/src/printing.rs index 74e05e698f..38edd784c3 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,14 @@ 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. +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} ({note})") } +} + mod system { use super::{Command, PrintJob, Printer}; pub fn printers() -> Vec { @@ -38,7 +45,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 +134,16 @@ 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 (job 12)"); + } + #[test] fn only_macos_queues_need_landscape_pages_turned() { assert_eq!(SystemPrint.turns_landscape(), !cfg!(target_os = "macos")); diff --git a/crates/engine/src/cmd/params.rs b/crates/engine/src/cmd/params.rs index 20e5054aeb..cd43f195c5 100644 --- a/crates/engine/src/cmd/params.rs +++ b/crates/engine/src/cmd/params.rs @@ -621,18 +621,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)?, _ => {} @@ -649,14 +659,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)?; @@ -755,12 +762,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/pdf/src/settings.rs b/crates/pdf/src/settings.rs index adaaa30c9c..88070bf9f7 100644 --- a/crates/pdf/src/settings.rs +++ b/crates/pdf/src/settings.rs @@ -447,9 +447,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/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 4a79f37e72..7f5c1ae411 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5229,6 +5229,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} ({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 5982685036..bba855ab96 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -5743,6 +5743,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} ({note}) “{title}” je poslano na {to} ({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 9dfc5458b5..d8a53ba80b 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -6374,6 +6374,19 @@ digits Malayalam Malaiàlam @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} ({note}) S’ha enviat “{title}” a {to} ({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 ab3abff6f5..ff794cf8e4 100644 --- a/crates/ui-egui/src/i18n/catalog.rs +++ b/crates/ui-egui/src/i18n/catalog.rs @@ -179,6 +179,31 @@ pub fn parse_entries(text: &str) -> (Vec, Vec) { (entries, errors) } +/// Whether an `@msg` source is a template, matched piece by piece, and not a whole message. +fn is_template(source: &str) -> bool { + source.contains('{') || source.contains("}}") +} + +/// 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" => is_template(src) && !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(); @@ -194,7 +219,7 @@ impl Catalog { c.plurals.insert(src, tr.split('|').map(str::to_string).collect()); } "@msg" => { - if src.contains('{') || src.contains("}}") { + if is_template(&src) { c.templates.extend(Template::parse(&src, vec![tr], false)); } else { c.messages.insert(src, tr); diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index edaad350a0..de71a2c7ac 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -6030,6 +6030,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} ({note}) “{title}” odesláno do {to} ({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 diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 10848dd3f7..dfc76b6d80 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5391,6 +5391,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} ({note}) Sendte “{title}” til {to} ({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 cd6a428631..3f80c9fd99 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -5604,6 +5604,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} ({note}) “{title}” an {to} gesendet ({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 diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index fc76658c72..e497401b43 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5389,6 +5389,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} ({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 c7c9c8bc1e..232637122b 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -5972,6 +5972,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} ({note}) Se envió “{title}” a {to} ({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 126e7854f9..92a981895b 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -5911,6 +5911,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} ({note}) “{title}” lähetettiin kohteeseen {to} ({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 3941bf0497..cb96dfc22e 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -5598,6 +5598,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} ({note}) “{title}” envoyé vers {to} ({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é diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index bf2f223fc0..1e4149beef 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -5856,7 +5856,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 या आकार मेल नहीं खाता @@ -8450,6 +8450,18 @@ antiAlias Sharp शार्प @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} ({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 969b923a1c..871266da20 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -6013,6 +6013,19 @@ imageTrace Outline Körvonal 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} ({note}) “{title}” elküldve ide: {to} ({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 diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 55cff9798e..cff4117ff4 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5391,6 +5391,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} ({note}) “{title}” dikirim ke {to} ({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 ea10433ebd..22a0c847fa 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -5646,6 +5646,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} ({note}) “{title}” inviato a: {to} ({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 diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index ca80ba3a83..24dac954af 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -5689,6 +5689,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} ({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}` は不明なパラメーターです。このオブジェクトにはキーを指定できません diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 0778b2e405..9d0060d772 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5312,6 +5312,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} ({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 d0e5750000..aaddeee11f 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5607,6 +5607,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} ({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}`: 이 객체는 키를 받지 않습니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 0d4ceaf795..276d23a84e 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5970,6 +5970,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} ({note}) “{title}” verzonden naar {to} ({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 7911a22071..5c54883755 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -5870,6 +5870,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} ({note}) Wysłano “{title}” do: {to} ({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 diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index c2349359ed..b11e28fdf8 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -4755,6 +4755,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} ({note}) “{title}” enviado para {to} ({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 diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index f878461da5..fbe4e211d2 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -5631,6 +5631,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} ({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/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 70efcf795f..82db0f2366 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5498,6 +5498,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} ({note}) Skickade “{title}” till {to} ({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 @@ -7458,7 +7470,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 6c9deb97d0..916ac29c31 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"); @@ -1695,8 +1695,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()); @@ -1996,6 +1995,139 @@ 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 (job 12)".to_string(), vec!["“Poster”", "Office Laser", "(job 12)"], vec!["Sent"]), + ( + "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 ff88601736..4f0d2bcf2d 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5265,6 +5265,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} ({note}) “{title}” şuraya gönderildi: {to} ({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 a7b3ea2c2e..28b8cc1f88 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -5626,6 +5626,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} ({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/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 518d89e4b6..cc62a7742a 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5540,6 +5540,19 @@ theme Appearance Giao diện @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} ({note}) Đã gửi “{title}” đến {to} ({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 26fb9e0c1b..2c9d181f36 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -5901,6 +5901,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} ({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}`;该对象不接受任何键 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 5685430cc8..9f2f55c85e 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -5735,6 +5735,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} ({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}`;此物件不接受任何鍵 diff --git a/docs/development.md b/docs/development.md index 05062e18b8..7372d86a3d 100644 --- a/docs/development.md +++ b/docs/development.md @@ -294,7 +294,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). Czech, German, Greek, Spanish, French, Georgian, Hungarian, Italian, Japanese, Korean, Polish, Brazilian Portuguese, Russian, Simplified Chinese, Traditional Chinese, Swedish, Ukrainian, Vietnamese, Finnish, Turkish, Catalan and Dutch + 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. Czech, German, Greek, Spanish, French, Georgian, Hungarian, Italian, Japanese, Korean, Polish, Brazilian Portuguese, Russian, Simplified Chinese, Traditional Chinese, Swedish, Ukrainian, Vietnamese, Finnish, Turkish, Catalan and Dutch translate status and error messages (`COMPLETE_MESSAGES` in `i18n::tests`); the untranslated report lists the message literals the scan finds that one of them has no row for. The scan reads `Err("…")`, `Other(…)`, `#[error(…)]` and `status(…)` messages, messages given to an error enum's variant (`PsError::Limit(…)`, the reason diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 26681e5b7f..8d2c04d9f3 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -907,6 +907,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The errors of the 3D effects (Extrude & Bevel, Revolve, Inflate, Rotate and their Classic forms) show in the status bar in the interface language: the art a 3D effect cannot build a solid from, invalid light, graphics and surface settings, and the notes for an object that draws no 3D faces or more wireframe edges than the limit. Each has a row in every catalog that translates all status and error messages, and the effect's name and the values in the message are translated or kept as written (`three_d_refusals_are_translated_in_every_complete_catalog`, `three_d_refusals_translate_with_their_values`). - 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`). - 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. - Export commands run through MCP, the control channel or the CLI refuse a key that no format takes, and warn about a key that only another format takes (`{"format": "pdf", "quality": 80}` writes the PDF with the warning "`quality` was not used: PDF files don't read it"; `an_option_only_another_format_reads_gets_a_note`, `control_export_notes_an_option_the_format_does_not_read`, `convert_warns_about_an_unused_option_only_when_one_was_given`), and a command that writes one format (`document.exportPdf`, `document.exportEps`, `document.exportDxf`) or takes one format's options (`document.pdfSettings`, `pdf.preset.save`) refuses a key that format doesn't take. An unknown key inside `marks`, `bleed`, `compression`, `output`, `advanced`, `security` or `flattener` is refused by its path. - Save commands run through MCP, the control channel or the CLI (`document.save`, `file.saveAs`, `file.saveCopy`, `file.saveAsTemplate`, `app.save`) refuse a key that no save format takes, beside the path or in `options`. Export for Screens refuses a key it doesn't take, and a key that no format takes in a format row or in a format's settings, by its path (`formats[1].marks.useDocumentBleed`); Export Assets (`assets.export`, `assets.settings.set`) checks the rows and settings it is given the same way. - Commands that read their `ids` (or `slices`) list themselves refuse a list with an entry that is not a non-negative integer, and a value that is not a list, and change nothing; they no longer drop the entry and act on the rest (Copy Appearance From, the Edit Colors commands and Overprint Black, Find and Replace, `layer.highlight`, `layer.move`, `library.add`, the Links panel commands, `object.transform`, Make Pattern, the Repeat commands, the slice commands, Join, Average and Join, `plugin.run`, `symbol.edit`, Make Opacity Mask; `tests::ids_without_selection::an_ids_entry_that_is_not_an_id_is_refused_and_changes_nothing`). The error for an entry of an object id list names the key, the entry and its value ("`ids` entry 1 is true, not a non-negative integer object id"), with a row in every catalog that has the other object id errors. From 7402ca4fd8cdcab03027dbb308262cd9879a54cc Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 17:09:49 -0800 Subject: [PATCH 006/226] .ai editing data: Scatter and Art brushes keep their art's opacity masks A Scatter or Art brush whose art holds an opacity mask was left out of the Brushes panel in the editing data with the brushes warning. The writer now writes such a brush when each mask's art passes the same check as the brush's art, in the form define_brush_art in crates/eps/src/import/ai/read/directives.rs reads: the mask's art between X= and X+ in the object's art dictionary, with its Clip, Invert Mask, disabled and linked options. Masks may sit up to seven deep in one another's art. Masks on a compound path's members, gradient masks and mask art past the reader's limits still leave the brush out with the warning. - The reader turns an Art brush's art over with the art of masks that don't move with their objects, so such a mask stays over the part of the object it was over. - A brush's mask art is written as the brush holds it, not as an object of the layers' mask art that has the same id and keeps an art style. --- crates/eps/src/ai_editing/tests.rs | 169 +++++++++++++++++++- crates/eps/src/ai_editing/writer/brushes.rs | 46 +++++- crates/eps/src/import.rs | 2 +- crates/eps/src/import/ai.rs | 4 +- crates/eps/src/import/ai/brush.rs | 27 +++- crates/eps/src/import/ai/tests.rs | 24 +++ docs/file-format-parity.md | 4 +- docs/target-app-parity.md | 1 + 8 files changed, 263 insertions(+), 14 deletions(-) diff --git a/crates/eps/src/ai_editing/tests.rs b/crates/eps/src/ai_editing/tests.rs index 3af515181c..1d006dbadc 100644 --- a/crates/eps/src/ai_editing/tests.rs +++ b/crates/eps/src/ai_editing/tests.rs @@ -8085,7 +8085,8 @@ fn brushes_document() -> Document { } /// Brush art `n` as a tree to compare with [`same_tree`]: each object's kind, its anchors and handles, -/// the fills and strokes that paint (a stroke with its width), and its members in order. +/// the fills and strokes that paint (a stroke with its width), its members in order, and its opacity +/// mask's art and options when it has one. fn art_tree(n: &Node) -> serde_json::Value { let kind = match &n.kind { NodeKind::Path { .. } => "path", @@ -8110,7 +8111,11 @@ fn art_tree(n: &Node) -> serde_json::Value { }) .collect(); let members: Vec = n.children().map(|c| c.iter().map(|m| art_tree(m)).collect()).unwrap_or_default(); - serde_json::json!({"kind": kind, "anchors": anchors, "paints": paints, "members": members}) + let mut tree = serde_json::json!({"kind": kind, "anchors": anchors, "paints": paints, "members": members}); + if let Some(m) = &n.extras().mask { + tree["mask"] = serde_json::json!({"art": art_tree(&m.art), "options": [m.clip, m.invert, m.disabled, m.linked]}); + } + tree } /// Are trees `a` and `b` ([`art_tree`]) the same but for numbers within the written numbers' @@ -8253,6 +8258,166 @@ fn an_art_brush_whose_art_doesnt_bend_keeps_its_paths_look() { assert!(same_tree(&art_tree(&got.art), &art_tree(&want.art)), "{:#?}", got.art); } +/// An opacity mask whose art is rectangle `r` filled in `paint`, with the options given. +fn rect_mask(id: u64, r: Rect, paint: Paint, clip: bool, invert: bool, linked: bool) -> OpacityMask { + let art = Node::path(vectorcraft_doc::NodeId(id), shapes::rectangle(r), Appearance::basic(paint, Paint::None, 0.0)); + OpacityMask { art: Arc::new(art), clip, invert, disabled: false, linked } +} + +/// `levels` white rectangle masks that clip, each but the last holding the next in its art. +fn mask_chain(levels: u32) -> Option> { + (0..levels).fold(None, |inner, i| { + let mut m = rect_mask(100 + u64::from(i), Rect::new(0.0, 0.0, 30.0 - f64::from(i), 8.0), solid(Color::WHITE), true, false, true); + Arc::make_mut(&mut m.art).extras_mut().mask = inner; + Some(Box::new(m)) + }) +} + +/// [`brush_art_node`] with opacity masks: on the group, a mid-gray rectangle that clips; on the wide +/// block, a white rectangle inverted without clipping. Both masks are `linked` or not. +fn masked_brush_art(linked: bool) -> Node { + let mut art = brush_art_node(); + if let Some(c) = art.children_mut() { + let wide = rect_mask(10, Rect::new(0.0, 0.0, 20.0, 4.0), solid(Color::WHITE), false, true, linked); + Arc::make_mut(&mut c[0]).extras_mut().mask = Some(Box::new(wide)); + } + art.extras_mut().mask = Some(Box::new(rect_mask(11, Rect::new(0.0, 0.0, 30.0, 8.0), solid(Color::rgb(0.5, 0.5, 0.5)), true, false, linked))); + art +} + +/// Scatter and Art brushes whose art holds opacity masks come back in the Brushes panel with their +/// settings, the masks' art in place with its paint, and the masks' options: masks on the art and on +/// a member, masks that don't move with their objects, and masks seven deep in one another's art. A +/// path with the masked Art brush comes back as its drawn look, with the stroke warning. +#[test] +fn scatter_and_art_brush_mask_art_round_trips() { + use vectorcraft_brush::{ArtBrush, Brush, BrushKind, Scatter}; + let mut deep = brush_art_node(); + deep.extras_mut().mask = mask_chain(7); + let lib = vec![ + Brush { name: "Masked spray".into(), kind: BrushKind::Scatter(Scatter { art: masked_brush_art(true), ..Scatter::default() }) }, + Brush { name: "Masked ribbon".into(), kind: BrushKind::Art(ArtBrush { art: masked_brush_art(true), ..ArtBrush::default() }) }, + Brush { name: "Unlinked spray".into(), kind: BrushKind::Scatter(Scatter { art: masked_brush_art(false), ..Scatter::default() }) }, + Brush { name: "Unlinked ribbon".into(), kind: BrushKind::Art(ArtBrush { art: masked_brush_art(false), ..ArtBrush::default() }) }, + Brush { name: "Deep spray".into(), kind: BrushKind::Scatter(Scatter { art: deep.clone(), ..Scatter::default() }) }, + Brush { name: "Deep ribbon".into(), kind: BrushKind::Art(ArtBrush { art: deep, ..ArtBrush::default() }) }, + ]; + let mut doc = Document::new(300.0, 200.0); + vectorcraft_brush::store(&mut doc, &lib); + brushed(&mut doc, "Masked ribbon", (20.0, 120.0), (280.0, 150.0), 1.0); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(!out.warnings.iter().any(|w| w == writer::BRUSHES || w == writer::DEEP_MASKS), "{:?}", out.warnings); + assert!(out.warnings.iter().any(|w| w == writer::STROKES), "{:?}", out.warnings); + assert_eq!(program(&doc).matches("%AI8_BeginBrushPattern").count(), lib.len()); + let back = read_back(&doc); + assert!(matches!(back.layers[0].children().unwrap()[0].kind, NodeKind::Group { .. }), "the path's drawn look"); + let got = vectorcraft_brush::library(&back); + assert_eq!(got.iter().map(|b| b.name.as_str()).collect::>(), lib.iter().map(|b| b.name.as_str()).collect::>()); + let none = || Node::group(vectorcraft_doc::NodeId(0), vec![]); + for (g, w) in got.iter().zip(&lib) { + let name = &w.name; + let (ga, wa) = match (&g.kind, &w.kind) { + (BrushKind::Scatter(gs), BrushKind::Scatter(ws)) => { + let settings = |s: &Scatter| Scatter { art: none(), modes: Some(s.modes()), ..s.clone() }; + assert_eq!(settings(gs), settings(ws), "{name}"); + (&gs.art, &ws.art) + } + (BrushKind::Art(ga), BrushKind::Art(wa)) => { + assert_eq!(ArtBrushOptions::of(ga), ArtBrushOptions::of(wa), "{name}"); + (&ga.art, &wa.art) + } + _ => panic!("{name}: {g:?}"), + }; + let (gt, wt) = (art_tree(ga), art_tree(wa)); + assert!(same_tree(>, &wt), "{name}: {gt:#} for {wt:#}"); + } +} + +/// Brushes whose mask art the reader wouldn't read back as it is are left out with a warning, beside +/// a brush that comes back: a Scatter brush whose art's mask is a gradient, one whose art holds +/// masks eight deep in one another's art (deeper than the editing data writes masks), one whose +/// mask's art is a compound path of 26,500 members of two squares each, which the reader reads as +/// 53,000 paths, more art than it copies into one file's brushes, and one whose art is a compound +/// path with a mask on a member (a compound path is written as one path, without its members' masks). +#[test] +fn brushes_whose_mask_art_isnt_read_back_are_left_out() { + use vectorcraft_brush::{Brush, BrushKind, Scatter}; + let keep = Brush { name: "Masked spray".into(), kind: BrushKind::Scatter(Scatter { art: masked_brush_art(true), ..Scatter::default() }) }; + let mut gradient = brush_art_node(); + let ramp = gradient_paint(sunset(), None, None); + gradient.extras_mut().mask = Some(Box::new(rect_mask(11, Rect::new(0.0, 0.0, 30.0, 8.0), ramp, true, false, true))); + let mut deep = brush_art_node(); + deep.extras_mut().mask = mask_chain(8); + let square = |i: u32| { + let (x, y) = (f64::from(i % 400) * 2.0, f64::from(i / 400) * 2.0); + shapes::rectangle(Rect::new(x, y, x + 1.0, y + 1.0)).subpaths + }; + let members = (0..26_500) + .map(|m| { + let path = PathData::new((0..2).flat_map(|k| square(m * 2 + k)).collect()); + Arc::new(Node::path(vectorcraft_doc::NodeId(21), path, Appearance::basic(solid(Color::WHITE), Paint::None, 0.0))) + }) + .collect(); + let mut squares = Node::path(vectorcraft_doc::NodeId(20), PathData::default(), Appearance::basic(solid(Color::WHITE), Paint::None, 0.0)); + squares.kind = NodeKind::Compound { children: members, rule: FillRule::NonZero }; + let mut heavy = brush_art_node(); + heavy.extras_mut().mask = Some(Box::new(OpacityMask { art: Arc::new(squares), clip: true, invert: false, disabled: false, linked: true })); + let mut member = brush_art_node(); + member.kind = match member.kind { + NodeKind::Group { mut children, .. } => { + let mask = rect_mask(10, Rect::new(0.0, 0.0, 20.0, 4.0), solid(Color::WHITE), true, false, true); + Arc::make_mut(&mut children[0]).extras_mut().mask = Some(Box::new(mask)); + NodeKind::Compound { children, rule: FillRule::NonZero } + } + kind => kind, + }; + member.appearance = Appearance::basic(black_fill(), Paint::None, 0.0).into(); + let cases = [ + ("gradient mask", gradient), + ("masks eight deep", deep), + ("mask art past the reader's limit", heavy), + ("mask on a compound path's member", member), + ]; + for (why, art) in cases { + let mut doc = Document::new(300.0, 200.0); + let lib = vec![keep.clone(), Brush { name: why.into(), kind: BrushKind::Scatter(Scatter { art, ..Scatter::default() }) }]; + vectorcraft_brush::store(&mut doc, &lib); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(out.warnings.iter().any(|w| w == writer::BRUSHES), "{why}: {:?}", out.warnings); + assert!(!out.warnings.iter().any(|w| w == writer::DEEP_MASKS), "{why}: {:?}", out.warnings); + let names: Vec = vectorcraft_brush::library(&read_back(&doc)).into_iter().map(|b| b.name).collect(); + assert_eq!(names, ["Masked spray"], "{why}"); + assert_eq!(program(&doc).matches("%AI8_BeginBrushPattern").count(), 1, "{why}"); + } +} + +/// A brush's mask art is written as the brush holds it when an object of the layers' mask art with +/// the same id keeps a live effect as an art style: the brush's mask comes back as its own plain +/// rectangle, without the layers' object's effect or geometry. +#[test] +fn a_brushs_mask_art_isnt_written_as_a_styled_object_with_its_id() { + use vectorcraft_brush::{Brush, BrushKind, Scatter}; + let offset = fx("path.offsetPath", serde_json::json!({"offset": 8.0, "joins": "miter", "miterLimit": 4.0})); + let mut id = None; + let mut doc = masked_image(|doc| { + let grown = styled_rect(doc, "Grown", Rect::new(60.0, 30.0, 110.0, 70.0), solid(Color::rgb(0.0, 0.0, 0.0)), Paint::None, vec![offset]); + id = Some(grown.id); + grown + }); + let id = id.expect("the mask's art"); + let mut art = brush_art_node(); + art.extras_mut().mask = Some(Box::new(rect_mask(id.0, Rect::new(0.0, 0.0, 30.0, 8.0), solid(Color::WHITE), true, false, true))); + let lib = vec![Brush { name: "Masked spray".into(), kind: BrushKind::Scatter(Scatter { art, ..Scatter::default() }) }]; + vectorcraft_brush::store(&mut doc, &lib); + let got = vectorcraft_brush::library(&read_back(&doc)); + let [Brush { kind: BrushKind::Scatter(s), .. }] = got.as_slice() else { panic!("{got:?}") }; + let BrushKind::Scatter(want) = &lib[0].kind else { panic!("a Scatter brush") }; + let m = s.art.extras().mask.as_deref().unwrap_or_else(|| panic!("the mask is read: {:#?}", s.art)); + assert!(m.art.appearance.effects.is_empty(), "{:?}", m.art.appearance.effects); + let (gt, wt) = (art_tree(&s.art), art_tree(&want.art)); + assert!(same_tree(>, &wt), "{gt:#} for {wt:#}"); +} + /// Settings the other tests don't use come back: a Calligraphic brush varying with tilt and bearing, /// a Scatter brush keeping its art's colors whose rotation doesn't follow the path, and brushes whose /// modes aren't given (the reader gives them, the same ones). diff --git a/crates/eps/src/ai_editing/writer/brushes.rs b/crates/eps/src/ai_editing/writer/brushes.rs index 2c281e702d..14836bdb5b 100644 --- a/crates/eps/src/ai_editing/writer/brushes.rs +++ b/crates/eps/src/ai_editing/writer/brushes.rs @@ -23,7 +23,7 @@ use super::{Writer, Xy}; use crate::ai_ops; use crate::ps; -pub(in crate::ai_editing) const BRUSHES: &str = "Pattern and Bristle brushes, Art brushes that don't stretch their art along the path from left to right at 100% unflipped without overlap, Scatter and Art brushes in Tints and Shades or Hue Shift, brushes whose art holds an empty path or group or more than paths, compound paths and groups with one solid fill and one plain stroke each, brushes whose names hold a slash or repeat an earlier brush's name, brushes that would open with other settings, brushes past the number or the amount of art one file's brushes can hold, and every brush on a large canvas are left out of the Brushes panel in the editing data for other apps"; +pub(in crate::ai_editing) const BRUSHES: &str = "Pattern and Bristle brushes, Art brushes that don't stretch their art along the path from left to right at 100% unflipped without overlap, Scatter and Art brushes in Tints and Shades or Hue Shift, brushes whose art or its opacity masks' art holds an empty path or group or more than paths, compound paths and groups with one solid fill and one plain stroke each, or opacity masks on a compound path's members or more than seven deep in one another's art, brushes whose names hold a slash or repeat an earlier brush's name, brushes that would open with other settings, brushes past the number or the amount of art one file's brushes can hold, and every brush on a large canvas are left out of the Brushes panel in the editing data for other apps"; /// Most brushes written (the reader's limit). const MAX_BRUSHES: usize = 4096; @@ -164,17 +164,38 @@ fn art_params(a: &ArtBrush, art: &str) -> Option { Some(format!("2 / {art}/ / / / / 0 0/ 5 0 0 0 / {}", nums6(&numbers))) } +/// Most opacity masks in one another's art in a brush's art: a brush's art section writes its art +/// one level inside, and masks at [`super::MAX_NEST`] levels are left out ([`super::DEEP_MASKS`]). +const MAX_MASK_NEST: u32 = super::MAX_NEST - 1; + /// Is `art` written as the reader reads it back, within a brush: paths and compound paths with /// points and groups with members (not clipping, without paint of their own), each opaque in the -/// normal blending mode, without effects or opacity masks, with at most one fill and one plain -/// stroke (no brush, width profile, arrowheads, alignment off the path or dashes fitted to corners) -/// over it, each in a color or none? A path without points isn't written ([`Writer::plain_object`]). +/// normal blending mode, without effects, with at most one fill and one plain stroke (no brush, +/// width profile, arrowheads, alignment off the path or dashes fitted to corners) over it, each in a +/// color or none, and opacity masks whose art is such art too, at most [`MAX_MASK_NEST`] deep and +/// none on a compound path's members? A path without points isn't written +/// ([`Writer::plain_object`]). fn plain_art(art: &Node) -> bool { + plain_within(art, MAX_MASK_NEST) +} + +/// Does no object of `art` have an opacity mask? +fn unmasked(art: &Node) -> bool { + let mut unmasked = true; + art.walk(&mut |n| unmasked &= n.extras().mask.is_none()); + unmasked +} + +/// [`plain_art`] with at most `masks` opacity masks in one another's art. +fn plain_within(art: &Node, masks: u32) -> bool { let mut plain = true; art.walk(&mut |n| { let kind = match &n.kind { NodeKind::Path { path, guide: false, clipping: false, .. } => path.subpaths.iter().any(|sp| !sp.anchors.is_empty()), - NodeKind::Compound { .. } => super::compound_path(n).subpaths.iter().any(|sp| !sp.anchors.is_empty()), + // A compound path is written as one path of its members' subpaths, without their masks. + NodeKind::Compound { children, .. } => { + children.iter().all(|c| unmasked(c)) && super::compound_path(n).subpaths.iter().any(|sp| !sp.anchors.is_empty()) + } NodeKind::Group { children, clip: false } => !children.is_empty(), _ => false, }; @@ -198,7 +219,7 @@ fn plain_art(art: &Node) -> bool { && order && quiet && n.appearance.effects.is_empty() - && n.extras().mask.is_none() + && n.extras().mask.as_deref().is_none_or(|m| masks > 0 && plain_within(&m.art, masks - 1)) && n.opacity >= 1.0 && n.blend == BlendMode::Normal; }); @@ -209,8 +230,13 @@ fn plain_art(art: &Node) -> bool { /// compound path with the subpaths of all its members as one path ([`super::compound_path`]), is /// written as one path when it has one subpath with points and as a compound path when it has more /// ([`Writer::plain_object`]); the reader reads that compound path as one path for each subpath, -/// each with the object's paint. +/// each with the object's paint. An opacity mask's art is written shown ([`Writer::mask`]). fn as_read(art: &mut Node) { + if let Some(m) = art.extras_if_any().and_then(|e| e.mask.as_mut()) { + let mask_art = Arc::make_mut(&mut m.art); + mask_art.visible = true; + as_read(mask_art); + } let (subpaths, rule) = match &art.kind { NodeKind::Path { path, rule, .. } => (path.subpaths.clone(), *rule), NodeKind::Compound { rule, .. } => (super::compound_path(art).subpaths, *rule), @@ -341,7 +367,7 @@ impl Writer<'_> { } let mut read = a.clone(); if *to_section == Affine::IDENTITY { - read.transform(Affine::FLIP_Y, false); + crate::import::turn_brush_art_over(&mut read); } as_read(&mut read); Some(read) @@ -378,6 +404,9 @@ impl Writer<'_> { // The art is the brush's own: not on `%_` lines, in a drawn look or in a symbol that // first uses the brush. (std::mem::take(&mut self.hidden), std::mem::take(&mut self.in_look), std::mem::take(&mut self.in_symbol)), + // The layers' objects written with art styles, by id: none of them is the brush's art, + // which may hold objects with the same ids. + std::mem::take(&mut self.styled), ); (self.to_art, self.grad_space, self.canvas, self.block_end) = (to_section, to_section, to_section, usize::MAX); self.state(false, false); @@ -413,6 +442,7 @@ impl Writer<'_> { self.clip, (self.block_start, self.block_end), (self.hidden, self.in_look, self.in_symbol), + self.styled, ) = saved; let text = std::mem::replace(&mut self.body, body); if !std::mem::replace(&mut self.warnings, warnings).is_empty() { diff --git a/crates/eps/src/import.rs b/crates/eps/src/import.rs index bdb3b9cf50..dbfdc15417 100644 --- a/crates/eps/src/import.rs +++ b/crates/eps/src/import.rs @@ -90,7 +90,7 @@ pub(crate) use ai::objects_read; pub(crate) use ai::{ BRUSH_MANAGER, BrushesRead, DEFORM_PLUGIN, EnvelopeGridPoint, MAX_CHECKED as ENVELOPE_CHECKS, MAX_EDITING_OBJECTS, MAX_GRADIENT_STOPS, MAX_LISTED, MAX_LISTED_NAME, MAX_SYMBOLS, brush_plugin_name, brushes_kept, envelope_outline, envelope_upright, read_art_style, read_brush_object, - read_style_list, style_moves_with, symbol_art_member, warp_number, + read_style_list, style_moves_with, symbol_art_member, turn_brush_art_over, warp_number, }; pub(crate) use ate::{MAX_BYTES as MAX_TEXT_DOCUMENT, MAX_FRAMES, MAX_SEGMENTS, MAX_STORY, MAX_VALUES as MAX_TEXT_VALUES, record_version}; pub use native::{AiLayers, ai_alone, ai_alone_on_page, ai_alone_with, ai_layers_alone, ai_opened_artboard, is_loss, layered_ai, layered_ai_from}; diff --git a/crates/eps/src/import/ai.rs b/crates/eps/src/import/ai.rs index 4595061151..2bf72588de 100644 --- a/crates/eps/src/import/ai.rs +++ b/crates/eps/src/import/ai.rs @@ -34,7 +34,9 @@ use std::io::Read as _; use super::lex::find; use crate::ps; -pub(crate) use brush::{BrushesRead, MANAGER_NAME as BRUSH_MANAGER, brushes_kept, plugin_name as brush_plugin_name, read_brush_object}; +pub(crate) use brush::{ + BrushesRead, MANAGER_NAME as BRUSH_MANAGER, brushes_kept, plugin_name as brush_plugin_name, read_brush_object, turn_over as turn_brush_art_over, +}; pub(crate) use envelope::DRAWN as ENVELOPE_DRAWN; pub(crate) use envelope::MAX_CHECKED; pub(crate) use envelope::TYPE_DRAWN as ENVELOPE_TYPE_DRAWN; diff --git a/crates/eps/src/import/ai/brush.rs b/crates/eps/src/import/ai/brush.rs index 5a5db47114..e768c154e7 100644 --- a/crates/eps/src/import/ai/brush.rs +++ b/crates/eps/src/import/ai/brush.rs @@ -50,6 +50,7 @@ //! at None so the art keeps its own colors. use std::collections::{HashMap, HashSet}; +use std::sync::Arc; use kurbo::Affine; use vectorcraft_brush::{ArtBrush, Bristle, Brush, BrushKind, Calligraphic, Colorization, Scatter, Variation}; @@ -377,6 +378,30 @@ pub(super) fn parse_tool_object(kind: Tool, name: &str, params: &str) -> Result< Ok(BrushDraft { name: name.to_string(), kind }) } +/// Turn `art` over (y for -y) with the art of all its opacity masks, those that don't move with +/// their objects too: the art changes the space it is in, and no object moves over its mask. +pub(crate) fn turn_over(art: &mut Node) { + art.transform(Affine::scale_non_uniform(1.0, -1.0), false); + turn_unlinked_masks(art); +} + +/// Turn over the art of the opacity masks in `n` that a transform of `n` leaves in place (the masks +/// that don't move with their objects), in members and in other masks' art too. +fn turn_unlinked_masks(n: &mut Node) { + if let Some(m) = n.extras_if_any().and_then(|e| e.mask.as_mut()) { + let linked = m.linked; + let art = Arc::make_mut(&mut m.art); + if linked { + turn_unlinked_masks(art); + } else { + turn_over(art); + } + } + for c in n.children_mut().into_iter().flatten() { + turn_unlinked_masks(Arc::make_mut(c)); + } +} + /// The brushes of `drafts`, their art from the sections `art` (by name), in the brush manager's /// `order` (brushes it doesn't list after those it does, in the order of their objects), each /// kept within its ranges → the brushes and how many were left out: those whose art isn't read, @@ -456,7 +481,7 @@ pub(super) fn finish_brushes_within( DraftKind::Art { brush, art: name, .. } => copy(&name).map(|mut a| { // The side of the section with y up draws on the right of the path, and a brush // draws art's y (down here) on the left of the path. - a.transform(Affine::scale_non_uniform(1.0, -1.0), false); + turn_over(&mut a); BrushKind::Art(ArtBrush { art: a, ..brush }) }), DraftKind::Pattern { .. } => None, diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index e2a1943de7..cbeb3ff7f3 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -6358,6 +6358,30 @@ fn a_brushs_opacity_mask_art_takes_ids_of_the_document() { assert_eq!(unique.len(), all.len(), "{all:?}"); } +/// An Art brush's art is turned over with the art of its opacity mask, whether the mask moves with +/// its object or not: the mask's art stays over the part of the object it is over in the section. +#[test] +fn an_art_brushs_opacity_mask_art_turns_over_with_its_object() { + let mut read = vec![]; + for linked in [true, false] { + let mask_art: String = format!("1 g\n{}f\n", rect_path(0.0, 0.0, 40.0, 3.0)).lines().map(|l| format!("%_{l}\n")).collect(); + let options = format!("%_1 /Bool (Clipping) ,\n%_{} /Bool (Linked) ,\n", u8::from(linked)); + let mask = format!("%_/ArtDictionary :\n%_/Mask :\n%_X=\n{mask_art}%_X+\n%_(Art) ,\n{options}%_; (AI9_Mask) ,\n%_;\n"); + let section = format!("%AI8_BeginBrushPattern\n(Ribbon art)\n0 A\n0 g\n{}f\n{mask}%AI8_EndBrushPattern\n", rect_path(0.0, 0.0, 40.0, 8.0)); + let shape = format!("{RED}{}f\n", rect_path(0.0, 0.0, 10.0, 10.0)); + let r = read_ok(&format!("{section}{}{}", plugin_object(ART_BRUSH, "Ribbon", RIBBON), layer(&shape))); + let lib = vectorcraft_brush::library(&r.doc); + let vectorcraft_brush::BrushKind::Art(brush) = brush_named(&lib, "Ribbon") else { panic!("art: {:?}", r.warnings) }; + let m = brush.art.extras().mask.as_deref().unwrap_or_else(|| panic!("the mask is read: {:#?}", brush.art)); + assert_eq!(m.linked, linked); + let (object, over) = (brush.art.geometric_bounds().unwrap(), m.art.geometric_bounds().unwrap()); + assert!((object.height() - 8.0).abs() < 1e-6 && (over.height() - 3.0).abs() < 1e-6, "linked {linked}: {over:?} over {object:?}"); + assert!(over.y0 > object.y0 - 1e-6 && over.y1 < object.y1 + 1e-6, "linked {linked}: {over:?} over {object:?}"); + read.push((object, over)); + } + assert_eq!(read[0], read[1], "a mask is in the same place whether it moves with its object or not"); +} + /// An art styles section inside a symbol's, a pattern's or a brush's art is skipped: the file's own /// art styles still style the layers' objects read after the definition. #[test] diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 490b47464d..5852781d75 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -118,7 +118,9 @@ private editing data. VectorCraft: Scatter and Art brushes with their art, are written in its order: Scatter and Art brushes in Tints or keeping their art's colors, Art brushes that stretch their art along the path from left to right at 100% unflipped without overlap, and art of paths and compound paths with points and groups with members, with one solid fill and one - plain stroke each. Other brushes, + plain stroke each. Such art may hold opacity masks whose art is of the same kinds, up to seven deep in one + another's art; the masks are written with their options, and an Art brush whose art holds one is written with + its strokes as their drawn look. Other brushes, Pattern and Bristle brushes among them, and brushes past the number or the art VectorCraft's reader reads are left out with a warning; no brush is written on a large canvas. A path or compound path with a Calligraphic brush, or with an Art brush in Tints whose art bends along the path, keeps the brush on its stroke; other brushed strokes are diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index f3707717e6..46eb5ac83a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1651,6 +1651,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur A `.ai` or EPS whose editing data has brushes opens with the file's Calligraphic, Scatter, Art and Bristle brushes in the Brushes panel in place of the default ones, in the file's order: the Calligraphic size, roundness and angle with their variation, the Scatter size, spacing, scatter and rotation, the Bristle settings, and the Scatter and Art brushes' art (Art brushes in the older and newer forms of their objects). A brush library `.ai` (brushes and no layers) opens from its PDF part with its brushes, so Other Library lists them. An Art brush in Tints keeps that colorization. Pattern brushes and brushes that can't be read are left out with a note. Paths with a Calligraphic brush, and paths with an Art brush in the newer form at 100% in Tints that stretches art of solid-filled paths unflipped, open as the path with the brush on its stroke. Paths with an Art brush in the older form, and other brushed paths, still come in as their drawn look (part of #372 and #637; `crates/eps/src/import/ai/tests.rs`, `crates/eps/src/import/tests_native.rs`). In a `.ai` opened from its editing data, a path or type object with Offset Path, Outline Object or Outline Stroke on the whole object opens as itself with those effects live, in their order and shown or hidden; on a fill or stroke of type they stay on that fill or stroke. Offset Path keeps its Offset, Joins and Miter Limit, and Outline Stroke takes its width from the stroke. An Offset Path with a setting missing, out of range or not read keeps the drawn art, as does a path with a Path effect on one fill or stroke (`crates/eps/src/import/ai/style/tests.rs`, `crates/eps/src/import/ai/tests.rs`, `crates/eps/src/import/tests_native.rs`). In a `.ai` or EPS opened from its editing data, a Scatter brush whose last 15 numbers start with 1 comes into the Brushes panel in Tints, and each brush art section is read without its frame, an unnamed, unpainted rectangle with no settings of its own at the art's bounds (within 1/1000 pt). A wider frame stays in the art, and an art group with a state or look of its own (hidden, locked, isolated, knockout, an opacity, a blend mode, a name, a mask, a note or an appearance) stays a group (`crates/eps/src/import/ai/tests.rs`). + A PDF-compatible `.ai` saved with Include Editing Data for Other Apps writes a Scatter or Art brush whose art holds opacity masks to the Brushes panel of its editing copy. This is VectorCraft's own rule for brushes a document already holds. Each mask's art is written in the brush's art section in the form VectorCraft's `.ai` reader reads (`define_brush_art` in `crates/eps/src/import/ai/read/directives.rs`), with the mask's Clip and Invert Mask options, whether it is disabled and whether it moves with its object, for masks up to seven deep in one another's art. A brush whose mask art holds more than paths, compound paths and groups with one solid fill and one plain stroke each is left out with a warning, and a path with an Art brush whose art holds a mask is written as its drawn look. When the reader turns an Art brush's art over, it turns the art of a mask that doesn't move with its object over too (`scatter_and_art_brush_mask_art_round_trips` and `brushes_whose_mask_art_isnt_read_back_are_left_out` in `crates/eps/src/ai_editing/tests.rs`, `an_art_brushs_opacity_mask_art_turns_over_with_its_object` in `crates/eps/src/import/ai/tests.rs`). In a `.ai` opened from its editing data, type with Warp on the object or on one of its fills or strokes opens as type with the effect live when the live warp draws as the art saved with it. When it draws differently, or when the file's limit of checks has no check left for it, it opens as that art, and one note says how many did. Type stays live without a comparison when the saved art paints nothing or draws type of its own, in frames of threaded type, when a text variable binds it, and when its text object doesn't come in as one text object (`crates/eps/src/import/ai/envelope.rs`, `crates/eps/src/import/tests_native.rs`). In a `.ai` opened from its editing data, an object with a Tweak that moves nothing or Pucker & Bloat at 0 opens as itself with the effect live. A path, compound path or group whose only effect is Transform without copies, or a Free Distort whose corners make a parallelogram, opens as itself with it live, and so does an object with nothing stroked whose only effect is Twist: a path or compound path with straight segments at up to 180° either way, and another path, compound path or group with no guide in it at up to 90° either way (limits VectorCraft sets); one twisted further keeps the drawn art. A gradient or pattern, an image, type, a clipping group, an opacity mask or effects inside the object, or a stroke with a Transform that scales, rotates or reflects, keep the drawn art (`crates/eps/src/import/ai/style/tests.rs`, `crates/eps/src/import/ai/tests.rs`, `crates/eps/src/import/ai/read/ops.rs`). A PDF page whose `UserUnit` (PDF 1.6) is above 1 opens at its size in points, its numbers times the `UserUnit` (one above 75,000 counts as 75,000), and `document.pdfInfo` gives its size and boxes in points too. A `.ai` whose editing data has its artboards in the units of such a page opens from that data at the page's size, with its layers, and when the layers can't be read its pages still take the artboard layout of the data, scaled the same way (part of #1482). From 96d4ed9e7b60375a2af19aca1cbc1f32521faa54 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 20:36:43 -0800 Subject: [PATCH 007/226] i18n: remove message rows the joined messages replace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The German, Polish, Brazilian Portuguese, Ukrainian and Simplified Chinese catalogs on main had rows for the unknown-option message with `{within}{key}` and the range message with `{lo}–{hi}{unit}`. Those messages now join the side-by-side values into one, and each catalog already has the joined rows, so the old rows are removed. The `{within}settings.{format}` rows in those catalogs and in Italian are removed too, since no message is made in that form any more. --- crates/ui-egui/src/i18n/de.tsv | 3 --- crates/ui-egui/src/i18n/it.tsv | 1 - crates/ui-egui/src/i18n/pl.tsv | 3 --- crates/ui-egui/src/i18n/pt-br.tsv | 3 --- crates/ui-egui/src/i18n/uk.tsv | 3 --- crates/ui-egui/src/i18n/zh-hans.tsv | 3 --- 6 files changed, 16 deletions(-) diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 3bffc42db3..c5a9bac1d9 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7456,8 +7456,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 @@ -8873,7 +8871,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/it.tsv b/crates/ui-egui/src/i18n/it.tsv index d78bbe5f86..3de841318d 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7504,7 +7504,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 diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 8bff9fc164..06d44c64c0 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7745,8 +7745,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 @@ -9159,7 +9157,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 4caa5c474e..ee2282009f 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -9225,8 +9225,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) @@ -9354,7 +9352,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/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index c26a7377a9..0496539cdb 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -8754,8 +8754,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) @@ -8882,7 +8880,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/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 386e9dd44b..77587b4d74 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7726,8 +7726,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 字符类没有结束 @@ -9145,7 +9143,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} From 02c24ac7b84ac72b27934fe1db021206adb86a0f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 17:53:45 -0800 Subject: [PATCH 008/226] .ai import: guides past an object's art keep the drawn look under Transform and Free Distort A compound path or group with a Transform that scales, rotates or reflects was read live whatever guides it held, and so was a group with a Free Distort that moves a corner. The live effect is measured from bounds that take in the guides, so where a guide reaches past the rest of the object's art, the live effect is placed from a larger box than the art. Such an object now opens as its drawn look. Guides are looked for in members at any depth, a guide in a group inside the object included, and a hidden member counts as art. These keep opening live: a Transform that only moves, a Transform with Transform Objects off, a Free Distort on a compound path, and objects whose guides lie inside the rest of their art. The `.ai` writer keeps a graphic-style link only where the reader reads the style live, so such an object is now written without the link, with the existing style-link warning. --- crates/eps/src/ai_editing/tests.rs | 68 ++++++++++++++++++++++ crates/eps/src/import/ai/read/ops.rs | 66 ++++++++++++++++----- crates/eps/src/import/ai/tests.rs | 86 ++++++++++++++++++++++++++++ docs/file-format-parity.md | 2 +- docs/target-app-parity.md | 2 +- 5 files changed, 209 insertions(+), 15 deletions(-) diff --git a/crates/eps/src/ai_editing/tests.rs b/crates/eps/src/ai_editing/tests.rs index 967c982ad4..91138405ed 100644 --- a/crates/eps/src/ai_editing/tests.rs +++ b/crates/eps/src/ai_editing/tests.rs @@ -7682,6 +7682,74 @@ fn a_link_to_a_twist_style_is_kept_where_the_reader_reads_it() { } } +/// A link to a graphic style with Transform or Free Distort is kept where the reader reads the +/// effect. On a compound path of a square and a guide: Transform with the guide inside the square, +/// moving only, or with Transform Objects off (Transform Patterns on or off), and Free Distort. On a +/// group holding such a compound path: Transform with the guide inside. Transform that scales where +/// the guide reaches past the square is written without the link and warns. +#[test] +fn a_link_to_a_transform_or_free_distort_style_with_a_guide_is_kept_where_the_reader_reads_it() { + // A compound path of a filled square and a guide from `a` to `b`, with appearance `ap`. + fn guided(doc: &mut Document, ap: Appearance, a: (f64, f64), b: (f64, f64)) -> Node { + let square = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(10.0, 10.0, 50.0, 40.0)), Appearance::default()); + let path = shapes::rectangle(Rect::new(a.0, a.1, b.0, b.1)); + let guide = Node::new(doc.alloc_id(), NodeKind::Path { path, rule: FillRule::NonZero, live: None, clipping: false, guide: true }); + let mut n = Node::new(doc.alloc_id(), NodeKind::Compound { children: vec![Arc::new(square), Arc::new(guide)], rule: FillRule::NonZero }); + n.appearance = ap.into(); + n + } + // A document with that compound path (in a group when `grouped`) with effect `e`, linked to a + // graphic style of that appearance. + let make = |e: vectorcraft_doc::Effect, grouped: bool, a: (f64, f64), b: (f64, f64)| { + let mut doc = Document::new(200.0, 100.0); + let filled = Appearance::basic(black_fill(), Paint::None, 0.0); + let ap = Appearance { effects: vec![e], ..if grouped { Appearance::default() } else { filled.clone() } }; + let mut g = vectorcraft_doc::GraphicStyle::new("Moved", ap.clone()); + g.id = 9; + doc.graphic_styles.push(g); + let mut n = if grouped { + let member = guided(&mut doc, filled, a, b); + let mut n = Node::group(doc.alloc_id(), vec![Arc::new(member)]); + n.appearance = ap.into(); + n + } else { + guided(&mut doc, ap, a, b) + }; + n.extras_mut().graphic_style = Some(9); + put(&mut doc, n); + doc + }; + let scale = || fx("distort.transform", serde_json::json!({"copies": 0, "scaleH": 50.0, "scaleV": 50.0})); + let moved = || fx("distort.transform", serde_json::json!({"copies": 0, "moveH": 5.0})); + let in_place = || fx("distort.transform", serde_json::json!({"copies": 0, "scaleH": 50.0, "objects": false, "patterns": false})); + let patterns_only = || fx("distort.transform", serde_json::json!({"copies": 0, "scaleH": 50.0, "objects": false, "patterns": true})); + let slant = || fx("distort.freeDistort", serde_json::json!({"corners": [[0.2, 0.0], [1.2, 0.0], [1.0, 1.0], [0.0, 1.0]]})); + let (inside, past) = (((20.0, 20.0), (30.0, 30.0)), ((20.0, 20.0), (90.0, 30.0))); + for (what, doc, id, kept) in [ + ("a compound path scaled, its guide inside", make(scale(), false, inside.0, inside.1), "distort.transform", true), + ("a compound path moved, its guide past", make(moved(), false, past.0, past.1), "distort.transform", true), + ("a compound path scaled with Transform Objects off, its guide past", make(in_place(), false, past.0, past.1), "distort.transform", true), + ( + "a compound path scaled with Transform Objects off and Transform Patterns on, its guide past", + make(patterns_only(), false, past.0, past.1), + "distort.transform", + true, + ), + ("a compound path distorted, its guide past", make(slant(), false, past.0, past.1), "distort.freeDistort", true), + ("a group scaled, its guide inside", make(scale(), true, inside.0, inside.1), "distort.transform", true), + ("a compound path scaled, its guide past", make(scale(), false, past.0, past.1), "distort.transform", false), + ("a group scaled, its guide past", make(scale(), true, past.0, past.1), "distort.transform", false), + ] { + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert_eq!(out.warnings.iter().any(|w| w == writer::STYLE_LINKS), !kept, "{what}: {:?}", out.warnings); + let back = read_back(&doc); + let n = &back.layers[0].children().unwrap()[0]; + let style = n.extras().graphic_style.and_then(|id| back.graphic_style_by_id(id)).map(|g| g.name.as_str()); + assert_eq!(style, kept.then_some("Moved"), "{what}: {n:?}"); + assert_eq!(n.appearance.effects.iter().any(|e| e.id == id), kept, "{what}: {n:?}"); + } +} + /// Twist and Transform on an object that isn't linked to a graphic style are not written as a style /// of its own: the object reads back without live effects. #[test] diff --git a/crates/eps/src/import/ai/read/ops.rs b/crates/eps/src/import/ai/read/ops.rs index c1a6aa0385..863be9431f 100644 --- a/crates/eps/src/import/ai/read/ops.rs +++ b/crates/eps/src/import/ai/read/ops.rs @@ -1076,13 +1076,47 @@ fn no_guides(n: &Node, depth: usize) -> bool { depth <= MAX_DEPTH && !n.is_guide() && n.children().into_iter().flatten().all(|c| no_guides(c, depth + 1)) } -/// Is `n` a compound path with a guide member whose bounds reach past the bounds of its members that -/// aren't guides, or with guide members only? Any other object counts as no. +/// Is `n` a compound path or group with a guide in it whose bounds reach past the bounds of the rest +/// of its art, or with guides only? Members are looked into to [`MAX_DEPTH`]; deeper counts as yes. +/// Any other object counts as no. fn guides_reach_past(n: &Node) -> bool { - let NodeKind::Compound { children, .. } = &n.kind else { return false }; - let bounds = - |guides: bool| children.iter().filter(|c| c.is_guide() == guides).fold(None, |acc, c| vectorcraft_geom::union_opt(acc, c.geometric_bounds())); - bounds(true).is_some_and(|g| bounds(false).is_none_or(|o| o.union(g) != o)) + /// Adds the bounds of the guides in `n`'s members to `guides` and of the rest to `art`; false when + /// it is deeper than [`MAX_DEPTH`]. + fn split(n: &Node, depth: usize, guides: &mut Option, art: &mut Option) -> bool { + depth <= MAX_DEPTH + && n.children().into_iter().flatten().all(|c| match c.children() { + _ if c.is_guide() => { + *guides = vectorcraft_geom::union_opt(*guides, c.geometric_bounds()); + true + } + Some(_) => split(c, depth + 1, guides, art), + None => { + *art = vectorcraft_geom::union_opt(*art, c.geometric_bounds()); + true + } + }) + } + if !matches!(n.kind, NodeKind::Compound { .. } | NodeKind::Group { .. }) { + return false; + } + let (mut guides, mut art) = (None, None); + !split(n, 0, &mut guides, &mut art) || guides.is_some_and(|g| art.is_none_or(|o| o.union(g) != o)) +} + +/// Do Transform params `p` scale, turn or reflect, so that where the object's bounds lie changes +/// what they draw? Moving alone doesn't. +fn transform_measures(p: &serde_json::Value) -> bool { + p["scaleH"].as_f64() != Some(100.0) + || p["scaleV"].as_f64() != Some(100.0) + || p["rotate"].as_f64() != Some(0.0) + || p["reflectX"].as_bool() != Some(false) + || p["reflectY"].as_bool() != Some(false) +} + +/// Do Free Distort params `p` move a corner of the box, so that where the object's bounds lie +/// changes what they draw? +fn free_distort_measures(p: &serde_json::Value) -> bool { + p["corners"] != serde_json::json!([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]) } /// The largest Twist angle, in degrees either way, read as a live effect on an object that isn't a @@ -1101,7 +1135,11 @@ const MAX_STRAIGHT_TWIST: f64 = 180.0; /// compound path with straight segments (only at 0° when its guide members reach past its other /// members, see [`guides_reach_past`]), or up to [`MAX_TWIST`] degrees either way on another object /// with no guide in it. Transform that scales, turns or reflects is read only when nothing is stroked -/// (its reference point lies on the bounds without strokes). +/// (its reference point lies on the bounds without strokes) and, unless Transform Objects is off, +/// no guide reaches past the rest of the object's art ([`guides_reach_past`]). Free Distort that +/// moves a corner of a group is read only when no guide in the group reaches past the rest of its +/// art. The live effect is measured from bounds that take in the guides, so such an object keeps +/// its drawn look. fn moves_with(object: &Node, st: &crate::import::ai::style::ArtStyle) -> bool { use crate::import::ai::style::StyleItem; let stroked = st.items.iter().any(|i| matches!(i, StyleItem::Stroke { paint, .. } if !paint.is_none())) @@ -1121,12 +1159,14 @@ fn moves_with(object: &Node, st: &crate::import::ai::style::ArtStyle) -> bool { } "distort.transform" => { let p = &e.params; - !stroked - || (p["scaleH"].as_f64() == Some(100.0) - && p["scaleV"].as_f64() == Some(100.0) - && p["rotate"].as_f64() == Some(0.0) - && p["reflectX"].as_bool() == Some(false) - && p["reflectY"].as_bool() == Some(false)) + // With Transform Objects off, nothing is placed from the bounds: a style read here and + // the object's members paint with no pattern for Transform Patterns to move (`simple`, + // `moves_alike`). + let placed = p["objects"].as_bool() != Some(false); + !transform_measures(p) || (!stroked && (!placed || !guides_reach_past(object))) + } + "distort.freeDistort" => { + !matches!(object.kind, NodeKind::Group { .. }) || !free_distort_measures(&e.params) || !guides_reach_past(object) } _ => true, }) diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index f1e201824d..71cb503617 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -7367,6 +7367,92 @@ fn twist_is_read_on_straight_paths_and_compound_paths_up_to_half_a_turn() { } } +#[test] +fn transform_and_free_distort_keep_the_drawn_look_where_a_guide_reaches_past_the_rest_of_the_art() { + // GUARDS: a compound path or group whose guides reach past the rest of its art was read with a + // live Transform that scales, turns or reflects (or, on a group, a live Free Distort) measured from + // bounds that take in those guides. Such an object keeps its drawn look. + let hide = |s: String| s.replace('\n', "\n%_"); + // A compound path of a square and `rest`, under its drawn look. + let compound = |rest: &str| { + format!( + "0 Ae\nu\n{RED}{}f\nU\n%_Bb\n%_{}0 BB\n1 (Bent) XW\n", + rect_path(16.0, 16.0, 64.0, 54.0), + hide(format!("*u\n{}f\n{rest}*U\n", rect_path(20.0, 20.0, 60.0, 50.0))) + ) + }; + // A group of a red square and `rest`, under its drawn look. + let group = |rest: &str| { + format!( + "0 Ae\nu\n{RED}{}f\nU\n%_0 Ae\n%_u\n%_{}U\n1 (Bent) XW\n", + rect_path(16.0, 16.0, 64.0, 54.0), + hide(format!("{RED}{}f\n{rest}", rect_path(20.0, 20.0, 60.0, 50.0))) + ) + }; + let guide = |from: (f64, f64), to: (f64, f64)| format!("{} {} m\n{} {} L\n(N) *\n", from.0, from.1, to.0, to.1); + let inside = guide((25.0, 25.0), (35.0, 35.0)); + let past = guide((30.0, 30.0), (70.0, 40.0)); + let nested = format!("0 Ae\nu\n{past}U\n"); + let transform = |keys: &str| format!("{keys}0 /Bool (transformPatterns) ,\n"); + let scale = transform("0.5 /Real (scaleH_Factor) ,\n0.5 /Real (scaleV_Factor) ,\n0 /Bool (scaleLines) ,\n"); + let turn = transform("0.5 /Real (rotate_Radians) ,\n"); + let reflect = transform("1 /Bool (reflectX) ,\n"); + let moved = transform("5 /Real (moveH_Pts) ,\n"); + let scale_in_place = transform("0.5 /Real (scaleH_Factor) ,\n0 /Bool (scaleLines) ,\n0 /Bool (transformObjects) ,\n"); + // Transform Objects off and Transform Patterns on: only a pattern moves, and a solid fill has none. + let scale_patterns = "0.5 /Real (scaleH_Factor) ,\n0 /Bool (scaleLines) ,\n0 /Bool (transformObjects) ,\n1 /Bool (transformPatterns) ,\n"; + let slanted = free_distort_keys([[25.0, 50.0], [65.0, 50.0], [20.0, 20.0], [60.0, 20.0]]); + let read = |name: &str, keys: &str, paint, art_: &str| read_ok(&format!("{}{}", distort_styles(name, keys, paint), layer(art_))); + let tr = "Adobe Transform"; + let fd = "Adobe Free Distort"; + for (what, r, id) in [ + ("a compound path scaled, its guide inside", read(tr, &scale, BLUE_FILL, &compound(&inside)), "distort.transform"), + ("a compound path moved, its guide past", read(tr, &moved, BLUE_FILL, &compound(&past)), "distort.transform"), + ("a compound path distorted, its guide past", read(fd, &slanted, BLUE_FILL, &compound(&past)), "distort.freeDistort"), + ("a group scaled, its guide inside", read(tr, &scale, None, &group(&inside)), "distort.transform"), + ("a group moved, its guide past", read(tr, &moved, None, &group(&past)), "distort.transform"), + ("a group scaled with Transform Objects off, its guide past", read(tr, &scale_in_place, None, &group(&past)), "distort.transform"), + ( + "a compound path scaled with Transform Objects off and Transform Patterns on, its guide past", + read(tr, scale_patterns, BLUE_FILL, &compound(&past)), + "distort.transform", + ), + ("a group distorted, its guide inside", read(fd, &slanted, None, &group(&inside)), "distort.freeDistort"), + ("a group distorted with no corner moved, its guide past", read(fd, "", None, &group(&past)), "distort.freeDistort"), + // A hidden member is measured too, and this one takes in the guide. + ( + "a group scaled, its guide past the square and inside a hidden member", + read(tr, &scale, None, &group(&format!("1 Xw\n{RED}{}f\n0 Xw\n{past}", rect_path(10.0, 10.0, 80.0, 60.0)))), + "distort.transform", + ), + ] { + assert!(!r.warnings.iter().any(|w| w.contains("drawn look")), "{what}: {:?}", r.warnings); + let a = art(&r.doc); + assert_eq!(a.len(), 1, "{what}: {a:#?}"); + assert!(a[0].children().map_or(0, |c| c.len()) >= 2, "{what}: the object, not its look: {a:#?}"); + let [e] = a[0].appearance.effects.as_slice() else { panic!("{what}: {:?}", a[0].appearance) }; + assert_eq!(e.id, id, "{what}"); + } + for (what, r) in [ + ("a compound path scaled, its guide past", read(tr, &scale, BLUE_FILL, &compound(&past))), + ("a compound path turned, its guide past", read(tr, &turn, BLUE_FILL, &compound(&past))), + ("a compound path reflected, its guide past", read(tr, &reflect, BLUE_FILL, &compound(&past))), + ("a group scaled, its guide past", read(tr, &scale, None, &group(&past))), + ("a group turned, its guide past", read(tr, &turn, None, &group(&past))), + ("a group distorted, its guide past", read(fd, &slanted, None, &group(&past))), + ("a group scaled, its guide past in a group in it", read(tr, &scale, None, &group(&nested))), + ( + "a group scaled, its guide past in a compound path in it", + read(tr, &scale, None, &group(&format!("*u\n{RED}{}f\n{past}*U\n", rect_path(25.0, 25.0, 35.0, 35.0)))), + ), + ] { + let a = art(&r.doc); + assert_eq!(a.len(), 1, "{what}: {a:#?}"); + assert!(a[0].appearance.effects.is_empty(), "{what}: the drawn look: {a:#?}"); + assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{what}: {:?}", r.warnings); + } +} + #[test] fn twist_on_a_straight_compound_path_keeps_the_drawn_look_where_a_guide_reaches_past_its_other_members() { // GUARDS: a straight compound path whose guide members reach past its other members was read diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 92fd10cbb3..26044d42e3 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -264,7 +264,7 @@ private editing data. VectorCraft: ### Illustrator's private editing data -The app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPrivateData` streams, a PDF's `AIPDFPrivateData` streams when it was saved with the editing data (#868), Zstandard or zlib, the EPS's in ASCII85) is not documented as a whole. VectorCraft reads its structure: layers and sublayers (names, order, visibility, lock, printing, preview, dimming, colour), groups as they were nested, compound paths (painted by their last path, or the last painted one, with the paths of groups inside them kept as their paths: #1410), clipping groups and layer clipping (several clipping paths in a clipping group, a layer or an opacity mask's art clip to their intersection, and a compound path of clipping paths stays one clip; a filled clipping path keeps its fill, which paints under the art it clips, except the path of a mask that covers several layers, whose fill is read as a path of its own in the layer that holds the mask's path, and a compound clipping path whose subpaths paint differently, whose filled subpaths are read as a compound path of their own under the art it clips; clipping paths that would nest the art past the document's 32 levels stop the editing data from being read: #5789), object names, hidden and locked objects, fills and strokes (grey, CMYK, RGB, named and spot colours, spot colours defined in Lab with their Lab values (#1032), global process colours as global swatches at their tint; a stroke of width 0, `0 w`, on a path, a gradient-filled path, legacy type or in an art style comes in as a 0.25 pt hairline, as from PDF: #1671), linear and radial gradients, pattern fills with their patterns as pattern swatches (#1025), gradient and pattern names in the file up to their first newline (a name that another swatch, or a gradient or pattern defined earlier, already has is numbered "Sky 2"; a name without a newline is kept, and when another swatch has it, the pattern's swatch, or a named color sharing a gradient or pattern swatch's name, is numbered the same way), opacity, blend modes, isolation and knockout, embedded images where their matrix puts them, rotated ones too (#2269), with their alpha channel (CMYK images keep their ink amounts, as they do when a `.ai` opens from its PDF part, and an alpha channel that hides part of a CMYK image becomes a grayscale opacity mask), placed (linked) files as linked images in their place, each showing the low-resolution preview the file keeps of it until its file is found or relinked in the Links panel (#1264), with the folder the file keeps relative to the document's, where the link is looked for when its path is gone, placed PDF and `.ai` pages as placed documents of the [page and Crop to box](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-other-file-types/adobe-pdf-placement-options.html) their dictionary names (`AI11 PlacedPDFPageIndex`, `AI11 PlacedPDFCropTo`; a value VectorCraft doesn't read, or a binding to an image variable, leaves a linked image), guides, and every artboard where it is, with its center mark, cross hairs, video safe areas and video ruler pixel aspect ratio. VectorCraft reads `CropAreaActive`, an `/Int` in the dictionary that holds the artboard array, as the index of the active artboard in that array, and the file opens with that artboard active; without it, or when it names no artboard that opens, the first artboard is active. It also reads the Document Raster Effects Settings (resolution, color model, background, anti-alias, clipping mask, Add Around Object and Preserve Spot Colors), the author from the header's `%%For` (an EPS's own header when the editing data's has none), swatches for the header's `%%CMYKCustomColor` and `%%RGBCustomColor` colors that the document has none of, and `%%TemplateBox` in older files; a setting with a value of another type or out of range keeps its default. Objects on Path groups open live, with their path, their objects in order along it, Pivot and Rotate; one with a dragged spacing or other options opens as a plain group. A gradient with stops in the middle runs its whole ramp across its shape, and a gradient object does not pass its fill to the next path (#1390). An object whose art style is one fill and one stroke at most (solid colours, its own gradient, a variable-width profile on a Stroke Offset stroke or written as each side's widths) with Drop Shadow, Inner Glow, Outer Glow, Feather, Round Corners, Scribble, Offset Path, Outline Object, Outline Stroke, Convert to Shape, Tweak (only when it moves nothing), Pucker & Bloat at 0 or Bas Relief (read from its settings block: [raster effects reference](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/raster-effects-reference.html), [Photoshop File Formats Specification](https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/), [scripting the filter gallery](https://community.adobe.com/questions-712/scripting-support-for-the-filter-gallery-1064646)) comes in as itself with them and their saved settings. A path, compound path or group (not a clipping group) whose only effect is Transform (not with copies or Random) or a Free Distort whose corners make a parallelogram comes in as itself with it too, when neither it nor anything in it paints with a gradient or pattern and everything in it is a path, compound path or group with no opacity mask and no effects of its own; Transform that scales, rotates or reflects needs nothing in it to be stroked. Twist as the only effect is read the same way when nothing in the object is stroked: up to 180° either way (a limit VectorCraft sets) on a path or compound path whose segments are all straight, except a compound path with a guide member that reaches past its other members at an angle other than 0°, and up to 90° either way (a limit VectorCraft sets) on another path, compound path or group with no guide in it. One with more, other effects (Zig Zag, a Pucker & Bloat of another amount, a Free Distort with other corners), an effect setting that is not read (an unknown key, a missing or out-of-range value, a Scribble with a color of its own), a variable-width stroke with one centered width array, dashes aligned to corners, a brush other than a Calligraphic or Art one, a Calligraphic brush with settings of its own or an angle that follows the path, or an Art brush other than the ones described next comes in as its drawn look (a group named after it). Objects in a symbol defined before the file's art styles section, as newer files write it, take the same styles as the layers' objects. A path with a Calligraphic brush otherwise comes in as the path, the brush on its stroke at the stroke's weight, which scales the brush (#372), and so does a path with an Art brush, whose weight scales the art across the path, when all of these hold: the brush stretches its art along the path, unflipped, at 100% in Tints; the path's settings are the brush's own, with no entry that isn't read, no variable width and no effects; its stroke isn't a swatch; and the art is paths, compound paths and groups in solid fills, with no strokes, masks or effects, and has some length along the path. A stroke takes the brush the Brushes panel keeps under its name, and one whose name the panel doesn't keep comes in as its drawn look. Type with an Art brush keeps its drawn look under the type. A Calligraphic brush's Pressure, Tilt, Bearing and Rotation come in as those channels (a 6D Art Pen's brushes vary with the pressure, the bearing and the barrel's rotation); its Stylus Wheel varies at random. The file's Calligraphic, Scatter, Art and Bristle brushes replace the default ones in the Brushes panel, in the file's order, also when the file comes in as its PDF part (a brush library has no layers); pattern brushes and brushes it can't read are left out with a note. When the file opens from its layers, the spot colors in the art of each brush that comes in become swatches, and that art's colors count toward the document's color mode, as a pattern's do. The swatches take at most 20,000 color names in all across the brush art, and each brush-art section keeps at most 20,000 names. Each name keeps its first definition, with the color operators' names before the gradient stops' names. A spot color past those limits makes no swatch, and its color still counts toward the color mode. A spot color that the page's art, a pattern or a symbol also defines keeps the value defined there. Type keeps its art style as a live appearance whatever its stack (an Art brush aside), so it can be retyped: each fill and stroke of the style's stack (solid colours, gradients and pattern fills, placed as the drawn look places them) with its own opacity, blend mode and effects, the effects on the whole object, and where the characters paint among them; the effects read are Warp, Offset Path, Outline Object, Outline Stroke, Transform (with copies, Transform Objects, Transform Patterns and Scale Strokes & Effects; not with Random), Free Distort, Pucker & Bloat, Twist, Zig Zag, Tweak (only when it moves nothing, the file holding none of its random outline), Drop Shadow, Inner Glow, Outer Glow, Feather, Round Corners, Scribble, Gaussian Blur, Bas Relief (its detail, smoothness and light direction from its settings block, or the effect's defaults when the style holds no settings block; a settings block that isn't read keeps the drawn look) and Convert to Shape, and a style with others, or with an effect setting that isn't read, keeps the type's drawn look. Convert to Shape keeps its Rectangle, Rounded Rectangle or Ellipse, its Absolute or Relative size (a relative size in the file is added to each side) and its corner radius; a relative Ellipse, or a setting that isn't read, keeps the drawn look. The page's drawing of such a style isn't held to look like VectorCraft's where its drawn look lay. Gradients take their matrix (`Xm`, radials and skewed ones too), focal point and the order of stops sharing a ramp point; gradient meshes, a clipping path's own fill and its stroke, and the artboards' names are read too. `editingData: "always"` (`convert --editing-data`) opens a `.ai` or an Illustrator EPS from its editing data even where it draws differently from its page, which can be older, with a note. Type is made from the file's text document, whole and editable, shown or not: point type (its frame's matrix, which newer files leave out when it is neither turned nor scaled, read as none), area type (a story in several frames as threaded type) and type on a path, with its characters, fonts, size, leading, tracking, scaling, baseline shift, fill and stroke (grey, RGB or CMYK), alignment, indents and paragraph spacing (a character attribute a run doesn't set comes from its character style, then the style that one is based on, then the document's defaults); area type keeps its frame's Area Type Options rows and columns, the gutter between rows and the gutter between columns, and its first baseline (Fixed, Cap Height, Leading or x Height) with its minimum; type on a path keeps its frame's Type on a Path effect, Align to Path and Flip (a frame whose options set key 6 to true keeps their defaults), and the first frame's Spacing is fitted from the file's layout, not read from the dialog's value; the distance from the path under Align to Path is measured for each character at its size and vertical scale (in vertical type, its horizontal scale), from the top of its font's em box (Ascender), half the height of the top of its font's H (Center) or the bottom of its font's bounding box (Descender); the fit under Gravity does not reproduce the file's layout, and its glyphs can lie up to 7.4 pt from the positions the file keeps; the page's drawing of it (often in pieces) is left out. Vertical type keeps its orientation, its columns from right to left, and a run set to Tate-chu-yoko keeps that setting. When it makes the type of every text object that shows, the page's type is only compared with it, each text object keeps its own group, frame and layer, and a line break inside a paragraph stays one. Where it can't make a text object's type (a frame of another kind), that text object takes the page's type where the text document puts its lines, or else what is left of the page's type in painting order (no group around it); the page's type where made type draws stays that type's, and hidden type is left out with a note. Text wrap is read too: an object whose dictionary has the wrap options (offset and Invert Wrap), or any graphic of a legacy wraparound group (`*w` … `*W`, before or after its type, with no offset), is a wrap object, and area type below it in its layer flows around it when the file opens, threaded type included (#2763). Kerning, underline and the other character and paragraph options aren't read yet. A `.ai` saved without PDF compatibility (a placeholder page) opens from its editing data alone, its point type, area type and type on a path made from the text document. A `.ai` whose PDF part shows only text isn't taken for that placeholder when its page states an art, trim or bleed box: it opens from its editing data alone where that reads, else from its PDF part (#1387). A `.ai` whose PDF part draws nothing at all (an empty page, with or without those boxes) opens from its editing data alone where that reads too: there is no page art to check its layers against, and the empty page would lose all of it. Text objects with an appearance keep their own text and frame, type of hidden layers stays hidden, and type on later artboards lands on its text objects (#1391); area type whose frame is too short for a line of the fallback font shows its first line (the frame is made taller, with a warning in the open result) (#1392). In a PDF saved with some of its artboards, the type on each page after the first goes to an artboard of that page's size after the previous page's artboard, and only to one that leaves an artboard for each later page; the first page's artboard also leaves one for each later page. When several artboards fit a later page, VectorCraft takes the one whose art draws most like the page, and compares at most 16 artboards for all the later pages together. Symbols are read into the Symbols panel, in the file's symbol list order, with their art, their registration point and the instances in their art, and their instances come in live with their matrix, name, hide, lock, opacity, blending mode, isolation, knockout and opacity mask; a symbol whose art isn't read whole (type, placed files, an image it leaves out or anything else it doesn't read) isn't kept. A file that comes in as its page or PDF part because its editing data has no layers (a symbol library), or because its layers can't be read or used (any of the cases below), gets the symbols its editing data defines before its first layer, in the symbol list's order, while its page art stays as the page draws it. Instances of symbols it can't read, instances with appearance changes of their own (a dynamic symbol's), pattern fills whose pattern it can't read, placed files the data keeps no preview of and anything else it doesn't read make the file come in as its page (on a layer that doesn't show, they are left out of that layer), with a warning saying what. An unread object on a shown layer whose box can be found instead comes in as a group of the page's objects inside that box, named after it, with the rest of the layers and groups kept and a warning listing what came in as the page's art; the file still comes in as its page when live art or another unread object shares that page art, when the object spans two artboards or lies on an artboard that has no page, when no page art lies inside its box, when that page art is inside a page group with a clip, mask, transparency or appearance, when the object holds a frame of threaded type, when the page art uses a pattern, image or swatch that the page lacks or that differs from the editing data's, or when the page art doesn't carry its transparency (#4806). The layers' art is also compared with the page (by lightness, so colours written as their CMYK equivalents compare alike, and by whether a pixel is inked at all); the page is used when they differ by more than 5% (away from type, when all the type is made from the text document), where one draws an object the other doesn't (away from type, whose lines may be laid out afresh), and when an EPS whose page is its art's box has art printed outside it (#735). A `.ai` is not compared with its page, and its PDF part is not imported, when its text document makes the type of every text object (at least one shows, and none is drawn by the appearance of the layer or group it is in), no object is unread, no placed file has a second placement, no live envelope keeps its drawn art, it declares no large canvas, and its artboards are its pages' trim boxes one for one, in points or in the first page's `UserUnit`: it opens from its layers, with the bleed of its pages' bleed boxes. When they differ because some objects draw differently (an object in another color, or one that only one of them draws), each top-level object of the layers that holds such a difference comes in as a group of the page's objects inside its box and the layers stay, with a warning that names the layer or sublayer of each such object as the Layers panel shows it (`` for one without a name) and how many came in from it; an export or Save As to the file's own path then needs `acknowledgeLoss: true`, and a wrap object replaced this way keeps its wrap options. The file still comes in as its page when only edges or type differ, when a difference lies outside every top-level object, when more than half of the top-level objects or more than 64 hold one, when such an object is or holds type or holds a wrap object inside a group, when the page's type of a text object that stays lies inside such an object's box, when the page's art can't replace such an object for one of the reasons above for an unread object, when matching the differences to the objects would take too much work, or when the result still differs from the page. `editingData: "always"` keeps the objects as read, and placed files at the other point their data gives are tried as well. An EPS whose page is its art's box keeps that page when it comes in through its layers, not the editing data's artboard, and a text object counts as drawn by the page by its colours, not only its lightness, so a red stroke stacked over a dark red one stays (#1102). `textAs: "outlines"` opens a `.ai` whose type shows from its PDF part, which has the outlines; `editingData: false` opens any of them as its page or PDF part only, for print pipelines (#735). A file whose import left something out (hidden text, art or layers) is never written over by an export or Save As to its own path unless `acknowledgeLoss: true` (`convert --replace-lossy`), so the original keeps what the document lacks. Where a `.ai` can't be read that way (or its layers are turned off in the import options), we read its PDF-compatible part, so Illustrator-only live objects arrive as appearance, and plain groups arrive ungrouped: that part draws each object on its own and marks only layers, clipping groups and groups with opacity, blending or a mask (those come back). Art outside the artboards isn't in that part at all (Illustrator's PDF part leaves it out), so it doesn't open; the import says so in a note (#472). Its pages still go where the editing data puts the artboards (a grid stays a grid), with the art on each, when it has as many artboards as pages, of the same sizes (#1068); the page of the artboard `CropAreaActive` names is then the active artboard. A `.ai` whose editing data has artboards but no layers also opens on that page under the same check, and its pages stay where they are. A `.ai` whose PDF part's pages are cropped to its art (each page the box of all the art, which is the editing data's bounding box) instead of its artboards opens from its layers, with its own artboards, where they draw as that page does. Its pages are laid out so that art one of them draws past its artboard (notes beside a design, which the part doesn't clip) doesn't lie over the page before it in the row, where it was taken for that page's art: the check against the editing data then found art its layers don't have there and opened the file as its PDF part, without the art outside the artboards. That part also has no paragraphs: area type is written line by line, and comes back as area type only where its font is installed and lays the lines out with the same breaks, else as a point type object per line (#508). Art off the page that a PDF does draw opens on the pasteboard. +The app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPrivateData` streams, a PDF's `AIPDFPrivateData` streams when it was saved with the editing data (#868), Zstandard or zlib, the EPS's in ASCII85) is not documented as a whole. VectorCraft reads its structure: layers and sublayers (names, order, visibility, lock, printing, preview, dimming, colour), groups as they were nested, compound paths (painted by their last path, or the last painted one, with the paths of groups inside them kept as their paths: #1410), clipping groups and layer clipping (several clipping paths in a clipping group, a layer or an opacity mask's art clip to their intersection, and a compound path of clipping paths stays one clip; a filled clipping path keeps its fill, which paints under the art it clips, except the path of a mask that covers several layers, whose fill is read as a path of its own in the layer that holds the mask's path, and a compound clipping path whose subpaths paint differently, whose filled subpaths are read as a compound path of their own under the art it clips; clipping paths that would nest the art past the document's 32 levels stop the editing data from being read: #5789), object names, hidden and locked objects, fills and strokes (grey, CMYK, RGB, named and spot colours, spot colours defined in Lab with their Lab values (#1032), global process colours as global swatches at their tint; a stroke of width 0, `0 w`, on a path, a gradient-filled path, legacy type or in an art style comes in as a 0.25 pt hairline, as from PDF: #1671), linear and radial gradients, pattern fills with their patterns as pattern swatches (#1025), gradient and pattern names in the file up to their first newline (a name that another swatch, or a gradient or pattern defined earlier, already has is numbered "Sky 2"; a name without a newline is kept, and when another swatch has it, the pattern's swatch, or a named color sharing a gradient or pattern swatch's name, is numbered the same way), opacity, blend modes, isolation and knockout, embedded images where their matrix puts them, rotated ones too (#2269), with their alpha channel (CMYK images keep their ink amounts, as they do when a `.ai` opens from its PDF part, and an alpha channel that hides part of a CMYK image becomes a grayscale opacity mask), placed (linked) files as linked images in their place, each showing the low-resolution preview the file keeps of it until its file is found or relinked in the Links panel (#1264), with the folder the file keeps relative to the document's, where the link is looked for when its path is gone, placed PDF and `.ai` pages as placed documents of the [page and Crop to box](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-other-file-types/adobe-pdf-placement-options.html) their dictionary names (`AI11 PlacedPDFPageIndex`, `AI11 PlacedPDFCropTo`; a value VectorCraft doesn't read, or a binding to an image variable, leaves a linked image), guides, and every artboard where it is, with its center mark, cross hairs, video safe areas and video ruler pixel aspect ratio. VectorCraft reads `CropAreaActive`, an `/Int` in the dictionary that holds the artboard array, as the index of the active artboard in that array, and the file opens with that artboard active; without it, or when it names no artboard that opens, the first artboard is active. It also reads the Document Raster Effects Settings (resolution, color model, background, anti-alias, clipping mask, Add Around Object and Preserve Spot Colors), the author from the header's `%%For` (an EPS's own header when the editing data's has none), swatches for the header's `%%CMYKCustomColor` and `%%RGBCustomColor` colors that the document has none of, and `%%TemplateBox` in older files; a setting with a value of another type or out of range keeps its default. Objects on Path groups open live, with their path, their objects in order along it, Pivot and Rotate; one with a dragged spacing or other options opens as a plain group. A gradient with stops in the middle runs its whole ramp across its shape, and a gradient object does not pass its fill to the next path (#1390). An object whose art style is one fill and one stroke at most (solid colours, its own gradient, a variable-width profile on a Stroke Offset stroke or written as each side's widths) with Drop Shadow, Inner Glow, Outer Glow, Feather, Round Corners, Scribble, Offset Path, Outline Object, Outline Stroke, Convert to Shape, Tweak (only when it moves nothing), Pucker & Bloat at 0 or Bas Relief (read from its settings block: [raster effects reference](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/raster-effects-reference.html), [Photoshop File Formats Specification](https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/), [scripting the filter gallery](https://community.adobe.com/questions-712/scripting-support-for-the-filter-gallery-1064646)) comes in as itself with them and their saved settings. A path, compound path or group (not a clipping group) whose only effect is Transform (not with copies or Random) or a Free Distort whose corners make a parallelogram comes in as itself with it too, when neither it nor anything in it paints with a gradient or pattern and everything in it is a path, compound path or group with no opacity mask and no effects of its own; Transform that scales, rotates or reflects needs nothing in it to be stroked and, with Transform Objects on, no guide in it that reaches past the rest of its art (hidden members count as art), and a Free Distort that moves a corner of a group needs no guide in the group that reaches past the rest of its art. Twist as the only effect is read the same way when nothing in the object is stroked: up to 180° either way (a limit VectorCraft sets) on a path or compound path whose segments are all straight, except a compound path with a guide member that reaches past its other members at an angle other than 0°, and up to 90° either way (a limit VectorCraft sets) on another path, compound path or group with no guide in it. One with more, other effects (Zig Zag, a Pucker & Bloat of another amount, a Free Distort with other corners), an effect setting that is not read (an unknown key, a missing or out-of-range value, a Scribble with a color of its own), a variable-width stroke with one centered width array, dashes aligned to corners, a brush other than a Calligraphic or Art one, a Calligraphic brush with settings of its own or an angle that follows the path, or an Art brush other than the ones described next comes in as its drawn look (a group named after it). Objects in a symbol defined before the file's art styles section, as newer files write it, take the same styles as the layers' objects. A path with a Calligraphic brush otherwise comes in as the path, the brush on its stroke at the stroke's weight, which scales the brush (#372), and so does a path with an Art brush, whose weight scales the art across the path, when all of these hold: the brush stretches its art along the path, unflipped, at 100% in Tints; the path's settings are the brush's own, with no entry that isn't read, no variable width and no effects; its stroke isn't a swatch; and the art is paths, compound paths and groups in solid fills, with no strokes, masks or effects, and has some length along the path. A stroke takes the brush the Brushes panel keeps under its name, and one whose name the panel doesn't keep comes in as its drawn look. Type with an Art brush keeps its drawn look under the type. A Calligraphic brush's Pressure, Tilt, Bearing and Rotation come in as those channels (a 6D Art Pen's brushes vary with the pressure, the bearing and the barrel's rotation); its Stylus Wheel varies at random. The file's Calligraphic, Scatter, Art and Bristle brushes replace the default ones in the Brushes panel, in the file's order, also when the file comes in as its PDF part (a brush library has no layers); pattern brushes and brushes it can't read are left out with a note. When the file opens from its layers, the spot colors in the art of each brush that comes in become swatches, and that art's colors count toward the document's color mode, as a pattern's do. The swatches take at most 20,000 color names in all across the brush art, and each brush-art section keeps at most 20,000 names. Each name keeps its first definition, with the color operators' names before the gradient stops' names. A spot color past those limits makes no swatch, and its color still counts toward the color mode. A spot color that the page's art, a pattern or a symbol also defines keeps the value defined there. Type keeps its art style as a live appearance whatever its stack (an Art brush aside), so it can be retyped: each fill and stroke of the style's stack (solid colours, gradients and pattern fills, placed as the drawn look places them) with its own opacity, blend mode and effects, the effects on the whole object, and where the characters paint among them; the effects read are Warp, Offset Path, Outline Object, Outline Stroke, Transform (with copies, Transform Objects, Transform Patterns and Scale Strokes & Effects; not with Random), Free Distort, Pucker & Bloat, Twist, Zig Zag, Tweak (only when it moves nothing, the file holding none of its random outline), Drop Shadow, Inner Glow, Outer Glow, Feather, Round Corners, Scribble, Gaussian Blur, Bas Relief (its detail, smoothness and light direction from its settings block, or the effect's defaults when the style holds no settings block; a settings block that isn't read keeps the drawn look) and Convert to Shape, and a style with others, or with an effect setting that isn't read, keeps the type's drawn look. Convert to Shape keeps its Rectangle, Rounded Rectangle or Ellipse, its Absolute or Relative size (a relative size in the file is added to each side) and its corner radius; a relative Ellipse, or a setting that isn't read, keeps the drawn look. The page's drawing of such a style isn't held to look like VectorCraft's where its drawn look lay. Gradients take their matrix (`Xm`, radials and skewed ones too), focal point and the order of stops sharing a ramp point; gradient meshes, a clipping path's own fill and its stroke, and the artboards' names are read too. `editingData: "always"` (`convert --editing-data`) opens a `.ai` or an Illustrator EPS from its editing data even where it draws differently from its page, which can be older, with a note. Type is made from the file's text document, whole and editable, shown or not: point type (its frame's matrix, which newer files leave out when it is neither turned nor scaled, read as none), area type (a story in several frames as threaded type) and type on a path, with its characters, fonts, size, leading, tracking, scaling, baseline shift, fill and stroke (grey, RGB or CMYK), alignment, indents and paragraph spacing (a character attribute a run doesn't set comes from its character style, then the style that one is based on, then the document's defaults); area type keeps its frame's Area Type Options rows and columns, the gutter between rows and the gutter between columns, and its first baseline (Fixed, Cap Height, Leading or x Height) with its minimum; type on a path keeps its frame's Type on a Path effect, Align to Path and Flip (a frame whose options set key 6 to true keeps their defaults), and the first frame's Spacing is fitted from the file's layout, not read from the dialog's value; the distance from the path under Align to Path is measured for each character at its size and vertical scale (in vertical type, its horizontal scale), from the top of its font's em box (Ascender), half the height of the top of its font's H (Center) or the bottom of its font's bounding box (Descender); the fit under Gravity does not reproduce the file's layout, and its glyphs can lie up to 7.4 pt from the positions the file keeps; the page's drawing of it (often in pieces) is left out. Vertical type keeps its orientation, its columns from right to left, and a run set to Tate-chu-yoko keeps that setting. When it makes the type of every text object that shows, the page's type is only compared with it, each text object keeps its own group, frame and layer, and a line break inside a paragraph stays one. Where it can't make a text object's type (a frame of another kind), that text object takes the page's type where the text document puts its lines, or else what is left of the page's type in painting order (no group around it); the page's type where made type draws stays that type's, and hidden type is left out with a note. Text wrap is read too: an object whose dictionary has the wrap options (offset and Invert Wrap), or any graphic of a legacy wraparound group (`*w` … `*W`, before or after its type, with no offset), is a wrap object, and area type below it in its layer flows around it when the file opens, threaded type included (#2763). Kerning, underline and the other character and paragraph options aren't read yet. A `.ai` saved without PDF compatibility (a placeholder page) opens from its editing data alone, its point type, area type and type on a path made from the text document. A `.ai` whose PDF part shows only text isn't taken for that placeholder when its page states an art, trim or bleed box: it opens from its editing data alone where that reads, else from its PDF part (#1387). A `.ai` whose PDF part draws nothing at all (an empty page, with or without those boxes) opens from its editing data alone where that reads too: there is no page art to check its layers against, and the empty page would lose all of it. Text objects with an appearance keep their own text and frame, type of hidden layers stays hidden, and type on later artboards lands on its text objects (#1391); area type whose frame is too short for a line of the fallback font shows its first line (the frame is made taller, with a warning in the open result) (#1392). In a PDF saved with some of its artboards, the type on each page after the first goes to an artboard of that page's size after the previous page's artboard, and only to one that leaves an artboard for each later page; the first page's artboard also leaves one for each later page. When several artboards fit a later page, VectorCraft takes the one whose art draws most like the page, and compares at most 16 artboards for all the later pages together. Symbols are read into the Symbols panel, in the file's symbol list order, with their art, their registration point and the instances in their art, and their instances come in live with their matrix, name, hide, lock, opacity, blending mode, isolation, knockout and opacity mask; a symbol whose art isn't read whole (type, placed files, an image it leaves out or anything else it doesn't read) isn't kept. A file that comes in as its page or PDF part because its editing data has no layers (a symbol library), or because its layers can't be read or used (any of the cases below), gets the symbols its editing data defines before its first layer, in the symbol list's order, while its page art stays as the page draws it. Instances of symbols it can't read, instances with appearance changes of their own (a dynamic symbol's), pattern fills whose pattern it can't read, placed files the data keeps no preview of and anything else it doesn't read make the file come in as its page (on a layer that doesn't show, they are left out of that layer), with a warning saying what. An unread object on a shown layer whose box can be found instead comes in as a group of the page's objects inside that box, named after it, with the rest of the layers and groups kept and a warning listing what came in as the page's art; the file still comes in as its page when live art or another unread object shares that page art, when the object spans two artboards or lies on an artboard that has no page, when no page art lies inside its box, when that page art is inside a page group with a clip, mask, transparency or appearance, when the object holds a frame of threaded type, when the page art uses a pattern, image or swatch that the page lacks or that differs from the editing data's, or when the page art doesn't carry its transparency (#4806). The layers' art is also compared with the page (by lightness, so colours written as their CMYK equivalents compare alike, and by whether a pixel is inked at all); the page is used when they differ by more than 5% (away from type, when all the type is made from the text document), where one draws an object the other doesn't (away from type, whose lines may be laid out afresh), and when an EPS whose page is its art's box has art printed outside it (#735). A `.ai` is not compared with its page, and its PDF part is not imported, when its text document makes the type of every text object (at least one shows, and none is drawn by the appearance of the layer or group it is in), no object is unread, no placed file has a second placement, no live envelope keeps its drawn art, it declares no large canvas, and its artboards are its pages' trim boxes one for one, in points or in the first page's `UserUnit`: it opens from its layers, with the bleed of its pages' bleed boxes. When they differ because some objects draw differently (an object in another color, or one that only one of them draws), each top-level object of the layers that holds such a difference comes in as a group of the page's objects inside its box and the layers stay, with a warning that names the layer or sublayer of each such object as the Layers panel shows it (`` for one without a name) and how many came in from it; an export or Save As to the file's own path then needs `acknowledgeLoss: true`, and a wrap object replaced this way keeps its wrap options. The file still comes in as its page when only edges or type differ, when a difference lies outside every top-level object, when more than half of the top-level objects or more than 64 hold one, when such an object is or holds type or holds a wrap object inside a group, when the page's type of a text object that stays lies inside such an object's box, when the page's art can't replace such an object for one of the reasons above for an unread object, when matching the differences to the objects would take too much work, or when the result still differs from the page. `editingData: "always"` keeps the objects as read, and placed files at the other point their data gives are tried as well. An EPS whose page is its art's box keeps that page when it comes in through its layers, not the editing data's artboard, and a text object counts as drawn by the page by its colours, not only its lightness, so a red stroke stacked over a dark red one stays (#1102). `textAs: "outlines"` opens a `.ai` whose type shows from its PDF part, which has the outlines; `editingData: false` opens any of them as its page or PDF part only, for print pipelines (#735). A file whose import left something out (hidden text, art or layers) is never written over by an export or Save As to its own path unless `acknowledgeLoss: true` (`convert --replace-lossy`), so the original keeps what the document lacks. Where a `.ai` can't be read that way (or its layers are turned off in the import options), we read its PDF-compatible part, so Illustrator-only live objects arrive as appearance, and plain groups arrive ungrouped: that part draws each object on its own and marks only layers, clipping groups and groups with opacity, blending or a mask (those come back). Art outside the artboards isn't in that part at all (Illustrator's PDF part leaves it out), so it doesn't open; the import says so in a note (#472). Its pages still go where the editing data puts the artboards (a grid stays a grid), with the art on each, when it has as many artboards as pages, of the same sizes (#1068); the page of the artboard `CropAreaActive` names is then the active artboard. A `.ai` whose editing data has artboards but no layers also opens on that page under the same check, and its pages stay where they are. A `.ai` whose PDF part's pages are cropped to its art (each page the box of all the art, which is the editing data's bounding box) instead of its artboards opens from its layers, with its own artboards, where they draw as that page does. Its pages are laid out so that art one of them draws past its artboard (notes beside a design, which the part doesn't clip) doesn't lie over the page before it in the row, where it was taken for that page's art: the check against the editing data then found art its layers don't have there and opened the file as its PDF part, without the art outside the artboards. That part also has no paragraphs: area type is written line by line, and comes back as area type only where its font is installed and lays the lines out with the same breaks, else as a point type object per line (#508). Art off the page that a PDF does draw opens on the pasteboard. A run of type in the editing data whose baseline direction is 1 opens with Standard Vertical Roman Alignment (https://helpx.adobe.com/illustrator/using/formatting-asian-characters.html) on, which is VectorCraft's own mapping: its half-width characters stand upright in vertical type, and horizontal type keeps the mark with no change to its layout. A run whose baseline direction is 2 or 3 (Tate-chu-yoko), or that names none in the run, its character style or the document's defaults, opens with it off. The scripting reference lists 1, 2 and 3 as the Standard, vertical rotated and Tate-chu-yoko baseline directions (https://web.archive.org/web/20170621180804/https://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2015_3/Illustrator%20VBScript%20Reference.pdf, page 256). A Scatter brush in the editing data whose last 15 numbers start with 1 comes into the Brushes panel in Tints. Each brush art section is read without its frame: an unnamed, unpainted rectangle with no settings of its own at the art's bounds (within 1/1000 pt), closed, or open with its first corner again at the end. A wider frame stays in the art, and an art group with a state or look of its own (hidden, locked, isolated, knockout, an opacity, a blend mode, a name, a mask, a note or an appearance) stays a group. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 296bd84b2b..d8df59097d 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1670,7 +1670,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur In a `.ai` opened from its editing data, a path or type object with Offset Path, Outline Object or Outline Stroke on the whole object opens as itself with those effects live, in their order and shown or hidden; on a fill or stroke of type they stay on that fill or stroke. Offset Path keeps its Offset, Joins and Miter Limit, and Outline Stroke takes its width from the stroke. An Offset Path with a setting missing, out of range or not read keeps the drawn art, as does a path with a Path effect on one fill or stroke (`crates/eps/src/import/ai/style/tests.rs`, `crates/eps/src/import/ai/tests.rs`, `crates/eps/src/import/tests_native.rs`). In a `.ai` or EPS opened from its editing data, a Scatter brush whose last 15 numbers start with 1 comes into the Brushes panel in Tints, and each brush art section is read without its frame, an unnamed, unpainted rectangle with no settings of its own at the art's bounds (within 1/1000 pt). A wider frame stays in the art, and an art group with a state or look of its own (hidden, locked, isolated, knockout, an opacity, a blend mode, a name, a mask, a note or an appearance) stays a group (`crates/eps/src/import/ai/tests.rs`). In a `.ai` opened from its editing data, type with Warp on the object or on one of its fills or strokes opens as type with the effect live when the live warp draws as the art saved with it. When it draws differently, or when the file's limit of checks has no check left for it, it opens as that art, and one note says how many did. Type stays live without a comparison when the saved art paints nothing or draws type of its own, in frames of threaded type, when a text variable binds it, and when its text object doesn't come in as one text object (`crates/eps/src/import/ai/envelope.rs`, `crates/eps/src/import/tests_native.rs`). - In a `.ai` opened from its editing data, an object with a Tweak that moves nothing or Pucker & Bloat at 0 opens as itself with the effect live. A path, compound path or group whose only effect is Transform without copies, or a Free Distort whose corners make a parallelogram, opens as itself with it live, and so does an object with nothing stroked whose only effect is Twist: a path or compound path with straight segments at up to 180° either way, unless it is a compound path with a guide member that reaches past its other members and the angle is not 0°, and another path, compound path or group with no guide in it at up to 90° either way (limits VectorCraft sets); one twisted further keeps the drawn art. A gradient or pattern, an image, type, a clipping group, an opacity mask or effects inside the object, or a stroke with a Transform that scales, rotates or reflects, keep the drawn art (`crates/eps/src/import/ai/style/tests.rs`, `crates/eps/src/import/ai/tests.rs`, `crates/eps/src/import/ai/read/ops.rs`). + In a `.ai` opened from its editing data, an object with a Tweak that moves nothing or Pucker & Bloat at 0 opens as itself with the effect live. A path, compound path or group whose only effect is Transform without copies, or a Free Distort whose corners make a parallelogram, opens as itself with it live (not when a guide in it reaches past the rest of its art, hidden members included, and the Transform scales, rotates or reflects the object with Transform Objects on, or the object is a group and the Free Distort moves a corner), and so does an object with nothing stroked whose only effect is Twist: a path or compound path with straight segments at up to 180° either way, unless it is a compound path with a guide member that reaches past its other members and the angle is not 0°, and another path, compound path or group with no guide in it at up to 90° either way (limits VectorCraft sets); one twisted further keeps the drawn art. A gradient or pattern, an image, type, a clipping group, an opacity mask or effects inside the object, or a stroke with a Transform that scales, rotates or reflects, keep the drawn art (`crates/eps/src/import/ai/style/tests.rs`, `crates/eps/src/import/ai/tests.rs`, `crates/eps/src/import/ai/read/ops.rs`). A PDF page whose `UserUnit` (PDF 1.6) is above 1 opens at its size in points, its numbers times the `UserUnit` (one above 75,000 counts as 75,000), and `document.pdfInfo` gives its size and boxes in points too. A `.ai` whose editing data has its artboards in the units of such a page opens from that data at the page's size, with its layers, and when the layers can't be read its pages still take the artboard layout of the data, scaled the same way (part of #1482). `document.open`, `file.place` and `document.pdfInfo` reject a `cropTo`, `crop`, `password`, `colorMode` or `textAs` that is not a string, such as `"textAs": true`, and `document.pdfInfo` rejects a `thumbnailSize` that is not a number; the error names the param, and nothing opens or is placed. A param left out or given as null keeps its default (`crates/engine/src/cmd/fileio/tests_pdfimport.rs`). When the PDF content of a `.ai` has a page for each artboard, the layers are compared with every page on its artboard (until the pages compared take 8,388,608 pixels at the comparison's scale, about 67 letter-size pages, or number 128): art that only the layers or only a later page draws is handled as art that differs on the first page is, and a text object that a later page doesn't draw is left out unless its layer doesn't print (`crates/eps/src/import/tests_native.rs`). From f79111b2351a915e8c27897aa39988038d96777f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 21:12:58 -0800 Subject: [PATCH 009/226] i18n: drop the adjacent-placeholder rows main added back MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The German, Polish, Portuguese (Brazil), Ukrainian and Simplified Chinese catalogs on main carry rows for `unknown parameter `{within}{key}`; {why}` and `{name} must be {lo}–{hi}{unit} (got {v})`. The catalog cannot match a template with two placeholders in a row, so these rows were never used, and the merge of main brought them back. The `{range}` and `{key}`; {why_not}` rows already translate both messages in these catalogs. --- crates/ui-egui/src/i18n/de.tsv | 2 -- crates/ui-egui/src/i18n/pl.tsv | 2 -- crates/ui-egui/src/i18n/pt-br.tsv | 2 -- crates/ui-egui/src/i18n/uk.tsv | 2 -- crates/ui-egui/src/i18n/zh-hans.tsv | 2 -- 5 files changed, 10 deletions(-) diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 3bffc42db3..bd02a51625 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7457,7 +7457,6 @@ breakText Glyphs Glyphen @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 @@ -8873,7 +8872,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/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 8bff9fc164..b4213a3bcb 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7746,7 +7746,6 @@ breakText Glyphs Glify @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 @@ -9159,7 +9158,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 4caa5c474e..704da6dc86 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -9226,7 +9226,6 @@ swatch Yellow Green Verde-amarelado @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) @@ -9354,7 +9353,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/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index c26a7377a9..04be591ee2 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -8755,7 +8755,6 @@ breakText Glyphs Гліфи @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) @@ -8882,7 +8881,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/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 386e9dd44b..6186f27939 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7727,7 +7727,6 @@ breakText Glyphs 字形 @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 字符类没有结束 @@ -9145,7 +9144,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} From 729dc32b6fa68ea29a4de427e231d9e41ef52b1d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 21:38:29 -0800 Subject: [PATCH 010/226] Printing: the spooler's note follows the printer name as its own sentence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The status after a print job read "Sent “{title}” to {to} ({note})". With no note and a printer name that ends in parentheses, such as "HP LaserJet (Copy 1)", the catalog matched that row and took the parenthesized part of the name as the note, so a translation that puts the verb after the printer split the name. The note now follows as its own sentence: "Sent “{title}” to {to}. The spooler replied: {note}". The status without a note is unchanged. All 27 catalogs translate the new message, and a test checks that German keeps such a printer name whole. --- apps/vectorcraft/src/printing.rs | 19 ++++++++++++++++--- crates/ui-egui/src/i18n/bg.tsv | 2 +- crates/ui-egui/src/i18n/bs.tsv | 2 +- crates/ui-egui/src/i18n/ca.tsv | 2 +- crates/ui-egui/src/i18n/cs.tsv | 2 +- crates/ui-egui/src/i18n/da.tsv | 2 +- crates/ui-egui/src/i18n/de.tsv | 2 +- crates/ui-egui/src/i18n/el.tsv | 2 +- crates/ui-egui/src/i18n/es.tsv | 2 +- crates/ui-egui/src/i18n/fi.tsv | 2 +- crates/ui-egui/src/i18n/fr.tsv | 2 +- crates/ui-egui/src/i18n/hi.tsv | 2 +- crates/ui-egui/src/i18n/hu.tsv | 2 +- crates/ui-egui/src/i18n/id.tsv | 2 +- crates/ui-egui/src/i18n/it.tsv | 2 +- crates/ui-egui/src/i18n/ja.tsv | 2 +- crates/ui-egui/src/i18n/ka.tsv | 2 +- crates/ui-egui/src/i18n/ko.tsv | 2 +- crates/ui-egui/src/i18n/nl.tsv | 2 +- crates/ui-egui/src/i18n/pl.tsv | 2 +- crates/ui-egui/src/i18n/pt-br.tsv | 2 +- crates/ui-egui/src/i18n/ru.tsv | 2 +- crates/ui-egui/src/i18n/sv.tsv | 2 +- crates/ui-egui/src/i18n/tr.tsv | 2 +- crates/ui-egui/src/i18n/uk.tsv | 2 +- crates/ui-egui/src/i18n/vi.tsv | 2 +- crates/ui-egui/src/i18n/zh-hans.tsv | 2 +- crates/ui-egui/src/i18n/zh-hant.tsv | 2 +- 28 files changed, 43 insertions(+), 30 deletions(-) diff --git a/apps/vectorcraft/src/printing.rs b/apps/vectorcraft/src/printing.rs index 38edd784c3..db3518c26e 100644 --- a/apps/vectorcraft/src/printing.rs +++ b/apps/vectorcraft/src/printing.rs @@ -30,10 +30,11 @@ 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. +/// 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} ({note})") } + if note.is_empty() { format!("Sent “{title}” to {to}") } else { format!("Sent “{title}” to {to}. The spooler replied: {note}") } } mod system { @@ -141,7 +142,19 @@ mod turn_tests { 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 (job 12)"); + 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] diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index a47249b587..70d20887f3 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5241,7 +5241,7 @@ lighting Light Светлина @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} ({note}) “{title}” е изпратено към {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index c92a149857..ebb6a76d0b 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -5755,7 +5755,7 @@ mark-style Japanese Japanski @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} ({note}) “{title}” je poslano na {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 2a2c9bc8a6..7f125d5846 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -6388,7 +6388,7 @@ digits Malayalam Malaiàlam @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} ({note}) S’ha enviat “{title}” a {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 0b58b67f29..e49448aadf 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -6043,7 +6043,7 @@ mark-style Japanese Japonské @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} ({note}) “{title}” odesláno do {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index a762ae3c43..32e22fc8d5 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5403,7 +5403,7 @@ mark-style Japanese Japansk @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} ({note}) Sendte “{title}” til {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index c5a9bac1d9..81ef945f4f 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -5617,7 +5617,7 @@ lighting Light Licht @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} ({note}) “{title}” an {to} gesendet ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index d2772f70da..56d91e3c33 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5402,7 +5402,7 @@ digits Malayalam Μαλαγιάλαμ @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} ({note}) Το “{title}” στάλθηκε: {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index a613e36d43..869101432b 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -5985,7 +5985,7 @@ mark-style Japanese Japonesas @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} ({note}) Se envió “{title}” a {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index e74409ff69..bdfc3a30d3 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -5924,7 +5924,7 @@ mark-style Japanese Japanilainen @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} ({note}) “{title}” lähetettiin kohteeseen {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 703c8ade60..8c032d03c8 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -5611,7 +5611,7 @@ lighting Light Lumière @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} ({note}) “{title}” envoyé vers {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index d0857fa3ad..47bb0a7f56 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -8462,7 +8462,7 @@ antiAlias Sharp शार्प @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} ({note}) “{title}” को {to} पर भेजा गया ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 73179edb5b..1858d6fc93 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -6026,7 +6026,7 @@ imageTrace Outline Körvonal @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} ({note}) “{title}” elküldve ide: {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index bf5df5e6b5..a8e3e2e080 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5403,7 +5403,7 @@ mark-style Japanese Jepang @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} ({note}) “{title}” dikirim ke {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 3de841318d..80f67e6753 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -5659,7 +5659,7 @@ lighting Light Luce @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} ({note}) “{title}” inviato a: {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index edd6f40e46..cac6087494 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -5702,7 +5702,7 @@ lighting Light ライト @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} ({note}) “{title}” を {to} に送信しました ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index f49a3e0eaa..557f72772a 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5325,7 +5325,7 @@ font-technology Variable ცვლადი @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} ({note}) “{title}” გაგზავნილია: {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 4d6571e316..fa787d866c 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5620,7 +5620,7 @@ lighting Light 광원 @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} ({note}) “{title}”을(를) {to}(으)로 보냈습니다({note}) +@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} diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index f85b170ca7..fd9bdcd384 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5983,7 +5983,7 @@ mark-style Japanese Japans @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} ({note}) “{title}” verzonden naar {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 06d44c64c0..53e400b596 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -5883,7 +5883,7 @@ mark-style Japanese Japońskie @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} ({note}) Wysłano “{title}” do: {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index ee2282009f..4975caa437 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -4766,7 +4766,7 @@ axis Both Ambos @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} ({note}) “{title}” enviado para {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 1e08f949e6..0104c12022 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -5644,7 +5644,7 @@ lighting Light Свет @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} ({note}) “{title}” отправлено: {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 96ab390c29..5f598db305 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5509,7 +5509,7 @@ lighting Light Ljus @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} ({note}) Skickade “{title}” till {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index da75b9155d..64392d99ad 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5278,7 +5278,7 @@ lighting Light Işık @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} ({note}) “{title}” şuraya gönderildi: {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 0496539cdb..df9bb6209b 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -5639,7 +5639,7 @@ lighting Light Світло @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} ({note}) “{title}” відправлено: {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 2908bed413..cac291adf0 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5553,7 +5553,7 @@ theme Appearance Giao diện @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} ({note}) Đã gửi “{title}” đến {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 77587b4d74..39393d3b7d 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -5914,7 +5914,7 @@ lighting Light 光源 @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} ({note}) 已将 “{title}” 发送到 {to} ({note}) +@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} diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 0bedaddb53..8ad01551f0 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -5748,7 +5748,7 @@ lighting Light 光源 @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} ({note}) 已將 “{title}” 傳送至 {to} ({note}) +@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} From 2b5797c2b382fcd998138d5214c225089b2b80e3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 07:25:52 -0800 Subject: [PATCH 011/226] i18n: drop rows for the old adjacent-placeholder messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Main added cs, fr, ko and zh-hant rows for 'unknown parameter `{within}{key}`; {why}', its settings.{format} variant and '{name} must be {lo}–{hi}{unit} (got {v})'. The code no longer emits these forms, and their adjacent placeholders cannot be matched; the rows for the current messages are kept. --- crates/ui-egui/src/i18n/cs.tsv | 3 --- crates/ui-egui/src/i18n/fr.tsv | 3 --- crates/ui-egui/src/i18n/ko.tsv | 3 --- crates/ui-egui/src/i18n/zh-hant.tsv | 3 --- 4 files changed, 12 deletions(-) diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 8640895fa7..f0899cf32b 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -9166,8 +9166,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) @@ -9295,7 +9293,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/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 0f719cfacd..34d83edbd7 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -9143,8 +9143,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) @@ -9271,7 +9269,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/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 10d75c3dd1..cb5b5d55fc 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -8766,8 +8766,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) @@ -8896,7 +8894,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/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 909ab8dc8e..440ed9bb8b 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -7542,8 +7542,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 字元類別未結束 @@ -8961,7 +8959,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} From 3a3e03998bfc77fb99129e9e698af24940c1d007 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 07:25:59 -0800 Subject: [PATCH 012/226] i18n: drop connect end rows that main already has main now carries its own de, fr and it rows for the connect end message, so the duplicate rows this branch added are removed. --- crates/ui-egui/src/i18n/de.tsv | 1 - crates/ui-egui/src/i18n/fr.tsv | 1 - crates/ui-egui/src/i18n/it.tsv | 1 - 3 files changed, 3 deletions(-) diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 9af9bb3de8..8d8bbdcee9 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7088,7 +7088,6 @@ breakText Glyphs Glyphen @msg `fidelity` must be from 0.01 to 100 pt `fidelity` muss zwischen 0.01 und 100 pt liegen @msg style must be "pencil" or "brush" style muss "pencil" oder "brush" sein @msg extend end must be "start" or "end" Das Ende von extend muss "start" oder "end" sein -@msg connect end must be "start" or "end" Das Ende von connect muss "start" oder "end" sein @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` muss eine ganze Zahl von 1 bis {MAX_BRIDGES_PER_ISLAND} sein Weed Box and Lines… Entgitterrahmen und -linien… Weed Box and Lines Entgitterrahmen und -linien diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index a5965e711c..ffe5272552 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7487,7 +7487,6 @@ breakText Glyphs Glyphes @msg `fidelity` must be from 0.01 to 100 pt `fidelity` doit être compris entre 0.01 et 100 pt @msg style must be "pencil" or "brush" style doit être "pencil" ou "brush" @msg extend end must be "start" or "end" l’extrémité de extend doit être "start" ou "end" -@msg connect end must be "start" or "end" l’extrémité de connect doit être "start" ou "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` doit être un nombre entier compris entre 1 et {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Cadre et lignes d’échenillage… Weed Box and Lines Cadre et lignes d’échenillage diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 0910ab5bac..b0fb190cc3 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7122,7 +7122,6 @@ breakText Glyphs Glifi @msg `fidelity` must be from 0.01 to 100 pt `fidelity` deve essere compreso tra 0.01 e 100 pt @msg style must be "pencil" or "brush" style deve essere "pencil" o "brush" @msg extend end must be "start" or "end" l’estremità di extend deve essere "start" o "end" -@msg connect end must be "start" or "end" l’estremità di connect deve essere "start" o "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` deve essere un numero intero compreso tra 1 e {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Riquadro e linee di spellicolatura… Weed Box and Lines Riquadro e linee di spellicolatura From 80e361b39a1b4dcdee03be5ea353dcd63b5c52d5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 07:58:28 -0800 Subject: [PATCH 013/226] Tests: freehand refusal check accepts a catalog's own quotation marks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main's German row for the connect end refusal quotes the values as „start“ and „end“, so the test now looks for each accepted value inside any of the quotation mark pairs the catalogs use. --- crates/ui-egui/src/i18n/tests.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 150d26825f..600d0d57a9 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -2544,17 +2544,20 @@ fn freehand_choice_refusals_translate_with_their_values() { let b = s.execute("path.create", &json!({"d": "M10 50 L20 50"})).unwrap()["id"].clone(); let points = json!([[20, 10], [30, 30], [20, 50]]); let refusals = [ - (json!({"points": points, "style": "ink"}), ["style", "\"pencil\"", "\"brush\""]), - (json!({"points": points, "extend": {"id": a, "end": "middle"}}), ["extend", "\"start\"", "\"end\""]), - (json!({"points": points, "extend": {"id": a}, "connect": {"id": b, "end": "middle"}}), ["connect", "\"start\"", "\"end\""]), + (json!({"points": points, "style": "ink"}), "style", ["pencil", "brush"]), + (json!({"points": points, "extend": {"id": a, "end": "middle"}}), "extend", ["start", "end"]), + (json!({"points": points, "extend": {"id": a}, "connect": {"id": b, "end": "middle"}}), "connect", ["start", "end"]), ]; - for (p, words) in &refusals { + // A catalog may put the accepted values in its own quotation marks (German „start“). + let quotes = [("\"", "\""), ("„", "“"), ("“", "”"), ("«", "»"), ("« ", " »"), ("「", "」"), ("‘", "’")]; + for (p, key, values) in &refusals { let e = s.execute("path.freehand", p).unwrap_err().to_string(); assert!(e.starts_with("invalid parameters for `path.freehand`: ") && e.contains(" must be "), "{e}"); for code in COMPLETE_MESSAGES { let shown = message(Lang::from_code(code).expect("registered"), &e); - assert!(!shown.contains(" must be ") && shown.contains("`path.freehand`"), "{code}: {e} -> {shown}"); - assert!(words.iter().all(|w| shown.contains(w)), "{code}: {e} -> {shown}"); + assert!(!shown.contains(" must be ") && shown.contains("`path.freehand`") && shown.contains(key), "{code}: {e} -> {shown}"); + let quoted = |v: &str| quotes.iter().any(|(open, close)| shown.contains(&format!("{open}{v}{close}"))); + assert!(values.iter().all(|v| quoted(v)), "{code}: {e} -> {shown}"); } } } From 2ec0af8eb03fa73d147f89c52ae701f4ff588c4d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 10:19:14 -0800 Subject: [PATCH 014/226] i18n: keep the Hindi connect-end row and drop the stale finite-angle rows The freehand refusal test now checks only that each catalog shows the accepted values as written, in its own quotation marks, so the Hindi row keeps its translated parameter name. No command emits "angle and roundness must be finite" any more, so its row goes from every catalog. --- crates/ui-egui/src/i18n/cs.tsv | 1 - crates/ui-egui/src/i18n/de.tsv | 1 - crates/ui-egui/src/i18n/fr.tsv | 1 - crates/ui-egui/src/i18n/hi.tsv | 2 +- crates/ui-egui/src/i18n/it.tsv | 1 - crates/ui-egui/src/i18n/ko.tsv | 1 - crates/ui-egui/src/i18n/nl.tsv | 1 - crates/ui-egui/src/i18n/pl.tsv | 1 - crates/ui-egui/src/i18n/pt-br.tsv | 1 - crates/ui-egui/src/i18n/tests.rs | 15 ++++++++------- crates/ui-egui/src/i18n/uk.tsv | 1 - crates/ui-egui/src/i18n/zh-hans.tsv | 1 - crates/ui-egui/src/i18n/zh-hant.tsv | 1 - 13 files changed, 9 insertions(+), 19 deletions(-) diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 83e2a80d2d..e8af19c539 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -8132,7 +8132,6 @@ breakText Glyphs Glyfy @msg anchor `smooth` must be true or false `smooth` kotevního bodu musí být true nebo false @msg anchor `{key}` must be [x, y] `{key}` kotevního bodu musí být [x, y] @msg anchor `{key}` must be a number `{key}` kotevního bodu musí být číslo -@msg angle and roundness must be finite úhel a zaoblení musí být konečné @msg angles must be a list as long as pins (degrees or null) angles musí být seznam stejně dlouhý jako pins (stupně nebo null) @msg appearance must be flat|center|edge appearance musí být flat|center|edge @msg apply is "fill" or "stroke", not `{other}` apply je "fill" nebo "stroke", ne `{other}` diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 73063193ae..692543107f 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7832,7 +7832,6 @@ breakText Glyphs Glyphen @msg anchor `smooth` must be true or false Ankerpunkt-`smooth` muss true oder false sein @msg anchor `{key}` must be [x, y] Ankerpunkt-`{key}` muss [x, y] sein @msg anchor `{key}` must be a number Ankerpunkt-`{key}` muss eine Zahl sein -@msg angle and roundness must be finite angle und roundness müssen endlich sein @msg angles must be a list as long as pins (degrees or null) angles muss eine Liste so lang wie pins sein (Grad oder null) @msg appearance must be flat|center|edge appearance muss flat|center|edge sein @msg apply is "fill" or "stroke", not `{other}` apply ist „fill“ oder „stroke“, nicht `{other}` diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index fae74c7bfb..6a93251632 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7996,7 +7996,6 @@ breakText Glyphs Glyphes @msg anchor `smooth` must be true or false `smooth` d’un point d’ancrage doit valoir true ou false @msg anchor `{key}` must be [x, y] `{key}` d’un point d’ancrage doit être [x, y] @msg anchor `{key}` must be a number `{key}` d’un point d’ancrage doit être un nombre -@msg angle and roundness must be finite l’angle et l’arrondi doivent être finis @msg angles must be a list as long as pins (degrees or null) angles doit être une liste aussi longue que pins (degrés ou null) @msg appearance must be flat|center|edge appearance doit valoir flat|center|edge @msg apply is "fill" or "stroke", not `{other}` apply vaut "fill" ou "stroke", pas `{other}` diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index a2a55a82d6..8aa0216ebd 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -6575,7 +6575,7 @@ antiAlias Sharp शार्प @msg compound paths can only contain paths यौगिक पाथ में केवल पाथ हो सकते हैं @msg compound shapes take paths, compound paths, groups, compound shapes, type, blends and envelopes कंपाउंड शेप पाथ, कंपाउंड पाथ, समूह, कंपाउंड शेप, टाइप, ब्लेंड और एन्वेलप लेते हैं @msg compressed (RLE) bitmaps can't be read yet संकुचित (RLE) bitmaps अभी तक पढ़ा नहीं जा सकता है -@msg connect end must be "start" or "end" connect अंत "start" या "end" होना चाहिए +@msg connect end must be "start" or "end" कनेक्ट अंत "start" या "end" होना चाहिए @msg connect needs a path other than the one extended connect के लिए बढ़ाए गए पाथ के अलावा कोई दूसरा पाथ चाहिए @msg connect needs id connect के लिए id चाहिए @msg connect path has no open end कनेक्ट पाथ का कोई खुला अंत नहीं है diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 2ca1590448..47aeb50c6e 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7880,7 +7880,6 @@ breakText Glyphs Glifi @msg anchor `smooth` must be true or false `smooth` del punto di ancoraggio deve essere true o false @msg anchor `{key}` must be [x, y] `{key}` del punto di ancoraggio deve essere [x, y] @msg anchor `{key}` must be a number `{key}` del punto di ancoraggio deve essere un numero -@msg angle and roundness must be finite angle e roundness devono essere finiti @msg angles must be a list as long as pins (degrees or null) angles deve essere un elenco lungo quanto pins (gradi o null) @msg appearance must be flat|center|edge appearance deve essere flat|center|edge @msg apply is "fill" or "stroke", not `{other}` apply è "fill" o "stroke", non `{other}` diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 3f61a79a36..6fc8f867c5 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -7728,7 +7728,6 @@ breakText Glyphs 글리프 @msg anchor `smooth` must be true or false 앵커의 `smooth`은(는) true 또는 false여야 합니다 @msg anchor `{key}` must be [x, y] 앵커의 `{key}`은(는) [x, y]여야 합니다 @msg anchor `{key}` must be a number 앵커의 `{key}`은(는) 숫자여야 합니다 -@msg angle and roundness must be finite 각도와 원형률은 유한해야 합니다 @msg angles must be a list as long as pins (degrees or null) angles는 pins와 길이가 같은 목록이어야 합니다(도 또는 null) @msg appearance must be flat|center|edge appearance는 flat|center|edge여야 합니다 @msg apply is "fill" or "stroke", not `{other}` apply는 "fill" 또는 "stroke"입니다: `{other}` diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 7cd4268e4a..188a96c2be 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -6080,7 +6080,6 @@ imageTrace Outline Contour @msg anchor `smooth` must be true or false `smooth` van het anker moet true of false zijn @msg anchor `{key}` must be [x, y] `{key}` van het anker moet [x, y] zijn @msg anchor `{key}` must be a number `{key}` van het anker moet een getal zijn -@msg angle and roundness must be finite hoek en ronding moeten eindig zijn @msg angles must be a list as long as pins (degrees or null) angles moet een lijst zijn die even lang is als pins (graden of null) @msg appearance must be flat|center|edge appearance moet flat|center|edge zijn @msg apply is "fill" or "stroke", not `{other}` apply is "fill" of "stroke", niet `{other}` diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 74055fa27e..3e7e130257 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -8120,7 +8120,6 @@ breakText Glyphs Glify @msg anchor `smooth` must be true or false `smooth` punktu kontrolnego musi mieć wartość true lub false @msg anchor `{key}` must be [x, y] `{key}` punktu kontrolnego musi mieć postać [x, y] @msg anchor `{key}` must be a number `{key}` punktu kontrolnego musi być liczbą -@msg angle and roundness must be finite kąt i okrągłość muszą być skończone @msg angles must be a list as long as pins (degrees or null) angles musi być listą tej samej długości co pins (stopnie lub null) @msg appearance must be flat|center|edge appearance musi mieć wartość flat|center|edge @msg apply is "fill" or "stroke", not `{other}` apply ma wartość "fill" lub "stroke", a nie `{other}` diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index e7cba2800b..ca296ae025 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -8199,7 +8199,6 @@ swatch Yellow Green Verde-amarelado @msg anchor `smooth` must be true or false `smooth` do ponto de ancoragem deve ser true ou false @msg anchor `{key}` must be [x, y] `{key}` do ponto de ancoragem deve ser [x, y] @msg anchor `{key}` must be a number `{key}` do ponto de ancoragem deve ser um número -@msg angle and roundness must be finite angle e roundness devem ser finitos @msg angles must be a list as long as pins (degrees or null) angles deve ser uma lista do mesmo tamanho que pins (graus ou null) @msg appearance must be flat|center|edge appearance deve ser flat|center|edge @msg apply is "fill" or "stroke", not `{other}` apply é "fill" ou "stroke", não `{other}` diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 600d0d57a9..3657269a88 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -2534,7 +2534,7 @@ fn blob_brush_range_refusals_translate_with_their_values() { } /// `path.freehand`'s refusals of an unknown `style`, `extend` end or `connect` end show in every -/// complete-message language with the key and the accepted values as given. +/// complete-message language with the accepted values as given. #[test] fn freehand_choice_refusals_translate_with_their_values() { use serde_json::json; @@ -2544,18 +2544,19 @@ fn freehand_choice_refusals_translate_with_their_values() { let b = s.execute("path.create", &json!({"d": "M10 50 L20 50"})).unwrap()["id"].clone(); let points = json!([[20, 10], [30, 30], [20, 50]]); let refusals = [ - (json!({"points": points, "style": "ink"}), "style", ["pencil", "brush"]), - (json!({"points": points, "extend": {"id": a, "end": "middle"}}), "extend", ["start", "end"]), - (json!({"points": points, "extend": {"id": a}, "connect": {"id": b, "end": "middle"}}), "connect", ["start", "end"]), + (json!({"points": points, "style": "ink"}), ["pencil", "brush"]), + (json!({"points": points, "extend": {"id": a, "end": "middle"}}), ["start", "end"]), + (json!({"points": points, "extend": {"id": a}, "connect": {"id": b, "end": "middle"}}), ["start", "end"]), ]; - // A catalog may put the accepted values in its own quotation marks (German „start“). + // A catalog may translate the parameter's name (Hindi कनेक्ट) and put the accepted values in its + // own quotation marks (German „start“); the values themselves stay as written. let quotes = [("\"", "\""), ("„", "“"), ("“", "”"), ("«", "»"), ("« ", " »"), ("「", "」"), ("‘", "’")]; - for (p, key, values) in &refusals { + for (p, values) in &refusals { let e = s.execute("path.freehand", p).unwrap_err().to_string(); assert!(e.starts_with("invalid parameters for `path.freehand`: ") && e.contains(" must be "), "{e}"); for code in COMPLETE_MESSAGES { let shown = message(Lang::from_code(code).expect("registered"), &e); - assert!(!shown.contains(" must be ") && shown.contains("`path.freehand`") && shown.contains(key), "{code}: {e} -> {shown}"); + assert!(!shown.contains(" must be ") && shown.contains("`path.freehand`"), "{code}: {e} -> {shown}"); let quoted = |v: &str| quotes.iter().any(|(open, close)| shown.contains(&format!("{open}{v}{close}"))); assert!(values.iter().all(|v| quoted(v)), "{code}: {e} -> {shown}"); } diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 7b4aa8d611..144450a87f 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7618,7 +7618,6 @@ breakText Glyphs Гліфи @msg anchor `smooth` must be true or false `smooth` опорної точки має бути true або false @msg anchor `{key}` must be [x, y] `{key}` опорної точки має бути [x, y] @msg anchor `{key}` must be a number `{key}` опорної точки має бути числом -@msg angle and roundness must be finite angle і roundness мають бути скінченними @msg angles must be a list as long as pins (degrees or null) angles має бути списком такої самої довжини, як pins (градуси або null) @msg appearance must be flat|center|edge appearance має бути flat|center|edge @msg apply is "fill" or "stroke", not `{other}` apply — це "fill" або "stroke", а не `{other}` diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 035549f81e..894008ce8b 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -8106,7 +8106,6 @@ breakText Glyphs 字形 @msg anchor `smooth` must be true or false 锚点的 `smooth` 必须为 true 或 false @msg anchor `{key}` must be [x, y] 锚点的 `{key}` 必须是 [x, y] @msg anchor `{key}` must be a number 锚点的 `{key}` 必须是数字 -@msg angle and roundness must be finite angle 和 roundness 必须是有限值 @msg angles must be a list as long as pins (degrees or null) angles 必须是与 pins 等长的列表 (度数或 null) @msg appearance must be flat|center|edge appearance 必须是 flat|center|edge @msg apply is "fill" or "stroke", not `{other}` apply 为 "fill" 或 "stroke",不能是 `{other}` diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index dabcad1aca..09a6d8f72e 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -8031,7 +8031,6 @@ breakText Glyphs 字符 @msg anchor `smooth` must be true or false 錨點的 `smooth` 必須是 true 或 false @msg anchor `{key}` must be [x, y] 錨點的 `{key}` 必須是 [x, y] @msg anchor `{key}` must be a number 錨點的 `{key}` 必須是數字 -@msg angle and roundness must be finite angle 和 roundness 必須是有限值 @msg angles must be a list as long as pins (degrees or null) angles 必須是與 pins 等長的清單 (度數或 null) @msg appearance must be flat|center|edge appearance 必須是 flat|center|edge @msg apply is "fill" or "stroke", not `{other}` apply 是 "fill" 或 "stroke",而非 `{other}` From 0f342cd68968c3aaa4ffd8922b0af0d4c71144cc Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 10:46:38 -0800 Subject: [PATCH 015/226] i18n: drop the duplicate Japanese connect-end row and the stale finite-angle rows main now has a Japanese row for `connect end must be "start" or "end"`, so the branch's copy is removed and ja.tsv keeps main's row. Nothing emits `angle and roundness must be finite` any more, so the rows main added for it in hu.tsv and ja.tsv are removed. --- crates/ui-egui/src/i18n/hu.tsv | 1 - crates/ui-egui/src/i18n/ja.tsv | 2 -- 2 files changed, 3 deletions(-) diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index c223e86e5c..673d49b4ae 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -8001,7 +8001,6 @@ breakText Glyphs Glifák @msg anchor `smooth` must be true or false horgonypont, `smooth`: true vagy false kell @msg anchor `{key}` must be [x, y] horgonypont, `{key}`: [x, y] kell @msg anchor `{key}` must be a number horgonypont, `{key}`: szám kell -@msg angle and roundness must be finite angle és roundness: véges érték kell @msg angles must be a list as long as pins (degrees or null) angles: a pins listával azonos hosszúságú lista kell (fok vagy null) @msg appearance must be flat|center|edge appearance: flat|center|edge kell @msg apply is "fill" or "stroke", not `{other}` apply: "fill" vagy "stroke", ez nem az: `{other}` diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index fa38b6374a..176b536439 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -7086,7 +7086,6 @@ axis Y Axis Y 軸 @msg anchor `smooth` must be true or false アンカーの `smooth` には true または false を指定してください @msg anchor `{key}` must be [x, y] アンカーの `{key}` には [x, y] を指定してください @msg anchor `{key}` must be a number アンカーの `{key}` には数値を指定してください -@msg angle and roundness must be finite angle と roundness には有限の値を指定してください @msg angles must be a list as long as pins (degrees or null) angles には pins と同じ長さのリスト (度数または null) を指定してください @msg appearance must be flat|center|edge appearance には flat|center|edge のいずれかを指定してください @msg apply is "fill" or "stroke", not `{other}` apply には "fill" または "stroke" を指定してください (`{other}` は指定できません) @@ -9000,7 +8999,6 @@ breakText Glyphs 字形 @msg `fidelity` must be from 0.01 to 100 pt `fidelity` は 0.01~100 pt の範囲で指定してください @msg style must be "pencil" or "brush" style は "pencil" または "brush" を指定してください @msg extend end must be "start" or "end" extend の端は "start" または "end" を指定してください -@msg connect end must be "start" or "end" connect の端は "start" または "end" を指定してください @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` には 1 から {MAX_BRIDGES_PER_ISLAND} の整数を指定してください Weed Box and Lines… カス取り枠とライン… Weed Box and Lines カス取り枠とライン From 3f7157d268d94e6eb18021d3e16a0149c2dc1aa3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 12:50:01 -0800 Subject: [PATCH 016/226] i18n: drop the ja, hu and it rows the joined messages replaced MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The unknown-parameter and range messages now join their side-by-side values first, so the old rows for `{within}{key}`, `{within}settings.{format}` and `{lo}–{hi}{unit}` no longer match any message. The other catalogs dropped them already. --- crates/ui-egui/src/i18n/hu.tsv | 3 --- crates/ui-egui/src/i18n/it.tsv | 2 -- crates/ui-egui/src/i18n/ja.tsv | 3 --- 3 files changed, 8 deletions(-) diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 6aca7fb970..8f60a4b7c8 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -9165,8 +9165,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) @@ -9294,7 +9292,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/it.tsv b/crates/ui-egui/src/i18n/it.tsv index f376c86158..86117dac2b 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -9077,9 +9077,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 2b417fce5a..4b5856d343 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -6732,8 +6732,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 文字クラスが閉じられていません @@ -8150,7 +8148,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} From 963d38d040a1f67fe501bec474a262c8fa5dbbef Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 15:13:44 -0800 Subject: [PATCH 017/226] i18n: Danish rows for Blob Brush and freehand refusals --- crates/ui-egui/src/i18n/da.tsv | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index ca27bdd2f9..75943180a3 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -632,6 +632,12 @@ @msg No bridge of this width fits across the selected art Ingen bro med denne bredde passer hen over den markerede grafik @msg Some islands could not be joined to the area around the art Nogle øer kunne ikke forbindes med området omkring grafikken @msg `width` must be from {lo} to {hi} pt `width` skal være fra {lo} til {hi} pt +@msg `angle` must be from -180 to 180 degrees `angle` skal være fra -180 til 180 grader +@msg `roundness` must be from 0 to 100% `roundness` skal være fra 0 til 100 % +@msg `fidelity` must be from 0.01 to 100 pt `fidelity` skal være fra 0.01 til 100 pt +@msg style must be "pencil" or "brush" style skal være "pencil" eller "brush" +@msg extend end must be "start" or "end" enden for extend skal være "start" eller "end" +@msg connect end must be "start" or "end" enden for connect skal være "start" eller "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` skal være et heltal fra 1 til {MAX_BRIDGES_PER_ISLAND} File Filer From 74961dd25e94e5429d79e83f2f36c22d1256375c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 20:15:09 -0800 Subject: [PATCH 018/226] Export 3D Object: mapped graphics export as textures of their faces Graphics mapped onto a plane or onto Extrude & Bevel's front or back cap now export as a PNG texture of that face: the face's color with its graphics drawn over it, flat and unlit, on a mesh of the face's own triangles with texture coordinates. - glTF embeds the PNG (TEXCOORD_0, baseColorTexture, clamp sampler). - USDA reads it through primvars:st, UsdPrimvarReader_float2 and a UsdUVTexture connected to diffuseColor; USDZ stores the PNG after the layer on a 64-byte boundary. - OBJ writes vt coordinates and an MTL map_Kd. - OBJ and USDA write -texture-1.png and so on beside them. - assets.export3D takes textureSize (128 to 4096, default 1024); one export draws at most 67,108,864 texture pixels. - Faces with the same color, graphics and bounds share one texture, and output without graphics is unchanged. Graphics on Revolve's side are not exported yet. --- crates/effects/src/lib.rs | 4 +- crates/effects/src/revolve.rs | 4 +- crates/effects/src/solids.rs | 76 +++- crates/effects/src/solids/graphics.rs | 59 +++ crates/effects/src/solids/tests_graphics.rs | 51 +++ crates/effects/src/solids/tests_mesh.rs | 2 +- crates/engine/src/cmd/assets.rs | 29 +- crates/engine/src/cmd/fileio.rs | 6 +- crates/engine/src/cmd/fileio/mesh3d.rs | 361 ++++++++++++++++--- crates/engine/src/cmd/fileio/mesh3d/tests.rs | 117 +++++- crates/engine/src/tests/assets_3d.rs | 112 ++++++ crates/three-d/src/lib.rs | 4 +- crates/three-d/src/solid.rs | 2 +- crates/three-d/src/solid/face_map.rs | 83 +++++ crates/three-d/src/solid/tests_face_map.rs | 45 ++- crates/ui-egui/src/panels/asset_export.rs | 24 +- docs/effects-parity.md | 2 +- docs/gaps.md | 3 +- docs/mcp.md | 13 +- docs/target-app-parity.md | 1 + 20 files changed, 913 insertions(+), 85 deletions(-) diff --git a/crates/effects/src/lib.rs b/crates/effects/src/lib.rs index a326c85cf2..b32aebe4e2 100644 --- a/crates/effects/src/lib.rs +++ b/crates/effects/src/lib.rs @@ -91,9 +91,9 @@ pub use revolve::{ CLASSIC_REVOLVE, REVOLVE, has_revolve, is_revolve, revolve_art, revolve_art_in, revolve_options, validate_revolve, validate_revolve_in, }; pub use solids::{ - CLASSIC_EXTRUDE, CLASSIC_ROTATE, EXTRUDE, GRAPHICS, GraphicFrame, INFLATE, MAX_GRAPHICS, MappedGraphic, ROTATE, ROTATE_SURFACES, + CLASSIC_EXTRUDE, CLASSIC_ROTATE, EXTRUDE, GRAPHICS, GraphicFrame, INFLATE, MAX_GRAPHICS, MappedGraphic, MeshGraphics, ROTATE, ROTATE_SURFACES, ROTATION_PRESETS, SHADING_COLORS, SOLIDS, SolidMesh, THREE_D_TYPES, classic_extrude_options, classic_shading, extrude_options, graphic_bounds, - graphic_frame, graphic_symbols, has_solid, inflate_options, is_classic_three_d, is_three_d, mapped_graphics, missing_symbol, + graphic_frame, graphic_symbols, has_solid, inflate_options, is_classic_three_d, is_three_d, mapped_graphics, mesh_graphics_art, missing_symbol, names_graphic_symbol, rename_graphic_symbol, rename_graphic_symbol_in, solid_art, solid_art_in, takes_graphics, three_d_meshes, three_d_meshes_in, three_d_meshes_of, three_d_meshes_of_in, three_d_params_as, three_d_wireframe_in, validate_solid, validate_solid_in, validate_three_d, validate_three_d_at, validate_three_d_at_in, validate_three_d_in, validate_three_d_params, view_options, with_graphic, diff --git a/crates/effects/src/revolve.rs b/crates/effects/src/revolve.rs index a9c9482d1d..dc990c1fe7 100644 --- a/crates/effects/src/revolve.rs +++ b/crates/effects/src/revolve.rs @@ -694,7 +694,7 @@ pub(crate) fn revolve_meshes(n: &Node, total: &mut usize, limit: usize) -> Resul let b = path.bounds().ok_or("Revolve requires a shape with at least two anchors")?; let (paint, opacity, _) = paint_of(item); let mesh = vectorcraft_three_d::revolve_mesh(path, rule, b, fx_options(fx))?; - Ok(crate::SolidMesh { mesh, color: crate::solids::mesh_color(&paint, opacity) }) + Ok(crate::SolidMesh::plain(mesh, crate::solids::mesh_color(&paint, opacity))) }; if let Some(index) = n.appearance.effects.iter().position(|e| e.visible && is_revolve(&e.id)) { let before = n.appearance.effects.get(..index).unwrap_or_default(); @@ -799,7 +799,7 @@ fn group_meshes(n: &Node, total: &mut usize, limit: usize) -> Result, +} + +impl SolidMesh { + /// A mesh painted `color`, with no graphics. + pub fn plain(mesh: Mesh, color: [f32; 4]) -> Self { + Self { mesh, color, graphics: None } + } +} + +/// The parts of `mesh`, a solid that 3D effect `id` with parameters `p` built about `bounds`, painted +/// `color`: for each planar face that carries graphics (Extrude & Bevel's caps, the plane), the +/// triangles on it as a mesh of their own with the art point of each corner ([`MeshGraphics`]), +/// then the rest. Revolve's side, whose graphics are not mapped onto its mesh, stays plain. +fn split_graphics(id: &str, p: &Value, bounds: Rect, mesh: Mesh, color: [f32; 4]) -> Vec { + let list = graphics::mapped_graphics(p); + if list.is_empty() || !takes_graphics(id) || id == crate::REVOLVE { + return vec![SolidMesh::plain(mesh, color)]; + } + let view = view_options(p); + let mut rest = mesh; + let mut out = vec![]; + for face in PlanarFace::ALL { + if !list.iter().any(|g| g.face == face) { + continue; + } + let on_mesh = if id == ROTATE { + vectorcraft_three_d::plane_mesh_face(bounds, view) + } else { + vectorcraft_three_d::extrude_mesh_face(bounds, extrude_options(p), view, face) + }; + let Some(on_mesh) = on_mesh else { continue }; + let (mut taken, mut left, mut art) = (Mesh::default(), Mesh::default(), vec![]); + for t in &rest.triangles { + let corner = |i: u32| rest.positions.get(i as usize).copied().zip(rest.normals.get(i as usize).copied()); + let Some(corners) = t.iter().map(|&i| corner(i)).collect::>>() else { continue }; + let points: Option> = corners.iter().map(|(m, n)| on_mesh.art_point(*m, *n)).collect(); + let into = match points { + Some(points) => { + art.extend(points); + &mut taken + } + None => &mut left, + }; + let base = into.positions.len() as u32; + for (m, n) in corners { + into.positions.push(m); + into.normals.push(n); + } + into.triangles.push([base, base + 1, base + 2]); + } + rest = left; + if !taken.is_empty() { + let graphics = list.iter().filter(|g| g.face == face).cloned().collect(); + out.push(SolidMesh { mesh: taken, color, graphics: Some(MeshGraphics { face, graphics, center: bounds.center(), art }) }); + } + } + if !rest.is_empty() { + out.insert(0, SolidMesh::plain(rest, color)); + } + out } /// The color a mesh of `paint` at `opacity` takes ([`SolidMesh::color`]). @@ -2305,13 +2368,16 @@ fn meshes_for(fx: &Effect, shapes: &[Profile], total: &mut usize, limit: usize) let p = crate::merged_params(&fx.id, &fx.params); let view = view_options(&p); let mut out = vec![]; - let mut keep = |out: &mut Vec, mesh: Mesh, color: [f32; 4]| keep_mesh(out, total, SolidMesh { mesh, color }, limit); + // A solid's parts with and without graphics count together against the limit. + let mut keep = |out: &mut Vec, mesh: Mesh, color: [f32; 4], bounds: Rect| { + split_graphics(&fx.id, &p, bounds, mesh, color).into_iter().try_for_each(|part| keep_mesh(out, total, part, limit)) + }; if is_plane(&fx.id) { for s in shapes { for item in &s.items { let (paint, opacity, _) = paint_of(item, s.opacity); let (area, rule) = region(&s.path, s.rule, item); - keep(&mut out, vectorcraft_three_d::plane_mesh(&area, rule, b, view)?, mesh_color(&paint, opacity))?; + keep(&mut out, vectorcraft_three_d::plane_mesh(&area, rule, b, view)?, mesh_color(&paint, opacity), b)?; } } return Ok(out); @@ -2348,7 +2414,7 @@ fn meshes_for(fx: &Effect, shapes: &[Profile], total: &mut usize, limit: usize) match solid.mesh() { Ok(mesh) => { let (paint, opacity, _) = paint_of(item, *member); - keep(&mut out, mesh, mesh_color(&paint, opacity))?; + keep(&mut out, mesh, mesh_color(&paint, opacity), bounds)?; } Err(_) if matches!(item, AppearanceItem::Stroke(_)) => {} Err(e) => return Err(e), diff --git a/crates/effects/src/solids/graphics.rs b/crates/effects/src/solids/graphics.rs index 7c0087e15b..7dc9aa5e44 100644 --- a/crates/effects/src/solids/graphics.rs +++ b/crates/effects/src/solids/graphics.rs @@ -519,6 +519,65 @@ pub(super) fn face_art( Some(Node::new(id, NodeKind::Group { children: vec![Arc::new(clip), Arc::new(Node::group(id, children))], clip: true })) } +/// The graphics on one planar face of a solid's mesh ([`super::SolidMesh`]): those mapped onto +/// `face`, placed about `center` (the center of the bounds the solids were built with), and the +/// point of the art's plane that each corner of the mesh shows (document coordinates of the art +/// before its 3D effect, y down). +#[derive(Clone, Debug, PartialEq)] +pub struct MeshGraphics { + pub face: PlanarFace, + pub graphics: Vec, + pub center: Point, + /// One for each position of the mesh. + pub art: Vec, +} + +impl MeshGraphics { + /// The bounds of the art points of the mesh's corners; `None` without corners. + pub fn art_bounds(&self) -> Option { + let first = *self.art.first()?; + Some(self.art.iter().fold(Rect::from_points(first, first), |r, p| r.union_pt(*p))) + } +} + +/// The art `graphics` draws on its face, flat in the art's plane, unshaded and unclipped: each +/// graphic's fills and stroke outlines at its place ([`MappedGraphic`]), back to front, as one +/// group of objects with id `id`. A graphic whose symbol `doc` does not have, or whose art is past +/// the limits of [`pieces_of`], is left out, as the canvas leaves it out. `Ok(None)` when nothing +/// is drawn; an error when the graphics' art draws more than [`MAX_ELEMENTS`] path elements +/// together. +pub fn mesh_graphics_art(doc: &Document, id: NodeId, graphics: &MeshGraphics) -> Result, String> { + let mut children = vec![]; + let mut elements = 0usize; + for g in graphics.graphics.iter().filter(|g| g.face == graphics.face) { + let Some(symbol) = doc.symbols.iter().find(|s| s.name == g.symbol) else { continue }; + let Ok(pieces) = pieces_of(doc, symbol) else { continue }; + let Some(bounds) = pieces.iter().filter_map(|p| p.path.bounds()).reduce(|a, b| a.union(b)) else { continue }; + let place = g.placement(bounds, graphics.center); + for piece in pieces { + elements = elements.saturating_add(drawn_elements(&piece.path, 1)); + if elements > MAX_ELEMENTS { + return Err("The graphics are too complex: simplify the symbols' art".into()); + } + let mut paint = piece.paint; + if let Paint::Pattern { xf, .. } = &mut paint { + *xf = place * *xf; + } + let mut fill = FillLayer::new(paint); + fill.opacity = piece.opacity; + fill.blend = piece.blend; + let mut appearance = Appearance { items: vec![AppearanceItem::Fill(fill)], ..Default::default() }; + appearance.transform_gradients(place); + let mut node = Node::path(id, piece.path.transformed(place), appearance); + if let NodeKind::Path { rule, .. } = &mut node.kind { + *rule = piece.rule; + } + children.push(Arc::new(node)); + } + } + Ok((!children.is_empty()).then(|| Node::group(id, children))) +} + /// One area of a graphic placed on Revolve's unrolled side surface, cut into straight pieces. struct Unrolled { polygons: Vec>, diff --git a/crates/effects/src/solids/tests_graphics.rs b/crates/effects/src/solids/tests_graphics.rs index f0da6b992b..fe89dd1f84 100644 --- a/crates/effects/src/solids/tests_graphics.rs +++ b/crates/effects/src/solids/tests_graphics.rs @@ -86,6 +86,48 @@ fn a_graphic_is_drawn_on_the_front_cap_at_its_offset_size_and_turn() { assert!((b.width() - 10.0 * 2f64.sqrt()).abs() < 1e-6); } +#[test] +fn a_mesh_carries_its_caps_graphics_flat_in_the_arts_plane() { + let d = document(); + let graphics = + json!([{"symbol": "Mark", "x": 20.0, "y": -10.0, "scale": 200.0}, {"symbol": "Mark", "face": "back", "x": 20.0, "y": -10.0, "scale": 200.0}]); + // Turned, so the caps' corners in the mesh are not the art's. + let n = object(EXTRUDE, json!({"rotationX": -20.0, "rotationY": 35.0, "rotationZ": 10.0, "graphics": graphics})); + let parts = super::super::three_d_meshes_in(Some(&d), &n).unwrap(); + // The walls first, then the front cap and the back cap, each two triangles. + assert_eq!( + parts.iter().map(|p| p.graphics.as_ref().map(|g| g.face)).collect::>(), + [None, Some(PlanarFace::Front), Some(PlanarFace::Back)] + ); + let total: usize = parts.iter().map(|p| p.mesh.triangles.len()).sum(); + let plain = super::super::three_d_meshes_in(Some(&d), &object(EXTRUDE, json!({"rotationX": -20.0, "rotationY": 35.0, "rotationZ": 10.0}))); + assert_eq!(total, plain.as_ref().map_or(0, |p| p.iter().map(|p| p.mesh.triangles.len()).sum()), "no triangle is lost or doubled"); + assert!(plain.unwrap().iter().all(|p| p.graphics.is_none())); + // The art points of each cap's corners are the art's own square; the graphic is drawn flat at + // its place, mirrored on the back so it reads from behind. + for (part, drawn) in parts[1..].iter().zip([Rect::new(60.0, 30.0, 80.0, 50.0), Rect::new(20.0, 30.0, 40.0, 50.0)]) { + let Some(g) = &part.graphics else { panic!("no graphics") }; + assert_eq!(g.art.len(), part.mesh.positions.len()); + assert!(close(g.art_bounds().unwrap(), Rect::new(0.0, 0.0, 100.0, 100.0)), "{:?}", g.art_bounds()); + assert_eq!(g.graphics.len(), 1); + let art = mesh_graphics_art(&d, NodeId(9), g).unwrap().unwrap(); + let paths: Vec<(PathData, Paint)> = art + .children() + .into_iter() + .flatten() + .filter_map(|c| Some((c.path_data()?.clone(), c.appearance.items.first()?.paint().clone()))) + .collect(); + assert!(close(bounds_of(&paths), drawn), "{:?}: {:?}", g.face, bounds_of(&paths)); + assert_eq!(paths[0].1, Paint::solid(red()), "unshaded"); + } + // A plane is all one face; a graphic whose symbol is gone draws nothing. + let n = object(ROTATE, json!({"rotationY": 35.0, "graphics": [{"symbol": "Gone"}]})); + let parts = super::super::three_d_meshes_in(Some(&d), &n).unwrap(); + assert_eq!(parts.len(), 1); + let Some(g) = &parts[0].graphics else { panic!("no graphics") }; + assert_eq!(mesh_graphics_art(&d, NodeId(9), g), Ok(None)); +} + #[test] fn without_the_document_or_its_symbol_nothing_is_drawn() { let n = object(EXTRUDE, json!({"graphics": [{"symbol": "Mark"}]})); @@ -563,6 +605,15 @@ fn art_nested_too_deep_is_refused_and_not_drawn() { // A loaded file draws its other graphics. let both = object(EXTRUDE, json!({"graphics": [{"symbol": "Deep"}, {"symbol": "Mark"}]})); assert_eq!(graphics_in(&solid_art_in(Some(&d), &both).unwrap()).len(), 1); + // A mesh's graphics leave it out as well and draw the others. + let parts = super::super::three_d_meshes_in(Some(&d), &both).unwrap(); + let Some(g) = parts.iter().find_map(|p| p.graphics.as_ref()) else { panic!("no graphics") }; + let art = mesh_graphics_art(&d, NodeId(9), g).unwrap().unwrap(); + assert_eq!(art.children().map_or(0, |c| c.len()), 1); + let deep = object(EXTRUDE, json!({"graphics": [{"symbol": "Deep"}]})); + let parts = super::super::three_d_meshes_in(Some(&d), &deep).unwrap(); + let Some(g) = parts.iter().find_map(|p| p.graphics.as_ref()) else { panic!("no graphics") }; + assert_eq!(mesh_graphics_art(&d, NodeId(9), g), Ok(None)); } #[test] diff --git a/crates/effects/src/solids/tests_mesh.rs b/crates/effects/src/solids/tests_mesh.rs index a9de7cd7f9..b7ecb75384 100644 --- a/crates/effects/src/solids/tests_mesh.rs +++ b/crates/effects/src/solids/tests_mesh.rs @@ -238,7 +238,7 @@ fn meshes_built_apart(fx: &Effect, shapes: &[Profile], total: &mut usize, limit: match mesh { Ok(mesh) => { let (paint, opacity, _) = paint_of(item, *opacity); - keep_mesh(&mut out, total, SolidMesh { mesh, color: mesh_color(&paint, opacity) }, limit)?; + keep_mesh(&mut out, total, SolidMesh::plain(mesh, mesh_color(&paint, opacity)), limit)?; } Err(_) if matches!(item, AppearanceItem::Stroke(_)) => {} Err(e) => return Err(e), diff --git a/crates/engine/src/cmd/assets.rs b/crates/engine/src/cmd/assets.rs index cb990e4857..205dee7973 100644 --- a/crates/engine/src/cmd/assets.rs +++ b/crates/engine/src/cmd/assets.rs @@ -10,8 +10,8 @@ use vectorcraft_doc::{ExportAsset, NodeId}; use super::edit::{roots_of, selected_roots}; use super::fileio::{ - DEFAULT_FORMAT_3D, FORMATS_3D, SCREEN_SETTINGS_KEYS, check_screen_settings, create_dir, export_crop, export_screens, mesh_file_names, mesh_files, - safe_file_name, store_screen_settings, with_screen_export_preset, write_file, + DEFAULT_FORMAT_3D, FORMATS_3D, SCREEN_SETTINGS_KEYS, TEXTURE_SIZE, TEXTURE_SIZES, check_screen_settings, create_dir, export_crop, export_screens, + image_count, mesh_file_names, mesh_files, safe_file_name, store_screen_settings, textures, with_screen_export_preset, write_file, }; use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, checked_ids_param, cmd, has_doc, ok, str_param, switch_or, text_param}; @@ -80,7 +80,7 @@ pub fn specs() -> Vec { "Export 3D Assets", [], None, - "{assets?: [asset id…] (default every 3D asset), folder?, zip?} each 3D asset's object as a mesh file in its format (assets.set3DFormat), named after the asset: USDA or USDZ, glTF 2.0 (one .gltf, its buffer embedded) or OBJ with its .mtl (whitespace and # in an OBJ's name become _). Every solid of the object (the fill's, each stroke's, a group's members') is a mesh with a material in the color it is painted; faces turned away from the viewer are included, at the object's 3D rotation, y up, about the point it turns about, in points (glTF: meters). Files that would share a name get -2, -3…; an object with a hole that crosses its face's outline or another hole, or with more than 2,000,000 triangles, is refused → {files: [path…]} (no folder: {files: [{name, dataBase64}]}, or with zip one zip as {name, dataBase64, files})", + "{assets?: [asset id…] (default every 3D asset), folder?, zip?, textureSize?: 128…4096 (default 1024: the pixels along the longer side of each face's texture)} each 3D asset's object as a mesh file in its format (assets.set3DFormat), named after the asset: USDA or USDZ, glTF 2.0 (one .gltf, its buffer embedded) or OBJ with its .mtl (whitespace and # in an OBJ's name become _). Every solid of the object (the fill's, each stroke's, a group's members') is a mesh with a material in the color it is painted; faces turned away from the viewer are included, at the object's 3D rotation, y up, about the point it turns about, in points (glTF: meters). The graphics mapped onto a plane or onto Extrude & Bevel's front or back cap (threeD.mapGraphic) are a PNG texture of that face: its color with the graphics drawn over it, flat and unlit, on a mesh of the face's own with texture coordinates; glTF embeds it, USDZ stores it after the layer, and OBJ and USDA write it beside them as -texture-1.png… (whitespace, # and @ become _). Graphics on Revolve's side are not exported. Files that would share a name get -2, -3…; an object with a hole that crosses its face's outline or another hole, or with more than 2,000,000 triangles, or textures of more than 67,108,864 pixels in one export, is refused → {files: [path…]} (no folder: {files: [{name, dataBase64}]}, or with zip one zip as {name, dataBase64, files})", has_doc, export_3d ), @@ -273,6 +273,8 @@ fn export_3d(s: &mut Session, p: &Value) -> Result { } let folder = text_param(p, "folder", C)?.filter(|f| !f.is_empty()); let zip = switch_or(p, "zip", false, C)?; + let size = texture_size_param(p, C)?; + let mut pixels = 0u64; // Every file's name, compared without case: a later file that would take one gets -2, -3… let mut taken: HashSet = HashSet::new(); let mut files: Vec<(String, Vec)> = vec![]; @@ -285,18 +287,20 @@ fn export_3d(s: &mut Session, p: &Value) -> Result { let what = &a.name; let parts = vectorcraft_render::effects::three_d_meshes_of_in(Some(d), nodes).map_err(|e| bad(C, format!("{what} can't be exported in 3D: {e}")))?; + let pictures = textures(d, &parts, size, &mut pixels).map_err(|e| bad(C, format!("{what} can't be exported in 3D: {e}")))?; + let images = image_count(&pictures); let base = Some(safe_file_name(&a.name)).filter(|b| !b.is_empty()).unwrap_or_else(|| "Asset".into()); let mut stem = base.clone(); let mut k = 1; loop { - let names = mesh_file_names(&stem, format).map_err(|e| bad(C, e))?; + let names = mesh_file_names(&stem, format, images).map_err(|e| bad(C, e))?; if names.iter().all(|n| !taken.contains(&n.to_lowercase())) { break; } k += 1; stem = format!("{base}-{k}"); } - let made = mesh_files(&stem, format, &parts).map_err(|e| bad(C, e))?; + let made = mesh_files(&stem, format, &parts, &pictures).map_err(|e| bad(C, e))?; taken.extend(made.iter().map(|(n, _)| n.to_lowercase())); files.extend(made); } @@ -334,6 +338,21 @@ fn export_3d(s: &mut Session, p: &Value) -> Result { } } +/// Param `textureSize` of command `cmd`: the pixels along the longer side of each face's texture, +/// [`TEXTURE_SIZE`] when it is not given. +fn texture_size_param(p: &Value, cmd: &str) -> Result { + let key = "textureSize"; + let (lo, hi) = TEXTURE_SIZES; + match p.get(key) { + None | Some(Value::Null) => Ok(TEXTURE_SIZE), + Some(v) => v + .as_u64() + .and_then(|n| u32::try_from(n).ok()) + .filter(|n| (lo..=hi).contains(n)) + .ok_or_else(|| bad(cmd, format!("`{key}` must be a whole number of pixels from {lo} to {hi}"))), + } +} + /// The asset ids of param `key`. fn asset_ids(p: &Value, key: &str, cmd: &str) -> Result> { let ids = p.get(key).and_then(Value::as_array).ok_or_else(|| bad(cmd, format!("`{key}` must be an array of asset ids (see assets.list)")))?; diff --git a/crates/engine/src/cmd/fileio.rs b/crates/engine/src/cmd/fileio.rs index 6d972beda8..eb5ef7b896 100644 --- a/crates/engine/src/cmd/fileio.rs +++ b/crates/engine/src/cmd/fileio.rs @@ -86,8 +86,10 @@ pub use load::{ }; pub(crate) use load::{check_files_not_lossy_overwrite, check_not_lossy_overwrite, lossy_source}; pub use load::{losses_summary, overwrite_losses}; -pub use mesh3d::{DEFAULT_FORMAT_3D, FORMATS_3D, format_3d_label}; -pub(crate) use mesh3d::{mesh_file_names, mesh_files}; +#[cfg(test)] +pub(crate) use mesh3d::MAX_TEXTURE_PIXELS; +pub use mesh3d::{DEFAULT_FORMAT_3D, FORMATS_3D, draws_textures, format_3d_label}; +pub(crate) use mesh3d::{TEXTURE_SIZE, TEXTURE_SIZES, image_count, mesh_file_names, mesh_files, textures}; pub use naming::{NameParts as FileNameParts, parse_date as parse_file_date, render as render_file_name}; pub(crate) use native::preview_png; pub use native::with_compression_pref; diff --git a/crates/engine/src/cmd/fileio/mesh3d.rs b/crates/engine/src/cmd/fileio/mesh3d.rs index 50a919d834..bc37a531b7 100644 --- a/crates/engine/src/cmd/fileio/mesh3d.rs +++ b/crates/engine/src/cmd/fileio/mesh3d.rs @@ -9,13 +9,24 @@ //! as their specifications ask; MTL colors are the display colors. Materials are two-sided, since //! an open solid or a turned plane is seen from both sides. //! +//! The graphics mapped onto a face of a solid ([`textures`]) are a PNG picture of that face: its +//! color with the graphics drawn over it, flat and unshaded, which the face's own mesh shows through +//! texture coordinates and a material of its own. glTF embeds each PNG as a data URI, USDZ stores it +//! after the layer, and OBJ and USDA name PNG files written beside them (`-texture-1.png`…). +//! //! Formats: glTF 2.0 , USD -//! (USDZ: ). +//! (USDZ: ; +//! textures: ), OBJ and MTL +//! . use std::fmt::Write as _; +use std::sync::Arc; use serde_json::{Value, json}; -use vectorcraft_render::effects::SolidMesh; +use vectorcraft_doc::color::{Color, Paint}; +use vectorcraft_doc::{Appearance, Document, Node, NodeId}; +use vectorcraft_geom::{Affine, Rect}; +use vectorcraft_render::effects::{MeshGraphics, SolidMesh}; /// The formats a 3D asset exports to, as `assets.set3DFormat` names them: USDA first, the default. pub const FORMATS_3D: [&str; 4] = ["usda", "usdz", "gltf", "obj"]; @@ -23,6 +34,12 @@ pub const FORMATS_3D: [&str; 4] = ["usda", "usdz", "gltf", "obj"]; pub const DEFAULT_FORMAT_3D: &str = "usda"; /// The meters in a point (1/72 inch). const METERS_PER_POINT: f64 = 0.0254 / 72.0; +/// The pixels along the longer side of a face's texture, unless `assets.export3D` is given another +/// size, and the sizes it takes. +pub(crate) const TEXTURE_SIZE: u32 = 1024; +pub(crate) const TEXTURE_SIZES: (u32, u32) = (128, 4096); +/// The most texture pixels one export draws, all its assets together. +pub(crate) const MAX_TEXTURE_PIXELS: u64 = 4 * 4096 * 4096; /// The label of `format` for menus: `USDA`, `USDZ`, `glTF`, `OBJ`. pub fn format_3d_label(format: &str) -> &'static str { @@ -40,14 +57,27 @@ fn obj_stem(stem: &str) -> String { stem.chars().map(|c| if c.is_whitespace() || c == '#' { '_' } else { c }).collect() } -/// The names of the files [`mesh_files`] writes for `stem` in `format`. -pub(crate) fn mesh_file_names(stem: &str, format: &str) -> Result, String> { +/// The name of texture `k` (from 0) of the object named `stem`: whitespace, `#` and `@` become `_`, +/// so an MTL `map_Kd` line and a USD asset path name it as one word. +fn texture_name(stem: &str, k: usize) -> String { + let stem: String = stem.chars().map(|c| if c.is_whitespace() || c == '#' || c == '@' { '_' } else { c }).collect(); + format!("{stem}-texture-{}.png", k + 1) +} + +/// The names of the files [`mesh_files`] writes for `stem` in `format` with `images` textures: OBJ +/// and USDA name a PNG file for each texture after them; glTF and USDZ hold theirs. +pub(crate) fn mesh_file_names(stem: &str, format: &str, images: usize) -> Result, String> { + let beside = |mut names: Vec, stem: &str| { + names.extend((0..images).map(|k| texture_name(stem, k))); + names + }; match format { "obj" => { let stem = obj_stem(stem); - Ok(vec![format!("{stem}.obj"), format!("{stem}.mtl")]) + Ok(beside(vec![format!("{stem}.obj"), format!("{stem}.mtl")], &stem)) } - "gltf" | "usda" | "usdz" => Ok(vec![format!("{stem}.{format}")]), + "usda" => Ok(beside(vec![format!("{stem}.usda")], stem)), + "gltf" | "usdz" => Ok(vec![format!("{stem}.{format}")]), _ => { let key = "format"; Err(format!("`{key}` must be one of {}", FORMATS_3D.join(", "))) @@ -55,35 +85,100 @@ pub(crate) fn mesh_file_names(stem: &str, format: &str) -> Result, S } } +/// A picture painted on one part of a 3D object ([`SolidMesh`]): a PNG, and for each corner of the +/// part's mesh where it falls on the picture (0 to 1 across from the left, 0 to 1 down from the +/// top). +#[derive(Clone, Debug, PartialEq)] +pub(crate) struct Texture { + pub png: Arc>, + pub uv: Vec<[f64; 2]>, +} + +/// The distinct pictures of `textures` in order of first use, and the index among them of each +/// part's (`None` for a part without one). +fn images(parts: usize, textures: &[Option]) -> (Vec>>, Vec>) { + let mut out: Vec>> = vec![]; + let index = (0..parts) + .map(|k| { + let t = textures.get(k)?.as_ref()?; + Some(out.iter().position(|p| Arc::ptr_eq(p, &t.png) || p == &t.png).unwrap_or_else(|| { + out.push(t.png.clone()); + out.len() - 1 + })) + }) + .collect(); + (out, index) +} + +/// The number of distinct pictures of `textures` ([`mesh_file_names`]). +pub(crate) fn image_count(textures: &[Option]) -> usize { + images(textures.len(), textures).0.len() +} + /// The files of a 3D object named `stem` in `format` ([`FORMATS_3D`]): `(file name, bytes)`, the -/// OBJ with its MTL after it. -pub(crate) fn mesh_files(stem: &str, format: &str, parts: &[SolidMesh]) -> Result)>, String> { - let names = mesh_file_names(stem, format)?; - let bytes = match format { +/// OBJ with its MTL after it and the PNG files of `textures` last. `textures` holds the picture of +/// each part that has one, in the order of `parts`. +pub(crate) fn mesh_files(stem: &str, format: &str, parts: &[SolidMesh], textures: &[Option]) -> Result)>, String> { + let (pictures, image) = images(parts.len(), textures); + let names = mesh_file_names(stem, format, pictures.len())?; + let scene = Scene { parts, textures, image: &image, pictures: &pictures }; + let pngs = || pictures.iter().map(|p| p.as_ref().clone()); + let bytes: Vec> = match format { "obj" => { - let (obj, mtl) = obj(&obj_stem(stem), parts); - vec![obj.into_bytes(), mtl.into_bytes()] + let stem = obj_stem(stem); + let (obj, mtl) = obj(&stem, &scene); + [obj.into_bytes(), mtl.into_bytes()].into_iter().chain(pngs()).collect() + } + "gltf" => vec![gltf(stem, &scene).into_bytes()], + "usda" => std::iter::once(usda(stem, &scene).into_bytes()).chain(pngs()).collect(), + _ => { + let mut members = vec![(format!("{stem}.usda"), usda(stem, &scene).into_bytes())]; + members.extend(pngs().enumerate().map(|(k, png)| (texture_name(stem, k), png))); + vec![super::zip::store_aligned(&members, 64)?] } - "gltf" => vec![gltf(stem, parts).into_bytes()], - "usda" => vec![usda(stem, parts).into_bytes()], - _ => vec![super::zip::store_aligned(&[(format!("{stem}.usda"), usda(stem, parts).into_bytes())], 64)?], }; Ok(names.into_iter().zip(bytes).collect()) } -/// The distinct colors of `parts` in order, and each part's index among them. -fn materials(parts: &[SolidMesh]) -> (Vec<[f32; 4]>, Vec) { - let mut colors: Vec<[f32; 4]> = vec![]; - let index = parts +/// The parts of an object with their pictures: `image` is each part's index among `pictures`. +struct Scene<'a> { + parts: &'a [SolidMesh], + textures: &'a [Option], + image: &'a [Option], + pictures: &'a [Arc>], +} + +impl Scene<'_> { + /// Part `k`'s texture coordinates and picture, when it has a picture. + fn texture(&self, k: usize) -> Option<(&[[f64; 2]], usize)> { + let t = self.textures.get(k)?.as_ref()?; + Some((t.uv.as_slice(), (*self.image.get(k)?)?)) + } +} + +/// A material: a color, with a picture that replaces its red, green and blue. +#[derive(Clone, Copy, PartialEq)] +struct Material { + color: [f32; 4], + image: Option, +} + +/// The distinct materials of `scene`'s parts in order, and each part's index among them. +fn materials(scene: &Scene) -> (Vec, Vec) { + let mut out: Vec = vec![]; + let index = scene + .parts .iter() - .map(|p| { - colors.iter().position(|c| *c == p.color).unwrap_or_else(|| { - colors.push(p.color); - colors.len() - 1 + .enumerate() + .map(|(k, p)| { + let m = Material { color: p.color, image: scene.texture(k).map(|(_, i)| i) }; + out.iter().position(|c| *c == m).unwrap_or_else(|| { + out.push(m); + out.len() - 1 }) }) .collect(); - (colors, index) + (out, index) } /// An sRGB channel (0..1) as linear light. @@ -96,8 +191,9 @@ fn num(v: f64) -> String { format!("{v}") } -fn obj(stem: &str, parts: &[SolidMesh]) -> (String, String) { - let (colors, material) = materials(parts); +fn obj(stem: &str, scene: &Scene) -> (String, String) { + let parts = scene.parts; + let (materials, material) = materials(scene); let mut o = String::new(); let _ = writeln!(o, "mtllib {stem}.mtl"); let _ = writeln!(o, "o {stem}"); @@ -106,33 +202,60 @@ fn obj(stem: &str, parts: &[SolidMesh]) -> (String, String) { let _ = writeln!(o, "v {} {} {}", num(v[0]), num(v[1]), num(v[2])); } } + // OBJ's texture coordinates run up from the picture's bottom. + for k in 0..parts.len() { + for uv in scene.texture(k).map(|(uv, _)| uv).unwrap_or_default() { + let _ = writeln!(o, "vt {} {}", num(uv[0]), num(1.0 - uv[1])); + } + } for p in parts { for n in &p.mesh.normals { let _ = writeln!(o, "vn {} {} {}", num(n[0]), num(n[1]), num(n[2])); } } - let mut base = 1usize; + let (mut base, mut uv_base) = (1usize, 1usize); for (k, p) in parts.iter().enumerate() { let _ = writeln!(o, "g Solid_{}", k + 1); let _ = writeln!(o, "usemtl Material_{}", material.get(k).copied().unwrap_or(0) + 1); + let textured = scene.texture(k).filter(|(uv, _)| uv.len() == p.mesh.positions.len()).is_some(); for t in &p.mesh.triangles { - let [a, b, c] = t.map(|i| i as usize + base); - let _ = writeln!(o, "f {a}//{a} {b}//{b} {c}//{c}"); + if textured { + let [a, b, c] = t.map(|i| i as usize); + let corner = |i: usize| format!("{}/{}/{}", i + base, i + uv_base, i + base); + let _ = writeln!(o, "f {} {} {}", corner(a), corner(b), corner(c)); + } else { + let [a, b, c] = t.map(|i| i as usize + base); + let _ = writeln!(o, "f {a}//{a} {b}//{b} {c}//{c}"); + } } base += p.mesh.positions.len(); + uv_base += scene.texture(k).map_or(0, |(uv, _)| uv.len()); } let mut m = String::new(); - for (k, c) in colors.iter().enumerate() { + for (k, mat) in materials.iter().enumerate() { + let c = mat.color; let _ = writeln!(m, "newmtl Material_{}", k + 1); - let _ = writeln!(m, "Kd {} {} {}", num(f64::from(c[0])), num(f64::from(c[1])), num(f64::from(c[2]))); + match mat.image { + // The picture holds the color; Kd multiplies it. + Some(_) => { + let _ = writeln!(m, "Kd 1 1 1"); + } + None => { + let _ = writeln!(m, "Kd {} {} {}", num(f64::from(c[0])), num(f64::from(c[1])), num(f64::from(c[2]))); + } + } let _ = writeln!(m, "d {}", num(f64::from(c[3]))); let _ = writeln!(m, "illum 1"); + if let Some(i) = mat.image { + let _ = writeln!(m, "map_Kd -clamp on {}", texture_name(stem, i)); + } } (o, m) } -fn gltf(stem: &str, parts: &[SolidMesh]) -> String { - let (colors, material) = materials(parts); +fn gltf(stem: &str, scene: &Scene) -> String { + let parts = scene.parts; + let (materials, material) = materials(scene); let mut buffer: Vec = vec![]; let (mut views, mut accessors, mut primitives) = (vec![], vec![], vec![]); let mut view = |buffer: &mut Vec, bytes: Vec, target: u32| -> usize { @@ -154,16 +277,25 @@ fn gltf(stem: &str, parts: &[SolidMesh]) -> String { })); accessors.push(json!({ "bufferView": normals, "componentType": 5126, "count": count, "type": "VEC3" })); accessors.push(json!({ "bufferView": indices, "componentType": 5125, "count": p.mesh.triangles.len() * 3, "type": "SCALAR" })); - primitives.push(json!({ + let mut primitive = json!({ "attributes": { "POSITION": at, "NORMAL": at + 1 }, "indices": at + 2, "material": material.get(k).copied().unwrap_or(0), - })); + }); + // glTF's texture coordinates run down from the picture's top, as the picture's own do. + if let Some((uv, _)) = scene.texture(k).filter(|(uv, _)| uv.len() == count) { + let bytes = uv.iter().flatten().flat_map(|x| (*x as f32).to_le_bytes()).collect(); + let coords = view(&mut buffer, bytes, 34962); + primitive["attributes"]["TEXCOORD_0"] = json!(accessors.len()); + accessors.push(json!({ "bufferView": coords, "componentType": 5126, "count": count, "type": "VEC2" })); + } + primitives.push(primitive); } - let materials: Vec = colors + let materials: Vec = materials .iter() .enumerate() - .map(|(k, c)| { + .map(|(k, mat)| { + let c = mat.color; let mut m = json!({ "name": format!("Material_{}", k + 1), "pbrMetallicRoughness": { @@ -173,13 +305,18 @@ fn gltf(stem: &str, parts: &[SolidMesh]) -> String { }, "doubleSided": true, }); + if let Some(i) = mat.image { + // The picture holds the color; the factor multiplies it. + m["pbrMetallicRoughness"]["baseColorFactor"] = json!([1.0, 1.0, 1.0, c[3]]); + m["pbrMetallicRoughness"]["baseColorTexture"] = json!({ "index": i }); + } if c[3] < 1.0 { m["alphaMode"] = json!("BLEND"); } m }) .collect(); - let doc = json!({ + let mut doc = json!({ "asset": { "version": "2.0", "generator": "VectorCraft" }, "scene": 0, "scenes": [{ "nodes": [0] }], @@ -193,6 +330,14 @@ fn gltf(stem: &str, parts: &[SolidMesh]) -> String { "bufferViews": views, "accessors": accessors, }); + if !scene.pictures.is_empty() { + // Linear filtering, mipmaps, and coordinates held at the picture's edge. + doc["samplers"] = json!([{ "magFilter": 9729, "minFilter": 9987, "wrapS": 33071, "wrapT": 33071 }]); + doc["textures"] = Value::Array((0..scene.pictures.len()).map(|i| json!({ "sampler": 0, "source": i })).collect()); + doc["images"] = Value::Array( + scene.pictures.iter().map(|p| json!({ "uri": format!("data:image/png;base64,{}", vectorcraft_format::base64_encode(p)) })).collect(), + ); + } serde_json::to_string_pretty(&doc).unwrap_or_default() } @@ -205,8 +350,9 @@ fn prim_name(name: &str) -> String { out } -fn usda(stem: &str, parts: &[SolidMesh]) -> String { - let (colors, material) = materials(parts); +fn usda(stem: &str, scene: &Scene) -> String { + let parts = scene.parts; + let (materials, material) = materials(scene); let root = prim_name(stem); let triple = |v: [f64; 3]| format!("({}, {}, {})", num(v[0]), num(v[1]), num(v[2])); let list = |items: Vec| items.join(", "); @@ -238,23 +384,148 @@ fn usda(stem: &str, parts: &[SolidMesh]) -> String { linear(c[2]) ); let _ = writeln!(u, " float[] primvars:displayOpacity = [{}] (\n interpolation = \"constant\"\n )", c[3]); + // USD's texture coordinates run up from the picture's bottom. + if let Some((uv, _)) = scene.texture(k).filter(|(uv, _)| uv.len() == p.mesh.positions.len()) { + let st = list(uv.iter().map(|t| format!("({}, {})", num(t[0]), num(1.0 - t[1]))).collect()); + let _ = writeln!(u, " texCoord2f[] primvars:st = [{st}] (\n interpolation = \"vertex\"\n )"); + } let _ = writeln!(u, " uniform token subdivisionScheme = \"none\"\n }}\n"); } let _ = writeln!(u, " def Scope \"Materials\"\n {{"); - for (k, c) in colors.iter().enumerate() { - let m = k + 1; + for (k, mat) in materials.iter().enumerate() { + let (m, c) = (k + 1, mat.color); + let at = format!("/{root}/Materials/Material_{m}"); let _ = writeln!(u, " def Material \"Material_{m}\"\n {{"); - let _ = writeln!(u, " token outputs:surface.connect = \n"); + let _ = writeln!(u, " token outputs:surface.connect = <{at}/Surface.outputs:surface>\n"); let _ = writeln!(u, " def Shader \"Surface\"\n {{"); let _ = writeln!(u, " uniform token info:id = \"UsdPreviewSurface\""); - let _ = writeln!(u, " color3f inputs:diffuseColor = ({}, {}, {})", linear(c[0]), linear(c[1]), linear(c[2])); + match mat.image { + Some(_) => { + let _ = writeln!(u, " color3f inputs:diffuseColor.connect = <{at}/Texture.outputs:rgb>"); + } + None => { + let _ = writeln!(u, " color3f inputs:diffuseColor = ({}, {}, {})", linear(c[0]), linear(c[1]), linear(c[2])); + } + } let _ = writeln!(u, " float inputs:opacity = {}", c[3]); let _ = writeln!(u, " float inputs:roughness = 1"); - let _ = writeln!(u, " token outputs:surface\n }}\n }}"); + let _ = writeln!(u, " token outputs:surface\n }}"); + if let Some(i) = mat.image { + let _ = writeln!(u, "\n def Shader \"Texture\"\n {{"); + let _ = writeln!(u, " uniform token info:id = \"UsdUVTexture\""); + let _ = writeln!(u, " asset inputs:file = @{}@", texture_name(stem, i)); + let _ = writeln!(u, " float2 inputs:st.connect = <{at}/Coordinates.outputs:result>"); + let _ = writeln!(u, " token inputs:sourceColorSpace = \"sRGB\""); + let _ = writeln!(u, " token inputs:wrapS = \"clamp\""); + let _ = writeln!(u, " token inputs:wrapT = \"clamp\""); + let _ = writeln!(u, " float3 outputs:rgb\n }}"); + let _ = writeln!(u, "\n def Shader \"Coordinates\"\n {{"); + let _ = writeln!(u, " uniform token info:id = \"UsdPrimvarReader_float2\""); + let _ = writeln!(u, " string inputs:varname = \"st\""); + let _ = writeln!(u, " float2 outputs:result\n }}"); + } + let _ = writeln!(u, " }}"); } let _ = writeln!(u, " }}\n}}"); u } +/// The pictures of the graphics on `parts` ([`SolidMesh::graphics`]), one for each part in order +/// (`None` for a part without graphics, or whose graphics draw nothing): the part's color with its +/// graphics drawn over it, flat and unshaded ([`vectorcraft_render::effects::mesh_graphics_art`]), +/// over the bounds of the art points of its corners, `size` pixels along the longer side. Parts with +/// the same color, face, graphics and bounds share one picture. `pixels` counts the pixels drawn so +/// far, and every call of one export shares it: an error when it passes [`MAX_TEXTURE_PIXELS`]. +pub(crate) fn textures(doc: &Document, parts: &[SolidMesh], size: u32, pixels: &mut u64) -> Result>, String> { + let mut renderer: Option = None; + // Each picture drawn: the part it was drawn for, its bounds, and the PNG (`None`: nothing drawn). + let mut drawn: Vec = vec![]; + let mut out = vec![]; + for part in parts { + let Some(g) = &part.graphics else { + out.push(None); + continue; + }; + let Some(frame) = texture_frame(g) else { + out.push(None); + continue; + }; + let scale = f64::from(size) / frame.width().max(frame.height()); + let fit = |side: f64| ((side * scale).ceil() as u32).clamp(1, size); + let (w, h) = (fit(frame.width()), fit(frame.height())); + let same = |(p, r, _): &&Drawn| p.color == part.color && *r == frame && p.graphics.as_ref().is_some_and(|o| same_graphics(o, g)); + let png = match drawn.iter().find(same) { + Some((_, _, png)) => png.clone(), + None => { + let png = match vectorcraft_render::effects::mesh_graphics_art(doc, NodeId(0), g)? { + None => None, + Some(art) => { + *pixels = pixels.saturating_add(u64::from(w) * u64::from(h)); + if *pixels > MAX_TEXTURE_PIXELS { + return Err(format!( + "the graphics need more than {MAX_TEXTURE_PIXELS} pixels of textures: lower textureSize (now {size})" + )); + } + let renderer = renderer.get_or_insert_with(vectorcraft_render::Renderer::new); + Some(Arc::new(picture(doc, renderer, part.color, art, (frame, scale), (w, h))?)) + } + }; + drawn.push((part, frame, png.clone())); + png + } + }; + out.push(png.map(|png| { + let uv = g.art.iter().map(|p| [(p.x - frame.x0) * scale / f64::from(w), (p.y - frame.y0) * scale / f64::from(h)]).collect(); + Texture { png, uv } + })); + } + Ok(out) +} + +/// Does [`textures`] draw a picture for one of `parts`: a part with graphics whose corners span an +/// area and whose graphics draw something? Nothing is rendered. +pub fn draws_textures(doc: &Document, parts: &[SolidMesh]) -> bool { + parts.iter().any(|p| { + p.graphics + .as_ref() + .is_some_and(|g| texture_frame(g).is_some() && matches!(vectorcraft_render::effects::mesh_graphics_art(doc, NodeId(0), g), Ok(Some(_)))) + }) +} + +/// The part of the art's plane a picture of `g` covers: the bounds of its corners' art points, when +/// they span an area. +fn texture_frame(g: &MeshGraphics) -> Option { + g.art_bounds().filter(|r| r.width() > 1e-9 && r.height() > 1e-9 && r.width().is_finite() && r.height().is_finite()) +} + +/// A picture [`textures`] drew: the part, the bounds and the PNG. +type Drawn<'a> = (&'a SolidMesh, Rect, Option>>); + +/// Do `a` and `b` draw the same graphics on their face? +fn same_graphics(a: &MeshGraphics, b: &MeshGraphics) -> bool { + a.face == b.face && a.center == b.center && a.graphics == b.graphics +} + +/// `art` drawn over `color` (opaque) as a PNG of `w` × `h` pixels whose top left is `frame`'s top +/// left, at `scale` pixels a point. +fn picture( + doc: &Document, + renderer: &mut vectorcraft_render::Renderer, + color: [f32; 4], + art: Node, + (frame, scale): (Rect, f64), + (w, h): (u32, u32), +) -> Result, String> { + // The color reaches two pixels past the frame, so the picture's edge pixels are covered. + let reach = 2.0 / scale; + let back = Rect::new(frame.x0 - reach, frame.y0 - reach, frame.x0 + f64::from(w) / scale + reach, frame.y0 + f64::from(h) / scale + reach); + let fill = Paint::solid(Color::rgb(color[0], color[1], color[2])); + let ground = Node::path(NodeId(0), vectorcraft_geom::shapes::rectangle(back), Appearance::basic(fill, Paint::None, 0.0)); + let group = Arc::new(Node::group(NodeId(0), vec![Arc::new(ground), Arc::new(art)])); + let (pw, ph) = (u16::try_from(w).map_err(|_| "texture too large")?, u16::try_from(h).map_err(|_| "texture too large")?); + let view = Affine::scale(scale) * Affine::translate((-frame.x0, -frame.y0)); + renderer.render_node(doc, &group, pw, ph, view).ok_or_else(|| "the graphics could not be drawn".to_string())?.to_png() +} + #[cfg(test)] mod tests; diff --git a/crates/engine/src/cmd/fileio/mesh3d/tests.rs b/crates/engine/src/cmd/fileio/mesh3d/tests.rs index 7c467fafad..6313b16762 100644 --- a/crates/engine/src/cmd/fileio/mesh3d/tests.rs +++ b/crates/engine/src/cmd/fileio/mesh3d/tests.rs @@ -7,7 +7,7 @@ use super::*; fn square(color: [f32; 4]) -> SolidMesh { let [a, b, c, d] = [[-5.0, -5.0, 0.0], [5.0, -5.0, 0.0], [5.0, 5.0, 0.0], [-5.0, 5.0, 0.0]]; let mesh = Mesh { positions: vec![a, b, c, a, c, d], normals: vec![[0.0, 0.0, 1.0]; 6], triangles: vec![[0, 1, 2], [3, 4, 5]] }; - SolidMesh { mesh, color } + SolidMesh::plain(mesh, color) } const RED: [f32; 4] = [1.0, 0.0, 0.0, 1.0]; @@ -18,9 +18,14 @@ fn text(files: &[(String, Vec)], name: &str) -> String { String::from_utf8(bytes.clone()).unwrap() } +/// [`mesh_files`] without textures. +fn plain_files(stem: &str, format: &str, parts: &[SolidMesh]) -> Result)>, String> { + mesh_files(stem, format, parts, &[]) +} + #[test] fn obj_numbers_corners_across_solids_and_names_its_materials() { - let files = mesh_files("Box", "obj", &[square(RED), square(BLUE), square(RED)]).unwrap(); + let files = plain_files("Box", "obj", &[square(RED), square(BLUE), square(RED)]).unwrap(); assert_eq!(files.iter().map(|(n, _)| n.as_str()).collect::>(), ["Box.obj", "Box.mtl"]); let obj = text(&files, "Box.obj"); assert!(obj.starts_with("mtllib Box.mtl\no Box\n")); @@ -36,7 +41,7 @@ fn obj_numbers_corners_across_solids_and_names_its_materials() { #[test] fn gltf_holds_its_buffer_and_every_accessor_fits_it() { - let files = mesh_files("Box", "gltf", &[square(RED), square(BLUE)]).unwrap(); + let files = plain_files("Box", "gltf", &[square(RED), square(BLUE)]).unwrap(); let g: Value = serde_json::from_str(&text(&files, "Box.gltf")).unwrap(); assert_eq!(g["asset"]["version"], "2.0"); let uri = g["buffers"][0]["uri"].as_str().unwrap(); @@ -59,11 +64,13 @@ fn gltf_holds_its_buffer_and_every_accessor_fits_it() { assert_eq!(g["materials"][1]["alphaMode"], "BLEND"); assert!(g["materials"][0].get("alphaMode").is_none()); assert_eq!(g["materials"][0]["doubleSided"], true); + // Without graphics there are no textures. + assert!(g.get("images").is_none() && g.get("textures").is_none() && prims[0]["attributes"].get("TEXCOORD_0").is_none()); } #[test] fn usda_is_y_up_in_points_with_a_material_for_each_color() { - let files = mesh_files("My Box", "usda", &[square(RED), square([0.5, 0.5, 0.5, 1.0])]).unwrap(); + let files = plain_files("My Box", "usda", &[square(RED), square([0.5, 0.5, 0.5, 1.0])]).unwrap(); let u = text(&files, "My Box.usda"); assert!(u.starts_with("#usda 1.0\n")); assert!(u.contains("defaultPrim = \"My_Box\"") && u.contains("upAxis = \"Y\"") && u.contains("def Xform \"My_Box\""), "{u}"); @@ -75,11 +82,12 @@ fn usda_is_y_up_in_points_with_a_material_for_each_color() { // sRGB 0.5 is about 0.214 linear. assert!(u.contains("color3f inputs:diffuseColor = (0.21404"), "{u}"); assert_eq!(u.matches('{').count(), u.matches('}').count()); + assert!(!u.contains("primvars:st") && !u.contains("UsdUVTexture")); } #[test] fn usdz_stores_the_layer_uncompressed_on_a_64_byte_boundary() { - let files = mesh_files("Box", "usdz", &[square(RED)]).unwrap(); + let files = plain_files("Box", "usdz", &[square(RED)]).unwrap(); let (name, zip) = &files[0]; assert_eq!(name, "Box.usdz"); // The local header: 30 bytes, the name, then the extra field. @@ -88,7 +96,7 @@ fn usdz_stores_the_layer_uncompressed_on_a_64_byte_boundary() { assert_eq!(u16_at(8), 0, "stored, not deflated"); let start = 30 + u16_at(26) + u16_at(28); assert_eq!(start % 64, 0); - let layer = mesh_files("Box", "usda", &[square(RED)]).unwrap().remove(0).1; + let layer = plain_files("Box", "usda", &[square(RED)]).unwrap().remove(0).1; assert_eq!(&zip[start..start + layer.len()], layer.as_slice()); let archive = super::super::zip::Archive::open(zip, 8).unwrap(); assert_eq!(archive.read("Box.usda", usize::MAX).unwrap(), Some(layer)); @@ -96,11 +104,11 @@ fn usdz_stores_the_layer_uncompressed_on_a_64_byte_boundary() { #[test] fn an_obj_names_its_mtl_file_without_spaces_or_comment_marks() { - let files = mesh_files("Box #1", "obj", &[square(RED)]).unwrap(); + let files = plain_files("Box #1", "obj", &[square(RED)]).unwrap(); assert_eq!(files.iter().map(|(n, _)| n.as_str()).collect::>(), ["Box__1.obj", "Box__1.mtl"]); assert!(text(&files, "Box__1.obj").starts_with("mtllib Box__1.mtl\n")); - assert_eq!(mesh_file_names("Box #1", "obj").unwrap(), ["Box__1.obj", "Box__1.mtl"]); - assert_eq!(mesh_file_names("Box #1", "usda").unwrap(), ["Box #1.usda"]); + assert_eq!(mesh_file_names("Box #1", "obj", 0).unwrap(), ["Box__1.obj", "Box__1.mtl"]); + assert_eq!(mesh_file_names("Box #1", "usda", 0).unwrap(), ["Box #1.usda"]); } #[test] @@ -108,17 +116,17 @@ fn obj_and_usda_keep_coordinates_a_32_bit_float_would_merge() { let mut part = square(RED); part.mesh.positions[0] = [20_000_000.0, 0.0, 0.0]; part.mesh.positions[1] = [20_000_001.0, 0.0, 0.0]; - let obj = text(&mesh_files("Box", "obj", std::slice::from_ref(&part)).unwrap(), "Box.obj"); + let obj = text(&plain_files("Box", "obj", std::slice::from_ref(&part)).unwrap(), "Box.obj"); assert!(obj.contains("v 20000000 0 0\nv 20000001 0 0\n"), "{obj}"); - let usda = text(&mesh_files("Box", "usda", &[part]).unwrap(), "Box.usda"); + let usda = text(&plain_files("Box", "usda", &[part]).unwrap(), "Box.usda"); assert!(usda.contains("(20000001, 0, 0)")); } #[test] fn an_unknown_format_is_refused() { - assert!(mesh_files("Box", "fbx", &[square(RED)]).is_err()); - assert!(mesh_file_names("Box", "").is_err()); - assert_eq!(mesh_file_names("Box", "obj").unwrap(), ["Box.obj", "Box.mtl"]); + assert!(plain_files("Box", "fbx", &[square(RED)]).is_err()); + assert!(mesh_file_names("Box", "", 0).is_err()); + assert_eq!(mesh_file_names("Box", "obj", 0).unwrap(), ["Box.obj", "Box.mtl"]); } #[test] @@ -128,3 +136,84 @@ fn prim_names_are_usd_identifiers() { assert_eq!(prim_name(""), "_"); assert_eq!(prim_name("é/x"), "__x"); } + +/// A red square, then a blue one whose corners show picture `png` (u to the right, v down). +fn textured(png: &[u8]) -> (Vec, Vec>) { + let uv = vec![[0.0, 1.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0], [1.0, 0.0], [0.0, 0.0]]; + let texture = Texture { png: Arc::new(png.to_vec()), uv }; + (vec![square(RED), square(BLUE)], vec![None, Some(texture)]) +} + +#[test] +fn each_format_carries_a_textured_part_with_its_coordinates_and_picture() { + let png = b"\x89PNG picture".to_vec(); + let (parts, pictures) = textured(&png); + // OBJ: vt runs up from the picture's bottom, the textured faces name it, and map_Kd the PNG + // written beside it, with its name in one word. + let files = mesh_files("My Box", "obj", &parts, &pictures).unwrap(); + assert_eq!(files.iter().map(|(n, _)| n.as_str()).collect::>(), ["My_Box.obj", "My_Box.mtl", "My_Box-texture-1.png"]); + assert_eq!(files[2].1, png); + let obj = text(&files, "My_Box.obj"); + assert_eq!(obj.lines().filter(|l| l.starts_with("vt ")).collect::>(), ["vt 0 0", "vt 1 0", "vt 1 1", "vt 0 0", "vt 1 1", "vt 0 1"]); + assert_eq!(obj.lines().rfind(|l| l.starts_with("f ")), Some("f 10/4/10 11/5/11 12/6/12")); + assert!(obj.contains("f 1//1 2//2 3//3"), "the plain part keeps no texture coordinates"); + let mtl = text(&files, "My_Box.mtl"); + assert!(mtl.contains("newmtl Material_2\nKd 1 1 1\nd 0.5\nillum 1\nmap_Kd -clamp on My_Box-texture-1.png\n"), "{mtl}"); + assert_eq!(mtl.matches("map_Kd").count(), 1); + // glTF: TEXCOORD_0 down from the top, and the picture embedded as a data URI. + let g: Value = serde_json::from_str(&text(&mesh_files("Box", "gltf", &parts, &pictures).unwrap(), "Box.gltf")).unwrap(); + let prims = g["meshes"][0]["primitives"].as_array().unwrap(); + assert!(prims[0]["attributes"].get("TEXCOORD_0").is_none()); + let uv = &g["accessors"][prims[1]["attributes"]["TEXCOORD_0"].as_u64().unwrap() as usize]; + assert_eq!((uv["type"].as_str(), uv["count"].as_u64(), uv["componentType"].as_u64()), (Some("VEC2"), Some(6), Some(5126))); + let view = &g["bufferViews"][uv["bufferView"].as_u64().unwrap() as usize]; + let data = vectorcraft_format::base64_decode(g["buffers"][0]["uri"].as_str().unwrap().split(',').nth(1).unwrap()).unwrap(); + let at = view["byteOffset"].as_u64().unwrap() as usize; + let first: Vec = (0..2).map(|k| f32::from_le_bytes(data[at + 4 * k..at + 4 * k + 4].try_into().unwrap())).collect(); + assert_eq!(first, [0.0, 1.0]); + let material = &g["materials"][prims[1]["material"].as_u64().unwrap() as usize]; + assert_eq!(material["pbrMetallicRoughness"]["baseColorTexture"]["index"], 0); + assert_eq!(material["pbrMetallicRoughness"]["baseColorFactor"], serde_json::json!([1.0, 1.0, 1.0, 0.5])); + assert_eq!(g["textures"][0]["source"], 0); + assert_eq!(g["samplers"][0]["wrapS"], 33071); + let image = g["images"][0]["uri"].as_str().unwrap().strip_prefix("data:image/png;base64,").unwrap(); + assert_eq!(vectorcraft_format::base64_decode(image).unwrap(), png); + // USDA: st up from the bottom, read by a primvar reader into a UV texture of the PNG beside it. + let files = mesh_files("Box", "usda", &parts, &pictures).unwrap(); + assert_eq!(files.iter().map(|(n, _)| n.as_str()).collect::>(), ["Box.usda", "Box-texture-1.png"]); + let u = text(&files, "Box.usda"); + assert_eq!(u.matches("primvars:st").count(), 1); + assert!(u.contains("texCoord2f[] primvars:st = [(0, 0), (1, 0), (1, 1), (0, 0), (1, 1), (0, 1)]"), "{u}"); + assert!(u.contains("color3f inputs:diffuseColor.connect = "), "{u}"); + assert!(u.contains("asset inputs:file = @Box-texture-1.png@") && u.contains("uniform token info:id = \"UsdUVTexture\"")); + assert!(u.contains("float2 inputs:st.connect = ")); + assert!(u.contains("string inputs:varname = \"st\"")); + assert_eq!(u.matches('{').count(), u.matches('}').count()); + // USDZ: the layer first, then the picture, each on a 64-byte boundary. + let zip = mesh_files("Box", "usdz", &parts, &pictures).unwrap().remove(0).1; + let archive = super::super::zip::Archive::open(&zip, 8).unwrap(); + assert_eq!(archive.read("Box.usda", usize::MAX).unwrap().map(String::from_utf8), Some(Ok(u))); + assert_eq!(archive.read("Box-texture-1.png", usize::MAX).unwrap(), Some(png.clone())); + let u16_at = |at: usize| u16::from_le_bytes([zip[at], zip[at + 1]]) as usize; + let u32_at = |at: usize| u32::from_le_bytes([zip[at], zip[at + 1], zip[at + 2], zip[at + 3]]) as usize; + let first = 30 + u16_at(26) + u16_at(28); + let second = first + u32_at(18); + assert_eq!(&zip[second..second + 4], &[0x50, 0x4b, 0x03, 0x04], "the picture comes second"); + let data = second + 30 + u16_at(second + 26) + u16_at(second + 28); + assert_eq!((first % 64, data % 64), (0, 0)); + assert_eq!(&zip[data..data + png.len()], png.as_slice()); +} + +#[test] +fn parts_sharing_a_picture_write_it_once() { + let (mut parts, mut pictures) = textured(b"one"); + parts.push(square(BLUE)); + pictures.push(pictures[1].clone()); + assert_eq!(image_count(&pictures), 1); + let files = mesh_files("Box", "obj", &parts, &pictures).unwrap(); + assert_eq!(files.len(), 3); + assert_eq!(text(&files, "Box.mtl").matches("newmtl").count(), 2, "the blue parts share the textured material"); + assert_eq!(mesh_file_names("Box", "usda", 2).unwrap(), ["Box.usda", "Box-texture-1.png", "Box-texture-2.png"]); + assert_eq!(mesh_file_names("A @b", "gltf", 2).unwrap(), ["A @b.gltf"]); + assert_eq!(texture_name("A @b#c", 0), "A__b_c-texture-1.png"); +} diff --git a/crates/engine/src/tests/assets_3d.rs b/crates/engine/src/tests/assets_3d.rs index cdef5b1dfc..dad1cc2b76 100644 --- a/crates/engine/src/tests/assets_3d.rs +++ b/crates/engine/src/tests/assets_3d.rs @@ -207,6 +207,118 @@ fn export_3d_writes_into_a_folder_or_one_zip() { let _ = std::fs::remove_dir_all(&dir); } +/// A blue 100 × 100 square extruded straight on, with a red 10 × 20 graphic "Mark" mapped onto its +/// front at its center and onto its back 30 pt to the right (as the back is seen from behind), +/// collected as a 3D asset in `format`. +fn mapped(format: &str) -> (Session, u64) { + let mut s = session(); + let mark = run(&mut s, "path.create", json!({"d": "M300 300L310 300L310 320L300 320Z"}))["id"].clone(); + run(&mut s, "paint.setFill", json!({"color": "#ff0000"})); + run(&mut s, "threeD.addGraphic", json!({"name": "Mark", "ids": [mark]})); + let id = run(&mut s, "path.create", json!({"d": "M100 100L200 100L200 200L100 200Z"}))["id"].as_u64().unwrap(); + run(&mut s, "paint.setFill", json!({"color": "#0000ff"})); + run(&mut s, "effect.apply", json!({"effect": "threeD.extrude", "params": {"rotationX": 0.0, "rotationY": 0.0, "rotationZ": 0.0, "depth": 20.0}})); + run(&mut s, "threeD.mapGraphic", json!({"symbol": "Mark", "ids": [id]})); + run(&mut s, "threeD.mapGraphic", json!({"symbol": "Mark", "face": "back", "x": 30.0, "ids": [id]})); + run(&mut s, "layer.setProps", json!({"id": id, "name": "Box"})); + let asset = run(&mut s, "assets.add3D", json!({"ids": [id], "format": format}))["assets"][0].as_u64().unwrap(); + (s, asset) +} + +/// The color of pixel `(x, y)` of PNG `png`. +fn pixel(png: &[u8], x: u32, y: u32) -> [u8; 4] { + image::load_from_memory(png).unwrap().to_rgba8().get_pixel(x, y).0 +} + +fn is_red(p: [u8; 4]) -> bool { + p[0] > 200 && p[1] < 50 && p[2] < 50 && p[3] == 255 +} + +fn is_blue(p: [u8; 4]) -> bool { + p[0] < 50 && p[1] < 50 && p[2] > 200 && p[3] == 255 +} + +#[test] +fn export_3d_paints_mapped_graphics_on_their_caps_in_every_format() { + for (format, names) in [ + ("usda", vec!["Box.usda", "Box-texture-1.png", "Box-texture-2.png"]), + ("usdz", vec!["Box.usdz"]), + ("gltf", vec!["Box.gltf"]), + ("obj", vec!["Box.obj", "Box.mtl", "Box-texture-1.png", "Box-texture-2.png"]), + ] { + let (mut s, _) = mapped(format); + let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); + assert_eq!(out.iter().map(|(n, _)| n.as_str()).collect::>(), names, "{format}"); + } + // The front's picture: the cap's 100 pt across 128 pixels, blue with the red graphic at the + // middle; the back's: the graphic 30 pt to the right as seen from behind, which is to the left + // in the art's plane. + let (mut s, _) = mapped("usda"); + let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); + let (front, back) = (&out[1].1, &out[2].1); + assert_eq!(image::load_from_memory(front).unwrap().to_rgba8().dimensions(), (128, 128)); + assert!(is_red(pixel(front, 64, 64)) && is_blue(pixel(front, 2, 2)) && is_blue(pixel(front, 64, 10))); + let at = |pt: f64| (pt * 1.28) as u32; + assert!(is_red(pixel(back, at(20.0), 64)) && is_blue(pixel(back, 64, 64)), "{:?}", pixel(back, 64, 64)); + // The USDA's front cap shows the front picture through st, up from the picture's bottom. + let usda = String::from_utf8(out[0].1.clone()).unwrap(); + assert_eq!(usda.matches("primvars:st").count(), 2); + assert_eq!(usda.matches("def Mesh").count(), 3, "the walls, the front cap and the back cap"); + // glTF holds both pictures, and a cap's coordinates stay inside its picture. + let (mut s, _) = mapped("gltf"); + let out = files(&run(&mut s, "assets.export3D", json!({}))); + let g: Value = serde_json::from_slice(&out[0].1).unwrap(); + assert_eq!(g["images"].as_array().map(Vec::len), Some(2)); + let png = vectorcraft_format::base64_decode(g["images"][0]["uri"].as_str().unwrap().split(',').nth(1).unwrap()).unwrap(); + assert_eq!(image::load_from_memory(&png).unwrap().to_rgba8().dimensions(), (1024, 1024), "1024 pixels by default"); +} + +#[test] +fn export_3d_keeps_flat_colors_without_graphics_and_refuses_bad_texture_sizes() { + let (mut s, asset) = mapped("obj"); + for bad in [json!(64), json!(5000), json!(512.5), json!("512"), json!(-1)] { + assert!(s.execute("assets.export3D", &json!({"textureSize": bad})).is_err(), "{bad}"); + } + // Without its graphics the box is one plain mesh, as before. + let id = s.doc().unwrap().doc.asset(asset).unwrap().nodes[0].0; + run(&mut s, "select.set", json!({"ids": [id]})); + run(&mut s, "effect.setParams", json!({"index": 0, "params": {"graphics": []}})); + let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); + assert_eq!(out.iter().map(|(n, _)| n.as_str()).collect::>(), ["Box.obj", "Box.mtl"]); + let obj = String::from_utf8(out[0].1.clone()).unwrap(); + assert!(!obj.contains("vt ") && obj.lines().filter(|l| l.starts_with("g ")).count() == 1); +} + +#[test] +fn texture_pixels_are_counted_across_one_export() { + let (s, asset) = mapped("gltf"); + let d = &s.doc().unwrap().doc; + let node = d.node(d.asset(asset).unwrap().nodes[0]).unwrap(); + let parts = vectorcraft_render::effects::three_d_meshes_in(Some(d), node).unwrap(); + let mut pixels = 0; + let made = crate::cmd::fileio::textures(d, &parts, 128, &mut pixels).unwrap(); + assert_eq!((made.iter().flatten().count(), pixels), (2, 2 * 128 * 128)); + let mut pixels = crate::cmd::fileio::MAX_TEXTURE_PIXELS - 128 * 128; + let e = crate::cmd::fileio::textures(d, &parts, 128, &mut pixels).unwrap_err(); + assert!(e.contains("textureSize"), "{e}"); +} + +#[test] +fn only_graphics_that_draw_count_as_textures() { + let parts_of = |s: &Session, asset: u64| { + let d = &s.doc().unwrap().doc; + let node = d.node(d.asset(asset).unwrap().nodes[0]).unwrap(); + vectorcraft_render::effects::three_d_meshes_in(Some(d), node).unwrap() + }; + let (mut s, asset) = mapped("obj"); + assert!(crate::cmd::fileio::draws_textures(&s.doc().unwrap().doc, &parts_of(&s, asset))); + // With its symbol gone the graphic draws nothing, so the export writes no texture. + run(&mut s, "symbol.delete", json!({"name": "Mark"})); + assert!(!crate::cmd::fileio::draws_textures(&s.doc().unwrap().doc, &parts_of(&s, asset))); + let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); + assert_eq!(out.iter().map(|(n, _)| n.as_str()).collect::>(), ["Box.obj", "Box.mtl"]); +} + #[test] fn three_d_assets_round_trip_through_the_native_format() { let mut s = session(); diff --git a/crates/three-d/src/lib.rs b/crates/three-d/src/lib.rs index 4290bc1c75..5dfdf05ece 100644 --- a/crates/three-d/src/lib.rs +++ b/crates/three-d/src/lib.rs @@ -9,8 +9,8 @@ mod solid; mod visibility; pub use solid::{ - Bevel, BevelShape, DepthPlane, Extrude, FaceMap, Facet, Inflate, PlanarFace, TOO_COMPLEX_SOLID, View, extrude, extrude_face_map, inflate, - inflate_each, inflate_together, plane, plane_face_map, + Bevel, BevelShape, DepthPlane, Extrude, FaceMap, Facet, Inflate, MeshFace, PlanarFace, TOO_COMPLEX_SOLID, View, extrude, extrude_face_map, + extrude_mesh_face, inflate, inflate_each, inflate_together, plane, plane_face_map, plane_mesh_face, }; pub use visibility::{VisibleFace, visible_faces}; mod shading; diff --git a/crates/three-d/src/solid.rs b/crates/three-d/src/solid.rs index 18ef7d6d1b..cc8881d2d9 100644 --- a/crates/three-d/src/solid.rs +++ b/crates/three-d/src/solid.rs @@ -28,7 +28,7 @@ pub(crate) use build::PLANES; use build::{Camera, cuts, edge_distance, newell, section}; pub(crate) use build::{Face3, Keep, extrude_faces, plane_faces}; pub use build::{extrude, plane}; -pub use face_map::{FaceMap, extrude_face_map, plane_face_map}; +pub use face_map::{FaceMap, MeshFace, extrude_face_map, extrude_mesh_face, plane_face_map, plane_mesh_face}; #[cfg(test)] use inflate::GRID_WORK; pub(crate) use inflate::inflate_faces; diff --git a/crates/three-d/src/solid/face_map.rs b/crates/three-d/src/solid/face_map.rs index d84dcc5ee6..cca6e6971a 100644 --- a/crates/three-d/src/solid/face_map.rs +++ b/crates/three-d/src/solid/face_map.rs @@ -174,6 +174,89 @@ pub fn plane_face_map(bounds: Rect, view: View) -> Option { Some(FaceMap::new(&camera, &placing, true)) } +/// A planar face in its solid's mesh ([`crate::Mesh`]): where the points of the art's plane lie +/// before projection, in the mesh's coordinates (y up), and the face's outward normal there. +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct MeshFace { + /// An art point `p` lies at `x · p.x + y · p.y + c`. + x: V3, + y: V3, + c: V3, + normal: V3, + /// A plane's mesh turns its normal toward the viewer, so its triangles face either way. + either_side: bool, +} + +/// From the effects' view space (y down) to the mesh's (y up). +fn mesh_space(v: V3) -> V3 { + V3(v.0, -v.1, v.2) +} + +impl MeshFace { + fn new(camera: &Camera, placing: &Placing, side: f64, either_side: bool) -> Self { + let (x, y, c) = placing.frame(); + let normal = mesh_space(camera.rotate(V3(0.0, 0.0, side))).unit(); + Self { x: mesh_space(x), y: mesh_space(y), c: mesh_space(c), normal, either_side } + } + + /// The art point that mesh point `m` shows, when `m` lies on the face's plane and a triangle + /// with unit normal `n` there belongs to the face. `None` otherwise, and when the face has no + /// area (a taper of 0 at the back). + pub fn art_point(&self, m: [f64; 3], n: [f64; 3]) -> Option { + let facing = self.normal.dot(V3(n[0], n[1], n[2])); + let facing = if self.either_side { facing.abs() } else { facing }; + // A NaN normal faces no way. + let faces = facing > 1.0 - 1e-6; + if !faces { + return None; + } + let d = V3(m[0], m[1], m[2]).sub(self.c); + let (xx, xy, yy) = (self.x.dot(self.x), self.x.dot(self.y), self.y.dot(self.y)); + let det = xx * yy - xy * xy; + let spans = xx > 1e-24 && yy > 1e-24 && det >= 1e-12 * xx * yy; + if !spans { + return None; + } + let (bx, by) = (self.x.dot(d), self.y.dot(d)); + let p = Point::new((bx * yy - by * xy) / det, (xx * by - xy * bx) / det); + let on = V3(self.x.0 * p.x + self.y.0 * p.y, self.x.1 * p.x + self.y.1 * p.y, self.x.2 * p.x + self.y.2 * p.y); + let off = d.sub(on); + let size = 1.0 + d.dot(d).sqrt() + self.c.dot(self.c).sqrt(); + (p.x.is_finite() && p.y.is_finite() && off.dot(off).sqrt() <= 1e-6 * size).then_some(p) + } +} + +/// Extrude & Bevel's cap `face` in the solid's mesh ([`MeshFace`]), for a solid built with +/// `bounds`, `options` and `view`, as [`extrude_face_map`] maps it on the page. With a depth of 0 +/// the art is a plane ([`plane_mesh_face`]). `None` for a hollow solid, for the back of a plane, +/// and for invalid bounds. +pub fn extrude_mesh_face(bounds: Rect, options: Extrude, view: View, face: PlanarFace) -> Option { + check_bounds(bounds).ok()?; + let o = options.sanitized(); + if o.depth <= 0.0 { + return (face == PlanarFace::Front).then(|| plane_mesh_face(bounds, view)).flatten(); + } + if !o.cap { + return None; + } + let camera = Camera::new(view, bounds, o.depth); + let (t, side) = match face { + PlanarFace::Front => (0.0, 1.0), + PlanarFace::Back => (1.0, -1.0), + }; + let placing = Placing::new(&camera, bounds.center(), Turn::new(bounds, o.twist, o.taper, t), o.depth / 2.0 - o.depth * t); + Some(MeshFace::new(&camera, &placing, side, false)) +} + +/// The plane [`super::plane`] turns art with `bounds` into, with `view`, in its mesh +/// ([`MeshFace`]). +pub fn plane_mesh_face(bounds: Rect, view: View) -> Option { + check_bounds(bounds).ok()?; + let camera = Camera::new(view, bounds, 0.0); + let placing = Placing::new(&camera, bounds.center(), Turn::new(bounds, 0.0, 1.0, 0.0), 0.0); + Some(MeshFace::new(&camera, &placing, 1.0, true)) +} + #[cfg(test)] #[path = "tests_face_map.rs"] mod tests; diff --git a/crates/three-d/src/solid/tests_face_map.rs b/crates/three-d/src/solid/tests_face_map.rs index 31644beda5..3cf10e7c70 100644 --- a/crates/three-d/src/solid/tests_face_map.rs +++ b/crates/three-d/src/solid/tests_face_map.rs @@ -1,7 +1,7 @@ use vectorcraft_geom::{BezPath, FillRule, PathData, Point, Rect}; use super::super::{Extrude, Facet, PlanarFace, View, extrude, plane}; -use super::{FaceMap, NEAREST, extrude_face_map, plane_face_map}; +use super::{FaceMap, MeshFace, NEAREST, extrude_face_map, extrude_mesh_face, plane_face_map, plane_mesh_face}; fn square() -> (PathData, Rect) { let mut b = BezPath::new(); @@ -143,6 +143,49 @@ fn a_page_point_nearer_the_eye_than_the_page_map_allows_has_no_art_point() { assert_eq!(map.to_art(q), None, "the inverse map takes {q:?} back to an art point the page map has no point for"); } +/// The art point of every corner of each triangle of `mesh` that `face` takes, and how many +/// triangles it takes. +fn mesh_art(mesh: &crate::Mesh, face: &MeshFace) -> (Vec, usize) { + let (mut points, mut taken) = (vec![], 0); + for t in &mesh.triangles { + let corners: Option> = t.iter().map(|&i| face.art_point(mesh.positions[i as usize], mesh.normals[i as usize])).collect(); + if let Some(c) = corners { + points.extend(c); + taken += 1; + } + } + (points, taken) +} + +#[test] +fn a_caps_mesh_corners_go_back_to_the_art_they_were_made_from() { + let (path, bounds) = square(); + let bevel = crate::Bevel { width: 4.0, height: 4.0, ..Default::default() }; + let options = Extrude { twist: 30.0, taper: 0.5, bevel: Some(bevel), ..Extrude::default() }; + let view = turned(40.0); + let mesh = crate::extrude_mesh(&path, FillRule::NonZero, bounds, options, view).unwrap(); + // The bevel's width sets the walls, and the back cap, out from the front's outline. + let outset = bounds.inflate(4.0, 4.0); + for (face, cap) in [(PlanarFace::Front, bounds), (PlanarFace::Back, outset)] { + let mesh_face = extrude_mesh_face(bounds, options, view, face).unwrap(); + let (points, taken) = mesh_art(&mesh, &mesh_face); + // A square cap is two triangles, and none of the bevel's or the walls' triangles are + // taken. The art points undo the back's twist and taper. + assert_eq!(taken, 2, "{face:?}"); + for p in points { + let near = corners(cap).iter().map(|c| c.distance(p)).fold(f64::INFINITY, f64::min); + assert!(near < 1e-6, "{face:?}: {p:?} is {near} from the cap's corners"); + } + } + // A hollow solid has no caps, and a plane's mesh has only the front, facing either way. + assert_eq!(extrude_mesh_face(bounds, Extrude { cap: false, ..options }, view, PlanarFace::Front), None); + let plane = crate::plane_mesh(&path, FillRule::NonZero, bounds, view).unwrap(); + let (points, taken) = mesh_art(&plane, &plane_mesh_face(bounds, view).unwrap()); + assert_eq!(taken, plane.triangles.len()); + assert!(points.iter().all(|p| corners(bounds).iter().any(|c| c.distance(*p) < 1e-6)), "{points:?}"); + assert_eq!(extrude_mesh_face(bounds, Extrude { depth: 0.0, ..options }, view, PlanarFace::Back), None); +} + #[test] fn the_mapped_part_of_a_rectangle_stops_before_the_eye() { let (_, bounds) = square(); diff --git a/crates/ui-egui/src/panels/asset_export.rs b/crates/ui-egui/src/panels/asset_export.rs index 39b3a0ea85..34978c1104 100644 --- a/crates/ui-egui/src/panels/asset_export.rs +++ b/crates/ui-egui/src/panels/asset_export.rs @@ -220,6 +220,17 @@ fn collect(app: &mut VectorcraftApp, ctx: &egui::Context, ids: Option bool { + let maps = |e: &vectorcraft_doc::Effect| e.visible && !vectorcraft_render::effects::mapped_graphics(&e.params).is_empty(); + let nodes: Vec<&Node> = asset.nodes.iter().filter_map(|id| doc.node(*id)).collect(); + nodes.iter().any(|n| n.appearance.effects.iter().chain(n.appearance.items.iter().flat_map(|i| i.effects())).any(maps)) + && vectorcraft_render::effects::three_d_meshes_of_in(Some(doc), nodes.iter().copied()) + .is_ok_and(|parts| vectorcraft_engine::cmd::fileio::draws_textures(doc, &parts)) +} + /// Export assets `ids` (`files_each`: the files one asset makes) into a picked folder (without a /// folder picker: the last folder Export for Screens used, else the Desktop); the web downloads /// them, several as one zip. @@ -230,11 +241,20 @@ fn export(app: &mut VectorcraftApp, ids: Vec, files_each: usize) { fn export_now(app: &mut VectorcraftApp, ids: Vec, files_each: usize) { // 3D assets are written as mesh files (`assets.export3D`), the others as pictures. + let web = io::is_web(app); let Some(st) = app.session.active() else { return }; let format = |id: &u64| st.doc.asset(*id).and_then(|a| a.format_3d.clone()); let (three_d, ids): (Vec, Vec) = ids.into_iter().partition(|id| format(id).is_some()); - // An OBJ is two files. - let mesh_files: usize = three_d.iter().map(|id| if format(id).as_deref() == Some("obj") { 2 } else { 1 }).sum(); + // An OBJ is two files, and an OBJ or a USDA whose graphics draw a texture writes it beside + // them. Only the web, which zips several files, needs the count. + let mesh_files: usize = three_d + .iter() + .map(|id| { + let format = format(id); + let textures = web && matches!(format.as_deref(), Some("obj" | "usda")) && st.doc.asset(*id).is_some_and(|a| writes_textures(&st.doc, a)); + usize::from(format.as_deref() == Some("obj")) + 1 + usize::from(textures) + }) + .sum(); // Create Sub-folders as the panel menu checks it: on by default, and remembered folders (per // row, format or item) are used as Export for Screens uses them (a remembered `subfolders` // false beside them would alone put every file in the folder itself). diff --git a/docs/effects-parity.md b/docs/effects-parity.md index 342a5171b6..acefb20804 100644 --- a/docs/effects-parity.md +++ b/docs/effects-parity.md @@ -183,7 +183,7 @@ VectorCraft choices; an original approximation, never compared with another appl | Materials panel, lighting, ray-traced render | Window › 3D and Materials panel with the object types (Plane, Extrude, Revolve, Inflate) and the Object, Rotation and Lighting settings of the applied effect, and Quick Actions › Expand as Wireframes ([three-d.md](three-d.md#3d-and-materials-panel)); one to ten directional lights with per-light Color (opaque RGB, white by default), Intensity, Rotation, Height, Softness and neutral Ambient Light, Revolve and colored Inflate use smooth vector shading; Extrude & Bevel and Rotate retain planar shading; original Standard, Diffuse, Top Left and Right lighting rigs; hard-edged shadows behind or below the object from the first light ([three-d.md](three-d.md#shadows)); the Materials tab's Graphics, document symbols mapped onto Extrude & Bevel's caps and onto a plane, moved with an artboard handle, and wrapped around Revolve's side ([three-d.md](three-d.md#graphics)); no base materials, graphics on Inflate or on Extrude & Bevel's walls and bevels, soft shadows or ray tracing | | 3D (Classic): Extrude & Bevel, Revolve, Rotate | Extrude & Bevel (Classic) initial: live, round seam joins, Extrude Depth, Cap, five original bevel shapes with Height and Bevel Extent In or Out, Position presets and rotation gizmo, Perspective, Wireframe, No Shading, Diffuse and Plastic surfaces with one to ten lights, Light Intensity, Ambient Light, Highlight Intensity and Size, Blend Steps, Black, Custom or no Shading Color, Draw Hidden Faces ([create 3D objects](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/create-3d-graphics/create-3d-objects.html)); Revolve (Classic) initial: live, round seam joins, Angle, Cap, Offset from the left or right edge, Position presets and rotation gizmo, Perspective, the same four surfaces, lights, highlight, Blend Steps and Shading Color, groups and layers revolved about one shared axis (same page); Rotate (Classic) initial: live, round seam joins, every fill and stroke turned as one plane, Position presets and rotation gizmo, Perspective, No Shading and Diffuse surfaces with lights, Ambient Light, Blend Steps and Shading Color ([rotate objects in 3D](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/create-3d-graphics/rotate-objects-in-3d.html)); Map Art: none | | Turntable (30.0 beta) | none | -| Export 3D objects (OBJ, USDA, glTF) | initial: Asset Export's Export 3D Object collects an object with Extrude & Bevel, Revolve, Inflate or Rotate as a 3D asset, and Export writes its solids as a USDA (the default), USDZ, glTF or OBJ mesh with a material in each solid's paint color (`assets.add3D`, `assets.set3DFormat`, `assets.export3D`); no textures, map art or shading ([3D export help](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/create-3d-graphics/export-3d-vector-artwork.html)) | +| Export 3D objects (OBJ, USDA, glTF) | initial: Asset Export's Export 3D Object collects an object with Extrude & Bevel, Revolve, Inflate or Rotate as a 3D asset, and Export writes its solids as a USDA (the default), USDZ, glTF or OBJ mesh with a material in each solid's paint color (`assets.add3D`, `assets.set3DFormat`, `assets.export3D`); graphics mapped onto a plane or Extrude & Bevel's caps are exported as PNG textures of those faces, flat and unlit; no graphics on Revolve's side, no materials and no shading ([3D export help](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/create-3d-graphics/export-3d-vector-artwork.html)) | The `three-d` crate (depends on `geom` and `pathops`, with no UI or GPU dependencies) builds, rotates, projects, shades and depth-sorts the surfaces; the effects crate turns them into art. What's left (materials and shadows, ray-traced rendering, diff --git a/docs/gaps.md b/docs/gaps.md index d0140731e2..b7735bfc69 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -692,7 +692,8 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi Extrude & Bevel, Inflate and Rotate with Position presets ([three-d.md](three-d.md), #1407). Colored Inflate has automatic smooth vector lighting from shared membrane normals. White-light Inflate keeps its polygon shading. Every 3D facet's seam has round joins ([three-d.md](three-d.md#seams)). All four take one to ten colored directional lights, with neutral ambient applied once, a light list and independent previewing controls. Standard, Diffuse, Top Left and Right select original rigs, shared with commands; manual settings show Custom. - **Missing:** materials (base, Substance, graphics), shadows, ray-traced rendering, angular cut caps, exact visibility for intersecting and concave surfaces, the rest of 3D - Classic (Map Art), Turntable, textures, map art and shading in 3D export. + Classic (Map Art), Turntable, and in 3D export the graphics on Revolve's side, materials and shading (graphics on + planes and Extrude & Bevel's caps are exported as textures). - **Impact:** specialist; Materials is the one menu stub left. - **Estimate:** 25–45 h; plan in `plan/` before coding. diff --git a/docs/mcp.md b/docs/mcp.md index 9336ea35ca..fffc77205f 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -8261,13 +8261,24 @@ default), `usdz`, `gltf` or `obj`; the panel shows a Format row for the 3D asset `assets.set3DFormat {assets, format}` sets it (an undo step only when the format changes). `assets.list` gives each asset's `format3D` (null for a picture asset). -`assets.export3D {assets?, folder?, zip?}` writes each 3D asset (default: all of them) as a mesh file named after it: +`assets.export3D {assets?, folder?, zip?, textureSize?}` writes each 3D asset (default: all of them) as a mesh file named after it: `.usda`, `.usdz`, `.gltf` (glTF 2.0, its buffer embedded) or `.obj` with its `.mtl` (whitespace and `#` in an OBJ's name become `_`). Every solid of the object (the fill's, each stroke's, a group's members') is its own mesh, with a two-sided material in the color it is painted (a gradient's stops averaged, a pattern gray). The mesh holds the solid's faces before they are projected onto the page, those turned away from the viewer included, at the object's 3D rotation, y up, about the point the object turns about: in points (USD's layer gives `metersPerUnit`), in meters in glTF. Files that would share a name get `-2`, `-3` and so on. +Graphics mapped onto a plane or onto Extrude & Bevel's front or back cap (`threeD.mapGraphic`) are exported as a PNG +texture of that face: the face's color with its graphics drawn over it, flat and unlit, on a mesh of the face's own +triangles with texture coordinates and a material that shows the texture. glTF embeds the PNG as a data URI +(`TEXCOORD_0`, `baseColorTexture`), USDZ stores it after the layer, USDA reads it through `primvars:st`, a +`UsdPrimvarReader_float2` and a `UsdUVTexture` connected to the surface's `diffuseColor`, and OBJ gives `vt` coordinates +and an MTL `map_Kd`; OBJ and USDA write the PNG beside them as `-texture-1.png`, `-texture-2.png` and so on +(whitespace, `#` and `@` become `_`). Faces with the same color, graphics and bounds share one texture. `textureSize` (128 to +4096, default 1024, VectorCraft's own values) is the number of pixels along the longer side of each texture; one export +draws at most 67,108,864 texture pixels in all, and past that it is refused. Graphics on Revolve's side are not +exported yet. The layouts follow glTF 2.0, UsdPreviewSurface () +and OBJ/MTL (). With `zip`, the files go into one ZIP named after the document with `-3D` added (`Untitled-1-3D.zip`), or `3D Assets.zip` when the document's title gives no file name. An object whose face has a hole that crosses the face's outline or another hole is refused, by `assets.add3D` and diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 90d82894db..57b5fdf189 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1321,6 +1321,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Extrude & Bevel (both kinds) and Rotate keep the art's curves in the faces they draw, export and expand: caps and the edges of walls and bevels where they meet a cap are cubics with smooth anchors where the art's are, fitted within 0.001 pt in perspective and within the sampling tolerance on a bevel's inset. An edge of a twisted wall that is cut into pieces, a piece of curve that does not fit after 8 halvings, and the curves past 1,048,576 for one solid stay straight (VectorCraft's own values; [three-d.md](three-d.md#what-differs-from-the-public-documentation)). Tests `solid::tests::a_cap_keeps_the_curves_of_the_art`, `a_cap_in_perspective_fits_the_projected_curves`, `a_beveled_cap_and_its_walls_share_their_curves`, `twisted_beveled_tiny_and_degenerate_caps_keep_their_curves`. - Export 3D Object (Asset Export's menu): an object with Extrude & Bevel, Revolve, Inflate or Rotate becomes a 3D asset whose Format is USDA (the default), USDZ, glTF or OBJ, and Export writes each of its solids as a mesh with a material in its paint's color (`assets.add3D`, `assets.set3DFormat`, `assets.export3D`; [export 3D vector artwork](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/create-3d-graphics/export-3d-vector-artwork.html)). - Export 3D Object builds each Extrude & Bevel (both kinds) and Inflate solid once: the same build gives the faces that count toward the object's limit and the faces of its mesh, and the meshes match those of a separate build bit for bit. Tests `mesh::tests::a_meshed_solid_is_built_once`, `an_extruded_solid_and_its_mesh_match_the_two_built_apart`, `inflated_solids_and_their_meshes_match_the_two_built_apart`, `solids::tests_mesh::one_build_exports_the_meshes_built_apart`, `a_stroke_past_the_limits_is_left_out_of_the_export`. + - Export 3D Object writes the graphics mapped onto a plane or onto Extrude & Bevel's front and back caps as a PNG texture of each face, the face's color with its graphics drawn flat and unlit over it, on a mesh of that face with texture coordinates, in all four formats (glTF embeds it, USDZ packs it after the layer, OBJ and USDA write `-texture-1.png` beside them; `assets.export3D` `textureSize`, 128 to 4096 pixels, default 1024, VectorCraft's own values; [the help page](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/create-3d-graphics/map-artwork-on-3d-objects.html)). Graphics on Revolve's side, materials and lighting are not exported. Tests `a_caps_mesh_corners_go_back_to_the_art_they_were_made_from`, `a_mesh_carries_its_caps_graphics_flat_in_the_arts_plane`, `each_format_carries_a_textured_part_with_its_coordinates_and_picture`, `export_3d_paints_mapped_graphics_on_their_caps_in_every_format`. - Checking an Extrude & Bevel (both kinds) or Inflate effect builds each solid the effect draws once, about the bounds the effect draws it about; a shape with no fill still has its profile built on its own. Tests `solids::tests::the_check_builds_each_drawn_solid_once`, `the_check_builds_the_profile_of_a_shape_with_no_fill`. - Initial live Revolve (#605, #846): a portable geometry and shading crate (`three-d`), editable path and compound profiles, compact options with artboard rotation and light gizmos, SVG/PDF vector output and Expand Appearance that can trim covered faces. Open ends have continuous caps by default, shading is smooth with one to ten colored lights, and intersecting surfaces' visibility is approximate ([revolve.md](revolve.md)). - Revolve takes graphics on its swept side, shaded with the object's light ([the archived reference, page 185](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=185)). By VectorCraft's own rule a graphic wraps around the axis at its own size at every distance from it, narrows toward the silhouette, follows the profile along its length and is hidden where the side faces away (`threeD.mapGraphic`; `revolve::tests_graphics`, `tests::side_faces_lie_on_the_unrolled_surface_and_caps_do_not`, `map_graphic_puts_a_graphic_on_the_side_of_a_revolve`). From f4934644ab70ac6715ea520b5994681fc713d417 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 21:17:04 -0800 Subject: [PATCH 019/226] Gradient mesh: a color dropped or eyedropped on a point or patch recolors it With the Fill proxy active, a solid color dragged from the Color or Swatches panel or a Fill proxy onto a selected gradient mesh recolors the mesh point under the pointer (within 5 screen pixels), else the four points around the patch there. With a mesh selected and a solid fill color set, a plain Eyedropper click does the same with the fill color. Both run object.mesh.setPointColor as one undo step. Another object on top of the mesh at that place keeps the earlier behavior, and Object Selection by Path Only does not stop a drop inside a patch. --- crates/tools/src/meshedit.rs | 10 +++ crates/tools/src/xform/eyedropper.rs | 94 ++++++++++++++++++++++++++++ crates/ui-egui/src/canvas/context.rs | 37 ++++++++++- crates/ui-egui/src/canvas/tests.rs | 80 +++++++++++++++++++++++ docs/mcp.md | 10 +++ docs/ui-parity.md | 1 + 6 files changed, 231 insertions(+), 1 deletion(-) diff --git a/crates/tools/src/meshedit.rs b/crates/tools/src/meshedit.rs index 1069c90eb5..6a1626ecff 100644 --- a/crates/tools/src/meshedit.rs +++ b/crates/tools/src/meshedit.rs @@ -66,6 +66,16 @@ pub fn part_points(m: &GradientMesh, p: Point, point_tol: f64, line_tol: f64) -> Some(vec![m.idx(r, c), m.idx(r, c + 1), m.idx(r + 1, c), m.idx(r + 1, c + 1)]) } +/// The points of gradient mesh `m` that a color dropped at `p`, or an Eyedropper click there, +/// recolors: the point within `point_tol`, else the four points around the patch under `p`. +pub fn color_points(m: &GradientMesh, p: Point, point_tol: f64) -> Option> { + if let Some(i) = m.point_near(p, point_tol) { + return Some(vec![i]); + } + let (r, c, ..) = m.locate(p)?; + Some(vec![m.idx(r, c), m.idx(r, c + 1), m.idx(r + 1, c), m.idx(r + 1, c + 1)]) +} + /// What a press on a mesh grabs: the mesh, the point and (on the focused point) a handle. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct MeshGrab { diff --git a/crates/tools/src/xform/eyedropper.rs b/crates/tools/src/xform/eyedropper.rs index c5e05f004b..dafab48480 100644 --- a/crates/tools/src/xform/eyedropper.rs +++ b/crates/tools/src/xform/eyedropper.rs @@ -10,6 +10,10 @@ //! blend's steps, an envelope's distorted contents). Clicking an image samples its pixels //! (averaged over the options' raster sample size; a CMYK image gives its ink amounts). //! +//! With a gradient mesh selected, a click on one of its points gives that point the current solid +//! fill color, and a click inside one of its patches gives it to the patch's four points +//! (`object.mesh.setPointColor`). +//! //! The Gradient panel's eyedropper sets the `stop` option (the tool to return to): the next click //! samples the colour under the cursor into the selected gradient stop (`paint.sampleColor //! {stop}`) and switches back to that tool. @@ -453,6 +457,21 @@ fn image_color_at(s: &Sampler, n: &Node, p: Point) -> Option { Some(Color::rgb(r, g, b)) } +/// The selected, editable gradient mesh and its points that an Eyedropper click at `p` recolors +/// ([`crate::meshedit::color_points`]): the topmost visible object within reach of `p` (locked art +/// included, clipping applied) must be that mesh, and the points are its point within reach of +/// `p`, else the four points around its patch under `p`. +fn selected_mesh_points(cx: &ToolContext, p: Point) -> Option<(NodeId, Vec)> { + let tol = cx.tol(5.0); + let opt = sample_options(cx); + let leaf = hit_test_visible(cx.doc, p, HitOptions { tol: opt.tol.max(tol), ..opt })?.leaf; + if !cx.selection.contains(leaf) || !cx.doc.editable()(leaf) { + return None; + } + let Some(NodeKind::Mesh(m)) = cx.doc.node(leaf).map(|n| &n.kind) else { return None }; + Some((leaf, crate::meshedit::color_points(m, p, tol)?)) +} + impl Tool for EyedropperTool { fn id(&self) -> &'static str { "eyedropper" @@ -471,6 +490,17 @@ impl Tool for EyedropperTool { return vec![Action::Dialog("brushKeyColor".into(), json!({ "color": color_json(&c) })), Action::SwitchTool(back)]; } let stop = self.stop.as_ref().zip(cx.gradient_stop); + // A plain click on a selected gradient mesh gives the fill color to the point there, else + // to the four points of the patch there. + if stop.is_none() + && !ev.mods.alt + && !ev.mods.shift + && let Paint::Solid { color, .. } = &cx.paint.fill + && let Some((id, points)) = selected_mesh_points(cx, ev.pos) + { + let params = json!({ "id": id.0, "points": points, "color": color_json(color), "keepModel": true }); + return vec![Action::Exec("object.mesh.setPointColor".into(), params)]; + } // Reading a source is independent of its editability. Only Alt's reverse operation // writes to the clicked object; Shift+Alt appends its appearance to the selection. let source = if ev.mods.alt && !ev.mods.shift && stop.is_none() { @@ -1353,6 +1383,70 @@ mod tests { assert_eq!(sampled_hex(&a), "#404040"); } + /// With a gradient mesh selected, a click on one of its points gives that point the fill color, + /// and a click inside a patch gives it to the patch's four points. Unselected, a click copies + /// the mesh's appearance as before, and Shift still samples. + #[test] + fn a_click_on_a_selected_mesh_gives_its_point_or_patch_the_fill_color() { + use vectorcraft_doc::{Document, GradientMesh}; + let mut d = Document::new(500.0, 500.0); + let l = d.layers[0].id; + let id = d.alloc_id(); + let mesh = GradientMesh::from_surface(2, 2, &|u, v| Point::new(100.0 + 100.0 * u, 100.0 + 100.0 * v), &|_, _| Color::WHITE); + d.insert(Some(l), 0, Node::new(id, NodeKind::Mesh(mesh))).unwrap(); + let mut p = paint(); + p.fill = Paint::solid(Color::rgb(1.0, 0.0, 0.0)); + let red = color_json(&Color::rgb(1.0, 0.0, 0.0)); + let set = |points: Value| { + vec![Action::Exec("object.mesh.setPointColor".into(), json!({"id": id.0, "points": points, "color": red, "keepModel": true}))] + }; + let mut s = Selection::default(); + let click = |s: &Selection, p: &crate::PaintDefaults, x: f64, y: f64, m: Mods| { + EyedropperTool::default().pointer(&cx(&d, s, p), &PointerEvent::new(PointerKind::Down, x, y).with_mods(m)) + }; + let plain = Mods::default(); + let a = click(&s, &p, 125.0, 125.0, plain); + assert_eq!(a, vec![Action::Exec("appearance.copyFrom".into(), json!({"source": id.0}))], "an unselected mesh"); + s.set([id]); + assert_eq!(click(&s, &p, 151.0, 149.0, plain), set(json!([4])), "the point near the click"); + assert_eq!(click(&s, &p, 125.0, 125.0, plain), set(json!([0, 1, 3, 4])), "the patch's four points"); + assert_eq!(click(&s, &p, 175.0, 175.0, plain), set(json!([4, 5, 7, 8]))); + let shift = Mods { shift: true, ..Default::default() }; + assert!(matches!(&click(&s, &p, 125.0, 125.0, shift)[0], Action::Exec(c, _) if c == "paint.sampleColor")); + let alt = Mods { alt: true, ..Default::default() }; + assert!(matches!(&click(&s, &p, 125.0, 125.0, alt)[0], Action::Exec(c, v) if c == "appearance.copyFrom" && v["reverse"] == true)); + // Off the mesh, or with a fill that is not a solid color, nothing goes to its points. + assert!(click(&s, &p, 400.0, 400.0, plain).is_empty()); + p.fill = Paint::None; + assert!(matches!(&click(&s, &p, 125.0, 125.0, plain)[0], Action::Exec(c, _) if c == "appearance.copyFrom")); + } + + /// An unselected object on top of a selected mesh's point keeps the click: it copies that + /// object's appearance, and the mesh's points keep their colors. + #[test] + fn a_click_on_an_object_over_a_selected_mesh_copies_that_object() { + use vectorcraft_doc::{Document, GradientMesh}; + let mut d = Document::new(500.0, 500.0); + let l = d.layers[0].id; + let id = d.alloc_id(); + let mesh = GradientMesh::from_surface(2, 2, &|u, v| Point::new(100.0 + 100.0 * u, 100.0 + 100.0 * v), &|_, _| Color::WHITE); + d.insert(Some(l), 0, Node::new(id, NodeKind::Mesh(mesh))).unwrap(); + let top = d.alloc_id(); + let mut cover = (*filled_rect(vectorcraft_geom::Rect::new(140.0, 140.0, 160.0, 160.0), Paint::solid(Color::BLACK))).clone(); + cover.id = top; + d.insert(Some(l), usize::MAX, cover).unwrap(); + let mut p = paint(); + p.fill = Paint::solid(Color::rgb(1.0, 0.0, 0.0)); + let mut s = Selection::default(); + s.set([id]); + let a = EyedropperTool::default().pointer(&cx(&d, &s, &p), &PointerEvent::new(PointerKind::Down, 150.0, 150.0)); + assert_eq!(a, vec![Action::Exec("appearance.copyFrom".into(), json!({"source": top.0}))]); + // Locked, it is still what the click samples. + d.node_mut(top).unwrap().locked = true; + let a = EyedropperTool::default().pointer(&cx(&d, &s, &p), &PointerEvent::new(PointerKind::Down, 150.0, 150.0)); + assert_eq!(a, vec![Action::Exec("appearance.copyFrom".into(), json!({"source": top.0}))], "a locked object on top"); + } + /// Finding the point in a mesh counts the points it looks at in every patch: a 20 × 20 mesh /// takes more than a thousand units of work. #[test] diff --git a/crates/ui-egui/src/canvas/context.rs b/crates/ui-egui/src/canvas/context.rs index cd98a214b7..d8cd85d13a 100644 --- a/crates/ui-egui/src/canvas/context.rs +++ b/crates/ui-egui/src/canvas/context.rs @@ -50,7 +50,9 @@ pub(super) fn context_menu(app: &mut VectorcraftApp, resp: &egui::Response, xf: /// A panel drag ([`widgets::PanelDrag`]) dropped on art acts on the object under the pointer, /// selected or not: a paint (swatches, a Fill/Stroke proxy, the Gradient panel's thumbnail) goes -/// to its active proxy (`paint.setFill`/`paint.setStroke` with its `ids`; a gradient fits it), the +/// to its active proxy (`paint.setFill`/`paint.setStroke` with its `ids`; a gradient fits it; a +/// solid fill color on a selected gradient mesh recolors the mesh point under the pointer, else the +/// four points of the patch there, with `object.mesh.setPointColor`), the /// Appearance panel's thumbnail gives the object (the topmost one hit) the appearance it carries /// (`appearance.copyFrom`), a graphic style is applied to it (`graphicStyle.apply`; with Alt, on /// top of its appearance), and a brush is applied to it (`brush.apply`, `brush.addFromLibrary` @@ -89,6 +91,21 @@ pub(super) fn panel_drop(app: &mut VectorcraftApp, ui: &Ui, resp: &egui::Respons } return; } + // A solid fill color on a selected gradient mesh: the point under the pointer, else the four + // points around the patch there, take it. The selected meshes are looked at directly, so + // Object Selection by Path Only and the selection tolerance do not stop it. + if let widgets::PanelDrag::Paint { params, paint, .. } = &*d + && !params.is_null() + && let Some(color) = paint.color() + && crate::panels::proxy_cmd(app, false) == "paint.setFill" + && let Some((id, points)) = selected_mesh_drop(app, xf.to_doc(pos), xf.zoom) + { + let params = json!({"id": id.0, "points": points, "color": crate::panels::color_json(&color), "keepModel": true}); + if let Err(e) = app.run("object.mesh.setPointColor", params) { + app.status(e); + } + return; + } let hit = hit_at(app, xf.to_doc(pos), xf.zoom); // A scatter, art or pattern brush from the Brushes panel dropped where there is no art: a copy // of its art, centered where it is dropped, to edit and Alt-drag back onto the brush. @@ -148,3 +165,21 @@ pub(super) fn panel_drop(app: &mut VectorcraftApp, ui: &Ui, resp: &egui::Respons app.status(e); } } + +/// The selected, editable gradient mesh and its points that a solid color dropped at document +/// point `p` at `zoom` recolors: the topmost object within 5 screen pixels of `p` must be that mesh +/// (fills count even with Object Selection by Path Only, and clipping applies), and the points are +/// its point within 5 screen pixels, else the four points around its patch under `p`. +fn selected_mesh_drop(app: &VectorcraftApp, p: vectorcraft_geom::Point, zoom: f64) -> Option<(vectorcraft_doc::NodeId, Vec)> { + let tol = 5.0 / zoom.max(1e-9); + let leaf = hit_with(app, p, zoom, |doc, p, opt| { + vectorcraft_doc::hit::hit_test(doc, p, vectorcraft_doc::hit::HitOptions { path_only: false, tol: opt.tol.max(tol), ..opt }) + })? + .leaf; + let st = app.session.active()?; + if !st.selection.contains(leaf) || !st.doc.editable()(leaf) { + return None; + } + let Some(vectorcraft_doc::NodeKind::Mesh(m)) = st.doc.node(leaf).map(|n| &n.kind) else { return None }; + Some((leaf, vectorcraft_tools::meshedit::color_points(m, p, tol)?)) +} diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 6e48b0a357..2bdaae94a8 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -8460,6 +8460,86 @@ fn swatches_and_proxy_paints_dropped_on_art_fill_the_object_hit() { assert!(matches!(fill(&app), Paint::Gradient(g) if g.geom.is_none())); } +#[test] +fn a_color_dropped_on_a_selected_mesh_recolors_the_point_or_patch_under_it() { + use vectorcraft_color::{Color, Paint}; + use vectorcraft_doc::{GradientMesh, NodeId, NodeKind}; + use widgets::PanelDrag; + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + let id = app.session.execute("shape.rectangle", &json!({"x": 50, "y": 50, "width": 100, "height": 100})).unwrap()["id"].as_u64().unwrap(); + let id = NodeId(id); + app.session.execute("object.mesh.create", &json!({"ids": [id.0], "rows": 2, "columns": 2})).unwrap(); + app.session.execute("select.none", &json!({})).unwrap(); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + let xf = Xf::new(app.canvas_rect.unwrap(), app.view().unwrap()); + let drop = |app: &mut VectorcraftApp, d: PanelDrag, at: Point| { + let at = xf.to_screen(at); + egui::DragAndDrop::set_payload(&ctx, d); + let up = egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers: Default::default() }; + frame(app, &ctx, vec![egui::Event::PointerMoved(at), up]); + }; + let mesh = |app: &VectorcraftApp| -> GradientMesh { + match &app.session.active().unwrap().doc.node(id).unwrap().kind { + NodeKind::Mesh(m) => m.clone(), + _ => panic!("not a gradient mesh"), + } + }; + let colors = |app: &VectorcraftApp| mesh(app).points.iter().map(|q| q.color).collect::>(); + let undo_len = |app: &VectorcraftApp| app.session.active().unwrap().history.undo.len(); + let before = colors(&app); + let m = mesh(&app); + let (center, patch) = (m.points[4].p, Point::new((m.points[0].p.x + m.points[4].p.x) / 2.0, (m.points[0].p.y + m.points[4].p.y) / 2.0)); + let (red, blue) = (Color::rgb(1.0, 0.0, 0.0), Color::rgb(0.0, 0.0, 1.0)); + app.session.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + // On a mesh point: that point alone. + drop(&mut app, PanelDrag::paint(Paint::solid(red)), center); + let after = colors(&app); + assert_eq!(after[4], red); + assert_eq!((0..9).filter(|i| after[*i] != before[*i]).count(), 1, "only the point under the pointer"); + // Inside a patch: its four points. + drop(&mut app, PanelDrag::paint(Paint::solid(blue)), patch); + let after = colors(&app); + assert_eq!([0, 1, 3, 4].map(|i| after[i]), [blue; 4]); + assert_eq!([2, 5, 6, 7, 8].map(|i| after[i]), [2, 5, 6, 7, 8].map(|i| before[i])); + assert!(app.session.active().unwrap().selection.contains(id), "the selection stays"); + // The same color again changes nothing and records no undo step. + let n = undo_len(&app); + drop(&mut app, PanelDrag::paint(Paint::solid(blue)), patch); + assert_eq!(undo_len(&app), n); + // With Object Selection by Path Only, a drop inside a patch still reaches its points, and a + // drop 4 screen pixels outside a corner point still reaches that point. + app.session.execute("prefs.set", &json!({"key": "objectSelectionByPathOnly", "value": true})).unwrap(); + let green = Color::rgb(0.0, 1.0, 0.0); + let far = Point::new((m.points[4].p.x + m.points[8].p.x) / 2.0, (m.points[4].p.y + m.points[8].p.y) / 2.0); + // Art below the patch, with its outline within the selection tolerance, is not taken for it. + let h = 1.0 / xf.zoom; + let below = app.session.execute("shape.rectangle", &json!({"x": far.x - h, "y": far.y - h, "width": 2.0 * h, "height": 2.0 * h})).unwrap()["id"] + .as_u64() + .unwrap(); + app.session.execute("object.arrange.sendToBack", &json!({"ids": [below]})).unwrap(); + app.session.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + drop(&mut app, PanelDrag::paint(Paint::solid(green)), far); + assert_eq!([4, 5, 7, 8].map(|i| colors(&app)[i]), [green; 4]); + assert_ne!(app.session.active().unwrap().doc.node(NodeId(below)).unwrap().appearance.fill_paint(), Paint::solid(green)); + let off = 4.0 / xf.zoom; + drop(&mut app, PanelDrag::paint(Paint::solid(red)), Point::new(m.points[0].p.x - off, m.points[0].p.y)); + assert_eq!(colors(&app)[0], red, "the corner point within reach"); + assert_eq!(colors(&app)[1], blue); + // An unselected object on top of the mesh takes the drop itself. + app.session.execute("prefs.set", &json!({"key": "objectSelectionByPathOnly", "value": false})).unwrap(); + let c = m.points[4].p; + let cover = app.session.execute("shape.rectangle", &json!({"x": c.x - 10.0, "y": c.y - 10.0, "width": 20, "height": 20})).unwrap()["id"] + .as_u64() + .unwrap(); + app.session.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let before = colors(&app); + drop(&mut app, PanelDrag::paint(Paint::solid(green)), c); + assert_eq!(colors(&app), before, "the mesh under it keeps its colors"); + assert_eq!(app.session.active().unwrap().doc.node(NodeId(cover)).unwrap().appearance.fill_paint(), Paint::solid(green)); +} + #[test] fn dropping_the_appearance_thumbnail_on_art_copies_the_appearance() { use vectorcraft_doc::NodeId; diff --git a/docs/mcp.md b/docs/mcp.md index 8ca4121032..a4e872204b 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -11116,6 +11116,16 @@ picked point's color, and `fillMixed` compares the picked points' colors with ea selected objects. The Transparency panel shows the picked points' opacity (blank when it differs), and the Control bar shows the first picked point's opacity. +A solid color dragged from the Color or Swatches panel or a Fill proxy and dropped on a selected gradient mesh, while the +Fill proxy is active, recolors the mesh point under the pointer (within 5 screen pixels), else the four points around the +patch there, as `object.mesh.setPointColor {id, points, color, keepModel: true}`. With a gradient mesh selected and a +solid fill color set, a plain Eyedropper click does the same with the fill color: on a point of any selected mesh, or +inside a patch of the selected mesh the click hits. A gradient, a pattern, a fill of None, a stroke proxy or a mesh that +is not selected keeps the earlier behavior (the whole object takes the paint, and the Eyedropper copies the appearance), +and so does an unselected object on top of the mesh at that place. +See [Edit mesh objects](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=312); +the 5-pixel reach is VectorCraft's own. + `object.mesh.movePoints {id, points: [index…], dx, dy}` (or `{items: [{id, points}…], dx, dy}` over several meshes) moves points by (dx, dy), their handles with them; `object.mesh.setPointColor` takes `points` or `items` the same way to colour or fade several points at once. An index out of range, an index that is not a whole number ≥ 0, or a diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 082e565bd2..39bd36ac5a 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -320,6 +320,7 @@ tools, never checked side by side) isn't captured row by row. | Cmd/Ctrl: last-used selection tool; Cmd+Alt: Group Selection inside Direct Selection | done | Cmd+Alt lends Group Selection only while Direct Selection is active (Cmd borrow from the Pen keeps Direct Selection so Alt stays copy/subtract); Cmd alone lends Direct Selection the Selection tool: its bounding box shows while Cmd is held over objects selected whole and its handles scale and rotate them, and a Cmd drag moves the whole object while its direct-selected anchors stay selected (#3901; no box over a selection with anchors picked yet); engine pointer and canvas regressions | | Eyedropper copies effective character dimensions between transformed text objects | done | Point/area and grouped text, highlighted ranges, reverse/remembered sampling, opt-outs and atomic invalid-transform rejection; `scaled_type_pick_*` (#6404) | | Eyedropper styles highlighted characters only and preserves ranges across Type switches | done | Font/paint, Shift color-only, Unicode, Undo/Redo and stale-range regression tests; enabled non-neutral source or target object transparency is refused atomically; disable Transparency to sample supported attributes | +| Gradient mesh: a solid color dropped from the Color or Swatches panel or a Fill proxy on a selected mesh recolors the mesh point under the pointer, else the patch's four points; with the mesh selected, an Eyedropper click applies the fill color the same way | done | [Edit mesh objects](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=312); `object.mesh.setPointColor`, one undo step, none when the color is unchanged. The 5-pixel reach for a point is VectorCraft's own. Tests `a_color_dropped_on_a_selected_mesh_recolors_the_point_or_patch_under_it`, `a_click_on_a_selected_mesh_gives_its_point_or_patch_the_fill_color`, `a_click_on_an_object_over_a_selected_mesh_copies_that_object` | | Eyedropper reads visible sources while their layer/object is locked or outside isolation | done | Ordinary/Shift/Shift+Alt and gradient-stop reads preserve the source and selection; Alt reverse remains editable-only; hidden art stays excluded (`eyedropper_sources.rs`, #1251) | | Add a visible stroke after drawing with inherited None/zero-width paint | done | Paint and Swap Fill/Stroke restore the existing 1 pt default; positive widths and painted zero widths stay as set; Undo/Redo and targeted appearance items tested (`stroke_visibility.rs`, #1253) | | Double-click a stroked segment to create a width point in Width Point Edit | done | Finite-arithmetic follow-up: engine regressions and full CI passed; [Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area). Command and pointer regressions cover opening, sampled widths, adjoining adjustment on/off through checkbox/OK, compound paths, Cancel/Delete and Undo/Redo; dialog layout reviewed. [Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area) | From 7a2657f6c6155f94a3d00f2c053decf73ff7f869 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 22:41:27 -0800 Subject: [PATCH 020/226] Export 3D Object: a textured face keeps its opacity in the texture A face that is not opaque drew its texture over an opaque ground, and the material then applied the face's opacity to the whole texture, so an opaque graphic on a half-opaque face came out half opaque. - The texture draws the face's color at its opacity, so the graphics keep their own. - glTF's textured material takes its alpha from the texture (factor 1, BLEND), and USDA connects opacity to the UsdUVTexture's outputs:a. - OBJ writes -texture-1-opacity.png, the texture's alpha as gray levels, for the MTL's map_d, and d 1 on textured materials. --- crates/engine/src/cmd/assets.rs | 8 +- crates/engine/src/cmd/fileio.rs | 2 +- crates/engine/src/cmd/fileio/mesh3d.rs | 133 +++++++++++++------ crates/engine/src/cmd/fileio/mesh3d/tests.rs | 50 +++++-- crates/engine/src/tests/assets_3d.rs | 25 ++++ docs/mcp.md | 7 +- 6 files changed, 168 insertions(+), 57 deletions(-) diff --git a/crates/engine/src/cmd/assets.rs b/crates/engine/src/cmd/assets.rs index 205dee7973..ffa273e650 100644 --- a/crates/engine/src/cmd/assets.rs +++ b/crates/engine/src/cmd/assets.rs @@ -11,7 +11,7 @@ use vectorcraft_doc::{ExportAsset, NodeId}; use super::edit::{roots_of, selected_roots}; use super::fileio::{ DEFAULT_FORMAT_3D, FORMATS_3D, SCREEN_SETTINGS_KEYS, TEXTURE_SIZE, TEXTURE_SIZES, check_screen_settings, create_dir, export_crop, export_screens, - image_count, mesh_file_names, mesh_files, safe_file_name, store_screen_settings, textures, with_screen_export_preset, write_file, + image_maps, mesh_file_names, mesh_files, safe_file_name, store_screen_settings, textures, with_screen_export_preset, write_file, }; use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, checked_ids_param, cmd, has_doc, ok, str_param, switch_or, text_param}; @@ -80,7 +80,7 @@ pub fn specs() -> Vec { "Export 3D Assets", [], None, - "{assets?: [asset id…] (default every 3D asset), folder?, zip?, textureSize?: 128…4096 (default 1024: the pixels along the longer side of each face's texture)} each 3D asset's object as a mesh file in its format (assets.set3DFormat), named after the asset: USDA or USDZ, glTF 2.0 (one .gltf, its buffer embedded) or OBJ with its .mtl (whitespace and # in an OBJ's name become _). Every solid of the object (the fill's, each stroke's, a group's members') is a mesh with a material in the color it is painted; faces turned away from the viewer are included, at the object's 3D rotation, y up, about the point it turns about, in points (glTF: meters). The graphics mapped onto a plane or onto Extrude & Bevel's front or back cap (threeD.mapGraphic) are a PNG texture of that face: its color with the graphics drawn over it, flat and unlit, on a mesh of the face's own with texture coordinates; glTF embeds it, USDZ stores it after the layer, and OBJ and USDA write it beside them as -texture-1.png… (whitespace, # and @ become _). Graphics on Revolve's side are not exported. Files that would share a name get -2, -3…; an object with a hole that crosses its face's outline or another hole, or with more than 2,000,000 triangles, or textures of more than 67,108,864 pixels in one export, is refused → {files: [path…]} (no folder: {files: [{name, dataBase64}]}, or with zip one zip as {name, dataBase64, files})", + "{assets?: [asset id…] (default every 3D asset), folder?, zip?, textureSize?: 128…4096 (default 1024: the pixels along the longer side of each face's texture)} each 3D asset's object as a mesh file in its format (assets.set3DFormat), named after the asset: USDA or USDZ, glTF 2.0 (one .gltf, its buffer embedded) or OBJ with its .mtl (whitespace and # in an OBJ's name become _). Every solid of the object (the fill's, each stroke's, a group's members') is a mesh with a material in the color it is painted; faces turned away from the viewer are included, at the object's 3D rotation, y up, about the point it turns about, in points (glTF: meters). The graphics mapped onto a plane or onto Extrude & Bevel's front or back cap (threeD.mapGraphic) are a PNG texture of that face: its color with the graphics drawn over it, flat and unlit, on a mesh of the face's own with texture coordinates; glTF embeds it, USDZ stores it after the layer, and OBJ and USDA write it beside them as -texture-1.png… (whitespace, # and @ become _); a face that is not opaque keeps its opacity in the texture's alpha, and an OBJ also gets -texture-1-opacity.png…, the alpha as gray levels for its map_d. Graphics on Revolve's side are not exported. Files that would share a name get -2, -3…; an object with a hole that crosses its face's outline or another hole, or with more than 2,000,000 triangles, or textures of more than 67,108,864 pixels in one export, is refused → {files: [path…]} (no folder: {files: [{name, dataBase64}]}, or with zip one zip as {name, dataBase64, files})", has_doc, export_3d ), @@ -288,12 +288,12 @@ fn export_3d(s: &mut Session, p: &Value) -> Result { let parts = vectorcraft_render::effects::three_d_meshes_of_in(Some(d), nodes).map_err(|e| bad(C, format!("{what} can't be exported in 3D: {e}")))?; let pictures = textures(d, &parts, size, &mut pixels).map_err(|e| bad(C, format!("{what} can't be exported in 3D: {e}")))?; - let images = image_count(&pictures); + let images = image_maps(&pictures); let base = Some(safe_file_name(&a.name)).filter(|b| !b.is_empty()).unwrap_or_else(|| "Asset".into()); let mut stem = base.clone(); let mut k = 1; loop { - let names = mesh_file_names(&stem, format, images).map_err(|e| bad(C, e))?; + let names = mesh_file_names(&stem, format, &images).map_err(|e| bad(C, e))?; if names.iter().all(|n| !taken.contains(&n.to_lowercase())) { break; } diff --git a/crates/engine/src/cmd/fileio.rs b/crates/engine/src/cmd/fileio.rs index a5aa6e2cc2..397f959946 100644 --- a/crates/engine/src/cmd/fileio.rs +++ b/crates/engine/src/cmd/fileio.rs @@ -89,7 +89,7 @@ pub use load::{losses_summary, overwrite_losses}; #[cfg(test)] pub(crate) use mesh3d::MAX_TEXTURE_PIXELS; pub use mesh3d::{DEFAULT_FORMAT_3D, FORMATS_3D, draws_textures, format_3d_label}; -pub(crate) use mesh3d::{TEXTURE_SIZE, TEXTURE_SIZES, image_count, mesh_file_names, mesh_files, textures}; +pub(crate) use mesh3d::{TEXTURE_SIZE, TEXTURE_SIZES, image_maps, mesh_file_names, mesh_files, textures}; pub use naming::{NameParts as FileNameParts, parse_date as parse_file_date, render as render_file_name}; pub(crate) use native::preview_png; pub use native::with_compression_pref; diff --git a/crates/engine/src/cmd/fileio/mesh3d.rs b/crates/engine/src/cmd/fileio/mesh3d.rs index bc37a531b7..16acbb6958 100644 --- a/crates/engine/src/cmd/fileio/mesh3d.rs +++ b/crates/engine/src/cmd/fileio/mesh3d.rs @@ -60,23 +60,40 @@ fn obj_stem(stem: &str) -> String { /// The name of texture `k` (from 0) of the object named `stem`: whitespace, `#` and `@` become `_`, /// so an MTL `map_Kd` line and a USD asset path name it as one word. fn texture_name(stem: &str, k: usize) -> String { - let stem: String = stem.chars().map(|c| if c.is_whitespace() || c == '#' || c == '@' { '_' } else { c }).collect(); - format!("{stem}-texture-{}.png", k + 1) + format!("{}-texture-{}.png", texture_stem(stem), k + 1) } -/// The names of the files [`mesh_files`] writes for `stem` in `format` with `images` textures: OBJ -/// and USDA name a PNG file for each texture after them; glTF and USDZ hold theirs. -pub(crate) fn mesh_file_names(stem: &str, format: &str, images: usize) -> Result, String> { - let beside = |mut names: Vec, stem: &str| { - names.extend((0..images).map(|k| texture_name(stem, k))); +/// The name of the opacity map of texture `k` (from 0) of the object named `stem`, as +/// [`texture_name`] names the texture. +fn opacity_name(stem: &str, k: usize) -> String { + format!("{}-texture-{}-opacity.png", texture_stem(stem), k + 1) +} + +/// `stem` with whitespace, `#` and `@` turned into `_`, for the names of its textures. +fn texture_stem(stem: &str) -> String { + stem.chars().map(|c| if c.is_whitespace() || c == '#' || c == '@' { '_' } else { c }).collect() +} + +/// The names of the files [`mesh_files`] writes for `stem` in `format` with the textures `images` +/// ([`image_maps`]: for each, whether it has an opacity map): OBJ and USDA name a PNG file for each +/// texture after them, and OBJ also one for each opacity map, after its texture; glTF and USDZ hold +/// theirs. +pub(crate) fn mesh_file_names(stem: &str, format: &str, images: &[bool]) -> Result, String> { + let beside = |mut names: Vec, stem: &str, maps: bool| { + for (k, map) in images.iter().enumerate() { + names.push(texture_name(stem, k)); + if maps && *map { + names.push(opacity_name(stem, k)); + } + } names }; match format { "obj" => { let stem = obj_stem(stem); - Ok(beside(vec![format!("{stem}.obj"), format!("{stem}.mtl")], &stem)) + Ok(beside(vec![format!("{stem}.obj"), format!("{stem}.mtl")], &stem, true)) } - "usda" => Ok(beside(vec![format!("{stem}.usda")], stem)), + "usda" => Ok(beside(vec![format!("{stem}.usda")], stem, false)), "gltf" | "usdz" => Ok(vec![format!("{stem}.{format}")]), _ => { let key = "format"; @@ -87,22 +104,26 @@ pub(crate) fn mesh_file_names(stem: &str, format: &str, images: usize) -> Result /// A picture painted on one part of a 3D object ([`SolidMesh`]): a PNG, and for each corner of the /// part's mesh where it falls on the picture (0 to 1 across from the left, 0 to 1 down from the -/// top). +/// top). `opacity` is a grayscale PNG of the picture's alpha when some of it is not opaque. #[derive(Clone, Debug, PartialEq)] pub(crate) struct Texture { pub png: Arc>, + pub opacity: Option>>, pub uv: Vec<[f64; 2]>, } +/// A distinct picture of a 3D object: the PNG and its opacity map. +type Picture = (Arc>, Option>>); + /// The distinct pictures of `textures` in order of first use, and the index among them of each /// part's (`None` for a part without one). -fn images(parts: usize, textures: &[Option]) -> (Vec>>, Vec>) { - let mut out: Vec>> = vec![]; +fn images(parts: usize, textures: &[Option]) -> (Vec, Vec>) { + let mut out: Vec = vec![]; let index = (0..parts) .map(|k| { let t = textures.get(k)?.as_ref()?; - Some(out.iter().position(|p| Arc::ptr_eq(p, &t.png) || p == &t.png).unwrap_or_else(|| { - out.push(t.png.clone()); + Some(out.iter().position(|(p, _)| Arc::ptr_eq(p, &t.png) || p == &t.png).unwrap_or_else(|| { + out.push((t.png.clone(), t.opacity.clone())); out.len() - 1 })) }) @@ -110,24 +131,27 @@ fn images(parts: usize, textures: &[Option]) -> (Vec>>, Vec (out, index) } -/// The number of distinct pictures of `textures` ([`mesh_file_names`]). -pub(crate) fn image_count(textures: &[Option]) -> usize { - images(textures.len(), textures).0.len() +/// For each distinct picture of `textures`, whether it has an opacity map ([`mesh_file_names`]). +pub(crate) fn image_maps(textures: &[Option]) -> Vec { + images(textures.len(), textures).0.iter().map(|(_, map)| map.is_some()).collect() } /// The files of a 3D object named `stem` in `format` ([`FORMATS_3D`]): `(file name, bytes)`, the -/// OBJ with its MTL after it and the PNG files of `textures` last. `textures` holds the picture of -/// each part that has one, in the order of `parts`. +/// OBJ with its MTL after it and the PNG files of `textures` last (an OBJ's opacity maps each after +/// its texture). `textures` holds the picture of each part that has one, in the order of `parts`. pub(crate) fn mesh_files(stem: &str, format: &str, parts: &[SolidMesh], textures: &[Option]) -> Result)>, String> { - let (pictures, image) = images(parts.len(), textures); - let names = mesh_file_names(stem, format, pictures.len())?; - let scene = Scene { parts, textures, image: &image, pictures: &pictures }; + let (images, image) = images(parts.len(), textures); + let maps: Vec = images.iter().map(|(_, map)| map.is_some()).collect(); + let names = mesh_file_names(stem, format, &maps)?; + let pictures: Vec>> = images.iter().map(|(p, _)| p.clone()).collect(); + let scene = Scene { parts, textures, image: &image, pictures: &pictures, maps: &maps }; let pngs = || pictures.iter().map(|p| p.as_ref().clone()); let bytes: Vec> = match format { "obj" => { let stem = obj_stem(stem); let (obj, mtl) = obj(&stem, &scene); - [obj.into_bytes(), mtl.into_bytes()].into_iter().chain(pngs()).collect() + let with_maps = images.iter().flat_map(|(p, map)| std::iter::once(p.as_ref().clone()).chain(map.as_ref().map(|m| m.as_ref().clone()))); + [obj.into_bytes(), mtl.into_bytes()].into_iter().chain(with_maps).collect() } "gltf" => vec![gltf(stem, &scene).into_bytes()], "usda" => std::iter::once(usda(stem, &scene).into_bytes()).chain(pngs()).collect(), @@ -140,12 +164,14 @@ pub(crate) fn mesh_files(stem: &str, format: &str, parts: &[SolidMesh], textures Ok(names.into_iter().zip(bytes).collect()) } -/// The parts of an object with their pictures: `image` is each part's index among `pictures`. +/// The parts of an object with their pictures: `image` is each part's index among `pictures`, and +/// `maps` says for each picture whether it has an opacity map. struct Scene<'a> { parts: &'a [SolidMesh], textures: &'a [Option], image: &'a [Option], pictures: &'a [Arc>], + maps: &'a [bool], } impl Scene<'_> { @@ -244,10 +270,14 @@ fn obj(stem: &str, scene: &Scene) -> (String, String) { let _ = writeln!(m, "Kd {} {} {}", num(f64::from(c[0])), num(f64::from(c[1])), num(f64::from(c[2]))); } } - let _ = writeln!(m, "d {}", num(f64::from(c[3]))); + // A picture's opacity map holds the opacity, as gray levels. + let _ = writeln!(m, "d {}", if mat.image.is_some() { "1".to_string() } else { num(f64::from(c[3])) }); let _ = writeln!(m, "illum 1"); if let Some(i) = mat.image { let _ = writeln!(m, "map_Kd -clamp on {}", texture_name(stem, i)); + if scene.maps.get(i).copied().unwrap_or(false) { + let _ = writeln!(m, "map_d -clamp on {}", opacity_name(stem, i)); + } } } (o, m) @@ -306,8 +336,8 @@ fn gltf(stem: &str, scene: &Scene) -> String { "doubleSided": true, }); if let Some(i) = mat.image { - // The picture holds the color; the factor multiplies it. - m["pbrMetallicRoughness"]["baseColorFactor"] = json!([1.0, 1.0, 1.0, c[3]]); + // The picture holds the color and the opacity; the factor multiplies them. + m["pbrMetallicRoughness"]["baseColorFactor"] = json!([1.0, 1.0, 1.0, 1.0]); m["pbrMetallicRoughness"]["baseColorTexture"] = json!({ "index": i }); } if c[3] < 1.0 { @@ -400,14 +430,20 @@ fn usda(stem: &str, scene: &Scene) -> String { let _ = writeln!(u, " def Shader \"Surface\"\n {{"); let _ = writeln!(u, " uniform token info:id = \"UsdPreviewSurface\""); match mat.image { + // The picture holds the color, and the opacity when the face is not opaque. Some(_) => { let _ = writeln!(u, " color3f inputs:diffuseColor.connect = <{at}/Texture.outputs:rgb>"); + if c[3] < 1.0 { + let _ = writeln!(u, " float inputs:opacity.connect = <{at}/Texture.outputs:a>"); + } else { + let _ = writeln!(u, " float inputs:opacity = 1"); + } } None => { let _ = writeln!(u, " color3f inputs:diffuseColor = ({}, {}, {})", linear(c[0]), linear(c[1]), linear(c[2])); + let _ = writeln!(u, " float inputs:opacity = {}", c[3]); } } - let _ = writeln!(u, " float inputs:opacity = {}", c[3]); let _ = writeln!(u, " float inputs:roughness = 1"); let _ = writeln!(u, " token outputs:surface\n }}"); if let Some(i) = mat.image { @@ -418,7 +454,11 @@ fn usda(stem: &str, scene: &Scene) -> String { let _ = writeln!(u, " token inputs:sourceColorSpace = \"sRGB\""); let _ = writeln!(u, " token inputs:wrapS = \"clamp\""); let _ = writeln!(u, " token inputs:wrapT = \"clamp\""); - let _ = writeln!(u, " float3 outputs:rgb\n }}"); + let _ = writeln!(u, " float3 outputs:rgb"); + if c[3] < 1.0 { + let _ = writeln!(u, " float outputs:a"); + } + let _ = writeln!(u, " }}"); let _ = writeln!(u, "\n def Shader \"Coordinates\"\n {{"); let _ = writeln!(u, " uniform token info:id = \"UsdPrimvarReader_float2\""); let _ = writeln!(u, " string inputs:varname = \"st\""); @@ -438,7 +478,8 @@ fn usda(stem: &str, scene: &Scene) -> String { /// far, and every call of one export shares it: an error when it passes [`MAX_TEXTURE_PIXELS`]. pub(crate) fn textures(doc: &Document, parts: &[SolidMesh], size: u32, pixels: &mut u64) -> Result>, String> { let mut renderer: Option = None; - // Each picture drawn: the part it was drawn for, its bounds, and the PNG (`None`: nothing drawn). + // Each picture drawn: the part it was drawn for, its bounds, and the PNG with its opacity map + // (`None`: nothing drawn). let mut drawn: Vec = vec![]; let mut out = vec![]; for part in parts { @@ -467,16 +508,16 @@ pub(crate) fn textures(doc: &Document, parts: &[SolidMesh], size: u32, pixels: & )); } let renderer = renderer.get_or_insert_with(vectorcraft_render::Renderer::new); - Some(Arc::new(picture(doc, renderer, part.color, art, (frame, scale), (w, h))?)) + Some(picture(doc, renderer, part.color, art, (frame, scale), (w, h))?) } }; drawn.push((part, frame, png.clone())); png } }; - out.push(png.map(|png| { + out.push(png.map(|(png, opacity)| { let uv = g.art.iter().map(|p| [(p.x - frame.x0) * scale / f64::from(w), (p.y - frame.y0) * scale / f64::from(h)]).collect(); - Texture { png, uv } + Texture { png, opacity, uv } })); } Ok(out) @@ -498,16 +539,17 @@ fn texture_frame(g: &MeshGraphics) -> Option { g.art_bounds().filter(|r| r.width() > 1e-9 && r.height() > 1e-9 && r.width().is_finite() && r.height().is_finite()) } -/// A picture [`textures`] drew: the part, the bounds and the PNG. -type Drawn<'a> = (&'a SolidMesh, Rect, Option>>); +/// A picture [`textures`] drew: the part, the bounds and the PNG with its opacity map. +type Drawn<'a> = (&'a SolidMesh, Rect, Option); /// Do `a` and `b` draw the same graphics on their face? fn same_graphics(a: &MeshGraphics, b: &MeshGraphics) -> bool { a.face == b.face && a.center == b.center && a.graphics == b.graphics } -/// `art` drawn over `color` (opaque) as a PNG of `w` × `h` pixels whose top left is `frame`'s top -/// left, at `scale` pixels a point. +/// `art` drawn over `color` (at its opacity) as a PNG of `w` × `h` pixels whose top left is `frame`'s +/// top left, at `scale` pixels a point, with a grayscale PNG of its alpha when some of it is not +/// opaque. fn picture( doc: &Document, renderer: &mut vectorcraft_render::Renderer, @@ -515,16 +557,27 @@ fn picture( art: Node, (frame, scale): (Rect, f64), (w, h): (u32, u32), -) -> Result, String> { +) -> Result { // The color reaches two pixels past the frame, so the picture's edge pixels are covered. let reach = 2.0 / scale; let back = Rect::new(frame.x0 - reach, frame.y0 - reach, frame.x0 + f64::from(w) / scale + reach, frame.y0 + f64::from(h) / scale + reach); let fill = Paint::solid(Color::rgb(color[0], color[1], color[2])); - let ground = Node::path(NodeId(0), vectorcraft_geom::shapes::rectangle(back), Appearance::basic(fill, Paint::None, 0.0)); + let mut ground = Node::path(NodeId(0), vectorcraft_geom::shapes::rectangle(back), Appearance::basic(fill, Paint::None, 0.0)); + ground.opacity = color[3]; let group = Arc::new(Node::group(NodeId(0), vec![Arc::new(ground), Arc::new(art)])); let (pw, ph) = (u16::try_from(w).map_err(|_| "texture too large")?, u16::try_from(h).map_err(|_| "texture too large")?); let view = Affine::scale(scale) * Affine::translate((-frame.x0, -frame.y0)); - renderer.render_node(doc, &group, pw, ph, view).ok_or_else(|| "the graphics could not be drawn".to_string())?.to_png() + let drawn = renderer.render_node(doc, &group, pw, ph, view).ok_or_else(|| "the graphics could not be drawn".to_string())?; + let alpha: Vec = drawn.pixels.iter().skip(3).step_by(4).copied().collect(); + let opacity = if alpha.iter().all(|a| *a == 255) { + None + } else { + let gray = image::GrayImage::from_raw(w, h, alpha).ok_or("the texture's opacity could not be drawn")?; + let mut png = vec![]; + gray.write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png).map_err(|e| format!("PNG encoding failed: {e}"))?; + Some(Arc::new(png)) + }; + Ok((Arc::new(drawn.to_png()?), opacity)) } #[cfg(test)] diff --git a/crates/engine/src/cmd/fileio/mesh3d/tests.rs b/crates/engine/src/cmd/fileio/mesh3d/tests.rs index 6313b16762..876140fce7 100644 --- a/crates/engine/src/cmd/fileio/mesh3d/tests.rs +++ b/crates/engine/src/cmd/fileio/mesh3d/tests.rs @@ -107,8 +107,8 @@ fn an_obj_names_its_mtl_file_without_spaces_or_comment_marks() { let files = plain_files("Box #1", "obj", &[square(RED)]).unwrap(); assert_eq!(files.iter().map(|(n, _)| n.as_str()).collect::>(), ["Box__1.obj", "Box__1.mtl"]); assert!(text(&files, "Box__1.obj").starts_with("mtllib Box__1.mtl\n")); - assert_eq!(mesh_file_names("Box #1", "obj", 0).unwrap(), ["Box__1.obj", "Box__1.mtl"]); - assert_eq!(mesh_file_names("Box #1", "usda", 0).unwrap(), ["Box #1.usda"]); + assert_eq!(mesh_file_names("Box #1", "obj", &[]).unwrap(), ["Box__1.obj", "Box__1.mtl"]); + assert_eq!(mesh_file_names("Box #1", "usda", &[]).unwrap(), ["Box #1.usda"]); } #[test] @@ -125,8 +125,8 @@ fn obj_and_usda_keep_coordinates_a_32_bit_float_would_merge() { #[test] fn an_unknown_format_is_refused() { assert!(plain_files("Box", "fbx", &[square(RED)]).is_err()); - assert!(mesh_file_names("Box", "", 0).is_err()); - assert_eq!(mesh_file_names("Box", "obj", 0).unwrap(), ["Box.obj", "Box.mtl"]); + assert!(mesh_file_names("Box", "", &[]).is_err()); + assert_eq!(mesh_file_names("Box", "obj", &[]).unwrap(), ["Box.obj", "Box.mtl"]); } #[test] @@ -140,7 +140,7 @@ fn prim_names_are_usd_identifiers() { /// A red square, then a blue one whose corners show picture `png` (u to the right, v down). fn textured(png: &[u8]) -> (Vec, Vec>) { let uv = vec![[0.0, 1.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0], [1.0, 0.0], [0.0, 0.0]]; - let texture = Texture { png: Arc::new(png.to_vec()), uv }; + let texture = Texture { png: Arc::new(png.to_vec()), opacity: None, uv }; (vec![square(RED), square(BLUE)], vec![None, Some(texture)]) } @@ -158,7 +158,7 @@ fn each_format_carries_a_textured_part_with_its_coordinates_and_picture() { assert_eq!(obj.lines().rfind(|l| l.starts_with("f ")), Some("f 10/4/10 11/5/11 12/6/12")); assert!(obj.contains("f 1//1 2//2 3//3"), "the plain part keeps no texture coordinates"); let mtl = text(&files, "My_Box.mtl"); - assert!(mtl.contains("newmtl Material_2\nKd 1 1 1\nd 0.5\nillum 1\nmap_Kd -clamp on My_Box-texture-1.png\n"), "{mtl}"); + assert!(mtl.contains("newmtl Material_2\nKd 1 1 1\nd 1\nillum 1\nmap_Kd -clamp on My_Box-texture-1.png\n"), "{mtl}"); assert_eq!(mtl.matches("map_Kd").count(), 1); // glTF: TEXCOORD_0 down from the top, and the picture embedded as a data URI. let g: Value = serde_json::from_str(&text(&mesh_files("Box", "gltf", &parts, &pictures).unwrap(), "Box.gltf")).unwrap(); @@ -173,7 +173,7 @@ fn each_format_carries_a_textured_part_with_its_coordinates_and_picture() { assert_eq!(first, [0.0, 1.0]); let material = &g["materials"][prims[1]["material"].as_u64().unwrap() as usize]; assert_eq!(material["pbrMetallicRoughness"]["baseColorTexture"]["index"], 0); - assert_eq!(material["pbrMetallicRoughness"]["baseColorFactor"], serde_json::json!([1.0, 1.0, 1.0, 0.5])); + assert_eq!(material["pbrMetallicRoughness"]["baseColorFactor"], serde_json::json!([1.0, 1.0, 1.0, 1.0])); assert_eq!(g["textures"][0]["source"], 0); assert_eq!(g["samplers"][0]["wrapS"], 33071); let image = g["images"][0]["uri"].as_str().unwrap().strip_prefix("data:image/png;base64,").unwrap(); @@ -204,16 +204,46 @@ fn each_format_carries_a_textured_part_with_its_coordinates_and_picture() { assert_eq!(&zip[data..data + png.len()], png.as_slice()); } +#[test] +fn a_textured_face_that_is_not_opaque_takes_its_opacity_from_the_picture() { + let (parts, mut pictures) = textured(b"picture"); + if let Some(t) = pictures[1].as_mut() { + t.opacity = Some(Arc::new(b"gray".to_vec())); + } + // OBJ: the opacity map, written after its texture, is the MTL's map_d. + let files = mesh_files("My Box", "obj", &parts, &pictures).unwrap(); + let names: Vec<&str> = files.iter().map(|(n, _)| n.as_str()).collect(); + assert_eq!(names, ["My_Box.obj", "My_Box.mtl", "My_Box-texture-1.png", "My_Box-texture-1-opacity.png"]); + assert_eq!(files[3].1, b"gray"); + assert_eq!(mesh_file_names("My Box", "obj", &image_maps(&pictures)).unwrap(), names); + let mtl = text(&files, "My_Box.mtl"); + assert!(mtl.contains("d 1\nillum 1\nmap_Kd -clamp on My_Box-texture-1.png\nmap_d -clamp on My_Box-texture-1-opacity.png\n"), "{mtl}"); + let g: Value = serde_json::from_str(&text(&mesh_files("Box", "gltf", &parts, &pictures).unwrap(), "Box.gltf")).unwrap(); + let material = &g["materials"][1]; + assert_eq!((material["pbrMetallicRoughness"]["baseColorFactor"][3].as_f64(), material["alphaMode"].as_str()), (Some(1.0), Some("BLEND"))); + let usda = mesh_files("Box", "usda", &parts, &pictures).unwrap(); + assert_eq!(usda.len(), 2, "USD reads the opacity from the texture's alpha"); + let u = text(&usda, "Box.usda"); + assert!(u.contains("float inputs:opacity.connect = ") && u.contains("float outputs:a"), "{u}"); + // An opaque textured face reads no opacity from its picture. + let (_, plain) = textured(b"picture"); + let opaque = vec![square(RED), square([0.0, 0.0, 1.0, 1.0])]; + let u = text(&mesh_files("Box", "usda", &opaque, &plain).unwrap(), "Box.usda"); + assert!(!u.contains("outputs:a") && u.contains("float inputs:opacity = 1"), "{u}"); + let mtl = text(&mesh_files("Box", "obj", &opaque, &plain).unwrap(), "Box.mtl"); + assert!(!mtl.contains("map_d") && mtl.contains("Kd 1 1 1\nd 1\n"), "{mtl}"); +} + #[test] fn parts_sharing_a_picture_write_it_once() { let (mut parts, mut pictures) = textured(b"one"); parts.push(square(BLUE)); pictures.push(pictures[1].clone()); - assert_eq!(image_count(&pictures), 1); + assert_eq!(image_maps(&pictures), [false]); let files = mesh_files("Box", "obj", &parts, &pictures).unwrap(); assert_eq!(files.len(), 3); assert_eq!(text(&files, "Box.mtl").matches("newmtl").count(), 2, "the blue parts share the textured material"); - assert_eq!(mesh_file_names("Box", "usda", 2).unwrap(), ["Box.usda", "Box-texture-1.png", "Box-texture-2.png"]); - assert_eq!(mesh_file_names("A @b", "gltf", 2).unwrap(), ["A @b.gltf"]); + assert_eq!(mesh_file_names("Box", "usda", &[false, true]).unwrap(), ["Box.usda", "Box-texture-1.png", "Box-texture-2.png"]); + assert_eq!(mesh_file_names("A @b", "gltf", &[false, false]).unwrap(), ["A @b.gltf"]); assert_eq!(texture_name("A @b#c", 0), "A__b_c-texture-1.png"); } diff --git a/crates/engine/src/tests/assets_3d.rs b/crates/engine/src/tests/assets_3d.rs index dad1cc2b76..c7dd8edd5e 100644 --- a/crates/engine/src/tests/assets_3d.rs +++ b/crates/engine/src/tests/assets_3d.rs @@ -273,6 +273,31 @@ fn export_3d_paints_mapped_graphics_on_their_caps_in_every_format() { assert_eq!(image::load_from_memory(&png).unwrap().to_rgba8().dimensions(), (1024, 1024), "1024 pixels by default"); } +#[test] +fn a_half_opaque_face_keeps_its_graphics_opaque_in_the_texture() { + let (mut s, asset) = mapped("usda"); + let doc = &s.active().unwrap().doc; + let id = doc.asset(asset).unwrap().nodes[0]; + let fill = doc.node(id).unwrap().appearance.items.iter().position(|i| matches!(i, vectorcraft_doc::AppearanceItem::Fill(_))).unwrap(); + run(&mut s, "select.set", json!({"ids": [id.0]})); + run(&mut s, "transparency.set", json!({"item": fill, "opacity": 50})); + let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); + // The graphic stays opaque where it covers the face, and the face around it is half opaque. + let front = &out[1].1; + assert_eq!(pixel(front, 64, 64), [255, 0, 0, 255]); + let around = pixel(front, 2, 2); + assert!(around[2] > 200 && (120..=135).contains(&around[3]), "{around:?}"); + let usda = String::from_utf8(out[0].1.clone()).unwrap(); + assert!(usda.contains("float inputs:opacity.connect"), "the texture's alpha is the opacity"); + // An OBJ's opacity map has the alpha as gray levels. + run(&mut s, "assets.set3DFormat", json!({"assets": [asset], "format": "obj"})); + let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); + assert_eq!(out[3].0, "Box-texture-1-opacity.png"); + let gray = image::load_from_memory(&out[3].1).unwrap().to_luma8(); + assert_eq!(gray.get_pixel(64, 64).0, [255]); + assert!((120..=135).contains(&gray.get_pixel(2, 2).0[0]), "{:?}", gray.get_pixel(2, 2)); +} + #[test] fn export_3d_keeps_flat_colors_without_graphics_and_refuses_bad_texture_sizes() { let (mut s, asset) = mapped("obj"); diff --git a/docs/mcp.md b/docs/mcp.md index 2f1a67ff21..d48b4edc0f 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -8336,11 +8336,14 @@ page, those turned away from the viewer included, at the object's 3D rotation, y about: in points (USD's layer gives `metersPerUnit`), in meters in glTF. Files that would share a name get `-2`, `-3` and so on. Graphics mapped onto a plane or onto Extrude & Bevel's front or back cap (`threeD.mapGraphic`) are exported as a PNG texture of that face: the face's color with its graphics drawn over it, flat and unlit, on a mesh of the face's own -triangles with texture coordinates and a material that shows the texture. glTF embeds the PNG as a data URI +triangles with texture coordinates and a material that shows the texture. A face that is not opaque keeps its opacity +in the texture's alpha, and the graphics keep their own. glTF embeds the PNG as a data URI (`TEXCOORD_0`, `baseColorTexture`), USDZ stores it after the layer, USDA reads it through `primvars:st`, a `UsdPrimvarReader_float2` and a `UsdUVTexture` connected to the surface's `diffuseColor`, and OBJ gives `vt` coordinates and an MTL `map_Kd`; OBJ and USDA write the PNG beside them as `-texture-1.png`, `-texture-2.png` and so on -(whitespace, `#` and `@` become `_`). Faces with the same color, graphics and bounds share one texture. `textureSize` (128 to +(whitespace, `#` and `@` become `_`). USD reads a face's opacity from the texture's alpha (`outputs:a`), and an OBJ +whose face is not opaque also gets `-texture-1-opacity.png`, the alpha as gray levels, for the MTL's `map_d`. +Faces with the same color, graphics and bounds share one texture. `textureSize` (128 to 4096, default 1024, VectorCraft's own values) is the number of pixels along the longer side of each texture; one export draws at most 67,108,864 texture pixels in all, and past that it is refused. Graphics on Revolve's side are not exported yet. The layouts follow glTF 2.0, UsdPreviewSurface () From c63cbc4b2db5c75a1029c18d31bbb4fe79caece4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 00:06:54 -0800 Subject: [PATCH 021/226] Export 3D Object: a texture takes the face's and the object's opacity as the canvas draws them The texture drew its graphics opaque whatever the object's opacity, and a gradient's clear stops would have made the graphics on it clear. - The graphics are drawn at the opacity of the face's fill or stroke, the face at its paint's opacity, and the object's opacity applies to the whole texture, as on the canvas. - A gradient's stops set the face's opacity only, so a graphic on a gradient with clear stops stays visible. --- crates/effects/src/solids.rs | 23 +++++++++------- crates/effects/src/solids/graphics.rs | 6 +++++ crates/engine/src/cmd/fileio/mesh3d.rs | 25 +++++++++++------- crates/engine/src/tests/assets_3d.rs | 36 ++++++++++++++++++++------ 4 files changed, 64 insertions(+), 26 deletions(-) diff --git a/crates/effects/src/solids.rs b/crates/effects/src/solids.rs index 763559300c..d8c8a621ea 100644 --- a/crates/effects/src/solids.rs +++ b/crates/effects/src/solids.rs @@ -2277,10 +2277,11 @@ impl SolidMesh { } /// The parts of `mesh`, a solid that 3D effect `id` with parameters `p` built about `bounds`, painted -/// `color`: for each planar face that carries graphics (Extrude & Bevel's caps, the plane), the -/// triangles on it as a mesh of their own with the art point of each corner ([`MeshGraphics`]), -/// then the rest. Revolve's side, whose graphics are not mapped onto its mesh, stays plain. -fn split_graphics(id: &str, p: &Value, bounds: Rect, mesh: Mesh, color: [f32; 4]) -> Vec { +/// `color` from a fill or stroke at `opacity`: for each planar face that carries graphics (Extrude & +/// Bevel's caps, the plane), the triangles on it as a mesh of their own with the art point of each +/// corner ([`MeshGraphics`]), then the rest. Revolve's side, whose graphics are not mapped onto its +/// mesh, stays plain. +fn split_graphics(id: &str, p: &Value, bounds: Rect, mesh: Mesh, (color, opacity): ([f32; 4], f32)) -> Vec { let list = graphics::mapped_graphics(p); if list.is_empty() || !takes_graphics(id) || id == crate::REVOLVE { return vec![SolidMesh::plain(mesh, color)]; @@ -2320,7 +2321,8 @@ fn split_graphics(id: &str, p: &Value, bounds: Rect, mesh: Mesh, color: [f32; 4] rest = left; if !taken.is_empty() { let graphics = list.iter().filter(|g| g.face == face).cloned().collect(); - out.push(SolidMesh { mesh: taken, color, graphics: Some(MeshGraphics { face, graphics, center: bounds.center(), art }) }); + let graphics = MeshGraphics { face, graphics, center: bounds.center(), art, opacity, object: 1.0 }; + out.push(SolidMesh { mesh: taken, color, graphics: Some(graphics) }); } } if !rest.is_empty() { @@ -2369,15 +2371,15 @@ fn meshes_for(fx: &Effect, shapes: &[Profile], total: &mut usize, limit: usize) let view = view_options(&p); let mut out = vec![]; // A solid's parts with and without graphics count together against the limit. - let mut keep = |out: &mut Vec, mesh: Mesh, color: [f32; 4], bounds: Rect| { - split_graphics(&fx.id, &p, bounds, mesh, color).into_iter().try_for_each(|part| keep_mesh(out, total, part, limit)) + let mut keep = |out: &mut Vec, mesh: Mesh, (paint, opacity): (&Paint, f32), bounds: Rect| { + split_graphics(&fx.id, &p, bounds, mesh, (mesh_color(paint, opacity), opacity)).into_iter().try_for_each(|part| keep_mesh(out, total, part, limit)) }; if is_plane(&fx.id) { for s in shapes { for item in &s.items { let (paint, opacity, _) = paint_of(item, s.opacity); let (area, rule) = region(&s.path, s.rule, item); - keep(&mut out, vectorcraft_three_d::plane_mesh(&area, rule, b, view)?, mesh_color(&paint, opacity), b)?; + keep(&mut out, vectorcraft_three_d::plane_mesh(&area, rule, b, view)?, (&paint, opacity), b)?; } } return Ok(out); @@ -2414,7 +2416,7 @@ fn meshes_for(fx: &Effect, shapes: &[Profile], total: &mut usize, limit: usize) match solid.mesh() { Ok(mesh) => { let (paint, opacity, _) = paint_of(item, *member); - keep(&mut out, mesh, mesh_color(&paint, opacity), bounds)?; + keep(&mut out, mesh, (&paint, opacity), bounds)?; } Err(_) if matches!(item, AppearanceItem::Stroke(_)) => {} Err(e) => return Err(e), @@ -2502,6 +2504,9 @@ fn meshes_within(doc: Option<&Document>, n: &Node, total: &mut usize, limit: usi .filter(|m| !m.mesh.is_empty()) .map(|mut m| { m.color[3] *= n.opacity.clamp(0.0, 1.0); + if let Some(g) = &mut m.graphics { + g.object *= n.opacity.clamp(0.0, 1.0); + } m }) .collect(); diff --git a/crates/effects/src/solids/graphics.rs b/crates/effects/src/solids/graphics.rs index 7dc9aa5e44..7ef2fe4e28 100644 --- a/crates/effects/src/solids/graphics.rs +++ b/crates/effects/src/solids/graphics.rs @@ -530,6 +530,12 @@ pub struct MeshGraphics { pub center: Point, /// One for each position of the mesh. pub art: Vec, + /// The opacity of the fill or stroke the face is painted with, which the graphics take too, as + /// the canvas draws them; neither a gradient's stops nor the object's own opacity is in it. + pub opacity: f32, + /// The opacity of the object the face belongs to, which applies to the face and its graphics + /// together. + pub object: f32, } impl MeshGraphics { diff --git a/crates/engine/src/cmd/fileio/mesh3d.rs b/crates/engine/src/cmd/fileio/mesh3d.rs index 16acbb6958..2e781772ea 100644 --- a/crates/engine/src/cmd/fileio/mesh3d.rs +++ b/crates/engine/src/cmd/fileio/mesh3d.rs @@ -508,7 +508,7 @@ pub(crate) fn textures(doc: &Document, parts: &[SolidMesh], size: u32, pixels: & )); } let renderer = renderer.get_or_insert_with(vectorcraft_render::Renderer::new); - Some(picture(doc, renderer, part.color, art, (frame, scale), (w, h))?) + Some(picture(doc, renderer, (part.color, g.opacity, g.object), art, (frame, scale), (w, h))?) } }; drawn.push((part, frame, png.clone())); @@ -544,17 +544,19 @@ type Drawn<'a> = (&'a SolidMesh, Rect, Option); /// Do `a` and `b` draw the same graphics on their face? fn same_graphics(a: &MeshGraphics, b: &MeshGraphics) -> bool { - a.face == b.face && a.center == b.center && a.graphics == b.graphics + a.face == b.face && a.center == b.center && a.graphics == b.graphics && a.opacity == b.opacity && a.object == b.object } -/// `art` drawn over `color` (at its opacity) as a PNG of `w` × `h` pixels whose top left is `frame`'s -/// top left, at `scale` pixels a point, with a grayscale PNG of its alpha when some of it is not -/// opaque. +/// `art` drawn over `color` as a PNG of `w` × `h` pixels whose top left is `frame`'s top left, at +/// `scale` pixels a point, with a grayscale PNG of its alpha when some of it is not opaque. As on +/// the canvas, the art is drawn at `face` (the opacity of the face's fill or stroke), the color at +/// its own opacity without `object`'s, and `object` (the object's opacity) applies to the whole +/// picture. fn picture( doc: &Document, renderer: &mut vectorcraft_render::Renderer, - color: [f32; 4], - art: Node, + (color, face, object): ([f32; 4], f32, f32), + mut art: Node, (frame, scale): (Rect, f64), (w, h): (u32, u32), ) -> Result { @@ -563,8 +565,13 @@ fn picture( let back = Rect::new(frame.x0 - reach, frame.y0 - reach, frame.x0 + f64::from(w) / scale + reach, frame.y0 + f64::from(h) / scale + reach); let fill = Paint::solid(Color::rgb(color[0], color[1], color[2])); let mut ground = Node::path(NodeId(0), vectorcraft_geom::shapes::rectangle(back), Appearance::basic(fill, Paint::None, 0.0)); - ground.opacity = color[3]; - let group = Arc::new(Node::group(NodeId(0), vec![Arc::new(ground), Arc::new(art)])); + let unit = |v: f32| if v.is_finite() { v.clamp(0.0, 1.0) } else { 0.0 }; + let object = unit(object); + ground.opacity = if object > 0.0 { unit(color[3] / object) } else { 0.0 }; + art.opacity *= unit(face); + let mut group = Node::group(NodeId(0), vec![Arc::new(ground), Arc::new(art)]); + group.opacity = object; + let group = Arc::new(group); let (pw, ph) = (u16::try_from(w).map_err(|_| "texture too large")?, u16::try_from(h).map_err(|_| "texture too large")?); let view = Affine::scale(scale) * Affine::translate((-frame.x0, -frame.y0)); let drawn = renderer.render_node(doc, &group, pw, ph, view).ok_or_else(|| "the graphics could not be drawn".to_string())?; diff --git a/crates/engine/src/tests/assets_3d.rs b/crates/engine/src/tests/assets_3d.rs index c7dd8edd5e..a9b2793885 100644 --- a/crates/engine/src/tests/assets_3d.rs +++ b/crates/engine/src/tests/assets_3d.rs @@ -274,7 +274,10 @@ fn export_3d_paints_mapped_graphics_on_their_caps_in_every_format() { } #[test] -fn a_half_opaque_face_keeps_its_graphics_opaque_in_the_texture() { +fn a_texture_takes_the_opacity_of_the_fill_and_of_the_object_as_the_canvas_draws_them() { + let half = |a: u8| (120..=135).contains(&a); + // A half-opaque fill: the face and the graphic over it are each drawn at half opacity, so the + // graphic covers three quarters. let (mut s, asset) = mapped("usda"); let doc = &s.active().unwrap().doc; let id = doc.asset(asset).unwrap().nodes[0]; @@ -282,11 +285,9 @@ fn a_half_opaque_face_keeps_its_graphics_opaque_in_the_texture() { run(&mut s, "select.set", json!({"ids": [id.0]})); run(&mut s, "transparency.set", json!({"item": fill, "opacity": 50})); let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); - // The graphic stays opaque where it covers the face, and the face around it is half opaque. - let front = &out[1].1; - assert_eq!(pixel(front, 64, 64), [255, 0, 0, 255]); - let around = pixel(front, 2, 2); - assert!(around[2] > 200 && (120..=135).contains(&around[3]), "{around:?}"); + let (on, around) = (pixel(&out[1].1, 64, 64), pixel(&out[1].1, 2, 2)); + assert!(on[0] > on[2] && (185..=197).contains(&on[3]), "{on:?}"); + assert!(around[2] > 200 && half(around[3]), "{around:?}"); let usda = String::from_utf8(out[0].1.clone()).unwrap(); assert!(usda.contains("float inputs:opacity.connect"), "the texture's alpha is the opacity"); // An OBJ's opacity map has the alpha as gray levels. @@ -294,8 +295,27 @@ fn a_half_opaque_face_keeps_its_graphics_opaque_in_the_texture() { let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); assert_eq!(out[3].0, "Box-texture-1-opacity.png"); let gray = image::load_from_memory(&out[3].1).unwrap().to_luma8(); - assert_eq!(gray.get_pixel(64, 64).0, [255]); - assert!((120..=135).contains(&gray.get_pixel(2, 2).0[0]), "{:?}", gray.get_pixel(2, 2)); + let (g_on, g_around) = (gray.get_pixel(64, 64).0[0], gray.get_pixel(2, 2).0[0]); + assert!((185..=197).contains(&g_on) && half(g_around), "{g_on} {g_around}"); + // A half-opaque object: the face and the graphic are drawn opaque, and the whole picture at + // half opacity. + let (mut s, asset) = mapped("usda"); + let id = s.active().unwrap().doc.asset(asset).unwrap().nodes[0]; + run(&mut s, "transparency.set", json!({"ids": [id.0], "opacity": 50})); + let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); + let (on, around) = (pixel(&out[1].1, 64, 64), pixel(&out[1].1, 2, 2)); + assert!(on[0] > 200 && on[2] < 50 && half(on[3]), "{on:?}"); + assert!(around[2] > 200 && around[0] < 50 && half(around[3]), "{around:?}"); + // A gradient whose stops are clear: the face is clear, and the graphic keeps its opacity. + let (mut s, asset) = mapped("usda"); + let id = s.active().unwrap().doc.asset(asset).unwrap().nodes[0]; + run(&mut s, "select.set", json!({"ids": [id.0]})); + let clear = json!({"stops": [{"offset": 0, "color": "#0000ff", "opacity": 0}, {"offset": 1, "color": "#0000ff", "opacity": 0}]}); + run(&mut s, "paint.setFill", json!({"gradient": clear})); + let out = files(&run(&mut s, "assets.export3D", json!({"textureSize": 128}))); + let (on, around) = (pixel(&out[1].1, 64, 64), pixel(&out[1].1, 2, 2)); + assert!(is_red(on), "{on:?}"); + assert_eq!(around[3], 0, "{around:?}"); } #[test] From 54acbab14e05d84df66e888ee1bc9b9cb0760172 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 00:43:38 -0800 Subject: [PATCH 022/226] Export 3D Object: docs say a texture's graphics take the fill's opacity docs/mcp.md said the graphics keep their own opacity; they take the opacity of the face's fill or stroke, and the object's opacity applies to the face and its graphics together. The split of a solid's mesh is laid out as rustfmt writes it. --- crates/effects/src/solids.rs | 4 +++- docs/mcp.md | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/effects/src/solids.rs b/crates/effects/src/solids.rs index eb1c844cdc..d25b84b46d 100644 --- a/crates/effects/src/solids.rs +++ b/crates/effects/src/solids.rs @@ -2389,7 +2389,9 @@ fn meshes_for(fx: &Effect, shapes: &[Profile], total: &mut usize, limit: usize) let mut out = vec![]; // A solid's parts with and without graphics count together against the limit. let mut keep = |out: &mut Vec, mesh: Mesh, (paint, opacity): (&Paint, f32), bounds: Rect| { - split_graphics(&fx.id, &p, bounds, mesh, (mesh_color(paint, opacity), opacity)).into_iter().try_for_each(|part| keep_mesh(out, total, part, limit)) + split_graphics(&fx.id, &p, bounds, mesh, (mesh_color(paint, opacity), opacity)) + .into_iter() + .try_for_each(|part| keep_mesh(out, total, part, limit)) }; if is_plane(&fx.id) { for s in shapes { diff --git a/docs/mcp.md b/docs/mcp.md index 41c15b2f8c..98f1db0cd9 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -8453,7 +8453,8 @@ about: in points (USD's layer gives `metersPerUnit`), in meters in glTF. Files t Graphics mapped onto a plane or onto Extrude & Bevel's front or back cap (`threeD.mapGraphic`) are exported as a PNG texture of that face: the face's color with its graphics drawn over it, flat and unlit, on a mesh of the face's own triangles with texture coordinates and a material that shows the texture. A face that is not opaque keeps its opacity -in the texture's alpha, and the graphics keep their own. glTF embeds the PNG as a data URI +in the texture's alpha: as on the canvas, the graphics take the opacity of the face's fill or stroke, and the object's +opacity applies to the face and its graphics together. glTF embeds the PNG as a data URI (`TEXCOORD_0`, `baseColorTexture`), USDZ stores it after the layer, USDA reads it through `primvars:st`, a `UsdPrimvarReader_float2` and a `UsdUVTexture` connected to the surface's `diffuseColor`, and OBJ gives `vt` coordinates and an MTL `map_Kd`; OBJ and USDA write the PNG beside them as `-texture-1.png`, `-texture-2.png` and so on From a46dc5df3729df786222e390bacbc2c6661aea9b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 06:35:15 -0800 Subject: [PATCH 023/226] 3D: a cap far from the page origin takes no bevel treads for its textures The mesh face measured mesh points from where art point (0, 0) lands, and scaled its plane tolerance by that distance. For art about 10 million points from the page origin the tolerance grew to tens of points, so the cap-parallel treads of a Step bevel took the cap's mapped graphics. The face now measures mesh points from the art's center, and the tolerance follows the solid's size only. --- crates/three-d/src/solid/face_map.rs | 28 +++++++++++++--------- crates/three-d/src/solid/tests_face_map.rs | 21 ++++++++++++++++ 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/crates/three-d/src/solid/face_map.rs b/crates/three-d/src/solid/face_map.rs index cca6e6971a..ac99348ba3 100644 --- a/crates/three-d/src/solid/face_map.rs +++ b/crates/three-d/src/solid/face_map.rs @@ -178,10 +178,12 @@ pub fn plane_face_map(bounds: Rect, view: View) -> Option { /// before projection, in the mesh's coordinates (y up), and the face's outward normal there. #[derive(Clone, Copy, Debug, PartialEq)] pub struct MeshFace { - /// An art point `p` lies at `x · p.x + y · p.y + c`. + /// An art point `p` lies at `x · (p.x - centre.x) + y · (p.y - centre.y) + at`, with the art's + /// center at `at`. x: V3, y: V3, - c: V3, + centre: Point, + at: V3, normal: V3, /// A plane's mesh turns its normal toward the viewer, so its triangles face either way. either_side: bool, @@ -193,10 +195,11 @@ fn mesh_space(v: V3) -> V3 { } impl MeshFace { - fn new(camera: &Camera, placing: &Placing, side: f64, either_side: bool) -> Self { - let (x, y, c) = placing.frame(); + fn new(camera: &Camera, placing: &Placing, centre: Point, side: f64, either_side: bool) -> Self { + let (x, y, _) = placing.frame(); + let at = mesh_space(placing.place(centre)); let normal = mesh_space(camera.rotate(V3(0.0, 0.0, side))).unit(); - Self { x: mesh_space(x), y: mesh_space(y), c: mesh_space(c), normal, either_side } + Self { x: mesh_space(x), y: mesh_space(y), centre, at, normal, either_side } } /// The art point that mesh point `m` shows, when `m` lies on the face's plane and a triangle @@ -210,7 +213,9 @@ impl MeshFace { if !faces { return None; } - let d = V3(m[0], m[1], m[2]).sub(self.c); + // Measured from the art's center, so the tolerance follows the solid's size and not where + // the art lies on the page. + let d = V3(m[0], m[1], m[2]).sub(self.at); let (xx, xy, yy) = (self.x.dot(self.x), self.x.dot(self.y), self.y.dot(self.y)); let det = xx * yy - xy * xy; let spans = xx > 1e-24 && yy > 1e-24 && det >= 1e-12 * xx * yy; @@ -218,10 +223,11 @@ impl MeshFace { return None; } let (bx, by) = (self.x.dot(d), self.y.dot(d)); - let p = Point::new((bx * yy - by * xy) / det, (xx * by - xy * bx) / det); - let on = V3(self.x.0 * p.x + self.y.0 * p.y, self.x.1 * p.x + self.y.1 * p.y, self.x.2 * p.x + self.y.2 * p.y); + let (px, py) = ((bx * yy - by * xy) / det, (xx * by - xy * bx) / det); + let on = V3(self.x.0 * px + self.y.0 * py, self.x.1 * px + self.y.1 * py, self.x.2 * px + self.y.2 * py); let off = d.sub(on); - let size = 1.0 + d.dot(d).sqrt() + self.c.dot(self.c).sqrt(); + let size = 1.0 + d.dot(d).sqrt(); + let p = Point::new(self.centre.x + px, self.centre.y + py); (p.x.is_finite() && p.y.is_finite() && off.dot(off).sqrt() <= 1e-6 * size).then_some(p) } } @@ -245,7 +251,7 @@ pub fn extrude_mesh_face(bounds: Rect, options: Extrude, view: View, face: Plana PlanarFace::Back => (1.0, -1.0), }; let placing = Placing::new(&camera, bounds.center(), Turn::new(bounds, o.twist, o.taper, t), o.depth / 2.0 - o.depth * t); - Some(MeshFace::new(&camera, &placing, side, false)) + Some(MeshFace::new(&camera, &placing, bounds.center(), side, false)) } /// The plane [`super::plane`] turns art with `bounds` into, with `view`, in its mesh @@ -254,7 +260,7 @@ pub fn plane_mesh_face(bounds: Rect, view: View) -> Option { check_bounds(bounds).ok()?; let camera = Camera::new(view, bounds, 0.0); let placing = Placing::new(&camera, bounds.center(), Turn::new(bounds, 0.0, 1.0, 0.0), 0.0); - Some(MeshFace::new(&camera, &placing, 1.0, true)) + Some(MeshFace::new(&camera, &placing, bounds.center(), 1.0, true)) } #[cfg(test)] diff --git a/crates/three-d/src/solid/tests_face_map.rs b/crates/three-d/src/solid/tests_face_map.rs index 3cf10e7c70..ebbe95448a 100644 --- a/crates/three-d/src/solid/tests_face_map.rs +++ b/crates/three-d/src/solid/tests_face_map.rs @@ -186,6 +186,27 @@ fn a_caps_mesh_corners_go_back_to_the_art_they_were_made_from() { assert_eq!(extrude_mesh_face(bounds, Extrude { depth: 0.0, ..options }, view, PlanarFace::Back), None); } +#[test] +fn a_cap_far_from_the_page_origin_takes_none_of_a_step_bevels_treads() { + let (path, bounds) = square(); + let far = vectorcraft_geom::kurbo::Affine::translate((1e7, 1e7)); + let path = PathData::from_bezpath(&(far * path.to_bezpath())); + let bounds = far.transform_rect_bbox(bounds); + let bevel = crate::Bevel { width: 4.0, height: 4.0, shape: crate::BevelShape::Step, ..Default::default() }; + let options = Extrude { bevel: Some(bevel), ..Extrude::default() }; + let view = turned(0.0); + let mesh = crate::extrude_mesh(&path, FillRule::NonZero, bounds, options, view).unwrap(); + let mesh_face = extrude_mesh_face(bounds, options, view, PlanarFace::Front).unwrap(); + let (points, taken) = mesh_art(&mesh, &mesh_face); + // The treads face the same way as the cap, a few points behind it: only the cap's two + // triangles are taken, wherever the art lies on the page. + assert_eq!(taken, 2); + for p in points { + let near = corners(bounds).iter().map(|c| c.distance(p)).fold(f64::INFINITY, f64::min); + assert!(near < 1e-6, "{p:?} is {near} from the cap's corners"); + } +} + #[test] fn the_mapped_part_of_a_rectangle_stops_before_the_eye() { let (_, bounds) = square(); From 4b3dd42bc577f95861cd6cea83913039069cf9c9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 09:35:37 -0800 Subject: [PATCH 024/226] i18n: drop the ka and ru rows the joined messages replaced MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Georgian and Russian catalogs from main still carried rows for the old `{within}{key}`, `{within}settings.{format}` and `{lo}–{hi}{unit}` messages, which no message matches since their values are joined first. Both catalogs already have rows for the joined messages. --- crates/ui-egui/src/i18n/ka.tsv | 3 --- crates/ui-egui/src/i18n/ru.tsv | 3 --- 2 files changed, 6 deletions(-) diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 660662bc77..f39e0e4f47 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -1806,8 +1806,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) @@ -1940,7 +1938,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} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index a2a56253a0..e154f73e9e 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -9433,8 +9433,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) @@ -9564,7 +9562,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} From 2ae0db53c0d47b42c2c6f33ac0035ac25f8ba89f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 09:35:53 -0800 Subject: [PATCH 025/226] i18n: Georgian and Russian keep one row of the connect end message The ka and ru catalogs already had a row for `connect end must be "start" or "end"`, and this branch added a second one, which fails bundled_catalogs_are_consistent. The added rows are removed and the existing translations stay. --- crates/ui-egui/src/i18n/ka.tsv | 1 - crates/ui-egui/src/i18n/ru.tsv | 1 - 2 files changed, 2 deletions(-) diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 8b768bea96..c8f29ba1a7 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -9854,7 +9854,6 @@ font-script Japanese იაპონური @msg `fidelity` must be from 0.01 to 100 pt `fidelity` უნდა იყოს 0.01-დან 100 pt-მდე @msg style must be "pencil" or "brush" style უნდა იყოს "pencil" ან "brush" @msg extend end must be "start" or "end" extend-ის ბოლო უნდა იყოს "start" ან "end" -@msg connect end must be "start" or "end" connect-ის ბოლო უნდა იყოს "start" ან "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` უნდა იყოს მთელი რიცხვი 1-დან {MAX_BRIDGES_PER_ISLAND}-მდე Weed Box and Lines… ნარჩენის მოსაცილებელი ჩარჩო და ხაზები… Weed Box and Lines ნარჩენის მოსაცილებელი ჩარჩო და ხაზები diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 92fe3db6a3..de59f54987 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -7752,7 +7752,6 @@ shape Open Открытый @msg `fidelity` must be from 0.01 to 100 pt `fidelity` должно быть от 0.01 до 100 pt @msg style must be "pencil" or "brush" style должен быть "pencil" или "brush" @msg extend end must be "start" or "end" конец extend должен быть "start" или "end" -@msg connect end must be "start" or "end" конец connect должен быть "start" или "end" @msg `count` must be a whole number from 1 to {MAX_BRIDGES_PER_ISLAND} `count` должно быть целым числом от 1 до {MAX_BRIDGES_PER_ISLAND} Weed Box and Lines… Рамка и линии выборки… Weed Box and Lines Рамка и линии выборки From 322ce1a0159ab9898bcd1c8d7180002b31404648 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 09:27:00 -0800 Subject: [PATCH 026/226] Smart Guides: tangent and perpendicular snaps find a touch point that falls exactly on a sample The touch points of a drawn line were found by sampling each target segment in 24 steps and bisecting where the sign changed. When the line was exactly square or tangent at one of the samples, the value there was exactly 0, neither interval changed sign, and no snap was offered: for example the foot of a perpendicular from a point above a segment's middle, or a circle's tangent point when it fell exactly on a sample. A sample whose value is exactly 0 now counts as a touch point when its neighbors are not 0, so a straight curve seen from its own line still gives none. The ends of the segment, a cusp and a start point on the curve itself are left out, as between samples. Part of #7846 --- crates/tools/src/guides/snap.rs | 16 ++++++++-- crates/tools/src/guides/tests.rs | 54 ++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/crates/tools/src/guides/snap.rs b/crates/tools/src/guides/snap.rs index d7ee8ecdd8..8aef46f028 100644 --- a/crates/tools/src/guides/snap.rs +++ b/crates/tools/src/guides/snap.rs @@ -29,7 +29,9 @@ pub(super) fn seg_direction(seg: &PathSeg, t: f64) -> Vec2 { } /// The parameters in (0, 1) where the line from `at` to `seg` is square to it (`perpendicular`) -/// or grazes it, found by sampling the curve for a change of sign and bisecting. +/// or grazes it, found by sampling the curve for a change of sign and bisecting. A sample where +/// the line is exactly square or grazing, and its neighbors are not, is one of them too: no sign +/// changes on either side of it. pub(super) fn touch_params(seg: &PathSeg, at: Point, perpendicular: bool) -> Vec { const STEPS: usize = 24; let f = |t: f64| { @@ -41,7 +43,17 @@ pub(super) fn touch_params(seg: &PathSeg, at: Point, perpendicular: bool) -> Vec for i in 1..=STEPS { let t = i as f64 / STEPS as f64; let cur = (t, f(t)); - if prev.1.is_finite() && cur.1.is_finite() && prev.1 * cur.1 < 0.0 { + if cur.1 == 0.0 { + // Not at the end (t = 1), not where `at` lies on the curve or the direction is zero + // (a cusp), and not along a stretch that is zero throughout, such as a straight + // curve seen from its own line. The sign need not change: the tangent at an + // inflection touches zero without crossing it. + let isolated = |n: f64| n.is_finite() && n != 0.0; + let (v, d) = (seg.eval(t) - at, seg_direction(seg, t)); + if i < STEPS && isolated(prev.1) && isolated(f((i + 1) as f64 / STEPS as f64)) && v.hypot() * d.hypot() > 1e-12 { + out.push(t); + } + } else if prev.1.is_finite() && cur.1.is_finite() && prev.1 * cur.1 < 0.0 { let (mut lo, mut hi) = (prev, cur); for _ in 0..40 { let mid = 0.5 * (lo.0 + hi.0); diff --git a/crates/tools/src/guides/tests.rs b/crates/tools/src/guides/tests.rs index 16b46f6fb9..e4c2600879 100644 --- a/crates/tools/src/guides/tests.rs +++ b/crates/tools/src/guides/tests.rs @@ -535,6 +535,60 @@ fn drawn_lines_land_perpendicular_to_segments_and_tangent_to_curves() { } } +/// A touch point that falls exactly on one of the samples `touch_params` takes (t = k / 24) is +/// found, once: the foot of the perpendicular from above a segment's middle, and the tangent +/// point of a line drawn from a free point to a circle (#7846). A line to an oval lands tangent +/// between samples, as before. +#[test] +fn touch_points_exactly_on_a_sample_are_found() { + use super::snap::touch_params; + use vectorcraft_doc::{Appearance, Node}; + use vectorcraft_geom::kurbo::{CubicBez, Line, ParamCurve}; + use vectorcraft_geom::shapes; + // (50, 40) above the segment (0, 0) to (100, 0): the foot is (50, 0), at t = 0.5 = 12 / 24. + let flat = PathSeg::Line(Line::new((0.0, 0.0), (100.0, 0.0))); + assert_eq!(touch_params(&flat, Point::new(50.0, 40.0), true), [0.5]); + assert_eq!(touch_params(&flat, Point::new(30.0, 40.0), true).len(), 1, "between samples, as before"); + assert!(touch_params(&flat, Point::new(0.0, 40.0), true).is_empty(), "the ends stay out"); + assert!(touch_params(&flat, Point::new(100.0, 40.0), true).is_empty(), "the ends stay out"); + // From a point on the segment itself there is no line to be square. + assert!(touch_params(&flat, Point::new(50.0, 0.0), true).is_empty()); + // A straight cubic seen from its own line runs along that line everywhere: no touch point. + let straight = PathSeg::Cubic(CubicBez::new((0.0, 0.0), (30.0, 0.0), (70.0, 0.0), (100.0, 0.0))); + assert!(touch_params(&straight, Point::new(-50.0, 0.0), false).is_empty()); + // y = 400 (t - 0.5)^3 has its inflection at t = 0.5, and the tangent there (the x axis) + // touches zero without a change of sign; seen from (-100, 0) it is still found. + let wave = PathSeg::Cubic(CubicBez::new((0.0, -50.0), (100.0 / 3.0, 50.0), (200.0 / 3.0, -50.0), (100.0, 50.0))); + assert_eq!(touch_params(&wave, Point::new(-100.0, 0.0), false), [0.5]); + let (mut d, _) = doc_with_rect(); + let l = d.layers[0].id; + let id = d.alloc_id(); + let circle = shapes::ellipse(Rect::new(450.0, 450.0, 550.0, 550.0)); + // The middle of the lower right quarter, and a point on the circle's tangent there. + let quarter = PathSeg::Cubic(circle.subpaths[0].segment(2)); + let mid = quarter.eval(0.5); + let from = mid + Vec2::new(-64.0, 64.0); + assert!(((mid - Point::new(500.0, 500.0)).hypot() - 50.0).abs() < 0.1, "{mid:?}"); + assert_eq!(touch_params(&quarter, from, false), [0.5]); + d.insert(Some(l), 1, Node::path(id, circle, Appearance::default_art())).unwrap(); + // An oval (centre (500, 300), 100 by 50) seen from (300, 300): the tangent points are at + // x = 450, y = 300 -/+ 25 * sqrt(3), between samples. + let oval = d.alloc_id(); + d.insert(Some(l), 2, Node::path(oval, shapes::ellipse(Rect::new(400.0, 250.0, 600.0, 350.0)), Appearance::default_art())).unwrap(); + let (s, p) = (Selection::default(), paint()); + let c = cx(&d, &s, &p); + let leave = Leave::segment(&c, from, false); + let (q, ov) = PointSnap::new(&c, || Targets::for_drawing(&d, &[], None, None)).snap_from(&c, mid + Vec2::new(1.5, 1.0), Some(&leave)); + assert_eq!(labels(&ov), ["tangent"]); + assert!((q - mid).hypot() < 1e-9, "{q:?} {mid:?}"); + assert_eq!(lines(&ov), vec![(from, q)]); + let start = Point::new(300.0, 300.0); + let leave = Leave::segment(&c, start, false); + let (q, ov) = PointSnap::new(&c, || Targets::for_drawing(&d, &[], None, None)).snap_from(&c, Point::new(452.0, 259.0), Some(&leave)); + assert_eq!(labels(&ov), ["tangent"]); + assert!((q - Point::new(450.0, 300.0 - 25.0 * 3f64.sqrt())).hypot() < 0.2, "{q:?}"); +} + /// A box dragged from a corner (Rectangle, Ellipse, ...) never snaps square to a segment, and /// a busy spot does not hide the contact: every segment in reach is tried. #[test] From da63094946391be5badc6e83b7390e41d6f9a48f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 09:46:54 -0800 Subject: [PATCH 027/226] i18n: check the spooler-note print message in every catalog `sent` now reports a spooler note as "The spooler replied: ...", so the cross-language case checks that form instead of the old "(job 12)" one, which matched the plain row and passed without the note row. --- crates/ui-egui/src/i18n/tests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 0b1167fdfc..dc1e0437bb 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -2479,7 +2479,11 @@ fn messages_with_joined_values_translate_whole() { ), ("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 (job 12)".to_string(), vec!["“Poster”", "Office Laser", "(job 12)"], vec!["Sent"]), + ( + "Sent “Poster” to Office Laser. The spooler replied: job 12".to_string(), + vec!["“Poster”", "Office Laser", "job 12"], + vec!["Sent", "spooler", "replied"], + ), ( "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"], From 78b1c6bf091c359724501071beae623f681e1247 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 10:19:38 -0800 Subject: [PATCH 028/226] Shapes: draw the circle through three points shape.circleThroughPoints draws the circle whose edge passes through three points, as a live ellipse with the current paint, in one undo step. The points come from `points` or, when it is left out, from the three selected anchor points: anchor points selected with Direct Selection, or all the anchor points of a path selected whole. The ends of selected segments do not count. The result gives the circle's center and radius. The circle is not pixel-aligned, even while Align New Objects to Pixel Grid is on, so it stays through the points. Two points that are the same, or three on one line (twice the triangle's area at most 1e-10 of its longest side squared), are refused with a message and nothing is drawn. The center is computed from the corner opposite the longest side, so nearly collinear points and points far from the origin keep their precision. With the Ellipse tool, the first two Shift-clicks place points and the third draws the circle through the three. After two points the tool previews the circle through the snapped pointer as a dashed outline; the preview goes when the pointer leaves the canvas. Once a point is placed, a Shift-click on the selection's handles or shape widgets places a point too. Escape, a click without Shift, a drag, a press without Shift on the selection or a shape widget, and an edit, Undo or Redo made outside the tool remove the points placed so far. A Shift-click without a drag used to open the size dialog, as a plain click does; a plain click still opens it, and so does a Shift-click while the perspective grid shows with an active plane, so that shape still goes on the plane. Docs: docs/mcp.md, ROADMAP. Messages translated in the 24 catalogs with complete messages. --- ROADMAP.md | 1 + crates/engine/src/cmd/create.rs | 99 ++++++++- crates/engine/src/cmd/plugin_call/reviewed.rs | 1 + crates/engine/src/tests.rs | 1 + crates/engine/src/tests/circle_through.rs | 209 ++++++++++++++++++ crates/geom/src/shapes.rs | 68 ++++++ crates/tools/src/shape.rs | 120 ++++++++-- crates/tools/src/shape/tests.rs | 184 +++++++++++++++ crates/ui-egui/src/i18n/ca.tsv | 3 + crates/ui-egui/src/i18n/cs.tsv | 3 + crates/ui-egui/src/i18n/da.tsv | 3 + crates/ui-egui/src/i18n/de.tsv | 3 + crates/ui-egui/src/i18n/el.tsv | 3 + crates/ui-egui/src/i18n/es.tsv | 3 + crates/ui-egui/src/i18n/fi.tsv | 3 + crates/ui-egui/src/i18n/fr.tsv | 3 + crates/ui-egui/src/i18n/hi.tsv | 3 + crates/ui-egui/src/i18n/hu.tsv | 3 + crates/ui-egui/src/i18n/it.tsv | 3 + crates/ui-egui/src/i18n/ja.tsv | 3 + crates/ui-egui/src/i18n/ka.tsv | 3 + crates/ui-egui/src/i18n/ko.tsv | 3 + crates/ui-egui/src/i18n/nl.tsv | 3 + crates/ui-egui/src/i18n/pl.tsv | 3 + crates/ui-egui/src/i18n/pt-br.tsv | 3 + crates/ui-egui/src/i18n/ru.tsv | 3 + crates/ui-egui/src/i18n/sv.tsv | 3 + crates/ui-egui/src/i18n/tr.tsv | 3 + crates/ui-egui/src/i18n/uk.tsv | 3 + crates/ui-egui/src/i18n/vi.tsv | 3 + crates/ui-egui/src/i18n/zh-hans.tsv | 3 + crates/ui-egui/src/i18n/zh-hant.tsv | 3 + docs/mcp.md | 23 ++ 33 files changed, 758 insertions(+), 20 deletions(-) create mode 100644 crates/engine/src/tests/circle_through.rs diff --git a/ROADMAP.md b/ROADMAP.md index ec3f6e9c76..253c7ef45f 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -134,6 +134,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap - 2026-11-05: Release Type on a Path joins the Type Tools add-on (Object › Plug-ins › Type Tools): each selected type on a path splits into point type with the same text and attributes, on one straight line starting where its first character sat, and the plain path it was set on, with its exact shape and place in the stacking order and no paint; or keeps only the path or only the text, optionally leaving the original. A dialog with Preview, one undo step (`addon.type.releasePath`, #5532). A VectorCraft addition: headline numbers unchanged. - 2026-11-04: New Document: the units chosen in Preset Details now belong to the chosen document, as the pane's options are listed for the selected preset; the chosen card shows them, every other Recent and Saved card keeps the units its document or preset was made in, and the built-in tabs still follow the chosen units, so switching between inches and millimetres no longer restyles every recent template. Scores and estimates unchanged. - 2026-11-02: Mouse wheel over a closed font-family field in Character, Properties or Control changes selected text through the family list using saved font filters (excluding search text), one undo step per notch, stopping at the ends (#5253). Scores and estimates unchanged. +- 2026-11-15: Circle through three points: three Shift-clicks with the Ellipse tool, or `shape.circleThroughPoints` with three points or three selected anchor points, draw the circle whose edge passes through them, with the current paint, in one undo step; after two points the tool previews the circle through the pointer, and two points that are the same or three on one line are refused with a message. Scores and estimates unchanged. - 2026-10-31: Pattern libraries: Window › Swatch Libraries › Patterns and the Swatches panel's library menu open Geometric Patterns, a built-in library of eleven pattern swatches (dots, stripes, checks, a grid and shapes); clicking one adds its pattern and swatch to the document, once, and applies it to the active fill or stroke (`swatch.library.add`). - 2026-11-11: Pattern libraries: Patterns › Grit Textures, a second built-in pattern library, holds eight seamless black textures (Fine Grain, Coarse Grit, Sand, Speckle, Stipple, Scratches, Sparse Flecks and Dense Flecks) on tiles of 18 to 36 pt, each drawn the same way every time; marks that reach past a tile edge continue on the next tile, so the tiles join without a seam (`swatch.library.add`). Scores and estimates unchanged. - 2026-11-11: Pattern libraries: Patterns › Optical Effects, a third built-in pattern library, of VectorCraft's own designs, holds eight black wave, moiré and op-art tiles (Sine Bands, Ripple Lines, Interference Rings, Offset Rings, Warped Checks, Pinched Stripes, Chevron Pulse and Radiating Lenses) of 32 to 48 pt, each drawn the same way every time; each tile is one period of its design, and art that reaches past a tile edge continues on the next tile, so the tiles join without a seam (`swatch.library.add`). Scores and estimates unchanged. diff --git a/crates/engine/src/cmd/create.rs b/crates/engine/src/cmd/create.rs index 08944940a2..9c6e042e9e 100644 --- a/crates/engine/src/cmd/create.rs +++ b/crates/engine/src/cmd/create.rs @@ -57,6 +57,15 @@ pub fn specs() -> Vec { has_doc, flare ), + cmd!( + "shape.circleThroughPoints", + "Circle Through Points", + [], + None, + "{points?: [[x, y], [x, y], [x, y]] (left out: the three selected anchor points, where a path selected whole counts all its anchors and selected segments' ends do not count)} → {id, cx, cy, radius}: a circle with the current paint whose edge passes through the three points, not pixel-aligned even while Align New Objects to Pixel Grid is on; two points that are the same or three on one line are an error, and nothing is drawn", + has_doc, + circle_through_points + ), cmd!("shape.line", "Line Segment", [], None, "{x1, y1, x2, y2, fill?: bool (Fill Line: the current fill, else none)} → {id}", has_doc, line), cmd!("shape.spiral", "Spiral", [], None, "{cx, cy, radius, decay=80 (%), segments=10, clockwise?} → {id}", has_doc, spiral), cmd!( @@ -131,14 +140,21 @@ pub(crate) fn add_look(s: &mut Session, label: &str, kind: NodeKind, look: NewAr /// [`add_look`] that selects the new object only when `select` is set; otherwise the selection /// stays as it was. pub(crate) fn insert_look(s: &mut Session, label: &str, kind: NodeKind, look: NewArt, name: Option, select: bool) -> Result { - insert_look_turned(s, label, kind, look, name, select, 0.0) + insert_look_turned(s, label, kind, look, name, select, 0.0, true) } /// [`add_art`] for an object made turned by a `rotation` param (degrees, clockwise on the page): /// its bounding box turns with it, as after the Rotate tool. fn add_art_turned(s: &mut Session, label: &str, kind: NodeKind, rotation: f64) -> Result { let look = s.new_art_look(s.paint.fill.clone(), s.paint.stroke.clone(), s.paint.stroke_width); - insert_look_turned(s, label, kind, look, None, true, bbox_turn(rotation)) + insert_look_turned(s, label, kind, look, None, true, bbox_turn(rotation), true) +} + +/// [`add_art`] for an object whose geometry must stay where it was computed: it is not +/// pixel-aligned, even while the document's Align New Objects to Pixel Grid is on. +fn add_art_unaligned(s: &mut Session, label: &str, kind: NodeKind) -> Result { + let look = s.new_art_look(s.paint.fill.clone(), s.paint.stroke.clone(), s.paint.stroke_width); + insert_look_turned(s, label, kind, look, None, true, 0.0, false) } /// The bounding-box angle (counter-clockwise, as `Node::bbox_angle` and the Rotate tool keep it) @@ -162,8 +178,10 @@ fn constrained_turn(s: &Session, rotation: f64) -> f64 { } } -/// [`insert_look`] with the new object's bounding box turned to `bbox_angle`. A new path or -/// compound path is pixel-aligned while the document's Align New Objects to Pixel Grid is on. +/// [`insert_look`] with the new object's bounding box turned to `bbox_angle`. With `align`, a new +/// path or compound path is pixel-aligned while the document's Align New Objects to Pixel Grid is +/// on. +#[allow(clippy::too_many_arguments)] fn insert_look_turned( s: &mut Session, label: &str, @@ -172,6 +190,7 @@ fn insert_look_turned( name: Option, select: bool, bbox_angle: f64, + align: bool, ) -> Result { let parent = s.doc()?.target_parent()?; let mode = s.draw_mode; @@ -181,7 +200,9 @@ fn insert_look_turned( let id = d.alloc_id(); let mut n = Node::new(id, kind); look.apply(d, &mut n); - super::object::align_new_object(d, &mut n); + if align { + super::object::align_new_object(d, &mut n); + } n.name = name; n.bbox_angle = bbox_angle; let mut into = None; @@ -368,6 +389,71 @@ fn ellipse(s: &mut Session, p: &Value) -> Result { add_art_turned(s, "Ellipse", path_kind(live.to_path(), Some(live)), f64_or(p, "rotation", 0.0)) } +/// A live ellipse whose edge passes through three points: `points`, or the three selected anchor +/// points ([`selected_anchor_points`]). One undo step, named as an Ellipse tool drag is. +fn circle_through_points(s: &mut Session, p: &Value) -> Result { + const C: &str = "shape.circleThroughPoints"; + let points = match p.get("points").filter(|v| !v.is_null()) { + Some(v) => three_points(v).ok_or_else(|| bad(C, "`points` must be three [x, y] pairs of numbers"))?, + None => selected_anchor_points(s)?.ok_or_else(|| bad(C, "direct-select three anchor points, or give `points`"))?, + }; + let [a, b, c] = points; + let (center, radius) = shapes::circle_through(a, b, c) + .ok_or_else(|| bad(C, "no circle passes through these points: two are the same or all three lie on one line"))?; + let r = Rect::new(center.x - radius, center.y - radius, center.x + radius, center.y + radius); + let live = LiveShape::Ellipse { w: r.width(), h: r.height(), pie: (0.0, 360.0), xf: Affine::translate(r.origin().to_vec2()) }; + // Not pixel-aligned: the circle stays through the points. + let mut out = add_art_unaligned(s, "Ellipse", path_kind(live.to_path(), Some(live)))?; + out["cx"] = json!(center.x); + out["cy"] = json!(center.y); + out["radius"] = json!(radius); + Ok(out) +} + +/// The three points `[[x, y], [x, y], [x, y]]` holds, each pair two finite numbers. +fn three_points(v: &Value) -> Option<[Point; 3]> { + let pair = |v: &Value| match v.as_array().map(Vec::as_slice) { + Some([x, y]) => x.as_f64().zip(y.as_f64()).filter(|(x, y)| x.is_finite() && y.is_finite()).map(|(x, y)| Point::new(x, y)), + _ => None, + }; + match v.as_array().map(Vec::as_slice) { + Some([a, b, c]) => Some([pair(a)?, pair(b)?, pair(c)?]), + _ => None, + } +} + +/// The positions of the selected anchor points, when there are exactly three. They are counted as +/// the other anchor commands count them ([`super::path::anchor_targets`]): a selected path with +/// anchors picked by Direct Selection gives those, and a path selected whole gives all of its own. +/// A selected segment's ends are not selected anchor points, so a selection with segments gives +/// none; so does a selection holding an object that is not a path, or an anchor that is gone. +fn selected_anchor_points(s: &Session) -> Result> { + let st = s.doc()?; + if st.selection.segments.values().any(|set| !set.is_empty()) { + return Ok(None); + } + let mut points = Vec::with_capacity(4); + for id in &st.selection.objects { + let Some(pd) = st.doc.node(*id).and_then(|n| n.path_data()) else { return Ok(None) }; + match st.selection.anchors.get(id) { + Some(set) => { + for &(si, ai) in set.iter().take(4) { + let Some(a) = pd.subpaths.get(si).and_then(|sp| sp.anchors.get(ai)) else { return Ok(None) }; + points.push(a.p); + } + } + None => points.extend(pd.anchors().take(4).map(|(_, _, a)| a.p)), + } + if points.len() > 3 { + return Ok(None); + } + } + Ok(match points.as_slice() { + &[a, b, c] => Some([a, b, c]), + _ => None, + }) +} + /// The whole-number count `p` gives for `key` (`5` or `5.0`), or `default` when it is left out or /// null. A fraction, a negative, a non-finite or a non-number is an error rather than the default. fn count_or(p: &Value, key: &str, default: u64, cmd: &str) -> Result { @@ -781,7 +867,8 @@ fn text_create(s: &mut Session, p: &Value) -> Result { // Lays the text out (and sizes an Auto Size frame). super::typecmd::refresh_bounds(&mut t); } - let made = insert_look_turned(s, "Type", NodeKind::Text(Box::new(t)), NewArt::plain(Appearance::default()), None, true, bbox_turn(rotation))?; + let made = + insert_look_turned(s, "Type", NodeKind::Text(Box::new(t)), NewArt::plain(Appearance::default()), None, true, bbox_turn(rotation), true)?; let id = made.get("id").and_then(Value::as_u64).map(NodeId); let made = super::typecmd::with_bounds(s, id, made); let mut made = super::typecmd::with_overflow(s, id.as_slice(), made); diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index 67d0fec2a3..a269ace561 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -542,6 +542,7 @@ pub(super) const ALLOWED: &[&str] = &[ "select.toggle", "select.update", "shape.arc", + "shape.circleThroughPoints", "shape.ellipse", "shape.flare", "shape.line", diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 1b420d7805..2c475c87d4 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -24,6 +24,7 @@ mod build; mod cancel; mod caret_kerning; mod charstroke; +mod circle_through; pub(super) mod clip; mod clipboard; mod clipflavours; diff --git a/crates/engine/src/tests/circle_through.rs b/crates/engine/src/tests/circle_through.rs new file mode 100644 index 0000000000..25fcc04beb --- /dev/null +++ b/crates/engine/src/tests/circle_through.rs @@ -0,0 +1,209 @@ +//! `shape.circleThroughPoints`: a circle through three given points, or through the three anchor +//! points selected with Direct Selection, and the Ellipse tool's three Shift-clicks that run it. + +use serde_json::{Value, json}; +use vectorcraft_doc::{LiveShape, Node, NodeKind}; +use vectorcraft_geom::Point; +use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey}; + +use crate::*; + +const C: &str = "shape.circleThroughPoints"; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap(); + s +} + +fn node(s: &Session, id: NodeId) -> Node { + s.doc().unwrap().doc.node(id).unwrap().clone() +} + +fn undo_len(s: &Session) -> usize { + s.doc().unwrap().history.undo.len() +} + +fn object_count(s: &Session) -> usize { + let mut n = 0; + s.doc().unwrap().doc.walk(|_| n += 1); + n +} + +fn id_of(v: &Value) -> NodeId { + NodeId(v["id"].as_u64().unwrap()) +} + +/// Whether the geometric bounds of `id` are `want` to within 10⁻⁹ pt. +fn bounds_are(s: &Session, id: NodeId, want: vectorcraft_geom::Rect) -> bool { + let b = s.doc().unwrap().doc.bounds_of(&[id], false).unwrap(); + [(b.x0, want.x0), (b.y0, want.y0), (b.x1, want.x1), (b.y1, want.y1)].iter().all(|(a, w)| (a - w).abs() < 1e-9) +} + +/// The largest distance of `points` from the path of `id`. +fn farthest_from_path(s: &Session, id: NodeId, points: &[Point]) -> f64 { + let n = node(s, id); + let path = n.path_data().unwrap(); + points.iter().map(|p| path.nearest(*p).unwrap().4).fold(0.0, f64::max) +} + +/// (0, 0), (80, 0) and (0, 60) lie on the circle centered at (40, 30) with radius 50 (their +/// right angle stands on the diameter). The circle is a live ellipse with the current paint, is +/// selected, passes through the points to within the four-curve circle's error (about 0.03% of the +/// radius), and one undo removes it. +#[test] +fn the_circle_through_three_given_points_is_exact_and_one_undo_step() { + let mut s = session(); + let reference = id_of(&s.execute("shape.ellipse", &json!({"x": 200, "y": 200, "width": 10, "height": 10})).unwrap()); + let undo = undo_len(&s); + let points = [Point::new(0.0, 0.0), Point::new(80.0, 0.0), Point::new(0.0, 60.0)]; + let out = s.execute(C, &json!({"points": [[0, 0], [80, 0], [0, 60]]})).unwrap(); + assert_eq!((out["cx"].as_f64(), out["cy"].as_f64(), out["radius"].as_f64()), (Some(40.0), Some(30.0), Some(50.0)), "{out}"); + let id = id_of(&out); + let n = node(&s, id); + match &n.kind { + NodeKind::Path { live: Some(live), .. } => match live.as_ref() { + LiveShape::Ellipse { w, h, pie, .. } => assert_eq!((*w, *h, *pie), (100.0, 100.0, (0.0, 360.0))), + other => panic!("not a live ellipse: {other:?}"), + }, + other => panic!("not a live shape: {other:?}"), + } + assert!(bounds_are(&s, id, vectorcraft_geom::Rect::new(-10.0, -20.0, 90.0, 80.0))); + assert!(farthest_from_path(&s, id, &points) < 50.0 * 3e-4, "{}", farthest_from_path(&s, id, &points)); + assert_eq!(n.appearance, node(&s, reference).appearance, "the current paint, as the Ellipse tool draws"); + assert_eq!(s.doc().unwrap().selection.objects, [id]); + assert_eq!(undo_len(&s), undo + 1); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(s.doc().unwrap().doc.node(id).is_none()); +} + +/// Two points that are the same, or three on one line, are refused with a message; nothing is +/// drawn and no undo step is recorded. Points nearly on one line still give their circle. +#[test] +fn coincident_or_collinear_points_are_refused() { + let mut s = session(); + let (undo, count) = (undo_len(&s), object_count(&s)); + for points in [json!([[10, 10], [10, 10], [50, 80]]), json!([[0, 0], [50, 50], [100, 100]]), json!([[5, 5], [5, 5], [5, 5]])] { + let e = s.execute(C, &json!({ "points": points })).unwrap_err().to_string(); + assert!(e.contains("no circle passes through these points"), "{points}: {e}"); + assert_eq!((undo_len(&s), object_count(&s)), (undo, count), "{points}"); + } + // 0.01 pt off a chord 200 pt long: the sagitta formula r = (h² + (L/2)²) / 2h. + let out = s.execute(C, &json!({"points": [[100, 200], [300, 200], [200, 199.99]]})).unwrap(); + let want = (0.01f64 * 0.01 + 100.0 * 100.0) / 0.02; + let (cx, cy, r) = (out["cx"].as_f64().unwrap(), out["cy"].as_f64().unwrap(), out["radius"].as_f64().unwrap()); + assert!((r - want).abs() / want < 1e-9 && (cx - 200.0).abs() < 1e-6 && (cy - (199.99 + want)).abs() / want < 1e-9, "{out}"); +} + +/// Points that are not three pairs of finite numbers are an error, not a fallback. +#[test] +fn malformed_points_are_refused() { + let mut s = session(); + let undo = undo_len(&s); + for points in [ + json!([[0, 0], [10, 0]]), + json!([[0, 0], [10, 0], [0, 10], [5, 5]]), + json!([[0, 0], [10, 0], [0]]), + json!([[0, 0], [10, 0], ["0", 10]]), + json!("0,0 10,0 0,10"), + json!([[0, 0], [10, 0], [0, 10, 3]]), + ] { + let e = s.execute(C, &json!({ "points": points })).unwrap_err().to_string(); + assert!(e.contains("`points` must be three [x, y] pairs of numbers"), "{points}: {e}"); + } + assert_eq!(undo_len(&s), undo); +} + +/// With `points` left out, the three anchor points selected with Direct Selection give the +/// circle, from one path or several; any other number of them is an error. +#[test] +fn three_direct_selected_anchor_points_give_the_circle() { + let mut s = session(); + let anchors: Vec = [(0, 0), (80, 0), (0, 60), (50, 120)].iter().map(|(x, y)| json!({"x": x, "y": y})).collect(); + let path = id_of(&s.execute("path.create", &json!({ "anchors": anchors })).unwrap()); + s.execute("select.anchors", &json!({"id": path.0, "anchors": [[0, 0], [0, 1], [0, 2]], "mode": "set"})).unwrap(); + let out = s.execute(C, &json!({})).unwrap(); + assert_eq!((out["cx"].as_f64(), out["cy"].as_f64(), out["radius"].as_f64()), (Some(40.0), Some(30.0), Some(50.0)), "{out}"); + // Anchors of two paths. + let other = id_of(&s.execute("path.create", &json!({"anchors": [{"x": 0, "y": 60}, {"x": 0, "y": 200}]})).unwrap()); + s.execute("select.anchors", &json!({"id": path.0, "anchors": [[0, 0], [0, 1]], "mode": "set"})).unwrap(); + s.execute("select.anchors", &json!({"id": other.0, "anchors": [[0, 0]], "mode": "add"})).unwrap(); + let out = s.execute(C, &json!({"points": null})).unwrap(); + assert_eq!((out["cx"].as_f64(), out["cy"].as_f64()), (Some(40.0), Some(30.0)), "{out}"); + // Two or four anchors, or a path of four anchors selected whole. + for picked in [json!([[0, 0], [0, 1]]), json!([[0, 0], [0, 1], [0, 2], [0, 3]])] { + s.execute("select.anchors", &json!({"id": path.0, "anchors": picked, "mode": "set"})).unwrap(); + let e = s.execute(C, &json!({})).unwrap_err().to_string(); + assert!(e.contains("direct-select three anchor points, or give `points`"), "{picked}: {e}"); + } + s.execute("select.set", &json!({"ids": [path.0]})).unwrap(); + assert!(s.execute(C, &json!({})).is_err()); + // A path of three anchors selected whole counts all three, as the other anchor commands count + // them; with an object that is not a path also selected, there is no circle. + let triangle = id_of(&s.execute("path.create", &json!({"anchors": [{"x": 0, "y": 0}, {"x": 80, "y": 0}, {"x": 0, "y": 60}]})).unwrap()); + s.execute("select.set", &json!({"ids": [triangle.0]})).unwrap(); + let out = s.execute(C, &json!({})).unwrap(); + assert_eq!((out["cx"].as_f64(), out["cy"].as_f64(), out["radius"].as_f64()), (Some(40.0), Some(30.0), Some(50.0)), "{out}"); + s.execute("edit.undo", &json!({})).unwrap(); + let text = id_of(&s.execute("text.create", &json!({"x": 300, "y": 300, "text": "A"})).unwrap()); + s.execute("select.set", &json!({"ids": [triangle.0, text.0]})).unwrap(); + assert!(s.execute(C, &json!({})).is_err()); + let undo = undo_len(&s); + // Two selected segments hold three ends, which are not selected anchor points. + s.execute("select.segments", &json!({"id": path.0, "segments": [[0, 0], [0, 1]], "mode": "set"})).unwrap(); + assert_eq!(s.doc().unwrap().selection.anchors.get(&path).map(|a| a.len()), Some(3)); + let e = s.execute(C, &json!({})).unwrap_err().to_string(); + assert!(e.contains("direct-select three anchor points, or give `points`"), "{e}"); + assert_eq!(undo_len(&s), undo); +} + +/// With Align New Objects to Pixel Grid on, the circle is still drawn through the points: it is +/// not pixel-aligned, so the grid does not move it. +#[test] +fn the_circle_is_not_moved_onto_the_pixel_grid() { + let mut s = session(); + s.execute("document.setup", &json!({"alignNewObjectsToPixelGrid": true})).unwrap(); + let points = [Point::new(0.3, 0.2), Point::new(80.6, 0.1), Point::new(0.4, 60.7)]; + let pairs: Vec = points.iter().map(|p| json!([p.x, p.y])).collect(); + let id = id_of(&s.execute(C, &json!({ "points": pairs })).unwrap()); + assert!(farthest_from_path(&s, id, &points) < 51.0 * 3e-4, "{}", farthest_from_path(&s, id, &points)); + assert!(!node(&s, id).extras().pixel_aligned); +} + +fn view() -> ViewInfo { + ViewInfo { smart_guides: false, ..ViewInfo::default() } +} + +fn click(s: &mut Session, mods: Mods, x: f64, y: f64) { + for k in [PointerKind::Down, PointerKind::Up] { + s.pointer(&PointerEvent::new(k, x, y).with_mods(mods), view()).unwrap(); + } +} + +/// With the Ellipse tool, three Shift-clicks draw the circle through the three points, in one +/// undo step; Escape drops the points placed so far. +#[test] +fn three_shift_clicks_with_the_ellipse_tool_draw_the_circle_through_them() { + let mut s = session(); + s.select_tool("ellipse", view()).unwrap(); + let shift = Mods { shift: true, ..Mods::default() }; + let (undo, count) = (undo_len(&s), object_count(&s)); + click(&mut s, shift, 100.0, 100.0); + click(&mut s, shift, 180.0, 100.0); + assert_eq!((undo_len(&s), object_count(&s)), (undo, count), "two points draw nothing yet"); + click(&mut s, shift, 100.0, 160.0); + assert_eq!(undo_len(&s), undo + 1); + let id = *s.doc().unwrap().selection.objects.first().unwrap(); + assert!(bounds_are(&s, id, vectorcraft_geom::Rect::new(90.0, 80.0, 190.0, 180.0))); + // Escape after two points: the next three clicks start afresh. + click(&mut s, shift, 0.0, 0.0); + click(&mut s, shift, 10.0, 300.0); + s.tool_key(ToolKey::Escape, Mods::default(), view()).unwrap(); + click(&mut s, shift, 200.0, 200.0); + click(&mut s, shift, 280.0, 200.0); + let undo = undo_len(&s); + click(&mut s, shift, 200.0, 260.0); + assert_eq!(undo_len(&s), undo + 1); + let id = *s.doc().unwrap().selection.objects.first().unwrap(); + assert!(bounds_are(&s, id, vectorcraft_geom::Rect::new(190.0, 180.0, 290.0, 280.0))); +} diff --git a/crates/geom/src/shapes.rs b/crates/geom/src/shapes.rs index 0ae8a75190..8eb1a69e9c 100644 --- a/crates/geom/src/shapes.rs +++ b/crates/geom/src/shapes.rs @@ -296,6 +296,33 @@ fn contour_with_rounding(pts: &[Point], rounded: f64) -> PathData { PathData::single(SubPath::new(anchors, true)) } +/// The circle through the points `a`, `b` and `c`: its center and radius. `None` when two of the +/// points are the same or the three lie on one line, which this takes to be when twice the +/// triangle's area is at most 10⁻¹⁰ of its longest side squared. +pub fn circle_through(a: Point, b: Point, c: Point) -> Option<(Point, f64)> { + // The corner opposite the longest side is the origin, so the two shorter sides are used. + let (ab, bc, ca) = ((b - a).hypot2(), (c - b).hypot2(), (a - c).hypot2()); + let (o, p, q, longest) = if bc >= ab && bc >= ca { + (a, b, c, bc) + } else if ca >= ab { + (b, c, a, ca) + } else { + (c, a, b, ab) + }; + let (u, v) = (p - o, q - o); + let cross = u.cross(v); + // Not a number, or nearly zero: no circle (a not-a-number side fails the finite check below). + if cross.is_nan() || cross.abs() <= 1e-10 * longest { + return None; + } + let (uu, vv) = (u.hypot2(), v.hypot2()); + let d = 2.0 * cross; + let offset = Vec2::new((v.y * uu - u.y * vv) / d, (u.x * vv - v.x * uu) / d); + let center = o + offset; + let radius = offset.hypot(); + (center.is_finite() && radius.is_finite()).then_some((center, radius)) +} + /// Regular polygon with `sides` (≥ 3), first vertex straight up from the centre. pub fn polygon(center: Point, radius: f64, sides: u32, rotation_deg: f64) -> PathData { let n = sides.max(3); @@ -670,6 +697,47 @@ mod tests { assert!(ellipse_pie(r, f64::NAN, 10.0).anchor_count() == 4, "not a number: the whole ellipse"); } + /// The circle through three points against the closed form: (0, 0), (8, 0) and (0, 6) lie on + /// the circle with the hypotenuse (8, 0)–(0, 6) as its diameter, center (4, 3) and radius 5. + #[test] + fn the_circle_through_three_points_has_the_closed_form_center_and_radius() { + let (o, a, b) = (Point::ORIGIN, Point::new(8.0, 0.0), Point::new(0.0, 6.0)); + for (p, q, r) in [(o, a, b), (a, b, o), (b, o, a), (b, a, o)] { + let (c, radius) = circle_through(p, q, r).unwrap(); + assert!(c.distance(Point::new(4.0, 3.0)) < 1e-12 && (radius - 5.0).abs() < 1e-12, "{c:?} {radius}"); + } + // Moved far from the origin, the answer moves with the points. + let far = Vec2::new(3.0e6, -2.0e6); + let (c, radius) = circle_through(o + far, a + far, b + far).unwrap(); + assert!(c.distance(Point::new(4.0, 3.0) + far) < 1e-6 && (radius - 5.0).abs() < 1e-6, "{c:?} {radius}"); + } + + /// Two points that are the same, or three on one line, give no circle. + #[test] + fn coincident_or_collinear_points_give_no_circle() { + let (a, b) = (Point::new(1.0, 2.0), Point::new(5.0, 7.0)); + assert_eq!(circle_through(a, a, b), None); + assert_eq!(circle_through(a, b, b), None); + assert_eq!(circle_through(a, a, a), None); + assert_eq!(circle_through(a, b, a.midpoint(b)), None); + assert_eq!(circle_through(a, b, a + (b - a) * 3.0), None); + assert_eq!(circle_through(a, b, Point::new(f64::NAN, 0.0)), None); + } + + /// Nearly on one line: a point 10⁻⁴ off a chord 2000 long still gives the circle (its sagitta + /// formula `r = (h² + (L/2)²) / 2h`), and its center sits on the chord's perpendicular + /// bisector; a point 10⁻¹² off it does not. + #[test] + fn nearly_collinear_points_give_a_stable_circle() { + let (a, b) = (Point::new(-1000.0, 0.0), Point::new(1000.0, 0.0)); + let h = 1e-4; + let (c, radius) = circle_through(a, b, Point::new(0.0, h)).unwrap(); + let want = (h * h + 1000.0 * 1000.0) / (2.0 * h); + assert!((radius - want).abs() / want < 1e-9, "{radius} vs {want}"); + assert!(c.x.abs() < 1e-6 && (c.y - (h - want)).abs() / want < 1e-9, "{c:?}"); + assert_eq!(circle_through(a, b, Point::new(0.0, 1e-12)), None); + } + #[test] fn rect_is_4_corners_clockwise() { let p = rectangle(Rect::new(0.0, 0.0, 100.0, 50.0)); diff --git a/crates/tools/src/shape.rs b/crates/tools/src/shape.rs index 66728b4826..e124139b54 100644 --- a/crates/tools/src/shape.rs +++ b/crates/tools/src/shape.rs @@ -8,6 +8,14 @@ //! the dragged corner snap to Smart Guides ([`DrawSnap`]), hovering before the press too. //! Escape cancels the drag and puts back the options its keys and Ctrl/Cmd changed. //! +//! With the Ellipse tool, three Shift-clicks draw the circle through the three points clicked +//! (`shape.circleThroughPoints`). Once a point is placed, a Shift-click on the selection's handles +//! or widgets places a point too. Escape, a click without Shift, a drag, a press without Shift on the +//! selection or a shape widget, and an edit, Undo or Redo made outside the tool drop the points +//! placed so far. +//! While the perspective grid shows with an active plane, a Shift-click opens the size dialog, as a +//! click does, and the shape goes on the plane. +//! //! The selection keeps its bounding box and its Live Shape widgets on show with the Rectangle, //! Rounded Rectangle, Ellipse, Polygon and Star tools, so a shape just drawn can be adjusted at //! once: a drag on a live rectangle's or polygon's corner widget rounds its corners and a drag on @@ -109,6 +117,26 @@ pub struct ShapeTool { /// The move of the selection snapped to a point, a guide or the grid at its last step: the /// arrow turns hollow, as the Selection tool's does. snapped: bool, + /// Ellipse tool: the points placed by Shift-clicks so far (fewer than three); the third + /// Shift-click draws the circle through them ([`circle_through_points`]). + through: Vec, + /// Where the pointer was last seen while `through` holds points, for the circle's preview. + hover: Option, + /// The press in progress came with Shift held, with the Ellipse tool and no active perspective + /// plane: a click places a point. + places_point: bool, +} + +/// Whether the perspective grid shows with an active plane: shapes then go on the plane. +fn perspective_plane_shown(cx: &ToolContext) -> bool { + let g = crate::distort::perspective::PerspectiveGrid::current(cx.doc); + g.visible && g.plane != crate::distort::perspective::Plane::None +} + +/// The command three Shift-clicks with the Ellipse tool run: the circle through their points. +fn circle_through_points(points: &[Point]) -> (String, Value) { + let pairs: Vec = points.iter().map(|p| json!([p.x, p.y])).collect(); + ("shape.circleThroughPoints".into(), json!({ "points": pairs })) } /// The options that keys and Ctrl/Cmd change while a shape is dragged out. @@ -159,9 +187,18 @@ impl ShapeTool { guides: vec![], measure: None, snapped: false, + through: vec![], + hover: None, + places_point: false, } } + /// Whether a press with `m` places another point for a circle: Shift with the Ellipse tool once + /// a point is placed. Such a press skips the selection's handles and widgets. + fn placing_point(&self, m: Mods) -> bool { + self.id == "ellipse" && m.shift && !self.through.is_empty() + } + fn drag_options(&self) -> DragOptions { DragOptions { sides: self.sides, points: self.points, corner_radius: self.corner_radius, star_ratio: self.star_ratio } } @@ -527,29 +564,39 @@ impl Tool for ShapeTool { match ev.kind { PointerKind::Move => { // Over a widget a press would drag, no Smart Guide for a new shape's start. - if self.over_widget(cx, ev.pos) - || self.over_handle(cx, ev.pos).is_some() - || self.over_center(cx, ev.pos) - || self.over_rotate(cx, ev.pos).is_some() + if !self.placing_point(ev.mods) + && (self.over_widget(cx, ev.pos) + || self.over_handle(cx, ev.pos).is_some() + || self.over_center(cx, ev.pos) + || self.over_rotate(cx, ev.pos).is_some()) { self.snap.clear(); + // A press there drags the widget or the selection, which drops the points. + self.hover = None; } else { - self.snap.hover(cx, ev.pos, &[], None); + // The snapped point: the third Shift-click lands where the press snaps. + let p = self.snap.hover(cx, ev.pos, &[], None); + self.hover = (!self.through.is_empty()).then_some(p); } vec![] } PointerKind::Down => { - if self.press_widget(cx, ev) { - self.snap.clear(); - return vec![]; - } - if let Some(out) = self.press_selection(cx, ev) { - return out; + if !self.placing_point(ev.mods) { + if self.press_widget(cx, ev) { + self.snap.clear(); + self.through.clear(); + return vec![]; + } + if let Some(out) = self.press_selection(cx, ev) { + self.through.clear(); + return out; + } } let p = self.snap.press(cx, ev.pos, &[], None); self.start = Some(p); self.last = ev.pos; self.began = false; + self.places_point = self.id == "ellipse" && ev.mods.shift && !perspective_plane_shown(cx); self.inner = None; self.before_drag = None; vec![] @@ -589,8 +636,20 @@ impl Tool for ShapeTool { self.before_drag = None; if self.began { self.began = false; + self.through.clear(); vec![Action::Commit] + } else if self.places_point { + // A Shift-click places a point; the third draws the circle through the three. + self.through.push(s); + self.hover = None; + if self.through.len() < 3 { + return vec![]; + } + let (c, v) = circle_through_points(&self.through); + self.through.clear(); + vec![Action::Exec(c, v)] } else { + self.through.clear(); // Alt (draw from centre) is passed on, so the size dialog can centre the shape on the click. let args = if ev.mods.alt { json!({ "x": s.x, "y": s.y, "alt": true }) } else { json!({ "x": s.x, "y": s.y }) }; vec![Action::Dialog(self.id.into(), args)] @@ -619,6 +678,12 @@ impl Tool for ShapeTool { _ => vec![], }; } + // Escape drops the points Shift-clicks placed for a circle; the document stays as it is. + if key == ToolKey::Escape && self.start.is_none() && !self.through.is_empty() { + self.through.clear(); + self.hover = None; + return vec![]; + } let Some(s) = self.start.filter(|_| self.began) else { return vec![] }; let changed = match (self.id, key) { ("polygon", ToolKey::Up) => { @@ -653,6 +718,7 @@ impl Tool for ShapeTool { } else if key == ToolKey::Escape { self.start = None; self.began = false; + self.through.clear(); self.inner = None; if let Some(o) = self.before_drag.take() { self.restore_drag_options(o); @@ -695,9 +761,23 @@ impl Tool for ShapeTool { match (&self.widget, &self.selection) { (Some(WidgetDrag::Corner(_)), _) => matches!(key, ToolKey::Up | ToolKey::Down), (_, Some(_)) => key == ToolKey::Escape, - _ => false, + _ => key == ToolKey::Escape && !self.through.is_empty(), } } + /// Points placed by Shift-clicks for a circle: Escape drops them. + fn ends_on_escape(&self, _cx: &ToolContext) -> bool { + !self.through.is_empty() + } + /// The pointer left the canvas: the circle's preview through it goes. + fn hover_ended(&mut self, _cx: &ToolContext) { + self.hover = None; + } + /// An edit, Undo or Redo made outside the tool, or another document, drops the points placed + /// for a circle. + fn history_moved(&mut self) { + self.through.clear(); + self.hover = None; + } /// The widget being dragged, the Smart Guides of the shape being drawn or the selection being /// moved, and its size, angle or offset label. fn overlays(&self, cx: &ToolContext) -> Vec { @@ -708,6 +788,17 @@ impl Tool for ShapeTool { } let mut o = self.snap.guides().to_vec(); o.extend(self.guides.iter().cloned()); + // The points Shift-clicks placed, and after two of them the circle through them and the + // pointer, dashed. + for p in &self.through { + o.push(Overlay::Anchor { p: *p, color: crate::draw2::FEEDBACK, filled: true, size: 6.0 }); + } + if let ([a, b], Some(h)) = (self.through.as_slice(), self.hover) + && let Some((c, r)) = vectorcraft_geom::shapes::circle_through(*a, *b, h) + { + let path = vectorcraft_geom::shapes::ellipse(Rect::new(c.x - r, c.y - r, c.x + r, c.y + r)).to_bezpath(); + o.push(Overlay::Path { path, color: crate::draw2::FEEDBACK, width: 1.0, dashed: true }); + } if let Some((p, text)) = &self.measure { o.push(Overlay::Measure { p: *p, text: text.clone() }); } @@ -763,8 +854,9 @@ impl Tool for ShapeTool { None => {} } // A press takes the corner and pie widgets first, then the box's handles, then the centre - // point, then the zone just outside a corner; everywhere else it draws a new shape. - if idle { + // point, then the zone just outside a corner; everywhere else it draws a new shape. A + // Shift-press that places another point for a circle skips them all. + if idle && !self.placing_point(m) { if shows_shape_widgets(self.id) && corners::over_widget(cx, p, false) { return Cursor::CornerRadius; } diff --git a/crates/tools/src/shape/tests.rs b/crates/tools/src/shape/tests.rs index c76eef404e..fe7eaa7ca5 100644 --- a/crates/tools/src/shape/tests.rs +++ b/crates/tools/src/shape/tests.rs @@ -251,6 +251,190 @@ fn click_opens_dialog() { assert_eq!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 10.0, 10.0)), vec![Action::Dialog("star".into(), json!({"x": 10.0, "y": 10.0}))]); } +/// With the Ellipse tool, the first two Shift-clicks place points (shown as marks, and with two +/// placed, the circle through them and the pointer is previewed); the third runs the circle +/// command through the three. A Shift-click with another shape tool still opens its dialog. +#[test] +fn three_shift_clicks_with_the_ellipse_tool_run_the_circle_through_them() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) }; + let shift = Mods { shift: true, ..Default::default() }; + let mut t = ShapeTool::new("ellipse"); + let click = |t: &mut ShapeTool, x: f64, y: f64| { + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, x, y).with_mods(shift)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, x, y).with_mods(shift)) + }; + assert_eq!(click(&mut t, 10.0, 10.0), vec![]); + assert_eq!(click(&mut t, 90.0, 10.0), vec![]); + assert!(t.ends_on_escape(&cx) && t.claims_key(&cx, ToolKey::Escape)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Move, 10.0, 70.0)); + let o = t.overlays(&cx); + assert_eq!(o.iter().filter(|o| matches!(o, Overlay::Anchor { .. })).count(), 2, "{o:?}"); + let preview = o.iter().find_map(|o| match o { + Overlay::Path { path, dashed: true, .. } => Some(path.clone()), + _ => None, + }); + let b = vectorcraft_geom::Shape::bounding_box(&preview.expect("the circle is previewed")); + assert!(b.x0.abs() < 1e-9 && (b.y0 + 10.0).abs() < 1e-9 && (b.x1 - 100.0).abs() < 1e-9 && (b.y1 - 90.0).abs() < 1e-9, "{b:?}"); + assert_eq!( + click(&mut t, 10.0, 70.0), + vec![Action::Exec("shape.circleThroughPoints".into(), json!({"points": [[10.0, 10.0], [90.0, 10.0], [10.0, 70.0]]}))] + ); + assert!(!t.ends_on_escape(&cx) && t.overlays(&cx).is_empty()); + // Another shape tool keeps its dialog on a Shift-click. + let mut r = ShapeTool::new("rectangle"); + assert_eq!(click(&mut r, 10.0, 10.0), vec![Action::Dialog("rectangle".into(), json!({"x": 10.0, "y": 10.0}))]); +} + +/// With Smart Guides on, the preview passes through the point the pointer snaps to, which is where +/// the third Shift-click lands. +#[test] +fn the_circle_preview_passes_through_the_snapped_pointer() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let cx = cx(&d, &s, &p); + let shift = Mods { shift: true, ..Default::default() }; + let mut t = ShapeTool::new("ellipse"); + for (x, y) in [(300.0, 0.0), (300.0, 200.0)] { + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, x, y).with_mods(shift)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, x, y).with_mods(shift)); + } + // Near the rectangle's corner anchor at (100, 100): the circle through (300, 0), (300, 200) + // and (100, 100) has its center at (225, 100) and radius 125. + t.pointer(&cx, &PointerEvent::new(PointerKind::Move, 98.0, 102.0)); + let preview = t.overlays(&cx).into_iter().find_map(|o| match o { + Overlay::Path { path, dashed: true, .. } => Some(path), + _ => None, + }); + let b = vectorcraft_geom::Shape::bounding_box(&preview.expect("the circle is previewed")); + let want = [100.0, -25.0, 350.0, 225.0]; + assert!([b.x0, b.y0, b.x1, b.y1].iter().zip(want).all(|(a, w)| (a - w).abs() < 1e-9), "{b:?}"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 98.0, 102.0).with_mods(shift)); + let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 98.0, 102.0).with_mods(shift)); + assert!(matches!(&a[..], [Action::Exec(_, v)] if v["points"][2] == json!([100.0, 100.0])), "{a:?}"); +} + +/// Escape, a plain click and a drag drop the points Shift-clicks placed, so the next Shift-click +/// starts a new circle. +#[test] +fn escape_a_click_or_a_drag_drops_the_shift_clicked_points() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) }; + let shift = Mods { shift: true, ..Default::default() }; + let mut t = ShapeTool::new("ellipse"); + let shift_click = |t: &mut ShapeTool, x: f64, y: f64| { + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, x, y).with_mods(shift)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, x, y).with_mods(shift)) + }; + shift_click(&mut t, 10.0, 10.0); + shift_click(&mut t, 90.0, 10.0); + assert_eq!(t.key(&cx, ToolKey::Escape, Mods::default()), vec![]); + assert!(!t.ends_on_escape(&cx)); + shift_click(&mut t, 10.0, 10.0); + shift_click(&mut t, 90.0, 10.0); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 50.0, 50.0)); + assert_eq!( + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 50.0, 50.0)), + vec![Action::Dialog("ellipse".into(), json!({"x": 50.0, "y": 50.0}))] + ); + assert!(!t.ends_on_escape(&cx), "a plain click drops them"); + shift_click(&mut t, 10.0, 10.0); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 50.0, 50.0).with_mods(shift)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 90.0, 90.0).with_mods(shift)); + assert_eq!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 90.0, 90.0).with_mods(shift)), vec![Action::Commit]); + assert!(!t.ends_on_escape(&cx), "a Shift-drag draws a circle and drops them"); + // A move of the selection by its centre point drops them too. + let (d, s) = unfilled_live_rect(); + let c = ToolContext { smart_guides: false, ..crate::testutil::cx(&d, &s, &p) }; + let mut t = ShapeTool::new("ellipse"); + for (x, y) in [(10.0, 10.0), (90.0, 10.0)] { + t.pointer(&c, &PointerEvent::new(PointerKind::Down, x, y).with_mods(shift)); + t.pointer(&c, &PointerEvent::new(PointerKind::Up, x, y).with_mods(shift)); + } + assert!(t.ends_on_escape(&c)); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, 150.0, 150.0)); + t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 170.0, 160.0)); + assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, 170.0, 160.0)), vec![Action::Commit]); + assert!(!t.ends_on_escape(&c), "a move of the selection drops them"); +} + +/// Once a point is placed, a Shift-click on the selection's side handle or centre point places a +/// point instead of scaling or moving the selection, and the cursor over them is the crosshair. +#[test] +fn shift_clicks_on_the_selection_place_points_once_one_is_placed() { + let (d, s) = unfilled_live_rect(); + let p = paint(); + let c = ToolContext { smart_guides: false, ..cx(&d, &s, &p) }; + let shift = Mods { shift: true, ..Default::default() }; + let mut t = ShapeTool::new("ellipse"); + let centre = Point::new(150.0, 150.0); + assert_eq!(t.cursor(&c, centre, shift), Cursor::Move, "no point placed yet: the centre point moves"); + let click = |t: &mut ShapeTool, x: f64, y: f64| { + t.pointer(&c, &PointerEvent::new(PointerKind::Down, x, y).with_mods(shift)); + t.pointer(&c, &PointerEvent::new(PointerKind::Up, x, y).with_mods(shift)) + }; + assert_eq!(click(&mut t, 10.0, 10.0), vec![]); + assert_eq!(t.cursor(&c, centre, shift), Cursor::Crosshair); + assert_eq!(t.cursor(&c, centre, Mods::default()), Cursor::Move, "without Shift a press still moves the selection"); + assert_eq!(click(&mut t, 100.0, 150.0), vec![], "the left side handle"); + assert!(!t.busy()); + assert_eq!( + click(&mut t, centre.x, centre.y), + vec![Action::Exec("shape.circleThroughPoints".into(), json!({"points": [[10.0, 10.0], [100.0, 150.0], [150.0, 150.0]]}))] + ); +} + +/// The pointer leaving the canvas removes the circle's preview, and an edit, Undo or Redo made +/// outside the tool drops the points placed so far. +#[test] +fn leaving_the_canvas_or_an_outside_edit_clears_the_circle_in_progress() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) }; + let shift = Mods { shift: true, ..Default::default() }; + let mut t = ShapeTool::new("ellipse"); + let click = |t: &mut ShapeTool, x: f64, y: f64| { + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, x, y).with_mods(shift)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, x, y).with_mods(shift)) + }; + let dashed = |t: &ShapeTool| t.overlays(&cx).iter().any(|o| matches!(o, Overlay::Path { dashed: true, .. })); + click(&mut t, 10.0, 10.0); + click(&mut t, 90.0, 10.0); + t.pointer(&cx, &PointerEvent::new(PointerKind::Move, 10.0, 70.0)); + assert!(dashed(&t)); + t.hover_ended(&cx); + assert!(!dashed(&t), "no preview through a pointer off the canvas"); + assert!(t.ends_on_escape(&cx), "the points stay"); + t.history_moved(); + assert!(!t.ends_on_escape(&cx) && t.overlays(&cx).is_empty()); + assert_eq!(click(&mut t, 10.0, 70.0), vec![], "the next Shift-click starts a new circle"); +} + +/// While the perspective grid shows with an active plane, a Shift-click with the Ellipse tool opens +/// the size dialog, whose shape goes on the plane, as before. +#[test] +fn a_shift_click_on_an_active_perspective_plane_opens_the_dialog() { + let (mut d, _) = doc_with_rect(); + crate::distort::perspective::PerspectiveGrid::preset(2, Rect::new(0.0, 0.0, 612.0, 792.0)).store(&mut d); + let s = Selection::default(); + let p = paint(); + let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) }; + let shift = Mods { shift: true, ..Default::default() }; + let mut t = ShapeTool::new("ellipse"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 10.0, 10.0).with_mods(shift)); + assert_eq!( + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 10.0, 10.0).with_mods(shift)), + vec![Action::Dialog("ellipse".into(), json!({"x": 10.0, "y": 10.0}))] + ); + assert!(!t.ends_on_escape(&cx)); +} + #[test] fn alt_click_passes_draw_from_centre_to_the_dialog() { let (d, _) = doc_with_rect(); diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 87ce2c3730..011a71e890 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5940,6 +5940,9 @@ digits Malayalam Malaiàlam @msg no active document no hi ha cap document actiu @msg no active perspective plane no hi ha cap pla de perspectiva actiu @msg no anchor points selected no hi ha cap punt d’ancoratge seleccionat +@msg `points` must be three [x, y] pairs of numbers `points` han de ser tres parells de nombres [x, y] +@msg direct-select three anchor points, or give `points` seleccioneu directament tres punts d’ancoratge o indiqueu `points` +@msg no circle passes through these points: two are the same or all three lie on one line cap cercle no passa per aquests punts: dos són iguals o tots tres són en una mateixa recta @msg no app to open files here aquí no hi ha cap aplicació per obrir fitxers @msg no artboard no hi ha tauler @msg no artboard {i} (0-based; the document has {_1}) no hi ha el tauler {i} (basat en 0; el document en té {_1}) diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index ffc55aad5a..184b3ddb18 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -5111,6 +5111,9 @@ imageTrace Outline Obrys @msg no active document žádný aktivní dokument @msg no active perspective plane žádná aktivní perspektivní rovina @msg no anchor points selected nejsou vybrány žádné kotevní body +@msg `points` must be three [x, y] pairs of numbers `points` musí být tři dvojice čísel [x, y] +@msg direct-select three anchor points, or give `points` vyberte přímým výběrem tři kotevní body, nebo zadejte `points` +@msg no circle passes through these points: two are the same or all three lie on one line těmito body neprochází žádná kružnice: dva jsou stejné nebo všechny tři leží na jedné přímce @msg no app to open files here zde chybí aplikace pro otevírání souborů @msg no artboard žádná pracovní plocha @msg no artboard {i} (0-based; the document has {_1}) pracovní plocha {i} neexistuje (číslováno od 0; dokument jich má {_1}) diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index edce184e8e..21df082dac 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5271,6 +5271,9 @@ imageTrace Outline Kontur @msg no active document intet aktivt dokument @msg no active perspective plane intet aktivt perspektivplan @msg no anchor points selected ingen ankerpunkter er markeret +@msg `points` must be three [x, y] pairs of numbers `points` skal være tre talpar [x, y] +@msg direct-select three anchor points, or give `points` direkte markér tre ankerpunkter, eller angiv `points` +@msg no circle passes through these points: two are the same or all three lie on one line ingen cirkel går gennem disse punkter: to er ens, eller alle tre ligger på én linje @msg no app to open files here ingen app til at åbne filer her @msg no artboard ingen tegneflade @msg no artboard {i} (0-based; the document has {_1}) ingen tegneflade {i} (0-baseret; dokumentet har {_1}) diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index c456cd5bc1..2664445fd0 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -4715,6 +4715,9 @@ theme Appearance Erscheinungsbild @msg no active document kein aktives Dokument @msg no active perspective plane keine aktive Perspektivebene @msg no anchor points selected keine Ankerpunkte ausgewählt +@msg `points` must be three [x, y] pairs of numbers `points` muss aus drei Zahlenpaaren [x, y] bestehen +@msg direct-select three anchor points, or give `points` wählen Sie drei Ankerpunkte direkt aus oder geben Sie `points` an +@msg no circle passes through these points: two are the same or all three lie on one line durch diese Punkte verläuft kein Kreis: zwei sind gleich oder alle drei liegen auf einer Linie @msg no app to open files here hier gibt es keine App zum Öffnen von Dateien @msg no artboard keine Zeichenfläche @msg no artboard {i} (0-based; the document has {_1}) keine Zeichenfläche {i} (Zählung ab 0; das Dokument hat {_1}) diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 4e30f47e3f..5844d70f89 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -4761,6 +4761,9 @@ digits Malayalam Μαλαγιάλαμ @msg no active document δεν υπάρχει ενεργό έγγραφο @msg no active perspective plane δεν υπάρχει ενεργό επίπεδο προοπτικής @msg no anchor points selected δεν έχουν επιλεγεί σημεία αγκύρωσης +@msg `points` must be three [x, y] pairs of numbers το `points` πρέπει να είναι τρία ζεύγη αριθμών [x, y] +@msg direct-select three anchor points, or give `points` επιλέξτε άμεσα τρία σημεία αγκύρωσης ή δώστε `points` +@msg no circle passes through these points: two are the same or all three lie on one line κανένας κύκλος δεν περνά από αυτά τα σημεία: δύο είναι ίδια ή και τα τρία βρίσκονται σε μία ευθεία @msg no app to open files here δεν υπάρχει εφαρμογή για άνοιγμα αρχείων εδώ @msg no artboard δεν υπάρχει πίνακας σχεδίασης @msg no artboard {i} (0-based; the document has {_1}) δεν υπάρχει πίνακας σχεδίασης {i} (αρίθμηση από 0· το έγγραφο περιέχει {_1}) diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 6719052a94..17a5bdae51 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4804,6 +4804,9 @@ axis Both Ambos @msg no active document no hay ningún documento activo @msg no active perspective plane no hay ningún plano de perspectiva activo @msg no anchor points selected no hay puntos de ancla seleccionados +@msg `points` must be three [x, y] pairs of numbers `points` debe ser tres pares de números [x, y] +@msg direct-select three anchor points, or give `points` seleccione directamente tres puntos de ancla o indique `points` +@msg no circle passes through these points: two are the same or all three lie on one line ningún círculo pasa por estos puntos: dos son iguales o los tres están en una misma línea @msg no app to open files here aquí no hay ninguna aplicación para abrir archivos @msg no artboard no hay mesa de trabajo @msg no artboard {i} (0-based; the document has {_1}) no existe la mesa de trabajo {i} (contando desde 0; el documento tiene {_1}) diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 2ed3c5e427..5c4b3aaa81 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -5027,6 +5027,9 @@ imageTrace Outline Ääriviiva @msg no active document ei aktiivista asiakirjaa @msg no active perspective plane ei aktiivista perspektiivitasoa @msg no anchor points selected ankkuripisteitä ei ole valittu +@msg `points` must be three [x, y] pairs of numbers `points` on annettava kolmena lukuparina [x, y] +@msg direct-select three anchor points, or give `points` valitse suoraan kolme ankkuripistettä tai anna `points` +@msg no circle passes through these points: two are the same or all three lie on one line näiden pisteiden kautta ei kulje ympyrää: kaksi pisteistä on samoja tai kaikki kolme ovat samalla suoralla @msg no app to open files here täällä ei ole sovellusta tiedostojen avaamiseen @msg no artboard ei piirtoalustaa @msg no artboard {i} (0-based; the document has {_1}) ei piirtoalustaa {i} (0-pohjainen; asiakirjassa on {_1}) diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 6a735eb1eb..4bc1541415 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -4783,6 +4783,9 @@ axis Both Les deux @msg no active document aucun document actif @msg no active perspective plane aucun plan de perspective actif @msg no anchor points selected aucun point d’ancrage sélectionné +@msg `points` must be three [x, y] pairs of numbers `points` doit contenir trois paires de nombres [x, y] +@msg direct-select three anchor points, or give `points` sélectionnez trois points d’ancrage avec l’outil Sélection directe, ou indiquez `points` +@msg no circle passes through these points: two are the same or all three lie on one line aucun cercle ne passe par ces points : deux sont identiques ou les trois sont alignés @msg no app to open files here aucune application pour ouvrir des fichiers ici @msg no artboard aucun plan de travail @msg no artboard {i} (0-based; the document has {_1}) aucun plan de travail {i} (numérotation à partir de 0 ; le document en a {_1}) diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index aedec9da73..c3c114bd93 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -7411,6 +7411,9 @@ antiAlias Sharp शार्प @msg no active document कोई सक्रिय डॉक्यूमेंट @msg no active perspective plane कोई सक्रिय पर्सपेक्टिव विमान नहीं @msg no anchor points selected कोई एंकर पॉइंट सिलेक्ट नहीं है +@msg `points` must be three [x, y] pairs of numbers `points` में संख्याओं के तीन [x, y] जोड़े होने चाहिए +@msg direct-select three anchor points, or give `points` तीन एंकर पॉइंट्स डायरेक्ट-सिलेक्ट करें, या `points` दें +@msg no circle passes through these points: two are the same or all three lie on one line इन पॉइंट्स से होकर कोई वृत्त नहीं गुज़रता: दो एक जैसे हैं या तीनों एक ही रेखा पर हैं @msg no app to open files here यहां फ़ाइलों को ओपन करने के लिए कोई ऐप नहीं है @msg no appearance item {index} कोई उपस्थिति आइटम {index} @msg no artboard कोई आर्टबोर्ड नहीं diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 80a39e7c70..ff6b1620ee 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5484,6 +5484,9 @@ imageTrace Outline Körvonal @msg no active document nincs aktív dokumentum @msg no active perspective plane nincs aktív perspektivikus sík @msg no anchor points selected nincs kijelölt horgonypont +@msg `points` must be three [x, y] pairs of numbers a `points` három [x, y] számpár legyen +@msg direct-select three anchor points, or give `points` jelölj ki közvetlen kijelöléssel három horgonypontot, vagy add meg a `points` értéket +@msg no circle passes through these points: two are the same or all three lie on one line ezeken a pontokon nem halad át kör: kettő egybeesik, vagy mindhárom egy egyenesen van @msg no app to open files here itt nincs fájlmegnyitó alkalmazás @msg no artboard nincs rajztábla @msg no artboard {i} (0-based; the document has {_1}) nincs ilyen sorszámú rajztábla: {i} (0-tól számozva; a dokumentumban ennyi van: {_1}) diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 66d162f02c..c65defea0f 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4845,6 +4845,9 @@ axis Both Entrambi @msg no active document nessun documento attivo @msg no active perspective plane nessun piano prospettico attivo @msg no anchor points selected nessun punto di ancoraggio selezionato +@msg `points` must be three [x, y] pairs of numbers `points` deve essere composto da tre coppie di numeri [x, y] +@msg direct-select three anchor points, or give `points` seleziona con Selezione diretta tre punti di ancoraggio oppure indica `points` +@msg no circle passes through these points: two are the same or all three lie on one line nessun cerchio passa per questi punti: due coincidono oppure tutti e tre sono allineati @msg no app to open files here nessuna app per aprire file qui @msg no artboard nessuna tavola da disegno @msg no artboard {i} (0-based; the document has {_1}) nessuna tavola da disegno {i} (a partire da 0; il documento ne ha {_1}) diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index e6fcd47ccc..7594c1fd57 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -4690,6 +4690,9 @@ swatch Bright Violet ビビッドバイオレット @msg image would be too large; lower the resolution 画像が大きくなりすぎるため、解像度を下げてください @msg clipboard is empty クリップボードが空です @msg no anchor points selected アンカーポイントが選択されていません +@msg `points` must be three [x, y] pairs of numbers `points` は 3 組の数値 [x, y] にしてください +@msg direct-select three anchor points, or give `points` アンカーポイントを 3 つダイレクト選択するか、`points` を指定してください +@msg no circle passes through these points: two are the same or all three lie on one line これらの点を通る円はありません: 2 つの点が同じか、3 点すべてが一直線上にあります @msg select at least two objects オブジェクトを 2 つ以上選択してください @msg exit isolation mode first 先に分離モードを終了してください @msg no saved presets 保存したプリセットはありません diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 9475bb917c..2b3a57ca74 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6557,6 +6557,9 @@ font-technology Variable ცვლადი @msg no active document აქტიური დოკუმენტი არ არის @msg no active perspective plane აქტიური პერსპექტივის სიბრტყე არ არის @msg no anchor points selected საყრდენი წერტილები მონიშნული არ არის +@msg `points` must be three [x, y] pairs of numbers `points` უნდა იყოს რიცხვების სამი [x, y] წყვილი +@msg direct-select three anchor points, or give `points` პირდაპირი მონიშვნით მონიშნეთ სამი საყრდენი წერტილი ან მიუთითეთ `points` +@msg no circle passes through these points: two are the same or all three lie on one line ამ წერტილებზე წრეწირი არ გადის: ორი ერთნაირია ან სამივე ერთ წრფეზე მდებარეობს @msg no app to open files here აქ ფაილების გასახსნელი აპი არ არის @msg no artboard სამუშაო დაფა არ არის @msg no artboard {i} (0-based; the document has {_1}) სამუშაო დაფა {i} არ არსებობს (0-დან ითვლება; დოკუმენტს აქვს {_1}) diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index ea9a413f88..c4cee8e14c 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -4617,6 +4617,9 @@ theme Appearance 외관 @msg image would be too large; lower the resolution 이미지가 너무 커집니다. 해상도를 낮추세요 @msg clipboard is empty 클립보드가 비어 있습니다 @msg no anchor points selected 선택한 앵커 포인트가 없습니다 +@msg `points` must be three [x, y] pairs of numbers `points`는 숫자 쌍 [x, y] 세 개여야 합니다 +@msg direct-select three anchor points, or give `points` 앵커 포인트 세 개를 직접 선택하거나 `points`를 지정하세요 +@msg no circle passes through these points: two are the same or all three lie on one line 이 점들을 지나는 원이 없습니다: 두 점이 같거나 세 점이 모두 한 직선 위에 있습니다 @msg select at least two objects 개체를 두 개 이상 선택하세요 @msg exit isolation mode first 먼저 격리 모드를 종료하세요 @msg no saved presets 저장된 프리셋이 없습니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index bf8fd86aa3..6a04803c76 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5166,6 +5166,9 @@ imageTrace Outline Contour @msg no active document geen actief document @msg no active perspective plane geen actief perspectiefvlak @msg no anchor points selected geen ankerpunten geselecteerd +@msg `points` must be three [x, y] pairs of numbers `points` moet uit drie getallenparen [x, y] bestaan +@msg direct-select three anchor points, or give `points` selecteer met directe selectie drie ankerpunten of geef `points` op +@msg no circle passes through these points: two are the same or all three lie on one line er gaat geen cirkel door deze punten: twee zijn gelijk of alle drie liggen op één lijn @msg no app to open files here hier is geen app om bestanden mee te openen @msg no artboard geen tekengebied @msg no artboard {i} (0-based; the document has {_1}) geen tekengebied {i} (vanaf 0; het document heeft er {_1}) diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index da2304edad..4eca975dfd 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4934,6 +4934,9 @@ imageTrace Outline Kontur @msg no active document brak aktywnego dokumentu @msg no active perspective plane brak aktywnej płaszczyzny perspektywy @msg no anchor points selected nie zaznaczono punktów kontrolnych +@msg `points` must be three [x, y] pairs of numbers `points` musi zawierać trzy pary liczb [x, y] +@msg direct-select three anchor points, or give `points` zaznacz bezpośrednio trzy punkty kontrolne lub podaj `points` +@msg no circle passes through these points: two are the same or all three lie on one line przez te punkty nie przechodzi żaden okrąg: dwa są takie same albo wszystkie trzy leżą na jednej prostej @msg no app to open files here brak aplikacji do otwierania plików @msg no artboard brak obszaru kompozycji @msg no artboard {i} (0-based; the document has {_1}) brak obszaru kompozycji {i} (numeracja od 0; dokument ma {_1}) diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 772a72544a..972af0b236 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -4168,6 +4168,9 @@ axis Both Ambos @msg no active document nenhum documento ativo @msg no active perspective plane nenhum plano de perspectiva ativo @msg no anchor points selected nenhum ponto de ancoragem selecionado +@msg `points` must be three [x, y] pairs of numbers `points` deve ter três pares de números [x, y] +@msg direct-select three anchor points, or give `points` selecione diretamente três pontos de ancoragem ou informe `points` +@msg no circle passes through these points: two are the same or all three lie on one line nenhum círculo passa por esses pontos: dois são iguais ou os três estão na mesma reta @msg no app to open files here nenhum aplicativo para abrir arquivos aqui @msg no artboard nenhuma prancheta @msg no artboard {i} (0-based; the document has {_1}) nenhuma prancheta {i} (base 0; o documento tem {_1}) diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 02cdb08e31..4ecf3e2988 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -4841,6 +4841,9 @@ axis Both Оба @msg no active document нет активного документа @msg no active perspective plane нет активной плоскости перспективы @msg no anchor points selected опорные точки не выделены +@msg `points` must be three [x, y] pairs of numbers `points` должен содержать три пары чисел [x, y] +@msg direct-select three anchor points, or give `points` выделите прямым выделением три опорные точки или задайте `points` +@msg no circle passes through these points: two are the same or all three lie on one line через эти точки не проходит ни одна окружность: две точки совпадают или все три лежат на одной прямой @msg no app to open files here здесь нет приложения для открытия файлов @msg no artboard нет монтажной области @msg no artboard {i} (0-based; the document has {_1}) нет монтажной области {i} (счёт с 0; в документе {_1}) diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index d4d0d0a4b5..38723ad2b6 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -4705,6 +4705,9 @@ axis Both Båda @msg no active document inget aktivt dokument @msg no active perspective plane inget aktivt perspektivplan @msg no anchor points selected inga ankarpunkter är markerade +@msg `points` must be three [x, y] pairs of numbers `points` måste vara tre talpar [x, y] +@msg direct-select three anchor points, or give `points` direktmarkera tre ankarpunkter eller ange `points` +@msg no circle passes through these points: two are the same or all three lie on one line ingen cirkel går genom de här punkterna: två är samma punkt eller så ligger alla tre på en linje @msg no app to open files here det finns ingen app för att öppna filer här @msg no artboard ingen rityta @msg no artboard {i} (0-based; the document has {_1}) ingen rityta {i} (räknat från 0; dokumentet har {_1}) diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index cd471d910c..a3e61585b8 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -4537,6 +4537,9 @@ axis Both Her İkisi @msg no active document etkin belge yok @msg no active perspective plane aktif perspektif düzlemi yok @msg no anchor points selected bağlantı noktası seçilmedi +@msg `points` must be three [x, y] pairs of numbers `points` üç [x, y] sayı çifti olmalıdır +@msg direct-select three anchor points, or give `points` üç bağlantı noktasını doğrudan seçin veya `points` verin +@msg no circle passes through these points: two are the same or all three lie on one line bu noktalardan geçen bir çember yok: ikisi aynı ya da üçü de aynı doğru üzerinde @msg no app to open files here burada dosyaları açacak uygulama yok @msg no artboard çalışma yüzeyi yok @msg no artboard {i} (0-based; the document has {_1}) çalışma yüzeyi yok {i} (0 tabanlı; belgede {_1} var) diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index bc0ffe5928..0a05b5e6b2 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -4829,6 +4829,9 @@ axis Both Обидві @msg no active document немає активного документа @msg no active perspective plane немає активної площини перспективи @msg no anchor points selected опорні точки не виділені +@msg `points` must be three [x, y] pairs of numbers `points` має містити три пари чисел [x, y] +@msg direct-select three anchor points, or give `points` виділіть три опорні точки прямим виділенням або задайте `points` +@msg no circle passes through these points: two are the same or all three lie on one line через ці точки не проходить жодне коло: дві точки збігаються або всі три лежать на одній прямій @msg no app to open files here тут немає програми для відкриття файлів @msg no artboard немає монтажної області @msg no artboard {i} (0-based; the document has {_1}) немає монтажної області {i} (рахунок з 0; у документі {_1}) diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index a8543b90ae..c4c1369586 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5152,6 +5152,9 @@ theme Appearance Giao diện @msg no active document không có tài liệu đang hoạt động @msg no active perspective plane không có mặt phẳng phối cảnh đang hoạt động @msg no anchor points selected chưa chọn điểm neo +@msg `points` must be three [x, y] pairs of numbers `points` phải là ba cặp số [x, y] +@msg direct-select three anchor points, or give `points` hãy chọn trực tiếp ba điểm neo hoặc cung cấp `points` +@msg no circle passes through these points: two are the same or all three lie on one line không có đường tròn nào đi qua các điểm này: hai điểm trùng nhau hoặc cả ba điểm thẳng hàng @msg no app to open files here không có ứng dụng để mở tệp ở đây @msg no artboard không có bảng vẽ @msg no artboard {i} (0-based; the document has {_1}) không có bảng vẽ {i} (bắt đầu từ 0; tài liệu có {_1}) diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 04dedf4229..05889711cc 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -4388,6 +4388,9 @@ imageTrace Outline 轮廓 @msg image would be too large; lower the resolution 图像将过大;请降低分辨率 @msg clipboard is empty 剪贴板为空 @msg no anchor points selected 未选择锚点 +@msg `points` must be three [x, y] pairs of numbers `points` 必须是三对数字 [x, y] +@msg direct-select three anchor points, or give `points` 请直接选择三个锚点,或提供 `points` +@msg no circle passes through these points: two are the same or all three lie on one line 没有圆经过这些点:有两点相同,或三点共线 @msg select at least two objects 请至少选择两个对象 @msg exit isolation mode first 请先退出隔离模式 @msg no saved presets 没有已保存的预设 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 7e3cb24439..991791187f 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2033,6 +2033,9 @@ file-filter Templates 範本 @msg image would be too large; lower the resolution 影像會過大;請降低解析度 @msg clipboard is empty 剪貼簿是空的 @msg no anchor points selected 未選取錨點 +@msg `points` must be three [x, y] pairs of numbers `points` 必須是三組數字 [x, y] +@msg direct-select three anchor points, or give `points` 請以直接選取方式選取三個錨點,或提供 `points` +@msg no circle passes through these points: two are the same or all three lie on one line 沒有圓通過這些點:有兩點相同,或三點共線 @msg select at least two objects 請選取至少兩個物件 @msg exit isolation mode first 請先結束隔離模式 @msg no saved presets 沒有已儲存的預設集 diff --git a/docs/mcp.md b/docs/mcp.md index b7b4905ef4..2a602f4d80 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5851,6 +5851,29 @@ slider (`ui.menuDialog {command: "object.path.smooth"}`, dialog `smoothSlider` w Auto-Smooth level, and the slider previews the result until `ui.dialog.confirm`; `ui.smoothAuto` moves the open slider back to the Auto-Smooth level. +## Circle through three points + +`shape.circleThroughPoints {points?: [[x, y], [x, y], [x, y]]}` draws the circle whose edge passes through three +points, as a live ellipse with the current paint, and selects it. Without `points`, it uses the three selected anchor +points, from one path or several: anchor points selected with Direct Selection, or all the anchor points of a path +selected whole, such as a triangle. The ends of selected segments do not count. The result is `{id, cx, cy, radius}`, +and one undo removes the circle. The circle is not pixel-aligned, even while the document's +[Align New Objects to Pixel Grid](#align-new-objects-to-pixel-grid) is on, so it stays through the points. The command +returns an error and draws nothing when two points are the same or the three lie on one line (twice the triangle's area +at most 10⁻¹⁰ of its longest side squared), when `points` is not three pairs of numbers, and when `points` is left out +and the selection does not hold exactly three anchor points of paths. + +With the Ellipse tool, the first two Shift-clicks place points, and the third draws the circle through the three with +this command. After two points the tool previews the circle through them and the pointer as a dashed outline. Once a +point is placed, a Shift-click on the selection's handles, center point or shape widgets places a point too. Escape, a +click without Shift, a drag, a press without Shift on the selection or a shape widget, and an edit, Undo or Redo made +outside the tool remove the points placed so far. A Shift-drag still draws a circle from corner to corner. While the +perspective grid shows with an active plane, a Shift-click opens the size dialog, as a click does. + +```json +{"name":"run_command","arguments":{"command":"shape.circleThroughPoints","params":{"points":[[0,0],[80,0],[0,60]]}}} +``` + ## Editing a path with the Curvature tool The Curvature tool edits any selected path, whatever drew it, keeping its shape except where edited (#798). Each edit From 5f33c7d7f346a763b2e446139c20b6f2a15b5ba6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 12:13:53 -0800 Subject: [PATCH 029/226] Shapes: Escape during the third Shift-click drops the press With two points placed, Escape pressed while the third Shift-click is held now drops the points and the press, so the release draws no circle. --- crates/tools/src/shape.rs | 9 +++++++-- crates/tools/src/shape/tests.rs | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/crates/tools/src/shape.rs b/crates/tools/src/shape.rs index e124139b54..8a1c4a1249 100644 --- a/crates/tools/src/shape.rs +++ b/crates/tools/src/shape.rs @@ -678,10 +678,15 @@ impl Tool for ShapeTool { _ => vec![], }; } - // Escape drops the points Shift-clicks placed for a circle; the document stays as it is. - if key == ToolKey::Escape && self.start.is_none() && !self.through.is_empty() { + // Escape drops the points Shift-clicks placed for a circle; the document stays as it is. A + // press that has not begun a drag is dropped too, so its release places no point. + if key == ToolKey::Escape && !self.began && !self.through.is_empty() { self.through.clear(); self.hover = None; + if self.start.take().is_some() { + self.places_point = false; + self.snap.clear(); + } return vec![]; } let Some(s) = self.start.filter(|_| self.began) else { return vec![] }; diff --git a/crates/tools/src/shape/tests.rs b/crates/tools/src/shape/tests.rs index fe7eaa7ca5..3968615715 100644 --- a/crates/tools/src/shape/tests.rs +++ b/crates/tools/src/shape/tests.rs @@ -363,6 +363,28 @@ fn escape_a_click_or_a_drag_drops_the_shift_clicked_points() { assert!(!t.ends_on_escape(&c), "a move of the selection drops them"); } +/// Escape pressed while the third Shift-click is held drops the points and the press, so the +/// release draws no circle. +#[test] +fn escape_during_the_third_shift_click_drops_the_points_and_the_press() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let cx = ToolContext { smart_guides: false, ..cx(&d, &s, &p) }; + let shift = Mods { shift: true, ..Default::default() }; + let mut t = ShapeTool::new("ellipse"); + for (x, y) in [(10.0, 10.0), (90.0, 10.0)] { + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, x, y).with_mods(shift)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, x, y).with_mods(shift)); + } + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 10.0, 70.0).with_mods(shift)); + assert!(t.claims_key(&cx, ToolKey::Escape)); + assert_eq!(t.key(&cx, ToolKey::Escape, shift), vec![]); + assert!(!t.ends_on_escape(&cx) && t.overlays(&cx).is_empty()); + assert_eq!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 10.0, 70.0).with_mods(shift)), vec![]); + assert!(!t.ends_on_escape(&cx), "the release places no point"); +} + /// Once a point is placed, a Shift-click on the selection's side handle or centre point places a /// point instead of scaling or moving the selection, and the cursor over them is the crosshair. #[test] From b04780190396e8d35c0ffa4129401d4be94353f9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 19:25:14 -0800 Subject: [PATCH 030/226] Command Palette: keys in one frame move the highlight in the order pressed Page Down, Up and the other keys that move the highlighted result now apply in the order they were pressed, so Page Down then Up in one frame lands one row above the page rather than on the last result. A scroll by any amount, not only steps over half a point, moves the highlight onto a row in view, so slow scrolling cannot carry the highlighted result out of sight while Enter still runs it. --- crates/ui-egui/src/palette.rs | 122 +++++++++++++++++++++++++--------- 1 file changed, 89 insertions(+), 33 deletions(-) diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 9219328a1f..20186a555f 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -411,29 +411,30 @@ fn footer(listed: usize, total: usize) -> String { } } -/// How many times each key that moves the highlighted result was pressed this frame. +/// The keys that move the highlighted result, in the order they were pressed this frame. #[derive(Default)] -struct Moves { - down: usize, - up: usize, - page_down: usize, - page_up: usize, -} +struct Moves(Vec); impl Moves { + /// The keys that move the highlighted result. + const KEYS: [egui::Key; 4] = [egui::Key::ArrowDown, egui::Key::ArrowUp, egui::Key::PageDown, egui::Key::PageUp]; + fn any(&self) -> bool { - self.down + self.up + self.page_down + self.page_up > 0 + !self.0.is_empty() } - /// The highlighted result of `n` after these moves from `sel`, a page being `page` rows: Up and - /// Down wrap at the ends, Page Up and Page Down stop at them. + /// The highlighted result of `n` after these moves from `sel`, taken in the order they were + /// pressed, a page being `page` rows: Up and Down wrap at the ends, Page Up and Page Down stop + /// at them. fn apply(&self, sel: usize, n: usize, page: usize) -> usize { let Some(last) = n.checked_sub(1) else { return 0 }; - let sel = sel.min(last); - let sel = (sel + self.down % n) % n; - let sel = (sel + n - self.up % n) % n; - let sel = sel.saturating_add(page.saturating_mul(self.page_down)).min(last); - sel.saturating_sub(page.saturating_mul(self.page_up)) + self.0.iter().fold(sel.min(last), |sel, key| match key { + egui::Key::ArrowDown => (sel + 1) % n, + egui::Key::ArrowUp => (sel + last) % n, + egui::Key::PageDown => sel.saturating_add(page).min(last), + egui::Key::PageUp => sel.saturating_sub(page), + _ => sel, + }) } } @@ -569,13 +570,15 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { let mut moves = Moves::default(); if n > 0 && !list_open { ctx.input_mut(|i| { - let mut key = |k| i.count_and_consume_key(egui::Modifiers::NONE, k); - moves = Moves { - down: key(egui::Key::ArrowDown), - up: key(egui::Key::ArrowUp), - page_down: key(egui::Key::PageDown), - page_up: key(egui::Key::PageUp), - }; + i.events.retain(|e| match e { + egui::Event::Key { key, pressed: true, modifiers, .. } + if Moves::KEYS.contains(key) && modifiers.matches_logically(egui::Modifiers::NONE) => + { + moves.0.push(*key); + false + } + _ => true, + }); }); } let screen = ctx.content_rect(); @@ -683,9 +686,9 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { }); let before = offset; offset = out.state.clamped_offset().y; - // After a scroll with the wheel or the scroll bar, the highlight moves to the - // nearest row in view, so Enter runs a result that can be seen. - if !new_query && !moves.any() && (offset - before).abs() > 0.5 { + // After a scroll with the wheel or the scroll bar, by any amount, the highlight + // moves to the nearest row in view, so Enter runs a result that can be seen. + if !new_query && !moves.any() && (offset - before).abs() > 0.0 { sel = nearest_in_view(sel, offset, view, n); } }); @@ -1917,14 +1920,17 @@ mod tests { /// Down wrap. #[test] fn page_keys_move_by_a_page_without_wrapping() { - let moves = |down, up, page_down, page_up| Moves { down, up, page_down, page_up }; - assert_eq!(moves(0, 0, 1, 0).apply(0, 50, 12), 12); - assert_eq!(moves(0, 0, 1, 0).apply(45, 50, 12), 49); - assert_eq!(moves(0, 0, 0, 1).apply(5, 50, 12), 0); - assert_eq!(moves(1, 0, 0, 0).apply(49, 50, 12), 0); - assert_eq!(moves(0, 1, 0, 0).apply(0, 50, 12), 49); - assert_eq!(moves(3, 0, 0, 0).apply(48, 50, 12), 1); - assert_eq!(moves(1, 0, 0, 0).apply(0, 0, 12), 0); + use egui::Key::{ArrowDown, ArrowUp, PageDown, PageUp}; + let moves = |keys: &[egui::Key]| Moves(keys.to_vec()); + assert_eq!(moves(&[PageDown]).apply(0, 50, 12), 12); + assert_eq!(moves(&[PageDown]).apply(45, 50, 12), 49); + assert_eq!(moves(&[PageUp]).apply(5, 50, 12), 0); + assert_eq!(moves(&[ArrowDown]).apply(49, 50, 12), 0); + assert_eq!(moves(&[ArrowUp]).apply(0, 50, 12), 49); + assert_eq!(moves(&[ArrowDown; 3]).apply(48, 50, 12), 1); + assert_eq!(moves(&[ArrowDown]).apply(0, 0, 12), 0); + assert_eq!(moves(&[PageDown, ArrowUp]).apply(0, 50, 12), 11, "in the order pressed"); + assert_eq!(moves(&[ArrowUp, PageDown]).apply(0, 50, 12), 49, "in the order pressed"); let mut open = Open::new("select", WINDOW); open.press(egui::Key::PageDown, 1); assert_eq!(open.highlighted(), VISIBLE_ROWS); @@ -1976,6 +1982,56 @@ mod tests { assert_eq!(lit[0].0, row_label(entries(&open.ctx, Lang::EN).iter().find(|e| e.id == open.listed()[sel]).unwrap())); } + /// Page Down, Up and Enter pressed in one frame move the highlight in that order, and Enter + /// runs the result they moved it to. + #[test] + fn keys_in_one_frame_move_the_highlight_in_the_order_pressed() { + let mut open = Open::new("show panel", WINDOW); + let listed = open.listed(); + assert!(listed.len() > VISIBLE_ROWS, "{listed:?}"); + let panel = listed[VISIBLE_ROWS - 1].strip_prefix("panel:").expect("a panel's result").to_string(); + assert!(!crate::panel_docking::showing(&open.app.ui, &panel), "{panel}"); + let key = |k| egui::Event::Key { key: k, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE }; + open.frame(vec![key(egui::Key::PageDown), key(egui::Key::ArrowUp), key(egui::Key::Enter)]); + assert!(!open.app.ui.palette_open); + assert!(crate::panel_docking::showing(&open.app.ui, &panel), "{panel}: {}", open.app.ui.status); + } + + /// A scroll in steps of less than half a point a frame still moves the highlight onto a row in + /// view once the highlighted row leaves it. + #[test] + fn a_scroll_in_small_steps_keeps_the_highlight_in_view() { + let mut open = Open::new("select", WINDOW); + let nodes = open.frame(vec![]); + let first = rows(&nodes).into_iter().next().unwrap(); + let at = egui::pos2(open.popup().center().x, ((first.2 + first.3) / 2.0) as f32); + open.frame(vec![egui::Event::PointerMoved(at)]); + let wheel = egui::Event::MouseWheel { + unit: egui::MouseWheelUnit::Point, + delta: egui::vec2(0.0, -0.4), + phase: egui::TouchPhase::Move, + source: egui::MouseWheelSource::Unknown, + modifiers: egui::Modifiers::NONE, + }; + let mut nodes = Vec::new(); + for _ in 0..200 { + nodes = open.frame(vec![wheel.clone()]); + } + for _ in 0..120 { + if !open.repaint { + break; + } + nodes = open.frame(vec![]); + } + let offset = open.ctx.data(|d| d.get_temp::(egui::Id::unique("palette-selected"))).unwrap().2; + assert!(offset > ROW_HEIGHT, "the list scrolled past the first row: {offset}"); + assert!(open.highlighted() > 0, "the highlight left the row scrolled out of view"); + let popup = open.popup(); + let lit: Vec<_> = rows(&nodes).into_iter().filter(|r| r.1).collect(); + assert_eq!(lit.len(), 1, "{lit:?}"); + assert!(lit[0].2 >= f64::from(popup.top()) && lit[0].3 <= f64::from(popup.bottom()), "{lit:?} in {popup:?}"); + } + /// When the window shrinks so the list shows fewer rows, the list scrolls to keep the /// highlighted result in view, and Enter runs that result. #[test] From f17a218cfcb9d792521b54020793eb6d9c7f6af8 Mon Sep 17 00:00:00 2001 From: HassanKhan Date: Mon, 16 Nov 2026 10:51:59 +0500 Subject: [PATCH 031/226] PDF import: text filled and stroked in one operator is one Type object (#8015) With text rendering modes 2 and 6 the reader fills every glyph of a text-showing operator before stroking them, but the importer only joined a stroke to the glyph filled last, so a word shown in one Tj came in as a stroke-only Type over a fill-only one. TextLine now records the glyphs it fills and stroke_filled matches each stroke to its filled glyph in order, splitting a run where the stroke differs. --- crates/pdf/src/import/builder.rs | 4 +- crates/pdf/src/import_text.rs | 113 ++++++++++++++++++++++++- crates/pdf/src/tests/text_placement.rs | 16 ++++ crates/pdf/src/tests/textstroke.rs | 82 ++++++++++++++++++ docs/file-format-parity.md | 4 +- docs/roadmap.md | 5 +- docs/target-app-parity.md | 13 +-- 7 files changed, 223 insertions(+), 14 deletions(-) diff --git a/crates/pdf/src/import/builder.rs b/crates/pdf/src/import/builder.rs index c2650138b9..8e6d3f3cae 100644 --- a/crates/pdf/src/import/builder.rs +++ b/crates/pdf/src/import/builder.rs @@ -984,7 +984,7 @@ impl<'p> Builder<'p> { self.flush_type3(); if let (Some(s), Some(line)) = (&look.stroke, &mut self.text) && look.fill.is_none() - && line.stroke_last(font_key, at, s.clone(), overprint) + && line.stroke_filled(font_key, at, opacity, &text, s.clone(), overprint) { return true; } @@ -1146,7 +1146,7 @@ impl<'p> Builder<'p> { // A stroke over the glyph just filled (fill and stroke rendering). if let (Some(s), Some(line)) = (&look.stroke, &mut self.text) && look.fill.is_none() - && line.stroke_last(key, at, s.clone(), overprint) + && line.stroke_filled(key, at, opacity, &text, s.clone(), overprint) { self.keep_glyph(o, m, drawn, opacity, scale, overprint); return true; diff --git a/crates/pdf/src/import_text.rs b/crates/pdf/src/import_text.rs index ec4fff092a..08a2ff54e5 100644 --- a/crates/pdf/src/import_text.rs +++ b/crates/pdf/src/import_text.rs @@ -219,6 +219,12 @@ pub(crate) struct TextLine { authored: Vec, /// Fill callbacks in an authored span, for the reader's later stroke pass. actual_fills: HashMap<(u128, u64, u64), Option>, + /// The glyphs filled without a stroke, in drawing order, for a stroke drawn over them later + /// ([`stroke_filled`](Self::stroke_filled)). + filled: Vec, + /// The first of [`filled`](Self::filled) a stroke may still be drawn over: a stroke matches + /// glyphs in the order they were filled, and each at most once. + stroked: usize, /// The first glyph was set vertically ([`Upright`]). upright: Option, /// The glyphs make a column (vertical type), each below the last. @@ -251,6 +257,17 @@ struct Slot { advance: Option, } +/// A glyph filled without a stroke: its font and baseline origin, and where its text is in the +/// line's runs (the run's index, the text's byte offset in it and its length). +#[derive(Clone, Copy, Debug)] +struct Filled { + font: u128, + origin: Point, + run: usize, + start: usize, + len: usize, +} + /// What a finished line of type tells beyond its text object (see [`crate::import_lines`]). #[derive(Clone, Debug, Default)] pub(crate) struct LineFacts { @@ -283,6 +300,8 @@ impl TextLine { slots: vec![], authored: vec![], actual_fills: HashMap::new(), + filled: vec![], + stroked: 0, upright: None, column: false, ink: vec![], @@ -319,6 +338,8 @@ impl TextLine { self.at = at; self.opacity = opacity; self.runs.clear(); + self.filled.clear(); + self.stroked = 0; self.column = false; } let down = -self.at.up(); @@ -327,6 +348,7 @@ impl TextLine { self.runs.push((look.clone(), 0.0, text.to_string())); self.last_start = 0; self.record_actual_fill(look, at, content); + self.record_filled(look, at, content); self.authored.extend(text.chars().map(|_| content.authored())); (self.upright, self.next, self.last) = (Some(upright), at.origin + down * at.size, at.origin); return true; @@ -364,6 +386,7 @@ impl TextLine { self.last_start = 0; } self.record_actual_fill(look, at, content); + self.record_filled(look, at, content); self.authored.extend(text.chars().map(|_| content.authored())); self.next = at.origin + down * at.size; self.last = at.origin; @@ -394,6 +417,8 @@ impl TextLine { self.last_size = at.size; self.baseline.clear(); self.runs.clear(); + self.filled.clear(); + self.stroked = 0; } let bytes = self.text_bytes; let glyph = self.baseline.len(); @@ -461,6 +486,7 @@ impl TextLine { self.last_start = 0; } self.record_actual_fill(look, at, content); + self.record_filled(look, at, content); self.text_bytes = self.text_bytes.saturating_add(text.len()); if !pen { let one = text.chars().count() == 1 && !content.authored(); @@ -488,6 +514,17 @@ impl TextLine { } } + /// Note glyph `content` just added to the last run, filled without a stroke, for a stroke + /// drawn over it later. + fn record_filled(&mut self, look: &Look, at: Placement, content: TextContent<'_>) { + let len = content.text().len(); + if content.authored() || len == 0 || look.fill.is_none() || look.stroke.is_some() { + return; + } + let run = self.runs.len().saturating_sub(1); + self.filled.push(Filled { font: look.font, origin: at.origin, run, start: self.last_start, len }); + } + /// The reader fills a whole Tj/TJ before replaying its glyphs as strokes. A replay /// must neither consume the replacement nor rewind the pen. Only the first glyph's /// style belongs to the replacement; suppressed glyphs have no text to restyle. @@ -529,16 +566,84 @@ impl TextLine { Some(bp) } - /// A stroke (`stroke`: paint, width, cap, join and miter limit) over the glyph just drawn at - /// `at` in `font` (fill and stroke rendering), which `overprint`s or not: that glyph is - /// stroked. `false`: it isn't that glyph. + /// A stroke (`stroke`: paint, width, cap, join and miter limit) over glyph `text` drawn at + /// `at` in `font` at `opacity`, which `overprint`s or not, after the glyph was filled (fill + /// and stroke rendering): that glyph is stroked. `false`: no glyph on the line was filled so. + /// + /// The reader fills all the glyphs a text-showing operator (`Tj`, `TJ`, `'`, `"`) draws + /// before it strokes them (#8015), or fills and strokes glyph by glyph: either way each + /// stroke is matched to the next glyph filled at the same place in the same font with the + /// same text, in order. The glyph's text and the text after it in its run take the stroke: + /// those after it are the rest of the same operator's glyphs, whose strokes come next (and + /// split their text off again only when theirs differs), so a run filled whole is stroked + /// whole. The glyphs before it in the run keep their own stroke or none (#7741). + pub fn stroke_filled(&mut self, font: u128, at: Placement, opacity: f32, text: &str, stroke: TypeStroke, overprint: bool) -> bool { + let tolerance = self.at.size * 1e-3; + // A stroke at another opacity than the fill's (`CA` and `ca` differ) is type of its own. + let rest = if opacity == self.opacity { self.filled.get(self.stroked..) } else { None }; + let found = rest.and_then(|rest| { + rest.iter().position(|g| { + g.font == font + && (g.origin - at.origin).hypot() < tolerance + && self.runs.get(g.run).and_then(|(.., t)| t.get(g.start..g.start.saturating_add(g.len))) == Some(text) + }) + }); + let Some(glyph) = found.and_then(|i| self.filled.get(self.stroked + i).copied().map(|g| (i, g))) else { + // Stroked text of its own (stroke rendering): no later stroke goes back over the + // glyphs filled before it, so no stroke looks through them again. + self.stroked = self.filled.len(); + return self.stroke_last(font, at, stroke, overprint); + }; + let (i, g) = glyph; + self.stroked = self.stroked.saturating_add(i).saturating_add(1); + self.stroke_from(g.run, g.start, stroke, overprint); + true + } + + /// Stroke run `run` from byte `start` on: split there into a run of its own when the run is + /// stroked otherwise and `start` isn't its first glyph. + fn stroke_from(&mut self, run: usize, start: usize, stroke: TypeStroke, overprint: bool) { + let last = run.saturating_add(1) == self.runs.len(); + let Some((look, shift, text)) = self.runs.get_mut(run) else { return }; + if look.stroke.as_ref() == Some(&stroke) && look.overprint_stroke == overprint { + return; + } + if !(start > 0 && start < text.len() && text.is_char_boundary(start)) { + (look.stroke, look.overprint_stroke) = (Some(stroke), overprint); + return; + } + let tail = text.split_off(start); + let mut own = look.clone(); + (own.stroke, own.overprint_stroke) = (Some(stroke), overprint); + let shift = *shift; + self.runs.insert(run + 1, (own, shift, tail)); + // The runs after it move up one; the glyphs still to be stroked in the tail move with it. + for g in self.filled.iter_mut().skip(self.stroked) { + if g.run == run && g.start >= start { + (g.run, g.start) = (run + 1, g.start - start); + } else if g.run > run { + g.run += 1; + } + } + for i in self.actual_fills.values_mut().flatten() { + if *i > run { + *i += 1; + } + } + if last { + self.last_start = self.last_start.saturating_sub(start); + } + } + + /// A stroke over the glyph just drawn at `at` in `font`, which `overprint`s or not: that glyph + /// is stroked. `false`: it isn't that glyph. /// /// A filled glyph joins a run of the same fill whatever its stroke ([`Look::takes`]), so the /// run can hold glyphs before it that are stroked otherwise or not at all: then the glyph's /// text becomes a run of its own with this stroke, and the glyphs before it keep theirs /// (#7741). The line's text is the same either way, so the characters' slots, gaps and /// authored flags, kept along the whole line, still line up. - pub fn stroke_last(&mut self, font: u128, at: Placement, stroke: TypeStroke, overprint: bool) -> bool { + fn stroke_last(&mut self, font: u128, at: Placement, stroke: TypeStroke, overprint: bool) -> bool { let start = self.last_start; let Some((look, shift, text)) = self.runs.last_mut().filter(|(l, ..)| l.font == font && (at.origin - self.last).hypot() < self.at.size * 1e-3) diff --git a/crates/pdf/src/tests/text_placement.rs b/crates/pdf/src/tests/text_placement.rs index 417a88e5b9..8bdde71eba 100644 --- a/crates/pdf/src/tests/text_placement.rs +++ b/crates/pdf/src/tests/text_placement.rs @@ -758,3 +758,19 @@ fn perf_text_heavy_open() { println!("4000 lines: {n} text objects in {took:?} (as outlines: {:?})", start.elapsed()); } } + +/// Vertical type filled, then stroked (fill and stroke rendering draws a whole operator's glyphs +/// filled before it strokes them): one column, each glyph filled and stroked (#8015). +#[test] +fn a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type() { + for mode in ["2", "6"] { + let content = format!("0 0 1 RG 1 0 0 rg 2 w BT {mode} Tr /F6 24 Tf 150 180 Td {} Tj 0 Tr ET", gids("§±×")); + let t = texts(&open_as(&page(&content, ""), TextAs::Text)); + assert_eq!(t.len(), 1, "{content}: {t:#?}"); + assert_eq!(t[0].plain_text(), "§±×"); + for r in &t[0].runs { + assert!(!r.style.fill.is_none() && !r.style.stroke.is_none(), "{content}: {:?}", t[0].runs); + assert!((r.style.stroke_width - 2.0).abs() < 1e-6, "{content}"); + } + } +} diff --git a/crates/pdf/src/tests/textstroke.rs b/crates/pdf/src/tests/textstroke.rs index f28e525f27..8f71cbb441 100644 --- a/crates/pdf/src/tests/textstroke.rs +++ b/crates/pdf/src/tests/textstroke.rs @@ -122,3 +122,85 @@ fn imported_stroked_type_keeps_the_files_cap_join_and_miter_limit() { assert_eq!(joins, [Some(LineJoin::Round), Some(LineJoin::Miter)], "{content}: {runs:?}"); } } + +/// Fill and stroke rendering (mode 2, or 6 with a clip) draws a text-showing operator's glyphs +/// filled, then the same glyphs stroked: the type comes in once, filled and stroked, whether the +/// operator shows one glyph or a word, or a TJ array of strings with kerning between them, in an +/// outline font, with or without replacement text (`ActualText`). Stroke rendering (modes 1 and 5) stays stroke only. A Type 3 glyph is filled in +/// every one of those modes, once (#8015). +#[test] +fn a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type() { + use vectorcraft_testkit::pdf::{PdfPage, first_extra, pdf_with}; + // `/T3`: a Type 3 font whose glyphs take the text's paint (`d1`), `W A V E` mapped by ToUnicode. + let t3 = first_extra(1); + let glyph = crate::tests_import_fidelity::stream("", "600 0 0 0 600 700 d1 0 0 m 600 0 l 300 700 l h f"); + let to_unicode = crate::tests_import_fidelity::stream( + "", + "/CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def /CMapName /T3-UCS def /CMapType 2 def 1 begincodespacerange <00> endcodespacerange 4 beginbfchar\n<41> <0041>\n<45> <0045>\n<56> <0056>\n<57> <0057>\nendbfchar endcmap CMapName currentdict /CMap defineresource pop end end", + ); + let font = format!( + "<< /Type /Font /Subtype /Type3 /FontBBox [0 0 600 700] /FontMatrix [0.001 0 0 0.001 0 0] /CharProcs << /g {} 0 R >> /Encoding << /Type /Encoding /Differences [65 /g 69 /g 86 /g 87 /g] >> /FirstChar 65 /LastChar 87 /Widths [600 0 0 0 600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 600 600] /ToUnicode {} 0 R /Resources << >> >>", + t3 + 1, + t3 + 2 + ); + let page = |content: &str| { + let resources = format!("/Font << /F1 << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> /T3 {t3} 0 R >>"); + pdf_with(&[PdfPage { resources, ..PdfPage::new(300.0, 200.0, content) }], &[&font, &glyph, &to_unicode], None) + }; + let objects = |content: &str| { + let d = import(&page(content)).unwrap(); + let mut types = vec![]; + d.walk(|n| { + if let NodeKind::Text(t) = &n.kind { + types.push((**t).clone()); + } + }); + types + }; + let cream = Paint::solid(Color::rgb8(0xff, 0xff, 0xcc)); + let black = Paint::solid(Color::BLACK); + let shows = + ["(WAVE) Tj", "[(WA) -50 (VE)] TJ", "(WA) Tj (VE) Tj", "(W) Tj (A) Tj (V) Tj (E) Tj", "/Span << /ActualText (WAVE) >> BDC (WAVE) Tj EMC"]; + for font in ["F1", "T3"] { + for show in shows { + for mode in ["0", "1", "2", "4", "5", "6"] { + let content = format!("0 0 0 RG 1 1 0.8 rg 3 w 1 J 1 j BT {mode} Tr /{font} 60 Tf 40 110 Td {show} 0 Tr ET"); + let types = objects(&content); + assert_eq!(types.len(), 1, "{content}: one type object: {types:#?}"); + let t = &types[0]; + assert_eq!(t.plain_text(), "WAVE", "{content}"); + // A Type 3 glyph paints itself: the reader fills it whatever the mode. + let (fill, stroke) = match mode { + _ if font == "T3" => (true, false), + "0" | "4" => (true, false), + "1" | "5" => (false, true), + _ => (true, true), + }; + for r in &t.runs { + let s = &r.style; + assert_eq!(s.fill, if fill { cream.clone() } else { Paint::None }, "{content}: fill: {:?}", t.runs); + if stroke { + assert_eq!(s.stroke, black, "{content}: stroke: {:?}", t.runs); + assert!((s.stroke_width - 3.0).abs() < 1e-6, "{content}: width {}", s.stroke_width); + assert_eq!((s.stroke_cap, s.stroke_join), (LineCap::Round, LineJoin::Round), "{content}"); + } else { + assert!(s.stroke.is_none(), "{content}: no stroke: {:?}", t.runs); + } + } + } + } + } + // A word filled, then stroked with another join part way through (one operator each): + // each part keeps its own join, all of it filled. + let content = "0 0 0 RG 1 1 0.8 rg 3 w BT 2 Tr /F1 60 Tf 40 110 Td 1 j (WA) Tj 0 j (VE) Tj 0 Tr ET"; + let types = objects(content); + assert_eq!(types.len(), 1, "{content}: {types:#?}"); + let joins: Vec<_> = types[0].runs.iter().map(|r| (r.text.as_str(), r.style.fill == cream, r.style.stroke_join)).collect(); + assert_eq!(joins, [("WA", true, LineJoin::Round), ("VE", true, LineJoin::Miter)], "{content}"); + // Filled type, then stroked type of its own elsewhere: a stroke over no filled glyph. + let content = "0 0 0 RG 1 1 0.8 rg 3 w BT 0 Tr /F1 60 Tf 40 110 Td (WAVE) Tj 1 Tr 0 -70 Td (WAVE) Tj 0 Tr ET"; + let types = objects(content); + assert_eq!(types.len(), 2, "{content}: {types:#?}"); + let looks: Vec<_> = types.iter().flat_map(|t| &t.runs).map(|r| (r.style.fill == cream, !r.style.stroke.is_none())).collect(); + assert_eq!(looks, [(true, false), (false, true)], "{content}"); +} diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 9c46a01f77..6fb1e13606 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-15 · **Change:** minor (PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, not butt caps and miter joins, #7741; `.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; `.ai` and EPS import: a top-object envelope whose mesh saves its sides' curves in pieces draws its contents along each whole curve, as its drawn art does, #7097; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: `.ai` and EPS import: type from the text document, type a PostScript program sets and legacy `.ai` type are set in an installed face of their font's PostScript name, exact name first, in the version a text document's record keeps; the `.ai` save writes a static font's version when its name alone gives another copy, #6983; `.ai` and EPS import: type keeps the manual kerning of its text document, #6899; `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, its strokes' miter tips and strokes a Transform effect moves included, after its glyphs grown by half its strokes' weight, #6824; `.ai` and EPS import: type filled or stroked with a pattern swatch keeps its pattern, from the art style its text document paint names, #6856; #6865: explicitly requested oversized editing artboard; PDF import: Indic type keeps its marks on their line, and a line whose type would not draw as the file does keeps the file's glyphs as outlines, #5235; previously: newly imported SVG/SVGZ titles are filtered and bounded without changing restored titles, #3626; `.ai` and EPS import, and what every export and `.ai` save draw: type's strokes in an envelope paint at their own weight along its bent outlines, Distort Appearance on or off, #6644; `.ai` and EPS import: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as the file's page aligns them, #6610; `.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; `.ai` save and open: layer colour presets Yellow, Magenta and Cyan keep their colour, as the `Lb` colour index now follows the file's numbering, #6502; `.ai` save: stroked type keeps its stroke's cap, join and miter limit in the text document, #6472; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.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; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; 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; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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; scores and estimates unchanged; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, not butt caps and miter joins, #7741; `.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; `.ai` and EPS import: a top-object envelope whose mesh saves its sides' curves in pieces draws its contents along each whole curve, as its drawn art does, #7097; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: `.ai` and EPS import: type from the text document, type a PostScript program sets and legacy `.ai` type are set in an installed face of their font's PostScript name, exact name first, in the version a text document's record keeps; the `.ai` save writes a static font's version when its name alone gives another copy, #6983; `.ai` and EPS import: type keeps the manual kerning of its text document, #6899; `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, its strokes' miter tips and strokes a Transform effect moves included, after its glyphs grown by half its strokes' weight, #6824; `.ai` and EPS import: type filled or stroked with a pattern swatch keeps its pattern, from the art style its text document paint names, #6856; #6865: explicitly requested oversized editing artboard; PDF import: Indic type keeps its marks on their line, and a line whose type would not draw as the file does keeps the file's glyphs as outlines, #5235; previously: newly imported SVG/SVGZ titles are filtered and bounded without changing restored titles, #3626; `.ai` and EPS import, and what every export and `.ai` save draw: type's strokes in an envelope paint at their own weight along its bent outlines, Distort Appearance on or off, #6644; `.ai` and EPS import: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as the file's page aligns them, #6610; `.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; `.ai` save and open: layer colour presets Yellow, Magenta and Cyan keep their colour, as the `Lb` colour index now follows the file's numbering, #6502; `.ai` save: stroked type keeps its stroke's cap, join and miter limit in the text document, #6472; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.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; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; 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; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x) > > Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865). @@ -333,6 +333,7 @@ Stop opacity on translated artboards remains outside this regression coverage. - [ ] Exact redistribution of one replacement over several lines/styles, and general mixed-direction paragraph layout. Replacement uses the first placed glyph's line/style. Tags deeper than 128 and replacements over 64 KiB encoded (at most 192 KiB decoded) fall back to glyph mappings with a warning; an outer accepted owner survives deeper tags. - [x] Stroked type (text rendering modes 1, 2, 5 and 6, with or without `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do; glyphs stroked with another cap, join or miter limit are a run of their own, also a glyph filled and then stroked otherwise than the run its fill joined (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). The dash array is not carried to the characters yet. +- [x] Type filled and stroked by one text-showing operator (text rendering modes 2 and 6: the reader fills all of a `Tj` or `TJ`, every string of the array, before it strokes the same glyphs) comes in as one type object, filled and stroked, as it does glyph by glyph; a stroke over no filled glyph (modes 1 and 5, or stroked type of its own) 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`). - [x] Place from bytes or unlinked paths, and PDF clipboard paste, keep the selected page's live text. Synthetic two-page regressions in `crates/engine/src/cmd/fileio/tests_pdffidelity.rs` cover both sources, page selection and explicit outlines. The single-page importer honors the same text choice as Open; existing PDF fallback rules are unchanged. @@ -344,6 +345,7 @@ Stop opacity on translated artboards remains outside this regression coverage. | Date | Change | Summary | |---|---|---| +| 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 at the same place in the same font with the same text on the line, 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. | | 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) came in with butt caps, miter joins and a miter limit of 10 whatever the file stroked it with, while paths kept the graphics state's. The characters' stroke now takes the line cap (`J`), line join (`j`) and miter limit (`M`) of the graphics state, as a path's stroke does, and glyphs stroked with other ones start a run of their own, also a glyph filled and then stroked otherwise than the run its fill joined, so the glyphs before it keep their stroke (#7741). Test `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`. Scores and estimates unchanged. | | 2026-11-13 | minor | `.ai` and EPS import: layers that don't draw as the page, even with the drawn art of every live envelope put back, no longer put back the drawn art of every envelope of type. Each live envelope of type is weighed in the page check's own drawing of the pages it lies on, on the pixels that it and its drawn art ink there (the two drawn together on a layer of their own, without the rest of the layers; a pixel inks with an alpha above 8 of 255): it keeps its drawn art and its type, hidden, with the note, where the layers with it differ from the page in more of those pixels than its own check allows against its drawn art (10% of them, or 3% differing with all their neighbours, away from type), or where the envelopes of type that stay live, in the order they were read, would together differ there in more of a page than half of what the page check allows (a budget of the same size as the one their own checks share, kept apart from it). Art that differs elsewhere on the page no longer costs them their editable type; art that differs on their pixels still does. An envelope of type that a clip group or a clipping sublayer clips, an opacity mask masks, or a group with an appearance of its own, another envelope, a repeat or a blend holds keeps its drawn art as before, wherever it lies: drawn on its own it would be weighed elsewhere than it draws, and what holds it can draw it onto the page from off it. An envelope on no page stays live, as the page check doesn't see it, unless the page holds all the art that prints (an EPS's page that is its art's box, where art past the page is compared too): there one reaching past the page keeps its drawn art. Past 12 of them on the pages, all keep it. This holds where the editing data is trusted, where the objects that differ come in as the page's art (the placed files' other placement weighed on its own, as it draws them elsewhere under or over the envelopes; layers that draw as the page with only the envelopes the page holds put back are used as they are; where none of the objects that differ can then come in as the page's art, because an object holds type, the drawn art of every envelope of type is put back and that is tried again, as before), and for a `.ai` whose layers would open alone, which still opens alone: its envelopes of type are all settled again as they were with the page, in the same order and with the same checks, so each that opens live draws as it was weighed, and those the page held get their drawn art back. Where putting the drawn art of every live envelope back makes the layers draw as the page, it is still put back (#5065). In 224 users' files (used locally, never committed): envelopes of type that open live go from 174 to 186, in 8 files, none fewer in any file; no file changes between its layers and its PDF part; 7 renders change, by at most 0.7% of their pixels at 40 ppi (1 closer to the page, 1 alike, 5 further, by at most 0.7 of a percentage point, where VectorCraft's own envelope draws a little apart from the drawn art, within its check); the note for type in an envelope goes from 6 files. Of the 14 envelopes of type that had opened live and lost it to the page check, 2 keep their drawn art: one where the page draws something else where it is, and one in a file that comes in as its PDF part (#7141). Tests `build::candidate_tests::the_page_holds_back_only_envelopes_of_type_where_it_differs_from_them`, `envelopes_of_type_stay_live_within_half_of_what_the_page_check_allows`, `an_envelope_of_type_differing_in_more_of_its_pixels_than_its_check_allows_is_held_back`, `envelopes_of_type_the_layers_dont_draw_in_place_are_held_back`, `on_a_page_that_holds_all_the_art_an_envelope_of_type_past_it_is_held_back`, `objects_come_in_as_the_page_art_with_every_envelope_of_type_put_back_where_a_live_one_holds_a_difference`, `tests_native::layers_that_would_open_alone_keep_an_envelope_of_type_live_where_other_art_differs_from_the_page`, `layers_that_would_open_alone_keep_live_only_the_envelopes_of_type_the_page_doesnt_hold`, `trusted_layers_that_would_open_alone_open_alone_with_an_envelope_of_type_the_page_doesnt_hold_live`, `layers_with_objects_that_come_in_as_the_page_art_keep_an_envelope_of_type_that_draws_as_the_page_live`, `trusted_layers_keep_an_envelope_of_type_live_where_other_art_differs_from_the_page`, `trusted_layers_leave_an_envelope_of_type_the_page_draws_otherwise_its_drawn_art`, `build::candidate_tests::the_other_placement_of_placed_files_is_weighed_on_its_own`, `layers_that_draw_as_the_page_with_the_held_envelopes_of_type_put_back_are_used_so` | | 2026-11-13 | minor | PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke instead of being left out, adding no text (#6971; `empty_actual_text_keeps_the_glyphs_art` in `crates/pdf/src/tests/actual_text.rs`). Scores and estimates unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index fae091f647..d909aae29b 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (#8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > > Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865). > @@ -160,7 +160,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule | M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | | M2 | Drawing tools + smart guides | ✅ mostly done (#3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | | M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel (its spectrum grows with a resized panel, #8005), Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); | 4–8 | -| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) | +| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF import: type filled and stroked by one text-showing operator comes in as one filled and stroked type object (#8015; estimates unchanged); PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | | M6 | Path operations (Pathfinder, Shape Builder, offset…) | ✅ mostly done (live compound shapes: Make, Alt-click a Shape Mode, member modes, Release, Expand (#4522); single-result Pathfinder names and SVG IDs retained (#1293); Divide open-cutting-path geometry, appearance and history verified (#1307; existing segment cap remains); Simplify preview/counts and rewritten-path component selection verified (#1272; the slider opens at the Auto-Simplify level; a Direct Selection part of a path simplifies on its own); Compound appearance and member fill-rule edits verified (#1197); Boolean precision on almost-horizontal edges fixed and the property tests made deterministic; Shape Builder gap detection, large-offset bug open); Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog | 3–6 | | M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, the custom dictionary and Ignore All commands, Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, Spelling › Auto Spell Check in the context menu of type, the Edit Custom Dictionary dialog, and the modal Check Spelling dialog (Edit › Spelling › Check Spelling…, `Cmd+I`, `ui.checkSpelling`, #4936); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs (feature-valued alternates and unencoded glyphs applied in one Undo step while keeping Arabic joining, #5514), OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, vertical type pending | 45–60 | @@ -208,6 +208,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 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 at the same place in the same font with the same text on the line, 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. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | | 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do, instead of butt caps, miter joins and a miter limit of 10; a glyph filled and then stroked otherwise than the run its fill joined comes in as a run of its own, so the glyphs before it keep their stroke (#7741; `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). Scores and estimates unchanged. | | 2026-11-15 | minor | M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimates unchanged | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index cc4082ad68..b78f00514b 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-16 · **Change:** minor (#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-16 · **Change:** minor (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; 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-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 at the same place in the same font with the same text on the line, 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. | | 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do, instead of butt caps, miter joins and a miter limit of 10; a glyph filled and then stroked otherwise than the run its fill joined comes in as a run of its own, so the glyphs before it keep their stroke (#7741; `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). Scores and estimates unchanged. | | 2026-11-15 | minor | G5: Neon & Glow joins Shadows and Glows, Outlines and Rules, Hand-Drawn, Textures, Painted and Sketched, Gradient Finishes, Shape Effects, Blends and Transparency, Game HUD and Status Effects as an eleventh built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor; original procedural styles generated in code); area score and estimate unchanged. | | 2026-11-14 | minor | G5: Weather Icons joins Basic Shapes, UI Frames, Map Markers, Inventory Icons and Skill Icons as a sixth built-in symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow; original procedural vector symbols generated in code, no default 9-slice); area score and estimate unchanged. | @@ -268,9 +269,9 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Image Trace, graphs, image tools | 3 | 75% | graph Column designs, Image Trace Create Strokes depth (Create Object Mosaic is done; junction-returning piece survival has source-generated regressions in `image-trace-quality.md`; large images trace with a warning; Auto Color keeps rare distinct colours) | 5–8 | estimated (raised from 72%); quick presets reveal adjustment controls, Properties reopens them | | Layers, artboards, document setup | 5 | 78% | Selected-artboard deletion is consistent across panel actions (all-selected retains artboard 1); history prunes removed indices while preserving valid multiselection; remaining: 30.0's artboard locking and colours and managing artboards from the canvas, Layers row menu commands beyond Collect for Export and menus on guide and blend spine rows (click-to-fit objects is done, #1227) | 5–8 | estimated (lowered from 82%: target moved); Artboard deletion keys keep artwork and the first of an all-selected set; Artboard Options' Show Center Mark and Show Cross Hairs draw on the canvas only (exports and print leave them out), regression-tested; Artboard Options' Show Video Safe Areas and Video Ruler Pixel Aspect Ratio (per artboard, native format) are done ([video display options](#evidence-what-ships-today-by-area)), score unchanged | | View & navigation | 3 | 70% | multiple windows and the rest of Arrange (Cascade, Float in Window, Float All in Windows) | 9–14 | estimated; Window › Arrange › Tile and Consolidate All Windows done (score/hours unchanged); document-tab artwork hover/copy and lossless transfer tested (2026-10-22; score/hours unchanged); cached canvas reprojection preserves scale during resize, rotation and DPI changes (regression and contributor original-file evidence below; scores/hours unchanged); cached canvas dimensions match the renderer limit before cache-key creation, view construction and worker submission (regression evidence below) | -| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), no writing of Illustrator's editing data (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); DXF export's Include Placed Images and Include Fill Hatches options, off in CNC / CAM (`images_and_hatches_are_left_out_independently_and_the_cnc_preset_leaves_out_both`; score, gaps and hours unchanged); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`; the distance from the path under Align to Path is measured from the top of each character's em box, half the height of the top of its H or the bottom of its font's bounding box (`tests_native::aligned_type_lies_as_far_from_its_path_as_the_file_lays_it_out`), and the fit under Gravity does not reproduce the file's layout), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. | -| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects other than grouped column, stacked column, line and area graphs the `.ai` reader reads back whole as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, textures, map art and shading in 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. Graphs saved to `.ai` in either form open again as live graphs (`ai_editing::tests::graphs_are_written_with_their_records_and_open_live`, `legacy_ai::tests::graphs_are_written_with_their_records_and_open_live`, `cmd::graph::tests::a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns`); other graphs are still written as their art (`graphs_the_records_cant_keep_are_written_as_their_art`); score and hours unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. | -| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects other than grouped column, stacked column, line and area graphs the `.ai` reader reads back whole as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. Graphs saved to `.ai` in either form open again as live graphs (`ai_editing::tests::graphs_are_written_with_their_records_and_open_live`, `legacy_ai::tests::graphs_are_written_with_their_records_and_open_live`, `cmd::graph::tests::a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns`); other graphs are still written as their art (`graphs_the_records_cant_keep_are_written_as_their_art`); score and hours unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Save refusal continuation (#6146): `READ_ONLY_LOCATION`, Save As on ordinary UI Save only; regression execution pending; score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. | +| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), no writing of Illustrator's editing data (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); DXF export's Include Placed Images and Include Fill Hatches options, off in CNC / CAM (`images_and_hatches_are_left_out_independently_and_the_cnc_preset_leaves_out_both`; score, gaps and hours unchanged); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`; the distance from the path under Align to Path is measured from the top of each character's em box, half the height of the top of its H or the bottom of its font's bounding box (`tests_native::aligned_type_lies_as_far_from_its_path_as_the_file_lays_it_out`), and the fit under Gravity does not reproduce the file's layout), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. PDF import: type filled and stroked by one text-showing operator (rendering modes 2 and 6) comes in as one type object, filled and stroked, not a stroked copy over a filled one (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. | +| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects other than grouped column, stacked column, line and area graphs the `.ai` reader reads back whole as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, textures, map art and shading in 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. Graphs saved to `.ai` in either form open again as live graphs (`ai_editing::tests::graphs_are_written_with_their_records_and_open_live`, `legacy_ai::tests::graphs_are_written_with_their_records_and_open_live`, `cmd::graph::tests::a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns`); other graphs are still written as their art (`graphs_the_records_cant_keep_are_written_as_their_art`); score and hours unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. PDF import: type filled and stroked by one text-showing operator (rendering modes 2 and 6) comes in as one type object, filled and stroked, not a stroked copy over a filled one (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. | +| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects other than grouped column, stacked column, line and area graphs the `.ai` reader reads back whole as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. Graphs saved to `.ai` in either form open again as live graphs (`ai_editing::tests::graphs_are_written_with_their_records_and_open_live`, `legacy_ai::tests::graphs_are_written_with_their_records_and_open_live`, `cmd::graph::tests::a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns`); other graphs are still written as their art (`graphs_the_records_cant_keep_are_written_as_their_art`); score and hours unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Save refusal continuation (#6146): `READ_ONLY_LOCATION`, Save As on ordinary UI Save only; regression execution pending; score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. PDF import: type filled and stroked by one text-showing operator (rendering modes 2 and 6) comes in as one type object, filled and stroked, not a stroked copy over a filled one (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. | | View & navigation | 3 | 70% | multiple windows and the rest of Arrange (Cascade, Float in Window, Float All in Windows) | 9–14 | estimated; Window › Arrange › Tile and Consolidate All Windows done (score/hours unchanged); document-tab artwork hover/copy and lossless transfer tested (2026-10-22; score/hours unchanged); cached canvas reprojection preserves scale during resize, rotation and DPI changes (regression and contributor original-file evidence below; scores/hours unchanged) | | View & navigation | 3 | 70% | multiple windows and the rest of Arrange (Cascade, Float in Window, Float All in Windows) | 9–14 | estimated; Window › Arrange › Tile and Consolidate All Windows done (score/hours unchanged) | | Guides, grids, smart guides, snapping, rulers | 3 | 80% | "intersect" smart guides for a moved selection's anchors (drawn points and dragged anchors snap to intersections, #1658) | 4–7 | estimated (lowered from 85%: target moved); Control bar snapping quick access includes Snap to Glyph and Alignment Guides (#6164); new ruler-guide Alt orientation implemented; global/artboard ruler modes (`view.globalRulers`) and video rulers (View › Rulers › Show Video Rulers, #2849) done; status-bar X/Y uses the active ruler origin and General units; score unchanged | @@ -533,7 +534,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Layers, artboards, document setup | 5 | 82% | Layers panel: a confirmation before deleting layers that hold art, row menu commands beyond Collect for Export (now on every layer, sublayer, group and object row), menus on guide and blend spine rows, the Layer Options dialog for several rows with mixed values, Paste Remembers Layers for sublayers; artboard preset polish (artboard escape routing and document setup modal handoff done; Move Artwork for artboard X/Y edits, Rearrange All Artboards, Document Setup, New Document and the rest of the Layers panel are done) | 4–7 | | View & navigation | 3 | 70% | New View/Edit Views, multiple windows/arrange, Snap to Pixel/Glyph (print tiling is done) | 9–14 | | Guides, grids, smart guides, snapping, rulers | 3 | 85% | global/video rulers, Spacing Guides' distance readouts and spacing for resized or drawn art, Alt swapping a ruler guide's orientation, ruler guides selected together with art (marquee, Shift-click), ruler guides as Layers rows with their own lock and hide (#451: Lock Guides locks them all; Make Guides paths are Layers rows already) (dragging existing guides is done, #414; new guides snapping to side midpoints and artboards, and artboard guides, #451; the drawing tools snapping, with Construction Guides, #506; Spacing Guides for moves, #394; moves snapping to the grid, #740; ruler guides pulling drawn points with Smart Guides on, and "center" and "anchor" labels while hovering with the Selection tool, #812; distance and angle labels while drawing, #2983) | 2–4; status-bar X/Y uses the active ruler origin and General units | -| File formats | 6 | 85% | PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; scores and estimates unchanged); PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); Explicit editing-data oversized single-artboard import fixed (#6865); scores and estimates unchanged. Legacy `.ai` files that name but omit their prolog open with their layers, or with their art on one layer when the format has no layers; graph data and settings in these files still come in only as drawn art. Affinity export, and the rest of Affinity import (adjustments, blur and bevel effects, brushes, live symbol instances, text threading), DWG (no open spec: DXF instead), PSD placement as layers (Photoshop Import Options; the merged image is done), EPS checked against more real files users send (Inkscape files open as vectors; other generators' constructs are tested with programs written from the PostScript Language Reference only; CID-keyed CJK type and `CCITTFaxDecode` images not read), the rest of Illustrator's editing data (appearances and live effects, symbols, pattern fills, brushes, placed files: #637), the remaining fidelity polish; EPS, DXF, EMF/WMF, TIFF, BMP, Targa, PSD export, SVGZ, PDF security, PDF/X, PDF layers, presets and Affinity import are done | 6–10 (existing scope; Affinity export unestimated) | +| File formats | 6 | 85% | PDF import: type filled and stroked by one text-showing operator comes in as one filled and stroked type object (#8015; scores and estimates unchanged); PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; scores and estimates unchanged); PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); Explicit editing-data oversized single-artboard import fixed (#6865); scores and estimates unchanged. Legacy `.ai` files that name but omit their prolog open with their layers, or with their art on one layer when the format has no layers; graph data and settings in these files still come in only as drawn art. Affinity export, and the rest of Affinity import (adjustments, blur and bevel effects, brushes, live symbol instances, text threading), DWG (no open spec: DXF instead), PSD placement as layers (Photoshop Import Options; the merged image is done), EPS checked against more real files users send (Inkscape files open as vectors; other generators' constructs are tested with programs written from the PostScript Language Reference only; CID-keyed CJK type and `CCITTFaxDecode` images not read), the rest of Illustrator's editing data (appearances and live effects, symbols, pattern fills, brushes, placed files: #637), the remaining fidelity polish; EPS, DXF, EMF/WMF, TIFF, BMP, Targa, PSD export, SVGZ, PDF security, PDF/X, PDF layers, presets and Affinity import are done | 6–10 (existing scope; Affinity export unestimated) | | Export for Screens, Asset Export, slices, Save for Web | 3 | 85% | polish only (all four are done) | 2–4 | | Print, colour management, separations, flattener | 3 | 80% | print preview fidelity (flattener presets in PDF and print, overprint in PDF and composite print, Print dialog, presets, PostScript, marks, separations, Print Tiling, print overprint/flattener/bitmap options and printer profile are done, as are the Japanese papers in its Media list: JIS B4/B5/B6, はがき, 往復はがき, 封筒 長形3号/長形4号/角形2号/角形3号 and 四六判, beside the ISO B4/B5 that settings saved before them keep) | 1–2 | | Automation | 3 | 65% | scripting surface, batch (MCP drops malformed app replies without replay; Variables: text/visibility variables bound to objects, an object may carry several, dataset rows applied in one undo step, panel and Window › Variables with dialogs; image/graph kinds and dataset import/export open) | 6–10 | @@ -587,6 +588,8 @@ since 2026-10-01. - **PDF authored replacement text (#6165):** `crates/pdf/src/tests/actual_text.rs` covers replacement once with suffix placement, PDF text-string decoding, empty and nested owners, sibling spans, page reset, multiple text-show operations, style/line changes, fill-and-stroke, reader windows and bounded input. Authored logical-order stretches are protected while adjacent ordinary text still undergoes reconstruction. The replacement takes its first placed glyph's style and line; its characters are not redistributed over later lines/styles. Exact mixed-direction paragraph layout is not claimed. No export changes; scores and hours stay at 75% / 10–20 h. - **PDF stroked type (#7741):** `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs` covers round, projecting and butt caps, round, bevel and miter joins and a miter limit of 3 on type stroked in rendering modes 1, 2, 5 and 6, shown as a word, a glyph at a time and under `ActualText`; glyphs stroked with another join as runs of their own; and a glyph filled and stroked after one stroked otherwise, which keeps the join of the glyph before it. Synthetic PDFs written in the test (standard Helvetica, not embedded); no fonts or fixtures added. The dash array is not yet carried to the characters. + +- **PDF type filled then stroked (#8015):** `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs` covers a word shown at once, a `TJ` array of two strings with kerning between them, a line over two `Tj` and a glyph at a time, also under `ActualText`, in text rendering modes 0, 1, 2, 4, 5 and 6: modes 2 and 6 come in as one type object `WAVE` filled #ffffcc with a 3 pt black stroke, round cap and join, modes 1 and 5 stroke only, 0 and 4 fill only; a Type 3 font is filled once in every mode (the reader paints Type 3 glyphs as their procedures draw them); a stroke join that changes between two operators keeps a run each; and filled type with stroked type of its own below it stays two objects. `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs` covers a vertical column in modes 2 and 6. Synthetic PDFs written in the tests; no fonts or fixtures added. - **PDF Indic type (#5235, #6906):** `crates/pdf/src/tests/reshaped.rs` covers a vowel sign the file draws before its consonant (the line keeps the file's glyphs as outlines, with a note), text in reading order (stays type), a mark with no advance (stays on its line, not vertical type of its own), outlined glyphs stroked with different dashes and translucent outlined glyphs (each keeps its own path). Synthetic font only; one real Gujarati file checked by eye on page 1. Indic type in an uninstalled font keeps the file's glyphs as outlines; reordering signs so more lines stay editable is not done. Scores and hours stay at 75% / 10-20 h. From d998629b8dc5716b762746d4351b8c8328fe8500 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 21:49:59 -0800 Subject: [PATCH 032/226] Eyedropper: Escape ends a gradient stop's or Key Color's pick and returns to the previous tool Escape with a gradient stop's or Brush Options' Key Color eyedropper armed now ends the pick without sampling and switches back to the tool that armed it. The stop keeps its color. With Brush Options open, the first Escape ends only the pick and the dialog stays open with its Key Color; a new Escape cancels the dialog as before. The plain Eyedropper keeps its Escape behavior, and a dropped touch leaves an armed pick waiting for its click. Fixes #8024 --- crates/tools/src/xform/eyedropper.rs | 72 ++++++++++++++++++- .../src/dialogs/brush_options/tests.rs | 21 ++++++ crates/ui-egui/src/panels/gradient/tests.rs | 21 ++++++ crates/ui-egui/src/shortcuts.rs | 14 ++++ docs/target-app-parity.md | 1 + 5 files changed, 128 insertions(+), 1 deletion(-) diff --git a/crates/tools/src/xform/eyedropper.rs b/crates/tools/src/xform/eyedropper.rs index c5e05f004b..79c5116887 100644 --- a/crates/tools/src/xform/eyedropper.rs +++ b/crates/tools/src/xform/eyedropper.rs @@ -16,6 +16,9 @@ //! //! Brush Options' Key Color eyedropper sets `brushKeyColor` and `stop`: the next click samples into //! the open dialog (`brushKeyColor` UI request) and switches back. +//! +//! Escape ends either pick without sampling and switches back to that tool. With neither pick +//! armed, Escape is left to the application. use std::collections::HashSet; @@ -28,7 +31,7 @@ use vectorcraft_geom::{Affine, Point, Rect}; use super::paint_owner; use crate::params::color_json; -use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext}; +use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey}; #[derive(Default)] pub struct EyedropperTool { @@ -530,6 +533,38 @@ impl Tool for EyedropperTool { fn cursor(&self, _cx: &ToolContext, _p: Point, _m: Mods) -> Cursor { Cursor::Eyedropper } + + /// Escape ends a gradient stop's or Key Color's pick without sampling and switches back to the + /// tool that armed it. + fn key(&mut self, _cx: &ToolContext, key: ToolKey, _mods: Mods) -> Vec { + if key != ToolKey::Escape || !self.picking() { + return vec![]; + } + let back = self.stop.take().unwrap_or_else(|| "selection".to_string()); + self.brush_key_color = false; + vec![Action::SwitchTool(back)] + } + + /// A dropped press (a long or canceled touch) leaves an armed pick waiting for its click. + fn drop_press(&mut self, _cx: &ToolContext) -> Vec { + vec![] + } + + /// Escape is the tool's while a pick is armed, so it switches back and ends nothing else. + fn claims_key(&self, _cx: &ToolContext, key: ToolKey) -> bool { + key == ToolKey::Escape && self.picking() + } + + fn ends_on_escape(&self, _cx: &ToolContext) -> bool { + self.picking() + } +} + +impl EyedropperTool { + /// Is a one-shot pick armed (a gradient stop's or Brush Options' Key Color)? + fn picking(&self) -> bool { + self.stop.is_some() || self.brush_key_color + } } #[cfg(test)] @@ -619,6 +654,41 @@ mod tests { assert_eq!(t.options(), json!({"stop": null, "brushKeyColor": false}), "one sample only"); } + /// #8024: Escape ends a gradient stop's pick and a Key Color pick without sampling and + /// switches back; the plain Eyedropper leaves Escape alone. + #[test] + fn escape_ends_a_pick_and_switches_back() { + let (d, _) = doc_with_rect(); + let (s, p) = (Selection::default(), paint()); + let mut cx = cx(&d, &s, &p); + cx.gradient_stop = Some(1); + let none = Mods::default(); + let mut t = EyedropperTool::default(); + assert!(!t.claims_key(&cx, ToolKey::Escape) && !t.ends_on_escape(&cx), "nothing armed"); + assert!(t.key(&cx, ToolKey::Escape, none).is_empty()); + + t.set_option("stop", &json!("gradient")); + assert!(t.claims_key(&cx, ToolKey::Escape) && t.ends_on_escape(&cx)); + assert!(!t.claims_key(&cx, ToolKey::Enter)); + assert!(t.drop_press(&cx).is_empty(), "a dropped press leaves the pick armed"); + assert_eq!(t.key(&cx, ToolKey::Escape, none), vec![Action::SwitchTool("gradient".into())]); + assert_eq!(t.options(), json!({"stop": null, "brushKeyColor": false})); + assert!(!t.claims_key(&cx, ToolKey::Escape) && t.key(&cx, ToolKey::Escape, none).is_empty(), "one cancel only"); + let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 150.0)); + assert!(!a.iter().any(|a| matches!(a, Action::Exec(_, v) if v.get("stop").is_some())), "no stop sample after the cancel: {a:?}"); + + t.set_option("brushKeyColor", &json!(true)); + t.set_option("stop", &json!("paintbrush")); + assert!(t.claims_key(&cx, ToolKey::Escape)); + assert_eq!(t.key(&cx, ToolKey::Escape, none), vec![Action::SwitchTool("paintbrush".into())]); + assert_eq!(t.options(), json!({"stop": null, "brushKeyColor": false})); + + // A Key Color pick with no tool to return to goes back to the Selection tool. + t.set_option("brushKeyColor", &json!(true)); + assert_eq!(t.key(&cx, ToolKey::Escape, none), vec![Action::SwitchTool("selection".into())]); + assert_eq!(t.options(), json!({"stop": null, "brushKeyColor": false})); + } + #[test] fn brush_key_color_samples_into_the_dialog_then_switches_back() { let (d, _) = doc_with_rect(); diff --git a/crates/ui-egui/src/dialogs/brush_options/tests.rs b/crates/ui-egui/src/dialogs/brush_options/tests.rs index 9ff55da454..df45452a02 100644 --- a/crates/ui-egui/src/dialogs/brush_options/tests.rs +++ b/crates/ui-egui/src/dialogs/brush_options/tests.rs @@ -204,6 +204,27 @@ fn brush_key_color_eyedropper_updates_the_open_dialog() { assert_eq!(app.session.tool_id(), back); } +/// #8024: the first Escape ends the Key Color pick and returns to the tool that armed it, leaving +/// Brush Options open with its Key Color; a new press then cancels the dialog. +#[test] +fn escape_ends_the_key_color_pick_and_leaves_brush_options_open() { + let (mut app, ctx) = (app(), ctx()); + app.select_tool("paintbrush"); + app.run("ui.brushOptions", json!({"name": "Confetti"})).unwrap(); + set(&mut app, json!({"colorization": "hueShift"})); + let before = app.ui.dialog.as_ref().and_then(|d| d.fields.get("keyColor").cloned()); + app.select_tool("eyedropper"); + app.session.set_tool_option("brushKeyColor", &json!(true)); + app.session.set_tool_option("stop", &json!("paintbrush")); + frame(&ctx, &mut app, vec![], ""); + escape(&ctx, &mut app); + assert!(app.ui.dialog.is_some(), "Brush Options stays open"); + assert_eq!(app.ui.dialog.as_ref().and_then(|d| d.fields.get("keyColor").cloned()), before, "the Key Color stays"); + assert_eq!(app.session.tool_id(), "paintbrush"); + escape(&ctx, &mut app); + assert!(app.ui.dialog.is_none(), "a new press cancels Brush Options"); +} + #[test] fn art_options_set_width_scale_direction_flips_and_colorization() { let mut app = app(); diff --git a/crates/ui-egui/src/panels/gradient/tests.rs b/crates/ui-egui/src/panels/gradient/tests.rs index d5362b8bab..14a711bf57 100644 --- a/crates/ui-egui/src/panels/gradient/tests.rs +++ b/crates/ui-egui/src/panels/gradient/tests.rs @@ -711,6 +711,27 @@ fn the_stop_eyedropper_arms_the_eyedropper_for_the_stop() { assert_eq!((app.session.tool_id(), app.session.tool_options()), ("eyedropper", json!({"stop": "gradient", "brushKeyColor": false}))); } +/// #8024: Escape ends the stop eyedropper's pick and returns to the Gradient tool. The stop keeps +/// its color, the selection stays, and a held Escape's repeats end nothing else. +#[test] +fn escape_ends_the_stop_eyedropper_and_returns_to_the_gradient_tool() { + let mut app = app(json!({"gradient": {}})); + crate::shortcut_editor::sync(&app.ui); + app.select_tool("gradient"); + app.run("gradient.selectStop", json!({"index": 0})).unwrap(); + let (paint, selected) = (current(&app), app.session.active().unwrap().selection.objects.clone()); + stop_eyedropper(&mut app); + let key = |pressed, repeat| Event::Key { key: egui::Key::Escape, physical_key: None, pressed, repeat, modifiers: Modifiers::NONE }; + let ctx = egui::Context::default(); + for events in [vec![key(true, false)], vec![key(true, true)], vec![key(false, false)]] { + let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| crate::shortcuts::handle(&mut app, ui.ctx())); + out.textures_delta.clear(); + } + assert_eq!(app.session.tool_id(), "gradient"); + assert_eq!(current(&app), paint, "the stop keeps its color"); + assert_eq!(app.session.active().unwrap().selection.objects, selected, "the selection stays"); +} + /// The gradient panel names its Angle and Aspect Ratio inputs. #[test] fn angle_and_aspect_fields_are_named() { diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 6329f489b1..781bec4e74 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -231,6 +231,14 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) { || crate::dialogs::new_document_popup_open(d) || crate::dialogs::export_artboard_name_editing(app, d) }); + // Escape ends Brush Options' Key Color pick and leaves the dialog open: the Eyedropper + // switches back to the tool that armed it. + if !popup && pressed_anew(ctx, Key::Escape) && key_color_pick_armed(app) { + let view = app.view_info(); + let r = app.session.tool_key(ToolKey::Escape, Mods::default(), view); + crate::canvas::apply_requests(app, r); + return; + } // Escape in Preferences' search field with text clears the field first. if !popup && pressed_anew(ctx, Key::Escape) && !crate::prefs_dialog::clear_search_on_escape(app, ctx) { crate::dialogs::cancel(app); @@ -387,6 +395,12 @@ pub(crate) fn pressed_anew(ctx: &egui::Context, key: Key) -> bool { ctx.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::Key { key: k, pressed: true, repeat: false, .. } if *k == key))) } +/// Is Brush Options open with its Key Color eyedropper armed, waiting for a click on the art? +fn key_color_pick_armed(app: &VectorcraftApp) -> bool { + let open = app.ui.dialog.as_ref().is_some_and(|d| d.kind == crate::dialogs::brush_options::KIND); + open && app.session.tool_id() == "eyedropper" && app.session.tool_options()["brushKeyColor"] == true +} + /// Takes this frame's repeats of `key` when the tool claims it: a press acts once, and they stay out /// of the shortcuts. A chord a command is bound to keeps its repeats. fn take_claimed_repeat(app: &mut VectorcraftApp, ctx: &egui::Context, key: Key, tool_key: ToolKey, view: ViewInfo) -> bool { diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index cc4082ad68..c1d8b60559 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1692,6 +1692,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Hue Clockwise and Hue Counterclockwise, VectorCraft's own gradient methods, in the Gradient panel's Method menu and on `paint.editGradient` and `paint.setFill` (`method`: `hue-clockwise`, `hue-counterclockwise`): a linear, radial, conic or diamond gradient's colors mix around the hue wheel, with hue, saturation and brightness each changing evenly from one stop to the next and the hue angle keeping one direction, as the fixed-direction rules of [CSS Color 4](https://www.w3.org/TR/css-color-4/#hue-interpolation) do: falling with Hue Clockwise (red, magenta, blue), which is clockwise on the color wheels, and rising with Hue Counterclockwise (red, yellow, green). Hues less than half a color level apart count as one hue, so a color and its tint do not turn the wheel. A gray stop takes the hue of the stop it mixes with, and black its saturation too. The canvas and raster exports draw it through stops on that curve, within half a color level; Reverse Gradient turns the method the other way with the stops, so the ramp keeps its colors. SVG and PDF write it as an RGB image, EPS as a shading in process colors, and a legacy `.ai` file and the `.ai` editing data with the colors between its stops as stops of their own, with a warning. - Gradient spread, VectorCraft's own setting: Pad, Repeat or Reflect, with a Repeats count of 1 to 100, in the Gradient panel and on `paint.editGradient` and `paint.setFill`; Repeat and Reflect run a linear, radial, conic or diamond gradient's stops that many times along the vector and on past its ends, the Gradient tool marks where the runs meet, and SVG writes and reads `spreadMethod`, CSS writes repeating gradients, PDF writes a conic's sweep shading over one run and the other kinds with their stops repeated across the shape, as EPS, legacy `.ai` and the `.ai` editing data do. - The stop popover a double-click on a stop opens (the Gradient tool's annotator or the Gradient panel) has an eyedropper beside its Color and Swatches tabs: it closes the popover and samples the next colour clicked on the art into the stop, as the Gradient panel's eyedropper does (#4681). + Escape ends that eyedropper's pick, and Brush Options' Key Color pick, without sampling and returns to the tool that started it; the stop keeps its color, and Brush Options stays open with its Key Color until a new Escape cancels it (#8024, [Modify gradients, archived user guide](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=264)). Cmd/Ctrl-click on the Gradient panel's Gradient Fill box or on the Tools panel's Gradient button resets the gradient of the active Fill or Stroke to the linear White, Black gradient, as one undo step ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)). With a gradient stop or a freeform gradient point selected, Alt-clicking a color swatch in the Swatches panel recolors it instead of the inactive Fill or Stroke. - **Freeform gradient colors in their own model:** Object ▸ Expand and Object ▸ Create Gradient Mesh (`object.mesh.create`) mix a freeform gradient's points in the color model they share: points of C50 M20 Y0 K10 give mesh points of C50 M20 Y0 K10, and RGB points keep their values in a working RGB space other than sRGB. The canvas, the gradient chips and the SVG, PDF, EPS and EMF writers mix the points in that model too. PDF and EPS write a gradient whose points are all CMYK, or all Gray in a CMYK file, as a CMYK image, which PDF's Output settings convert as they convert any CMYK image. Points in different models mix in display RGB (on the canvas in a CMYK document that shows transparency, as the inks of each point), and a CMYK document stores the result of Expand as CMYK through the color settings. Points colored along CMYK stops (`paint.editGradient {stops}`, or a CMYK gradient switched to freeform) are CMYK, and so are a point `paint.freeform.splitLine` adds between CMYK points and a point `paint.freeform.addPoint` adds without `color` to CMYK points. Public reference: [Gradients](https://web.archive.org/web/20250714042311/https://helpx.adobe.com/illustrator/using/gradients.html) and [Meshes](https://web.archive.org/web/20250812201019/https://helpx.adobe.com/illustrator/using/meshes.html), which do not state how colors in different models mix; the rule is VectorCraft's own. From 2e639f150a8f770636bf3baafc1f32f64490b032 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 21:56:34 -0800 Subject: [PATCH 033/226] =?UTF-8?q?Help:=20Search=20Commands=E2=80=A6=20is?= =?UTF-8?q?=20the=20first=20Help=20menu=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Search Commands… moves from the middle of the Help menu to the top, with a separator after it. It runs the same help.commandPalette command and shows its shortcut. In the native macOS menu bar it is the first item below the system's search field. --- crates/ui-egui/src/menus/tests.rs | 26 ++++++++++++++++++++++++++ crates/ui-egui/src/menus/tree.rs | 3 ++- crates/ui-egui/src/tests/nativemenu.rs | 13 +++++++++++++ docs/target-app-parity.md | 1 + 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/menus/tests.rs b/crates/ui-egui/src/menus/tests.rs index 1bb152292e..3e2673a651 100644 --- a/crates/ui-egui/src/menus/tests.rs +++ b/crates/ui-egui/src/menus/tests.rs @@ -61,6 +61,32 @@ fn file_ends_with_exit() { assert!(matches!(last, Item::Cmd("Exit", "app.quit", _)), "{last:?}"); } +/// Help starts with Search Commands…, the command search's own command, showing its shortcut, +/// then a separator; the menus list it once. +#[test] +fn help_starts_with_search_commands() { + let app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default()); + let tree = menu_tree(); + let (_, help) = tree.iter().find(|(t, _)| *t == "Help").unwrap(); + assert!(matches!(help[0], Item::Cmd("Search Commands…", "help.commandPalette", _)), "{:?}", help[0]); + assert!(matches!(help[1], Item::Sep), "{:?}", help[1]); + let Some(Entry::Item(row)) = entry(&app, &help[0]) else { panic!("Search Commands… is not shown") }; + assert!(row.enabled); + assert_eq!(row.shortcut, shortcut_of("help.commandPalette")); + assert!(row.shortcut.is_some(), "the search's shortcut shows next to the item"); + fn count(items: &[Item]) -> usize { + items + .iter() + .map(|it| match it { + Item::Cmd(_, "help.commandPalette", _) => 1, + Item::Sub(_, children) => count(children), + _ => 0, + }) + .sum() + } + assert_eq!(tree.iter().map(|(_, items)| count(items)).sum::(), 1); +} + /// No application menu in the window (as in Illustrator): the bar starts at File. #[test] fn the_bar_starts_at_file() { diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index ec8ec99018..617d0d403e 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -738,12 +738,13 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec)> { ( "Help", vec![ + c("Search Commands…", "help.commandPalette"), + Sep, c("Join Our Discord", "help.discord"), c("ArtCraft Website", "help.website"), c("VectorCraft on getartcraft.com", "help.appPage"), c("VectorCraft on GitHub", "help.github"), Sep, - c("Search Commands…", "help.commandPalette"), todos("VectorCraft Help…", "F1"), c("Safe Mode…", "help.safeMode"), c("Copy Troubleshooting Info", "help.copyTroubleshootingInfo"), diff --git a/crates/ui-egui/src/tests/nativemenu.rs b/crates/ui-egui/src/tests/nativemenu.rs index 689ae8a60c..12b106ee88 100644 --- a/crates/ui-egui/src/tests/nativemenu.rs +++ b/crates/ui-egui/src/tests/nativemenu.rs @@ -210,6 +210,19 @@ fn the_window_menu_has_the_system_items() { assert_eq!(Standard::Zoom.label(), "Zoom"); } +/// The Mac Help menu keeps Search Commands… first among VectorCraft's items, with its shortcut, +/// then a separator. +#[test] +fn the_mac_help_menu_starts_with_search_commands() { + let bar = bar(&app(true)); + let help = &bar.menu(MenuRole::Help).unwrap().children; + assert_eq!(ids(help)[..2], ["help.commandPalette".to_string(), "---".into()]); + let search = find(&bar, "help.commandPalette"); + assert_eq!(search.label, "Search Commands…"); + assert_eq!(search.shortcut, menus::shortcut_of("help.commandPalette")); + assert!(search.shortcut.is_some()); +} + /// A system key a command already has stays the command's: the system item goes without. The /// user's shortcuts show in the menus. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index cc4082ad68..c2d645cc61 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1013,6 +1013,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The Free Transform widget's Constrain works in Free Distort as well as in Free Transform ([the help page](https://helpx.adobe.com/illustrator/using/tool-techniques/free-transform-tool.html)). With Constrain on, or Shift held, a corner dragged in Free Distort moves only along the line through the opposite corner, in the box's own proportions, and the other three corners stay in place; on a turned box the line runs through the box's own corners. The line is VectorCraft's own rule. Cmd/Ctrl+Alt+Shift on a corner still drags in Perspective Distort, where Constrain stays unavailable (tools `xform::free::tests::free_distort_corner_keeps_to_its_diagonal_with_shift_or_constrain`, `shift_pressed_during_a_free_distort_drag_constrains_it`, `a_turned_box_is_constrained_along_its_own_diagonal`, `along_diagonal_of_a_degenerate_box`; engine `xform::free_transform_constrained_distort_keeps_the_corner_on_its_diagonal`; ui-egui `free_transform::tests::the_widget_sets_the_mode_and_a_corner_drag_then_distorts`). - Native macOS menu bar, vector tool cursors, a command palette (Help › Search Commands…), middle-button panning with any tool. Native menus explicitly end tracking on command selection, outside window presses and Escape; menu updates wait until tracking ends, and a dismissing press never starts a canvas gesture (M14.8). - A Recent Commands button beside the Help › Search Commands field lists the last five commands and tools picked from the palette, most recent first, with a command picked again moved to the top. Choosing a row closes the palette and runs it as a pick of the same result does; with no picks yet the list shows a dimmed No recent commands row, and a command that is not available now, such as a filter of a plug-in that is not loaded, is left out until it comes back. The ids are saved with the UI state. While the list is open, Up and Down move through its rows, wrapping at the ends, and Escape closes the list before the palette. This is VectorCraft's own addition and does not raise a score (#6376; `palette` tests `recent_commands_*`, `a_recent_command_runs_what_its_pick_runs`, `the_keys_wrap_within_recent_commands`, `escape_closes_recent_commands_before_the_palette`). + - Help › Search Commands… is the first item of the Help menu in the window, with its shortcut and a separator after it; in the native macOS menu bar it is the first item below the system's search field. This is VectorCraft's own order and does not raise a score (`menus::tests::help_starts_with_search_commands`, `tests::nativemenu::the_mac_help_menu_starts_with_search_commands`). - The Learn panel (Window › Learn, or Explore tutorials beside the search icon on the app bar) has a For you tab with a Get started section and a Quick skill guide card, and a Skills tab that lists VectorCraft's own skills with their progress rings and counts of tutorials finished; a skill lists its tutorials, a tutorial shows its numbered steps, and Back goes up a level; `learn.list`, `learn.tab {tab}`, `learn.skill {skill}`, `learn.show {tutorial}` and `learn.back` script it, and the tab buttons, the rows and Back run them ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`). - A tool's name in a Learn tutorial step is a blue link that shows where the tool is without choosing it (`learn.locateTool {tool}`): its toolbar button is marked, a collapsed group's flyout opens with the tool's row marked, a torn-off strip comes to the front, and a tool no shown toolbar holds is marked in the All Tools drawer. The mark, its 3 seconds and the hidden-toolbar cases are VectorCraft's own rules ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`, the `a_learn_link_*` tests in `toolbar::tests`). - Under a tutorial's steps, View more opens the tutorial's own practice sample as a new untitled document, and once the tutorial is finished, Next Up moves to the next tutorial in the same skill, as the help page describes ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html)). The samples are VectorCraft's own drawings. A Finish tutorial button that shows once the sample is open, the untitled copy, Back to skills in place of Next Up after a skill's last tutorial, and Next Up showing the next tutorial without opening its sample are VectorCraft's own rules. `learn.openSample`, `learn.finish`, `learn.next` and `learn.skills` (Back to skills) script them. Not done: the help page's short video. Regression tests: `view_more_opens_the_tutorial_s_sample_as_a_new_untitled_document`, `finishing_a_tutorial_offers_next_up_in_its_skill`, `the_practice_controls_work_from_the_keyboard`, `the_last_tutorial_of_a_skill_offers_back_to_skills`, `learn_finish_and_learn_next_follow_the_practice`, `learn_skills_shows_the_list_of_skills`, `the_practice_commands_reject_a_missing_or_unknown_tutorial`, `every_tutorial_has_its_own_readable_sample` and `the_next_tutorial_is_the_next_one_in_the_same_skill` in `crates/ui-egui/src/panels/learn/tests.rs`. From fe8cd6660e2336575137918c82bb0d8065211bd5 Mon Sep 17 00:00:00 2001 From: HassanKhan Date: Mon, 16 Nov 2026 11:11:39 +0500 Subject: [PATCH 034/226] test(text): Tsume check takes nothing where a cluster has no blank space (#7821) optical_kerning_keeps_the_tsume_of_a_letter_with_coloured_harakat also runs on an installed Arabic face. In macOS's Arial (5.01.2x) the initial beh and its fatha fill their whole cell, so Tsume rightly takes nothing, but the test required it to move something. The installed-face check now measures each cluster's blank space first: with some, Tsume must move the glyphs; with none, it must move nothing. The test font stays strict. --- crates/text/src/tests/harakat.rs | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/crates/text/src/tests/harakat.rs b/crates/text/src/tests/harakat.rs index 4e11921a6f..1a310ada27 100644 --- a/crates/text/src/tests/harakat.rs +++ b/crates/text/src/tests/harakat.rs @@ -454,18 +454,23 @@ fn check_spaced_harakat(db: &FontDb, family: &str) { } /// Right to left, with harakat coloured apart, Optical kerning keeps the Tsume of each letter's -/// cluster as it does in "HOH": the glyphs move as far with Optical kerning as without it. +/// cluster as it does in "HOH": the glyphs move as far with Optical kerning as without it. The test +/// font leaves blank space beside both letters' ink, so its Tsume must move something; an installed +/// face may not (#7821: Arial's initial beh and its fatha fill its cell), and there the Tsume takes +/// nothing, with or without Optical kerning. #[test] fn optical_kerning_keeps_the_tsume_of_a_letter_with_coloured_harakat() { let db = FontDb::with_font_dirs(vec![]); assert_eq!(db.add_font(crate::test_fonts::lam_alef_font(b"rlig").unwrap()), 1); - check_optical_tsume(&db, crate::test_fonts::lam_alef_family(b"rlig")); + check_optical_tsume(&db, crate::test_fonts::lam_alef_family(b"rlig"), true); if let Some(face) = arabic_face("optical_kerning_keeps_the_tsume_of_a_letter_with_coloured_harakat") { - check_optical_tsume(FontDb::global(), &face.family); + check_optical_tsume(FontDb::global(), &face.family, false); } } -fn check_optical_tsume(db: &FontDb, family: &str) { +/// `strict`: every letter's cluster must leave blank space beside its ink, so its Tsume must move +/// or narrow something. +fn check_optical_tsume(db: &FontDb, family: &str, strict: bool) { const WORD: &str = "بَبَ"; // ب 0, fatha 2, ب 4, fatha 6 let set = |optical: bool, letter: Option| { let mut t = text_with_harakat(WORD, family, Some(red())); @@ -479,11 +484,27 @@ fn check_optical_tsume(db: &FontDb, family: &str) { // Tsume of the line's first cluster only narrows its advance and moves no glyph. let xs = |t: &TextObject| layout(db, t).glyphs.iter().flat_map(|g| [g.xf.as_coeffs()[4], g.advance]).collect::>(); assert!(xs(&set(true, None)).iter().zip(xs(&set(false, None))).any(|(a, b)| (a - b).abs() > 1e-6), "{family}: Optical moves the pair"); + // The blank space Tsume shares out: between the letter's cluster's cell (from its glyphs' + // shared origin, as long as their advances) and its glyphs' ink, on each side, without Tsume. + let plain = layout(db, &set(false, None)); + let blank = |letter: usize| { + let cluster: Vec<_> = plain.glyphs.iter().filter(|g| g.byte == letter).collect(); + let start = cluster.iter().map(|g| g.origin.x).fold(f64::INFINITY, f64::min); + let end = start + cluster.iter().map(|g| g.advance).sum::(); + let ink = cluster.iter().filter(|g| !g.outline.elements().is_empty()).map(|g| g.outline.bounding_box()); + let (lo, hi) = ink.fold((f64::INFINITY, f64::NEG_INFINITY), |(lo, hi), b| (lo.min(b.x0), hi.max(b.x1))); + (lo - start).clamp(0.0, end - start) + (end - hi).clamp(0.0, end - start) + }; // Each letter in turn: the first one's cluster ends the pair, the second one's starts it. for letter in [0, 4] { let moved = |optical: bool| xs(&set(optical, Some(letter))).iter().zip(xs(&set(optical, None))).map(|(a, b)| a - b).collect::>(); let (without, with_optical) = (moved(false), moved(true)); - assert!(without.iter().any(|m| m.abs() > 1e-3), "{family} {letter}: Tsume moves or narrows the glyphs: {without:?}"); + let blank = blank(letter); + if strict || blank > 1e-3 { + assert!(without.iter().any(|m| m.abs() > 1e-3), "{family} {letter}: Tsume moves or narrows the glyphs ({blank} blank): {without:?}"); + } else { + assert!(without.iter().all(|m| m.abs() < 1e-6), "{family} {letter}: no blank space ({blank}), Tsume takes nothing: {without:?}"); + } assert!( without.len() == with_optical.len() && without.iter().zip(&with_optical).all(|(a, b)| (a - b).abs() < 1e-6), "{family} {letter}: {without:?} {with_optical:?}" From 069f6963c6df1de9945d5eb933bef25c1e66cf15 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 22:18:48 -0800 Subject: [PATCH 035/226] SVG glyphs: a glyph from a shared SVG document reads only what it refers to A font's SVG table can keep many glyphs in one document. Each glyph's art was read by handing the importer the whole document, with every other glyph moved into defs. The importer now gets the glyph's element and only what it refers to: elements named by its effective link (plain href, else xlink:href) or by url(#id) in attributes, style attributes and sheets, what those refer to in turn, the start and end tags of the elements holding them, and every + + {other}"## + ), + // Clip paths, masks, filters, markers and patterns, a cycle, the glyph using itself, a + // non-ASCII id. + format!( + r##" + + + + + + + {other}"## + ), + // A rule on the glyph's own parent, which it leaves either way; a quoted, spaced URL to + // an id with punctuation in it. + format!( + r##" + + {other}"## + ), + // A pattern whose art takes its paint from the group holding it. + format!( + r##" + + {other}"## + ), + ]; + for doc in &docs { + let (reduced, whole) = (rewrite(doc, 1, true), rewrite(doc, 1, false)); + assert!(reduced.len() < whole.len() && !reduced.contains("#123456"), "reduced: {reduced}"); + assert_eq!(art(doc, 1, true), art(doc, 1, false), "{reduced}"); + } + } + + /// Whatever the reduction can't follow keeps the whole document in the `defs`. + #[test] + fn what_cant_be_followed_keeps_the_whole_document() { + let glyph = |defs: &str, art: &str| { + format!( + r##"{defs}{art}"## + ) + }; + let gradient = r##""##; + let path = |fill: &str| format!(r##""##); + let docs = [ + glyph("", &path("#000")), + glyph("", &path("#000")), + glyph("", &path("#000")), + glyph("", &path("#000")), + glyph(r"", &path("#000")), + glyph("", &path("#000")), + glyph(gradient, &path(r"url(#\67)")), + glyph(gradient, r#""#), + glyph(gradient, &path("url(#%67)")), + glyph(gradient, &path("url('#g)")), + glyph(gradient, &path("url(#g) url(#g x)")), + glyph(gradient, &path("url(#nothing)")), + glyph(gradient, &path("url(other.svg#g)")), + glyph(gradient, r##""##), + glyph(&format!("{gradient}{gradient}"), &path("url(#g)")), + glyph(&format!(r#"{gradient}"#), &path("url(#g)")), + glyph(&format!("{gradient}"), &path("url(#g)")), + r##""## + .to_string(), + r##"]>"## + .to_string(), + ]; + for doc in &docs { + assert_eq!(rewrite(doc, 1, true), rewrite(doc, 1, false), "{doc}"); + } + } + + #[test] + fn edits_apply_inside_the_range_asked_for() { + let edits = vec![(0..1, "A".to_string()), (2..2, "B".into()), (3..5, String::new()), (4..6, "C".into())]; + // An edit overlapping one already made is passed by; one not inside the range is not made. + assert_eq!(edited("0123456", 0..7, &edits).as_deref(), Some("A1B256")); + assert_eq!(edited("0123456", 2..5, &edits).as_deref(), Some("B2")); + assert_eq!(edited("0123456", 4..7, &edits).as_deref(), Some("C6")); + assert_eq!(edited("0123456", 1..2, &edits).as_deref(), Some("1B")); + } + + /// Of an element's `href` and `xlink:href`, only the plain one is followed, as the importer + /// follows it: the other's element stays out, and one that isn't there doesn't keep the whole + /// document. + #[test] + fn only_the_link_the_importer_follows_is_kept() { + let doc = |xlink: &str| { + format!( + r##" + "## + ) + }; + for xlink in ["#nothing", "other.svg#b"] { + let doc = doc(xlink); + let reduced = rewrite(&doc, 1, true); + assert!(reduced.len() < rewrite(&doc, 1, false).len() && !reduced.contains("#123456"), "{reduced}"); + assert_eq!(art(&doc, 1, true), art(&doc, 1, false)); + } + let doc = doc("#b").replace(r##""##, ""); + let reduced = rewrite(&doc, 1, true); + assert!(reduced.contains(r#"id="a""#) && !reduced.contains(r#"id="b""#), "{reduced}"); + assert_eq!(art(&doc, 1, true), art(&doc, 1, false)); + } + + /// A glyph inside an element that gives a prefix (or the default namespace) another namespace + /// than the root does keeps its own after it leaves that element. + #[test] + fn a_glyph_keeps_its_namespaces_when_the_root_gives_them_others() { + let flat = r##" + "##; + let nested = r##" + "##; + // The glyph declaring the prefix itself keeps it as it is. + let declared = r##" + "##; + for reduce in [true, false] { + assert_eq!(art(nested, 1, reduce), art(flat, 1, reduce), "{}", rewrite(nested, 1, reduce)); + assert_eq!(art(declared, 1, reduce), art(flat, 1, reduce), "{}", rewrite(declared, 1, reduce)); + } + assert_eq!(rewrite(declared, 1, true).matches("xmlns:v=").count(), 2); + // A path in another default namespace is no SVG path, out of that element too. + let other = r##" + "##; + let only = r##""##; + for reduce in [true, false] { + assert_eq!(art(other, 1, reduce), art(only, 1, reduce), "{}", rewrite(other, 1, reduce)); + } + } + + /// Many references to the same elements keep each of them once. + #[test] + fn repeated_references_keep_each_element_once() { + let uses: String = (0..2000).map(|i| format!(r##""##)).collect(); + let doc = format!( + r##" + + {uses}"## + ); + let reduced = rewrite(&doc, 1, true); + for id in ["g", "a", "b"] { + assert_eq!(reduced.matches(&format!(r#"id="{id}""#)).count(), 1, "{id}"); + } + assert!(!reduced.contains("#123456")); + } + + /// An empty document, or one without the glyph, has no art; one of exactly the cap reads, one a + /// byte larger doesn't. + #[test] + fn empty_and_capped_documents() { + assert!(glyph_art(b"", 1, 1000.0, Color::BLACK, None).is_none()); + assert!(glyph_art(br#""#, 1, 1000.0, Color::BLACK, None).is_none()); + let doc = shared(20); + let at = doc.len() - "".len(); + let padded = |len: u64| { + let pad = "x".repeat(len as usize - doc.len() - "".len()); + format!("{}{}", &doc[..at], &doc[at..]) + }; + let (full, over) = (padded(MAX_SVG_GLYPH_BYTES), padded(MAX_SVG_GLYPH_BYTES + 1)); + assert_eq!(full.len() as u64, MAX_SVG_GLYPH_BYTES); + assert_eq!(art(&full, 3, true), art(&doc, 3, true)); + assert!(glyph_art(over.as_bytes(), 3, 1000.0, Color::BLACK, None).is_none()); + } + + /// This thread's CPU time in seconds where the system reports it, else the time since a first + /// call. + fn cpu_seconds() -> f64 { + static START: std::sync::OnceLock = std::sync::OnceLock::new(); + let schedstat = std::fs::read_to_string("/proc/thread-self/schedstat").ok(); + match schedstat.as_deref().and_then(|s| s.split_whitespace().next()?.parse::().ok()) { + Some(ns) => ns / 1e9, + None => START.get_or_init(std::time::Instant::now).elapsed().as_secs_f64(), + } + } + + /// The importer's time for 50 distinct glyphs of shared documents, read whole and reduced, the + /// two alternating in one process: `cargo test -p vectorcraft-svg --lib glyph::tests::timing -- + /// --ignored --nocapture`. + #[test] + #[ignore = "timing, run by hand"] + fn timing() { + for n in [100, 500, 2000] { + let doc = shared(n); + let gids: Vec = (0..50).map(|i| (i * n / 50) as u32).collect(); + let run = |reduce: bool| { + let t = cpu_seconds(); + for g in &gids { + assert!(glyph_art_with(doc.as_bytes(), *g, 1000.0, Color::BLACK, None, reduce).is_some()); + } + cpu_seconds() - t + }; + run(false); + run(true); + let (mut whole, mut reduced) = (vec![], vec![]); + for round in 0..9 { + if round % 2 == 0 { + whole.push(run(false)); + reduced.push(run(true)); + } else { + reduced.push(run(true)); + whole.push(run(false)); + } + } + let median = |v: &mut Vec| { + v.sort_by(f64::total_cmp); + v[v.len() / 2] + }; + let ms = |v: &[f64]| v.iter().map(|s| format!("{:.1}", s * 1e3)).collect::>().join(" "); + println!("{n} glyphs, {} bytes: whole {} ms, reduced {} ms", doc.len(), ms(&whole), ms(&reduced)); + println!("{n} glyphs: median whole {:.1} ms, reduced {:.1} ms", median(&mut whole) * 1e3, median(&mut reduced) * 1e3); + } + } +} diff --git a/crates/svg/tests/it/svg_glyphs.rs b/crates/svg/tests/it/svg_glyphs.rs index 20e5342412..3e4ba8b697 100644 --- a/crates/svg/tests/it/svg_glyphs.rs +++ b/crates/svg/tests/it/svg_glyphs.rs @@ -241,13 +241,10 @@ fn an_images_plain_href_decides_whether_it_is_an_svg_image() { let svg = vectorcraft_svg::base64_encode( br##""##, ); - let image = |href: &str, xlink: &str| { - format!( - r##""##, - if href == "png" { &png } else { &svg }, - if xlink == "png" { &png } else { &svg } - ) - }; + let data = |kind: &str| format!("data:image/{kind};base64,{}", if kind == "png" { &png } else { &svg }); + let image = |href: &str, xlink: &str| format!(r##""##, data(href), data(xlink)); + // The same, `xlink:href` written first. + let xlink_first = |href: &str, xlink: &str| format!(r##""##, data(xlink), data(href)); let images = |inner: String| { let doc = format!( r##"{inner}"## @@ -258,6 +255,38 @@ fn an_images_plain_href_decides_whether_it_is_an_svg_image() { }; assert_eq!(images(image("png", "svg+xml")), 1, "the PNG stays"); assert_eq!(images(image("svg+xml", "png")), 0, "the document goes"); + assert_eq!(images(xlink_first("png", "svg+xml")), 1, "the PNG stays, its link written last"); + assert_eq!(images(xlink_first("svg+xml", "png")), 0, "the document goes, its link written last"); +} + +/// A glyph draws what it refers to wherever its document defines it: here a sheet's `url()` to a +/// gradient inside another glyph's element, which takes its stops from one in `defs`. The other +/// glyph's own art is not drawn. +#[test] +fn a_glyph_draws_what_it_refers_to_from_anywhere_in_its_document() { + let doc = r##" + + + + "##; + let fills = fills(&art(doc, 5).unwrap()); + let stops = fills.iter().find_map(|p| match p { + Paint::Gradient(g) => Some(g.gradient.stops.iter().map(|s| s.color).collect::>()), + _ => None, + }); + assert_eq!(stops, Some(vec![Color::rgb8(255, 0, 0), Color::rgb8(0, 0, 255)]), "{fills:?}"); + assert!(!fills.contains(&Paint::solid(Color::rgb8(0, 255, 0))), "not the other glyph's art: {fills:?}"); +} + +/// A glyph in colors of its own doesn't use the text's because another glyph of its document does. +#[test] +fn another_glyphs_current_color_does_not_color_a_glyph() { + let doc = r##" + + + "##; + assert!(!glyph_art(doc.as_bytes(), 1, 1000.0, BLUE, None).unwrap().1); + assert!(glyph_art(doc.as_bytes(), 2, 1000.0, BLUE, None).unwrap().1); } /// A glyph's `` draws its art but keeps no link: outlined text must not export a diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 0782bacab9..3f46017fe5 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -718,6 +718,7 @@ since 2026-10-01. - **Colour emoji with bitmap glyphs:** `sbix` (Apple Color Emoji) and `CBDT` (Noto Color Emoji) glyphs draw as their largest strike's PNG, placed with the type and unpainted by its fill; PDF writes them in Type 3 glyphs or as images, SVG as images with outlined text, EPS and legacy `.ai` as images, and Create Outlines makes embedded images. Synthetic test fonts in `crates/text/src/test_fonts.rs`; tests `crates/text/src/tests/bitmaps.rs`, `crates/render/src/tests/bitmapglyphs.rs`, `crates/svg/tests/it/colour_glyphs.rs`, `pdf::tests::colour_bitmap_glyphs_export_as_images`, the `eps` `colour_bitmap_glyphs_*` tests and `tests_pathops::create_outlines_turns_bitmap_glyphs_into_images`. COLR and OpenType SVG fonts remain. - **COLR colour fonts:** v0 and v1 glyphs draw as vector layers (solid colours, linear and radial gradients, including ones that repeat or reflect, clips, blend modes, the foreground colour from the run's fill) on the canvas, as paths in SVG, EPS, legacy `.ai` and PDF with outlined text, as Type 3 text in PDF, and as editable groups with Create Outlines; sweep gradients, Porter-Duff compositing and radial gradients that repeat or reflect and start at a circle draw the glyph as an image. Measured by `tests_colr`, `render::tests_colrglyphs`, `pdf::tests::colr_glyphs_export_as_vector_art`, `svg/tests/it/colour_glyphs.rs`, `eps` `colr_glyphs_*`, `tests_pathops::create_outlines_turns_colr_glyphs_into_layer_groups`. Scores unchanged (estimated). - **OpenType SVG colour fonts:** each glyph's SVG document is read by the SVG importer (registered by the engine) into vector art in the run's colours, then drawn, exported and outlined as COLR glyphs are; PDF real text writes them as text that draws nothing and draws their art where they sit. Measured by `tests_svg_glyphs`, `svg/tests/it/svg_glyphs.rs`, `tests_colourfonts::create_outlines_turns_svg_glyphs_into_groups`, `tests_colourfonts::pdf_real_text_draws_svg_glyphs_as_art_and_keeps_their_characters`. Scores unchanged (estimated). +- **OpenType SVG glyphs from a shared document:** when one SVG document holds many glyphs, the importer reads only the glyph's element and what it refers to (by `href` or `url(#id)`, through other elements, the elements holding them and every `