Merge main into fix/classic-overprint-separations

This commit is contained in:
dotCooCoo committed 2026-11-18 00:29:20 -08:00
commit bb1cf4275a
79 files changed
+2720 -193

No files matched your search

+12
View File
@@ -112,6 +112,18 @@ pub enum ArrowStyle {
None,
}
impl ArrowStyle {
/// The stroke arrowhead drawn at each end of the dimension line, or None for no head.
pub fn arrowhead(self) -> Option<crate::Arrowhead> {
match self {
Self::Filled => Some(crate::Arrowhead::Triangle),
Self::Open => Some(crate::Arrowhead::TriangleOpen),
Self::Tick => Some(crate::Arrowhead::Slash),
Self::None => None,
}
}
}
/// Where the label sits across the dimension line.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
+25 -6
View File
@@ -2096,7 +2096,9 @@ pub fn compound_part_at(n: &Node, p: Point, tol: f64) -> Option<NodeId> {
/// Objects (children of layers, or of `scope` in isolation mode) touched by a marquee rect, leaving
/// out those on a locked artboard ([`crate::LockedArtboards::holds_id`]). Symbol instances are measured
/// by their art ([`Node::geometric_bounds_with`]), and outside that box, except in outline, they are
/// touched where the live geometry effects of a clipping path in their art show it. The art of a clip group or of a layer with a
/// touched where the live geometry effects of a clipping path in their art show it, or where the
/// geometry effects of their active fill or stroke reshape the art. Images are also touched, except
/// in outline, where their own fills and strokes paint outside their box. The art of a clip group or of a layer with a
/// clipping mask counts only when the marquee meets the region its clipping path clips to, and then
/// only within that region's bounds. In isolation mode the clipping mask of the isolated container,
/// or of the parent of the single object isolated, does not limit the marquee, as it does not limit
@@ -2265,8 +2267,10 @@ fn marquee_with(doc: &Document, r: Rect, scope: Option<NodeId>, leaves: bool, wh
/// Does the marquee `r` touch `n`? It skips the children of a Shaper Group that clicks skip
/// ([`shaper_hides`]). An Intertwine group is touched by its members, and a repeat is touched
/// by the copies it draws, as clicks hit them. Objects of every other kind except paths,
/// compound paths, layers and groups are touched by their box. A clipping path is touched by
/// its own geometry ([`mask_marquee`]) and on the edge of its region ([`clip_edge_touches`]).
/// compound paths, layers and groups are touched by their box, and an image or a symbol
/// instance also where its fills and strokes paint outside it ([`painted_touches`]). A clipping
/// path is touched by its own geometry ([`mask_marquee`]) and on the edge of its region
/// ([`clip_edge_touches`]).
fn touches(n: &Node, s: &SymbolBoxes, r: Rect, scope: Option<NodeId>, whole_compounds: bool, outline: bool) -> bool {
// A path or compound path whose geometry effects reshape it, or a group or layer whose own
// geometry effects reshape its members, is touched where that art is drawn ([`drawn_art`]).
@@ -2296,12 +2300,27 @@ fn marquee_with(doc: &Document, r: Rect, scope: Option<NodeId>, leaves: bool, wh
NodeKind::Compound { children, .. } => children.iter().any(|c| c.visible && touches(c, s, r, scope, whole_compounds, outline)),
NodeKind::Repeat(spec) => spec.expand(Some(s.document())).iter().any(|copy| touches(copy, s, r, scope, whole_compounds, outline)),
// A symbol instance is touched by its box, and outside it where the live geometry
// effects of a clipping path in its art show the art. In the art of another instance
// walked outside that instance's box, it is touched only by its own art ([`ArtOnly`]).
NodeKind::SymbolInstance { .. } => !ArtOnly::on() && box_touches(n, s, r) || !outline && instance_art_touches(n, s, r, whole_compounds),
// effects of a clipping path in its art show the art, or where the geometry effects of
// its active fill or stroke reshape the art ([`painted_touches`]). In the art of another
// instance walked outside that instance's box, it is touched only by its own art
// ([`ArtOnly`]) and those shapes.
NodeKind::SymbolInstance { .. } => {
!ArtOnly::on() && box_touches(n, s, r) || !outline && (instance_art_touches(n, s, r, whole_compounds) || painted_touches(n, s, r))
}
// An image is touched by its box, and outside it where its own fills and strokes paint.
NodeKind::Image(_) => box_touches(n, s, r) || !outline && painted_touches(n, s, r),
_ => box_touches(n, s, r),
}
}
/// Does the marquee `r` touch the shapes that the fills and strokes of image or symbol
/// instance `n` paint ([`image_paint`]), where clicks hit them ([`hit_painted`])? Each shape is
/// touched by its path, as a path is ([`vectorcraft_geom::hit::intersects_rect`]). Only when
/// `r` meets the reach of `n` ([`Node::reach_bounds_with`]).
fn painted_touches(n: &Node, s: &SymbolBoxes, r: Rect) -> bool {
let meets = |b: Rect| b.x0 <= r.x1 && r.x0 <= b.x1 && b.y0 <= r.y1 && r.y0 <= b.y1;
n.reach_bounds_with(s).is_some_and(meets)
&& image_paint(Some(s.document()), n).iter().any(|(bp, _, _)| vectorcraft_geom::hit::intersects_rect(&PathData::from_bezpath(bp), r))
}
/// Does the marquee `r` touch the box of `n`? A box with no width or no height (an instance of
/// a symbol that draws a straight line) is touched where the marquee crosses it.
fn box_touches(n: &Node, s: &SymbolBoxes, r: Rect) -> bool {
+17
View File
@@ -220,6 +220,13 @@ pub fn language_quotes(language: &str) -> Option<Quotes> {
LANGUAGES.iter().find(|(l, _, _)| l.eq_ignore_ascii_case(language)).map(|(_, _, q)| *q)
}
/// The BCP 47 tag of the [`LANGUAGES`] entry named or tagged `language` (case-insensitive), the
/// default's included (`en-US`): what a document's language ([`DocSetup::language`]) is written
/// as in an exported file. `None` for a language not in the list.
pub fn language_tag(language: &str) -> Option<&'static str> {
LANGUAGES.iter().find(|(n, t, _)| n.eq_ignore_ascii_case(language) || t.eq_ignore_ascii_case(language)).map(|(_, t, _)| *t)
}
/// The [`LANGUAGES`] entry named or tagged `language` (case-insensitive) as a character's
/// language ([`crate::CharStyle::language`]) stores it: its tag, or `None` for the default (the
/// first entry); `Err` for a language not in the list.
@@ -404,6 +411,16 @@ impl DocSetup {
mod tests {
use super::*;
/// A document's language is written by its tag, the default's included (#3644).
#[test]
fn document_languages_have_their_tags() {
assert_eq!(language_tag(&DocSetup::default().language), Some("en-US"));
assert_eq!(language_tag("French"), Some("fr"));
assert_eq!(language_tag("german: swiss"), Some("de-CH"));
assert_eq!(language_tag("sr-latn"), Some("sr-Latn"));
assert_eq!((language_tag("Klingon"), language_tag("")), (None, None));
}
/// Characters store a language of the list by its tag, the default as none.
#[test]
fn char_languages_are_stored_by_tag() {
+2
View File
@@ -840,6 +840,8 @@ pub use docmenu::guide_indexes;
pub(crate) use edit::{Unrecorded, settle_interaction, typing_in_progress};
pub(crate) use object::bounds_rewrite;
pub(crate) use object::{keep_aligned_in, refresh_pixel_aligned};
/// The rules `object.scale`, `object.reflect` and `object.shear` check their params with.
pub use object::{reflect_axis, scale_factors, shear_tangent};
pub use plugin_call::{Location, ParamsPlace, key_location, location_in, location_keys};
pub use select::SIMILAR;
pub(crate) use vectorcraft_doc::range::parse_range;
+3 -10
View File
@@ -3,10 +3,8 @@ use super::{CommandSpec, EngineError, Result, Session, cmd, has_doc};
use serde_json::{Value, json};
use std::sync::Arc;
use vectorcraft_color::{Color, Paint};
use vectorcraft_doc::dimension::{
ArrowStyle, Dimension, DimensionMode, DimensionOptions, DimensionSource, LineType, Orientation, TextAlignment, TextPosition,
};
use vectorcraft_doc::{Appearance, Arrowhead, CharStyle, ColorMode, Dash, Document, Node, NodeId, NodeKind, TextObject};
use vectorcraft_doc::dimension::{Dimension, DimensionMode, DimensionOptions, DimensionSource, LineType, Orientation, TextAlignment, TextPosition};
use vectorcraft_doc::{Appearance, CharStyle, ColorMode, Dash, Document, Node, NodeId, NodeKind, TextObject};
use vectorcraft_geom::{Affine, BezPath, PathData, Point, Vec2};
pub fn specs() -> Vec<CommandSpec> {
@@ -567,12 +565,7 @@ fn appearance(o: &DimensionOptions, mode: ColorMode, ext: bool, arrows: bool) ->
LineType::Solid => None,
};
if arrows {
let head = match o.arrow_style {
ArrowStyle::Filled => Some(Arrowhead::Triangle),
ArrowStyle::Open => Some(Arrowhead::TriangleOpen),
ArrowStyle::Tick => Some(Arrowhead::Slash),
ArrowStyle::None => None,
};
let head = o.arrow_style.arrowhead();
st.start_arrow = head.clone();
st.end_arrow = head;
st.arrow_scale = (o.arrow_scale, o.arrow_scale);
+1
View File
@@ -42,3 +42,4 @@ pub(crate) use pixelgrid::{
};
pub(super) use shape::recut;
pub(crate) use transform::{apply_transform, preview_copies, scaling, transform_node, transform_patterns, transforms_objects};
pub use transform::{reflect_axis, scale_factors, shear_tangent};
+1 -1
View File
@@ -61,7 +61,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Shear…",
["Object", "Transform"],
None,
"{ids?: [id…] (selected first; default: the selection), angle: deg (positive turns the vertical edges clockwise with the horizontal axis, the top to the right; the horizontal edges clockwise with the vertical axis, the right side down), axis?: \"horizontal\"|\"vertical\"|deg (the line the art slides along, counter-clockwise from horizontal on the page, -359 to 359; 0: horizontal, 90: vertical; omitted: horizontal), origin?, copy?, objects?: bool (Transform Objects, default true; false: the art stays and, with patterns, only its pattern tiles transform), patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles), typeAreas?: bool (area type: the frame is reshaped and the text reflows at its size)}. With anchors selected with Direct Selection (and no copy), only those anchors and their handles transform, about the centre of their own box.",
"{ids?: [id…] (selected first; default: the selection), angle: deg (-359 to 359, sheared by its tangent, so 120 slants as -60; 0 and ±180 have no slant and, without copy, change nothing; ±90 and ±270 are an error; positive turns the vertical edges clockwise with the horizontal axis, the top to the right; the horizontal edges clockwise with the vertical axis, the right side down), axis?: \"horizontal\"|\"vertical\"|deg (the line the art slides along, counter-clockwise from horizontal on the page, -359 to 359; 0: horizontal, 90: vertical; omitted: horizontal), origin?, copy?, objects?: bool (Transform Objects, default true; false: the art stays and, with patterns, only its pattern tiles transform), patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles), typeAreas?: bool (area type: the frame is reshaped and the text reflows at its size)}. With anchors selected with Direct Selection (and no copy), only those anchors and their handles transform, about the centre of their own box.",
has_selection,
shear
),
+49 -16
View File
@@ -369,15 +369,22 @@ pub(super) fn scale(s: &mut Session, p: &Value) -> Result<Value> {
check_switches(p, &TRANSFORM_SWITCHES, "object.scale")?;
let ids = selected_roots_to_transform(s)?;
let o = origin_of(s, p, &ids)?;
let sx = f64_req(p, "sx", "object.scale")? / 100.0;
let sy = f64_or(p, "sy", sx * 100.0) / 100.0;
if sx == 0.0 || sy == 0.0 {
return Err(bad("object.scale", "scale must be non-zero"));
}
let sx = f64_req(p, "sx", "object.scale")?;
let (sx, sy) = scale_factors(sx, f64_or(p, "sy", sx)).map_err(|e| bad("object.scale", e))?;
let frame = basis_frame(s, p, "object.scale", &ids)?;
apply_transform(s, "Scale", ids, about(o, frame.conjugate(Affine::scale_non_uniform(sx, sy))), p, true)
}
/// The factors `object.scale` applies for `sx` and `sy` in percent, or the error it returns when
/// either factor is 0.
pub fn scale_factors(sx: f64, sy: f64) -> std::result::Result<(f64, f64), String> {
let (sx, sy) = (sx / 100.0, sy / 100.0);
if sx == 0.0 || sy == 0.0 {
return Err("scale must be non-zero".into());
}
Ok((sx, sy))
}
/// The frame that `object.scale` and a named `object.reflect` act in, from the `basis` param:
/// `"box"` (the default) is the bounding box of `ids`, turned with rotated objects until Reset
/// Bounding Box ([`Document::bbox_angle`]); `"page"` is the page's axes. Anchors selected with
@@ -402,16 +409,7 @@ pub(super) fn reflect(s: &mut Session, p: &Value) -> Result<Value> {
let ids = selected_roots_to_transform(s)?;
let o = origin_of(s, p, &ids)?;
// A named axis is the bounding box's own (see [`basis_frame`]); an angle is a line on the page.
let named = match p.get("axis") {
Some(Value::String(a)) if a == "horizontal" => Some(Affine::scale_non_uniform(1.0, -1.0)),
Some(Value::Number(_)) => None,
None | Some(Value::Null) => Some(Affine::scale_non_uniform(-1.0, 1.0)),
Some(Value::String(a)) if a == "vertical" => Some(Affine::scale_non_uniform(-1.0, 1.0)),
Some(v) => {
let given = v.as_str().map_or_else(|| v.to_string(), str::to_string);
return Err(bad("object.reflect", format!("axis must be \"vertical\", \"horizontal\" or an angle in degrees, not `{given}`")));
}
};
let named = reflect_axis(p.get("axis")).map_err(|e| bad("object.reflect", e))?;
let m = match named {
Some(m) => basis_frame(s, p, "object.reflect", &ids)?.conjugate(m),
None => {
@@ -423,12 +421,47 @@ pub(super) fn reflect(s: &mut Session, p: &Value) -> Result<Value> {
apply_transform(s, "Reflect", ids, about(o, m), p, true)
}
/// The reflection `object.reflect` applies for its `axis` param: the matrix for a named axis
/// (`"vertical"`, the default, or `"horizontal"`), in the bounding box's frame; `None` for an angle,
/// which is a line on the page; or the error for any other value.
pub fn reflect_axis(axis: Option<&Value>) -> std::result::Result<Option<Affine>, String> {
match axis {
Some(Value::String(a)) if a == "horizontal" => Ok(Some(Affine::scale_non_uniform(1.0, -1.0))),
Some(Value::Number(_)) => Ok(None),
None | Some(Value::Null) => Ok(Some(Affine::scale_non_uniform(-1.0, 1.0))),
Some(Value::String(a)) if a == "vertical" => Ok(Some(Affine::scale_non_uniform(-1.0, 1.0))),
Some(v) => {
let given = v.as_str().map_or_else(|| v.to_string(), str::to_string);
Err(format!("axis must be \"vertical\", \"horizontal\" or an angle in degrees, not `{given}`"))
}
}
}
/// Angles closer than this many degrees to ±90 or ±270, or to 0 or ±180, count as those angles. It
/// is far above the rounding error of an angle up to 359° and below any angle a field shows.
const SHEAR_ANGLE_TOLERANCE: f64 = 1e-9;
/// The slant `object.shear` applies for `angle` in degrees: its tangent, and 0 for 0 and ±180. An
/// angle outside -359 to 359, or ±90 or ±270, is an error.
pub fn shear_tangent(angle: f64) -> std::result::Result<f64, String> {
if !(-359.0..=359.0).contains(&angle) {
return Err(format!("`angle` must be from -359 to 359 degrees, not {angle}"));
}
// ±90 and ±270 slant an edge onto the shear axis: their tangent is unbounded.
let flat = angle.rem_euclid(180.0);
if (flat - 90.0).abs() < SHEAR_ANGLE_TOLERANCE {
return Err(format!("`angle` cannot be {angle}: ±90 and ±270 degrees have no shear"));
}
// 0 and ±180 have no slant, but the tangent of ±180° in radians is about 1e-16, not 0.
Ok(if flat < SHEAR_ANGLE_TOLERANCE || 180.0 - flat < SHEAR_ANGLE_TOLERANCE { 0.0 } else { angle.to_radians().tan() })
}
pub(super) fn shear(s: &mut Session, p: &Value) -> Result<Value> {
check_numbers(p, &["angle"], "object.shear")?;
check_switches(p, &TRANSFORM_SWITCHES, "object.shear")?;
let t = shear_tangent(f64_or(p, "angle", 0.0)).map_err(|e| bad("object.shear", e))?;
let ids = selected_roots_to_transform(s)?;
let o = origin_of(s, p, &ids)?;
let t = f64_or(p, "angle", 0.0).clamp(-89.0, 89.0).to_radians().tan();
let horizontal = Affine::new([1.0, 0.0, -t, 1.0, 0.0, 0.0]);
// A named axis, or a line on the page at an angle in degrees, counter-clockwise from horizontal.
let m = match p.get("axis") {
+15 -3
View File
@@ -161,6 +161,8 @@ pub struct FilterRun {
parent: Option<NodeId>,
/// The document it was made from, and that document's revision then.
document: (u64, u64),
/// The plug-in's limits with the Plug-in Instruction Budget in force when it was made.
limits: vectorcraft_plugins::Limits,
}
/// A filter's output handed in by a [`FilterRun`] made away from `plugin.run`, with what the run
@@ -245,7 +247,11 @@ impl FilterRun {
let capacity = (plugin.limits().max_memory_bytes / 2).min(i32::MAX as usize).saturating_sub(params.len());
let (input, read_only) = objects::encode_input_with(&st.doc, &inputs, &kinds, capacity).map_err(err)?;
let document = (st.uid, st.revision);
Ok(FilterRun { plugin, command, input, params, inputs, read_only, parent, document })
let limits = match s.prefs.plugin_instruction_budget {
crate::PluginBudget::Normal => plugin.limits().clone(),
crate::PluginBudget::Large => plugin.large_limits(),
};
Ok(FilterRun { plugin, command, input, params, inputs, read_only, parent, document, limits })
}
/// The plug-in, for its name and budget.
@@ -274,7 +280,13 @@ impl FilterRun {
/// can run on any thread; inside a [`vectorcraft_doc::cancel::scope`] Cancel stops it between
/// two slices of its budget.
pub fn run(&self) -> Result<Vec<u8>> {
self.plugin.run(&self.input, &self.params).map_err(err)
self.plugin.run_limited(&self.input, &self.params, &self.limits).map_err(err)
}
/// The limits it runs under: the plug-in's, with the Plug-in Instruction Budget in force when
/// it was made.
pub fn limits(&self) -> &vectorcraft_plugins::Limits {
&self.limits
}
/// Does the plug-in call commands (its manifest's `commandAllowlist`)? Then it runs only in the
@@ -289,7 +301,7 @@ impl FilterRun {
let may = self.plugin.manifest().permissions();
let calls = super::plugin_call::Calls::of(s, may.contains(&Permission::DocRead), may.contains(&Permission::DocWrite));
let mut bridge = |id: &str, args: &Value| super::plugin_call::call(s, &calls, id, args);
self.plugin.run_calling(&self.input, &self.params, self.plugin.limits(), &mut bridge).0.map_err(err)
self.plugin.run_calling(&self.input, &self.params, &self.limits, &mut bridge).0.map_err(err)
}
/// Runs a plug-in that calls commands and applies its output: the calls and the output are one
+8
View File
@@ -324,6 +324,14 @@ pub const PREF_SPECS: &[PrefSpec] = &[
p!("hyphenationExceptions", "Hyphenation", "", "Exceptions (comma separated)", text),
// Plug-ins & Scratch Disks
p!("pluginsFolder", "Plug-ins & Scratch Disks", "Plug-ins", "Additional Plug-ins Folder", text),
// The instructions each object filter run gets: Large gives at least 250 M besides those for each byte of input.
p!(
"pluginInstructionBudget",
"Plug-ins & Scratch Disks",
"Plug-ins",
"Plug-in Instruction Budget",
choice(&[("normal", "Normal"), ("large", "Large")])
),
p!("scratchPrimary", "Plug-ins & Scratch Disks", "Scratch Disks", "Primary", text),
p!("scratchSecondary", "Plug-ins & Scratch Disks", "Scratch Disks", "Secondary", text),
// User Interface
+43 -20
View File
@@ -76,7 +76,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Redefine Graphic Style",
["Window", "Appearance"],
None,
"{name?, id?} replace the style (default: the one the object was last linked to) with the look of object `id` or the first selected object (a graph series group with no fill, stroke, effect, opacity, blend mode, isolation, knockout or style link of its own: the topmost path directly in it; a graph's Axes or Legend group: its topmost line or label); the objects still linked to it update, and that object becomes linked. The art of a graph design in a series keeps its look and is unlinked, as the source or as a linked object. A linked graph series group passes the style to the paths directly in it, a linked Axes group to its lines and labels and a linked Legend group to its labels, other than the source and paths linked to the style whose look was edited, and is left cleared (as appearance.clear) and unlinked. On a linked path directly in a graph series, the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke and the object's opacity and blend mode (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind → {name}",
"{name?, id?} | {name, from} replace the style (default: the one the object was last linked to) with the look of object `id` or the first selected object (a graph series group with no fill, stroke, effect, opacity, blend mode, isolation, knockout or style link of its own: the topmost path directly in it; a graph's Axes or Legend group: its topmost line or label); the objects still linked to it update, and that object becomes linked. With `from`, the style takes the look of the style named `from` (its fills, strokes, effects, opacity, blend mode, isolate and knockout) and keeps its own name and place; `from` and the objects linked to it stay as they are, `from` naming the style itself or a style with the same look changes nothing, and `from` with `id` is an error. The art of a graph design in a series keeps its look and is unlinked, as the source or as a linked object. A linked graph series group passes the style to the paths directly in it, a linked Axes group to its lines and labels and a linked Legend group to its labels, other than the source and paths linked to the style whose look was edited, and is left cleared (as appearance.clear) and unlinked. On a linked path directly in a graph series, the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke and the object's opacity and blend mode (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring (a graph's Axes group stands for the lines and labels directly in it, its Legend group for the labels), the graph stores that object's topmost visible fill and stroke rows and object opacity and blend mode for every label or line of its kind → {name}",
has_doc,
style_redefine
),
@@ -489,22 +489,43 @@ pub(crate) fn style_json(g: &GraphicStyle) -> Value {
fn style_redefine(s: &mut Session, p: &Value) -> Result<Value> {
let cmd = "graphicStyle.redefine";
let (src, n) = source(s, p, cmd)?;
let d = &s.doc()?.doc;
// A series group that holds nothing of its own is redefined from the topmost of its paths, which a style links.
let n = super::appearance::look_holder(d, n);
let src = if n.id == src { src } else { n.id };
let i = match str_param(p, "name") {
Some(name) => style_index(d, name)?,
None => n
.extras()
.graphic_style
.and_then(|id| d.graphic_style_by_id(id))
.and_then(|g| d.graphic_style_index(&g.name))
.ok_or_else(|| bad(cmd, "the object has no graphic style (pass `name`)"))?,
// The style to replace, its new look, and the object that look comes from (none for another style's look).
let (i, look, src) = match p.get("from") {
Some(from) => {
let from = from.as_str().ok_or_else(|| bad(cmd, "`from` must be a graphic style name"))?;
if p.get("id").is_some() {
return Err(bad(cmd, "pass `id` or `from`, not both"));
}
let name = str_param(p, "name").ok_or_else(|| bad(cmd, "missing name (the style `from` replaces)"))?;
let d = &s.doc()?.doc;
let (i, j) = (style_index(d, name)?, style_index(d, from)?);
// A style dropped on itself, or on a style with the same look, stays as it is.
let target = &d.graphic_styles[i];
let look = GraphicStyle { name: target.name.clone(), id: target.id, ..d.graphic_styles[j].clone() };
if i == j || look == *target {
return Ok(json!({ "name": name }));
}
(i, look, None)
}
None => {
let (src, n) = source(s, p, cmd)?;
let d = &s.doc()?.doc;
// A series group that holds nothing of its own is redefined from the topmost of its paths, which a style links.
let n = super::appearance::look_holder(d, n);
let src = if n.id == src { src } else { n.id };
let i = match str_param(p, "name") {
Some(name) => style_index(d, name)?,
None => n
.extras()
.graphic_style
.and_then(|id| d.graphic_style_by_id(id))
.and_then(|g| d.graphic_style_index(&g.name))
.ok_or_else(|| bad(cmd, "the object has no graphic style (pass `name`)"))?,
};
(i, GraphicStyle::of(String::new(), captured(n), n), Some(src))
}
};
let look = GraphicStyle::of(String::new(), captured(n), n);
let name = d.graphic_styles[i].name.clone();
let name = s.doc()?.doc.graphic_styles[i].name.clone();
let chars = s.prefs.override_char_color;
let before = s.doc()?.doc.clone();
s.edit_named("Redefine Graphic Style “{name}”", &name, false, |d, _| {
@@ -513,7 +534,7 @@ fn style_redefine(s: &mut Session, p: &Value) -> Result<Value> {
// Objects still linked follow the new definition; edited ones are unlinked (they keep their look), and the
// source keeps its own. The art of a graph design in a series is unlinked and keeps its look too, as the
// source or as a linked object: the graph draws it again from the design.
let linked = objects_where(d, |n| n.extras().graphic_style == Some(id) && n.id != src);
let linked = objects_where(d, |n| n.extras().graphic_style == Some(id) && Some(n.id) != src);
let (follow, edited): (Vec<NodeId>, Vec<NodeId>) =
linked.into_iter().partition(|nid| !super::graph::is_design_art(d, *nid) && d.node(*nid).is_some_and(|n| in_sync(n, &old)));
set_link(d, &edited, None);
@@ -521,7 +542,7 @@ fn style_redefine(s: &mut Session, p: &Value) -> Result<Value> {
// goes back to the empty appearance the graph draws it with. The source and the edited paths keep their look.
let mut follow_marks = super::graph::series_group_marks(d, &follow);
let edited: HashSet<NodeId> = edited.into_iter().collect();
follow_marks.retain(|nid| *nid != src && !edited.contains(nid));
follow_marks.retain(|nid| Some(*nid) != src && !edited.contains(nid));
super::appearance::clear_stood_for(d, &super::appearance::stood_for(&follow, &follow_marks));
let g = d.graphic_styles[i].clone();
let mut shared = None;
@@ -530,8 +551,10 @@ fn style_redefine(s: &mut Session, p: &Value) -> Result<Value> {
}
super::appearance::capture_series_writes(&before, d, &follow_marks, (true, true), (true, true), false, true);
super::graph::capture_label_rows(d, &follow_marks);
let link = (!super::graph::is_design_art(d, src)).then_some(id);
set_link(d, &[src], link);
if let Some(src) = src {
let link = (!super::graph::is_design_art(d, src)).then_some(id);
set_link(d, &[src], link);
}
Ok(())
})?;
Ok(json!({ "name": name }))
+1 -1
View File
@@ -415,7 +415,7 @@ use history::history_budget_for;
pub use history::{History, HistoryEntry, NamedStep, default_history_budget};
pub(crate) use interaction::PreviewCopies;
pub use interaction::{Interaction, LastTransform, UndoGroup, UndoScope};
pub use prefs::{DrawMode, Prefs};
pub use prefs::{DrawMode, PluginBudget, Prefs};
pub use sanity::TOO_DEEP;
pub(crate) use sanity::{deselect_hidden, is_guide_path};
#[cfg(test)]
+26
View File
@@ -10,6 +10,26 @@ pub enum DrawMode {
Inside,
}
/// Plug-ins & Scratch Disks › Plug-in Instruction Budget: the instructions an object filter's run
/// may use ([`vectorcraft_plugins::Plugin::large_limits`]).
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, serde::Serialize)]
#[serde(rename_all = "lowercase")]
pub enum PluginBudget {
/// The plug-in's own limits.
#[default]
Normal,
/// At least [`vectorcraft_plugins::LARGE_FUEL`] instructions besides those for each byte of
/// input; the time budget is unchanged.
Large,
}
/// A saved Plug-in Instruction Budget: any value but `large`, of any type, reads as Normal, and the
/// other preferences are read as they are.
fn plugin_budget<'de, D: serde::Deserializer<'de>>(d: D) -> std::result::Result<PluginBudget, D::Error> {
let saved = <Value as serde::Deserialize>::deserialize(d)?;
Ok(if saved.as_str() == Some("large") { PluginBudget::Large } else { PluginBudget::Normal })
}
/// A saved Default Language as its tag: older preferences hold the language's name, and one the list
/// no longer has reads as the default.
fn language_tag<'de, D: serde::Deserializer<'de>>(d: D) -> std::result::Result<String, D::Error> {
@@ -179,6 +199,11 @@ pub struct Prefs {
pub fonts_folder: String,
// Plug-ins & Scratch Disks
pub plugins_folder: String,
/// Plug-in Instruction Budget: the instructions each object filter run gets, from
/// `plugin.run`, a plug-in command and the app alike. Live effects, exporters and importers
/// keep their own budgets.
#[serde(deserialize_with = "plugin_budget")]
pub plugin_instruction_budget: PluginBudget,
pub scratch_primary: String,
pub scratch_secondary: String,
// User Interface
@@ -496,6 +521,7 @@ impl Default for Prefs {
hyphenation_exceptions: String::new(),
fonts_folder: String::new(),
plugins_folder: String::new(),
plugin_instruction_budget: PluginBudget::Normal,
scratch_primary: s("Startup"),
scratch_secondary: s("None"),
ui_brightness: s("mediumDark"),
+68 -11
View File
@@ -387,22 +387,79 @@ fn a_fill_effect_reshapes_the_fill_of_a_group_in_the_art() {
assert!(differing(&before, &after, 8) < 200, "expanding changed {} pixels", differing(&before, &after, 8));
}
/// An image whose fill Convert to Shape gives a shape, selected. The frame runs from 85 to 115;
/// the fill's shape is 9 pt larger on each side.
fn image_with_shaped_fill(s: &mut Session) -> NodeId {
let mut png = vec![];
image::RgbaImage::from_pixel(30, 30, image::Rgba([255, 0, 0, 255]))
.write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png)
.unwrap();
let r = run(s, "file.place", json!({"name": "red.png", "dataBase64": vectorcraft_format::base64_encode(&png), "at": [100, 100]}));
let im = NodeId(r["ids"][0].as_u64().unwrap());
run(s, "select.set", json!({"ids": [im.0]}));
run(s, "appearance.addFill", json!({}));
run(s, "paint.setFill", json!({"color": "#0000ff", "item": 0}));
run(s, "effect.apply", json!({"effect": "convertToShape.rectangle", "item": 0}));
im
}
/// The objects a marquee from `x0` to `x1` across y = 100 touches, as the canvas shows them, in
/// outline with `outline`.
fn marquee_at(s: &Session, x0: f64, x1: f64, outline: bool) -> Vec<NodeId> {
let r = vectorcraft_geom::Rect::new(x0, 90.0, x1, 110.0);
vectorcraft_doc::hit::marquee_in_view(&s.doc().unwrap().doc, r, None, true, outline)
}
/// A marquee touches a symbol instance where the geometry effects of its fill or stroke paint its
/// art outside its box, as a click there selects it, except in outline.
#[test]
fn a_marquee_where_a_symbol_instance_fill_or_stroke_effect_paints_selects_it() {
let mut s = session();
let (id, row) = instance_with_row(&mut s, "Square", true);
assert_eq!(marquee_at(&s, 38.0, 45.0, false), []);
offset_row(&mut s, id, row, 10.0);
assert_eq!(marquee_at(&s, 38.0, 45.0, false), [id], "a marquee across the grown fill");
assert_eq!(marquee_at(&s, 30.0, 37.0, false), [], "a marquee past the grown fill");
assert_eq!(marquee_at(&s, 38.0, 45.0, true), [], "outline mode draws the art as it is");
let mut s = session();
let (id, row) = instance_with_row(&mut s, "Square", false);
offset_row(&mut s, id, row, 10.0);
assert_eq!(marquee_at(&s, 38.0, 42.0, false), [id], "a marquee across the moved stroke");
assert_eq!(marquee_at(&s, 43.0, 45.0, false), [], "a marquee between the moved stroke and the fill");
let mut s = session();
let (id, row) = nested_instance_with_row(&mut s);
offset_row(&mut s, id, row, 10.0);
assert_eq!(marquee_at(&s, 38.0, 45.0, false), [id], "a marquee across the grown fill of the nested art");
}
/// A marquee touches an image where the shape of its own fill lies outside its frame, and an
/// instance of a symbol made of that image where the instance's fill effect grows that shape, as
/// clicks there select them, except in outline.
#[test]
fn a_marquee_on_the_shape_of_an_image_fill_selects_it() {
let mut s = session();
let im = image_with_shaped_fill(&mut s);
assert_eq!(marquee_at(&s, 74.0, 79.0, false), [im], "a marquee across the fill's shape outside the frame");
assert_eq!(marquee_at(&s, 70.0, 75.0, false), [], "a marquee past the fill's shape");
assert_eq!(marquee_at(&s, 74.0, 79.0, true), [], "outline mode draws the frame");
let id = NodeId(run(&mut s, "symbol.new", json!({"name": "Image"}))["id"].as_u64().unwrap());
run(&mut s, "appearance.addFill", json!({"ids": [id.0]}));
let row = node(&s, id).appearance.items.len() - 1;
run(&mut s, "appearance.setItem", json!({"ids": [id.0], "index": row, "none": true}));
offset_row(&mut s, id, row, 10.0);
assert_eq!(marquee_at(&s, 64.0, 68.0, false), [id], "a marquee across the instance's grown fill");
assert_eq!(marquee_at(&s, 58.0, 63.0, false), [], "a marquee past the grown fill");
}
/// An image in the symbol's art whose fill Convert to Shape gives a shape: the instance's fill
/// effect grows what that fill paints, and a click there selects the instance.
#[test]
fn a_click_on_the_grown_fill_of_an_image_in_the_art_selects_the_instance() {
let mut s = session();
let mut png = vec![];
image::RgbaImage::from_pixel(30, 30, image::Rgba([255, 0, 0, 255]))
.write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png)
.unwrap();
// The frame runs from 85 to 115; the fill's shape is 9 pt larger on each side.
let r = run(&mut s, "file.place", json!({"name": "red.png", "dataBase64": vectorcraft_format::base64_encode(&png), "at": [100, 100]}));
let im = NodeId(r["ids"][0].as_u64().unwrap());
run(&mut s, "select.set", json!({"ids": [im.0]}));
run(&mut s, "appearance.addFill", json!({}));
run(&mut s, "paint.setFill", json!({"color": "#0000ff", "item": 0}));
run(&mut s, "effect.apply", json!({"effect": "convertToShape.rectangle", "item": 0}));
image_with_shaped_fill(&mut s);
let id = NodeId(run(&mut s, "symbol.new", json!({"name": "Image"}))["id"].as_u64().unwrap());
run(&mut s, "appearance.addFill", json!({"ids": [id.0]}));
let row = node(&s, id).appearance.items.len() - 1;
+53
View File
@@ -4446,6 +4446,59 @@ fn a_cancelled_filter_run_changes_nothing() {
assert_eq!(s.doc().unwrap().doc, before);
}
/// Preferences › Plug-ins & Scratch Disks › Plug-in Instruction Budget: with Normal a light filter
/// runs out of instructions and changes nothing; with Large the same installed filter finishes, as
/// one undo step, without being installed again. The time budget, Cancel and a heavy filter's
/// larger budget stay as they are, and setting Normal again applies to the next run.
#[test]
fn the_plugin_instruction_budget_preference_sets_a_filter_run_s_instructions() {
use cmd::plugin::FilterRun;
let mut s = session();
let id = "test.engine.largebudget";
let output = json!({"objects": [{"path": triangle(), "name": "Plug-in"}]}).to_string();
// More steps than a light budget pays for, fewer than 5 times it.
install_wat(&mut s, &tpl::spinning(&tpl::manifest(id, "filter", "{}"), 20_000_000, &output));
let p = json!({"id": id, "ids": []});
let (before, undo) = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len());
let e = s.execute("plugin.run", &p).unwrap_err().to_string();
assert!(e.contains("instruction budget"), "{e}");
assert_eq!((&s.doc().unwrap().doc, s.doc().unwrap().history.undo.len()), (&before, undo));
run(&mut s, "prefs.set", json!({"key": "pluginInstructionBudget", "value": "large"}));
let light = vectorcraft_plugins::Limits::default();
let large = FilterRun::prepare(&s, &p).unwrap().limits().clone();
assert_eq!(large, vectorcraft_plugins::Limits { fuel_base: vectorcraft_plugins::LARGE_FUEL, ..light.clone() });
assert_eq!((large.fuel_per_byte, large.wall_time_ms), (light.fuel_per_byte, light.wall_time_ms));
// Cancel still stops it, and it changes nothing.
let token = vectorcraft_doc::cancel::CancelToken::new();
token.cancel();
let r = vectorcraft_doc::cancel::scope(&token, None, || s.execute("plugin.run", &p));
assert!(matches!(r, Err(EngineError::Cancelled)), "{r:?}");
assert_eq!((&s.doc().unwrap().doc, s.doc().unwrap().history.undo.len()), (&before, undo));
let made = run(&mut s, "plugin.run", p.clone())["ids"].clone();
assert_eq!(made.as_array().map(Vec::len), Some(1));
assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1);
// A heavy filter keeps its larger budget with either choice.
let heavy_id = "test.engine.largebudget.heavy";
run(&mut s, "plugin.install", json!({"dataBase64": vectorcraft_format::base64_encode(&heavy(heavy_id, 1)), "allowHeavy": true}));
let hp = json!({"id": heavy_id, "ids": []});
for budget in ["large", "normal"] {
run(&mut s, "prefs.set", json!({"key": "pluginInstructionBudget", "value": budget}));
let limits = FilterRun::prepare(&s, &hp).unwrap().limits().clone();
let heavy_limits = (vectorcraft_plugins::HEAVY_FUEL, vectorcraft_plugins::HEAVY_WALL_TIME_MS);
assert_eq!((limits.fuel_base, limits.wall_time_ms), heavy_limits, "{budget}");
}
// Normal again: the next run runs out of instructions.
let undo = s.doc().unwrap().history.undo.len();
let e = s.execute("plugin.run", &p).unwrap_err().to_string();
assert!(e.contains("instruction budget"), "{e}");
assert_eq!(s.doc().unwrap().history.undo.len(), undo);
run(&mut s, "plugin.remove", json!({"id": id}));
run(&mut s, "plugin.remove", json!({"id": heavy_id}));
}
/// The manifest of a filter `id` named "Cmd Test" of `kind` with `commands` (a JSON list).
fn with_commands(id: &str, kind: &str, commands: &str) -> String {
format!(r#"{{"id":"{id}","name":"Cmd Test","version":"1","kind":"{kind}","commands":{commands}}}"#)
+32
View File
@@ -464,6 +464,38 @@ fn gpu_preference_defaults_to_automatic_and_validates() {
assert_eq!(s.prefs.gpu_preference, "automatic");
}
/// Plug-ins & Scratch Disks › Plug-in Instruction Budget: Normal by default, Large by value or
/// label, kept through a save and load, and reset with its category. Setting another value is an
/// error that changes nothing; a saved value that is missing, unknown or of another type reads as
/// Normal and leaves the other saved preferences as they are.
#[test]
fn plugin_instruction_budget_defaults_to_normal_and_validates() {
let mut s = Session::new();
assert_eq!(s.prefs.plugin_instruction_budget, PluginBudget::Normal);
assert_eq!(s.execute("prefs.get", &json!({"key": "pluginInstructionBudget"})).unwrap(), json!("normal"));
set_pref(&mut s, "pluginInstructionBudget", json!("Large"));
assert_eq!(s.prefs.plugin_instruction_budget, PluginBudget::Large);
assert_eq!(s.execute("prefs.get", &json!({"key": "pluginInstructionBudget"})).unwrap(), json!("large"));
for bad in [json!("unlimited"), json!(""), json!(5), json!(null), json!(true), json!(["large"])] {
assert!(s.execute("prefs.set", &json!({"key": "pluginInstructionBudget", "value": bad})).is_err(), "{bad}");
assert_eq!(s.prefs.plugin_instruction_budget, PluginBudget::Large, "{bad}");
}
let back: Prefs = serde_json::from_value(s.prefs.to_json()).unwrap();
assert_eq!(back.plugin_instruction_budget, PluginBudget::Large);
let other_values = [json!("unlimited"), json!(5), json!(null), json!(["large"]), json!({"large": true}), json!("LARGE")];
let saved_files = other_values.map(|v| json!({"keyboardIncrement": 4, "pluginInstructionBudget": v}));
for saved in std::iter::once(json!({"keyboardIncrement": 4})).chain(saved_files) {
let read: Prefs = serde_json::from_value(saved.clone()).unwrap();
assert_eq!((read.plugin_instruction_budget, read.keyboard_increment), (PluginBudget::Normal, 4.0), "{saved}");
}
let l = s.execute("prefs.list", &json!({})).unwrap();
let row = l.as_array().unwrap().iter().find(|e| e["key"] == "pluginInstructionBudget").unwrap().clone();
assert_eq!((row["category"].as_str(), row["section"].as_str()), (Some("Plug-ins & Scratch Disks"), Some("Plug-ins")));
assert_eq!((&row["options"], &row["value"]), (&json!(["normal", "large"]), &json!("large")));
s.execute("prefs.reset", &json!({"category": "Plug-ins & Scratch Disks"})).unwrap();
assert_eq!(s.prefs.plugin_instruction_budget, PluginBudget::Normal);
}
/// Performance › Low-Latency Drawing (#6013): off by default and for preference files written
/// before it, a boolean only, kept through a save/load round trip, listed under Performance and
/// reset with it.
+62
View File
@@ -299,6 +299,68 @@ fn redefine_shares_one_appearance() {
assert!(!Shared::ptr_eq(&node(&s, d).appearance, &nb.appearance));
}
/// Redefine with `from` gives a style another style's look: the style keeps its name, place and id,
/// its objects still linked follow, edited ones are unlinked, and `from` and its objects stay as
/// they are, in one undo step. A style replaced by itself or by a style with the same look records
/// nothing, and bad parameters are errors that change nothing.
#[test]
fn redefine_from_a_style_gives_the_style_that_look() {
let mut s = session();
let (a, b, c) = linked_three(&mut s);
let d = rect(&mut s, 300.0);
set_fill(&mut s, d, "#0000ff");
run(&mut s, "transparency.set", json!({"item": null, "opacity": 50, "blend": "multiply"}));
run(&mut s, "graphicStyle.new", json!({"name": "Blue"}));
set_fill(&mut s, c, "#00ff00");
let names = |s: &Session| s.doc().unwrap().doc.graphic_styles.iter().map(|g| g.name.clone()).collect::<Vec<_>>();
let steps = |s: &Session| s.doc().unwrap().history.undo.len();
let (old, blue, order, before) = (style(&s, "S"), style(&s, "Blue"), names(&s), steps(&s));
assert_eq!(run(&mut s, "graphicStyle.redefine", json!({"name": "S", "from": "Blue"}))["name"], "S");
assert_eq!(style(&s, "S"), GraphicStyle { name: "S".into(), id: old.id, ..blue.clone() });
assert_eq!(names(&s), order);
let blue_paint = Paint::solid(Color::from_hex("#0000ff").unwrap());
for id in [a, b] {
let n = node(&s, id);
assert_eq!((n.appearance.fill_paint(), n.opacity, n.blend), (blue_paint.clone(), 0.5, BlendMode::Multiply));
}
assert_eq!(linked(&mut s, "S"), vec![a.0, b.0]);
// The edited object keeps its look and is unlinked; Blue and its object are as they were.
assert_eq!(fill(&s, c), Paint::solid(Color::from_hex("#00ff00").unwrap()));
assert_eq!(node(&s, c).extras().graphic_style, None);
assert_eq!(style(&s, "Blue"), blue);
assert_eq!(linked(&mut s, "Blue"), vec![d.0]);
let step = s.doc().unwrap().history.undo.last().unwrap().clone();
assert_eq!((step.label.as_str(), steps(&s)), ("Redefine Graphic Style “S”", before + 1));
run(&mut s, "edit.undo", json!({}));
assert_eq!(style(&s, "S"), old);
assert_eq!((fill(&s, a), fill(&s, b)), (Paint::solid(Color::WHITE), Paint::solid(Color::WHITE)));
assert_eq!(node(&s, c).extras().graphic_style, Some(old.id));
run(&mut s, "edit.redo", json!({}));
assert_eq!(style(&s, "S").appearance, blue.appearance);
assert_eq!(linked(&mut s, "S"), vec![a.0, b.0]);
run(&mut s, "edit.undo", json!({}));
// A style replaced by itself, or by a copy with the same look, records nothing.
run(&mut s, "graphicStyle.duplicate", json!({"name": "Blue"}));
let before = steps(&s);
run(&mut s, "graphicStyle.redefine", json!({"name": "S", "from": "S"}));
run(&mut s, "graphicStyle.redefine", json!({"name": "Blue copy", "from": "Blue"}));
assert_eq!(steps(&s), before);
assert_eq!(style(&s, "S"), old);
// A style that does not exist, a `from` that is not a name, `from` with `id` and a missing `name` are errors.
for p in [
json!({"name": "S", "from": "nope"}),
json!({"name": "nope", "from": "Blue"}),
json!({"name": "S", "from": 3}),
json!({"name": "S", "from": "Blue", "id": a.0}),
json!({"from": "Blue"}),
] {
assert!(s.execute("graphicStyle.redefine", &p).is_err(), "{p}");
}
assert_eq!((steps(&s), style(&s, "S")), (before, old));
}
#[test]
fn deleting_a_style_unlinks_and_renaming_keeps_links() {
let mut s = session();
+63
View File
@@ -515,6 +515,69 @@ fn reflect_and_shear_reject_unknown_axes_without_changing_state() {
assert!((b.y0 + 30.0).abs() < 1e-6 && (b.y1 + 20.0).abs() < 1e-6 && b.width() > 30.0, "along the horizontal axis: {b:?}");
}
/// Shear takes an angle from -359 to 359 degrees and shears by its tangent: 60 and -60 slant
/// opposite ways, and 120 and 300 slant as -60 does.
#[test]
fn shear_angles_slant_by_their_tangent() {
let run = 100.0 * 60f64.to_radians().tan();
for (angle, want) in [
(60.0, Rect::new(-run, 0.0, 100.0, 100.0)),
(-60.0, Rect::new(0.0, 0.0, 100.0 + run, 100.0)),
(120.0, Rect::new(0.0, 0.0, 100.0 + run, 100.0)),
(300.0, Rect::new(0.0, 0.0, 100.0 + run, 100.0)),
(-359.0, Rect::new(-100.0 * 1f64.to_radians().tan(), 0.0, 100.0, 100.0)),
] {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 100.0, 100.0);
s.execute("object.shear", &json!({"angle": angle, "origin": [0, 0]})).unwrap();
assert!(close(bounds(&s, a), want), "{angle}: {:?}, want {want:?}", bounds(&s, a));
}
}
/// Shear returns an error for an angle outside -359 to 359 and for ±90 and ±270, which have no
/// finite shear (within a billionth of a degree too); nothing moves and no undo step is recorded.
#[test]
fn shear_rejects_angles_with_no_shear_or_out_of_range() {
let mut s = session();
let a = rect(&mut s, 10.0, 20.0, 30.0, 10.0);
let n = undo_len(&s);
let none = |v: f64| format!("invalid parameters for `object.shear`: `angle` cannot be {v}: ±90 and ±270 degrees have no shear");
let range = |v: f64| format!("invalid parameters for `object.shear`: `angle` must be from -359 to 359 degrees, not {v}");
for (angle, msg) in [
(90.0, none(90.0)),
(-90.0, none(-90.0)),
(270.0, none(270.0)),
(-270.0, none(-270.0)),
(90.0 + 1e-12, none(90.0 + 1e-12)),
(360.0, range(360.0)),
(-359.5, range(-359.5)),
(1e300, range(1e300)),
] {
let e = s.execute("object.shear", &json!({"angle": angle})).expect_err(&angle.to_string());
assert_eq!(e.to_string(), msg);
}
assert!(s.execute("object.shear", &json!({"angle": "45"})).is_err(), "a string is not an angle");
assert!(close(bounds(&s, a), Rect::new(10.0, 20.0, 40.0, 30.0)), "nothing moved: {:?}", bounds(&s, a));
assert_eq!(undo_len(&s), n, "no undo step");
}
/// Shear by 0, 180 or -180 degrees, along either axis, has no slant: the art keeps its exact
/// coordinates and no undo step is recorded.
#[test]
fn shear_by_0_and_180_changes_nothing() {
let mut s = session();
let a = rect(&mut s, 10.0, 20.0, 30.0, 10.0);
let before = bounds(&s, a);
let n = undo_len(&s);
for angle in [180.0, -180.0, 0.0, 180.0 + 1e-12, -180.0 - 1e-12] {
for axis in ["horizontal", "vertical"] {
s.execute("object.shear", &json!({"angle": angle, "axis": axis})).unwrap();
assert_eq!(bounds(&s, a), before, "{angle} {axis}");
assert_eq!(undo_len(&s), n, "{angle} {axis}: no undo step");
}
}
}
/// Shear along an axis at an angle, counter-clockwise from horizontal on the page: each point
/// slides along the axis by the tangent of the shear angle times its distance across the axis
/// from the origin. -359° and 359° are taken, the shear is one undo step and Transform Again
+23
View File
@@ -95,6 +95,29 @@ fn apply_to_all_restyles_every_dimension_in_one_undo_step() {
assert!(s.execute("dimension.applyToAll", &json!({"id":line})).is_err(), "not a dimension");
}
#[test]
fn each_arrow_style_draws_its_stroke_arrowhead_at_both_ends() {
use vectorcraft_doc::Arrowhead;
let mut s = session();
for (style, head) in
[("filled", Some(Arrowhead::Triangle)), ("open", Some(Arrowhead::TriangleOpen)), ("tick", Some(Arrowhead::Slash)), ("none", None)]
{
let id = run(&mut s, "dimension.create", json!({"a":[0,0],"b":[72,0],"options":{"arrowStyle":style}}))["id"].as_u64().unwrap();
let n = s.doc().unwrap().doc.node(NodeId(id)).unwrap();
let heads: Vec<_> = n
.children()
.unwrap()
.iter()
.filter_map(|n| n.appearance.stroke().map(|s| (s.start_arrow.clone(), s.end_arrow.clone())))
.filter(|(a, b)| a.is_some() || b.is_some())
.collect();
match head {
Some(head) => assert!(!heads.is_empty() && heads.iter().all(|h| *h == (Some(head.clone()), Some(head.clone()))), "{style}: {heads:?}"),
None => assert!(heads.is_empty(), "{style}: {heads:?}"),
}
}
}
#[test]
fn dimension_angles_circles_arcs_and_curves() {
let mut s = session();
+127
View File
@@ -3431,6 +3431,133 @@ fn many_gradient_definitions_take_distinct_names_in_order() {
assert_eq!(text, program(&doc));
}
/// The program written from `doc`, with the gradient and pattern definitions found by comparing
/// each in turn (`scanned`) or through their indexes.
fn program_scanned(doc: &Document, scanned: bool) -> Vec<u8> {
writer::SCANNED_DEFINITIONS.with(|s| s.set(scanned));
let out = export_ai_editing(doc, &opts());
writer::SCANNED_DEFINITIONS.with(|s| s.set(false));
out.unwrap().program
}
/// [`gradients_and_patterns`] with more rectangles, each filled with a gradient: `distinct` with
/// gradients of their own; `reused` with one of `ramps` gradients in turn; one for each of
/// `swatches` new gradient swatches, linked to it, with the swatch's gradient for every other one
/// and another gradient for the rest; one with the gradient of an object whose style isn't written
/// (an even-odd fill with a drop shadow), after that object; and two whose gradients
/// differ only in the sign of a zero offset.
fn many_gradients(distinct: u16, reused: u16, ramps: u16, swatches: u16) -> Document {
let mut doc = gradients_and_patterns();
let two = |a: Color, b: Color| ramp(GradientKind::Linear, &[(0.0, a, 1.0, 0.5), (1.0, b, 1.0, 0.5)]);
let shade = |i: u16, n: u16| f32::from(i) / f32::from(n.max(1));
let swatch_gradient = |i: u16| two(Color::gray(shade(i, swatches)), Color::rgb(1.0, 0.0, 0.0));
let more = (0..swatches)
.map(|i| Swatch { name: format!("Ramp {i}"), paint: gradient_paint(swatch_gradient(i), None, None), global: false, spot: false })
.collect();
swatches_plus(&mut doc, more);
let mut paints = vec![];
for i in 0..distinct {
paints.push(gradient_paint(two(Color::rgb(shade(i, distinct), 0.5, 0.0), Color::rgb(0.0, 0.0, 1.0)), None, None));
}
for i in 0..reused {
paints.push(gradient_paint(two(Color::rgb(0.0, shade(i % ramps.max(1), ramps), 0.5), Color::WHITE), None, None));
}
for i in 0..swatches {
let g = if i % 2 == 0 { swatch_gradient(i) } else { two(Color::gray(shade(i, swatches)), Color::rgb(0.0, 1.0, 0.0)) };
paints.push(gradient_paint(g, None, Some(&format!("Ramp {i}"))));
}
// The reader wouldn't read an even-odd fill with the style, so the style isn't written.
let unstyled = two(Color::WHITE, Color::BLACK);
let ap = Appearance {
items: vec![AppearanceItem::Fill(FillLayer::new(gradient_paint(unstyled.clone(), None, None)))],
effects: vec![fx("stylize.dropShadow", serde_json::json!({}))],
contents_index: None,
};
let mut n = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(10.0, 10.0, 50.0, 40.0)), ap);
if let NodeKind::Path { rule, .. } = &mut n.kind {
*rule = FillRule::EvenOdd;
}
put(&mut doc, n);
paints.push(gradient_paint(unstyled, None, None));
let zero = |o: f32| ramp(GradientKind::Linear, &[(o, Color::rgb(0.2, 0.3, 0.4), 1.0, 0.5), (1.0, Color::BLACK, 1.0, 0.5)]);
paints.extend([gradient_paint(zero(0.0), None, None), gradient_paint(zero(-0.0), None, None)]);
for (i, p) in (0u16..).zip(paints) {
let (x, y) = (f64::from(i % 60) * 5.0, f64::from(i / 60 % 40) * 5.0);
let n = painted(&mut doc, shapes::rectangle(Rect::new(x, y, x + 4.0, y + 4.0)), vec![AppearanceItem::Fill(FillLayer::new(p))]);
put(&mut doc, n);
}
doc
}
/// Gradient and pattern definitions found through their indexes are those found by comparing each
/// in turn: the program is the same, byte for byte. A swatch's definition serves a paint linked to
/// it only with the swatch's gradient; a gradient defined for a style that isn't written leaves its
/// name free; gradients that differ only in the sign of a zero share a definition.
#[test]
fn indexed_definitions_write_the_same_program() {
let doc = many_gradients(300, 300, 7, 6);
let (indexed, scanned) = (program_scanned(&doc, false), program_scanned(&doc, true));
let differ = indexed.iter().zip(&scanned).position(|(a, b)| a != b);
assert!(indexed == scanned, "the programs differ from byte {differ:?} ({} and {} bytes)", indexed.len(), scanned.len());
let text = String::from_utf8(indexed).unwrap();
let names: Vec<&str> = text.lines().filter_map(|l| l.strip_prefix("%AI5_BeginGradient: ")).collect();
// `gradients_and_patterns`'s 5, then 300 + 7 + 6 swatches' + 3 others linked to swatches + 1
// after the style + 1 for both signs of zero.
assert_eq!(names.len(), 5 + 300 + 7 + 6 + 3 + 1 + 1, "{names:?}");
assert_eq!(names.iter().collect::<std::collections::HashSet<_>>().len(), names.len(), "{names:?}");
assert_eq!(text.matches("%AI3_BeginPattern: (Dots)").count(), 1);
}
/// A gradient paint is matched with the definitions of the same gradient, not with each
/// definition: 1,000 gradients of their own and 1,000 paints of 10 others take a few comparisons
/// each, where comparing each definition in turn takes hundreds of thousands.
#[test]
fn gradient_definitions_are_found_without_comparing_each() {
let doc = many_gradients(1000, 1000, 10, 0);
let comparisons = |scanned: bool| {
writer::GRADIENT_COMPARISONS.with(|c| c.set(0));
program_scanned(&doc, scanned);
writer::GRADIENT_COMPARISONS.with(std::cell::Cell::get)
};
let (indexed, scanned) = (comparisons(false), comparisons(true));
assert!(indexed <= 2 * 2010, "{indexed} comparisons through the index");
assert!(scanned > 100 * indexed, "{scanned} comparisons scanning, {indexed} through the index");
}
/// The time to write 5,000 rectangles with gradients of their own, 5,000 with 50 others and 20
/// gradient swatches, with the definitions found by comparing each in turn and through their
/// indexes: the median of 7 runs of each, alternating, with the programs compared. Run with
/// `cargo test --release -p vectorcraft-eps --lib -- --ignored --nocapture gradient_definitions_timing`.
#[test]
#[ignore = "timing"]
fn gradient_definitions_timing() {
let doc = many_gradients(5000, 5000, 50, 20);
let mut times = [vec![], vec![]];
let mut programs: [Option<Vec<u8>>; 2] = [None, None];
let mut how = "";
for _ in 0..7 {
for (k, scanned) in [true, false].into_iter().enumerate() {
let (start, h) = thread_time();
let program = program_scanned(&doc, scanned);
times[k].push(thread_time().0.saturating_sub(start));
how = h;
programs[k].get_or_insert(program);
}
}
assert_eq!(programs[0], programs[1]);
for t in &mut times {
t.sort();
}
let ms = |d: std::time::Duration| d.as_secs_f64() * 1000.0;
println!("median of 7 runs ({how}):");
println!("| definitions found | median (ms) | runs (ms) |");
println!("|---|---:|---|");
for (k, label) in ["by comparing each", "through the indexes"].into_iter().enumerate() {
let runs: Vec<String> = times[k].iter().map(|d| format!("{:.1}", ms(*d))).collect();
println!("| {label} | {:.1} | {} |", ms(times[k][3]), runs.join(", "));
}
}
/// A hard edge: a linear gradient whose stops all lie at one place is written from its last stop,
/// and reads back with each stop on its side.
#[test]
+6 -5
View File
@@ -45,7 +45,8 @@ pub(super) use images::PAYLOAD;
pub(super) use images::{IMAGE_DEPTH, IMAGES, LAST_SAMPLES_ONLY, LINKS_EMBEDDED, SAMPLE_LIMITS, SAMPLE_READS, SAMPLES_KEPT};
#[cfg(test)]
pub(super) use paints::{
GRADIENT_DITHER, GRADIENT_HUE, GRADIENT_PERCEPTUAL, GRADIENT_SHAPES, GRADIENTS, STOP_LINKS, SWATCH_PLACEMENT, free_gradient_name,
GRADIENT_COMPARISONS, GRADIENT_DITHER, GRADIENT_HUE, GRADIENT_PERCEPTUAL, GRADIENT_SHAPES, GRADIENTS, SCANNED_DEFINITIONS, STOP_LINKS,
SWATCH_PLACEMENT, free_gradient_name,
};
#[cfg(test)]
pub(super) use symbols::{MISSING_SYMBOL, SYMBOL_ART, SYMBOL_COUNT, SYMBOL_OPTIONS};
@@ -200,11 +201,11 @@ pub(super) struct Writer<'a> {
/// pattern's definition, the pattern's space turned y up.
canvas: Affine,
/// The gradient definitions, in the order they are first used.
gradients: Vec<paints::GradientDef>,
gradients: paints::GradientDefs,
/// The number the next new gradient definition's name tries first (1 is `Gradient`).
next_gradient: u64,
/// The pattern definitions written, each after those its art uses.
patterns: Vec<paints::PatternOut>,
patterns: paints::PatternDefs,
/// The patterns whose definitions are being written.
defining: Vec<String>,
/// Writing the palette: the definitions it adds are for its swatches only.
@@ -357,9 +358,9 @@ impl<'a> Writer<'a> {
grad_space: to_art,
tile_grad_space: Affine::translate((-origin.0, origin.1)),
canvas: Affine::new([1.0, 0.0, 0.0, -1.0, origin.0, origin.1]) * to_art,
gradients: vec![],
gradients: paints::GradientDefs::default(),
next_gradient: 1,
patterns: vec![],
patterns: paints::PatternDefs::default(),
defining: vec![],
in_palette: false,
canvas_origin: origin,
+234 -16
View File
@@ -1,7 +1,9 @@
//! Gradients and patterns: their definitions in the setup, gradient instances on paths and the
//! pattern operators (see [`crate::ai_editing`] for the form).
use std::collections::HashMap;
use std::fmt::Write;
use std::hash::{Hash, Hasher};
use vectorcraft_color::gradient::GradientGeom;
use vectorcraft_color::swatch::REGISTRATION;
@@ -46,6 +48,134 @@ pub(super) struct PatternOut {
used: bool,
}
#[cfg(test)]
thread_local! {
/// Whether [`GradientDefs`] and [`PatternDefs`] find definitions on this thread by comparing
/// the gradient or name with each definition in turn.
pub(in crate::ai_editing) static SCANNED_DEFINITIONS: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
/// How many times [`GradientDefs::find`] has compared two gradients on this thread.
pub(in crate::ai_editing) static GRADIENT_COMPARISONS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
}
/// Are gradients `a` and `b` the same?
fn same_gradient(a: &Gradient, b: &Gradient) -> bool {
#[cfg(test)]
GRADIENT_COMPARISONS.with(|c| c.set(c.get() + 1));
a == b
}
/// A key of `g` for [`GradientDefs`]: the same gradients have the same key (each number by its
/// bits, with -0 as 0); different gradients may share one.
fn gradient_key(g: &Gradient) -> u64 {
let bits = |x: f32| if x == 0.0 { 0 } else { x.to_bits() };
let mut h = std::hash::DefaultHasher::new();
std::mem::discriminant(&g.kind).hash(&mut h);
std::mem::discriminant(&g.method).hash(&mut h);
(g.dither, g.spread, g.repeats, g.stops.len()).hash(&mut h);
for s in &g.stops {
let (model, c) = match s.color {
Color::Rgb { r, g, b } => (0u8, [r, g, b, 0.0]),
Color::Cmyk { c, m, y, k } => (1, [c, m, y, k]),
Color::Gray { k } => (2, [k, 0.0, 0.0, 0.0]),
Color::Lab { l, a, b } => (3, [l, a, b, 0.0]),
};
(model, c.map(bits), [s.offset, s.opacity, s.midpoint, s.tint].map(bits)).hash(&mut h);
(&s.swatch, s.plates.map(|p| p.map(bits))).hash(&mut h);
}
h.finish()
}
/// The gradient definitions, in the order they are first used, found by name and by gradient
/// without comparing each one.
#[derive(Default)]
pub(super) struct GradientDefs {
list: Vec<GradientDef>,
/// Each definition's place in `list`, by its name (no two definitions share one).
names: HashMap<String, usize>,
/// The places in `list` of the definitions no swatch names, in order, by their gradient's key
/// ([`gradient_key`]).
ramps: HashMap<u64, Vec<usize>>,
}
impl GradientDefs {
/// Is `name` a definition's name?
fn has_name(&self, name: &str) -> bool {
#[cfg(test)]
if SCANNED_DEFINITIONS.with(std::cell::Cell::get) {
return self.list.iter().any(|d| d.name == name);
}
self.names.contains_key(name)
}
/// The place of the definition of `g`: the swatch `swatch` names when it is a gradient swatch
/// of the same gradient, else the first definition of the same gradient that no swatch names.
fn find(&self, g: &Gradient, swatch: Option<&str>) -> Option<usize> {
#[cfg(test)]
if SCANNED_DEFINITIONS.with(std::cell::Cell::get) {
return swatch
.and_then(|s| self.list.iter().position(|d| d.swatch && d.name == s && same_gradient(&d.gradient, g)))
.or_else(|| self.list.iter().position(|d| !d.swatch && same_gradient(&d.gradient, g)));
}
let held = |i: &usize, swatch: bool| self.list.get(*i).is_some_and(|d| d.swatch == swatch && same_gradient(&d.gradient, g));
swatch
.and_then(|s| self.names.get(s).copied().filter(|i| held(i, true)))
.or_else(|| self.ramps.get(&gradient_key(g))?.iter().copied().find(|i| held(i, false)))
}
/// Add `d`, whose name no definition has.
fn push(&mut self, d: GradientDef) {
let i = self.list.len();
if !d.swatch {
self.ramps.entry(gradient_key(&d.gradient)).or_default().push(i);
}
self.names.insert(d.name.clone(), i);
self.list.push(d);
}
/// Keep the first `len` definitions; the names of those removed are free again.
fn truncate(&mut self, len: usize) {
while self.list.len() > len {
let Some(d) = self.list.pop() else { break };
self.names.remove(&d.name);
if !d.swatch {
// Places are added in order, so the removed definition's is the last of its key's.
let key = gradient_key(&d.gradient);
if let Some(places) = self.ramps.get_mut(&key) {
places.pop();
if places.is_empty() {
self.ramps.remove(&key);
}
}
}
}
}
}
/// The pattern definitions written, each after those its art uses, found by name.
#[derive(Default)]
pub(super) struct PatternDefs {
list: Vec<PatternOut>,
/// Each definition's place in `list`, by its name (no two definitions share one).
names: HashMap<String, usize>,
}
impl PatternDefs {
/// The place of pattern `name`'s definition.
fn find(&self, name: &str) -> Option<usize> {
#[cfg(test)]
if SCANNED_DEFINITIONS.with(std::cell::Cell::get) {
return self.list.iter().position(|p| p.name == name);
}
self.names.get(name).copied()
}
/// Add `p`, whose name no definition has.
fn push(&mut self, p: PatternOut) {
self.names.insert(p.name.clone(), self.list.len());
self.list.push(p);
}
}
pub(in crate::ai_editing) const DIAMOND: &str =
"diamond gradients are written as radial gradients through their corners, with the same stops, in the editing data for other apps";
pub(in crate::ai_editing) const SPREAD: &str = "gradients that repeat or reflect are written with their stops repeated across the shape (at most 256 stops, padding past them) in the editing data for other apps";
@@ -118,7 +248,7 @@ impl Writer<'_> {
&& let stops = curve_as_stops(&g.gradient)
&& let gradient = stops.unrolled_within(crate::import::MAX_GRADIENT_STOPS)
&& writable_gradient(&gradient)
&& !self.gradients.iter().any(|d| d.name == sw.name)
&& !self.gradients.has_name(&sw.name)
{
self.gradients.push(GradientDef { name: sw.name.clone(), gradient: gradient.into_owned(), swatch: true, used: false });
}
@@ -131,17 +261,14 @@ impl Writer<'_> {
/// swatch or a pattern).
fn define_gradient(&mut self, g: &Gradient, swatch: Option<&str>) -> String {
let used = !self.in_palette;
let found = swatch
.and_then(|s| self.gradients.iter().position(|d| d.swatch && d.name == s && d.gradient == *g))
.or_else(|| self.gradients.iter().position(|d| !d.swatch && d.gradient == *g));
if let Some(d) = found.and_then(|i| self.gradients.get_mut(i)) {
let found = self.gradients.find(g, swatch);
if let Some(d) = found.and_then(|i| self.gradients.list.get_mut(i)) {
d.used |= used;
return d.name.clone();
}
let (doc, gradients) = (self.doc, &self.gradients);
let name = free_gradient_name(&mut self.next_gradient, |name| {
gradients.iter().any(|d| d.name == name) || doc.swatch(name).is_some() || doc.pattern(name).is_some()
});
let name =
free_gradient_name(&mut self.next_gradient, |name| gradients.has_name(name) || doc.swatch(name).is_some() || doc.pattern(name).is_some());
self.gradients.push(GradientDef { name: name.clone(), gradient: g.clone(), swatch: false, used });
name
}
@@ -149,14 +276,14 @@ impl Writer<'_> {
/// The gradient definitions' state, for [`Self::gradient_rollback`]: their count, which ones the
/// art uses, and the next name's number.
pub(super) fn gradient_mark(&self) -> (usize, Vec<bool>, u64) {
(self.gradients.len(), self.gradients.iter().map(|d| d.used).collect(), self.next_gradient)
(self.gradients.list.len(), self.gradients.list.iter().map(|d| d.used).collect(), self.next_gradient)
}
/// The gradient definitions as they were at `mark` ([`Self::gradient_mark`]).
pub(super) fn gradient_rollback(&mut self, mark: (usize, Vec<bool>, u64)) {
let (len, used, next) = mark;
self.gradients.truncate(len);
for (d, u) in self.gradients.iter_mut().zip(used) {
for (d, u) in self.gradients.list.iter_mut().zip(used) {
d.used = u;
}
self.next_gradient = next;
@@ -476,7 +603,7 @@ impl Writer<'_> {
if !self.defining.is_empty() || self.nest >= MAX_NEST || self.in_symbol {
return false;
}
if self.patterns.iter().any(|p| p.name == name) {
if self.patterns.find(name).is_some() {
return true;
}
self.doc.pattern(name).is_some_and(tile_holds_art)
@@ -492,7 +619,7 @@ impl Writer<'_> {
return false;
}
let used = !self.in_palette;
if let Some(p) = self.patterns.iter_mut().find(|p| p.name == name) {
if let Some(p) = self.patterns.find(name).and_then(|i| self.patterns.list.get_mut(i)) {
p.used |= used;
return true;
}
@@ -582,7 +709,7 @@ impl Writer<'_> {
/// uses).
pub(in crate::ai_editing) fn definitions(&mut self, s: &mut String) {
let defs = std::mem::take(&mut self.gradients);
let (used, unused): (Vec<&GradientDef>, Vec<&GradientDef>) = defs.iter().partition(|d| d.used);
let (used, unused): (Vec<&GradientDef>, Vec<&GradientDef>) = defs.list.iter().partition(|d| d.used);
let _ = writeln!(s, "{} Bn", used.len());
for d in &used {
self.gradient_def(s, d);
@@ -595,12 +722,12 @@ impl Writer<'_> {
s.push_str("%AI5_End_NonPrinting--\n");
}
self.gradients = defs;
for p in self.patterns.iter().filter(|p| p.used) {
for p in self.patterns.list.iter().filter(|p| p.used) {
s.push_str(&p.text);
}
if self.patterns.iter().any(|p| !p.used) {
if self.patterns.list.iter().any(|p| !p.used) {
s.push_str("%AI5_Begin_NonPrinting\nNp\n");
for p in self.patterns.iter().filter(|p| !p.used) {
for p in self.patterns.list.iter().filter(|p| !p.used) {
s.push_str(&p.text);
}
s.push_str("%AI5_End_NonPrinting--\n");
@@ -729,3 +856,94 @@ fn tile_holds_art(def: &PatternDef) -> bool {
b.x0 >= room.x0 && b.y0 >= room.y0 && b.x1 <= room.x1 && b.y1 <= room.y1
})
}
#[cfg(test)]
mod tests {
use super::*;
fn two(a: f32, b: Color) -> Gradient {
Gradient::new(GradientKind::Linear, vec![GradientStop::new(a, Color::rgb(0.2, 0.4, 0.6)), GradientStop::new(1.0, b)])
}
fn def(name: &str, gradient: Gradient, swatch: bool) -> GradientDef {
GradientDef { name: name.into(), gradient, swatch, used: true }
}
/// The same gradients have the same key, a zero of either sign included.
#[test]
fn a_zero_of_either_sign_gives_the_same_key() {
assert_eq!(gradient_key(&two(0.0, Color::BLACK)), gradient_key(&two(-0.0, Color::BLACK)));
assert_eq!(two(0.0, Color::BLACK), two(-0.0, Color::BLACK));
assert_ne!(gradient_key(&two(0.0, Color::BLACK)), gradient_key(&two(0.0, Color::WHITE)));
}
/// Definitions whose gradients share a key are told apart by their gradients, the first of the
/// same gradient found; a gradient that isn't equal to itself is found in none.
#[test]
fn definitions_that_share_a_key_are_told_apart() {
let (black, white) = (two(0.0, Color::BLACK), two(0.0, Color::WHITE));
let mut defs = GradientDefs::default();
defs.push(def("Gradient", white.clone(), false));
defs.push(def("Gradient 2", black.clone(), false));
defs.push(def("Gradient 3", black.clone(), false));
// Every definition under the black gradient's key, as if the keys of both were the same.
defs.ramps = HashMap::from([(gradient_key(&black), vec![0, 1, 2])]);
assert_eq!(defs.find(&black, None), Some(1));
assert_eq!(defs.find(&white, None), None);
defs.ramps.insert(gradient_key(&white), vec![0, 1, 2]);
assert_eq!(defs.find(&white, None), Some(0));
let nan = two(f32::NAN, Color::BLACK);
defs.push(def("Gradient 4", nan.clone(), false));
assert_eq!(defs.find(&nan, None), None);
}
/// A swatch's definition is found by the swatch's name and gradient; a definition that no
/// swatch names, for the same gradient without the name or with another.
#[test]
fn a_swatch_definition_is_found_by_its_name_and_gradient() {
let (black, white) = (two(0.0, Color::BLACK), two(0.0, Color::WHITE));
let mut defs = GradientDefs::default();
defs.push(def("Ramp", black.clone(), true));
assert_eq!(defs.find(&black, Some("Ramp")), Some(0));
assert_eq!(defs.find(&black, None), None);
assert_eq!(defs.find(&white, Some("Ramp")), None);
defs.push(def("Gradient", black.clone(), false));
defs.push(def("Gradient 2", white.clone(), false));
assert_eq!(defs.find(&black, Some("Ramp")), Some(0));
assert_eq!(defs.find(&black, None), Some(1));
assert_eq!(defs.find(&white, Some("Ramp")), Some(2));
assert_eq!(defs.find(&black, Some("Other")), Some(1));
}
/// Definitions removed leave their names free and are no longer found; those kept still are.
#[test]
fn removed_definitions_free_their_names() {
let (black, white) = (two(0.0, Color::BLACK), two(0.0, Color::WHITE));
let mut defs = GradientDefs::default();
defs.push(def("Ramp", white.clone(), true));
defs.push(def("Gradient", black.clone(), false));
defs.push(def("Gradient 2", white.clone(), false));
defs.push(def("Gradient 3", black.clone(), false));
defs.truncate(2);
assert!(defs.has_name("Ramp") && defs.has_name("Gradient"));
assert!(!defs.has_name("Gradient 2") && !defs.has_name("Gradient 3"));
assert_eq!(defs.find(&black, None), Some(1));
assert_eq!(defs.find(&white, None), None);
assert_eq!(defs.ramps.values().map(Vec::len).sum::<usize>(), 1);
defs.push(def("Gradient 2", white.clone(), false));
assert_eq!(defs.find(&white, None), Some(2));
defs.truncate(0);
assert!(defs.list.is_empty() && defs.names.is_empty() && defs.ramps.is_empty());
}
/// A pattern's definition is found by its name.
#[test]
fn pattern_definitions_are_found_by_name() {
let mut defs = PatternDefs::default();
assert_eq!(defs.find("Dots"), None);
for name in ["Dots", "Checks"] {
defs.push(PatternOut { name: name.into(), text: String::new(), used: false });
}
assert_eq!((defs.find("Dots"), defs.find("Checks"), defs.find("Stripes")), (Some(0), Some(1), None));
}
}
+27
View File
@@ -1636,6 +1636,33 @@ fn doc_json(s: &mut Server) -> Value {
serde_json::from_str(&text_of(&r)).unwrap()
}
#[test]
fn transform_refused_by_a_later_operation_changes_nothing() {
let mut s = server();
let count = |s: &mut Server| -> u64 {
let r = call(s, 90, "inspect_document", json!({}));
serde_json::from_str::<Value>(&text_of(&r)).unwrap()["objects"].as_u64().unwrap()
};
let base = count(&mut s);
let r = id_of(&call(&mut s, 1, "draw_shape", json!({"shape": "rectangle", "x": 100, "y": 100, "width": 100, "height": 50})));
let before = doc_json(&mut s);
for (id, args, says) in [
(2, json!({"ids": [r], "scale": 50, "shear": 90}), "object.shear"),
(3, json!({"ids": [r], "dx": 10, "rotate": 30, "shear": -270}), "object.shear"),
(4, json!({"ids": [r], "scale": 50, "shear": 400}), "object.shear"),
(5, json!({"ids": [r], "scale": 50, "reflect": "diagonal"}), "object.reflect"),
(6, json!({"ids": [r], "dx": 10, "rotate": 30, "scaleX": 0}), "object.scale"),
] {
let t = call(&mut s, id, "transform", args.clone());
assert_eq!(t["isError"], true, "{args}: {t}");
assert!(text_of(&t).contains(says), "{args}: {t}");
assert_eq!(doc_json(&mut s), before, "{args}");
}
// No undo step was recorded: one undo removes the rectangle.
assert_eq!(call(&mut s, 7, "undo", json!({}))["isError"], false);
assert_eq!(count(&mut s), base, "one undo removes the rectangle");
}
#[test]
fn add_text_rejects_invalid_path_effects_before_editing() {
let mut s = server();
+1 -1
View File
@@ -466,7 +466,7 @@ pub fn tool_definitions() -> Vec<Value> {
tool(
"transform",
"Transform",
"Move, rotate, scale, reflect or shear the selection (or `ids`); several may be combined and run in that order. Angles in degrees (counter-clockwise), scale in %. Scale and reflect act along the selection's bounding box, turned with rotated objects until Reset Bounding Box. `origin` [x,y] defaults to the selection centre; `copy` transforms a copy.",
"Move, rotate, scale, reflect or shear the selection (or `ids`); several may be combined and run in that order. Angles in degrees (counter-clockwise), scale in %. Scale and reflect act along the selection's bounding box, turned with rotated objects until Reset Bounding Box. `origin` [x,y] defaults to the selection centre; `copy` transforms a copy. A scale, reflect or shear its command refuses returns that error before any step runs, and nothing changes.",
obj(
json!({
"ids": {"type": "array", "items": {"type": "integer"}},
+20 -4
View File
@@ -302,6 +302,24 @@ pub(super) fn add_text(b: &mut dyn Backend, a: &Args) -> Result<Value, String> {
}
pub(super) fn transform(b: &mut dyn Backend, a: &Args) -> Result<Value, String> {
// Each operation is its own command: check the params the later ones refuse before the first
// runs, so a refused request changes nothing.
fn bad(cmd: &'static str) -> impl Fn(String) -> String {
move |e| format!("invalid parameters for `{cmd}`: {e}")
}
let s = a.get("scale").and_then(Value::as_f64);
let (sx, sy) = (a.get("scaleX").and_then(Value::as_f64).or(s), a.get("scaleY").and_then(Value::as_f64).or(s));
if sx.is_some() || sy.is_some() {
vectorcraft_engine::cmd::scale_factors(sx.unwrap_or(100.0), sy.unwrap_or(100.0)).map_err(bad("object.scale"))?;
}
let reflect = a.get("reflect").and_then(Value::as_str);
if let Some(axis) = reflect {
vectorcraft_engine::cmd::reflect_axis(Some(&json!(axis))).map_err(bad("object.reflect"))?;
}
let shear = a.get("shear").and_then(Value::as_f64);
if let Some(sh) = shear {
vectorcraft_engine::cmd::shear_tangent(sh).map_err(bad("object.shear"))?;
}
select_ids(b, a)?;
// With `copy`, the first operation duplicates and the rest transform the copy (the new selection).
let copy = std::cell::Cell::new(a.get("copy").and_then(Value::as_bool).unwrap_or(false));
@@ -322,17 +340,15 @@ pub(super) fn transform(b: &mut dyn Backend, a: &Args) -> Result<Value, String>
exec(b, "object.rotate", with(json!({"angle": r})))?;
done.push("rotate");
}
let s = a.get("scale").and_then(Value::as_f64);
let (sx, sy) = (a.get("scaleX").and_then(Value::as_f64).or(s), a.get("scaleY").and_then(Value::as_f64).or(s));
if sx.is_some() || sy.is_some() {
exec(b, "object.scale", with(json!({"sx": sx.unwrap_or(100.0), "sy": sy.unwrap_or(100.0)})))?;
done.push("scale");
}
if let Some(axis) = a.get("reflect").and_then(Value::as_str) {
if let Some(axis) = reflect {
exec(b, "object.reflect", with(json!({"axis": axis})))?;
done.push("reflect");
}
if let Some(sh) = a.get("shear").and_then(Value::as_f64) {
if let Some(sh) = shear {
exec(b, "object.shear", with(json!({"angle": sh})))?;
done.push("shear");
}
+7 -3
View File
@@ -64,8 +64,8 @@ pub(crate) struct Sheet<'a> {
impl Writer {
/// A PDF with `set`'s version, standard, compression and colour output, and `doc`'s metadata
/// under `title`, created at `created` (Unix seconds). With `cmyk`, transparency blends in
/// CMYK (unless the colours are converted to RGB).
/// and language under `title`, created at `created` (Unix seconds). With `cmyk`, transparency
/// blends in CMYK (unless the colours are converted to RGB).
pub(crate) fn new(doc: &Document, set: &crate::PdfSettings, title: &str, created: Option<i64>, cmyk: bool) -> Result<Self, PdfError> {
let out = ColorOut::new(doc, set)?;
let mut warnings = out.profile_notes.clone();
@@ -111,7 +111,11 @@ impl Writer {
created: created.map(date_time),
modified: None,
};
let pdf = write::Writer::new(settings, metadata);
// The document language (Document Setup) as the catalog's `Lang` and the XMP packet's
// `dc:language` (ISO 32000-1, 14.9.2): its BCP 47 tag. A language without a tag writes
// none rather than a guess.
let language = vectorcraft_doc::setup::language_tag(&doc.setup.language).map(str::to_string);
let pdf = write::Writer::new_with_language(settings, metadata, language);
Ok(Self {
pdf,
cmyk: out.blends_cmyk(cmyk),
+35
View File
@@ -1449,6 +1449,41 @@ fn empty_and_populated_file_info_preserve_key_presence() {
assert!(s.contains("/ViewerPreferences<</DisplayDocTitle true>>"), "viewers should show the document title (#3646)");
}
/// The text of the `/Lang` entry of the catalog of `pdf` (a literal string), if any.
fn catalog_lang(pdf: &[u8]) -> Option<String> {
let xref = crate::patch::Xref::read(pdf).expect("a cross-reference table");
let root = xref.trailer_ref(pdf, b"/Root").expect("a catalog");
let (start, end) = xref.dict(pdf, root).expect("the catalog's dictionary");
let catalog = String::from_utf8_lossy(&pdf[start..end]).into_owned();
let at = catalog.find("/Lang")? + "/Lang".len();
let rest = catalog[at..].trim_start().strip_prefix('(').expect("a literal string");
Some(rest[..rest.find(')').expect("a closed string")].to_string())
}
/// The catalog gives the document language chosen in Document Setup as its BCP 47 tag, in
/// exported and printed PDFs, and the XMP packet says it too (#3644).
#[test]
fn the_catalog_gives_the_document_language() {
let mut d = doc(100.0, 100.0);
for (language, tag) in [(None, "en-US"), (Some("French"), "fr"), (Some("German: Swiss"), "de-CH")] {
if let Some(language) = language {
d.setup.language = language.into();
}
for opts in [PdfOptions::uncompressed(), PdfOptions::default()] {
let bytes = export(&d, &opts).unwrap();
assert_eq!(catalog_lang(&bytes).as_deref(), Some(tag), "{language:?}");
}
// Print to PDF writes its file with the same writer.
let printed = print(&d, &PrintOptions { created: Some(1_700_000_000), ..Default::default() }).unwrap();
assert_eq!(catalog_lang(&printed.bytes).as_deref(), Some(tag), "{language:?}: printed");
let s = uncompressed(&d);
assert!(s.contains(&format!("<dc:language><rdf:Bag><rdf:li>{tag}</rdf:li></rdf:Bag></dc:language>")), "{language:?}: {s}");
}
// A language without a tag (from a file) writes none rather than a guess.
d.setup.language = "Klingon".into();
assert_eq!(catalog_lang(&export(&d, &PdfOptions::uncompressed()).unwrap()), None);
}
/// A function or colour space built on itself is refused before the interpreter builds it (by
/// recursion, with no cap: a stack overflow), and those of real files are read.
#[test]
+1 -1
View File
@@ -53,7 +53,7 @@ pub mod wat;
pub use dialog::ParamUi;
pub use host::{LogLevel, LogLine, Report};
pub use manifest::{Budget, Command, InputKind, Kind, Manifest, Param, ParamSpec};
pub use runtime::{ABI_VERSION, HEAVY_FUEL, HEAVY_WALL_TIME_MS, Limits, Plugin, heavy_terms};
pub use runtime::{ABI_VERSION, HEAVY_FUEL, HEAVY_WALL_TIME_MS, LARGE_FUEL, Limits, Plugin, heavy_terms};
#[doc(hidden)]
pub use runtime::{BYTES_COPIED_PER_FUEL, FUEL_SLICE};
+11
View File
@@ -35,6 +35,11 @@ pub const HEAVY_FUEL: u64 = 1_000_000_000;
/// Wall-clock budget of a heavy filter's run, in milliseconds.
pub const HEAVY_WALL_TIME_MS: u64 = 300_000;
/// Instructions a filter's run may use besides [`Limits::fuel_per_byte`] for each byte of input
/// when Preferences › Plug-ins & Scratch Disks › Plug-in Instruction Budget is Large
/// ([`Plugin::large_limits`]): 5 times the default.
pub const LARGE_FUEL: u64 = 250_000_000;
/// The limit a run reports when its input and parameters together are past half its memory.
pub(crate) const SELECTION_TOO_LARGE: &str = "memory budget (the selection is too large to hand over)";
@@ -215,6 +220,12 @@ impl Plugin {
pub fn limits(&self) -> &Limits {
&self.limits
}
/// Its limits with the Large instruction budget: at least [`LARGE_FUEL`] instructions besides
/// those for each byte of input, and every other limit, the time budget included, as it is. A
/// heavy filter keeps its larger budget.
pub fn large_limits(&self) -> Limits {
Limits { fuel_base: self.limits.fuel_base.max(LARGE_FUEL), ..self.limits.clone() }
}
/// Module size in bytes.
pub fn size(&self) -> usize {
self.size
+18 -1
View File
@@ -7,7 +7,7 @@ use std::time::{Duration, Instant};
use serde_json::{Value, json};
use vectorcraft_plugins::storage::{Meter, Storage, StorageError};
use vectorcraft_plugins::{Error, HEAVY_FUEL, HEAVY_WALL_TIME_MS, Kind, Limits, Plugin, Report, heavy_terms, registry, wat as tpl};
use vectorcraft_plugins::{Error, HEAVY_FUEL, HEAVY_WALL_TIME_MS, Kind, LARGE_FUEL, Limits, Plugin, Report, heavy_terms, registry, wat as tpl};
/// The example Desaturate plug-in, built from `crates/plugins/example`.
const DESATURATE: &[u8] = include_bytes!("fixtures/desaturate.wasm");
@@ -259,6 +259,23 @@ fn a_heavy_filter_finishes_what_a_light_one_cannot() {
assert_eq!(p.run(INPUT.as_bytes(), b"{}").unwrap(), INPUT.as_bytes());
}
/// The Large instruction budget gives a light filter 5 times the instructions besides those for
/// each byte of input, so it finishes 20 million steps of a loop that its own budget can't, in the
/// same time budget. A heavy filter keeps its larger budget, and every other limit stays.
#[test]
fn the_large_budget_finishes_what_a_light_one_cannot_and_keeps_a_heavy_one() {
let light = Plugin::load(&build(&tpl::spinning(MANIFEST, 20_000_000, INPUT)), Limits::default()).unwrap();
assert_eq!(light.run(INPUT.as_bytes(), b"{}"), Err(Error::Limit("instruction budget".into())));
let large = light.large_limits();
assert_eq!(large, Limits { fuel_base: LARGE_FUEL, ..Limits::default() });
assert_eq!(LARGE_FUEL, 5 * Limits::default().fuel_base);
assert_eq!(light.run_limited(INPUT.as_bytes(), b"{}", &large).unwrap(), INPUT.as_bytes());
let heavy = r#"{"id":"test.heavy","name":"Heavy","version":"1","kind":"filter","budget":"heavy"}"#;
let heavy = Plugin::load(&build(&tpl::spinning(heavy, 1, INPUT)), Limits::default()).unwrap();
assert_eq!(heavy.large_limits(), *heavy.limits());
assert_eq!((heavy.large_limits().fuel_base, heavy.large_limits().wall_time_ms), (HEAVY_FUEL, HEAVY_WALL_TIME_MS));
}
#[test]
fn an_exporter_returns_its_file_with_an_export_s_budget() {
use vectorcraft_plugins::export::{self, Target};
+82 -3
View File
@@ -4,7 +4,7 @@ use super::DialogSpec;
use crate::{VectorcraftApp, state::Dialog, theme::Tokens, widgets};
use egui::{RichText, Ui};
use serde_json::{Value, json};
use vectorcraft_doc::dimension::DimensionOptions;
use vectorcraft_doc::dimension::{ArrowStyle, DimensionOptions};
pub const KIND: &str = "dimensionOptions";
pub(super) const SPEC: DialogSpec = DialogSpec {
@@ -32,6 +32,10 @@ const UNITS: Choices = &[
];
const LINE_TYPES: Choices = &[("solid", "Solid"), ("dashed", "Dashed"), ("dotted", "Dotted")];
const ARROWS: Choices = &[("filled", "Filled"), ("open", "Open"), ("tick", "Tick"), ("none", "None")];
/// The style of each `ARROWS` entry, in the same order.
const ARROW_STYLES: [ArrowStyle; 4] = [ArrowStyle::Filled, ArrowStyle::Open, ArrowStyle::Tick, ArrowStyle::None];
/// The size of an Arrow Style preview: a line with the head at its right end.
const ARROW_PREVIEW: egui::Vec2 = egui::vec2(40.0, 16.0);
const POSITIONS: Choices = &[("away", "Away from the Line"), ("between", "Between Line and Object")];
const ALIGNMENTS: Choices = &[("left", "Left"), ("center", "Center"), ("right", "Right")];
@@ -69,6 +73,29 @@ fn choose(ui: &mut Ui, fields: &mut serde_json::Map<String, Value>, key: &str, l
});
changed
}
/// The Arrow Style dropdown: each style shows a drawn preview of its arrowhead before its name, in
/// the open list and in the closed field.
fn arrow_style(ui: &mut Ui, fields: &mut serde_json::Map<String, Value>, id: &str) -> bool {
const KEY: &str = "arrowStyle";
let mut changed = false;
widgets::label_row(ui, tl!("Arrow Style:"), 96.0, |ui| {
let current = fields.get(KEY).and_then(Value::as_str).unwrap_or_default();
let shown = ARROWS.iter().position(|(v, _)| *v == current);
let names: Vec<&str> = ARROWS.iter().map(|(_, s)| tl!(*s)).collect();
let icon = |ui: &Ui, rect: egui::Rect, i: usize, ink: egui::Color32, _: bool| {
if let Some(style) = ARROW_STYLES.get(i) {
crate::panels::stroke::paint_arrow(ui, rect, style.arrowhead().as_ref(), false, ink);
}
};
if let Some((value, _)) =
widgets::dropdown_icon_names_sized(ui, ("dimension", id), shown, &names, 150.0, ARROW_PREVIEW, icon).and_then(|i| ARROWS.get(i))
{
fields.insert(KEY.into(), json!(value));
changed = true;
}
});
changed
}
fn number(ui: &mut Ui, fields: &mut serde_json::Map<String, Value>, key: &str, label: &str, range: (f64, f64), suffix: &str) -> bool {
let mut changed = false;
widgets::label_row(ui, tl!(label), 96.0, |ui| {
@@ -160,7 +187,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool {
color(ui, f, "lineColor");
});
ui.horizontal(|ui| {
choose(ui, f, "arrowStyle", "Arrow Style:", ARROWS);
arrow_style(ui, f, "arrowStyle");
number(ui, f, "arrowScale", "Arrow Scale:", (1.0, 1000.0), "%");
});
});
@@ -310,7 +337,7 @@ pub fn properties_section(app: &mut VectorcraftApp, ui: &mut Ui) {
changed |= number(ui, &mut f, "lineWeight", "Line Weight:", (0.1, 100.0), "pt");
changed |= color(ui, &mut f, "lineColor");
});
ui.horizontal(|ui| changed |= choose(ui, &mut f, "arrowStyle", "Arrow Style:", ARROWS));
ui.horizontal(|ui| changed |= arrow_style(ui, &mut f, "props-arrowStyle"));
ui.horizontal(|ui| {
changed |= number(ui, &mut f, "fontSize", "Font Size:", (1.0, 1000.0), "pt");
changed |= color(ui, &mut f, "textColor");
@@ -377,4 +404,56 @@ mod tests {
assert!(text.contains(label), "{label}: {text}");
}
}
/// Whether a frame drew a picture (a textured mesh) just before the text `name` on its line.
fn picture_before(out: &egui::FullOutput, name: &str) -> bool {
fn collect(s: &egui::Shape, texts: &mut Vec<(String, egui::Rect)>, pictures: &mut Vec<egui::Rect>) {
match s {
egui::Shape::Text(t) => texts.push((t.galley.text().to_owned(), t.visual_bounding_rect())),
egui::Shape::Mesh(m) if m.texture_id != egui::TextureId::default() => pictures.push(m.calc_bounds()),
egui::Shape::Vec(v) => v.iter().for_each(|s| collect(s, texts, pictures)),
_ => {}
}
}
let (mut texts, mut pictures) = (vec![], vec![]);
for c in &out.shapes {
collect(&c.shape, &mut texts, &mut pictures);
}
texts
.iter()
.filter(|(t, _)| t == name)
.any(|(_, r)| pictures.iter().any(|p| p.max.x <= r.min.x + 1.0 && r.min.x - p.max.x < 16.0 && p.min.y < r.max.y && p.max.y > r.min.y))
}
/// The frame `f` draws, once its previews are loaded.
fn frame(app: &mut VectorcraftApp, mut f: impl FnMut(&mut VectorcraftApp, &mut Ui)) -> egui::FullOutput {
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
ctx.run_ui(egui::RawInput::default(), |ui| f(app, ui)).textures_delta.clear();
ctx.run_ui(egui::RawInput::default(), |ui| f(app, ui))
}
/// The Arrow Style field of the Tool Options and of Properties shows the style's arrowhead,
/// drawn, before its name (#8049).
#[test]
fn arrow_style_shows_a_drawn_arrowhead() {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
app.run("tool.options", json!({"tool":"dimension"})).unwrap();
let out = frame(&mut app, |app, ui| super::super::show(app, ui.ctx()));
assert!(picture_before(&out, "Filled"), "Tool Options");
app.ui.dialog = None;
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
app.run("dimension.create", json!({"a":[10,10],"b":[110,10],"options":{"arrowStyle":"tick"}})).unwrap();
let out = frame(&mut app, properties_section);
assert!(picture_before(&out, "Tick"), "Properties");
}
/// Each Arrow Style entry previews the style its value names.
#[test]
fn arrow_previews_follow_the_listed_styles() {
assert_eq!(ARROWS.len(), ARROW_STYLES.len());
for ((value, _), style) in ARROWS.iter().zip(ARROW_STYLES) {
assert_eq!(serde_json::to_value(style).unwrap(), json!(value));
}
}
}
+5
View File
@@ -640,6 +640,11 @@ pub fn tr_ctx<'a>(lang: Lang, context: &str, s: &'a str) -> &'a str {
lang.catalog().contextual(context, s).unwrap_or_else(|| tr(lang, s))
}
/// The translation of `s` in `lang`'s `context` rows alone, or `None` when it has no such row.
pub fn tr_ctx_row(lang: Lang, context: &str, s: &str) -> Option<&'static str> {
lang.catalog().contextual(context, s)
}
/// A name the app gives something (a default swatch's), translated where the current language has
/// a `context` row for it; any other name (one the user gave) comes back as it is.
pub fn t_name<'a>(context: &str, name: &'a str) -> &'a str {
+4
View File
@@ -127,6 +127,7 @@
Add to Swatches Добавяне към образци
Add Used Colors Добавяне на използваните цветове
Additional Plug-ins Folder Допълнителна папка за плъгини
Plug-in Instruction Budget Бюджет на инструкции за плъгини
Additional Fonts Folder Допълнителна папка за шрифтове
Adjust Adjoining Width Points Регулиране на прилежащите точки за ширина
Incoming Входяща
@@ -3358,6 +3359,9 @@ digits Malayalam Малаялам
Search commands, tools, panels and effects… Търсене на команди, инструменти, панели и ефекти…
No commands match Няма съвпадащи команди
{pos} of {total}: {name} {pos} от {total}: {name}
No menu item Няма елемент в менюто
Toolbar Лента с инструменти
{toolbar}, in the {tool} group {toolbar}, в групата на {tool}
@plural {n} result|{n} results {n} резултат|{n} резултата
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} от {n} резултат. Продължете да пишете, за да ги стесните.|{shown} от {n} резултата. Продължете да пишете, за да ги стесните.
Recent Commands Последни команди
Can't render this file because it is too large.
+4
View File
@@ -3944,6 +3944,7 @@ theme Appearance Izgled
90° & 45° Angles Uglovi od 90° i 45°
90° Angles Uglovi od 90°
Additional Plug-ins Folder Dodatni folder dodataka
Plug-in Instruction Budget Budžet instrukcija za dodatke
Additional Fonts Folder Dodatni folder fontova
Alignment Guides Vodilice za poravnanje
Anchor Points, Handle, and Bounding Box Display Prikaz sidrenih tačaka, ručki i graničnog okvira
@@ -4479,6 +4480,9 @@ font-technology Variable Varijabilni
Search commands, tools, panels and effects… Pretraži naredbe, alate, panele i efekte…
No commands match Nijedna naredba se ne podudara
{pos} of {total}: {name} {pos} od {total}: {name}
No menu item Nema stavke menija
Toolbar Traka s alatima
{toolbar}, in the {tool} group {toolbar}, u grupi {tool}
@plural {n} result|{n} results {n} rezultat|{n} rezultata|{n} rezultata
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} od {n} rezultata. Nastavite kucati da ih suzite.|{shown} od {n} rezultata. Nastavite kucati da ih suzite.|{shown} od {n} rezultata. Nastavite kucati da ih suzite.
Recent Commands Nedavne naredbe
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -223,6 +223,7 @@
Add Used Colors Afegeix els colors utilitzats
Additional Fonts Folder Carpeta addicional de tipus de lletra
Additional Plug-ins Folder Carpeta addicional de complements
Plug-in Instruction Budget Pressupost d’instruccions dels complements
Adjust Adjoining Width Points Ajusta els punts d’amplada contigus
Incoming Entrant
Outgoing Sortint
@@ -4301,6 +4302,9 @@ digits Malayalam Malaiàlam
Search commands, tools, panels and effects… Cerca ordres, eines, panells i efectes…
No commands match Cap ordre coincideix
{pos} of {total}: {name} {pos} de {total}: {name}
No menu item Cap element de menú
Toolbar Barra d’eines
{toolbar}, in the {tool} group {toolbar}, al grup {tool}
@plural {n} result|{n} results {n} resultat|{n} resultats
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} de {n} resultat. Continueu escrivint per reduir-los.|{shown} de {n} resultats. Continueu escrivint per reduir-los.
Recent Commands Ordres recents
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -4048,6 +4048,7 @@ theme Appearance Motiv
90° & 45° Angles Úhly 90° a 45°
90° Angles Úhly 90°
Additional Plug-ins Folder Další složka zásuvných modulů
Plug-in Instruction Budget Rozpočet instrukcí zásuvných modulů
Additional Fonts Folder Další složka písem
Alignment Guides Vodítka zarovnání
Anchor Points, Handle, and Bounding Box Display Zobrazení kotevních bodů, úchytů a ohraničovacího rámečku
@@ -4587,6 +4588,9 @@ font-technology Variable Variabilní
Search commands, tools, panels and effects… Hledat příkazy, nástroje, panely a efekty…
No commands match Žádný příkaz neodpovídá
{pos} of {total}: {name} {pos} z {total}: {name}
No menu item Žádná položka nabídky
Toolbar Panel nástrojů
{toolbar}, in the {tool} group {toolbar}, ve skupině {tool}
@plural {n} result|{n} results {n} výsledek|{n} výsledky|{n} výsledků
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} z {n} výsledku. Pište dál a výsledky se zúží.|{shown} z {n} výsledků. Pište dál a výsledky se zúží.|{shown} z {n} výsledků. Pište dál a výsledky se zúží.
Recent Commands Nedávné příkazy
Can't render this file because it is too large.
+4
View File
@@ -6497,6 +6497,7 @@ theme Appearance Udseende
90° & 45° Angles 90° & 45°-vinkler
90° Angles 90°-vinkler
Additional Plug-ins Folder Yderligere mappe med plug-ins
Plug-in Instruction Budget Instruktionsbudget for plug-ins
Additional Fonts Folder Yderligere mappe med skrifttyper
Alignment Guides Justeringshjælpelinjer
Anchor Points, Handle, and Bounding Box Display Visning af ankerpunkter, håndtag og afgrænsningsboks
@@ -7011,6 +7012,9 @@ font-technology Variable Variable
Search commands, tools, panels and effects… Søg i kommandoer, værktøjer, paneler og effekter…
No commands match Ingen kommandoer passer
{pos} of {total}: {name} {pos} af {total}: {name}
No menu item Intet menupunkt
Toolbar Værktøjslinje
{toolbar}, in the {tool} group {toolbar}, i gruppen {tool}
@plural {n} result|{n} results {n} resultat|{n} resultater
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} af {n} resultat. Skriv videre for at indsnævre dem.|{shown} af {n} resultater. Skriv videre for at indsnævre dem.
Recent Commands Seneste kommandoer
Can't render this file because it is too large.
+6
View File
@@ -116,6 +116,7 @@
Add to Swatches Zu Farbfeldern hinzufügen
Add Used Colors Verwendete Farben hinzufügen
Additional Plug-ins Folder Zusätzlicher Plug-in-Ordner
Plug-in Instruction Budget Anweisungsbudget für Plug-ins
Additional Fonts Folder Zusätzlicher Schriftenordner
Adjust Adjoining Width Points Angrenzende Breitenpunkte anpassen
Incoming Eingehend
@@ -3436,6 +3437,11 @@ digits Malayalam Malayalam
Search commands, tools, panels and effects… Befehle, Werkzeuge, Bedienfelder und Effekte suchen…
No commands match Keine passenden Befehle
{pos} of {total}: {name} {pos} von {total}: {name}
No menu item Kein Menüeintrag
Toolbar Werkzeugleiste
{toolbar}, in the {tool} group {toolbar}, in der Gruppe „{tool}“
Tool Werkzeug
Command Befehl
@plural {n} result|{n} results {n} Ergebnis|{n} Ergebnisse
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} von {n} Ergebnis. Tippen Sie weiter, um sie einzugrenzen.|{shown} von {n} Ergebnissen. Tippen Sie weiter, um sie einzugrenzen.
Recent Commands Zuletzt verwendete Befehle
Can't render this file because it is too large.
+4
View File
@@ -121,6 +121,7 @@
Add to Swatches Προσθήκη στα δείγματα χρωμάτων
Add Used Colors Προσθήκη των χρησιμοποιημένων χρωμάτων
Additional Plug-ins Folder Πρόσθετος φάκελος επεκτάσεων
Plug-in Instruction Budget Προϋπολογισμός εντολών επεκτάσεων
Additional Fonts Folder Πρόσθετος φάκελος γραμματοσειρών
Adjust Adjoining Width Points Ρύθμιση γειτονικών σημείων πλάτους
Incoming Εισερχόμενο
@@ -4177,6 +4178,9 @@ digits Malayalam Μαλαγιάλαμ
Search commands, tools, panels and effects… Αναζήτηση εντολών, εργαλείων, πλαισίων και εφέ…
No commands match Καμία εντολή δεν ταιριάζει
{pos} of {total}: {name} {pos} από {total}: {name}
No menu item Χωρίς στοιχείο μενού
Toolbar Γραμμή εργαλείων
{toolbar}, in the {tool} group {toolbar}, στην ομάδα {tool}
@plural {n} result|{n} results {n} αποτέλεσμα|{n} αποτελέσματα
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} από {n} αποτέλεσμα. Συνεχίστε να πληκτρολογείτε για να τα περιορίσετε.|{shown} από {n} αποτελέσματα. Συνεχίστε να πληκτρολογείτε για να τα περιορίσετε.
Recent Commands Πρόσφατες εντολές
Can't render this file because it is too large.
+4
View File
@@ -141,6 +141,7 @@
Add to Swatches Agregar a muestras
Add Used Colors Agregar colores usados
Additional Plug-ins Folder Carpeta de plugins adicionales
Plug-in Instruction Budget Presupuesto de instrucciones de plugins
Additional Fonts Folder Carpeta de fuentes adicionales
Adjust Adjoining Width Points Ajustar puntos de anchura contiguos
Incoming Entrante
@@ -3471,6 +3472,9 @@ digits Malayalam Malayálam
Search commands, tools, panels and effects… Buscar comandos, herramientas, paneles y efectos…
No commands match Ningún comando coincide
{pos} of {total}: {name} {pos} de {total}: {name}
No menu item Sin elemento de menú
Toolbar Barra de herramientas
{toolbar}, in the {tool} group {toolbar}, en el grupo {tool}
@plural {n} result|{n} results {n} resultado|{n} resultados
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} de {n} resultado. Sigue escribiendo para acotarlos.|{shown} de {n} resultados. Sigue escribiendo para acotarlos.
Recent Commands Comandos recientes
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -3984,6 +3984,7 @@ theme Appearance Ulkoasu
90° & 45° Angles 90° ja 45° kulmat
90° Angles 90° kulmat
Additional Plug-ins Folder Lisälaajennusten kansio
Plug-in Instruction Budget Laajennusten käskybudjetti
Additional Fonts Folder Lisäfonttien kansio
Alignment Guides Tasausapuviivat
Anchor Points, Handle, and Bounding Box Display Ankkuripisteiden, kahvojen ja rajausruudun näyttö
@@ -4502,6 +4503,9 @@ font-technology Variable Muuttuvat
Search commands, tools, panels and effects… Hae komentoja, työkaluja, paneeleita ja tehosteita…
No commands match Mikään komento ei vastaa hakua
{pos} of {total}: {name} {pos}/{total}: {name}
No menu item Ei valikkokohdetta
Toolbar Työkalurivi
{toolbar}, in the {tool} group {toolbar}, ryhmässä {tool}
@plural {n} result|{n} results {n} tulos|{n} tulosta
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown}/{n} tulosta. Kirjoita lisää rajataksesi tuloksia.|{shown}/{n} tulosta. Kirjoita lisää rajataksesi tuloksia.
Recent Commands Viimeisimmät komennot
Can't render this file because it contains an unexpected character in line 2 and column 73.
+4
View File
@@ -142,6 +142,7 @@
Add to Swatches Ajouter au nuancier
Add Used Colors Ajouter les couleurs utilisées
Additional Plug-ins Folder Dossier de modules externes supplémentaires
Plug-in Instruction Budget Budget d’instructions des modules externes
Additional Fonts Folder Dossier de polices supplémentaires
Adjust Adjoining Width Points Ajuster les points de largeur adjacents
Incoming Entrant
@@ -3459,6 +3460,9 @@ digits Malayalam Malayalam
Search commands, tools, panels and effects… Chercher commandes, outils, panneaux et effets…
No commands match Aucune commande ne correspond
{pos} of {total}: {name} {pos} sur {total} : {name}
No menu item Aucun élément de menu
Toolbar Barre d’outils
{toolbar}, in the {tool} group {toolbar}, dans le groupe {tool}
@plural {n} result|{n} results {n} résultat|{n} résultats
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} sur {n} résultat. Continuez à taper pour les affiner.|{shown} sur {n} résultats. Continuez à taper pour les affiner.
Recent Commands Commandes récentes
Can't render this file because it is too large.
+7
View File
@@ -164,6 +164,7 @@
Add to the Current Shortcuts વર્તમાન શૉર્ટકટમાં ઉમેરો
Additional Fonts Folder વધારાનું ફોન્ટ ફોલ્ડર
Additional Plug-ins Folder વધારાનું પ્લગ-ઇન ફોલ્ડર
Plug-in Instruction Budget પ્લગ-ઇન સૂચના બજેટ
Adjust Adjoining Width Points અડીને આવેલા પહોળાઈ બિંદુઓ ગોઠવો
Incoming આવતી બાજુ
Outgoing જતી બાજુ
@@ -3568,6 +3569,12 @@
Search commands, tools, panels and effects… આદેશો, ટૂલ્સ, પેનલ્સ અને ઇફેક્ટ્સ શોધો…
No commands match કોઈ આદેશ મેળ ખાતો નથી
{pos} of {total}: {name} {total} માંથી {pos}: {name}
No menu item કોઈ મેનૂ આઇટમ નથી
Toolbar ટૂલબાર
{toolbar}, in the {tool} group {toolbar}, {tool} જૂથમાં
Tool ટૂલ
Command કમાન્ડ
Panel પેનલ
@plural {n} result|{n} results {n} પરિણામ|{n} પરિણામો
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} માંથી {shown} પરિણામ. તેમને સંકુચિત કરવા લખતા રહો.|{n} માંથી {shown} પરિણામો. તેમને સંકુચિત કરવા લખતા રહો.
Recent Commands તાજેતરના આદેશો
Can't render this file because it contains an unexpected character in line 72 and column 5.
+4
View File
@@ -257,6 +257,7 @@
Add Used Colors उपयोग किए रंग जोड़ें
Additional Fonts Folder अतिरिक्त फ़ॉन्ट फ़ोल्डर
Additional Plug-ins Folder अतिरिक्त प्लग-इन फ़ोल्डर
Plug-in Instruction Budget प्लग-इन निर्देश बजट
Adjust Adjoining Width Points सटे हुए चौड़ाई पॉइंट समायोजित करें
Incoming आने वाली ओर
Outgoing जाने वाली ओर
@@ -4653,6 +4654,9 @@ antiAlias Sharp शार्प
Search commands, tools, panels and effects… आदेश, टूल, पैनल्स और इफ़ेक्ट्स खोजें…
No commands match कोई आदेश मेल नहीं खाता
{pos} of {total}: {name} {total} में से {pos}: {name}
No menu item कोई मेनू आइटम नहीं
Toolbar टूलबार
{toolbar}, in the {tool} group {toolbar}, {tool} समूह में
@plural {n} result|{n} results {n} परिणाम|{n} परिणाम
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} में से {shown} परिणाम। इन्हें सीमित करने के लिए लिखते रहें।|{n} में से {shown} परिणाम। इन्हें सीमित करने के लिए लिखते रहें।
Recent Commands हाल के आदेश
Can't render this file because it is too large.
+4
View File
@@ -211,6 +211,7 @@
Add Used Colors Használt színek hozzáadása
Additional Fonts Folder További betűtípusok mappája
Additional Plug-ins Folder További bővítmények mappája
Plug-in Instruction Budget Bővítmények utasításkerete
Adjust Adjoining Width Points Szomszédos szélességi pontok igazítása
Incoming Bejövő
Outgoing Kimenő
@@ -4094,6 +4095,9 @@ mark-style Japanese Japán
Search commands, tools, panels and effects… Parancsok, eszközök, panelek és effektusok keresése…
No commands match Nincs egyező parancs
{pos} of {total}: {name} {pos}/{total}: {name}
No menu item Nincs menüpont
Toolbar Eszköztár
{toolbar}, in the {tool} group {toolbar}, a(z) {tool} csoportjában
@plural {n} result|{n} results {n} találat
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} találatból {shown} látható. Gépeljen tovább a szűkítéshez.
Recent Commands Legutóbbi parancsok
Can't render this file because it is too large.
+4
View File
@@ -3715,6 +3715,7 @@ theme Appearance Tampilan
90° & 45° Angles Sudut 90° & 45°
90° Angles Sudut 90°
Additional Plug-ins Folder Folder plug-in tambahan
Plug-in Instruction Budget Anggaran instruksi plug-in
Additional Fonts Folder Folder font tambahan
Alignment Guides Panduan perataan
Anchor Points, Handle, and Bounding Box Display Tampilan titik jangkar, pegangan, dan kotak pembatas
@@ -4227,6 +4228,9 @@ font-technology Variable Variabel
Search commands, tools, panels and effects… Cari perintah, alat, panel, dan efek…
No commands match Tidak ada perintah yang cocok
{pos} of {total}: {name} {pos} dari {total}: {name}
No menu item Tidak ada item menu
Toolbar Bilah alat
{toolbar}, in the {tool} group {toolbar}, dalam grup {tool}
@plural {n} result|{n} results {n} hasil
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} dari {n} hasil. Terus ketik untuk mempersempitnya.
Recent Commands Perintah terbaru
Can't render this file because it contains an unexpected character in line 2538 and column 5.
+6
View File
@@ -141,6 +141,7 @@
Add to Swatches Aggiungi ai campioni
Add Used Colors Aggiungi colori usati
Additional Plug-ins Folder Cartella plug-in aggiuntivi
Plug-in Instruction Budget Budget di istruzioni dei plug-in
Additional Fonts Folder Cartella font aggiuntivi
Adjust Adjoining Width Points Regola punti di larghezza adiacenti
Incoming In entrata
@@ -3521,6 +3522,11 @@ digits Malayalam Malayalam
Search commands, tools, panels and effects… Cerca comandi, strumenti, pannelli ed effetti…
No commands match Nessun comando corrisponde
{pos} of {total}: {name} {pos} di {total}: {name}
No menu item Nessuna voce di menu
Toolbar Barra degli strumenti
{toolbar}, in the {tool} group {toolbar}, nel gruppo {tool}
Tool Strumento
Command Comando
@plural {n} result|{n} results {n} risultato|{n} risultati
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} di {n} risultato. Continua a digitare per restringerli.|{shown} di {n} risultati. Continua a digitare per restringerli.
Recent Commands Comandi recenti
Can't render this file because it is too large.
+4
View File
@@ -1093,6 +1093,7 @@ digits Malayalam マラヤーラム数字
Add to Selection 選択範囲に追加
Add to Swatches スウォッチに追加
Additional Plug-ins Folder 追加プラグインフォルダー
Plug-in Instruction Budget プラグインの命令予算
Additional Fonts Folder 追加フォントフォルダー
Adjust Adjoining Width Points 隣接する幅ポイントを調整
Incoming 入り側
@@ -3406,6 +3407,9 @@ mark-style Japanese 日本式
Search commands, tools, panels and effects… コマンド、ツール、パネル、効果を検索…
No commands match 一致するコマンドはありません
{pos} of {total}: {name} {total} 件中 {pos} 件目: {name}
No menu item メニュー項目なし
Toolbar ツールバー
{toolbar}, in the {tool} group {toolbar}、{tool} のグループ内
@plural {n} result|{n} results {n} 件
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} 件中 {shown} 件。続けて入力すると絞り込めます。
Recent Commands 最近使ったコマンド
Can't render this file because it is too large.
+4
View File
@@ -5810,6 +5810,7 @@ theme Appearance იერსახე
90° & 45° Angles 90° და 45° კუთხეები
90° Angles 90° კუთხეები
Additional Plug-ins Folder დამატებითი პლაგინები
Plug-in Instruction Budget პლაგინების ინსტრუქციების ბიუჯეტი
Additional Fonts Folder შრიფტების დამატებითი საქაღალდე
Alignment Guides გასწორების დამხმარე ხაზები
Anchor Points, Handle, and Bounding Box Display საყრდენი წერტილების, სახელურებისა და შემომსაზღვრელი ჩარჩოს ჩვენება
@@ -6298,6 +6299,9 @@ font-technology Variable ცვლადი
Search commands, tools, panels and effects… ბრძანებების, ხელსაწყოების, პანელებისა და ეფექტების ძიება…
No commands match შესაბამისი ბრძანება არ არის
{pos} of {total}: {name} {pos} / {total}: {name}
No menu item მენიუს ელემენტი არ არის
Toolbar ხელსაწყოთა ზოლი
{toolbar}, in the {tool} group {toolbar}, ჯგუფში {tool}
@plural {n} result|{n} results {n} შედეგი
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} შედეგიდან {shown}. გააგრძელეთ აკრეფა მათ შესამცირებლად.
Recent Commands ბოლოდროინდელი ბრძანებები
Can't render this file because it is too large.
+6
View File
@@ -1083,6 +1083,7 @@ digits Malayalam 말라얄람어
Add to Selection 선택 영역에 추가
Add to Swatches 견본에 추가
Additional Plug-ins Folder 추가 플러그인 폴더
Plug-in Instruction Budget 플러그인 명령어 예산
Additional Fonts Folder 추가 글꼴 폴더
Adjust Adjoining Width Points 인접한 너비 점 조정
Incoming 들어오는 쪽
@@ -3395,6 +3396,11 @@ mark-style Japanese 일본식
Search commands, tools, panels and effects… 명령, 도구, 패널 및 효과 검색…
No commands match 일치하는 명령이 없습니다
{pos} of {total}: {name} {total}개 중 {pos}번째: {name}
No menu item 메뉴 항목 없음
Toolbar 도구 모음
{toolbar}, in the {tool} group {toolbar}, {tool} 그룹
Tool 도구
Command 명령
@plural {n} result|{n} results 결과 {n}개
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. 결과 {n}개 중 {shown}개. 계속 입력하여 범위를 좁히세요.
Recent Commands 최근 명령
Can't render this file because it is too large.
+4
View File
@@ -4370,6 +4370,7 @@ theme Appearance Vormgeving
90° & 45° Angles Hoeken van 90° & 45°
90° Angles Hoeken van 90°
Additional Plug-ins Folder Extra map met plug-ins
Plug-in Instruction Budget Instructiebudget voor plug-ins
Additional Fonts Folder Extra map met lettertypen
Alignment Guides Uitlijnhulplijnen
Anchor Points, Handle, and Bounding Box Display Weergave van ankerpunten, greep en begrenzingskader
@@ -4884,6 +4885,9 @@ font-technology Variable Variabel
Search commands, tools, panels and effects… Opdrachten, gereedschappen, panelen en effecten zoeken…
No commands match Geen opdrachten gevonden
{pos} of {total}: {name} {pos} van {total}: {name}
No menu item Geen menu-item
Toolbar Gereedschapsbalk
{toolbar}, in the {tool} group {toolbar}, in de groep {tool}
@plural {n} result|{n} results {n} resultaat|{n} resultaten
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} van {n} resultaat. Typ verder om ze te beperken.|{shown} van {n} resultaten. Typ verder om ze te beperken.
Recent Commands Recente opdrachten
Can't render this file because it is too large.
+4
View File
@@ -3927,6 +3927,7 @@ theme Appearance Wygląd
90° & 45° Angles Kąty 90° i 45°
90° Angles Kąty 90°
Additional Plug-ins Folder Dodatkowy folder wtyczek
Plug-in Instruction Budget Budżet instrukcji wtyczek
Additional Fonts Folder Dodatkowy folder czcionek
Alignment Guides Linie wyrównania
Anchor Points, Handle, and Bounding Box Display Wyświetlanie punktów kontrolnych, uchwytów i obwiedni
@@ -4430,6 +4431,9 @@ font-technology Variable Zmienne
Search commands, tools, panels and effects… Szukaj poleceń, narzędzi, paneli i efektów…
No commands match Żadne polecenie nie pasuje
{pos} of {total}: {name} {pos} z {total}: {name}
No menu item Brak pozycji menu
Toolbar Pasek narzędzi
{toolbar}, in the {tool} group {toolbar}, w grupie {tool}
@plural {n} result|{n} results {n} wynik|{n} wyniki|{n} wyników
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} z {n} wyniku. Pisz dalej, aby je zawęzić.|{shown} z {n} wyników. Pisz dalej, aby je zawęzić.|{shown} z {n} wyników. Pisz dalej, aby je zawęzić.
Recent Commands Ostatnie polecenia
Can't render this file because it is too large.
+4
View File
@@ -147,6 +147,7 @@
Add to Selection Adicionar à Seleção
Add to Swatches Adicionar às Amostras
Additional Plug-ins Folder Pasta Adicional de Plug-ins
Plug-in Instruction Budget Orçamento de Instruções de Plug-ins
Additional Fonts Folder Pasta Adicional de Fontes
Adjust Adjoining Width Points Ajustar Pontos de Largura Adjacentes
Incoming Entrada
@@ -2923,6 +2924,9 @@ digits Malayalam Malaiala
Search commands, tools, panels and effects… Pesquisar comandos, ferramentas, painéis e efeitos…
No commands match Nenhum comando corresponde
{pos} of {total}: {name} {pos} de {total}: {name}
No menu item Nenhum item de menu
Toolbar Barra de Ferramentas
{toolbar}, in the {tool} group {toolbar}, no grupo {tool}
@plural {n} result|{n} results {n} resultado|{n} resultados
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} de {n} resultado. Continue digitando para filtrá-los.|{shown} de {n} resultados. Continue digitando para filtrá-los.
Recent Commands Comandos recentes
Can't render this file because it is too large.
+4
View File
@@ -139,6 +139,7 @@
Add to Swatches Добавить в образцы
Add Used Colors Добавить использованные цвета
Additional Plug-ins Folder Папка дополнительных модулей
Plug-in Instruction Budget Бюджет инструкций модулей
Additional Fonts Folder Папка дополнительных шрифтов
Adjust Adjoining Width Points Настроить смежные точки ширины
Incoming Входящая
@@ -3503,6 +3504,9 @@ digits Malayalam Малаялам
Search commands, tools, panels and effects… Поиск команд, инструментов, панелей и эффектов…
No commands match Нет подходящих команд
{pos} of {total}: {name} {pos} из {total}: {name}
No menu item Нет пункта меню
Toolbar Панель инструментов
{toolbar}, in the {tool} group {toolbar}, в группе «{tool}»
@plural {n} result|{n} results {n} результат|{n} результата|{n} результатов
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} из {n} результата. Продолжайте вводить, чтобы сузить их.|{shown} из {n} результатов. Продолжайте вводить, чтобы сузить их.|{shown} из {n} результатов. Продолжайте вводить, чтобы сузить их.
Recent Commands Недавние команды
Can't render this file because it is too large.
+4
View File
@@ -129,6 +129,7 @@
Add to Swatches Lägg till i färgrutor
Add Used Colors Lägg till använda färger
Additional Plug-ins Folder Mapp för ytterligare plugins
Plug-in Instruction Budget Instruktionsbudget för plugins
Additional Fonts Folder Mapp för ytterligare typsnitt
Adjust Adjoining Width Points Justera angränsande breddpunkter
Incoming Inkommande
@@ -3383,6 +3384,9 @@ digits Malayalam Malayalam
Search commands, tools, panels and effects… Sök kommandon, verktyg, paneler och effekter…
No commands match Inga kommandon matchar
{pos} of {total}: {name} {pos} av {total}: {name}
No menu item Inget menyalternativ
Toolbar Verktygsfält
{toolbar}, in the {tool} group {toolbar}, i gruppen {tool}
@plural {n} result|{n} results {n} resultat|{n} resultat
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} av {n} resultat. Fortsätt skriva för att begränsa dem.|{shown} av {n} resultat. Fortsätt skriva för att begränsa dem.
Recent Commands Senaste kommandon
Can't render this file because it is too large.
+15
View File
@@ -804,6 +804,21 @@ fn anti_aliasing_method_labels_are_in_complete_catalogs() {
}
}
/// Each row in the `search` context, which adds a language's words to a group of words with the same
/// meaning for the command palette, names a group and adds single words of no other group. No
/// catalog has to have these rows.
#[test]
fn search_rows_name_a_group_and_add_single_words() {
let mut bad = Vec::new();
for l in LANGUAGES.iter().filter(|l| !l.source.is_empty()) {
let (entries, _) = parse_entries(l.source);
for (_, src, tr) in entries.iter().filter(|(ctx, _, _)| ctx == crate::palette::words::CONTEXT) {
bad.extend(crate::palette::words::row_problems(src, tr).into_iter().map(|p| format!("{}: {p}", l.code)));
}
}
assert!(bad.is_empty(), "{bad:#?}");
}
/// The Painted and Sketched graphic style library's name and its styles' names have a row in every
/// bundled catalog.
#[test]
+4
View File
@@ -126,6 +126,7 @@
Add to Swatches Renk Örneklerine Ekle
Add Used Colors Kullanılan Renkleri Ekle
Additional Plug-ins Folder Ek Eklentiler Klasörü
Plug-in Instruction Budget Eklenti Talimat Bütçesi
Additional Fonts Folder Ek Yazı Tipleri Klasörü
Adjust Adjoining Width Points Bitişik Genişlik Noktalarını Ayarlayın
Incoming Gelen
@@ -3261,6 +3262,9 @@ digits Malayalam Malayalam
Search commands, tools, panels and effects… Komutları, araçları, panelleri ve efektleri arayın…
No commands match Eşleşen komut yok
{pos} of {total}: {name} {pos}/{total}: {name}
No menu item Menü öğesi yok
Toolbar Araç Çubuğu
{toolbar}, in the {tool} group {toolbar}, {tool} grubunda
@plural {n} result|{n} results {n} sonuç
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} sonuçtan {shown} tanesi. Daraltmak için yazmaya devam edin.
Recent Commands Son komutlar
Can't render this file because it is too large.
+6
View File
@@ -135,6 +135,7 @@
Add to Swatches Додати до зразків
Add Used Colors Додати використані кольори
Additional Plug-ins Folder Папка додаткових модулів
Plug-in Instruction Budget Бюджет інструкцій модулів
Additional Fonts Folder Папка додаткових шрифтів
Adjust Adjoining Width Points Налаштувати суміжні точки ширини
Incoming Вхідна
@@ -3513,6 +3514,11 @@ digits Malayalam Малаялам
Search commands, tools, panels and effects… Пошук команд, інструментів, панелей та ефектів…
No commands match Немає відповідних команд
{pos} of {total}: {name} {pos} з {total}: {name}
No menu item Немає пункту меню
Toolbar Панель інструментів
{toolbar}, in the {tool} group {toolbar}, у групі «{tool}»
Tool Інструмент
Command Команда
@plural {n} result|{n} results {n} результат|{n} результати|{n} результатів
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} з {n} результату. Продовжуйте вводити, щоб звузити їх.|{shown} з {n} результатів. Продовжуйте вводити, щоб звузити їх.|{shown} з {n} результатів. Продовжуйте вводити, щоб звузити їх.
Recent Commands Нещодавні команди
Can't render this file because it is too large.
+6
View File
@@ -157,6 +157,7 @@
Add Used Colors Thêm các màu đã dùng
Additional Fonts Folder Thư mục phông bổ sung
Additional Plug-ins Folder Thư mục plug-in bổ sung
Plug-in Instruction Budget Ngân sách lệnh của plug-in
Adjust Adjoining Width Points Điều chỉnh các điểm chiều rộng kề nhau
Incoming Phía vào
Outgoing Phía ra
@@ -3859,6 +3860,11 @@ mark-style Japanese Kiểu Nhật
Search commands, tools, panels and effects… Tìm kiếm lệnh, công cụ, bảng và hiệu ứng…
No commands match Không có lệnh nào khớp
{pos} of {total}: {name} {pos} trên {total}: {name}
No menu item Không có mục menu
Toolbar Thanh công cụ
{toolbar}, in the {tool} group {toolbar}, trong nhóm {tool}
Tool Công cụ
Command Lệnh
@plural {n} result|{n} results {n} kết quả
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} trên {n} kết quả. Tiếp tục gõ để thu hẹp.
Recent Commands Lệnh gần đây
Can't render this file because it is too large.
+4
View File
@@ -90,6 +90,7 @@
Add to Swatches 添加到色板
Add Used Colors 添加已用颜色
Additional Plug-ins Folder 附加增效工具文件夹
Plug-in Instruction Budget 增效工具指令预算
Additional Fonts Folder 附加字体文件夹
Adjust Adjoining Width Points 调整相邻宽度点
Incoming 入侧
@@ -3338,6 +3339,9 @@ digits Malayalam 马拉雅拉姆数字
Search commands, tools, panels and effects… 搜索命令、工具、面板和效果…
No commands match 没有匹配的命令
{pos} of {total}: {name} 第 {pos} 个,共 {total} 个:{name}
No menu item 无菜单项
Toolbar 工具栏
{toolbar}, in the {tool} group {toolbar},位于 {tool} 组中
@plural {n} result|{n} results {n} 个结果
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. 共 {n} 个结果,显示 {shown} 个。继续输入以缩小范围。
Recent Commands 最近使用的命令
Can't render this file because it is too large.
+6
View File
@@ -99,6 +99,7 @@
Add to Swatches 新增至色票
Add Used Colors 新增使用中的顏色
Additional Plug-ins Folder 額外的增效模組資料夾
Plug-in Instruction Budget 增效模組指令預算
Additional Fonts Folder 額外的字體資料夾
Adjust Adjoining Width Points 調整相鄰寬度點
Incoming 入側
@@ -4716,6 +4717,11 @@ digits Malayalam 馬來亞拉姆數字
Search commands, tools, panels and effects… 搜尋指令、工具、面板與效果…
No commands match 沒有符合的指令
{pos} of {total}: {name} 第 {pos} 個,共 {total} 個:{name}
No menu item 無選單項目
Toolbar 工具列
{toolbar}, in the {tool} group {toolbar},位於 {tool} 群組中
Tool 工具
Command 指令
@plural {n} result|{n} results {n} 個結果
@plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. 共 {n} 個結果,顯示 {shown} 個。繼續輸入以縮小範圍。
Recent Commands 最近使用的指令
Can't render this file because it is too large.
+384 -19
View File
@@ -9,6 +9,7 @@ use crate::theme::Tokens;
use crate::{VectorcraftApp, menus};
mod search;
pub(crate) mod words;
/// Engine commands the palette leaves out, each with the UI command of the same name that runs it
/// the way the panels and menus do: (engine id, UI command id). The Layers panel's Delete
@@ -286,6 +287,12 @@ pub(crate) struct Entry {
menu_item: &'static str,
/// The entry's kind, in the order [`search::kind`] ranks kinds.
kind: u8,
/// Where the row's label starts in `shown`: after the menu path, which the row shows as the
/// entry's home instead ([`home_text`]), or 0.
label_at: usize,
/// Does the row's home name the item of the menu bar after its menu path, since the item's
/// label differs from the entry's?
names_item: bool,
}
/// The palette's entries, the index a query is looked up in, and the last query's ranked results.
@@ -338,10 +345,27 @@ fn catalog(lang: crate::i18n::Lang, native: bool) -> Catalog {
let list = build_in(lang, native);
let shown_homes: Vec<Option<String>> =
list.iter().map(|e| e.home.as_deref().map(|h| format!("{} › {}", shown_label(lang, h), crate::i18n::tr(lang, e.menu_item)))).collect();
let index = search::Index::build(&list, &shown_homes);
// A group's row in the `search` context gives its words in `lang`; a plain row is not read.
let search_row = |key: &str| crate::i18n::tr_ctx_row(lang, words::CONTEXT, key).map(str::to_string);
let index = search::Index::build(&list, &shown_homes, &params_texts(&list), search_row);
Catalog { list, index, ranked: std::sync::Mutex::new(None) }
}
/// The params text of each entry's command, which the index reads a description from
/// ([`search::description`]): an engine or plug-in command's, a UI command's (the one it wraps
/// keeps its own) and an effect's. A tool, a panel and a filter plug-in have none.
fn params_texts(list: &[Entry]) -> Vec<&'static str> {
let engine = vectorcraft_engine::command_specs().iter().chain(vectorcraft_engine::cmd::plugin::command_specs());
let mut by_id: std::collections::HashMap<&str, &'static str> = engine.map(|c| (c.id, c.params)).collect();
by_id.extend(menus::UI_COMMANDS.iter().map(|c| (c.0, c.3)));
list.iter()
.map(|e| match e.id.strip_prefix("effect:") {
Some(effect) => vectorcraft_effects::effect_info(effect).map_or("", |info| info.params),
None => by_id.get(e.id.as_str()).copied().unwrap_or(""),
})
.collect()
}
/// The palette's entries in `lang` with the in-window menu bar.
#[cfg(test)]
fn build(lang: crate::i18n::Lang) -> Vec<Entry> {
@@ -374,7 +398,16 @@ fn build_in(lang: crate::i18n::Lang, native: bool) -> Vec<Entry> {
}
let (home, menu_item) = homes.get(&d.id).map_or((None, ""), |(path, item)| (Some(path.clone()), *item));
let kind = search::kind(&d.id, home.as_deref());
Entry { id: d.id, shortcut: d.shortcut, shown, haystack, home, menu_item, kind }
// A row with a home shows its label without the menu path in front of it. A path that
// makes the name distinct ([`distinct_names`]) stays, unless the row's home shows that
// same path or it is the Tools in front of a tool's name, which the tool's kind and
// toolbar show.
let tool = d.id.starts_with("tool:");
let drop = if d.in_context { home.as_deref() == Some(d.path.as_str()) || (tool && d.path == "Tools") } else { home.is_some() || tool };
let prefix = format!("{} › ", shown_label(lang, &d.path));
let label_at = if drop && !d.path.is_empty() && shown.starts_with(&prefix) { prefix.len() } else { 0 };
let names_item = !menu_item.is_empty() && menu_item != d.label;
Entry { id: d.id, shortcut: d.shortcut, shown, haystack, home, menu_item, kind, label_at, names_item }
})
.collect()
}
@@ -445,10 +478,87 @@ const TOP: f32 = 90.0;
/// The space kept between the popup and the bottom of the window, in points.
const BOTTOM_GAP: f32 = 8.0;
/// What a result row shows and screen readers read: its name, and its shortcut after a comma.
fn row_label(e: &Entry) -> String {
/// The point size of the kind icon at the start of a result row.
const KIND_ICON: f32 = 14.0;
/// The point size of the home's text after a row's label.
const HOME_TEXT: f32 = 11.0;
/// The kind of result `e` is: the icon its row starts with and the word screen readers read
/// first, in the UI language. A tool shows its own icon.
fn kind_of(e: &Entry) -> (&'static str, &'static str) {
match e.id.split_once(':') {
Some(("tool", tool)) => (vectorcraft_tools::tool_info(tool).map_or("square-dashed", |t| crate::icons::tool_icon(t.icon)), tl!("Tool")),
Some(("panel", _)) => ("layout-grid", tl!("Panel")),
Some(("effect", _)) => ("dc-fx", tl!("Effect")),
Some(("plugin", _)) => ("dc-filter", tl!("Filter")),
_ => ("menu", tl!("Command")),
}
}
/// The label a result row shows: its name without the menu path its home shows.
fn label_of(e: &Entry) -> &str {
e.shown.get(e.label_at..).unwrap_or(&e.shown)
}
/// Where result `e` lives, as its row shows it: a tool's place on the toolbars ([`tool_home`]),
/// the menu path of the item of the menu bar that runs it (with the item's label when it differs
/// from the result's), or "No menu item".
fn home_text(app: &VectorcraftApp, e: &Entry) -> String {
let lang = crate::i18n::current();
if let Some(tool) = e.id.strip_prefix("tool:") {
return tool_home(app, tool);
}
match &e.home {
Some(path) if e.names_item => format!("{} › {}", shown_label(lang, path), crate::i18n::tr(lang, e.menu_item)),
Some(path) => shown_label(lang, path),
None => tl!("No menu item").to_string(),
}
}
/// Where `tool` is in the current layout: "Toolbar" for its button on the Tools panel, or the name
/// of the toolbar made with New Toolbar that holds it, followed by ", in the <tool> group", naming
/// the tool its slot's button shows, when the tool is hidden in that slot's group; "All Tools"
/// when no toolbar holds it. A toolbar shown now comes first: the Tools panel, then the toolbars
/// made with New Toolbar; then a hidden Tools panel, then hidden toolbars made with New Toolbar.
/// Toolbars are hidden in Presentation Mode and while Tab hides the panels.
fn tool_home(app: &VectorcraftApp, tool: &str) -> String {
let lang = crate::i18n::current();
let place = |name: &str, shown: Option<&str>| match shown.filter(|s| *s != tool).and_then(vectorcraft_tools::tool_info) {
// The tool goes in first, so a toolbar named with a placeholder keeps its name.
Some(t) => crate::i18n::fmt(tl!("{toolbar}, in the {tool} group"), &[("tool", crate::i18n::tr(lang, t.label)), ("toolbar", name)]),
None => name.to_string(),
};
let toolbars_shown = app.ui.screen_mode < 3 && app.ui.tab_hid.is_none();
let main = crate::toolbar::slots(app).into_iter().map(|(_, s)| s).find(|s| s.contains(&tool));
let main = main.map(|slot| place(tl!("Toolbar"), Some(crate::toolbar::shown_tool(app, &slot))));
let active = app.session.tool_id();
let custom = |shown: bool| {
app.ui.custom_toolbars.iter().filter(|b| b.shown == shown).find_map(|bar| {
let slot = bar.slots.iter().find(|s| s.iter().any(|t| t == tool))?;
let tools: Vec<&'static str> = slot.iter().filter_map(|id| vectorcraft_tools::tool_info(id).map(|t| t.id)).collect();
Some(place(&bar.name, crate::custom_toolbars::shown_tool(bar, active, &tools)))
})
};
if toolbars_shown {
if app.ui.toolbar
&& let Some(main) = &main
{
return main.clone();
}
if let Some(bar) = custom(true) {
return bar;
}
}
main.or_else(|| custom(true)).or_else(|| custom(false)).unwrap_or_else(|| tl!("All Tools").to_string())
}
/// What screen readers read for a result row, and its hover text: its kind, its label, where it
/// lives (`home`) and its shortcut, after commas.
fn row_label(e: &Entry, home: &str) -> String {
let shortcut = menus::shown_shortcut(&e.shortcut);
if shortcut.is_empty() { e.shown.clone() } else { format!("{}, {shortcut}", e.shown) }
let kind = kind_of(e).1;
let start = format!("{kind}, {}, {home}", label_of(e));
if shortcut.is_empty() { start } else { format!("{start}, {shortcut}") }
}
/// The line under the results: how many results matched, how many of them the list holds when it
@@ -502,6 +612,41 @@ fn name_galley(painter: &egui::Painter, name: &str, font: egui::FontId, color: e
painter.layout_job(job)
}
/// A result row's label and home laid out in `width` points, and whether either was cut short. The
/// home goes after the label in the smaller dim text and is cut first; when the label alone does
/// not fit, the home is left out and the label is cut before the id it shows after its name
/// ([`distinct_names`]), which stays whole unless the id alone is wider than the row.
fn row_galleys(
painter: &egui::Painter,
e: &Entry,
home: &str,
font: egui::FontId,
color: egui::Color32,
dim: egui::Color32,
width: f32,
) -> (Arc<egui::Galley>, Option<Arc<egui::Galley>>, bool) {
let label = label_of(e);
let full = name_galley(painter, label, font.clone(), color, f32::INFINITY);
let room = width - full.size().x - 10.0;
if full.size().x <= width {
if room < HOME_TEXT {
return (full, None, !home.is_empty());
}
let home = name_galley(painter, home, egui::FontId::new(HOME_TEXT, font.family), dim, room);
let cut = home.elided;
return (full, Some(home), cut);
}
let suffix = format!(" ({})", e.id);
let (head, suffix) = match label.strip_suffix(suffix.as_str()) {
Some(head) => (head, suffix),
None => (label, String::new()),
};
let suffix_width = name_galley(painter, &suffix, font.clone(), color, f32::INFINITY).size().x;
let cut_head = name_galley(painter, head, font.clone(), color, width - suffix_width);
let shown: String = cut_head.rows.iter().flat_map(|r| r.glyphs.iter().map(|g| g.chr)).collect();
(name_galley(painter, &format!("{shown}{suffix}"), font, color, width), None, true)
}
/// The scroll offset that keeps row `sel` in a list `view` points tall that was scrolled to `offset`.
fn offset_showing(sel: usize, offset: f32, view: f32) -> f32 {
let top = sel as f32 * ROW_HEIGHT;
@@ -740,7 +885,8 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
let rank = if sel + 1 == matches.len() { kept.unwrap_or(sel) } else { sel };
let pos = (rank + 1).to_string();
let of = total.to_string();
let said = crate::i18n::fmt(tl!("{pos} of {total}: {name}"), &[("pos", &pos), ("total", &of), ("name", &row_label(e))]);
let name = row_label(e, &home_text(app, e));
let said = crate::i18n::fmt(tl!("{pos} of {total}: {name}"), &[("pos", &pos), ("total", &of), ("name", &name)]);
ui.ctx().accesskit_node_builder(r.id, |node| node.set_description(said));
}
if n > 0 {
@@ -765,16 +911,29 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) {
}
let font = egui::TextStyle::Body.resolve(ui.style());
let shortcut = menus::shown_shortcut(&e.shortcut);
let home = home_text(app, e);
let said = row_label(e, &home);
let p = ui.painter();
let shortcut_at = rect.right_center() - egui::vec2(8.0, 0.0);
let used = p.text(shortcut_at, egui::Align2::RIGHT_CENTER, &shortcut, font.clone(), t.text_dim);
let name_end = if shortcut.is_empty() { rect.right() - 8.0 } else { used.left() - 12.0 };
let name_at = rect.left() + 8.0;
let name = name_galley(p, &e.shown, font, t.text, name_end - name_at);
p.galley(egui::pos2(name_at, rect.center().y - name.size().y / 2.0), name, t.text);
let icon = egui::Rect::from_center_size(
egui::pos2(rect.left() + 8.0 + KIND_ICON / 2.0, rect.center().y),
egui::Vec2::splat(KIND_ICON),
);
crate::icons::paint(ui, kind_of(e).0, icon, t.icon);
let name_at = icon.right() + 6.0;
let (label, home, cut) = row_galleys(p, e, &home, font, t.text, t.text_dim, name_end - name_at);
let home_at = name_at + label.size().x + 10.0;
p.galley(egui::pos2(name_at, rect.center().y - label.size().y / 2.0), label, t.text);
if let Some(home) = home {
p.galley(egui::pos2(home_at, rect.center().y - home.size().y / 2.0), home, t.text_dim);
}
// A row whose text is cut short shows all of it while the pointer rests on it.
let resp = if cut { resp.on_hover_text(said.clone()) } else { resp };
// `WidgetInfo::selected` reaches screen readers as a toggled state, so the
// row sets the selected state on its node itself.
resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::ListItem, true, row_label(e)));
resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::ListItem, true, said.clone()));
ui.ctx().accesskit_node_builder(resp.id, |node| node.set_selected(on));
if resp.clicked() {
run = Some(e.id.clone());
@@ -1934,6 +2093,12 @@ mod tests {
self.ctx.memory(|m| m.area_rect(egui::Id::unique("palette"))).unwrap()
}
/// What screen readers read for result `id`'s row.
fn said(&self, id: &str) -> String {
let entries = entries(&self.ctx, Lang::EN);
entries.iter().find(|e| e.id == id).map(|e| row_label(e, &home_text(&self.app, e))).unwrap()
}
/// The results the palette lists for its query.
fn listed(&self) -> Vec<String> {
let entries = entries(&self.ctx, Lang::EN);
@@ -2042,8 +2207,7 @@ mod tests {
let nodes = open.press(egui::Key::ArrowDown, 15);
assert_eq!(open.highlighted(), 15);
let lit: Vec<_> = rows(&nodes).into_iter().filter(|r| r.1).collect();
let entries = entries(&open.ctx, Lang::EN);
let want = entries.iter().find(|e| e.id == listed[15]).map(row_label).unwrap();
let want = open.said(&listed[15]);
assert_eq!(lit.len(), 1, "{lit:?}");
assert_eq!(lit[0].0, want);
let popup = open.popup();
@@ -2118,7 +2282,7 @@ mod tests {
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:?}");
assert_eq!(lit[0].0, row_label(entries(&open.ctx, Lang::EN).iter().find(|e| e.id == open.listed()[sel]).unwrap()));
assert_eq!(lit[0].0, open.said(&open.listed()[sel]));
}
/// Page Down, Up and Enter pressed in one frame move the highlight in that order, and Enter
@@ -2211,7 +2375,7 @@ mod tests {
assert!(open.repaint, "the frame that moved the highlight asks for another");
let nodes = open.frame(vec![]);
let lit: Vec<String> = rows(&nodes).into_iter().filter(|r| r.1).map(|r| r.0).collect();
let label = entries.iter().find(|e| e.id == listed[3]).map(row_label).unwrap();
let label = open.said(&listed[3]);
assert_eq!(lit, std::slice::from_ref(&label));
assert_eq!(field_description(&nodes), format!("4 of {}: {label}", matching(&entries, "select").len()));
}
@@ -2233,6 +2397,206 @@ mod tests {
out.textures_delta.clear();
}
/// The label and home of English result `id`'s row with the app's current layout.
fn label_and_home(app: &VectorcraftApp, id: &str) -> (String, String) {
crate::i18n::set_current(Lang::EN);
let entries = build(Lang::EN);
let e = entries.iter().find(|e| e.id == id).unwrap_or_else(|| panic!("{id} is listed"));
(label_of(e).to_string(), home_text(app, e))
}
/// A row shows its label without the menu path, and the menu path of the item of the menu bar
/// that runs it after it: with that item's label when it differs, and "No menu item" for a
/// command no item runs.
#[test]
fn rows_show_where_each_result_lives() {
let app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
let row = |id: &str| label_and_home(&app, id);
assert_eq!(row("effect:stylize.roundCorners"), ("Round Corners…".into(), "Effect › Stylize".into()));
assert_eq!(row("panel:layers"), ("Layers".into(), "Window".into()));
assert_eq!(row("object.group"), ("Group".into(), "Object".into()));
assert_eq!(row("app.quit").1, "File › Exit");
// Window › Learn runs the Learn command as well as showing the Learn panel.
assert_eq!(row("window.learn").1, "Window");
let entries = build(Lang::EN);
let learn = entries.iter().find(|e| e.id == "window.learn").expect("the Learn command");
assert_eq!(learn.kind, search::kind("object.group", Some("Object")), "the Learn command ranks as a command of the menu bar");
let none = entries.iter().find(|e| e.home.is_none() && !e.id.starts_with("tool:")).expect("a command with no menu item");
assert_eq!((label_of(none), home_text(&app, none).as_str()), (none.shown.as_str(), "No menu item"));
// A path that keeps two names apart stays, unless the home shows it: the Knife tool's row
// drops the Tools in front of its name, and an Other Library… row shows its library menu
// as its home only.
assert_eq!(row("tool:knife").0, "Knife");
let other: Vec<(&str, String)> =
entries.iter().filter(|e| e.shown.ends_with("Other Library…")).map(|e| (label_of(e), home_text(&app, e))).collect();
assert!(other.len() >= 2 && other.iter().all(|(label, home)| *label == "Other Library…" && home.starts_with("Window › ")), "{other:?}");
let kept = entries.iter().find(|e| e.label_at == 0 && e.shown.contains(" › ")).expect("a row that keeps its path");
assert!(kept.home.as_deref().is_none_or(|h| !kept.shown.starts_with(&format!("{h} › "))), "{}", kept.shown);
for e in entries.iter().filter(|e| e.label_at > 0) {
assert!(e.home.is_some() || e.id.starts_with("tool:"), "{} has no home but drops its path", e.id);
}
}
/// No two results' rows show the same kind, label and home, in any language, with the menu bar
/// in the window or the native one.
#[test]
fn no_two_rows_read_alike() {
let app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
let mut alike = vec![];
for lang in Lang::all() {
crate::i18n::set_current(lang);
for native in [false, true] {
let mut seen = std::collections::HashMap::new();
for e in &build_in(lang, native) {
let row = (kind_of(e).1, label_of(e).to_string(), home_text(&app, e));
if let Some(other) = seen.insert(row.clone(), e.id.clone())
&& other != e.id
{
alike.push(format!("{} (native {native}): {other} and {}: {row:?}", lang.code(), e.id));
}
}
}
}
crate::i18n::set_current(Lang::EN);
assert!(alike.is_empty(), "{}", alike.join("\n"));
}
/// Every catalog translates the words a row's kind and home are read with.
#[test]
fn catalogs_translate_the_kind_and_home_words() {
let words = ["Tool", "Panel", "Effect", "Filter", "Command", "Toolbar", "{toolbar}, in the {tool} group", "All Tools", "No menu item"];
let missing: Vec<String> = Lang::all()
.filter(|l| *l != Lang::EN)
.flat_map(|l| words.iter().filter(move |w| !crate::i18n::has(l, w)).map(move |w| format!("{}: {w}", l.code())))
.collect();
assert!(missing.is_empty(), "{missing:?}");
}
/// A tool's row names the toolbar it is on, and the tool its slot's button shows while it is
/// hidden in that slot's group. A toolbar shown now comes before a hidden Tools panel, which
/// comes before a hidden toolbar made with New Toolbar.
#[test]
fn a_tool_row_names_its_toolbar_slot() {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
let home = |app: &VectorcraftApp, id: &str| label_and_home(app, id).1;
assert_eq!(home(&app, "tool:groupSelection"), "Toolbar, in the Direct Selection Tool group");
assert_eq!(home(&app, "tool:directSelection"), "Toolbar");
app.select_tool("groupSelection");
assert_eq!(home(&app, "tool:groupSelection"), "Toolbar");
assert_eq!(home(&app, "tool:directSelection"), "Toolbar, in the Group Selection Tool group");
let bar = |name: &str, slot: &[&str], shown: bool| crate::state::CustomToolbar {
name: name.into(),
slots: vec![slot.iter().map(|t| t.to_string()).collect()],
shown,
pos: [0.0, 0.0],
dock: None,
dock_right: false,
slot_tool: Default::default(),
double: false,
floating: vec![],
};
// Window › Tools hides the Tools panel while a toolbar made with New Toolbar holds the Pen
// Tool: the row names that toolbar.
app.ui.toolbar = false;
assert_eq!(home(&app, "tool:pen"), "Toolbar");
app.ui.custom_toolbars.push(bar("Drawing", &["pen", "curvature"], true));
assert_eq!(home(&app, "tool:pen"), "Drawing");
assert_eq!(home(&app, "tool:curvature"), "Drawing, in the Pen Tool group");
app.ui.custom_toolbars[0].name = "{tool}".into();
assert_eq!(home(&app, "tool:curvature"), "{tool}, in the Pen Tool group");
app.ui.custom_toolbars[0].name = "Drawing".into();
// Tab hides the toolbars made with New Toolbar too: the hidden Tools panel comes first.
app.ui.tab_hid = Some(crate::state::TabHid { dock: true, toolbar: true, control_bar: true });
assert_eq!(home(&app, "tool:pen"), "Toolbar");
app.ui.tab_hid = None;
// The Tools panel shown again comes first.
app.ui.toolbar = true;
assert_eq!(home(&app, "tool:pen"), "Toolbar");
// In Presentation Mode no toolbar shows; the tool still lives on the Tools panel.
app.ui.screen_mode = 3;
assert_eq!(home(&app, "tool:pen"), "Toolbar");
app.ui.screen_mode = 0;
// A tool that only a hidden toolbar made with New Toolbar holds is named on it, and one no
// toolbar holds is in All Tools.
let on_tools: Vec<&str> = crate::toolbar::slots(&app).into_iter().flat_map(|(_, s)| s).collect();
let loose = vectorcraft_tools::catalog::all_tools().map(|t| t.id).find(|t| !on_tools.contains(t)).expect("a tool not on the Tools panel");
let id = format!("tool:{loose}");
assert_eq!(home(&app, &id), "All Tools");
app.ui.custom_toolbars.push(bar("Cutting", &[loose], false));
assert_eq!(home(&app, &id), "Cutting");
}
/// A row too narrow for its label and home cuts the home first; a label that does not fit
/// alone is cut before the id it shows after its name, which stays whole.
#[test]
fn a_narrow_row_cuts_the_home_first_and_keeps_the_id() {
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
let entries = build(Lang::EN);
let keyed = entries.iter().find(|e| e.shown.ends_with(&format!(" ({})", e.id))).expect("a result that shows its id");
let copy = entries.iter().find(|e| e.id == "edit.copy").expect("Copy");
let app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {
let font = egui::TextStyle::Body.resolve(ui.style());
let p = ui.painter();
let lay = |e: &Entry, home: &str, width: f32| row_galleys(p, e, home, font.clone(), egui::Color32::WHITE, egui::Color32::GRAY, width);
let text = |g: &egui::Galley| g.rows.iter().flat_map(|r| r.glyphs.iter().map(|g| g.chr)).collect::<String>();
let (label, home, cut) = lay(copy, "Edit", 400.0);
assert_eq!((text(&label), home.map(|h| text(&h)), cut), ("Copy".into(), Some("Edit".into()), false));
let long = "A Menu › A Submenu With A Long Name › Another Submenu";
let (label, home, cut) = lay(copy, long, 160.0);
let home = home.expect("some of the home fits");
assert!(cut && home.elided && text(&label) == "Copy", "{}", text(&home));
assert!(label.size().x + 10.0 + home.size().x <= 160.0 + 0.5);
// A long German menu path is cut before the label.
crate::i18n::set_current(Lang::from_code("de").expect("German"));
let german = build_in(crate::i18n::current(), false);
let deep = german
.iter()
.filter(|e| e.label_at > 0)
.max_by_key(|e| e.home.as_ref().map_or(0, |h| shown_label(crate::i18n::current(), h).chars().count()));
let deep = deep.expect("a German row with a home");
let path = home_text(&app, deep);
crate::i18n::set_current(Lang::EN);
let label_width = name_galley(p, label_of(deep), font.clone(), egui::Color32::WHITE, f32::INFINITY).size().x;
let (label, home, cut) = lay(deep, &path, label_width + 60.0);
assert!(cut && text(&label) == label_of(deep) && home.is_some_and(|h| h.elided), "{path}");
let suffix = format!(" ({})", keyed.id);
let suffix_width = name_galley(p, &suffix, font.clone(), egui::Color32::WHITE, f32::INFINITY).size().x;
let full = name_galley(p, label_of(keyed), font.clone(), egui::Color32::WHITE, f32::INFINITY).size().x;
assert!(full - 5.0 > suffix_width + 20.0, "{}", label_of(keyed));
for width in [full - 5.0, suffix_width + 20.0, suffix_width / 2.0] {
let (label, home, cut) = lay(keyed, long, width);
let shown = text(&label);
assert!(cut && home.is_none(), "{width}");
assert!(label.size().x <= width + 0.5, "{width}: {shown} is {} wide", label.size().x);
// An id wider than the row is cut too.
assert_eq!(shown.ends_with(&format!("…{suffix}")), width > suffix_width, "{width}: {shown}");
}
});
out.textures_delta.clear();
}
/// Screen readers read a row as its kind, label, home and shortcut, and the field's
/// description names them too; the row's height is unchanged.
#[test]
fn screen_readers_hear_the_kind_and_home() {
let mut open = Open::new("round corners", WINDOW);
let nodes = open.frame(vec![]);
let said = open.said("effect:stylize.roundCorners");
assert_eq!(said, "Effect, Round Corners…, Effect › Stylize");
let row = rows(&nodes).into_iter().find(|r| r.0 == said).expect("its row is drawn");
assert!((row.3 - row.2 - f64::from(ROW_HEIGHT)).abs() < 0.01, "{row:?}");
assert!(field_description(&nodes).ends_with(&said), "{}", field_description(&nodes));
let open = Open::new("group selection", WINDOW);
assert_eq!(open.said("tool:groupSelection"), "Tool, Group Selection Tool, Toolbar, in the Direct Selection Tool group");
let mut open = Open::new("layers", WINDOW);
let said = open.said("panel:layers");
assert!(said.starts_with("Panel, Layers, Window"), "{said}");
let nodes = open.frame(vec![]);
assert!(rows(&nodes).iter().any(|r| r.0 == said));
}
/// The popup stays inside a short window, showing fewer rows when 12 don't fit; a page is the
/// rows shown.
#[test]
@@ -2283,7 +2647,8 @@ mod tests {
let mut open = Open::new("show panel", WINDOW);
let listed = open.listed();
let entries = entries(&open.ctx, Lang::EN);
let label = |i: usize| entries.iter().find(|e| e.id == listed[i]).map(row_label).unwrap();
let said: Vec<String> = listed.iter().map(|id| open.said(id)).collect();
let label = |i: usize| said[i].clone();
let nodes = open.frame(vec![]);
// More results match than the list holds: the place counts every match, as the footer does.
let total = matching(&entries, "show panel").len();
@@ -2295,10 +2660,10 @@ mod tests {
let nodes = open.press(egui::Key::ArrowDown, 1);
assert_eq!(field_description(&nodes), format!("2 of {total}: {}", label(1)));
// Fewer results match than the list holds.
let mut open = Open::new("copy", WINDOW);
let mut open = Open::new("eyedropper", WINDOW);
let n = open.listed().len();
assert!((1..MAX_RESULTS).contains(&n), "{n}");
let first = entries.iter().find(|e| e.id == open.listed()[0]).map(row_label).unwrap();
let first = open.said(&open.listed()[0]);
let nodes = open.frame(vec![]);
assert_eq!(field_description(&nodes), format!("1 of {n}: {first}"));
assert!(labels(&nodes).contains(&footer(n, n)), "{:?}", labels(&nodes));
@@ -2780,7 +3145,7 @@ mod tests {
let listed: Vec<_> = matching(&entries, "show panel").into_iter().take(MAX_RESULTS).collect();
let hidden = |e: &&&Entry| e.id.strip_prefix("panel:").is_some_and(|p| !crate::panel_docking::showing(&window.app.ui, p));
let e = listed.iter().find(hidden).expect("a hidden panel's result");
let label = row_label(e);
let label = row_label(e, &home_text(&window.app, e));
let row = rows(&nodes).into_iter().find(|r| r.0 == label).expect("its row is drawn");
let panel = e.id.strip_prefix("panel:").unwrap_or_default().to_string();
window.click(egui::pos2(window.popup().center().x, ((row.2 + row.3) / 2.0) as f32));
@@ -2868,7 +3233,7 @@ mod tests {
assert!(plugin.is_some_and(|p| p < MAX_RESULTS), "the plug-in is shown: {plugin:?}");
assert_eq!(ranked.iter().position(|e| e.id == id), Some(MAX_RESULTS), "the plug-in pushed the highlight past the limit");
assert_eq!((sel, &now), (MAX_RESULTS - 1, &id), "the highlight stays on its result, in the last row");
let label = row_label(ranked[MAX_RESULTS]);
let label = row_label(ranked[MAX_RESULTS], &home_text(&open.app, ranked[MAX_RESULTS]));
assert!(rows(&nodes).iter().any(|r| r.1 && r.0 == label), "its row is drawn and highlighted");
assert_eq!(field_description(&nodes), format!("{} of {}: {label}", MAX_RESULTS + 1, ranked.len()));
}
+723 -36
View File
@@ -11,27 +11,49 @@ use crate::menus;
const INDEX_CHARS: usize = 200;
/// The field of a result a word comes from, best first, and the fields of the English stem forms
/// ([`stems`]) of the words of the label and the menu path.
/// ([`stems`]) of the words of the label, the menu path and the description ([`description`]).
const LABEL: u8 = 0;
const PATH: u8 = 1;
const ID: u8 = 2;
const LABEL_STEMMED: u8 = 3;
const PATH_STEMMED: u8 = 4;
const DESCRIPTION: u8 = 5;
const DESCRIPTION_STEMMED: u8 = 6;
/// A word's grade in a result, best first: a whole word of the label, a word of the label it
/// shares an English stem form with ("outlines" and Outline), a word of the label it starts, a
/// word of the menu path it is, shares a stem form with or starts, a word of the id it is or
/// starts, or text inside a word of any field ([`super::matching`]'s substring rule). The grades
/// without a stem are twice the values they had before stems were added, so results matched
/// without a stem keep their order by the sum of the grades.
/// word of the label with the same meaning ([`super::words`]), a word of the menu path it is,
/// shares a stem form with or starts, a word of the menu path with the same meaning, a word of the
/// id it is or starts, text inside a word of any field ([`super::matching`]'s substring rule), a
/// word of the description it is, shares a stem form with, starts or means the same as, a word of
/// the label a typo away from it ([`Index::typos`]), or a word of the menu path a typo away. A word
/// of the description comes after the substring rule, so every result the substring rule finds
/// ranks above a result found only by its description. The grades without a stem or a word with
/// the same meaning are twice the values they had before those were added, so results matched
/// without them keep their order by the sum of the grades.
const LABEL_WORD: u8 = 2;
const LABEL_STEM: u8 = 3;
const LABEL_PREFIX: u8 = 4;
const LABEL_SYNONYM: u8 = 5;
const PATH_WORD: u8 = 6;
const PATH_SYNONYM: u8 = 7;
const ID_WORD: u8 = 8;
const SUBSTRING: u8 = 10;
const DESCRIPTION_WORD: u8 = 11;
const LABEL_TYPO: u8 = 12;
const PATH_TYPO: u8 = 14;
const NONE: u8 = u8::MAX;
/// The most characters of a command's description the index reads (VectorCraft's own limit).
const DESCRIPTION_CHARS: usize = 300;
/// The words of a description the index leaves out, besides words of 2 characters or fewer and
/// words with no letter.
const STOP_WORDS: &[&str] = &["the", "and", "ids", "true", "false", "null"];
/// The most words a query word with a typo meets ([`Index::typos`]), nearest first.
const TYPO_TERMS: usize = 32;
/// How a whole query matches a result, best first: it is the result's id, it is a label, a label
/// starts with it, or it is the initials of a label.
const EXACT_ID: u8 = 0;
@@ -62,6 +84,38 @@ pub(crate) struct Index {
initials_text: String,
/// Each result's offset and length in `initials_text`.
initials: Vec<(u32, u16)>,
/// Each word of a group of words with the same meaning ([`super::words::GROUPS`], and the
/// words the UI language's catalog adds), with the group's place in the table.
synonyms: HashMap<Box<str>, u16>,
}
/// Is `w` one word as the index splits text ([`words`])?
pub(crate) fn is_one_word(w: &str) -> bool {
let mut it = words(w);
it.next() == Some(w) && it.next().is_none()
}
/// The words of each group of [`super::words::GROUPS`], with the words `search_row` gives for the
/// group's catalog row ([`super::words::row_key`]) in the UI language. A word the catalog gives
/// that is not a single word, or that is already a word of a group, is left out.
fn synonym_groups(search_row: impl Fn(&str) -> Option<String>) -> HashMap<Box<str>, u16> {
let mut out: HashMap<Box<str>, u16> = HashMap::new();
let groups = super::words::GROUPS.iter().enumerate().filter_map(|(g, words)| u16::try_from(g).ok().map(|g| (g, words)));
for (g, words) in groups.clone() {
for &w in *words {
out.insert(w.into(), g);
}
}
for (g, words) in groups {
let Some(text) = search_row(&super::words::row_key(words)) else { continue };
for (w, single) in super::words::row_words(&text) {
if single {
out.entry(w.into()).or_insert(g);
}
}
}
out.shrink_to_fit();
out
}
/// Splits `text` into lowercase words at whitespace and at `.`, `-`, `/`, `(`, `)`, `…`, `›`, `,`
@@ -133,6 +187,80 @@ fn stems(word: &str) -> Vec<String> {
vec![]
}
/// Is `c` a letter of a script written without spaces between words (Han, kana or Hangul)?
fn spaceless(c: char) -> bool {
matches!(
u32::from(c),
0x1100..=0x11FF
| 0x3040..=0x30FF
| 0x3130..=0x318F
| 0x31F0..=0x31FF
| 0x3400..=0x4DBF
| 0x4E00..=0x9FFF
| 0xA960..=0xA97F
| 0xAC00..=0xD7FF
| 0xF900..=0xFAFF
| 0xFF66..=0xFFDC
| 0x20000..=0x323AF
)
}
/// The most edits a query word may be away from a word it meets as a typo: 1 for a word of 4 to 7
/// characters, 2 for a longer one, and none for a shorter word or one with letters of a script
/// written without spaces ([`spaceless`]).
fn typo_bound(word: &str) -> Option<usize> {
if word.chars().any(spaceless) {
return None;
}
match word.chars().count() {
0..=3 => None,
4..=7 => Some(1),
_ => Some(2),
}
}
/// The number of edits between `a` and `b` when it is at most `bound`: a character inserted,
/// removed or changed, or two adjacent characters swapped (`gruop` and `group`), each count as one.
/// The count stops as soon as every way of lining the two up needs more than `bound`.
fn edits_within(a: &[char], b: &[char], bound: usize) -> Option<usize> {
if a.len().abs_diff(b.len()) > bound {
return None;
}
let at = |row: &[usize], j: usize| row.get(j).copied().unwrap_or(usize::MAX);
// The edits between the first i characters of `a` and the first j of `b`, for the rows i - 2,
// i - 1 and i.
let mut before: Vec<usize> = vec![0; b.len() + 1];
let mut last: Vec<usize> = (0..=b.len()).collect();
let mut row: Vec<usize> = vec![0; b.len() + 1];
for (i, &ca) in a.iter().enumerate() {
if let Some(first) = row.first_mut() {
*first = i + 1;
}
for (j, &cb) in b.iter().enumerate() {
let changed = at(&last, j).saturating_add(usize::from(ca != cb));
let removed = at(&last, j + 1).saturating_add(1);
let inserted = at(&row, j).saturating_add(1);
let mut edits = changed.min(removed).min(inserted);
let swapped = i.checked_sub(1).and_then(|k| a.get(k)).zip(j.checked_sub(1).and_then(|k| b.get(k)));
if let Some((&pa, &pb)) = swapped
&& pa == cb
&& pb == ca
{
edits = edits.min(at(&before, j - 1).saturating_add(1));
}
if let Some(cell) = row.get_mut(j + 1) {
*cell = edits;
}
}
if row.iter().all(|&e| e > bound) {
return None;
}
std::mem::swap(&mut before, &mut last);
std::mem::swap(&mut last, &mut row);
}
last.last().copied().filter(|&e| e <= bound)
}
/// Adds each word of `text` to `found` for result `entry` in `field`, and with `stemmed`, each
/// word's English stem forms in that field.
fn add_words(found: &mut Vec<(String, u16, u8)>, text: &str, entry: u16, field: u8, stemmed: Option<u8>) {
@@ -152,6 +280,50 @@ fn split_name(name: &str) -> (&str, &str) {
}
}
/// A command's description, read from its params text: the text without each `{…}` group that is
/// not inside a `{`, `[` or `(` group (braces inside double quotes are text), without each such
/// `[…]` or `(…)` group just after a `→`, and without the `→` just before a removed group, with
/// each run of whitespace made one space and cut to its first [`DESCRIPTION_CHARS`] characters at
/// the end of a word. A group that is never closed stays in the text, and so does a result written
/// as words after a `→`. Params text that is only a group has an empty description.
pub(crate) fn description(params: &str) -> String {
let mut out = String::new();
// The end of the text copied to `out`, and whether a removed group is open.
let (mut copied, mut open) = (0, false);
for (i, ch, depth) in crate::shortcut_editor::outside_quotes(params) {
let before = params.get(copied..i).unwrap_or_default();
match ch {
'{' | '[' | '(' if depth == 0 && (ch == '{' || before.trim_end().ends_with('→')) => {
out.push_str(before);
(copied, open) = (i, true);
}
'}' | ']' | ')' if depth == 1 && open => {
let kept = out.trim_end().strip_suffix('→').unwrap_or(&out).len();
out.truncate(kept);
out.push(' ');
(copied, open) = (i + ch.len_utf8(), false);
}
_ => {}
}
}
out.push_str(params.get(copied..).unwrap_or_default());
let text = out.split_whitespace().collect::<Vec<_>>().join(" ");
// A cut inside a word drops the rest of that word, so no part of a word is read as a word.
let Some((head, rest)) = text.char_indices().nth(DESCRIPTION_CHARS).and_then(|(end, _)| text.split_at_checked(end)) else { return text };
let head = if rest.starts_with(' ') { head } else { head.rsplit_once(' ').map_or("", |(kept, _)| kept) };
head.trim_end().to_string()
}
/// The lowercase words of the lowercased `description` the index holds: split at every character
/// that is not a letter, a digit or an apostrophe, without apostrophes at either end, and leaving
/// out words of 2 characters or fewer, words with no letter and [`STOP_WORDS`].
fn description_words(description: &str) -> impl Iterator<Item = &str> {
description
.split(|c: char| !(c.is_alphanumeric() || c == '\''))
.map(|w| w.trim_matches('\''))
.filter(|w| w.chars().count() > 2 && w.chars().any(char::is_alphabetic) && !STOP_WORDS.contains(w))
}
/// `name` without the id that follows it when the result shows its id.
fn without_id<'a>(name: &'a str, id: &str) -> &'a str {
name.strip_suffix(')').and_then(|n| n.strip_suffix(id)).and_then(|n| n.strip_suffix(" (")).unwrap_or(name)
@@ -172,9 +344,12 @@ impl Index {
/// The index of `entries`, whose menu homes and menu items read `homes` in the UI language. The
/// words of a result's menu home and of its menu item's label count as menu path words. The
/// words of the English names, menu home and menu item label also add their English stem forms
/// ([`stems`]); words in the UI language do not. A catalog with more results than a posting can
/// name gets an empty index, and queries match by the substring rule alone.
pub(crate) fn build(entries: &[Entry], homes: &[Option<String>]) -> Index {
/// ([`stems`]); words in the UI language do not. `params` gives each result's params text, whose
/// [`description`] adds its words ([`description_words`]) and their stem forms; only the words
/// are kept. `search_row` gives the UI language's words for a group of words with the same
/// meaning ([`synonym_groups`]). A catalog with more results than a posting can name gets an
/// empty index, and queries match by the substring rule alone.
pub(crate) fn build(entries: &[Entry], homes: &[Option<String>], params: &[&str], search_row: impl Fn(&str) -> Option<String>) -> Index {
if entries.len() > usize::from(u16::MAX) {
return Index::default();
}
@@ -211,12 +386,18 @@ impl Index {
for id in ids(e) {
found.extend(words(id).map(|w| (w.to_string(), entry, ID)));
}
if let Some(text) = params.get(i).filter(|p| !p.is_empty()) {
for w in description_words(&description(text).to_lowercase()) {
found.push((w.to_string(), entry, DESCRIPTION));
found.extend(stems(w).into_iter().map(|s| (s, entry, DESCRIPTION_STEMMED)));
}
}
let len = u16::try_from(initials_text.len() - start).unwrap_or(0);
initials.push((u32::try_from(start).unwrap_or(0), len));
}
found.sort_unstable();
found.dedup();
let mut index = Index { initials_text, initials, ..Index::default() };
let mut index = Index { initials_text, initials, synonyms: synonym_groups(search_row), ..Index::default() };
let mut last: Option<&str> = None;
for (word, entry, field) in &found {
if last != Some(word.as_str()) {
@@ -253,6 +434,8 @@ impl Index {
+ self.postings.capacity() * std::mem::size_of::<Posting>()
+ self.initials_text.capacity()
+ self.initials.capacity() * std::mem::size_of::<(u32, u16)>()
+ self.synonyms.capacity() * (std::mem::size_of::<(Box<str>, u16)>() + 1)
+ self.synonyms.keys().map(|w| w.len()).sum::<usize>()
}
/// The text of the word at `(offset, len)` in `term_text`.
@@ -273,10 +456,11 @@ impl Index {
self.terms.binary_search_by(|t| self.text(t).cmp(text)).ok()
}
/// The best grade ([`LABEL_WORD`] to [`ID_WORD`]) `word` gets in each result, [`NONE`] where it
/// is no word, shares no English stem form with a word of the label or menu path, and starts no
/// word of the result. The words it starts are found by a binary search of the sorted words; a
/// stem form matches only a word or stem form equal to it.
/// The best grade ([`LABEL_WORD`] to [`DESCRIPTION_WORD`], without [`SUBSTRING`]) `word` gets in
/// each result, [`NONE`] where it is no word, shares no English stem form with a word of the
/// label, menu path or description, means the same as none of them, and starts no word of the
/// result. The words it starts are found by a binary search of the sorted words; a stem form
/// matches only a word or stem form equal to it.
fn grades(&self, word: &str, n: usize) -> Vec<u8> {
let mut out = vec![NONE; n];
let mut mark = |postings: &[Posting], grade: &dyn Fn(u8) -> Option<u8>| {
@@ -301,19 +485,22 @@ impl Index {
LABEL if whole => Some(LABEL_WORD),
LABEL => Some(LABEL_PREFIX),
PATH => Some(PATH_WORD),
DESCRIPTION => Some(DESCRIPTION_WORD),
ID => Some(ID_WORD),
_ => None,
});
}
// The word meets a stem form of a word of the result ("scale" and Scaling) when it is itself
// a word of some result, so a partly typed word ("scal") that only equals a stem form does
// not lift Scaling above Scale.
// a word of some result's label, menu path, id or description, so a partly typed word
// ("scal") that only equals a stem form does not lift Scaling above Scale. A description is
// cut at the end of a word ([`description`]), so it holds no partly typed word.
if let Some(t) = self.find(word)
&& self.postings_of(t).iter().any(|p| matches!(p.field, LABEL | PATH | ID))
&& self.postings_of(t).iter().any(|p| matches!(p.field, LABEL | PATH | ID | DESCRIPTION))
{
mark(self.postings_of(t), &|field| match field {
LABEL_STEMMED => Some(LABEL_STEM),
PATH_STEMMED => Some(PATH_WORD),
DESCRIPTION_STEMMED => Some(DESCRIPTION_WORD),
_ => None,
});
}
@@ -324,12 +511,88 @@ impl Index {
mark(self.postings_of(t), &|field| match field {
LABEL | LABEL_STEMMED => Some(LABEL_STEM),
PATH | PATH_STEMMED => Some(PATH_WORD),
DESCRIPTION | DESCRIPTION_STEMMED => Some(DESCRIPTION_WORD),
_ => None,
});
}
// Each other word of the word's group of words with the same meaning ([`Index::synonyms_of`])
// meets a word of the label, menu path or description, or a stem form of one, equal to it.
// Ids are not matched this way.
for t in self.synonyms_of(word) {
mark(self.postings_of(t), &|field| match field {
LABEL | LABEL_STEMMED => Some(LABEL_SYNONYM),
PATH | PATH_STEMMED => Some(PATH_SYNONYM),
DESCRIPTION | DESCRIPTION_STEMMED => Some(DESCRIPTION_WORD),
_ => None,
});
}
out
}
/// The other words of the group of words with the same meaning that `word`, or a stem form of
/// it, is in ("bg" and background, "flipped" and reflect), as places in `terms`; the words of the
/// group no result holds are left out.
fn synonyms_of(&self, word: &str) -> Vec<usize> {
let group = std::iter::once(word.to_string()).chain(stems(word)).find_map(|w| self.synonyms.get(w.as_str()).copied());
let Some(group) = group else { return vec![] };
let mut found: Vec<usize> = self.synonyms.iter().filter(|&(w, &g)| g == group && &**w != word).filter_map(|(w, _)| self.find(w)).collect();
// The map's order changes from one build to the next; the words' order in `terms` does not.
found.sort_unstable();
found
}
/// The words of labels and menu paths that `word` is a typo of: within [`typo_bound`] edits of
/// it ([`edits_within`]), at most [`TYPO_TERMS`], nearest first, as places in `terms`. Ids and
/// words with letters of a script written without spaces ([`spaceless`]) are not compared.
fn typos(&self, word: &str) -> Vec<usize> {
let Some(bound) = typo_bound(word) else { return vec![] };
let word: Vec<char> = word.chars().collect();
let mut term: Vec<char> = vec![];
let mut near: Vec<(usize, usize)> = vec![];
for (t, at) in self.terms.iter().enumerate() {
let text = self.text(at);
if text.chars().count().abs_diff(word.len()) > bound || text.chars().any(spaceless) {
continue;
}
term.clear();
term.extend(text.chars());
if let Some(edits) = edits_within(&word, &term, bound)
&& self.postings_of(t).iter().any(|p| matches!(p.field, LABEL | PATH))
{
near.push((edits, t));
}
}
near.sort_unstable();
near.truncate(TYPO_TERMS);
near.into_iter().map(|(_, t)| t).collect()
}
/// Gives each result a word of `near` ([`Index::typos`]) is a word of its label or menu path
/// [`LABEL_TYPO`] or [`PATH_TYPO`] in `grades`, where its grade is not better. A typo replaces
/// [`DESCRIPTION_WORD`], since a result found only by its description ranks below one found
/// through a typo ([`rank`]).
fn mark_typos(&self, near: &[usize], grades: &mut [u8]) {
for &t in near {
for p in self.postings_of(t) {
let grade = match p.field {
LABEL => LABEL_TYPO,
PATH => PATH_TYPO,
_ => continue,
};
if let Some(g) = grades.get_mut(usize::from(p.entry)) {
*g = if *g == DESCRIPTION_WORD { grade } else { (*g).min(grade) };
}
}
}
}
/// The text of the first word of `near` that is a word of result `i` in one of `fields` (its
/// label or its menu path, and their stem forms).
fn nearest_of(&self, near: &[usize], i: usize, fields: &[u8]) -> Option<&str> {
let t = near.iter().find(|&&t| self.postings_of(t).iter().any(|p| usize::from(p.entry) == i && fields.contains(&p.field)))?;
self.terms.get(*t).map(|at| self.text(at))
}
/// Is `query` (no spaces) the initials of one of result `i`'s labels?
fn initials_are(&self, i: usize, query: &str) -> bool {
let Some(&(offset, len)) = self.initials.get(i) else { return false };
@@ -379,18 +642,29 @@ fn phrase(e: &Entry, query: &str, initials: bool) -> u8 {
NO_PHRASE
}
/// What results are ordered by, compared field by field: how the whole query matches, the worst
/// grade a word gets, the sum of the grades, the kind of result and the label's length.
type RankKey = (u8, u8, u32, u8, usize);
/// What results are ordered by, compared field by field: whether a word matched only through a
/// description, whether a word matched only through a typo, how the whole query matches, the worst
/// grade a word gets, the sum of the grades, how the whole query matches when read with the words
/// of the same meaning it matched through, the kind of result and the label's length.
type RankKey = (bool, bool, u8, u8, u32, u8, u8, usize);
/// The results of `entries` that the lowercased `query` matches, best first, as places in
/// `entries`. A result matches when every word of the query is text in one of its names or ids
/// (the rule the palette always had, so nothing it found is lost), when every word of the query is
/// or starts a word of its label, menu path or id or shares an English stem form with a word of its
/// label or menu path ("rounded corners" for Round Corners…), or when the query is the initials of
/// a label ("ea" for Export As…). Results are ordered by how the whole query matches ([`phrase`]),
/// then by the worst grade a word gets, the sum of the grades, the kind of result ([`kind`]), the
/// label's length and the catalog order. An empty query lists every result in catalog order.
/// or starts a word of its label, menu path, description ([`description`]) or id, shares an English
/// stem form with a word of its label, menu path or description ("rounded corners" for Round
/// Corners…) or means the same as a word of its label, menu path or description ("remove bg" for
/// Remove Background…), or when the query is the initials of a label ("ea" for Export As…). A query
/// word that is no word, stem form or word start of any result's label, menu path or id also
/// matches the words of labels and menu paths it is a typo of ([`Index::typos`]).
/// Results where a word matched only through a description come after every other result. Before
/// them, results where a word matched only through a typo come after every other result, and their
/// whole-query match is read with each such word replaced by the word it is a typo of ("gruop" as
/// "group"). Results are ordered by that, by how the whole query matches ([`phrase`]), then by the
/// worst grade a word gets, the sum of the grades, how the whole query matches when read with each
/// word matched through a word of the same meaning replaced by that word ("colour" as "color"),
/// the kind of result ([`kind`]), the label's length and the catalog order. An empty query lists
/// every result in catalog order.
pub(crate) fn rank(entries: &[Entry], index: &Index, query: &str) -> Vec<u32> {
let query = normalize(query);
if query.is_empty() {
@@ -399,8 +673,39 @@ pub(crate) fn rank(entries: &[Entry], index: &Index, query: &str) -> Vec<u32> {
let spaced: Vec<&str> = query.split(' ').collect();
let head: String = query.chars().take(INDEX_CHARS).collect();
let tokens: Vec<&str> = words(&head).collect();
// Where each word starts in the query (`head` is its start), for reading the query with a typo
// corrected.
let starts: Vec<usize> = tokens.iter().map(|t| (t.as_ptr() as usize).saturating_sub(head.as_ptr() as usize)).collect();
let n = entries.len();
let indexed: Vec<Vec<u8>> = tokens.iter().map(|t| index.grades(t, n)).collect();
let mut indexed: Vec<Vec<u8>> = Vec::with_capacity(tokens.len());
let mut typos: Vec<Vec<usize>> = Vec::with_capacity(tokens.len());
let mut meanings: Vec<Vec<usize>> = Vec::with_capacity(tokens.len());
// After a word that is nothing in any result and a typo of nothing, a result is found only by
// the substring rule or its initials, where a typo grade changes nothing, so the later words are
// not compared.
let mut compare = true;
for (k, t) in tokens.iter().enumerate() {
// A repeated word is graded once.
if let Some(j) = tokens.iter().take(k).position(|u| u == t)
&& let (Some(grades), Some(near), Some(same)) = (indexed.get(j).cloned(), typos.get(j).cloned(), meanings.get(j).cloned())
{
indexed.push(grades);
typos.push(near);
meanings.push(same);
continue;
}
meanings.push(index.synonyms_of(t));
let mut grades = index.grades(t, n);
// A word that matches only words of descriptions is still compared with the words of labels
// and menu paths it may be a typo of.
let near = if compare && grades.iter().all(|&g| g == NONE || g == DESCRIPTION_WORD) { index.typos(t) } else { vec![] };
if near.is_empty() && grades.iter().all(|&g| g == NONE) {
compare = false;
}
index.mark_typos(&near, &mut grades);
indexed.push(grades);
typos.push(near);
}
// The index reads only the start of a longer query, so such a query matches by the substring
// rule, which reads all of it.
let fits = query.chars().count() <= INDEX_CHARS;
@@ -414,24 +719,80 @@ pub(crate) fn rank(entries: &[Entry], index: &Index, query: &str) -> Vec<u32> {
// Each word's grade, the worst and their sum; with initials, every word counts as a word
// the label starts, as the initials stand for every word of the label.
let (mut all_indexed, mut worst, mut sum) = (fits && !tokens.is_empty(), 0u8, 0u32);
for (grades, token) in indexed.iter().zip(&tokens) {
// The query as read for the whole-query match, with each word matched only through a typo
// replaced by the word of this result it is a typo of; and as read with each word matched
// through a word with the same meaning replaced by that word too.
let (mut typo, mut corrected, mut copied) = (false, String::new(), 0);
let mut described = false;
let (mut synonym, mut meant, mut meant_copied) = (false, String::new(), 0);
let splice = |out: &mut String, copied: &mut usize, k: usize, token: &str, word: &str| {
if let Some(&start) = starts.get(k)
&& let Some(between) = query.get(*copied..start)
{
out.push_str(between);
out.push_str(word);
*copied = start + token.len();
}
};
for (k, (grades, token)) in indexed.iter().zip(&tokens).enumerate() {
let mut g = grades.get(i).copied().unwrap_or(NONE);
if g == NONE {
all_indexed = false;
if e.haystack.contains(token) {
g = SUBSTRING;
}
if g > SUBSTRING && e.haystack.contains(token) {
g = SUBSTRING;
}
let g = if initials {
g.min(LABEL_PREFIX)
} else if g == NONE {
SUBSTRING
} else {
g
};
described |= g == DESCRIPTION_WORD;
let field = match g {
LABEL_TYPO => Some(LABEL),
PATH_TYPO => Some(PATH),
_ => None,
};
if let Some(field) = field {
typo = true;
if let Some(near) = typos.get(k).and_then(|near| index.nearest_of(near, i, &[field])) {
splice(&mut corrected, &mut copied, k, token, near);
splice(&mut meant, &mut meant_copied, k, token, near);
}
}
let fields: &[u8] = match g {
LABEL_SYNONYM => &[LABEL, LABEL_STEMMED],
PATH_SYNONYM => &[PATH, PATH_STEMMED],
_ => &[],
};
if !fields.is_empty() {
synonym = true;
if let Some(same) = meanings.get(k).and_then(|same| index.nearest_of(same, i, fields)) {
splice(&mut meant, &mut meant_copied, k, token, same);
}
}
let g = if initials { g.min(LABEL_PREFIX) } else { g.min(SUBSTRING) };
worst = worst.max(g);
sum += u32::from(g);
}
if !(substring || all_indexed || initials) {
continue;
}
let tier = phrase(e, &query, initials);
let tier = if typo {
corrected.push_str(query.get(copied..).unwrap_or_default());
phrase(e, &corrected, false)
} else {
phrase(e, &query, initials)
};
let meant_tier = if synonym {
meant.push_str(query.get(meant_copied..).unwrap_or_default());
phrase(e, &meant, false)
} else {
tier
};
let length = split_name(&e.shown).0.chars().count();
ranked.push(((tier, worst, sum, e.kind, length), place));
ranked.push(((described, typo, tier, worst, sum, meant_tier, e.kind, length), place));
}
ranked.sort_by_key(|&(key, place)| (key, place));
ranked.into_iter().map(|(_, place)| place).collect()
@@ -460,6 +821,10 @@ pub(crate) fn menu_homes(native: bool) -> HashMap<String, (String, &'static str)
match it {
menus::Item::Cmd(label, id, p) if !skip.contains(id) => {
out.entry(key(id, p)).or_insert_with(|| (path.join(" › "), *label));
// Window › Learn runs `window.learn`, which is a result of its own too.
if *id == "window.learn" {
out.entry((*id).to_string()).or_insert_with(|| (path.join(" › "), *label));
}
}
menus::Item::Sub(name, children) => {
path.push(name);
@@ -510,12 +875,19 @@ mod tests {
kind: kind(id, home.as_deref()),
home,
menu_item: "",
label_at: 0,
names_item: false,
}
}
/// `entries` with their index.
fn synthetic(entries: Vec<Entry>) -> Catalog {
let index = Index::build(&entries, &[]);
described(entries, &[])
}
/// `entries` with their index, the params text of each in `params`.
fn described(entries: Vec<Entry>, params: &[&str]) -> Catalog {
let index = Index::build(&entries, &[], params, |_| None);
Catalog { list: entries, index, ranked: std::sync::Mutex::new(None) }
}
@@ -704,6 +1076,299 @@ mod tests {
}
}
/// Edits are counted up to a bound: a changed, inserted or removed character, or two adjacent
/// characters swapped, is one edit, and words further apart than the bound give none.
#[test]
fn edits_are_counted_up_to_a_bound() {
let edits = |a: &str, b: &str, bound: usize| edits_within(&a.chars().collect::<Vec<_>>(), &b.chars().collect::<Vec<_>>(), bound);
for (a, b, bound, expected) in [
("group", "group", 1, Some(0)),
("gruop", "group", 1, Some(1)),
("elipse", "ellipse", 1, Some(1)),
("rectange", "rectangle", 2, Some(1)),
("eyedroper", "eyedropper", 2, Some(1)),
("recktanglee", "rectangle", 2, Some(2)),
("grop", "group", 1, Some(1)),
("grap", "group", 1, None),
("ab", "abcd", 1, None),
("ca", "abc", 2, None),
("abcd", "wxyz", 2, None),
("über", "uber", 1, Some(1)),
("", "ab", 2, Some(2)),
] {
assert_eq!(edits(a, b, bound), expected, "{a} {b}");
assert_eq!(edits(b, a, bound), expected, "{b} {a}");
}
assert_eq!(typo_bound("pen"), None);
assert_eq!(typo_bound("elip"), Some(1));
assert_eq!(typo_bound("rectang"), Some(1));
assert_eq!(typo_bound("rectange"), Some(2));
for w in ["群組群組", "かなかなか", "한국어단어", "zz群組"] {
assert_eq!(typo_bound(w), None, "{w}");
}
}
/// A query word with a typo finds a result whose label or menu path holds the word, below every
/// result matched without a typo, and a word that is a word or a word start of some result, a
/// word of fewer than 4 letters, an id and a word of a script written without spaces get no
/// typo matches.
#[test]
fn a_word_with_a_typo_finds_the_result() {
let c = synthetic(vec![entry("Zz Group", "a.one"), entry("Zz Cut", "b.two"), entry("Zz Rectangle", "c.three")]);
assert_eq!(ranked(&c, "gruop"), ["a.one"], "two letters swapped");
assert_eq!(ranked(&c, "gruop zz"), ["a.one"]);
assert_eq!(ranked(&c, "cutx"), ["b.two"]);
assert!(ranked(&c, "cux").is_empty(), "3 letters");
assert_eq!(ranked(&c, "recktanglee"), ["c.three"], "two edits in a longer word");
assert!(ranked(&c, "rectanglexxx").is_empty());
// Below a result whose name holds the word as text, and below one that holds it whole.
let c = synthetic(vec![entry("Zz Color", "a.one"), entry("Zz Bcolrb", "b.two")]);
assert_eq!(ranked(&c, "colr"), ["b.two", "a.one"]);
let c = synthetic(vec![entry("Color", "a.one"), entry("Zz Bcolrb", "b.two")]);
assert_eq!(ranked(&c, "colr"), ["b.two", "a.one"], "also when the word spelled right is the label");
let c = synthetic(vec![entry("Zz Color", "a.one"), entry("Zz Colr", "b.two")]);
assert_eq!(ranked(&c, "colr"), ["b.two"], "a word some result holds gets no typo matches");
// A word of the label before a word of the menu path.
let c = synthetic(vec![entry("Color › Zz Other", "a.one"), entry("Zz Color", "b.two")]);
assert_eq!(ranked(&c, "colr"), ["b.two", "a.one"]);
// Ids and words of scripts written without spaces.
let c = synthetic(vec![entry("Zz One", "group.one"), entry("物件 › 群組群組", "b.two")]);
assert!(ranked(&c, "gruop").is_empty());
assert!(ranked(&c, "群組群物").is_empty());
// A word of Latin letters followed by Han letters, one edit from "abcd", is not compared.
let c = synthetic(vec![entry("Zz Abc群", "a.one")]);
assert!(ranked(&c, "abcd").is_empty());
// The whole query is read with the word it is a typo of: "gruop" names Group as "group" does.
let c = synthetic(vec![entry("Group Selection Tool", "tool:groupSelection"), entry("Object › Group", "object.group")]);
assert_eq!(ranked(&c, "gruop"), ranked(&c, "group"));
assert_eq!(ranked(&c, "gruop").first().map(String::as_str), Some("object.group"));
// The rest of the query is read as typed, `›` included.
let c = synthetic(vec![entry("Object › Group Zz Tool", "tool:zz"), entry("Object › Group", "object.group")]);
assert_eq!(ranked(&c, "object › group"), ["object.group", "tool:zz"]);
assert_eq!(ranked(&c, "object › gruop"), ranked(&c, "object › group"));
// A label typo is read with the word of the label, even when a word of the menu path is
// nearer: "abcdefgh" reads as "abcdefyy" in the first, which is then its label.
let c = synthetic(vec![entry("Abcdefyy Zz", "tool:b"), entry("Abcdefgx › Abcdefyy", "a.one")]);
assert_eq!(ranked(&c, "abcdefgh"), ["a.one", "tool:b"]);
}
/// A query word with a typo meets at most 32 words, the nearest first, and a long word with no
/// match finds nothing.
#[test]
fn a_typo_meets_at_most_32_words() {
// 35 words one edit from the query and one word two edits from it, which sorts before them.
let near = ('a'..='z').chain('0'..='9').filter(|&ch| ch != 'q');
let mut entries: Vec<Entry> = near.enumerate().map(|(i, ch)| entry(&format!("Abcdefg{ch}"), &format!("a.n{i}"))).collect();
entries.insert(0, entry("Abcdeaxq", "far.one"));
let c = synthetic(entries);
let found = ranked(&c, "abcdefgq");
assert_eq!(found.len(), 32, "{found:?}");
assert!(!found.contains(&"far.one".to_string()));
let c = synthetic(vec![entry("Abcdeaxq", "far.one")]);
assert_eq!(ranked(&c, "abcdefgq"), ["far.one"], "two edits in a word of 8 letters");
assert!(ranked(&c, &"q".repeat(30)).is_empty());
}
/// On the English results, misspelled words list first the commands the word spelled right
/// lists first by labels, menu paths and ids (a typo does not match descriptions), the tool among
/// the first four, and a word of 3 letters is not read as a typo.
#[test]
fn misspelled_words_find_the_command() {
let c = catalog(Lang::EN, false);
let first = |q: &str| ranked(&c, q).first().cloned().unwrap_or_default();
assert_eq!(first("gruop"), "object.group");
let plain = Index::build(&c.list, &[], &[], |_| None);
let id = |&i: &u32| c.list.get(i as usize).map(|e| e.id.clone()).unwrap_or_default();
for (typo, word, tool) in [
("eyedroper", "eyedropper", "tool:eyedropper"),
("rectange", "rectangle", "tool:rectangle"),
("elipse", "ellipse", "tool:ellipse"),
("gruop", "group", "tool:groupSelection"),
] {
assert!(substring_rule(&c, typo).is_empty(), "{typo} matched nothing before");
let top = |q: &str| ranked(&c, q).into_iter().take(4).collect::<Vec<_>>();
let spelled_right: Vec<String> = rank(&c.list, &plain, word).iter().take(4).map(id).collect();
assert_eq!(top(typo), spelled_right, "{typo}");
assert!(place(&c, typo, tool).is_some_and(|p| p < 4), "{typo}: {:?}", ranked(&c, typo));
}
assert_eq!(first("pen"), "tool:pen");
assert!(place(&c, "pen", "file.open").is_some(), "Open… holds the text");
}
/// A query word finds a result whose label or menu path holds another word of its group of words
/// with the same meaning: below a result whose label holds the word itself, above one whose menu
/// path holds the word, and with a menu path word of the group last. A stem form of the query word
/// and of a result's word meet the group too; ids, word starts and words of no group do not.
#[test]
fn a_word_with_the_same_meaning_finds_the_result() {
let c = synthetic(vec![
entry("Delete › Zz Path", "d.four"),
entry("Remove › Zz Other", "c.three"),
entry("Zz Delete", "a.one"),
entry("Zz Remove", "b.two"),
]);
assert_eq!(ranked(&c, "remove"), ["b.two", "a.one", "c.three", "d.four"]);
assert!(ranked(&c, "remo zz").iter().all(|id| id != "a.one" && id != "d.four"), "a word start is not looked up");
let c = synthetic(vec![entry("Zz Reflect…", "a.one"), entry("Zz Reflecting", "b.two"), entry("Zz One", "reflect.one")]);
assert_eq!(ranked(&c, "flipped zz"), ["a.one", "b.two"], "stem forms on both sides, and no id");
let c = synthetic(vec![entry("Zz Unite", "a.one"), entry("Zz Merge", "b.two")]);
assert_eq!(ranked(&c, "merge"), ["b.two"], "merge is in no group");
assert_eq!(ranked(&c, "combine"), ["a.one"]);
// Among results that match equally well, the whole query read with the word of the same
// meaning ("colour" as "color") puts the label Color first, but never above a label that
// holds the query word itself.
let c = synthetic(vec![entry("Zz Color", "tool:zz"), entry("Color", "panel:color"), entry("Zz Colour", "c.three")]);
assert_eq!(ranked(&c, "colour"), ["c.three", "panel:color", "tool:zz"]);
}
/// A catalog row adds words in the UI language to a group, and a word that is not a single word
/// or that is a word of another group is left out.
#[test]
fn a_catalog_row_adds_words_to_a_group() {
let entries = || vec![entry("Zz Delete", "a.one")];
let row = |key: &str| (key == "remove, delete, erase, clear").then(|| "Entfernen, ganz weg, text".to_string());
let with = Catalog { list: entries(), index: Index::build(&entries(), &[], &[], row), ranked: std::sync::Mutex::new(None) };
assert_eq!(ranked(&with, "entfernen"), ["a.one"]);
assert!(ranked(&with, "ganz weg").is_empty(), "two words are left out");
assert!(ranked(&with, "text").is_empty(), "text stays in its own group");
let without = synthetic(entries());
assert!(ranked(&without, "entfernen").is_empty(), "only while the row's language is the UI language");
}
/// A description is the params text without the groups of its schema and result: one fixture
/// of each shape the params texts take.
#[test]
fn a_description_leaves_out_the_schema_and_the_result() {
for (params, expected) in [
// A schema, prose and a result.
("{a: 1, b?: bool (true)} make it so → {changed, ids}", "make it so"),
// A quoted brace inside a schema.
("{sep: \"}\" or \"{\" (\"}\")} split the text", "split the text"),
// A schema only.
("{radius: pt (10)}", ""),
// An empty schema, then prose with no arrow.
("{} choose the Corner Tool", "choose the Corner Tool"),
// Prose after the result.
("{from?: index} → {index}: moves the document", ": moves the document"),
// Nested braces and brackets.
("{a: {b: 1}, c: [x, {y}]} trims the path", "trims the path"),
// Alternative schemas.
("{id, dx} or {items: [{id}…], dx} move anchors", "or move anchors"),
// A result in brackets or parentheses, and a result written as words.
("{} → [name…] for the active document", "for the active document"),
("{id} → ({x, y}) its place", "its place"),
("{id} → its id.", "→ its id."),
// A group inside parentheses is text, and so is a group that is never closed.
("fits it (as {x} does) here", "fits it (as {x} does) here"),
("{a: 1 never closed", "{a: 1 never closed"),
// No group at all.
("plain words\n here", "plain words here"),
("", ""),
] {
assert_eq!(description(params), expected, "{params}");
}
// A long description ends at the end of a word.
let cut = description(&"word ".repeat(100));
assert!(cut.chars().count() <= DESCRIPTION_CHARS && cut.ends_with(" word"), "{cut}");
let cut = description(&format!("{}handles", "abcd ".repeat(59)));
assert!(cut.chars().count() <= DESCRIPTION_CHARS && cut.ends_with(" abcd"), "{cut}");
let whole = format!("{}handles", "abcd ".repeat(58));
assert_eq!(description(&whole), whole);
assert!(description_words("the and ids true false null of a 16 10pt x").eq(["10pt"]));
assert!(description_words("image's 'quoted' png").eq(["image's", "quoted", "png"]));
}
/// A word of a description finds the result as a whole word, a stem form, a word start or a word
/// with the same meaning, below a result that holds the word in its label or menu path or inside
/// a word. A schema's words, words left out of descriptions and typos do not find it.
#[test]
fn a_word_of_the_description_finds_the_result() {
let c = described(
vec![
entry("Zz Alpha", "a.one"),
entry("Zz Background", "b.two"),
entry("Zz Underbackground", "c.three"),
entry("Background › Zz Delta", "d.four"),
],
&["{corners?: bool (true)} make the background of the images transparent → {changed}", "", "", ""],
);
assert_eq!(ranked(&c, "transparent"), ["a.one"]);
assert_eq!(ranked(&c, "making images"), ["a.one"], "stem forms");
assert_eq!(ranked(&c, "transp"), ["a.one"], "a word start");
assert_eq!(ranked(&c, "background"), ["b.two", "d.four", "c.three", "a.one"]);
assert_eq!(ranked(&c, "bg"), ["b.two", "d.four", "a.one"], "a word with the same meaning");
assert_eq!(ranked(&c, "transparent background"), ["a.one"]);
assert!(ranked(&c, "corners").is_empty(), "a word of the schema");
assert!(ranked(&c, "changed").is_empty(), "a word of the result");
assert!(ranked(&c, "the").is_empty(), "a word left out");
assert!(ranked(&c, "trasnparent").is_empty(), "a typo");
assert!(synthetic(vec![entry("Zz Alpha", "a.one")]).index.find("transparent").is_none());
}
/// A result found only by its description ranks below a result found through a typo of a word
/// of its label: "centr" starts "centred" in a description and is a typo of "center". A result
/// matched both ways ranks as matched through the typo.
#[test]
fn a_description_match_ranks_below_a_typo() {
let c = described(vec![entry("Zz Beta", "b.two"), entry("Zz Center", "a.one")], &["{} keeps the art centred on the page", ""]);
assert_eq!(ranked(&c, "centr"), ["a.one", "b.two"]);
assert_eq!(ranked(&c, "zz centr"), ["a.one", "b.two"]);
let both = described(vec![entry("Zz Center", "a.one"), entry("Center", "c.three")], &["", "{} keeps the art centred on the page"]);
assert_eq!(ranked(&both, "centr"), ["c.three", "a.one"]);
}
/// On the English results, words of what a command does find it: "transparent background"
/// lists Remove Background… near the top, and "png" lists it below every result with png in its
/// name or menu path, while a word of its schema alone ("corners") does not list it.
#[test]
fn words_of_a_description_find_the_command() {
let c = catalog(Lang::EN, false);
let remove = "addon.image.removeBackground";
let text = super::super::params_texts(&c.list);
let at = c.list.iter().position(|e| e.id == remove).unwrap();
assert!(description(text[at]).starts_with("make the background of each image transparent"), "{}", description(text[at]));
assert!(substring_rule(&c, "transparent background").len() < ranked(&c, "transparent background").len());
assert!(place(&c, "transparent background", remove).is_some_and(|p| p < 3), "{:?}", ranked(&c, "transparent background"));
let png = ranked(&c, "png");
let below = png.iter().position(|id| id == remove).unwrap();
let named = |e: &Entry| names(e).chain(e.home.as_deref()).any(|n| n.to_lowercase().contains("png"));
let with_png: Vec<usize> = c.list.iter().filter(|e| named(e)).filter_map(|e| png.iter().position(|id| *id == e.id)).collect();
assert!(!with_png.is_empty() && with_png.iter().all(|&p| p < below), "{png:?}");
assert!(place(&c, "corners", remove).is_none());
assert!(place(&c, "corners", "effect:stylize.roundCorners").is_some_and(|p| p < 3), "{:?}", ranked(&c, "corners"));
}
/// On the English results, everyday words find commands whose names use another word, and a
/// result whose label holds a word with the same meaning as the query ranks above one that holds
/// the query only in its menu path.
#[test]
fn words_with_the_same_meaning_find_the_command() {
let c = catalog(Lang::EN, false);
let first = |q: &str| ranked(&c, q).first().cloned().unwrap_or_default();
let within = |q: &str, id: &str, n: usize| place(&c, q, id).is_some_and(|p| p < n);
for q in ["remove bg", "outline text", "flip", "combine", "vectorize", "colour"] {
assert!(substring_rule(&c, q).len() < ranked(&c, q).len(), "{q} finds more than before");
}
assert_eq!(first("remove bg"), "addon.image.removeBackground");
assert_eq!(first("outline text"), "type.createOutlines");
assert!(within("flip", "object.reflect", 3), "{:?}", ranked(&c, "flip"));
assert!(within("combine", "object.pathfinder.unite", 3), "{:?}", ranked(&c, "combine"));
assert!(ranked(&c, "vectorize").iter().take(3).any(|id| id.starts_with("imageTrace.")), "{:?}", ranked(&c, "vectorize"));
assert_eq!(first("colour"), "panel:color", "{:?}", ranked(&c, "colour"));
// A word that only starts other labels is in a group, and its labels follow the direct match.
assert_eq!(first("unite"), "object.pathfinder.unite");
assert!(place(&c, "unite", "object.slice.combine").is_some(), "{:?}", ranked(&c, "unite"));
assert!(place(&c, "delete", "view.guides.clear").is_some(), "{:?}", ranked(&c, "delete"));
assert!(place(&c, "settings", "edit.preferences").is_some(), "{:?}", ranked(&c, "settings"));
let merge = ranked(&c, "merge");
let unite = merge.iter().position(|id| id == "object.pathfinder.unite");
let named = |id: &String| c.list.iter().any(|e| &e.id == id && split_name(&e.shown).0 == "Merge");
assert!(merge.first().is_some_and(named), "{merge:?}");
assert!(unite.is_none() || merge.iter().rposition(named) < unite, "{merge:?}");
let (scale, vertical) = (place(&c, "type", "type.scaleTextAttributes"), place(&c, "type", "type.orientation.vertical"));
assert!(scale.is_some() && scale < vertical, "{scale:?} {vertical:?}");
}
/// The application menu of the native Mac menu bar holds the items [`menu_homes`] puts there,
/// under the same submenus.
#[test]
@@ -949,8 +1614,8 @@ mod tests {
assert_eq!(of("tool:pen"), None);
// The home's words find the result: Preferences… under the native bar's Settings.
let native_catalog = catalog(Lang::EN, true);
assert!(place(&native_catalog, "settings pref", "edit.preferences").is_some());
assert!(place(&c, "settings pref", "edit.preferences").is_none());
assert!(place(&native_catalog, "vectorcraft settings pref", "edit.preferences").is_some());
assert!(place(&c, "vectorcraft settings pref", "edit.preferences").is_none());
// The menu item's own label finds the result too: File › Exit runs Quit VectorCraft.
assert!(place(&c, "exit", "app.quit").is_some());
}
@@ -972,10 +1637,32 @@ mod tests {
let c = catalog(Lang::EN, false);
let built = started.elapsed();
let started = std::time::Instant::now();
let index = Index::build(&c.list, &[]);
let params = super::super::params_texts(&c.list);
let index = Index::build(&c.list, &[], &params, |_| None);
println!("catalog {built:?}, index alone {:?}, {} results, {} bytes", started.elapsed(), c.list.len(), index.bytes());
let started = std::time::Instant::now();
let without = Index::build(&c.list, &[], &[], |_| None);
println!("index without descriptions {:?}, {} bytes", started.elapsed(), without.bytes());
let long = "q".repeat(200);
for q in ["e", "ea", "select", "bring front", "zzzz", long.as_str()] {
let typos = "gruop elipse rectange eyedroper trasnform patern gradeint symbl";
let repeated = format!("{typos} ").repeat(3);
let queries = [
"e",
"ea",
"select",
"bring front",
"zzzz",
"eyedroper",
"gruop zz",
"remove bg",
"colour",
"transparent background",
"png",
typos,
repeated.as_str(),
long.as_str(),
];
for q in queries {
let started = std::time::Instant::now();
let runs = 100;
for _ in 0..runs {
+125
View File
@@ -0,0 +1,125 @@
//! Words that mean the same thing when searching the command palette: VectorCraft's own groups,
//! written for this table. A query word in a group also finds results whose label or menu path
//! holds another word of its group ([`super::search`]).
//!
//! A word that is the whole label of a command stays out of a group whose other words name a
//! different command: Merge is the label of Pathfinder and Live Paint commands that are not Unite,
//! and Mirror is the label of a repeat that is not Reflect…, so these are in no group. Insert is left
//! out too, since it starts the labels of type commands that are not Place…. A word that only starts
//! or ends other labels can be in a group, and a search for another word of its group also lists
//! those labels: "unite" lists Combine Slices after Unite, and "delete" lists Clear Guides. Plural and
//! verb forms that the search's English stem forms already join (round and rounded) are not groups.
//!
//! A catalog may add a group's words in its language with a row in the `search` context: the group's
//! English words joined by ", ", then that language's words joined by ", ". The words join the group
//! while that language is the UI language. No catalog has to have these rows. The search splits
//! labels into words only at spaces and punctuation, so in a language written without spaces a row's
//! word finds only a label that is that word alone.
/// The groups: lowercase single English words, at most `MAX_WORDS` in a group and `MAX_GROUPS`
/// groups, no word longer than [`MAX_CHARS`] characters and no word in two groups.
pub(crate) const GROUPS: &[&[&str]] = &[
&["remove", "delete", "erase", "clear"],
&["background", "bg"],
&["image", "picture", "photo", "img", "bitmap"],
&["text", "type"],
&["reflect", "flip"],
&["unite", "combine"],
&["trace", "vectorize"],
&["color", "colour"],
&["gray", "grey"],
&["grayscale", "greyscale"],
&["center", "centre"],
&["duplicate", "clone"],
&["zoom", "magnify"],
&["rotate", "turn", "spin"],
&["scale", "resize"],
&["opacity", "transparency"],
&["font", "typeface"],
&["preferences", "settings", "prefs"],
&["artboard", "canvas"],
&["swatch", "palette"],
&["eyedropper", "dropper"],
];
/// The most groups [`GROUPS`] may hold.
#[cfg(test)]
const MAX_GROUPS: usize = 60;
/// The most words a group may hold.
#[cfg(test)]
const MAX_WORDS: usize = 6;
/// The most characters a word may have.
pub(crate) const MAX_CHARS: usize = 20;
/// The context of a catalog row that adds a group's words in its language.
pub(crate) const CONTEXT: &str = "search";
/// The source text of group `group`'s row in a catalog: its words joined by ", ".
pub(crate) fn row_key(group: &[&str]) -> String {
group.join(", ")
}
/// The words of a catalog row's translation `text`, each trimmed and lowercased with its runs of
/// whitespace made one space, and whether each is a single word of at most [`MAX_CHARS`]
/// characters that the search can look up.
pub(crate) fn row_words(text: &str) -> impl Iterator<Item = (String, bool)> + '_ {
text.split(',').map(|w| {
let w = super::search::normalize(w);
let single = !w.is_empty() && w.chars().count() <= MAX_CHARS && super::search::is_one_word(&w);
(w, single)
})
}
/// What is wrong with a catalog's `search` row for `source` translated as `text`: a source that is
/// no group's [`row_key`], an empty word, a word that is not a single word, or a word that is a word
/// of another group.
#[cfg(test)]
pub(crate) fn row_problems(source: &str, text: &str) -> Vec<String> {
let Some(group) = GROUPS.iter().position(|g| row_key(g) == source) else {
return vec![format!("{source:?} is not a group")];
};
let mut problems = vec![];
for (w, single) in row_words(text) {
if w.is_empty() {
problems.push(format!("{source:?}: an empty word"));
} else if !single {
problems.push(format!("{source:?}: {w:?} is not a single word"));
} else if let Some(other) = GROUPS.iter().enumerate().find(|&(i, g)| i != group && g.contains(&w.as_str())) {
problems.push(format!("{source:?}: {w:?} is a word of {:?}", row_key(other.1)));
}
}
problems
}
#[cfg(test)]
mod tests {
use super::*;
/// The table keeps to its limits: groups, words per group, characters per word, and each word
/// lowercase, a single word and in one group only.
#[test]
fn the_groups_keep_to_their_limits() {
assert!(GROUPS.len() <= MAX_GROUPS, "{} groups", GROUPS.len());
let mut seen = std::collections::HashSet::new();
for group in GROUPS {
assert!((2..=MAX_WORDS).contains(&group.len()), "{group:?}");
for &w in *group {
assert!(w.chars().count() <= MAX_CHARS, "{w}");
assert_eq!(super::super::search::normalize(w), w, "{w} is lowercase");
assert!(super::super::search::is_one_word(w), "{w} is one word");
assert!(seen.insert(w), "{w} is in two groups");
}
}
}
/// A catalog row passes when it names a group and adds single words of no other group, and fails
/// otherwise.
#[test]
fn catalog_rows_are_checked() {
assert!(row_problems("remove, delete, erase, clear", "entfernen, löschen").is_empty());
assert_eq!(row_problems("remove, delete", "entfernen").len(), 1, "not a group's words");
assert_eq!(row_problems("remove, delete, erase, clear", "entfernen,, löschen").len(), 1, "an empty word");
assert_eq!(row_problems("remove, delete, erase, clear", "ganz entfernen").len(), 1, "two words");
assert_eq!(row_problems("remove, delete, erase, clear", "Text").len(), 1, "a word of another group once lowercased");
}
}
+101 -4
View File
@@ -3,7 +3,8 @@
//! shows the shape outlined in black and filled with white, under a red slash. Clicking a style applies it to the
//! selection (Alt-click adds it on top); Shift-click adds to the panel's selection every style from
//! the last one clicked without Shift through this one; Cmd/Ctrl-click adds or removes one;
//! double-click opens Graphic Style Options. Dragging a style moves it in the list, applies it
//! double-click opens Graphic Style Options. Dragging a style moves it in the list (dropped on
//! another style with Alt held, replaces that style with its look), applies it
//! to the art it is dropped on (`canvas::panel_drop`), or, dropped on New Graphic Style, adds a
//! copy of it and of the styles highlighted with it at the end of the list; art dragged off the
//! canvas or the Appearance panel's thumbnail dropped on the panel becomes a new style, and
@@ -368,6 +369,8 @@ struct Events {
new_from: Option<NodeId>,
/// Art or an appearance dropped on a style with Alt held: the style takes this object's look.
replaced: Option<(String, NodeId)>,
/// A style dropped on another with Alt held: the second (`.0`) takes the first's (`.1`) look.
restyled: Option<(String, String)>,
/// The style the right button is held on.
large: Option<usize>,
/// A style is dragged over a tile or row.
@@ -387,7 +390,8 @@ fn clicked(ui: &Ui, resp: &Response, name: &str) -> Option<Click> {
/// Clicks, drags and the right button on the tile or row `resp` of style `i` of `d` (`list`: rows
/// stack downwards). A drag from it carries the style ([`PanelDrag::GraphicStyle`]); a style
/// dragged over it lands before or after it by the pointer's half. Art (its first object) or the
/// dragged over it lands before or after it by the pointer's half, or with Alt held outlines it
/// and, released there, replaces it with the dragged style's look. Art (its first object) or the
/// Appearance panel's thumbnail held over it with Alt outlines it, and released there replaces the
/// style with that object's look; without Alt it is left to the list ([`zone_input`]).
fn cell_input(ui: &Ui, resp: &Response, d: &Document, i: usize, list: bool, ev: &mut Events) {
@@ -414,6 +418,11 @@ fn cell_input(ui: &Ui, resp: &Response, d: &Document, i: usize, list: bool, ev:
if moving == name {
// Dropped on itself: it stays where it is.
resp.dnd_release_payload::<PanelDrag>();
} else if alt_held(ui) {
widgets::drop_target_outline(ui, resp.rect);
if resp.dnd_release_payload::<PanelDrag>().is_some() {
ev.restyled = Some((name.clone(), moving.clone()));
}
} else {
let r = resp.rect;
let at = ui.input(|i| i.pointer.interact_pos()).unwrap_or(r.center());
@@ -531,6 +540,9 @@ fn act(app: &mut VectorcraftApp, ui: &Ui, s: &Shown, ev: Events, picker: bool) {
{
run(app, "graphicStyle.redefine", json!({ "name": name, "id": id.0 }));
}
if let Some((name, from)) = ev.restyled {
run(app, "graphicStyle.redefine", json!({ "name": name, "from": from }));
}
match ev.click {
Some(Click::Pick(name, _)) if picker => {
app.run("graphicStyle.apply", json!({"name": name, "add": alt_held(ui)})).ok();
@@ -1535,10 +1547,10 @@ mod tests {
assert_eq!(doc(&app).graphic_style("Red").unwrap().appearance, red.appearance, "{view:?}");
app.run("edit.undo", json!({})).unwrap();
// A style dragged onto Red with Alt moves and replaces nothing.
// A style dragged onto Red without Alt moves and replaces nothing.
let last = n.last().unwrap().clone();
egui::DragAndDrop::set_payload(&ctx, PanelDrag::GraphicStyle(last.clone()));
frame_at(&mut app, at, release(at, alt), alt);
frame_at(&mut app, at, release(at, none), none);
assert_eq!(names(&app)[0], last, "{view:?}");
assert_eq!(doc(&app).graphic_style("Red").unwrap().appearance, red.appearance, "{view:?}");
app.run("edit.undo", json!({})).unwrap();
@@ -1557,6 +1569,91 @@ mod tests {
}
}
/// A style dropped on another with Alt held replaces that style's look with its own: the
/// replaced style keeps its name, place and id, and its art follows, in one undo step; the
/// dragged style and its art stay as they are. Without Alt the style moves; dropped on itself
/// it does nothing.
#[test]
fn a_style_dropped_on_another_with_alt_replaces_that_style() {
let mut app = app();
let rect = app.session.active().unwrap().doc.layers[0].children().unwrap()[0].id;
app.run("paint.setFill", json!({"color": "#ff0000", "ids": [rect.0]})).unwrap();
app.run("graphicStyle.new", json!({"name": "Red", "id": rect.0})).unwrap();
app.run("graphicStyle.move", json!({"name": "Red", "to": 0})).unwrap();
app.run("shape.ellipse", json!({"x": 60, "y": 60, "width": 20, "height": 20})).unwrap();
let oval = app.session.active().unwrap().selection.objects[0];
app.run("paint.setFill", json!({"color": "#00ff00", "ids": [oval.0]})).unwrap();
app.run("graphicStyle.new", json!({"name": "Green", "id": oval.0})).unwrap();
let ctx = egui::Context::default();
let screen = Some(Rect::from_min_size(pos2(0.0, 0.0), vec2(260.0, 600.0)));
// One frame of the panel with `events` and `modifiers` held: whether a drop-target outline
// the size of one style's tile or row is drawn around `at`.
let frame_at = |app: &mut VectorcraftApp, at: egui::Pos2, events: Vec<egui::Event>, modifiers: egui::Modifiers| {
let events = std::iter::once(egui::Event::ModifiersChanged(modifiers)).chain(events).collect();
let mut out = ctx.run_ui(egui::RawInput { screen_rect: screen, events, ..Default::default() }, |ui| show(app, ui));
out.textures_delta.clear();
let accent = Tokens::get(&ctx).accent;
out.shapes.iter().any(|c| match &c.shape {
egui::Shape::Rect(r) => r.stroke.width == 1.5 && r.stroke.color == accent && r.rect.contains(at) && r.rect.height() < 45.0,
_ => false,
})
};
let release = |at: egui::Pos2, modifiers: egui::Modifiers| {
let up = egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers };
vec![egui::Event::PointerMoved(at), up]
};
let (none, alt) = (egui::Modifiers::default(), egui::Modifiers::ALT);
let doc = |app: &VectorcraftApp| app.session.active().unwrap().doc.clone();
let steps = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len();
let (red, green) = (doc(&app).graphic_style("Red").unwrap().clone(), doc(&app).graphic_style("Green").unwrap().clone());
let (red_fill, green_fill) = (red.appearance.fill_paint(), green.appearance.fill_paint());
assert_ne!(red_fill, green_fill);
// The first style: the top of the list's first row, or its first tile.
for (view, at) in [(View::SmallList, pos2(60.0, 9.0)), (View::Thumbnail, pos2(20.0, 20.0))] {
app.ui.graphic_styles_view = view;
frame_at(&mut app, at, vec![], none);
let n = names(&app);
assert_eq!(n[0], "Red", "{view:?}");
let before = steps(&app);
// Held over Red with Alt it is outlined; without Alt it is not (the insertion marker shows instead).
egui::DragAndDrop::set_payload(&ctx, PanelDrag::GraphicStyle("Green".into()));
assert!(!frame_at(&mut app, at, vec![egui::Event::PointerMoved(at)], none), "{view:?}: no outline without Alt");
assert!(frame_at(&mut app, at, vec![egui::Event::PointerMoved(at)], alt), "{view:?}: outlined with Alt");
assert_eq!((names(&app), steps(&app)), (n.clone(), before), "{view:?}: holding it there changes nothing");
// Released there with Alt: Red takes Green's look and keeps its name, place and id.
frame_at(&mut app, at, release(at, alt), alt);
let d = doc(&app);
assert_eq!(names(&app), n, "{view:?}: no style moves");
let g = d.graphic_style("Red").unwrap();
assert_eq!((g.id, &g.appearance), (red.id, &green.appearance), "{view:?}");
assert_eq!(d.node(rect).unwrap().appearance.fill_paint(), green_fill, "{view:?}: the linked rectangle follows");
assert_eq!(d.node(rect).unwrap().extras().graphic_style, Some(red.id), "{view:?}");
assert_eq!(d.graphic_style("Green").unwrap(), &green, "{view:?}: Green stays as it was");
assert_eq!(d.node(oval).unwrap().extras().graphic_style, Some(green.id), "{view:?}: the oval stays linked to Green");
assert_eq!(steps(&app), before + 1, "{view:?}: one undo step");
app.run("edit.undo", json!({})).unwrap();
let d = doc(&app);
assert_eq!(d.graphic_style("Red").unwrap(), &red, "{view:?}: undo restores the style");
assert_eq!(d.node(rect).unwrap().appearance.fill_paint(), red_fill, "{view:?}");
assert_eq!(d.node(rect).unwrap().extras().graphic_style, Some(red.id), "{view:?}");
// Red dropped on itself with Alt changes nothing and records nothing.
egui::DragAndDrop::set_payload(&ctx, PanelDrag::GraphicStyle("Red".into()));
frame_at(&mut app, at, release(at, alt), alt);
assert_eq!((names(&app), steps(&app)), (n.clone(), before), "{view:?}");
assert_eq!(doc(&app).graphic_style("Red").unwrap(), &red, "{view:?}");
// Without Alt, Green moves before Red and Red keeps its look.
egui::DragAndDrop::set_payload(&ctx, PanelDrag::GraphicStyle("Green".into()));
frame_at(&mut app, at, release(at, none), none);
assert_eq!(names(&app)[0], "Green", "{view:?}");
assert_eq!(doc(&app).graphic_style("Red").unwrap(), &red, "{view:?}");
app.run("edit.undo", json!({})).unwrap();
assert_eq!(names(&app), n, "{view:?}");
}
}
#[test]
fn shift_click_selects_a_range_and_cmd_click_adds_or_removes_one_style() {
let mut app = app();
+1 -1
View File
@@ -416,7 +416,7 @@ pub(super) fn arrow_doc(mut a: Option<Arrowhead>, start: bool, w: f64, h: f64) -
/// Draw an arrowhead preview (the head as the canvas draws it) in `r`: a line with the head at the
/// left (`start`) or right end.
fn paint_arrow(ui: &Ui, r: Rect, a: Option<&Arrowhead>, start: bool, color: Color32) {
pub(crate) fn paint_arrow(ui: &Ui, r: Rect, a: Option<&Arrowhead>, start: bool, color: Color32) {
if let Some(tex) = widgets::doc_preview(ui, &format!("arrow:{}:{start}", arrow_key(a)), r.size(), |w, h| arrow_doc(a.cloned(), start, w, h)) {
ui.painter().image(tex.id(), r, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), color);
}
+23
View File
@@ -20,6 +20,29 @@ fn marquee_selection_choices_are_saved_from_preferences() {
assert!(text.contains("Drag Direction"), "{text}");
}
/// Plug-ins & Scratch Disks › Plug-in Instruction Budget: shown with its choices, applied by OK,
/// saved with the UI state and read back from it when the app starts again.
#[test]
fn plugin_instruction_budget_shows_applies_and_restores() {
let mut a = app();
open(&mut a, Some("Plug-ins & Scratch Disks"));
let text = crate::tests_labels::painted_text(&mut a, |a, ui| show(a, ui.ctx()));
assert!(text.contains("Plug-in Instruction Budget") && text.contains("Normal"), "{text}");
a.ui.dialog.as_mut().unwrap().fields.insert("pluginInstructionBudget".into(), json!("large"));
confirm(&mut a).unwrap();
assert_eq!(a.session.prefs.plugin_instruction_budget, vectorcraft_engine::PluginBudget::Large);
let saved: Value = serde_json::from_slice(&serde_json::to_vec(&a.ui).unwrap()).unwrap();
assert_eq!(saved["engine_prefs"]["pluginInstructionBudget"], json!("large"));
let mut b = app();
b.ui.engine_prefs = saved["engine_prefs"].clone();
restore(&mut b);
assert_eq!(b.session.prefs.plugin_instruction_budget, vectorcraft_engine::PluginBudget::Large);
// A saved value this version doesn't offer reads as Normal, and the other preferences stay.
b.ui.engine_prefs = json!({"keyboardIncrement": 4, "pluginInstructionBudget": 7});
restore(&mut b);
assert_eq!((b.session.prefs.plugin_instruction_budget, b.session.prefs.keyboard_increment), (vectorcraft_engine::PluginBudget::Normal, 4.0));
}
#[test]
fn geometric_snapping_is_a_saved_smart_guides_preference() {
let mut a = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
+25 -6
View File
@@ -1017,14 +1017,10 @@ fn names_a_required_field(params: &str) -> bool {
!(f.is_empty() || f.starts_with('…') || f[end..].starts_with('=') || f[..end].split('|').all(|n| n.trim().ends_with('?')))
};
let Some(rest) = params.strip_prefix('{') else { return false };
let (mut depth, mut quoted, mut start) = (0usize, false, 0);
for (i, ch) in rest.char_indices() {
let mut start = 0;
for (i, ch, depth) in outside_quotes(rest) {
match ch {
'"' => quoted = !quoted,
_ if quoted => {}
'{' | '[' | '(' => depth += 1,
'}' if depth == 0 => return required(&rest[start..i]),
'}' | ']' | ')' => depth = depth.saturating_sub(1),
',' if depth == 0 => {
if required(&rest[start..i]) {
return true;
@@ -1037,6 +1033,29 @@ fn names_a_required_field(params: &str) -> bool {
false
}
/// Each character of `text` that is not a double quote or inside a pair of them, with its byte
/// offset and the number of `{`, `[` and `(` groups open before it. A closing `}`, `]` or `)` comes
/// with a count that includes the group it closes, and one with no group open counts none.
pub(crate) fn outside_quotes(text: &str) -> impl Iterator<Item = (usize, char, usize)> + '_ {
let (mut depth, mut quoted) = (0usize, false);
text.char_indices().filter_map(move |(i, ch)| {
if ch == '"' {
quoted = !quoted;
return None;
}
if quoted {
return None;
}
let before = depth;
match ch {
'{' | '[' | '(' => depth += 1,
'}' | ']' | ')' => depth = depth.saturating_sub(1),
_ => {}
}
Some((i, ch, before))
})
}
pub fn entry(key: &str) -> Option<Entry> {
entries().iter().find(|e| e.key == key).cloned()
}
+2 -2
View File
@@ -51,8 +51,8 @@ pub use drag::{
use dropdowns::combo_button_id;
pub(crate) use dropdowns::{combo, combo_menu, combo_menu_field_named, combo_named, field_focused_in, menu_min_width, popover_is_open};
pub use dropdowns::{
dropdown, dropdown_icon_names, dropdown_named, dropdown_names, dropdown_names_named, dropdown_with, dropdown_with_named, list_scroll_style,
menu_room, menu_scroll, panel_scroll, popover, set_menu_floor, strip_scroll,
dropdown, dropdown_icon_names, dropdown_icon_names_sized, dropdown_named, dropdown_names, dropdown_names_named, dropdown_with,
dropdown_with_named, list_scroll_style, menu_room, menu_scroll, panel_scroll, popover, set_menu_floor, strip_scroll,
};
#[cfg(test)]
pub(crate) use dropdowns::{menu_floor, menu_room_either};
+2 -1
View File
@@ -17,7 +17,8 @@ pub enum PanelDrag {
/// replaces the style it is dropped on with it (`graphicStyle.redefine`).
Appearance(vectorcraft_doc::NodeId),
/// A Graphic Styles panel style: art it is dropped on takes it (`graphicStyle.apply` with its
/// `ids`); the panel moves it to where it is dropped.
/// `ids`); the panel moves it to where it is dropped, or with Alt held replaces the style it is
/// dropped on with its look (`graphicStyle.redefine` with `from`).
GraphicStyle(String),
/// The selected art, dragged off the canvas with the Selection tool: the Graphic Styles panel
/// makes a style of the first object (`graphicStyle.new`), or with Alt held replaces the style
+15 -3
View File
@@ -50,11 +50,23 @@ pub fn dropdown_icon_names(
width: f32,
icon_size: f32,
icon: impl Fn(&Ui, Rect, usize, egui::Color32, bool),
) -> Option<usize> {
dropdown_icon_names_sized(ui, id, current, options, width, Vec2::splat(icon_size), icon)
}
/// [`dropdown_icon_names`] with icons of any size, for a picture wider than it is tall, such as a
/// line with an arrowhead.
pub fn dropdown_icon_names_sized(
ui: &mut Ui,
id: impl std::hash::Hash,
current: Option<usize>,
options: &[&str],
width: f32,
icon_size: Vec2,
icon: impl Fn(&Ui, Rect, usize, egui::Color32, bool),
) -> Option<usize> {
let icon = &icon;
let atom = move |i: usize, highlighted: bool| {
egui::Atom::paint(Vec2::splat(icon_size), move |ui, a| icon(ui, a.rect, i, a.fallback_text_color, highlighted))
};
let atom = move |i: usize, highlighted: bool| egui::Atom::paint(icon_size, move |ui, a| icon(ui, a.rect, i, a.fallback_text_color, highlighted));
let shown = match current.and_then(|i| options.get(i).map(|name| (i, *name))) {
Some((i, name)) => (atom(i, false), egui::RichText::new(name).size(12.0)).into_atoms(),
None => egui::RichText::new("").size(12.0).into_atoms(),
+25
View File
@@ -524,3 +524,28 @@ fn kerning_reads_parentheses_around_its_text_with_a_manual_value_too() {
assert_eq!(typed(automatic, "(1,5)"), Some(SpinPick::Value(1.5)), "a decimal comma, automatic: {automatic}");
}
}
/// Enter on text that reads as no number in a range field refuses it as a unit field does: the
/// field flashes and an open dialog is not confirmed with the old value.
#[test]
fn a_range_field_refuses_text_that_reads_as_no_number() {
let typed = |text: &str| {
let ctx = themed(Default::default());
let picked = std::cell::Cell::new(None);
let mut add = |ui: &mut Ui| {
if let Some(v) = range_field(ui, "count", 12.0, 0.0..=100.0, "", 0, 80.0) {
picked.set(Some(v));
}
};
arm_field_focus(&ctx, "count");
frame(&ctx, 0.0, vec![], &mut add);
frame(&ctx, 0.1, vec![], &mut add);
let enter = |pressed| egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed, repeat: false, modifiers: Default::default() };
frame(&ctx, 0.2, vec![egui::Event::Text(text.into()), enter(true), enter(false)], &mut add);
let refused = ctx.data_mut(|d| d.remove_temp::<bool>(dialog_reject_commit_flag())).unwrap_or(false);
(picked.get(), refused)
};
assert_eq!(typed("40"), (Some(40.0), false), "a number commits");
assert_eq!(typed("abc"), (None, true), "text that reads as no number is refused");
assert_eq!(typed("(10+5)*2"), (None, true), "parentheses the field doesn't read are refused");
}
+13 -1
View File
@@ -917,7 +917,19 @@ fn bounded_field_reading(
let stepped = step_value(ui, &resp, &mut buf, bounds, (read, show), step, &[]).map(|v| round_to(v, decimals));
let scrubbed = scrub::field(ui, id, rect, &buf, value, decimals, bounds);
if commit && buf != shown {
read(&buf)
let typed = read(&buf);
if typed.is_none() {
// Text that reads as no number is refused as [`unit_field_from`] refuses it: the field
// flashes, shows its value again, and an open dialog is not confirmed by this Enter.
let end = ui.input(|i| i.time + 0.25);
ui.data_mut(|d| {
d.remove::<String>(id);
d.insert_temp(id.with("invalid-flash"), end);
});
crate::widgets::reject_dialog_commit(ui.ctx());
ui.ctx().request_repaint();
}
typed
} else if let Some(v) = stepped.or(scrubbed).filter(|&v| Some(v) != value) {
Some(v)
} else if live && resp.changed() {
+3 -2
View File
@@ -1,6 +1,6 @@
# File format parity
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-17 · **Change:** minor (PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; 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` procLine truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (PDF export writes the document language as the catalog's `/Lang`, #3644; PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; 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-Line truncated
>
> Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865).
@@ -315,7 +315,7 @@ Gradient meshes in the editing data keep each point's own color where a patch's
| VectorCraft `.vectorcraft` / `.vctemplate` | — | yes | yes | lossless JSON, versioned, save down to v1; property-tested round trips (`format/tests/prop_format.rs`); documents with a lot of path data are written as compact JSON, about a fifth of the size (#1492); a save falls back to a plain fsync and to writing elsewhere and copying in when the folder refuses the usual steps (#1625, #1649, part of #1620; not confirmed on a real network share); the size limits on embedded data also apply to files read from memory (#1783), and saving over a private file on Unix leaves no readable temporary copy beside it (#1778); a dynamic symbol's type (`dynamic` on the symbol) and an instance's appearance changes to its art (`symbol_overrides`, each path at most 64 deep, counted against the object budget) are written only when set, so documents without them save as before (#4938) |
| Illustrator template `.ait` | open, save | yes | PDF-compatible only, from Save as Template (`.vctemplate` stays its default) | New from Template opens a saved `.ait` untitled with its layers and art (`tests_pdfedit.rs`) |
| Illustrator `.ai` | open, save | yes (PDF-compatible + editing-data structure with template layers and ruler guides, File Info) | PDF-compatible, or legacy version 7 (layers and groups) | see above; no real-file corpus |
| PDF | open, place, save | yes (authored ActualText in editable import, #6165; layers, masks, editable text, security, overprint, File Info from the XMP packet and the document information dictionary; Crop To › Trim takes the bleed box as the document's bleed; Import PDF pages as links opens each page as a placed document linked to it, on its own artboard, `tests/placed_document.rs`, and is checked when All is picked and cleared when Range is picked) | yes (presets, PDF/X-1a/3/4, layers, marks and bleed, ICC, fast web view, 1.3+; objects' URLs as link annotations, not in PDF/X) | fuzzed import; shared guarded writer and windowed reader ([pdf-backend.md](pdf-backend.md)), metadata, incomplete-content and dependency-source regressions; PDF text opens where the file draws it, glyph by glyph (#722: kerning or none, spacing per character, text rise as baseline shift, vertical writing, justified text boxes); alpha soft masks drawn as images import with the mask (#1551); a clip only counts as covering the page when its shape does (#1542); a PDF another app copied pastes as editable vector art (#1499); letter-spaced type on a path keeps its length and its glyph-by-glyph stroke comes in as one text object (#1586, #1585); a crafted name tree with shared nodes no longer takes exponential time on open (#1781); fonts named with hyphens (`Noto-Sans-Bold`) or with a composite font's CMap (`Name-Identity-H`) find the installed family; invisible text (rendering mode 3: a scanned page's recognized text) opens as type with no fill or stroke and saves back as invisible, searchable text (#2675); PDF/X-1a and X-3 flattening in a CMYK document keeps CMYK inks where it rasterizes (#2160); an image mask (`/ImageMask true`) painted in a solid color opens as a grayscale image colorized by that color, a spot color keeping its swatch and tint, so Fill and Recolor Artwork reach it, and the same mask painted again in another color keeps that color (#6313); an image in a Separation space opens as a grayscale image of its tints colorized by its ink at 100 % (a spot swatch, a process plate or Registration), its soft mask as its opacity mask (#6314); a DeviceN image of one colorant opens the same way, and one of process plates only (the ink `None` may be among them) opens in CMYK with each colorant's tint in its plate (#6348) 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. |
| PDF | open, place, save | yes (authored ActualText in editable import, #6165; layers, masks, editable text, security, overprint, File Info from the XMP packet and the document information dictionary; Crop To › Trim takes the bleed box as the document's bleed; Import PDF pages as links opens each page as a placed document linked to it, on its own artboard, `tests/placed_document.rs`, and is checked when All is picked and cleared when Range is picked) | yes (presets, PDF/X-1a/3/4, layers, marks and bleed, ICC, fast web view, 1.3+; objects' URLs as link annotations, not in PDF/X; the document language as the catalog's `/Lang` and XMP `dc:language`, #3644) | fuzzed import; shared guarded writer and windowed reader ([pdf-backend.md](pdf-backend.md)), metadata, incomplete-content and dependency-source regressions; PDF text opens where the file draws it, glyph by glyph (#722: kerning or none, spacing per character, text rise as baseline shift, vertical writing, justified text boxes); alpha soft masks drawn as images import with the mask (#1551); a clip only counts as covering the page when its shape does (#1542); a PDF another app copied pastes as editable vector art (#1499); letter-spaced type on a path keeps its length and its glyph-by-glyph stroke comes in as one text object (#1586, #1585); a crafted name tree with shared nodes no longer takes exponential time on open (#1781); fonts named with hyphens (`Noto-Sans-Bold`) or with a composite font's CMap (`Name-Identity-H`) find the installed family; invisible text (rendering mode 3: a scanned page's recognized text) opens as type with no fill or stroke and saves back as invisible, searchable text (#2675); PDF/X-1a and X-3 flattening in a CMYK document keeps CMYK inks where it rasterizes (#2160); an image mask (`/ImageMask true`) painted in a solid color opens as a grayscale image colorized by that color, a spot color keeping its swatch and tint, so Fill and Recolor Artwork reach it, and the same mask painted again in another color keeps that color (#6313); an image in a Separation space opens as a grayscale image of its tints colorized by its ink at 100 % (a spot swatch, a process plate or Registration), its soft mask as its opacity mask (#6314); a DeviceN image of one colorant opens the same way, and one of process plates only (the ink `None` may be among them) opens in CMYK with each colorant's tint in its plate (#6348) 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. |
| EPS | open, place, save | yes (own PostScript L3 interpreter, Illustrator EPS editing data structure) | yes (L2/L3, TIFF previews) | CIDFonts the file doesn't carry not drawn, but for those over a predefined CMap (`UniJIS-UCS2-H`, `90ms-RKSJ-H`, `GBK-EUC-H`, `KSCms-UHC-H`, `ETen-B5-H`), set as type in the font of the CIDFont's name, vertical over a `-V` CMap; a name that ends in the row-and-cell CMap `H` or `V` splits off the CMap only when the file defines the CIDFont of that name, the CIDFont is `Ryumin-Light` or `GothicBBB-Medium` (the Japanese CIDFonts a printer carries), or the name has a hyphen and an installed face that covers Japanese has it; name-keyed fonts in a FontSet set as type by name; #505; images encoded with `CCITTFaxDecode` (ITU-T T.4 Group 3 and T.6 Group 4, with `K`, `Columns`, `Rows`, `EndOfBlock`, `EndOfLine`, `EncodedByteAlign` and `BlackIs1`) draw, and damaged data keeps the rows decoded before its first damaged row; Type 42 (TrueType) fonts set type at its size (#1553); an embedded Type 1 font's encrypted part is read for its glyphs, which space its type, outline it and draw glyphs without a character, in plain and composite fonts; a Type 42 font that carries its TrueType font gives each code its character by its glyph name or, for names that say nothing (`/g12`), by the glyph's entry in the font's own character map, spaces its type by its own widths and draws glyphs that stand for no character from its outlines; the show operators' spacing along the baseline (`ashow`, `widthshow`, `xshow`, `yshow`, `xyshow`, and the moves of `kshow`'s procedure, run between each two characters) is kept on live type as tracking, so type in a font that isn't installed keeps the file's line lengths (spacing that moves characters off the baseline, as `yshow`, `xyshow` or a `kshow` procedure can, places each character as its own text object); composite (Type 0) fonts with the 8/8 mapping, as PDF-to-PostScript converters write two-byte fonts, draw a Type 42 descendant's glyphs from the TrueType outlines it carries and an embedded Type 1 descendant's from its charstrings, and set other descendants' characters as type at the composite font's size (other mappings are still set as type in the font of their name); CID-keyed fonts (`composefont`, `FMapType` 9 over a CMap built with the CIDInit operators or `Identity-H`/`Identity-V`; `bfchar` and `bfrange` mappings give a base-font descendant its codes or glyph names) draw the glyphs of the Type 0 CIDFonts (Type 1 charstrings in their `StartData` binary data or `GlyphDirectory`) and Type 2 CIDFonts (TrueType glyphs through `CIDMap`) they carry, and the CID-keyed fonts of a FontSet's Compact Font Format data (Type 2 charstrings); a clip only counts as covering the page when its shape does (#1542); an EPS another app copied pastes as editable vector art (`clipboard.importEps`, #1499); a stitched shading keeps its hard colour changes on import (#1654); sampled functions (type 0) interpolate between their samples, multilinearly or by cubics with `Order 3`, and a sampled axial or radial gradient has a stop at each sample; a gradient the page paints as a row of abutting one-colour strips (as Level 2 writers draw smooth shades) imports as one linear gradient, without the seams the strips leave when each is drawn alone; CMYK images, CMYK JPEGs included, keep their ink amounts on import, as from PDF, and the pixels a `MaskColor` or `ImageType 3` mask hides become a grayscale opacity mask; ruzstd 0.9.1 for compressed editing data (#1807, RUSTSEC-2026-0344) |
| PostScript `.ps` | open, place | yes (the EPS reader reads its first page; `.epsf` files open and place as EPS) | via Print to PostScript | `tests_epsimport.rs` |
| DCS 1.0 / 2.0 | place linked | place linked only (one image of the plates; spot plates as spot swatches; the composite's clipping path; each plate on its own ink in Separations Preview and print separations) | no | `crates/eps/src/dcs/tests.rs`, `crates/engine/src/tests/dcs.rs` |
@@ -383,6 +383,7 @@ Stop opacity on translated artboards remains outside this regression coverage.
| Date | Change | Summary |
|---|---|---|
| 2026-11-18 | minor | PDF export (#3644): the document language chosen in Document Setup is written as the catalog's `/Lang` (BCP 47, `en-US` by default) and as XMP `dc:language`; a language without a tag writes none. Scores and estimates unchanged. |
| 2026-11-17 | minor | PDF import (#8300): a glyph filled only (text rendering mode 0) right after one filled and stroked (mode 2) joined the stroked run and came in stroked too: `2 Tr (B) Tj 0 Tr (C) Tj` came in as `BC` stroked throughout. A glyph filled only now joins only a run drawn alike, so it starts a run of its own, filled only, in the same type object, and takes a stroke only when the file draws one over it (the #8015 matching); a word filled whole then stroked whole, and fill and stroke rendering glyph by glyph, still come in as one run filled and stroked. Tests: `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`, `glyphs_filled_and_stroked_one_by_one_stay_one_run`; scores and estimates unchanged. |
| 2026-11-17 | minor | PDF import (#8015 follow-up): type filled and stroked at less than full opacity is no longer joined into one type object, since the file composites the fill and the stroke apiece, darker where they overlap, while one object's opacity applies to both together; it stays a filled object and a stroked one, as a fill and stroke at different opacities already did. An upright glyph (vertical type) filled and stroked is no longer kept as an outline for a line that comes in as its outlines, as glyphs filled only weren't, so such a line can't lose them. The #8015 entries now say what is left: translucent type filled and stroked, and a `TJ` whose kerning starts a new line part way through, still come in as two objects. Tests: `translucent_fill_and_stroke_text_stays_two_objects`, `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled`; scores and estimates unchanged. |
| 2026-11-16 | minor | PDF import: fill and stroke rendering (text rendering modes 2 and 6) draws all the glyphs of a text-showing operator (`Tj`, `TJ`, `'`, `"`) filled, then the same glyphs stroked, so a word shown at once came in as two type objects: a stroke-only copy over a fill-only one. Each stroke is now matched, in order, to the glyph filled with the same placement (where, how large, how wide, slanted and turned) in the same font with the same text on the line, and only that glyph takes the stroke, so the word comes in as one type object, filled and stroked; glyphs stroked with another join part way through still split into runs of their own, and stroked type over no filled glyph (modes 1 and 5) stays stroke only (#8015; `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`, `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs`). Scores and estimates unchanged. |
+3 -2
View File
@@ -1,6 +1,6 @@
# Gaps
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups <g>, or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; 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: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313;Line truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (PDF export writes the document language as the catalog's `/Lang`, #3644; Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups <g>, or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; 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: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow documLine truncated
> Selection update (2026-11-11): path and compound-path interiors follow enabled non-None fill rows, including lower fills beneath a top None row (#6625). Hidden-only interiors miss; zero-opacity fills remain selectable. Cap/join follow-up (2026-11-12): hidden-fill and no-fill stroke hits must respect cap and join geometry; focused cap/join CPU regressions passed. Scores and estimates unchanged.
@@ -36,6 +36,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard
| Date | Change | Summary |
|---|---|---|
| 2026-11-18 | minor | G19: PDF export writes the document language chosen in Document Setup as the catalog's `/Lang` (its BCP 47 tag, `en-US` by default) and the XMP packet's `dc:language`, in exported and printed PDFs (#3644); `/MarkInfo` stays with tagged PDF (#3643). Scores and estimates unchanged. |
| 2026-11-16 | minor | G1: Recolor Artwork - native Lab entry in Color Picker, swatch libraries access in Color Picker, and row right-click context menu ("Pick from Swatches", "Limit to Library") (#4028); scores and estimates unchanged. |
| 2026-11-15 | minor | G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…, `ui.checkSpelling`, #4936) with Not in Dictionary sentence context, suggestions, Ignore, Ignore All, Change, Change All, Add to Dictionary, Done/Cancel, keyboard navigation, and one-step Undo/Redo; spell check complete; 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); estimate unchanged (3–13 h). |
@@ -869,7 +870,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
- **Missing:** AccessKit is on by default, so egui widgets reach screen readers, but custom panels, the canvas and its objects aren't described and nothing has been tested with VoiceOver, Narrator or Orca; keyboard-only canvas operation; high
contrast. Illustrator's own accessibility is limited, so this is mostly beyond parity.
- **Done:** PDF export writes `/ViewerPreferences << /DisplayDocTitle true >>` when File Info has a Document Title (or an explicit export title is supplied), so viewers and accessibility checkers use that title instead of the file name (#3646).
- **Done:** PDF export writes `/ViewerPreferences << /DisplayDocTitle true >>` when File Info has a Document Title (or an explicit export title is supplied), so viewers and accessibility checkers use that title instead of the file name (#3646). It writes the document language chosen in Document Setup as the catalog's `/Lang` (its BCP 47 tag, `en-US` by default) and the XMP packet's `dc:language`, so screen readers and checkers know the language (#3644). Tagged PDF (structure tree, `/MarkInfo`) is still missing (#3643).
- **Estimate:** 15–25 h.
## Highlighted-text Eyedropper (2026-10-21)
+23 -7
View File
@@ -724,7 +724,7 @@ ends the wait, so the sampler can be shown again. The BSDs and headless sessions
| `add_text` | `{text, x?, y?, width?, height?, fit?, fitMinPercent?, path?, mode?, pathEffect?, size?, font?, color?, justify?, vertical?}` | Point type at (x, y) (`justify`: `left`, `center` or `right` starts, centres or ends each line on x); area type with `width`/`height` (`fit`: `none`, `autoHeight`, `shrinkText`, as `text.areaOptions`); or `path` + `mode` (`area`/`onPath`) to flow text in or along a path, with `pathEffect` for type on a path (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`; SVG export writes type on a path with any effect other than `rainbow` as outlines, with a warning). An invalid effect is rejected before editing. `justify` (also `auto`, `justifyAll`) aligns the paragraphs of every kind, as `text.setStyle` does later. `vertical: true` uses the existing vertical writing mode for every kind (default `false`, horizontal). Returns `{id}`, with `overflow: true` when the text doesn't fit its frame or path. |
| `apply_effect` | `{effect?, params?, ids?}` | Appends a live effect. Without `effect`, returns the effect catalogue with parameters and defaults. |
| `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). In remote desktop mode, `run_command` and `invoke_menu` can both call `pathfinder.repeat` with `{}`. Successful panel operations, direct `object.pathfinder.*` commands, and `command.batch` steps (including Actions panel playback) set its history. Repeat applies it to the current selection using current Pathfinder Options. Trap, compound-shape edits, live effects and `action.batch` do not set history. With no history it returns "no Pathfinder operation applied yet". |
| `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. `rotate` is in degrees counter-clockwise; a positive `shear` moves the top to the right. With `copy`, the first step duplicates. |
| `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. `rotate` is in degrees counter-clockwise; a positive `shear` moves the top to the right. With `copy`, the first step duplicates. A `scale`, `reflect` or `shear` that its command would refuse returns that error before any step runs; nothing changes and no undo step is recorded. |
| `create_graph` | `{type?, x, y, width, height, csv? \| series?, categories?, rows?}` | The nine Illustrator graph types: column, stacked column, bar, stacked bar, line, area, scatter, pie and radar. An empty CSV cell or a `null` in `rows` is a blank value; a number in straight quotes is a label. Edit later with `graph.setData` / `graph.setType` via `run_command`. `graph.column {design, columnType: vertical\|uniform\|repeating\|sliding, each, fractions: chop\|scale}` draws the columns or bars of the series picked with Group Selection (or `seriesIndexes`, or all of them) with a graph design saved by `graph.design`; with no `design` it returns the series' current design and options. Type in the design that holds a `%` followed by two digits shows each column's value, with at least the first digit's places before the decimal point and the second digit's places after it. |
| `text_wrap` | `{ids?, offset?, invert?, release?}` | Area type below the objects (same layer) flows around them. `offset` is in points, from -1000 to 1000 (default 6). An offset outside that range or not a number, or an `invert` or `release` that is not true or false, is an error and changes nothing; `object.textWrap.make` and `object.textWrap.options` refuse the same values. |
| `undo` / `redo` | `{}` | Many calls that change nothing record no undo step, for example `object.align` with nothing to move, `object.move` by 0 without `copy` and `object.showAll` with nothing hidden. `undo` (`edit.undo`) after such a call undoes the step before it. Settings that change without an undo step stay as they are when `undo` or `redo` brings back a step that did not change them: the perspective grid's view options and active plane, the grid preferences (`gridlineEvery`, `gridSubdivisions`), the export settings (`assets.settings.set`), and the current brush and symbol. A step that changed one of them, such as a perspective grid preset that shows the grid, takes that change back. The point Automatic Plane Positioning holds comes back with the step, and is let go when the active plane kept is another one. `inspect_document` lists the undo steps as `history`. `run_command` with `edit.clearHistory` removes every undo and redo step of the active document and returns `{cleared}`, the number of steps removed; the document stays as it is, and the command records no undo step. `run_command` with `edit.newDocumentFromState` and `{index?, created?}` makes a new document holding the art as it was at that state and makes it the active document, and returns `{index, title}`. `index` is a row of the History panel, with 0 the oldest state kept, and an omitted or null `index` uses the current state. An `index` that names no state fails with `no history state N`, one that is not a whole number with `` `index` must be a whole number ``, and either changes nothing. `created` is File Info's created date in Unix seconds or null, and defaults to now. The new document takes the next `Untitled-N` name, is marked unsaved, has nothing selected and has no steps to undo or redo. It is out of symbol, opacity-mask and pattern editing, and the art drawn in a pattern's tile is stored in the pattern, as `object.pattern.done` stores it. The source document and its steps stay as they are, except that typing or a drag in progress is first kept as a step. When a command keeps a drag whose preview Real-time Drawing off had not applied yet (`edit.undo`, `edit.redo`, `edit.clearHistory`, `edit.newDocumentFromState` and the other commands that end a drag first), and applying that preview gives a warning, the command's result carries it as `previewWarning`, and as `warning` too when the command gives no warning of its own; the app's status bar shows `warning`. While the Type tool edits type, `undo` and `redo` put its caret, with no characters selected, at the end of the text the step changed: after the text it puts back or retypes, or where the text it takes out was. A step that changes no characters, such as a formatting change, leaves the caret and the selection where they are. |
@@ -4631,8 +4631,14 @@ object's, type its characters'). `graphicStyle.apply {name, ids?}` gives the obj
style's look: editing their appearance or transparency breaks the link, and `graphicStyle.redefine {name?, id?}`
updates only the objects still linked. Art dragged off the canvas, or the Appearance panel's thumbnail, dropped on a
style in the Graphic Styles panel with Alt held runs `graphicStyle.redefine` with that style's `name` and the object's
`id` (the first object of the art); an object already linked to the style with its look changes nothing. The art of a
column or marker design in a graph series is never linked:
`id` (the first object of the art); an object already linked to the style with its look changes nothing.
`graphicStyle.redefine {name, from}` gives the style `name` the look of the style `from` instead (fills, strokes,
effects, opacity, blend mode, isolate and knockout): `name` keeps its name, place and id, its objects still linked
follow in one undo step, and `from` and its objects stay as they are. `from` naming the same style, or a style with
the same look, records nothing; a `from` that names no style or is not a string, or `from` with `id`, is an error. A
style dragged onto another in the Graphic Styles panel with Alt held runs it with the dragged style as `from`;
without Alt the style moves (`graphicStyle.move`). The art of a column or marker design in a graph series is never
linked:
`graphicStyle.new` can make a style from it, and `graphicStyle.redefine` leaves its look as it was and unlinks it,
whether it is the source or a linked object. `graphicStyle.list` returns each style with the ids linked to it and the
style of the first selected object; `select.same.graphicStyle` selects an object's fellow users.
@@ -6768,8 +6774,9 @@ and Shift steps follow the box the same way; a Reflect axis drawn with the tool
line on the page at that angle, counter-clockwise from horizontal, as `object.reflect`'s numeric `axis` is, and the art
slides along that line about `origin` by the shear `angle`, which stays a separate value. 0 shears as `"horizontal"`
and 90 as `"vertical"`. A numeric `axis` outside the range, a number given as a string, or any other value is an
error, and nothing changes. The shear `angle` is clamped to -89 through 89. The Shear dialog's Axis has Horizontal,
Vertical and Angle; the Axis Angle field beside it starts at 0° and takes input while Angle is chosen. The [help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/shear-objects.html)
error, and nothing changes. The shear `angle` runs from -359 to 359 along every axis and is sheared by its tangent;
±90 and ±270 are an error. The Shear dialog's Axis has Horizontal, Vertical and Angle; the Axis Angle field beside it
starts at 0° and takes input while Angle is chosen. The [help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/shear-objects.html)
describes the Angle axis as a custom slant direction between -359° and 359°, measured from the horizontal. The
counter-clockwise direction on the page and the 0° starting value are VectorCraft's own.
@@ -7288,8 +7295,12 @@ wide.
`object.align` needs `horizontal` or `vertical`. The three Align commands, `object.reflect` and `object.shear` return
an error that lists the choices of a `horizontal`, `vertical`, `to`, `axis` or `bounds` param given another value
(`object.reflect` and `object.shear` also take a numeric `axis` and name the value given; `object.shear`'s numeric
`axis` runs from -359 to 359, while its `angle` is clamped to -89 through 89), and one for a `spacing` that is not a
number; nothing moves.
`axis` runs from -359 to 359), and one for a `spacing` that is not a number; nothing moves. `object.shear` takes an `angle` from -359 to 359 degrees, the range of the
[Shear dialog](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/shear-objects.html),
and shears by its tangent, so 120 slants as -60. An angle of 0 or ±180 (within 1e-9 degrees) has no slant: without
`copy`, nothing moves and no undo step is recorded, and with `copy` the copies keep the art's place. It returns an error for an angle outside that range, and, as
VectorCraft's own rule, for ±90 and ±270 (within 1e-9 degrees), which have no finite shear; nothing moves and no undo
step is recorded.
## Glyph bounds for type
@@ -11918,6 +11929,10 @@ no file, and an import opens no document). A filter whose manifest asks for a he
`plugin.inspect {path | dataBase64}` entry) needs a person's approval, and `plugin.install` refuses `allowHeavy: true`
from a request. `plugin.run`
runs it where it is called, so the call may take minutes; `notifications/cancelled` stops it.
The preference `pluginInstructionBudget` (`normal`, the default, or `large`; `prefs.set` refuses any other value)
sets the instructions every object filter run gets: Large gives a light filter 250 M instructions instead of 50 M,
plus 4,000 per input byte either way, with its 60 s time budget unchanged; a heavy filter keeps its own budget with
either value. The next `plugin.run` or plug-in command uses the value set ([plug-ins](plugins.md#instruction-budget-preference)).
A plug-in whose manifest lists permissions (`permissions` in its `plugin.inspect` entry, with `needsApproval: true`)
needs a person's approval too, and `plugin.install` refuses `grant: [permission]` from a request. With a desktop
app connected, `ui.installPlugin` opens the approval dialog and returns `{pending: "pluginInstall"}`; `answer_dialog`,
@@ -12010,6 +12025,7 @@ Disable and Continue can't save the plug-in it turns off, this launch skips it a
{"name":"run_command","arguments":{"command":"plugin.setEnabled","params":{"id":"org.example.wobble","enabled":true}}}
{"name":"run_command","arguments":{"command":"plugin.install","params":{"path":"/plugins/desaturate.wasm"}}}
{"name":"run_command","arguments":{"command":"plugin.run","params":{"id":"org.vectorcraft.example.desaturate","params":{"amount":60}}}}
{"name":"run_command","arguments":{"command":"prefs.set","params":{"key":"pluginInstructionBudget","value":"large"}}}
{"name":"run_command","arguments":{"command":"effect.apply","params":{"effect":"plugin.org.example.wobble","params":{"size":4}}}}
{"name":"run_command","arguments":{"command":"document.open","params":{"path":"/tmp/plot.hpgl","importer":"plugin.org.example.hpgl"}}}
{"name":"run_command","arguments":{"command":"plugin.org.example.tidy.grow","params":{"by":3}}}
+17 -1
View File
@@ -126,7 +126,7 @@ defaults):
| Module size | 32 MiB | rejected |
| Linear memory | 512 MiB per instance (input and parameters: at most half) | `memory.grow` returns -1; oversized input or initial memory fails |
| Output | 64 MiB of JSON | `Limit("output size")` |
| Instructions (fuel) | 50 M per call + 4,000 per input byte for `vc_run`; a [heavy filter](#heavy-filters) 1 G + 4,000 per byte; an export or import 10 G + 4,000 per byte | `Limit("instruction budget")` |
| Instructions (fuel) | 50 M per call + 4,000 per input byte for `vc_run`; an object filter with the [Large instruction budget](#instruction-budget-preference) 250 M + 4,000 per byte; a [heavy filter](#heavy-filters) 1 G + 4,000 per byte; an export or import 10 G + 4,000 per byte | `Limit("instruction budget")` |
| Wall clock | 60 s per filter run, 5 s per live-effect run, 300 s per heavy filter run, export or import (checked every 20 M instructions; the web build reads the page's `performance.now()`) | `Limit("time budget")` |
| Import input | 128 MiB of the file (`vectorcraft_plugins::import::MAX_INPUT_BYTES`) | the file doesn't open; a larger file named by `path` is not read past that |
| Call depth | 1,024 frames | trap |
@@ -136,6 +136,22 @@ An export runs where the export runs: with Background Export on, on the export's
plug-in between two of those 20 M-instruction slices; nothing is written then. An import stops the same way when the
open it runs in is cancelled, and nothing opens then.
### Instruction budget preference
Preferences › Plug-ins & Scratch Disks › Plug-in Instruction Budget (`pluginInstructionBudget`, VectorCraft's own
setting) sets the instructions each object filter run gets, from the app, `plugin.run`, a plug-in's commands, scripts
and MCP alike:
- **Normal** (`normal`, the default): the limits in the table above, 50 M + 4,000 per input byte.
- **Large** (`large`): 250 M + 4,000 per input byte (`vectorcraft_plugins::LARGE_FUEL`, 5 times Normal). The 60 s time
budget, the memory, output and call depth limits stay as they are.
A [heavy filter](#heavy-filters) keeps its 1 G and 300 s with either choice. Live effects, exporters and importers keep
their own budgets. A change applies to the next run of every installed filter, without installing it again. Cancel and
the time budget stop a run between two 20 M-instruction slices with either choice. `prefs.set {key:
"pluginInstructionBudget", value}` takes `normal` or `large` (or the labels Normal and Large) and refuses any other
value; a saved preferences file with another value reads as Normal.
### Live effects while a document opens
While the app draws a document on screen, the live-effect runs of its first view share a 2,000 ms budget
+3 -2
View File
@@ -1,6 +1,6 @@
# Roadmap: milestones and what's next
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-17 · **Change:** minor (M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: 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 fixLine truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: 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 oLine truncated
>
> Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865).
>
@@ -59,6 +59,7 @@ M7 type: Touch Type moves a right-to-left character along its line and up from i
| Date | Change | Summary |
|---|---|---|
| 2026-11-18 | minor | M14: PDF export writes the document language (Document Setup) as the catalog's `/Lang` (#3644). Scores and estimates unchanged. |
| 2026-11-13 | minor | Graphic Styles: in a panel made taller the list fills the space above the footer instead of stopping at 220 pt (#2992; `the_list_fills_a_tall_panel_above_its_footer` in `crates/ui-egui/src/panels/graphic_styles.rs`). Scores and estimates unchanged. |
| 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. |
| 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. |
@@ -173,7 +174,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule
| M11 | Artboards & views (selected-set deletion shared by Artboards menu, trash and Properties, retaining artboard 1 when all are selected; Artboard deletion keys keep the first of an all-selected set and protect artwork; history prunes invalid indices while preserving valid multiselection (history tests and full workspace CI pass); click-to-fit objects with the Artboard tool (#1227), artboard escape routing and document setup modal handoff done; artboard panel/tool with Move Artwork for X/Y fields and Artboard Options, Trim View, middle-button pan, print tiling and the status bar's artboard navigator with synchronized Artboard tool selection done; Window › Arrange › Tile and Consolidate All Windows done; multiple windows, presentation polish) (cached canvas reprojection preserves scale during resize, rotation and DPI changes; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) (cached canvas dimensions match the renderer limit before cache-key creation, view construction and worker submission; regression-tested; estimates unchanged); status-bar pointer coordinates follow the active ruler origin and General units | 🟡; Artboard Options shares existing presets and orientation controls and can fit artwork without moving it; artwork fitting includes all drawn document art across artboards and off-board; artwork bounds are cached by active document and revision, and selection uses the shared bounds cache across artboards | 15–25 |
| M12 | Advanced color & art (CMYK/ICC, separations, Gradient Mesh, Live Paint, Image Trace, Graphs) | 🟡 Gradient Mesh, Live Paint, Image Trace (junction-returning pieces retain their positioned boundaries; a simpler contour walk with identical output; an edge's sub-pixel shift is the same from either side; notches read only their own piece; collapsed loops keep few segments; large images trace with a warning; Auto Color keeps rare distinct colours; quick presets trace at once and the Image Trace button opens the adjustment controls; Properties reopens them; tiny fitted contours retain islands and holes; Create Strokes: exact crop EDT, Guo–Hall thinning and maximal-disc graph simplification; 15 presets, the 14 documented ones each with an enhanced version; Ignore Color, Shapes, Auto Grouping and Gradients options; measured in `image-trace-quality.md`; closed outlines retain their interior after straightening; the Flat Logo mode places edges to a fraction of a pixel, restores sharp corners, snaps lines and circles, and refuses gradients; live trace result bounds and selection highlights exclude the retained bitmap except in source-image views), Recolor Artwork, colour management (ICC, soft proofing, separations preview), Graphs (all 9 tools, Graph Data/Type, group-selected series colours persist through regenerate/save/open) done; Graph Design and Marker designs, Transpose and Switch x/y, `\|` label line breaks, the pie options, drop shadows, the legend across the top, overlapping widths, First Row/Column in Front, filled lines, kept label formatting and the Graph Data worksheet done; graph Column designs pending; Vector Halftone Preview keeps the selection box without drawing dot selection marks (#6369); Live Paint Bucket fills faces crossed in one drag (#6373) | 6–10 |
| M13 | Automation (Actions ✅ record/playback, persisted; variables, scripting, batch) | 🟡 MCP `add_text` exposes existing vertical point, area and path type; `script.run` and File › Scripts › Other Script… run JavaScript files, and Window › Script Console shows their output; the script document model and batch work remain | 18–27 |
| M14 | 1.0 polish (preferences, shortcut editor, workspaces, accessibility, packaging for all OSes) (status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates; sample widths cached by language/unit/DPI; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) | 🟡 Icon-strip flyouts resize on their free edges and retain sizes (#5713); interim macOS cursor delivery (#2292) uses existing artwork and host-owned AppKit cursors; headless coverage only, native menu/focus/handback and display validation pending. Dock groups collapse to their tabs by a double-click on a tab (UI.8); Preferences › General › Constrain Angle acts for the arrow keys, Shift drags and new objects (#394, 2026-10-21); numeric-field pointer selection and focus regression-tested (#1326; a release more than 1 pt from the press keeps the caret, a tap within 1 pt selects all, #6659); RPM runtime capabilities and glibc floor checked (#1275; real-distro install/start-up pending), Eyedropper cursor with precise-setting checks (#1269), Preferences, shortcut editor (chords with Shift and a punctuation key fire as typed; other apps' text shortcut sets imported), workspaces (each keeps its layout changes until Reset <name>, UI.7), Window › Help Bar shown or hidden apart from the status bar and kept in saved workspaces, panels docked by dragging into any dock group (as tabs or a top/bottom split) or into the icon column, and closed from a dock tab's context menu (UI.6), a custom title bar on Windows/Linux with a Home button, content-sized dialogs, menus that scroll when longer than the window and macOS native menu dismissal done (M14.8), and native macOS save sheets with a Format menu (#866); titled PDF exports set `DisplayDocTitle` for viewers and accessibility checkers (#3646); accessibility and broader Windows/Linux packaging/QA pending; floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), with pointer and native-window regression coverage; estimates unchanged; numeric spinner arrows keep repeating while held with the mouse (#6307); Swatches item context menus tested in all five views and rendered layouts inspected; Linux full CI passed, Windows engine baseline limitations documented (G12) | 18–28 |
| M14 | 1.0 polish (preferences, shortcut editor, workspaces, accessibility, packaging for all OSes) (status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates; sample widths cached by language/unit/DPI; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) | 🟡 Icon-strip flyouts resize on their free edges and retain sizes (#5713); interim macOS cursor delivery (#2292) uses existing artwork and host-owned AppKit cursors; headless coverage only, native menu/focus/handback and display validation pending. Dock groups collapse to their tabs by a double-click on a tab (UI.8); Preferences › General › Constrain Angle acts for the arrow keys, Shift drags and new objects (#394, 2026-10-21); numeric-field pointer selection and focus regression-tested (#1326; a release more than 1 pt from the press keeps the caret, a tap within 1 pt selects all, #6659); RPM runtime capabilities and glibc floor checked (#1275; real-distro install/start-up pending), Eyedropper cursor with precise-setting checks (#1269), Preferences, shortcut editor (chords with Shift and a punctuation key fire as typed; other apps' text shortcut sets imported), workspaces (each keeps its layout changes until Reset <name>, UI.7), Window › Help Bar shown or hidden apart from the status bar and kept in saved workspaces, panels docked by dragging into any dock group (as tabs or a top/bottom split) or into the icon column, and closed from a dock tab's context menu (UI.6), a custom title bar on Windows/Linux with a Home button, content-sized dialogs, menus that scroll when longer than the window and macOS native menu dismissal done (M14.8), and native macOS save sheets with a Format menu (#866); titled PDF exports set `DisplayDocTitle` for viewers and accessibility checkers (#3646) and give the document language as the catalog's `/Lang` (#3644); accessibility and broader Windows/Linux packaging/QA pending; floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), with pointer and native-window regression coverage; estimates unchanged; numeric spinner arrows keep repeating while held with the mouse (#6307); Swatches item context menus tested in all five views and rendered layouts inspected; Linux full CI passed, Windows engine baseline limitations documented (G12) | 18–28 |
| — | Interaction fidelity pass (every tool's modifiers, Properties panel per context, isolation, nuance; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed) | ⬜ (new ruler-guide Alt orientation implemented; existing-guide Escape cancellation regression-tested; broader pass remains) | 60–90 |
| — | Hardening at scale (big-file corpus, fuzzing, cross-platform + browser QA) | 🟡 PngSuite integrity and bounded fetching verified (#1729); real-world corpus/manual QA remain | 50–80 |
| M14 follow-up | Color Picker layout (#2008) | ✅ Compact controls, centered header, stacked actions, aligned fields and screen sampling; narrow windows scroll vertically | Included above |
+12 -4
View File
@@ -1,6 +1,6 @@
# Parity with Adobe Illustrator
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-17 · **Change:** minor (Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: expliLine truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/cLine truncated
>
> Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5).
>
@@ -63,6 +63,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard
| Date | Change | Summary |
|---|---|---|
| 2026-11-18 | minor | Hardening: PDF export writes the document language (Document Setup) as the catalog's `/Lang` and XMP `dc:language` (#3644). Scores and estimates unchanged. |
| 2026-11-17 | minor | Distort & Transform › Twist: handles follow the rotation's derivative, so a strongly twisted path is a smooth spiral instead of pieces meeting at kinks (#7069; `twist_joins_its_pieces_smoothly` in `crates/effects/src/tests.rs`). Scores and estimates unchanged. |
| 2026-11-17 | minor | PDF import (#8300): a glyph filled only (text rendering mode 0) right after one filled and stroked (mode 2) joined the stroked run and came in stroked too: `2 Tr (B) Tj 0 Tr (C) Tj` came in as `BC` stroked throughout. A glyph filled only now joins only a run drawn alike, so it starts a run of its own, filled only, in the same type object, and takes a stroke only when the file draws one over it (the #8015 matching); a word filled whole then stroked whole, and fill and stroke rendering glyph by glyph, still come in as one run filled and stroked. Tests: `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`, `glyphs_filled_and_stroked_one_by_one_stay_one_run`; scores and estimates unchanged. |
| 2026-11-17 | minor | PDF import (#8015 follow-up): type filled and stroked at less than full opacity is no longer joined into one type object, since the file composites the fill and the stroke apiece, darker where they overlap, while one object's opacity applies to both together; it stays a filled object and a stroked one, as a fill and stroke at different opacities already did. An upright glyph (vertical type) filled and stroked is no longer kept as an outline for a line that comes in as its outlines, as glyphs filled only weren't, so such a line can't lose them. The #8015 entries now say what is left: translucent type filled and stroked, and a `TJ` whose kerning starts a new line part way through, still come in as two objects. Tests: `translucent_fill_and_stroke_text_stays_two_objects`, `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled`; scores and estimates unchanged. |
@@ -549,7 +550,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale)
| Libraries, Links, Package | 2 | 82% | the Libraries panel is local only (no cloud by design: libraries are files on this machine) and has no shared libraries, linked graphics or gradients and patterns as items yet; its graphics, colours and text styles (#745), its search, groups and library export/import as `.vclibrary` files (#926), a list that scrolls, with items and groups reordered by dragging and items dragged into and out of groups, art and swatches dragged in added where they are dropped, and items shown as icons or in a list with their names, are done; Links and Package are done; placed VectorCraft documents are done (linked by default, vectors in every output, previews, Break Link, Expand, Edit Original, refresh on save) | 2–3 |
| **Feature parity** | **103** | **~75%** | | **~210–330** |
| Interaction-fidelity pass (side by side with Illustrator: every tool modifier, cursor, dialog, Properties context) | | | | 60–90 |
| Hardening (big-file corpus, fuzzing, cross-platform and browser QA, accessibility, packaging) | | | Bounded control socket waits (#1726); PngSuite pinned-file integrity and download budgets verified (#1729); RPM runtime capabilities and glibc floor checked (#1275); titled PDF exports ask viewers to display the document title (#3646); real-distro installation/start-up QA pending | 50–80 |
| Hardening (big-file corpus, fuzzing, cross-platform and browser QA, accessibility, packaging) | | | Bounded control socket waits (#1726); PngSuite pinned-file integrity and download budgets verified (#1729); RPM runtime capabilities and glibc floor checked (#1275); titled PDF exports ask viewers to display the document title (#3646); PDF exports give the document language as the catalog's `/Lang` (#3644); real-distro installation/start-up QA pending | 50–80 |
| **Full parity** | | **~56%** | | **~320–500** |
_Inventories (2026-10-07):_ 13 menu items still stubbed (`todo(…)` in `crates/ui-egui/src/menus.rs`); every tool
@@ -636,6 +637,7 @@ since 2026-10-01.
**Drawing tools, Dimension tool second point without construction guides through a first point off the anchors:** By VectorCraft's own rule, with Smart Guides on, the second Linear point does not snap to the construction guides through a first point that is not on an anchor, so a click beside a segment straight below such a first point lands on the segment; after a first point picked on an anchor, the construction guides through it still apply. The second point still snaps to anchors, centers and alignment lines, and with Snap to Perpendicular or Snap to Tangent on, it lands where the line from the first point meets a segment square or grazes a curve. `a_point_on_a_guide_stays_on_the_guide`, `the_second_point_after_an_anchor_lands_on_construction_guides`, `the_second_point_lands_square_to_a_segment_or_grazing_a_curve` and `linear_picks_show_and_snap_to_smart_guides` cover it.
**Drawing tools, Dimension tool points land on dimensions already drawn (#8063):** By VectorCraft's own rule, with Smart Guides or Snap to Point on, a Linear point that no anchor of the art within 8 pixels takes lands on the end of a visible, unlocked dimension's dimension line, or on the far end of its extension line, within 8 pixels, and a point that nothing else places lands on the closest point of such a line within 8 pixels, so at any zoom a dimension can start where another one ends. The end of an extension line next to the point it measures does not pull points away from that anchor. With Smart Guides and Anchor/Path Labels on, a point on an anchor or line end shows the "anchor" label and a point on a segment or line shows the "path" label. `linear_picks_land_on_anchors_paths_and_drawn_dimensions` and `an_anchor_beside_a_drawn_dimension_takes_the_point` cover it.
**Drawing tools, Dimension tool dimensions selected with their art keep their lines and label:** Object › Expand, Object › Expand Appearance and Object › Path › Outline Stroke leave a dimension selected with art it measures, directly or in selected groups without fills, strokes or effects of their own, as it is and change only the other art; when the new art no longer fits its link, the dimension stays where it was, no longer linked, and undo links it again. `expand_leaves_a_dimension_selected_with_its_art_as_it_is`, `expand_appearance_leaves_a_dimension_selected_with_its_art_as_it_is`, `outline_stroke_leaves_a_dimension_selected_with_its_art_as_it_is`, `a_dimension_selected_with_art_that_has_nothing_to_expand_changes_nothing`, `a_group_effect_expanded_reaches_the_dimension_it_holds`, `expand_keeps_a_dimension_in_its_asset_and_its_variable_binding`, `a_dimension_keeps_no_link_to_the_art_expand_replaced`, `a_dimension_outlasts_the_art_outline_stroke_or_expand_appearance_replaced`, `a_dimension_outlasts_the_stroke_expand_outlined` and `expand_appearance_in_safe_mode_leaves_a_dimension_selected_with_its_art` cover it.
**Drawing tools, Dimension tool Arrow Style shows each arrowhead (#8049):** The Arrow Style dropdown in Dimension Tool Options and in the Properties panel's Dimension section draws each style's arrowhead at the end of a short line before its name, in the open list and in the closed field, using the Stroke panel's arrowhead previews. Filled, Open, Tick and None are the same four styles, saved as before. `arrow_style_shows_a_drawn_arrowhead` and `each_arrow_style_draws_its_stroke_arrowhead_at_both_ends` cover it.
**Drawing tools, Line Segment from one curve onto a common tangent of another:** By VectorCraft's own rule, with Smart Guides and Snap to Tangent on, a Line Segment drag pressed anywhere on a convex closed path with curves and dragged to within the snapping tolerance of another such path lands on a common tangent of the two ([tangent lines to circles](https://en.wikipedia.org/wiki/Tangent_lines_to_circles)): both ends move to where the line touches the paths, the start sliding along the first path, and each end shows the "tangent" label when Anchor/Path Labels is on, with the line drawn as a guide when Alignment Guides is on. The line is the tangent whose touch point on the second path is nearest the pointer, so moving the pointer around the second path switches between the outer tangent and the one crossing between the paths. The start stays where it was pressed when Shift, Alt or Space is held, when an anchor, center or crossing lies nearer the pointer than the second path does, when the press snapped to an anchor, center or crossing off the first path, when Snap to Tangent is off, when Snap to Grid or pixel snapping places drawn points, or when either path bends inward somewhere or has more than 512 segments. `a_line_from_one_circle_to_another_lands_on_their_common_tangent`, `a_line_from_a_turned_ellipse_lands_on_its_tangent_with_a_circle`, `a_line_near_the_second_path_takes_the_tangent_touching_it_nearest`, `a_line_keeps_its_start_without_a_tangent_snap`, `a_line_to_a_crescent_or_from_an_anchor_beside_the_curve_keeps_its_start` and `a_line_segment_drag_draws_the_common_tangent_as_one_undo_step` cover it.
**Live trace result bounds and selection highlights exclude the retained bitmap except in source-image views:** `live_trace_result_bounds_exclude_the_retained_bitmap_at_any_angle` checks every TraceView, geometric and visual bounds and rotated result bounds. `live_trace_selection_highlight_excludes_the_retained_source_rectangle` checks result highlights and the existing ordinary-group policy. Shared editing-child traversal also preserves Shaper handling.
**Artboard Options shares existing presets and orientation controls and can fit artwork without moving it; artwork fitting includes all drawn document art across artboards and off-board; artwork bounds are cached by active document and revision, and selection uses the shared bounds cache across artboards:** Shared existing preset definitions are reused; no external preset assets are added. Presets preserve each selected artboard's orientation, and orientation choices apply even when the active board already matches. Fit operations draft bounds until OK, affect only the active artboard and leave artwork in place. Regression coverage checks draft/Cancel, selected-set application, active-only fitting and Undo.
@@ -1333,7 +1335,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
The settled part of that outline is kept in paths of up to 64 pieces each. A path is shared from one frame to the next until a piece in it changes, and the canvas keeps the triangles it drew the path with while the view stays the same, so a frame does not copy, flatten or tessellate a settled path again; a pan, zoom or rotation draws each one once more. This is VectorCraft's own rule. The line that a drag of more than 64 segments shows with a round Eraser tip, the Knife, the Path Eraser or the Pencil with Live preview off is kept the same way, in pieces of 64 segments: a frame builds again only the last piece, and the Knife's dashes run on from one piece to the next. With the Eraser's Size set to a mode that follows the pen, each step of such a drag is kept as its own path and a frame builds only a new step. A smoothing drag's band is kept until it changes. The canvas still copies the kept triangles of every piece into each frame.
- **Transform:** Rotate, Reflect, Scale, Shear (click or Alt-click snaps the reference point to anchors and centres; Alt-click opens the tool's dialog, and a drag with Alt down at the release, from the press or pressed mid-drag, transforms a copy), Reshape, Free Transform (free and perspective distort and shear, switched by the keys held during a handle drag).
A Reshape drag stretches part of a path from the dragged point without losing the path's general form, as [Adjust path segments](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/adjust-path-segments.html) has it. On an open path the stretch reaches both ends: the end anchors stay in place, each anchor between moves less the nearer it lies to an end, and the handles of a smooth anchor stay in line (`path.reshape`; the reach and the shares are VectorCraft's own rule, in `docs/mcp.md`). A click sets a focal point and a click on a segment adds a highlighted anchor there; Shift-click adds more, and a drag from any of them moves them all. The anchors that are not direct-selected stay in place and a closed path selected whole moves whole (VectorCraft's own rule, in `docs/mcp.md`).
Align, Distribute, Distribute Spacing, Reflect and Shear return an error for any `horizontal`, `vertical`, `to`, `axis`, `bounds` or `spacing` value they don't take, listing the choices, and Align returns one when a call gives neither `horizontal` nor `vertical`; nothing moves and no undo step is recorded. Align and Distribute act on the anchor points selected with Direct Selection: the points of one path align to each other, not to the artboard, and Distribute spaces them (#1641, fixes #1636; aligning to a key anchor is still missing).
Align, Distribute, Distribute Spacing, Reflect and Shear return an error for any `horizontal`, `vertical`, `to`, `axis`, `bounds` or `spacing` value they don't take, listing the choices, and Align returns one when a call gives neither `horizontal` nor `vertical`; nothing moves and no undo step is recorded. Shear takes an angle from -359° to 359° and shears by its tangent, so 120° slants as -60°; an angle outside that range, and ±90° and ±270° (VectorCraft's own rule), return an error ([shear objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/shear-objects.html); `shear_angles_slant_by_their_tangent`, `shear_rejects_angles_with_no_shear_or_out_of_range`). Align and Distribute act on the anchor points selected with Direct Selection: the points of one path align to each other, not to the artboard, and Distribute spaces them (#1641, fixes #1636; aligning to a key anchor is still missing).
Transform Each opens on the scale, move, rotate, reflect, Random, reference point, Transform Objects and Preview it was last confirmed with (kept with the UI state; Copy never is), and its Copy button, left of Cancel, transforms a copy of each object as the [Scale multiple objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/scale-multiple-objects.html) help page has it; the Copy checkbox is gone (#1732; the remembered values follow a maintainer comment on the issue, not the help page). Its Scale section has the Relative and Absolute radio buttons the same page describes: percentages of each object's size, or the width and height it becomes (`object.transformEach` `relative`, which Transform Again repeats); Absolute measures each object's own box, and the scales act along its axes about that box's reference point, so a turned shape keeps its shape and objects of different sizes come out alike; the fields show the width and height the selected objects share and read "Mixed" when they differ or a side is 0 (a line's), each object measured by its own box, rotated with it, as the Transform panel and the Control bar show it (sizes they show alike count as the same), and a size typed into them sets every object to it (a side left Mixed keeps its size), our choices where the page leaves them open; a live Repeat scales its spacing by the geometric mean of the two factors, so its Absolute size is approximate. The link beside the two scales keeps them in proportion, as the shape dialogs' Width and Height link does (`__constrain`, kept with the dialog's values; where it sits is our choice, the public pages don't establish it). The panel lists Scale, Move and Rotate, then the Options in two columns (Transform Objects, Transform Patterns, Scale Strokes & Effects, Scale Corners; Reflect X, Reflect Y, Random), the Reference Point, and Preview at the left of the button row, level with Copy, Cancel and OK.
Transform Again uses the Copy, Transform Patterns, Scale Strokes & Effects and Scale Corners choices of the transform it repeats; after a bounding-box handle drag on area type, it resizes the type area again and the type keeps its size (`object.transformAgain`). With anchors selected with Direct Selection, Move, Rotate, Scale, Reflect, Shear and Transform Again (the commands, their dialogs and the four tools' drags) transform only those anchors, their handles with them, about the centre of the box around them unless a point was clicked; a copy still copies the whole object (#1408; behaviour reference: [adjust path segments](https://helpx.adobe.com/illustrator/using/adjust-path-segments.html); the default reference point and the copy are our choices). The Move, Rotate, Scale, Reflect and Shear dialogs have a Preview checkbox, off when they open: while it is on the canvas follows the values, Cancel rolls it back and OK is still one undo step; Up/Down step the Rotate and Shear angles and the Scale percentages by 1, Shift by 10 (#1412). The five dialogs and Transform Each have Transform Objects beside Transform Patterns: off, the art stays and only its pattern tiles transform (`objects` on the transform commands), and Transform Again repeats the choice (#1448; behaviour reference: [scale objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/scale-objects.html); the checkboxes are always enabled and the Scale page's pair is applied to all of them, our choices). Reflect's axis is Horizontal, Vertical or an angle (#1460; [reflect objects along an axis](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/reflect-objects-along-an-axis.html)).
Shear's axis is Horizontal, Vertical or Angle: the Shear dialog's Axis Angle field, and a numeric `axis` on `object.shear`, set a line on the page from -359° to 359° that the art slides along, apart from the shear angle; an axis angle outside that range is an error and nothing changes ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/shear-objects.html) describes this angled axis and its range; counter-clockwise from horizontal and the field's 0° start are our choices). Tests: `shear_along_an_axis_at_an_angle`, `reflect_and_shear_reject_unknown_axes_without_changing_state` and `shear_takes_an_axis_angle`.
@@ -1449,6 +1451,10 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
A modal window that opens without a press in the window (a dialog opened from the macOS menu bar or by an automation command, the About window, a file dialog, the update prompt, or the progress window of a plug-in, trace or open run) closes the Command Palette, a tool group's flyout, the All Tools drawer and any open menu or popup in the pass it opens. While such a window is open, the palette stays closed, so opening it from the macOS menu bar or by an automation command does not take the keyboard from the window; it opens again once the window closes (`palette` tests `a_dialog_opened_from_the_system_menu_closes_the_palette`, `the_about_window_closes_the_palette`, `a_progress_window_closes_the_palette`, `the_palette_opened_over_a_dialog_closes`, `a_click_on_the_menu_bar_closes_the_palette_before_a_dialog_opens`, `a_dialog_opened_without_a_press_closes_a_flyout`, `a_dialog_opened_without_a_press_closes_the_tools_drawer`, `a_dialog_opened_without_a_press_closes_a_menu`, `the_palette_opened_as_a_dialog_closes_stays_open_until_the_next_dialog`).
The Command Palette ranks its results by how well they match. A query that is a result's id lists that result first (`view.goto1` lists Saved View 1 above Saved View 10); then come results whose name is the query, results whose name without its menu path starts with it, and results whose initials it is ("ea" finds Export As…). Within each of those, a result where every word of the query is a whole word of its name ranks above one where a word only starts a word of the name, then one where it is a word of the menu that holds it, then of its id, then text inside a word, so a query that is a menu's title ("object") lists results named with that word above the items of that menu. A tool ranks above a menu command, panel, effect or filter plug-in that matches as well, so "rect" lists the Rectangle Tool above Effect › Convert to Shape › Rectangle…, and of two results of the same kind the shorter name comes first. Words of the menu bar item that runs a result also find it, the item's own label included ("exit" finds Quit VectorCraft, which File › Exit runs); with the native macOS menu bar, the items that bar moves into its application menu are found under it (Preferences… under Settings). Every result the earlier search found is still found, and the highlight stays on its result when a plug-in is installed, a shortcut changes or the language changes while the palette is open (`palette::search` tests `a_better_word_grade_ranks_first`, `a_better_whole_query_tier_ranks_first`, `kind_and_length_never_lift_a_worse_grade`, `a_menu_title_does_not_lift_its_items`, `common_queries_list_the_command_near_the_top`, `every_result_is_found_first_by_its_name_and_its_id`, `every_result_found_before_is_still_found_and_shown`, `results_know_their_place_in_the_menu_bar`, `native_homes_follow_the_native_application_menu`; `palette` test `the_highlight_stays_on_its_result_when_the_results_change`).
A Command Palette query word in an English plural or verb form finds a result whose English name or menu path holds the base word: "rounded corners" lists Effect › Stylize › Round Corners… first, and "scaling" finds Object › Transform › Scale…. The search drops `'s`; `es` after `s`, `x`, `z`, `ch` or `sh` (also trying the word with only its `s` dropped, so "rasterizes" finds Rasterize…); a final `s` in words of more than 3 letters, except after `ss`, `us` or `is`; `ing` in words of more than 5 letters and `ed` in words of more than 4. After `ing` or `ed`, a doubled `b`, `d`, `g`, `m`, `n`, `p`, `r` or `t` is tried both single and doubled, the single letter only when at least 3 letters are left ("cutting" meets Cut, "added" meets Add); otherwise the word is also tried with an `e` ("scaling" meets Scale…). It turns `ies` into `y` or `ie` in words of more than 5 letters and `sses` into `ss`, and leaves `series` and `species` as they are. Among results that the whole query matches the same way (as an id, as a label, at the start of a label, as initials, or none of these), a result whose name holds the base word of a query word ranks below one that holds the query word whole and above one where the query word only starts a word of the name, so "scale zz" lists a name with "Zz Scaling" above one with "Zz Scalers". "scale" alone still lists "Scalers" above "Scaling", because "Scalers" starts with the query. A partly typed word that is not itself a word of any result ("scal") does not meet a base word. Names shown in other languages and ids are not changed this way, and every result found before is still found (`palette::search` tests `plurals_and_verb_forms_meet_their_base_word`, `a_plural_or_verb_form_finds_the_result`, `a_better_word_grade_ranks_first`, `a_partly_typed_word_does_not_lift_a_verb_form`, `a_whole_query_tier_comes_before_a_stem_form`, `results_matched_without_a_stem_keep_their_order`).
A Command Palette query word with a typo still finds the result: "gruop" lists Object › Group first, and "eyedroper", "rectange" and "elipse" list the same first results as the words spelled right, the Eyedropper, Rectangle and Ellipse tools among them. When a query word of 4 or more letters is not a word, a base word or the start of a word of any result's name, menu path or id, the search compares it with the words of result names and menu paths, and a word 1 edit away (2 for a query word of 8 or more letters) matches; a letter added, left out or changed, or two letters next to each other swapped, is one edit. A query word meets at most the 32 nearest such words. Results matched through a typo come after every result the query matches without one, and among them the query is read with the misspelled word replaced by the word it meets, so they come in the order the word spelled right gives; then a result whose label holds the word comes before one whose menu path holds it. Ids, and query words and result words with Chinese, Japanese or Korean letters, are not compared this way, and results without typos keep their order (`palette::search` tests `edits_are_counted_up_to_a_bound`, `a_word_with_a_typo_finds_the_result`, `a_typo_meets_at_most_32_words`, `misspelled_words_find_the_command`).
A Command Palette query word also finds a result whose name or menu path holds a word with the same meaning: "remove bg" lists Remove Background… first, "outline text" lists Type › Create Outlines first, and "flip", "combine", "vectorize" and "colour" list Reflect…, Unite, an Image Trace command and the Color panel among the first 3 results. The words come from VectorCraft's own table of 21 groups of English words (`palette/words.rs`, at most 60 groups of at most 6 words); a word that is the whole label of another command, such as Merge or Mirror, is in no group, and neither is Insert. A word or its English base word that is in a group meets the other words of its group in labels and menu paths, and their base words, but not ids or word starts. A result whose label holds the word itself ranks above one whose label holds a word with the same meaning, which ranks above one whose menu path holds the word, so "type" now lists Scale Text Attributes above Type › Orientation › Vertical. A catalog may add a group's words in its language with a row in the `search` context (the group's English words joined by ", ", then that language's words), used while that language is the UI language; no catalog has to have these rows (`palette::search` tests `a_word_with_the_same_meaning_finds_the_result`, `a_catalog_row_adds_words_to_a_group`, `words_with_the_same_meaning_find_the_command`; `palette::words` tests; `i18n` test `search_rows_name_a_group_and_add_single_words`).
A Command Palette query word also finds a command by what the command's description says: "transparent background" lists Remove Background… among the first 3 results, and "png" lists it after every result with "png" in its name or menu path. The description is the command's params text (an engine or plug-in command's, a UI command's, or an effect's) without each `{…}` group that is not inside a `{`, `[` or `(` group, without each such `[…]` or `(…)` group just after a `→`, and without the `→` before a removed group, cut to its first 300 characters at the end of a word. The words of a schema ("corners" for Remove Background…) and of a result written as a group do not find the command; a result written as words after a `→` stays in the description. Words of 2 characters or fewer, words with no letter, and "the", "and", "ids", "true", "false" and "null" are left out. A query word that is a word of a description, shares an English base word with one, starts one or has the same meaning as one finds the result, and such a result ranks below every result that the query matches in its name, menu path or id, as text inside a word or through a typo. Descriptions are English only, and a typo does not match them. Tools, panels and filter plug-ins have no description (`palette::search` tests `a_description_leaves_out_the_schema_and_the_result`, `a_word_of_the_description_finds_the_result`, `a_description_match_ranks_below_a_typo`, `words_of_a_description_find_the_command`).
Each Command Palette row starts with an icon for its kind (a tool's own icon, or one for a panel, an effect, a filter plug-in or a command) and shows where the result lives after its label, in smaller dim text: the menu path of the menu bar item that runs it, with that item's label when it differs from the result's ("File › Exit" for Quit VectorCraft), and "No menu item" for a command no item runs. A panel's row shows "Window". A row with a home shows its label without the menu path in front of it. A path that keeps two results' names apart stays in the label, unless the row's home shows the same path; a tool's row drops the "Tools" in front of its name. A tool's row names the toolbar it is on: "Toolbar" for its button on the Tools panel, or the name of a toolbar made with New Toolbar, followed by ", in the <tool> group" when the tool is hidden in the group of a slot whose button shows another tool ("Toolbar, in the Direct Selection Tool group" for the Group Selection Tool), and "All Tools" when no toolbar holds it. A toolbar shown now comes first (the Tools panel, then the toolbars made with New Toolbar), then a hidden Tools panel, then hidden toolbars made with New Toolbar; toolbars count as hidden in Presentation Mode and while Tab hides the panels. The Learn command (`window.learn`), which Window › Learn runs, takes the Window menu as its home, so a search reads its menu path like any other result's, and among results that tie on everything else it ranks as a command of the menu bar, before panels and after tools. The home is cut short with "…" before the label, and a label too long for the row keeps the id it shows after its name unless the id alone is wider than the row. A cut row shows all its text while the pointer rests on it, and screen readers read the kind, the label, the home and the shortcut. The row height is unchanged (`palette` tests `rows_show_where_each_result_lives`, `no_two_rows_read_alike`, `a_tool_row_names_its_toolbar_slot`, `a_narrow_row_cuts_the_home_first_and_keeps_the_id`, `screen_readers_hear_the_kind_and_home`, `catalogs_translate_the_kind_and_home_words`).
`object.setProps` with `visible: false` or `locked: true` deselects every selected object that is then hidden or locked, the key object included, as the eye and lock columns do.
Ctrl/Cmd+Alt-clicking an eye switches the other layers to Outline and the row's layer to Preview, or switches all layers back to Preview when the others are in Outline (`layer.outlineOthers`, `layer.previewAll`).
Ctrl/Cmd+Alt-clicking New Layer adds a layer directly below the current layer, at its level (`layer.new {below: true}`), and Ctrl/Cmd+Alt-clicking New Sublayer adds a sublayer under the contents of the layer it goes into (`layer.newSublayer {bottom: true}`), each in one undo step. The reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists these clicks for placing a layer below the selected layer and a new sublayer at the bottom of the layer list.
@@ -1920,7 +1926,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
Outline Object on an image's own fill or stroke follows the outline of the image's opaque area, and the image's frame when the image has no transparency. Path effects apply to a fill or stroke added to a bitmap object ([archived reference manual, page 561](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=561)), and with Outline Object such a stroke follows the boundary of the art when the image has transparent areas and the image's frame when it has none ([CreativePro article on strokes for placed images](https://web.archive.org/web/20250815214529/https://creativepro.com/add-strokes-placed-images-illustrator/)). VectorCraft's own rules: the opaque area is the pixels at least 50% opaque, and its outline is traced as Image Trace's Black and White mode traces at threshold 128 and fitted with curves. Evidence: `tests::imageoutline` (vectorcraft-effects), `opaque::tests` (vectorcraft-trace), `tests::containers::an_images_stroke_with_outline_object_follows_its_opaque_area` and `tests::containers::an_images_outline_object_stroke_exports_selects_and_measures_along_its_opaque_area` (vectorcraft-engine), `tests::objectfx::an_images_outline_object_stroke_follows_new_pixels_under_the_same_key` (vectorcraft-render).
A geometry effect on one of type's own fills or strokes reshapes the whole outline that the fill or stroke paints, on the canvas and in exports; PDF, SVG, EPS and the other vector exports write such type as paths. On type that holds inline graphics, those effects are drawn and exported only when the type has a geometry effect or perspective of its own.
A geometry effect on a symbol instance's fill reshapes the filled shapes of the symbol's art and leaves their strokes as they are; one on the instance's stroke reshapes the stroked shapes and leaves their fills as they are. The shapes keep their colors. Only the instance's topmost fill and topmost stroke count, and only while they are visible with an opacity above 0. The canvas and Object › Expand Appearance use the same art, SVG and PDF export bake the same shapes, and Expand Appearance turns the instance into an editable group in one undo step. A group's own fills and strokes in the art take the effects too. An instance inside the art passes the effects on to its own art, and a dynamic symbol's instance reshapes the fills and strokes it paints on the art. How the effects map onto the symbol's art is VectorCraft's own rule. The help page <https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/apply-and-modify-effects.html> describes effects on one fill or stroke, and the help page <https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/expand-objects.html> describes Expand Appearance (engine `expand::a_symbol_instance_fill_effect_reshapes_its_filled_art_and_expands`, `a_symbol_instance_stroke_effect_reshapes_its_stroked_art_and_expands`, `a_stroke_effect_reshapes_a_stroke_a_dynamic_instance_adds`, `a_fill_effect_reshapes_the_fill_of_a_group_in_the_art`, `only_the_topmost_visible_instance_fill_reshapes_the_art`, `a_nested_symbol_instance_takes_the_outer_fill_effect`, `export_bakes_a_symbol_instance_fill_effect`, `a_fill_effect_on_an_instance_of_a_symbol_that_holds_itself_ends`). Existing documents with a geometry effect on a symbol instance's fill or stroke draw differently: before, the effect drew nothing.
Effect › Pathfinder takes a symbol instance as the art it draws with the geometry effects of its fill and stroke, as they take a path with such effects: the result painted by the instance's art carries those effects, also when the instance has geometry effects of its own and when the instance sits inside another symbol's art. A click where those effects paint the art outside the instance's bounds selects the instance, a fill only when Selection by Path Only is off, and outline mode still takes the instance's bounds alone. A compound shape's area leaves out its members' fill and stroke effects for symbol instances as for paths, since the compound shape paints the area with its own appearance. These are VectorCraft's own rules (engine `expand::pathfinder_takes_a_symbol_instance_fill_and_stroke_effects`, `a_click_where_a_symbol_instance_fill_or_stroke_effect_paints_selects_it`, `a_stroke_effect_reshapes_a_stroke_a_dynamic_instance_adds`, `a_fill_effect_reshapes_the_fill_of_a_group_in_the_art`, `a_click_on_the_grown_fill_of_an_image_in_the_art_selects_the_instance`). Before, Pathfinder dropped those effects and clicks took only the instance's bounds.
Effect › Pathfinder takes a symbol instance as the art it draws with the geometry effects of its fill and stroke, as they take a path with such effects: the result painted by the instance's art carries those effects, also when the instance has geometry effects of its own and when the instance sits inside another symbol's art. A click where those effects paint the art outside the instance's bounds selects the instance, a fill only when Selection by Path Only is off, and outline mode still takes the instance's bounds alone. A marquee across those shapes selects the instance too, and a marquee across the shape an image's own fill or stroke paints outside its frame selects the image, except in outline mode. A compound shape's area leaves out its members' fill and stroke effects for symbol instances as for paths, since the compound shape paints the area with its own appearance. These are VectorCraft's own rules (engine `expand::pathfinder_takes_a_symbol_instance_fill_and_stroke_effects`, `a_click_where_a_symbol_instance_fill_or_stroke_effect_paints_selects_it`, `a_stroke_effect_reshapes_a_stroke_a_dynamic_instance_adds`, `a_fill_effect_reshapes_the_fill_of_a_group_in_the_art`, `a_click_on_the_grown_fill_of_an_image_in_the_art_selects_the_instance`, `a_marquee_where_a_symbol_instance_fill_or_stroke_effect_paints_selects_it`, `a_marquee_on_the_shape_of_an_image_fill_selects_it`). Before, Pathfinder dropped those effects, and clicks and marquees took only the instance's bounds.
Live effects inside a symbol's art (geometry effects, color adjustments and the rest that export bakes) are written where each instance places the art in PDF, print, EPS and DXF, as the canvas draws them: the art is placed first and its effects are applied after, so an instance that scales its art does not scale the distance a Transform effect moves it. Symbols nested in the art, a dynamic symbol instance's own paint changes and the stain an instance's fill gives its art are kept, and the art is stained before its effects apply. A linked instance's PDF link covers its art where the effects draw it. A symbol whose art holds itself stops at the nesting limit, and the symbols' own art keeps its effects. An instance stays an instance in these exports when the objects its art makes once baked (the copies a Transform effect makes included) would take the export's placed symbol art past 16,000,000 objects, or when its baked art would draw deeper than the 128 levels a document may draw; these are VectorCraft's own limits. Art baked for an instance that then stays an instance still counts toward that limit, and while an instance's art bakes, the art's own objects are held in the limit for the instances nested in it. Instances the export leaves out (hidden ones, those in hidden groups, on template layers, and on hidden layers or layers that do not print when the export leaves those out) are not placed and do not count toward that limit. Before, these exports wrote the art without its effects (effects `bake::placing_symbols_bakes_their_art_where_each_instance_places_it`, `placing_symbols_reaches_the_art_of_nested_instances`, `placing_a_symbol_that_holds_itself_stops`, `placing_symbols_keeps_dynamic_instances_changes`, `placing_symbols_keeps_the_instances_stain`, `placing_symbols_counts_the_baked_art`, `placing_symbols_counts_nested_art_once`, `placing_symbols_holds_the_outer_art_while_it_bakes`, `placing_symbols_counts_the_art_it_drops`, `placing_symbols_counts_art_dropped_for_depth_against_later_baked_art`, `placing_symbols_keeps_the_baked_art_within_the_drawn_depth`, `placing_symbols_skips_instances_the_export_leaves_out`; doc `depth::tests::drawn_heights_measure_objects_outside_the_layers`; PDF, print, EPS and DXF `symbol_art_effects_are_written_where_they_draw`, `symbol_art_effects_print_where_they_draw`; PDF `a_stained_instance_keeps_its_stain_when_its_art_has_effects`, `a_linked_instance_keeps_its_link_when_its_art_has_effects`).
EMF, WMF and SVG export write the same symbol art the same way: an instance of a symbol whose art, or the art of a symbol nested in it, has such effects is written as that art placed by the instance and then baked, so a square that a Transform effect moves 100 pt right draws 100 pt right of where the instance places it at any scale or rotation, and art the effect moves onto the artboard is written. EMF and SVG clip 9-slice cells and WMF does not, as each places other instances. In SVG those instances use no `<symbol>`, and instances of symbols without such effects still share one; named objects in a symbol's art take no ids there, as in an instance with its own copy of the art, so two instances do not write the same id; with Hidden Layers on, hidden instances are placed too and written hidden. An SVG instance nested in another instance's art is shared through `<use>` only when the transform it is drawn with, the outer instances' included, keeps the shared art as the canvas draws it, so a nested stroke keeps its weight in a scaled instance. Preserve Editing still embeds the document with its live effects. Before, these exports wrote the art without its effects (metafile `tests::import::symbol_art_effects_are_written_where_they_draw`; SVG `symbols_layers::symbol_art_effects_are_written_where_the_canvas_draws_them`, `a_kept_hidden_instance_is_written_with_its_symbols_effects`, `instances_written_as_their_art_give_its_names_no_id`, `a_nested_instance_is_shared_only_under_the_transform_it_is_drawn_with`; effects `bake::placing_symbols_skips_instances_the_export_leaves_out`).
EMF and WMF export with Use Artboards applies the document's live effects once for all the chosen artboards instead of once for each, and writes the same files byte for byte (metafile `tests::export_regions_writes_what_each_region_writes_alone`; `export_regions_perf` times it).
@@ -1946,6 +1952,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
A graphic style dragged onto the Graphic Styles panel's New Graphic Style button is duplicated, as the panel menu's Duplicate Graphic Style does, and both put the copy at the end of the list, as the help page describes ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=391)). VectorCraft's own rules: the button takes the drop with no art selected; a dragged style that is highlighted brings the other highlighted styles, copied in panel order in one undo step, and the copies are highlighted; the copy is named `<name> copy`, with a number when that is taken, and no art is linked to it (`a_style_dropped_on_new_graphic_style_is_duplicated_at_the_end` in `crates/ui-egui/src/panels/graphic_styles.rs`, `tests::styles::duplicate_puts_the_copy_at_the_end_of_the_list_in_one_undo_step`).
A graphic style dragged onto the Graphic Styles panel's Delete Graphic Style button is deleted, which the help page gives as another way to delete a style besides the panel menu's Delete Graphic Style; art that used the style keeps its look and is no longer linked to it ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=392)). VectorCraft's own rules: the drop asks first as the button does, and with Alt held it deletes without asking; the button takes the drop with no style highlighted; a dragged style that is highlighted brings the other highlighted styles, deleted in one undo step (`a_style_dropped_on_delete_graphic_style_is_deleted_as_the_button_deletes` in `crates/ui-egui/src/panels/graphic_styles.rs`).
The Appearance panel's thumbnail dropped on a graphic style with Alt held replaces that style with the look of the object the panel shows; the style keeps its name and the art that uses it takes the new look, as the help page describes ([the help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=568)). VectorCraft's own rules: art dragged off the canvas does the same with its first object; the style keeps its place in the list, is outlined while one is held over it with Alt, and the replacement is one undo step; an object already linked to the style with its look changes nothing; without Alt the drop makes a new style (`art_or_an_appearance_dropped_on_a_style_with_alt_replaces_that_style` in `crates/ui-egui/src/panels/graphic_styles.rs`).
A graphic style dragged onto another style in the Graphic Styles panel with Alt held gives that style the dragged style's look; the replaced style keeps its name and the art that uses it takes the new look, as the help page describes ([the help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=568)). VectorCraft's own rules: the dragged style and the art linked to it stay as they are; the replaced style keeps its place in the list and is outlined while a style is held over it with Alt; the replacement is one undo step; a style dropped on itself, or on a style with the same look, changes nothing and records no undo step; without Alt the style moves (`graphicStyle.redefine {name, from}`, `a_style_dropped_on_another_with_alt_replaces_that_style` in `crates/ui-egui/src/panels/graphic_styles.rs`, `tests::styles::redefine_from_a_style_gives_the_style_that_look`).
In the Graphic Styles panel's thumbnail and list views, a style with no fill and no stroke, one with only effects or transparency included, shows its preview shape with a black outline, a white fill and a red slash, as the help page describes for the panel's thumbnails ([Graphic styles](https://helpx.adobe.com/illustrator/using/graphic-styles.html)); its effects still draw on that shape. The Control bar's Style picker and chip, graphic style library panels and the large preview on the selected object show the same marker. A fill or stroke row that paints None does not count as a fill or stroke, and a hidden row or one with zero opacity does; these rules, the marker outside the panel's thumbnails and the slash's direction and size are VectorCraft's own (`a_style_with_no_fill_and_no_stroke_shows_an_outlined_shape_and_a_red_slash` in `crates/ui-egui/src/panels/graphic_styles.rs`).
Applying a style to several objects, and Redefine Graphic Style, give the objects one shared copy of the style's appearance instead of a copy each; an object that is edited later gets its own copy, and an object whose placed gradients are fitted to its own bounds gets its own. The undo history's memory estimate counts a shared appearance once. Saved files are unchanged (`crates/engine/src/tests/styles.rs`).
- **Several text styles at once:** in the Character Styles and Paragraph Styles panels, Shift-click highlights a range of styles and Ctrl/Cmd-click adds or removes one, without applying them; the panel menu's Select All Unused (`charStyle.unused`, `paraStyle.unused`) highlights the styles no type uses (in the layers, opacity masks, symbols, graph designs, pattern tiles and the art of brushes), never the Normal style; Delete, the button or the menu item, deletes every highlighted style but Normal in one undo step (`charStyle.delete {names}`, `paraStyle.delete {names}`). The menu's Duplicate copies every highlighted style in one undo step and highlights the copies. A highlighted row dragged onto Create New Style or Delete carries every highlighted style: dropped on Create New Style it copies them all and highlights the copies, and dropped on Delete it deletes them all but Normal and clears the highlight; a row from outside the highlight carries only its own style. Public reference: [Character and paragraph styles](https://web.archive.org/web/20261015081534/https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html).
@@ -2424,6 +2431,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Changed plug-in gradients lose spot plates (G17):** a gradient that a filter or importer changes loses each stop's swatch link, tint and process `plates` together, in fills and strokes, and keeps the stop's color, offset, opacity and midpoint; a gradient returned unchanged keeps all three. Regressions: `crates/plugins/src/objects/tests.rs` (`changed_gradient_fill_and_stroke_drop_spot_plates`, `unchanged_gradient_paint_keeps_spot_plates`). Scores and hours unchanged.
- **Plug-in data kept with the document (G17):** a filter writes JSON of at most 1 MiB with `documentData` (one undo step with its objects; `null` removes it) and reads it back in `_context.documentData`, which no other filter is given. It is the document's foreign data (`unknown.pluginData`, by plug-in id), as the perspective grid is, so the native file keeps it with no section of its own; an exporter is given the whole document, so it can read every plug-in's. Regressions: `crates/engine/src/tests/plugins.rs`, `crates/engine/tests/plugin_export.rs` (the exporter), `crates/doc/src/plugin_data.rs`, `crates/plugins/src/objects/tests.rs`. Scores and hours unchanged.
- **Heavy filter plug-ins (G17):** a filter's manifest may ask for `"budget": "heavy"`: 1 G instructions (20 times a light run's) and 300 s a run, for routing, packing or simulation. Install Plug-in… and File › Open ask the user first, `plugin.install` needs `allowHeavy: true` (`plugin.inspect` tells beforehand), the Additional Plug-ins Folder skips such filters, and the plug-in store keeps the answer. Its dialog has no Preview; the app runs it on a thread of its own with a progress window (Cancel, Continue in Background) and applies the result as `plugin.run` with the same parameters, one undo step, unless the document or the plug-in changed meanwhile. Regressions: `crates/plugins/tests/abi.rs`, `crates/plugins/src/manifest.rs`, `crates/engine/src/tests/plugins.rs`, `crates/ui-egui/src/tests/plugin_runs.rs`. Scores and hours unchanged.
- **Plug-in instruction budget preference (G17, VectorCraft's own setting):** Preferences › Plug-ins & Scratch Disks › Plug-in Instruction Budget (`pluginInstructionBudget`) is Normal by default, which keeps the 50 M instructions a light filter run gets, or Large, which gives each object filter run 250 M plus the 4,000 per input byte, with the 60 s time budget, Cancel and the other limits unchanged. A heavy filter keeps its 1 G and 300 s with either choice; live effects, exporters and importers keep their own budgets. A change applies to the next run of an installed filter; `prefs.set` refuses any other value, and a saved file with another value reads as Normal. Regressions: `crates/plugins/tests/abi.rs`, `crates/engine/src/tests/plugins.rs`, `crates/engine/src/tests/prefs.rs`, `crates/ui-egui/src/prefs_dialog/tests.rs`. Scores and hours unchanged.
- **Safe Mode for plug-ins (G17):** `vectorcraft --safe-mode` and `vectorcraft-cli --safe-mode <subcommand>` start without plug-ins. When a launch stopped while a plug-in was loading or drawing its first live effect, the next launch names that plug-in, without saying it caused the stop, and offers Disable and Continue, Start Normally or Start in Safe Mode. Help › Safe Mode lists the disabled plug-ins with Enable on Re-launch, which takes effect at the next launch, and the app bar and the window title show Safe Mode. The help page (https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf, pages 65 to 69) describes the same choice between diagnosing and starting normally, a Safe Mode with the problem item off and the rest of the app working, and turning the item back on at the next launch. In Safe Mode no plug-in loads or runs, and a live-effect plug-in draws its object's geometry unchanged while the object keeps the effect, which the Appearance panel marks "(Safe Mode)" with the plug-in's id in its tooltip and `effect.list` marks `skipped`; Expand Appearance refuses such an object. The web build keeps no plug-ins between page loads and has no marker. Each desktop launch with preferences keeps a marker in the `Launch` folder next to them; `vectorcraft-cli` and a desktop launch without preferences keep none, so a stop there leads to no choice at the next launch. Disabled plug-ins are listed in `Plug-ins/disabled.json`. `plugin.safeMode` reports Safe Mode and the disabled plug-ins, and `plugin.setEnabled` changes the list. Regressions: `crates/plugins/src/safe_mode.rs`, `crates/plugins/tests/safe_mode.rs`, `crates/engine/tests/plugin_safe_mode.rs`, `crates/ui-egui/tests/safe_mode.rs`. Scores and hours unchanged.
- **Hang report and Copy Troubleshooting Info:** when the desktop app's interface thread stays in one part of a frame for 3 s (VectorCraft's own value), a watching thread writes a hang report to the log and to `logs/hang-report-<process id>.txt`, and removes the file when the interface answers again. A later launch that finds a report no process holds writes it to the log, keeps it as `logs/hang-report.1.txt` and, unless another start-up message is showing, says so in the status bar. Help › Copy Troubleshooting Info (`help.copyTroubleshootingInfo`) copies the platform facts, the recent commands and frame times, and the reports of this session and the last one. Regressions: `apps/vectorcraft/src/hang_watch/tests.rs`, `crates/ui-egui/src/hang_beacon.rs`, `crates/ui-egui/src/troubleshooting.rs`. Scores and hours unchanged.
- **A disabled plug-in whose update stays in the store is turned on:** when `plugin.install` writes a module that lists permissions to the `Plug-ins` folder, its grant can't be written, and the folder can't be returned to the old module (or, on a first install, the new module can't be removed), the folder holds the new module, so a disabled plug-in is turned on, by id and by stored file, as for any install the folder holds. The old grant, or none, doesn't cover the new module, so the next start skips it until it is approved. Regressions: `crates/engine/src/tests/plugins.rs`. Scores and hours unchanged.