From 27ab77377b02f23f104ab2826b257f302d12818b Mon Sep 17 00:00:00 2001
From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com>
Date: Wed, 4 Nov 2026 00:27:13 +0430
Subject: [PATCH 01/38] Fix #3626: an imported document takes the title the
file carries
An SVG's root
and a PDF's XMP dc:title (else Info Title) title the imported document; a file that gives none, or only the Untitled-N name, takes its file name without the extension. Native files and documents restored from editing data keep their own title.
---
crates/engine/src/cmd/fileinfo.rs | 12 +++
crates/engine/src/cmd/fileio.rs | 1 +
crates/engine/src/cmd/fileio/formats.rs | 7 +-
crates/engine/src/cmd/fileio/load.rs | 22 ++++--
crates/engine/src/cmd/fileio/tests.rs | 3 +-
.../engine/src/cmd/fileio/tests_dxfimport.rs | 6 +-
.../engine/src/cmd/fileio/tests_epsimport.rs | 2 +-
crates/engine/src/cmd/fileio/tests_svg.rs | 2 +-
crates/engine/src/tests/fileinfo.rs | 73 ++++++++++++++++++-
crates/pdf/src/file_info.rs | 4 +
crates/pdf/src/tests/file_info.rs | 16 +++-
crates/svg/src/import.rs | 7 +-
crates/svg/src/import/layers.rs | 10 +++
docs/file-format-parity.md | 3 +-
docs/gaps.md | 3 +-
docs/mcp.md | 17 +++--
docs/target-app-parity.md | 5 +-
17 files changed, 167 insertions(+), 26 deletions(-)
diff --git a/crates/engine/src/cmd/fileinfo.rs b/crates/engine/src/cmd/fileinfo.rs
index 36ccd7cdb0..3a37098b48 100644
--- a/crates/engine/src/cmd/fileinfo.rs
+++ b/crates/engine/src/cmd/fileinfo.rs
@@ -141,6 +141,18 @@ fn text(k: &str, v: &Value, multiline: bool) -> Result {
Ok(s.to_string())
}
+/// The title `raw`, read from a file, makes a document: runs of white space (line breaks too)
+/// become single spaces, other control characters are dropped, at most [`MAX_TEXT`] characters
+/// are kept, as `file.info` takes a title. `None` when nothing is left, or when it is the
+/// Untitled-N name New gives (what a document that never had a title writes to its files).
+pub(crate) fn imported_title(raw: &str) -> Option {
+ let words: Vec =
+ raw.split_whitespace().map(|w| w.chars().filter(|c| !c.is_control()).collect::()).filter(|w| !w.is_empty()).collect();
+ let title: String = words.join(" ").chars().take(MAX_TEXT).collect();
+ let title = title.trim_end();
+ super::fileio::is_own_title(title).then(|| title.to_string())
+}
+
/// Keywords from a list or a comma- or semicolon-separated string: trimmed, each once (ignoring
/// case), empty ones dropped.
fn keywords(v: &Value) -> Result> {
diff --git a/crates/engine/src/cmd/fileio.rs b/crates/engine/src/cmd/fileio.rs
index 76f408d221..cbc8506fca 100644
--- a/crates/engine/src/cmd/fileio.rs
+++ b/crates/engine/src/cmd/fileio.rs
@@ -125,6 +125,7 @@ pub use commands::specs;
pub use export_names::artboard_file_names;
pub(crate) use export_names::{default_name, merge, unique_file_names, with_black_output, write_or_return};
use export_names::{distinct_names_by, write_encoded};
+pub(crate) use formats::is_own_title;
use formats::{ARTBOARD, ARTBOARDS, RANGE, USE_ARTBOARDS, import_name, writable};
pub use formats::{
DOC_EXTS, DOCX_EXTS, FORMATS, Format, FormatOption, OPEN_EXTS, PLACE_EXTS, RTF_EXTS, TEXT_EXTS, UNASSOCIATED_EXTS, export_extensions, extension,
diff --git a/crates/engine/src/cmd/fileio/formats.rs b/crates/engine/src/cmd/fileio/formats.rs
index 09e8de8294..30778f6a6e 100644
--- a/crates/engine/src/cmd/fileio/formats.rs
+++ b/crates/engine/src/cmd/fileio/formats.rs
@@ -778,7 +778,12 @@ pub(crate) fn import_name(base: &str, taken: impl Fn(&str) -> bool) -> String {
/// (the title PDF, PNG and SVG metadata carry). A title of its own stays, and native files keep
/// the stored title.
pub fn has_own_title(doc: &vectorcraft_doc::Document) -> bool {
- !doc.title.trim().is_empty() && !doc.title.strip_prefix("Untitled-").is_some_and(|n| !n.is_empty() && n.bytes().all(|b| b.is_ascii_digit()))
+ is_own_title(&doc.title)
+}
+
+/// Is `title` one a person or a file gave, not blank and not the Untitled-N name New gives?
+pub(crate) fn is_own_title(title: &str) -> bool {
+ !title.trim().is_empty() && !title.strip_prefix("Untitled-").is_some_and(|n| !n.is_empty() && n.bytes().all(|b| b.is_ascii_digit()))
}
pub fn titled_for_export(doc: &vectorcraft_doc::Document, path: Option<&str>, format: &str) -> Option {
diff --git a/crates/engine/src/cmd/fileio/load.rs b/crates/engine/src/cmd/fileio/load.rs
index a318616d54..8a646a8e91 100644
--- a/crates/engine/src/cmd/fileio/load.rs
+++ b/crates/engine/src/cmd/fileio/load.rs
@@ -7,9 +7,10 @@ use vectorcraft_doc::{Document, ImageBlob, ImageObject, Node, NodeKind};
use vectorcraft_geom::Affine;
use vectorcraft_render::effects::pixel::LoadedTexture;
+use super::super::fileinfo::imported_title;
use super::super::{Result, Session, bad, bool_or, clipboard, parse_range, str_param};
use super::pdfimport::LoadOptions;
-use super::{Format, SAVE_FORMATS, absolute_path, file_stamp, format, psdread, read_file, readable_format_for_name};
+use super::{Format, SAVE_FORMATS, absolute_path, file_stamp, file_stem, format, psdread, read_file, readable_format_for_name};
use crate::cmd::links::Resolved;
use crate::{EngineError, Prefs};
@@ -392,10 +393,12 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result
};
// A PDF, `.ai` or `.ait` read from its pages or its editing copy, not restored from the document
// it carries, opens with the File Info it gives (a PostScript `.ai` gives none).
+ let mut pdf_title = None;
if matches!(format.id, "pdf" | "ai" | "ait")
&& !restored
&& let Some(info) = vectorcraft_pdf::file_info(bytes, opts.password.as_deref())
{
+ pdf_title = info.title.clone();
super::super::fileinfo::read_pdf(&mut doc.metadata, info);
}
// Threaded type read from a file flows through its frames (the threaded type of a restored
@@ -412,11 +415,18 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result
if let Some(mode) = opts.color_mode.filter(|m| *m != doc.color_mode) {
super::super::colormgmt::set_color_mode(&mut doc, mode, true, None, opts.grays);
}
- // Imports are named after the file; a native document keeps its own title (the tab shows the
- // file name once it has a path).
- if !matches!(format.id, "vectorcraft" | "template") || doc.title.is_empty() {
- doc.title = title;
- }
+ // The document is titled as the file titles it: a native document keeps its own title, one
+ // restored from the editing data a file carries and an SVG keep the title they hold (the SVG's
+ // ``), a PDF, `.ai` or `.ait` takes its XMP `dc:title` or Info `Title`. Without one the
+ // document takes the file name without its extension, as an export does (#3626). The tab shows
+ // the file name once the document has a path.
+ let own = match format.id {
+ "vectorcraft" | "template" => Some(doc.title.clone()).filter(|t| !t.is_empty()),
+ _ if restored || format.id == "svg" => imported_title(&doc.title),
+ "pdf" | "ai" | "ait" => pdf_title.as_deref().and_then(imported_title),
+ _ => None,
+ };
+ doc.title = own.unwrap_or_else(|| file_stem(&title));
warnings.extend(doc.images.values().filter_map(|b| size_note(&b.bytes)));
Ok(Loaded { doc, format, warnings, restored, converted, preview_only, editing_data })
}
diff --git a/crates/engine/src/cmd/fileio/tests.rs b/crates/engine/src/cmd/fileio/tests.rs
index 69158c04b8..d3714e82e8 100644
--- a/crates/engine/src/cmd/fileio/tests.rs
+++ b/crates/engine/src/cmd/fileio/tests.rs
@@ -67,7 +67,8 @@ fn opens_every_readable_format() {
] {
let r = open(&mut s, name, &bytes);
assert_eq!(r["format"], format, "{name}");
- assert_eq!(r["title"], if format == "vectorcraft" { "Untitled-1" } else { name }, "{name}");
+ // The document that wrote the file never had a title of its own, so the file gives none and the name (without its extension) titles it.
+ assert_eq!(r["title"], if format == "vectorcraft" { "Untitled-1" } else { "a" }, "{name}");
assert!(s.doc().unwrap().doc.node_count() >= 2, "{name}: the rectangle came through");
}
for (name, kind) in [
diff --git a/crates/engine/src/cmd/fileio/tests_dxfimport.rs b/crates/engine/src/cmd/fileio/tests_dxfimport.rs
index ec7b295c23..c7de9d9e16 100644
--- a/crates/engine/src/cmd/fileio/tests_dxfimport.rs
+++ b/crates/engine/src/cmd/fileio/tests_dxfimport.rs
@@ -120,7 +120,11 @@ const MM: f64 = 72.0 / 25.4;
fn document_open_reads_a_dxf_drawing() {
let mut s = Session::new();
let r = open(&mut s, &plan(), json!({})).unwrap();
- assert_eq!((r["format"].as_str(), r["title"].as_str()), (Some("dxf"), Some("plan.dxf")));
+ assert_eq!(
+ (r["format"].as_str(), r["title"].as_str()),
+ (Some("dxf"), Some("plan")),
+ "a file that carries no title opens as its name without the extension"
+ );
assert_eq!(layer_names(&s), ["Walls", "Notes"]);
let st = s.doc().unwrap();
// Millimetres at 1:1, the artboard the art's size.
diff --git a/crates/engine/src/cmd/fileio/tests_epsimport.rs b/crates/engine/src/cmd/fileio/tests_epsimport.rs
index 8c4141902c..0e9b8e805f 100644
--- a/crates/engine/src/cmd/fileio/tests_epsimport.rs
+++ b/crates/engine/src/cmd/fileio/tests_epsimport.rs
@@ -64,7 +64,7 @@ fn other_eps_files_are_read_by_the_postscript_interpreter() {
// The page is the bounding box: the art's bounds.
assert_eq!(d.artboards[0].rect.size(), vectorcraft_geom::Size::new(101.0, 51.0), "the stroke's half width rounds up to whole points");
assert_eq!(objects(&s), 1);
- assert_eq!(s.doc().unwrap().title(), "plain.eps");
+ assert_eq!(s.doc().unwrap().title(), "plain");
}
/// A CMYK image the PostScript interpreter reads keeps its ink amounts when the EPS opens and when
diff --git a/crates/engine/src/cmd/fileio/tests_svg.rs b/crates/engine/src/cmd/fileio/tests_svg.rs
index 73ee604a98..ff3a73432c 100644
--- a/crates/engine/src/cmd/fileio/tests_svg.rs
+++ b/crates/engine/src/cmd/fileio/tests_svg.rs
@@ -138,7 +138,7 @@ fn preserve_editing_reopens_the_native_document() {
let doc = &s.doc().unwrap().doc;
assert_eq!(doc.artboards.len(), 2, "both artboards came back");
assert_eq!(doc.artboards[1].name, "Back");
- assert_eq!(doc.title, "both.svg");
+ assert_eq!(doc.title, "both");
// Without it the SVG is imported (one artboard).
let text = svg(&mut s, json!({}));
s.execute("document.open", &json!({"name": "plain.svg", "dataBase64": vectorcraft_format::base64_encode(text.as_bytes())})).unwrap();
diff --git a/crates/engine/src/tests/fileinfo.rs b/crates/engine/src/tests/fileinfo.rs
index c37cbfe90d..905cf910f3 100644
--- a/crates/engine/src/tests/fileinfo.rs
+++ b/crates/engine/src/tests/fileinfo.rs
@@ -161,7 +161,7 @@ fn an_exported_pdf_opens_with_its_file_info() {
assert_eq!(back["description"], "A poster\nfor the fair");
assert_eq!(back["keywords"], json!(["fair", "Poster", "print"]));
assert!(back["created"].as_str().is_some_and(|c| c.ends_with('Z')), "the file's creation date: {}", back["created"]);
- assert_eq!(back["title"], "poster.pdf", "the title stays the file name");
+ assert_eq!(back["title"], "Poster", "the title is the one the PDF carries, not its file name");
assert_eq!(back["copyrightStatus"], "copyrighted");
assert_eq!(back["copyrightNotice"], "(c) 2026 Ada");
assert_eq!(back["copyrightUrl"], "https://example.com/rights");
@@ -277,6 +277,77 @@ fn a_pdf_compatible_ai_opens_with_the_file_info_of_its_xmp_packet() {
assert_eq!(m.copyright_url, "");
}
+/// A one-page PDF whose trailer names an information dictionary with the entries `info`, and whose
+/// catalog has a metadata stream holding an XMP `dc:title` of `xmp_title`.
+fn pdf_titled(info: Option<&str>, xmp_title: Option<&str>) -> Vec {
+ use vectorcraft_testkit::pdf::{PdfPage, first_extra, pdf_with_catalog};
+ let first = first_extra(1);
+ let mut objects = vec![];
+ let mut catalog = String::new();
+ if let Some(t) = xmp_title {
+ let xmp = format!(
+ "\
+ \
+ Zugangswege {t} \
+ "
+ );
+ objects.push(format!("<< /Type /Metadata /Subtype /XML /Length {} >>\nstream\n{xmp}\nendstream", xmp.len()));
+ catalog = format!("/Metadata {first} 0 R ");
+ }
+ let info_at = first + objects.len();
+ if let Some(i) = info {
+ objects.push(format!("<< {i} >>"));
+ }
+ let refs: Vec<&str> = objects.iter().map(String::as_str).collect();
+ let bytes = pdf_with_catalog(&[PdfPage::new(100.0, 100.0, "0 0 1 rg 10 10 50 50 re f")], &refs, &catalog, None);
+ if info.is_none() {
+ return bytes;
+ }
+ // The trailer follows the cross-reference table, so a longer trailer moves no object.
+ String::from_utf8(bytes).unwrap().replacen("/Root 1 0 R", &format!("/Root 1 0 R /Info {info_at} 0 R"), 1).into_bytes()
+}
+
+/// The title `document.open` gives a file called `name` with content `bytes`.
+fn opened_title(name: &str, bytes: &[u8]) -> String {
+ let mut s = Session::new();
+ let r = s.execute("document.open", &json!({"name": name, "dataBase64": vectorcraft_format::base64_encode(bytes)})).unwrap();
+ assert_eq!(r["fileInfoTitle"], s.doc().unwrap().doc.title.as_str());
+ s.doc().unwrap().doc.title.clone()
+}
+
+#[test]
+fn import_uses_the_files_own_title() {
+ // SVG: the root's ``, its white space made single spaces; not a shape's tooltip.
+ let svg = |inner: &str| {
+ format!(
+ "{inner}Tooltip "
+ )
+ };
+ assert_eq!(opened_title("box.svg", svg("\n Access\n paths ").as_bytes()), "Access paths");
+ assert_eq!(
+ opened_title("box.svg", svg("Zugangswege Rechenzentrum – Prüfdiagramm ").as_bytes()),
+ "Zugangswege Rechenzentrum – Prüfdiagramm"
+ );
+ // PDF: the XMP `dc:title` (its `x-default` item) beats the Info `Title`; the Info `Title` stands alone.
+ assert_eq!(opened_title("plan.pdf", &pdf_titled(Some("/Title (Info title)"), Some("XMP title"))), "XMP title");
+ assert_eq!(opened_title("plan.pdf", &pdf_titled(None, Some("XMP title"))), "XMP title");
+ assert_eq!(opened_title("plan.pdf", &pdf_titled(Some("/Title (Info title)"), None)), "Info title");
+ assert_eq!(opened_title("plan.ai", &pdf_titled(Some("/Title (Info title)"), None)), "Info title");
+ // A file that gives none (or a blank one): its name without the extension, in a folder too.
+ assert_eq!(opened_title("box.svg", svg("").as_bytes()), "box");
+ assert_eq!(opened_title("/work/box.svg", svg(" ").as_bytes()), "box");
+ assert_eq!(opened_title("plan.pdf", &pdf_titled(None, None)), "plan");
+ assert_eq!(opened_title("plan.pdf", &pdf_titled(Some("/Author (Ada)"), None)), "plan");
+ // The Untitled-N name New gives is no title (a document that never had one writes it).
+ assert_eq!(opened_title("plan.pdf", &pdf_titled(Some("/Title (Untitled-2)"), None)), "plan");
+ // A native file keeps the title it has.
+ let mut s = session();
+ let native = vectorcraft_format::base64_encode(&b64(&s.execute("document.export", &json!({"format": "vectorcraft"})).unwrap()));
+ let mut t = Session::new();
+ t.execute("document.open", &json!({"name": "other.vectorcraft", "dataBase64": native})).unwrap();
+ assert_eq!(t.doc().unwrap().doc.title, "Poster");
+}
+
#[test]
fn png_exports_carry_text_chunks() {
let mut s = session();
diff --git a/crates/pdf/src/file_info.rs b/crates/pdf/src/file_info.rs
index 983a7dcea7..1cb0a45273 100644
--- a/crates/pdf/src/file_info.rs
+++ b/crates/pdf/src/file_info.rs
@@ -24,6 +24,8 @@ const PDF: &str = "http://ns.adobe.com/pdf/1.3/"; // brand-ok: the XMP namespace
/// The File Info fields a PDF gives, each `None` when the file gives none (or only blank text).
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct FileInfo {
+ /// XMP `dc:title` (its `x-default` item, else its first), else Info `Title`.
+ pub title: Option,
/// XMP `dc:creator` (its names joined with ", "), else Info `Author`.
pub author: Option,
/// XMP `dc:description` (its `x-default` item, else its first), else Info `Subject`.
@@ -53,6 +55,7 @@ pub(crate) fn file_info_in(pdf: &Pdf) -> FileInfo {
let mut f = packet(pdf).and_then(|p| xmp(&p)).unwrap_or_default();
let info = pdf.metadata();
let text = |b: &Option>| b.as_deref().map(text_string).map(|s| s.trim().to_string()).filter(|s| !s.is_empty());
+ f.title = f.title.or_else(|| text(&info.title));
f.author = f.author.or_else(|| text(&info.author));
f.description = f.description.or_else(|| text(&info.subject));
f.keywords = f.keywords.or_else(|| text(&info.keywords).map(|k| split(&k)).filter(|k| !k.is_empty()));
@@ -90,6 +93,7 @@ fn xmp(packet: &[u8]) -> Option {
let creators = get(DC, "creator");
let subjects = get(DC, "subject");
Some(FileInfo {
+ title: first(DC, "title"),
author: (!creators.is_empty()).then(|| creators.join(", ")),
description: first(DC, "description"),
keywords: if subjects.is_empty() { first(PDF, "Keywords").map(|k| split(&k)).filter(|k| !k.is_empty()) } else { Some(subjects) },
diff --git a/crates/pdf/src/tests/file_info.rs b/crates/pdf/src/tests/file_info.rs
index 7ce2f42f47..f7c5d694b6 100644
--- a/crates/pdf/src/tests/file_info.rs
+++ b/crates/pdf/src/tests/file_info.rs
@@ -45,7 +45,7 @@ fn description(attrs: &str, body: &str) -> String {
}
const INFO: &str = "/Author (Grace Hopper) /Subject /Keywords (navy; compilers, , cobol) \
- /CreationDate (D:20261005140300+02'00') /ModDate (D:20261006090000Z) /Title (Ignored title)";
+ /CreationDate (D:20261005140300+02'00') /ModDate (D:20261006090000Z) /Title (Compiler manual)";
/// Unix seconds of 2026-10-05 12:03:00 UTC (14:03 at +02:00).
const CREATED: i64 = 1_791_201_780;
@@ -58,6 +58,7 @@ fn the_information_dictionary_gives_file_info() {
assert_eq!(
f,
FileInfo {
+ title: Some("Compiler manual".into()),
author: Some("Grace Hopper".into()),
description: Some("Cata log".into()),
keywords: Some(vec!["navy".into(), "compilers".into(), "cobol".into()]),
@@ -79,7 +80,8 @@ fn the_information_dictionary_gives_file_info() {
fn the_xmp_packet_gives_file_info() {
let body = description(
"xmpRights:Marked=\"False\" xmp:ModifyDate=\"2026-10-06T09:00:00.25Z\"",
- "Ada Lovelace Charles Babbage \
+ "Plakat Poster \
+ Ada Lovelace Charles Babbage \
Ein Plakat A poster\nfor the fair \
fair print \
(c) 2026 Ada \
@@ -90,6 +92,7 @@ fn the_xmp_packet_gives_file_info() {
assert_eq!(
f,
FileInfo {
+ title: Some("Poster".into()),
author: Some("Ada Lovelace, Charles Babbage".into()),
description: Some("A poster\nfor the fair".into()),
keywords: Some(vec!["fair".into(), "print".into()]),
@@ -138,6 +141,13 @@ fn the_xmp_packet_wins_where_both_give_a_field() {
assert_eq!(f.created, Some(1_791_331_200 + 5 * 3600 + 30 * 60));
assert_eq!(f.description.as_deref(), Some("Cata log"));
assert_eq!(f.modified, Some(MODIFIED));
+ // The title is the packet's where it gives one (a blank `x-default` item leaves the next one),
+ // else the dictionary's.
+ assert_eq!(f.title.as_deref(), Some("Compiler manual"));
+ let body =
+ description("", " Manuel ");
+ let f = file_info(&pdf(Some(INFO), Some(&packet(&body))), None).unwrap();
+ assert_eq!(f.title.as_deref(), Some("Manuel"));
}
#[test]
@@ -197,11 +207,13 @@ fn an_xmp_packet_nested_too_deep_leaves_the_information_dictionary() {
#[test]
fn a_written_pdf_gives_its_file_info_back() {
let mut d = Document::new(100.0, 100.0);
+ d.title = "Fair poster".into();
d.metadata.author = "Ada Lovelace".into();
d.metadata.description = "A poster\nfor the fair".into();
d.metadata.keywords = vec!["fair".into(), "print".into()];
let bytes = export(&d, &PdfOptions { created: Some(CREATED), ..PdfOptions::uncompressed() }).unwrap();
let f = file_info(&bytes, None).unwrap();
+ assert_eq!(f.title.as_deref(), Some("Fair poster"));
assert_eq!(f.author.as_deref(), Some("Ada Lovelace"));
assert_eq!(f.description.as_deref(), Some("A poster\nfor the fair"));
assert_eq!(f.keywords, Some(vec!["fair".to_string(), "print".into()]));
diff --git a/crates/svg/src/import.rs b/crates/svg/src/import.rs
index 11795b83fa..aa625de695 100644
--- a/crates/svg/src/import.rs
+++ b/crates/svg/src/import.rs
@@ -38,7 +38,7 @@ pub(super) use importer::PT_PER_IN;
use importer::SymbolMade;
pub(super) use layers::DEFAULT_FONT_SIZE;
pub(crate) use layers::SUBLAYER;
-use layers::{RootUnits, inkscape_pages, promote_sublayers, root_layer_name};
+use layers::{RootUnits, inkscape_pages, promote_sublayers, root_layer_name, root_title};
pub(super) use prepass::Edits;
pub use prepass::{MAX_FOREIGN, MAX_FOREIGN_VALUE};
use prepass::{labels, prepass};
@@ -142,6 +142,11 @@ pub(crate) fn import(svg: &str, opts: &ImportOptions, max_nodes: usize) -> Resul
let k = units.k;
let mut doc = Document::new(size.width() as f64 * k, size.height() as f64 * k);
doc.units = units.unit;
+ // The file's own title, when it gives one; else the document keeps the placeholder name
+ // `Document::new` gave it, for the caller to name after the file.
+ if let Some(title) = root_title(xml.root_element()) {
+ doc.title = title;
+ }
let mut im = Importer {
doc,
warnings,
diff --git a/crates/svg/src/import/layers.rs b/crates/svg/src/import/layers.rs
index 04e3887945..6115d2e445 100644
--- a/crates/svg/src/import/layers.rs
+++ b/crates/svg/src/import/layers.rs
@@ -16,6 +16,16 @@ pub(super) fn root_layer_name(root: XNode) -> Option {
root.attribute("data-name").or(id).map(str::trim).filter(|n| !n.is_empty()).map(str::to_string)
}
+/// The title the file gives root element `root`: the text of its first `` child (the one
+/// SVG 1.1 §5.4 and SVG 2 §5.4 give a document or element; a `` inside a shape or group is
+/// that element's tooltip, not the document's), its runs of white space made single spaces. `None`
+/// without one, or when it is blank.
+pub(super) fn root_title(root: XNode) -> Option {
+ let title = root.children().find(|c| c.is_element() && c.tag_name().name() == "title" && c.tag_name().namespace() == Some(super::SVG_NS))?;
+ let text: Vec<&str> = title.descendants().filter_map(|n| n.text().filter(|_| n.is_text())).flat_map(str::split_whitespace).collect();
+ (!text.is_empty()).then(|| text.join(" "))
+}
+
/// Is element `g` a `` marked as a layer ([`SUBLAYER`])? Only one with an id counts: the id (or
/// the label beside it) is its name.
pub(super) fn marked_layer(g: XNode) -> bool {
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index 6f02703ca5..ba1d1738e4 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,6 +1,6 @@
# File format parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** minor (native format: dynamic symbols, #4938) · **Target:** Adobe Illustrator 2026 (30.x)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (an imported document takes the title its file carries; previously: native format: dynamic symbols, #4938) · **Target:** Adobe Illustrator 2026 (30.x)
Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`,
`OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public
@@ -161,6 +161,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri
| Date | Change | Summary |
|---|---|---|
+| 2026-11-03 | minor | An imported document takes the title its file carries: an SVG's root ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title` else its Info `Title`; a file that gives none opens with its file name without the extension (#3626). |
| 2026-11-01 | minor | Native format: a symbol's Symbol Type (`dynamic`) and a dynamic symbol instance's appearance changes to objects of its art (`symbol_overrides`) round-trip; both are left out when unset, so other documents save unchanged (#4938). `.ai` reading and writing of dynamic symbols remains. |
| 2026-11-01 | minor | Exports draw each artboard's background color behind its art (#4937): PNG, JPEG, GIF, TIFF, WebP, BMP, Targa and PSD (a layer of its own; on a transparent background too), PDF, SVG and EPS pages, a `.ai` file's PDF pages and PostScript and PDF print; `includeArtboardFill: false` leaves it out. Files with editing data (Preserve Editing, `.ai`, EPS, native) keep it as the artboard's color and reopen without extra art. Not read from the reference app's own `.ai` data, nor written to it. DXF, EMF and WMF leave it out |
| 2026-10-31 | minor | PDF import finds an installed font whose PDF name holds hyphens (`Noto-Sans-Bold` is Noto Sans, Bold: the longest part before a hyphen that names an installed family) and a composite font by its CIDFont's name rather than its base name, which ends in the CMap's (`Name-Identity-H`, [ISO 32000-1 §9.7.6.1](https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf)); a missing font is split only before a style part (`Helvetica-BoldOblique`), so it is reported as `MS PGothic`, not `MS`; scores unchanged (estimated) |
diff --git a/docs/gaps.md b/docs/gaps.md
index 8b707fd9f6..016703c688 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -1,6 +1,6 @@
# Gaps
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (an imported document takes the title its file carries; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
## Feature submission evidence
@@ -732,6 +732,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv
| Date | Change | Summary |
|---|---|---|
+| 2026-11-03 | minor | An imported document takes the title its file carries (an SVG's root ``, a PDF's XMP `dc:title` else its Info `Title`), else its file name without the extension, instead of the file name with it (#3626); no scored gap or estimate reassessed. |
| 2026-11-02 | minor | G15: the renderer keeps a compound path's assembled path between frames and drops unused geometry entries after a few frames however few there are. Estimate unchanged. |
| 2026-11-02 | minor | G15: hit testing culls paths and compound paths by their control points' box and tests a compound path's outline and fill against only its members near the click; the same objects are hit. Estimate unchanged. |
| 2026-11-03 | minor | Symbol editing shows draggable 9-slice guides within the artwork (#5280). Guides outside the artwork remain unsupported. The G5 estimate remains 14–24 h. |
diff --git a/docs/mcp.md b/docs/mcp.md
index 0ca4e32353..4911590619 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -3908,13 +3908,16 @@ They also write the `copyrightNotice` as `dc:rights`, the `copyrightUrl` as `xmp
`copyrightStatus` as `xmpRights:Marked` (`True` for copyrighted, `False` for public domain, none for unknown) to the
XMP packet.
A PDF, `.ai` or `.ait` opened from its pages or its editing copy (`document.open`,
-`file.newFromTemplate`, `file.revert`; not one restored from the document it carries) opens with the `author`,
-`description`, `keywords`, `copyrightStatus`, `copyrightNotice`, `copyrightUrl`, `created` and `modified` that its XMP
-packet (`dc:creator`, `dc:description`, `dc:subject` or `pdf:Keywords`, `xmpRights:Marked`, `dc:rights`,
-`xmpRights:WebStatement`, `xmp:CreateDate`, `xmp:ModifyDate`) and its document information dictionary (`Author`,
-`Subject`, `Keywords`, `CreationDate`, `ModDate`) give, the XMP packet's value where both give one. A value that
-`file.info` would refuse is left out, and the title is set as for any other open (the file name, or a new untitled
-name for a template).
+`file.newFromTemplate`, `file.revert`; not one restored from the document it carries) opens with the `title`,
+`author`, `description`, `keywords`, `copyrightStatus`, `copyrightNotice`, `copyrightUrl`, `created` and `modified`
+that its XMP packet (`dc:title`, `dc:creator`, `dc:description`, `dc:subject` or `pdf:Keywords`, `xmpRights:Marked`,
+`dc:rights`, `xmpRights:WebStatement`, `xmp:CreateDate`, `xmp:ModifyDate`) and its document information dictionary
+(`Title`, `Author`, `Subject`, `Keywords`, `CreationDate`, `ModDate`) give, the XMP packet's value where both give
+one (for `dc:title` and `dc:description`, the `x-default` language item first). An SVG opens with the `title` of its
+root `` element (not a shape's or group's). A title is read with its white space made single spaces and
+without control characters, at most 65,536 characters, as `file.info` takes one. A file that gives no title, a blank
+one or the `Untitled-N` name New gives, opens with its file name without the extension (`box.svg` opens as `box`), and a native file keeps its own
+title. A value that `file.info` would refuse is left out, and a template opens with a new untitled name.
`document.inspect` (`inspect_document`) and the `document.open` (`open_file`) reply report the File Info title as
`fileInfoTitle`. Their `title` is the document's tab name, which comes from the file name once the document is saved
to or opened from a file (with ` [Converted]` or ` [Recovered]` where that applies).
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index b4370a3a0c..b544fdf895 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1,6 +1,6 @@
# Parity with Adobe Illustrator
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (an imported document takes the title its file carries; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026)
## Feature submission evidence
@@ -1172,7 +1172,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- File › Place with Bounding Box (`file.place {crop: "bounding"}`) measures the art that shows, with its strokes and effects, as an export does: hidden objects, guides and template layers do not count, a group whose only part on the page or artboard is hidden is not placed, and symbol instances are measured by their art, for `at`, `rect`, the place cursor and `file.place.info` (`crates/engine/src/tests/place.rs`).
- Separations Preview shows placed and embedded raster images on the visible plates, as it shows vector art (#4153): an RGB image's pixels are separated into process inks with the proof setup's intent, a CMYK image shows its own inks, a hidden plate's ink leaves the image, and with one plate visible the image shows that plate's ink as a grey. Raster images carry no spot ink, so a spot plate shown alone shows them as paper; a colorized image shows its color's plates. Emoji and other bitmap glyphs follow the same rule. The plate-filtered pixels and their reduced-size copies are kept apart from the image's own pixels, for each set of visible plates, proof setup and color settings, and with the preview off nothing changes. Evidence: `tests::colorize::separations_preview_shows_an_rgb_images_process_inks`, `separations_preview_shows_a_cmyk_images_own_inks`, `separations_preview_keeps_an_images_pixels_per_plate_set`. Print preview fidelity remains the open gap, so scores and hours are unchanged.
- Desktop print transport uses `craft-print` for CUPS and modern Windows. Sheet composition, copies, separations and colour management remain in VectorCraft. The Print dialog's Media list also carries the Japanese papers — JIS B4 257 × 364 mm, JIS B5 182 × 257 mm and JIS B6 128 × 182 mm beside the ISO B4/B5 (250 × 353 and 176 × 250 mm, kept so settings and presets saved before them keep their paper), and はがき 100 × 148 mm, 往復はがき 148 × 200 mm, 封筒 長形3号 120 × 235 mm, 長形4号 90 × 225 mm, 角形2号 240 × 332 mm, 角形3号 216 × 277 mm and 四六判 127 × 188 mm; the JSON id or the dialog label names a paper, any case and spacing (`B5 (JIS)` or `b5jis`) (`crates/pdf/src/print/settings.rs`, `crates/pdf/src/tests/print.rs`). The print-preview and physical-device fidelity gaps remain, so print scores and hours are unchanged.
- - A PDF, PDF-compatible `.ai` or `.ait` opened from its pages or its editing copy opens with the File Info that its XMP packet and its document information dictionary give: the author, description, keywords, copyright status, notice and URL, and the created and modified dates, the XMP packet's value where both give one; the title is not changed (`crates/pdf/src/tests/file_info.rs`, `crates/engine/src/tests/fileinfo.rs`).
+ - A PDF, PDF-compatible `.ai` or `.ait` opened from its pages or its editing copy opens with the File Info that its XMP packet and its document information dictionary give: the title (`dc:title`, its `x-default` item first, else Info `Title`), the author, description, keywords, copyright status, notice and URL, and the created and modified dates, the XMP packet's value where both give one (`crates/pdf/src/tests/file_info.rs`, `crates/engine/src/tests/fileinfo.rs`). An SVG opens with the title of its root ``; a file that gives no title opens with its file name without the extension, and a native file keeps its own title (#3626).
- PDF export and PDF-compatible `.ai` and `.ait` saves write the document's File Info created date as the file's creation date, or the time of writing when the document has none, and the time of writing as its modification date; the page information mark still prints the time of writing (`crates/engine/src/tests/fileinfo.rs`, `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/marks.rs`).
- PDF export and PDF-compatible `.ai` and `.ait` saves write File Info's copyright notice, URL and status to the XMP packet (`dc:rights`, `xmpRights:WebStatement`, `xmpRights:Marked`), so a PDF or `.ai` opened from its pages keeps them (`crates/pdf/src/tests/file_info.rs`, `crates/engine/src/tests/fileinfo.rs`).
- Opening a PDF or PDF-compatible `.ai` whose XMP packet nests elements more than 256 deep no longer overflows the stack: File Info leaves the packet out and takes the document information dictionary's values (`crates/pdf/src/tests/file_info.rs`).
@@ -1565,6 +1565,7 @@ A double-click on a Repeat (Radial, Grid or Mirror) with the Selection tool ente
| Date | Change | Summary |
|---|---|---|
+| 2026-11-03 | minor | File Info on open: an imported document takes the title its file carries (an SVG's root ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title` else its Info `Title`), else its file name without the extension, instead of the file name with it (#3626); scores and estimates unchanged. |
| 2026-11-03 | minor | Enclosing Lasso is an add-on with no default shortcut or Basic toolbar slot. Scores and estimates remain unchanged. |
| 2026-11-02 | minor | Wheel input over closed font-family fields changes selected text (#5253); public documentation and application choices distinguished; scores and estimates unchanged. |
| 2026-11-03 | minor | Find Font's replacement-source chooser offers Document, Recent and System (#5217); scores and estimates unchanged. |
From 15993912dee1c8960a0618b3314d3b0ad9c40686 Mon Sep 17 00:00:00 2001
From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com>
Date: Wed, 4 Nov 2026 03:22:46 +0430
Subject: [PATCH 02/38] Fix #3626: .svgz keeps its title and the file-name
fallback is cleaned (review)
---
crates/engine/src/cmd/fileinfo.rs | 17 +++++++++++++++--
crates/engine/src/cmd/fileio/load.rs | 6 +++---
crates/engine/src/tests/fileinfo.rs | 22 ++++++++++++++++++++++
3 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/crates/engine/src/cmd/fileinfo.rs b/crates/engine/src/cmd/fileinfo.rs
index 3a37098b48..e805757b12 100644
--- a/crates/engine/src/cmd/fileinfo.rs
+++ b/crates/engine/src/cmd/fileinfo.rs
@@ -146,11 +146,24 @@ fn text(k: &str, v: &Value, multiline: bool) -> Result {
/// are kept, as `file.info` takes a title. `None` when nothing is left, or when it is the
/// Untitled-N name New gives (what a document that never had a title writes to its files).
pub(crate) fn imported_title(raw: &str) -> Option {
+ let title = cleaned_title(raw);
+ super::fileio::is_own_title(&title).then_some(title)
+}
+
+/// `raw` as `file.info` takes a title (see [`imported_title`]), empty when nothing is left. An
+/// Untitled-N name stays.
+fn cleaned_title(raw: &str) -> String {
let words: Vec =
raw.split_whitespace().map(|w| w.chars().filter(|c| !c.is_control()).collect::()).filter(|w| !w.is_empty()).collect();
let title: String = words.join(" ").chars().take(MAX_TEXT).collect();
- let title = title.trim_end();
- super::fileio::is_own_title(title).then(|| title.to_string())
+ title.trim_end().to_string()
+}
+
+/// The title a document without one of its own takes from its file name's `stem`: cleaned as an
+/// imported title is, so `file.info` takes it, and the Untitled-1 name a new document starts
+/// with when nothing is left of it.
+pub(crate) fn stem_title(stem: &str) -> String {
+ Some(cleaned_title(stem)).filter(|t| !t.is_empty()).unwrap_or_else(|| "Untitled-1".to_string())
}
/// Keywords from a list or a comma- or semicolon-separated string: trimmed, each once (ignoring
diff --git a/crates/engine/src/cmd/fileio/load.rs b/crates/engine/src/cmd/fileio/load.rs
index 8a646a8e91..ac46299de5 100644
--- a/crates/engine/src/cmd/fileio/load.rs
+++ b/crates/engine/src/cmd/fileio/load.rs
@@ -7,7 +7,7 @@ use vectorcraft_doc::{Document, ImageBlob, ImageObject, Node, NodeKind};
use vectorcraft_geom::Affine;
use vectorcraft_render::effects::pixel::LoadedTexture;
-use super::super::fileinfo::imported_title;
+use super::super::fileinfo::{imported_title, stem_title};
use super::super::{Result, Session, bad, bool_or, clipboard, parse_range, str_param};
use super::pdfimport::LoadOptions;
use super::{Format, SAVE_FORMATS, absolute_path, file_stamp, file_stem, format, psdread, read_file, readable_format_for_name};
@@ -422,11 +422,11 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result
// the file name once the document has a path.
let own = match format.id {
"vectorcraft" | "template" => Some(doc.title.clone()).filter(|t| !t.is_empty()),
- _ if restored || format.id == "svg" => imported_title(&doc.title),
+ _ if restored || matches!(format.id, "svg" | "svgz") => imported_title(&doc.title),
"pdf" | "ai" | "ait" => pdf_title.as_deref().and_then(imported_title),
_ => None,
};
- doc.title = own.unwrap_or_else(|| file_stem(&title));
+ doc.title = own.unwrap_or_else(|| stem_title(&file_stem(&title)));
warnings.extend(doc.images.values().filter_map(|b| size_note(&b.bytes)));
Ok(Loaded { doc, format, warnings, restored, converted, preview_only, editing_data })
}
diff --git a/crates/engine/src/tests/fileinfo.rs b/crates/engine/src/tests/fileinfo.rs
index 905cf910f3..4cb511b99c 100644
--- a/crates/engine/src/tests/fileinfo.rs
+++ b/crates/engine/src/tests/fileinfo.rs
@@ -348,6 +348,28 @@ fn import_uses_the_files_own_title() {
assert_eq!(t.doc().unwrap().doc.title, "Poster");
}
+#[test]
+fn compressed_svg_keeps_its_title() {
+ let svgz = |inner: &str| {
+ vectorcraft_svg::compress(&format!(
+ "{inner} "
+ ))
+ };
+ assert_eq!(opened_title("box.svgz", &svgz("Access paths ")), "Access paths");
+ assert_eq!(opened_title("box.svgz", &svgz("")), "box");
+}
+
+#[test]
+fn file_name_title_is_cleaned_like_an_imported_one() {
+ let svg = b" ";
+ // A name `file.info` would reject (white space only) or that keeps control characters.
+ assert_eq!(opened_title(" .svg", svg), "Untitled-1");
+ assert_eq!(opened_title("\u{1}\u{7f}.svg", svg), "Untitled-1");
+ assert_eq!(opened_title("bo\u{1}x two\t.svg", svg), "box two");
+ // The Untitled-N name stays the stem.
+ assert_eq!(opened_title("Untitled-7.svg", svg), "Untitled-7");
+}
+
#[test]
fn png_exports_carry_text_chunks() {
let mut s = session();
From 99be3dca579c9de2c237445d038326372a874ac9 Mon Sep 17 00:00:00 2001
From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com>
Date: Wed, 4 Nov 2026 10:54:36 +0430
Subject: [PATCH 03/38] Fix #3626: the imported title goes into File Info only;
the display name is unchanged
An SVG's root and a PDF's, .ai's or .ait's XMP dc:title (else Info Title) are now
DocMetadata::title, the File Info title, not Document::title. Document::title stays what it was
on main: the file's name with its extension (a native file keeps its own), so the tab, the window
title, Save As, the default export names and Save for Web are unchanged.
- Document::info_title() is metadata.title else the document's title. file.info reports and
compares it, document.inspect and the document.open reply report it as fileInfoTitle, and the
writers of a title (PDF Title and XMP dc:title, SVG and Dublin Core, PNG text, EPS, .ai
and EMF) and has_own_title (DisplayDocTitle) use it. The PDF page-information mark and the
default file names still use the document's name.
- Changing the title in File Info sets the document's title as it always did and drops the one the
file gave; the unchanged title the dialog sends back is no edit.
- metadata.title is saved in the native format only when set (older versions ignore it) and is read
back from the editing data of an SVG, PDF, .ai or EPS; a template opens untitled.
- Reverts the file-stem title, the stem_title cleaning and the svgz branch that only existed to make
Document::title a stem, and the five assertions that change had made.
---
crates/doc/src/lib.rs | 2 +-
crates/doc/src/metadata.rs | 43 ++++-
crates/engine/src/cmd/fileinfo.rs | 45 +++--
crates/engine/src/cmd/fileio/encode.rs | 2 +-
crates/engine/src/cmd/fileio/eps.rs | 2 +-
crates/engine/src/cmd/fileio/formats.rs | 4 +-
crates/engine/src/cmd/fileio/legacy_ai.rs | 2 +-
crates/engine/src/cmd/fileio/load.rs | 33 ++--
crates/engine/src/cmd/fileio/save.rs | 2 +-
crates/engine/src/cmd/fileio/tests.rs | 3 +-
.../engine/src/cmd/fileio/tests_dxfimport.rs | 6 +-
.../engine/src/cmd/fileio/tests_epsimport.rs | 2 +-
crates/engine/src/cmd/fileio/tests_svg.rs | 2 +-
crates/engine/src/cmd/webexport.rs | 2 +-
crates/engine/src/inspect.rs | 4 +-
crates/engine/src/tests/fileinfo.rs | 169 ++++++++++++------
crates/metafile/src/lib.rs | 2 +-
crates/pdf/src/export/entry.rs | 6 +-
crates/pdf/src/tests/file_info.rs | 10 ++
crates/svg/src/export.rs | 2 +-
crates/svg/src/export/output.rs | 2 +-
crates/svg/src/import.rs | 8 +-
crates/svg/tests/it/title_control_chars.rs | 26 +++
docs/file-format-parity.md | 4 +-
docs/gaps.md | 4 +-
docs/mcp.md | 13 +-
docs/target-app-parity.md | 6 +-
27 files changed, 272 insertions(+), 134 deletions(-)
diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs
index b59f661c21..5033e52b47 100644
--- a/crates/doc/src/lib.rs
+++ b/crates/doc/src/lib.rs
@@ -253,7 +253,7 @@ pub struct Document {
/// they were copied from instead of the current layer.
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub paste_remembers_layers: bool,
- /// File → File Info (the title is [`Document::title`]).
+ /// File → File Info (its title is [`Document::info_title`]).
#[serde(default, skip_serializing_if = "skip::is_default")]
pub metadata: DocMetadata,
/// Effect → Document Raster Effects Settings besides the resolution
diff --git a/crates/doc/src/metadata.rs b/crates/doc/src/metadata.rs
index 151365c5d2..908b649e4d 100644
--- a/crates/doc/src/metadata.rs
+++ b/crates/doc/src/metadata.rs
@@ -1,11 +1,15 @@
//! File → File Info: the document's descriptive metadata (author, description, keywords, rating,
//! copyright) and its created and modified dates, which the SVG, PDF and PNG writers carry. The
-//! document title is [`crate::Document::title`]. Every field is defaulted, so documents saved
-//! before File Info existed load unchanged.
+//! document title is [`Document::title`], the name it shows in its tab and offers Save As when it
+//! has no file; a title the file it was opened from gave itself is [`DocMetadata::title`], and
+//! [`Document::info_title`] is the title File Info shows and exports write. Every field is
+//! defaulted, so documents saved before File Info existed load unchanged.
use chrono::{Datelike, Timelike};
use serde::{Deserialize, Serialize};
+use crate::Document;
+
/// File Info → Copyright Status.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
@@ -44,6 +48,13 @@ pub const MAX_RATING: u8 = 5;
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct DocMetadata {
+ /// The title the file this document was opened from gives itself (an SVG's root ``, a
+ /// PDF's XMP `dc:title` or Info `Title`), which File Info shows and exports write in place of
+ /// [`Document::title`], the document's display name. `None`: the file gave none, so the
+ /// display name is the title. Left out of a saved document when unset, so other documents
+ /// save as they did.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub title: Option,
pub author: String,
/// The author's position or job title.
pub author_title: String,
@@ -83,6 +94,16 @@ impl DocMetadata {
}
}
+impl Document {
+ /// The title File Info shows and the files an export writes carry (PDF `Title` and XMP
+ /// `dc:title`, SVG ``, PNG `Title`): the title the file this document was opened from
+ /// gave itself ([`DocMetadata::title`]), else [`Document::title`]. The display name (the tab, the
+ /// default file name) is always [`Document::title`].
+ pub fn info_title(&self) -> &str {
+ self.metadata.title.as_deref().filter(|t| !t.trim().is_empty()).unwrap_or(&self.title)
+ }
+}
+
/// The time exported files record: PDF `CreationDate` and `ModDate`, the PNG `Creation Time`
/// entry, a zip entry's date, and a saved document's `created` and `modified`. It is the clock,
/// unless `SOURCE_DATE_EPOCH` is set, which replaces it so that the same commands produce the same
@@ -191,6 +212,24 @@ mod tests {
assert!(DocMetadata::default().png_text("").is_empty());
}
+ #[test]
+ fn the_info_title_is_the_files_own_title_else_the_display_name() {
+ let mut d = Document::new(10.0, 10.0);
+ d.title = "box.svg".into();
+ assert_eq!(d.info_title(), "box.svg");
+ d.metadata.title = Some("Access paths".into());
+ assert_eq!((d.title.as_str(), d.info_title()), ("box.svg", "Access paths"));
+ d.metadata.title = Some(" ".into());
+ assert_eq!(d.info_title(), "box.svg");
+ // Saved only when set: other documents' metadata is as before, and the field comes back.
+ d.metadata.title = None;
+ assert!(!serde_json::to_string(&d.metadata).unwrap().contains("title"));
+ d.metadata.title = Some("Access paths".into());
+ let json = serde_json::to_string(&d.metadata).unwrap();
+ assert_eq!(serde_json::from_str::(&json).unwrap().title.as_deref(), Some("Access paths"));
+ assert_eq!(serde_json::from_str::("{}").unwrap().title, None);
+ }
+
/// `SOURCE_DATE_EPOCH` replaces the clock in exported output only when it is a non-negative
/// decimal integer; anything else leaves the clock to decide, so an export is never refused.
#[test]
diff --git a/crates/engine/src/cmd/fileinfo.rs b/crates/engine/src/cmd/fileinfo.rs
index e805757b12..9a59d0f2f8 100644
--- a/crates/engine/src/cmd/fileinfo.rs
+++ b/crates/engine/src/cmd/fileinfo.rs
@@ -1,7 +1,8 @@
//! File → File Info (`file.info`): the document title and its descriptive metadata (author,
//! description, keywords, rating, copyright), with the read-only created and modified dates. The
-//! SVG (with `metadata`), PDF and PNG writers carry it, and a PDF or `.ai` opens with the File Info
-//! it gives ([`read_pdf`]).
+//! title is the one the file the document was opened from gave itself ([`DocMetadata::title`]),
+//! else the document's name. The SVG (with `metadata`), PDF and PNG writers carry it, and a PDF or
+//! `.ai` opens with the File Info it gives ([`read_pdf`]).
use serde_json::{Map, Value, json};
use vectorcraft_doc::metadata::{MAX_RATING, iso8601};
@@ -22,7 +23,7 @@ const READ_ONLY: [&str; 6] = ["created", "modified", "colorMode", "units", "artb
pub(crate) fn info_json(d: &Document) -> Value {
let m = &d.metadata;
json!({
- "title": d.title,
+ "title": d.info_title(),
"author": m.author,
"authorTitle": m.author_title,
"description": m.description,
@@ -48,14 +49,22 @@ pub(crate) fn file_info(s: &mut Session, p: &Value) -> Result {
_ => return Err(bad(C, "params must be an object")),
};
let d = &s.doc()?.doc;
- let (mut title, mut m) = (d.title.clone(), d.metadata.clone());
+ let (mut title, mut m) = (d.info_title().to_string(), d.metadata.clone());
for (k, v) in o {
apply(&mut title, &mut m, k, v)?;
}
let d = &s.doc()?.doc;
- if title != d.title || m != d.metadata {
+ // A title File Info changes becomes the document's own, as it always has (the tab and Save As
+ // offer it where the document has no file), and replaces the one its file gave.
+ let retitled = title != d.info_title();
+ if retitled {
+ m.title = None;
+ }
+ if retitled || m != d.metadata {
s.edit("File Info", |d, _| {
- d.title = title;
+ if retitled {
+ d.title = title;
+ }
d.metadata = m;
Ok(())
})?;
@@ -64,8 +73,8 @@ pub(crate) fn file_info(s: &mut Session, p: &Value) -> Result {
}
/// The File Info a PDF or PDF-compatible `.ai` gives ([`vectorcraft_pdf::file_info`]) into `m`: each
-/// field that `file.info` would take (a value it refuses is left out), and the created and
-/// modified dates.
+/// field that `file.info` would take (a value it refuses is left out), its title ([`imported_title`])
+/// as the File Info title, and the created and modified dates.
pub(crate) fn read_pdf(m: &mut DocMetadata, f: vectorcraft_pdf::FileInfo) {
let status = f.copyrighted.map(|c| if c { CopyrightStatus::Copyrighted } else { CopyrightStatus::PublicDomain });
let fields = [
@@ -83,6 +92,7 @@ pub(crate) fn read_pdf(m: &mut DocMetadata, f: vectorcraft_pdf::FileInfo) {
let _ = apply(&mut title, m, k, &v);
}
}
+ m.title = f.title.as_deref().and_then(imported_title);
m.created = f.created.or(m.created);
m.modified = f.modified.or(m.modified);
}
@@ -141,29 +151,16 @@ fn text(k: &str, v: &Value, multiline: bool) -> Result {
Ok(s.to_string())
}
-/// The title `raw`, read from a file, makes a document: runs of white space (line breaks too)
+/// The File Info title `raw`, read from a file, makes: runs of white space (line breaks too)
/// become single spaces, other control characters are dropped, at most [`MAX_TEXT`] characters
/// are kept, as `file.info` takes a title. `None` when nothing is left, or when it is the
/// Untitled-N name New gives (what a document that never had a title writes to its files).
pub(crate) fn imported_title(raw: &str) -> Option {
- let title = cleaned_title(raw);
- super::fileio::is_own_title(&title).then_some(title)
-}
-
-/// `raw` as `file.info` takes a title (see [`imported_title`]), empty when nothing is left. An
-/// Untitled-N name stays.
-fn cleaned_title(raw: &str) -> String {
let words: Vec =
raw.split_whitespace().map(|w| w.chars().filter(|c| !c.is_control()).collect::()).filter(|w| !w.is_empty()).collect();
let title: String = words.join(" ").chars().take(MAX_TEXT).collect();
- title.trim_end().to_string()
-}
-
-/// The title a document without one of its own takes from its file name's `stem`: cleaned as an
-/// imported title is, so `file.info` takes it, and the Untitled-1 name a new document starts
-/// with when nothing is left of it.
-pub(crate) fn stem_title(stem: &str) -> String {
- Some(cleaned_title(stem)).filter(|t| !t.is_empty()).unwrap_or_else(|| "Untitled-1".to_string())
+ let title = title.trim_end();
+ super::fileio::is_own_title(title).then(|| title.to_string())
}
/// Keywords from a list or a comma- or semicolon-separated string: trimmed, each once (ignoring
diff --git a/crates/engine/src/cmd/fileio/encode.rs b/crates/engine/src/cmd/fileio/encode.rs
index b125e48a88..a3da6316c5 100644
--- a/crates/engine/src/cmd/fileio/encode.rs
+++ b/crates/engine/src/cmd/fileio/encode.rs
@@ -589,7 +589,7 @@ fn encode_files(doc: &Document, f: &Format, p: &Value) -> Result {
let bytes = renderer.export_region(doc, region, format, &settings).map_err(EngineError::Other)?;
// File Info as PNG text chunks.
let bytes = if matches!(format, RasterFormat::Png | RasterFormat::Png8) {
- vectorcraft_render::encode::png::with_text(bytes, &doc.metadata.png_text(&doc.title))
+ vectorcraft_render::encode::png::with_text(bytes, &doc.metadata.png_text(doc.info_title()))
} else {
bytes
};
diff --git a/crates/engine/src/cmd/fileio/eps.rs b/crates/engine/src/cmd/fileio/eps.rs
index f90dacfc71..7a71f4b2ec 100644
--- a/crates/engine/src/cmd/fileio/eps.rs
+++ b/crates/engine/src/cmd/fileio/eps.rs
@@ -326,7 +326,7 @@ fn encode_document(doc: &Document, p: &Value, saving: bool) -> Result {
let o = EpsOptions {
region,
origin,
- title: doc.title.clone(),
+ title: doc.info_title().to_owned(),
created,
native: Some(native(&editing, if saving { None } else { board }, set.include_linked)),
..set.eps.clone()
diff --git a/crates/engine/src/cmd/fileio/formats.rs b/crates/engine/src/cmd/fileio/formats.rs
index 30778f6a6e..289f11139b 100644
--- a/crates/engine/src/cmd/fileio/formats.rs
+++ b/crates/engine/src/cmd/fileio/formats.rs
@@ -778,7 +778,7 @@ pub(crate) fn import_name(base: &str, taken: impl Fn(&str) -> bool) -> String {
/// (the title PDF, PNG and SVG metadata carry). A title of its own stays, and native files keep
/// the stored title.
pub fn has_own_title(doc: &vectorcraft_doc::Document) -> bool {
- is_own_title(&doc.title)
+ is_own_title(doc.info_title())
}
/// Is `title` one a person or a file gave, not blank and not the Untitled-N name New gives?
@@ -790,6 +790,8 @@ pub fn titled_for_export(doc: &vectorcraft_doc::Document, path: Option<&str>, fo
let path = path.filter(|_| !has_own_title(doc) && !matches!(format, "vectorcraft" | "template" | "ai"))?;
let mut d = doc.clone();
d.title = file_stem(path);
+ // A File Info title that is no title of its own (blank, or an Untitled-N name) would hide it.
+ d.metadata.title = None;
Some(d)
}
diff --git a/crates/engine/src/cmd/fileio/legacy_ai.rs b/crates/engine/src/cmd/fileio/legacy_ai.rs
index d4820242d9..97e1258f67 100644
--- a/crates/engine/src/cmd/fileio/legacy_ai.rs
+++ b/crates/engine/src/cmd/fileio/legacy_ai.rs
@@ -142,7 +142,7 @@ pub(super) fn encode(cmd: &str, f: &Format, doc: &Document, p: &Value) -> Result
}
}
}
- let o = vectorcraft_eps::LegacyAiOptions { title: doc.title.clone(), created, hidden, outline_text };
+ let o = vectorcraft_eps::LegacyAiOptions { title: doc.info_title().to_owned(), created, hidden, outline_text };
let out = vectorcraft_eps::export_legacy_ai(&d, &o).map_err(|e| bad(cmd, e))?;
for w in placed.iter().chain(&out.warnings) {
note(&mut enc.warnings, w);
diff --git a/crates/engine/src/cmd/fileio/load.rs b/crates/engine/src/cmd/fileio/load.rs
index 335a3200d1..ba01841c68 100644
--- a/crates/engine/src/cmd/fileio/load.rs
+++ b/crates/engine/src/cmd/fileio/load.rs
@@ -7,10 +7,10 @@ use vectorcraft_doc::{Document, ImageBlob, ImageObject, Node, NodeKind};
use vectorcraft_geom::Affine;
use vectorcraft_render::effects::pixel::LoadedTexture;
-use super::super::fileinfo::{imported_title, stem_title};
+use super::super::fileinfo::imported_title;
use super::super::{Result, Session, bad, bool_or, clipboard, parse_range, str_param};
use super::pdfimport::LoadOptions;
-use super::{Format, SAVE_FORMATS, absolute_path, file_stamp, file_stem, format, psdread, read_file, readable_format_for_name};
+use super::{Format, SAVE_FORMATS, absolute_path, file_stamp, format, psdread, read_file, readable_format_for_name};
use crate::cmd::links::Resolved;
use crate::{EngineError, Prefs};
@@ -391,12 +391,10 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result
};
// A PDF, `.ai` or `.ait` read from its pages or its editing copy, not restored from the document
// it carries, opens with the File Info it gives (a PostScript `.ai` gives none).
- let mut pdf_title = None;
if matches!(format.id, "pdf" | "ai" | "ait")
&& !restored
&& let Some(info) = vectorcraft_pdf::file_info(bytes, opts.password.as_deref())
{
- pdf_title = info.title.clone();
super::super::fileinfo::read_pdf(&mut doc.metadata, info);
}
// Threaded type read from a file flows through its frames (the threaded type of a restored
@@ -413,18 +411,18 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result
if let Some(mode) = opts.color_mode.filter(|m| *m != doc.color_mode) {
super::super::colormgmt::set_color_mode(&mut doc, mode, true, None, opts.grays);
}
- // The document is titled as the file titles it: a native document keeps its own title, one
- // restored from the editing data a file carries and an SVG keep the title they hold (the SVG's
- // ``), a PDF, `.ai` or `.ait` takes its XMP `dc:title` or Info `Title`. Without one the
- // document takes the file name without its extension, as an export does (#3626). The tab shows
- // the file name once the document has a path.
- let own = match format.id {
- "vectorcraft" | "template" => Some(doc.title.clone()).filter(|t| !t.is_empty()),
- _ if restored || matches!(format.id, "svg" | "svgz") => imported_title(&doc.title),
- "pdf" | "ai" | "ait" => pdf_title.as_deref().and_then(imported_title),
- _ => None,
- };
- doc.title = own.unwrap_or_else(|| stem_title(&file_stem(&title)));
+ // The title the file gives itself (an SVG's ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title`
+ // or Info `Title`, which the readers put in File Info; the one a native document holds) is the
+ // File Info title, cleaned as `file.info` takes one. A file restored from the editing data it
+ // carries gives the title that document had, unless that is the file's name. The document's own
+ // name stays what it has always been: the file's name (#3626).
+ let held = restored.then_some(doc.title.as_str()).filter(|t| *t != title);
+ doc.metadata.title = doc.metadata.title.as_deref().or(held).and_then(imported_title);
+ // Imports are named after the file; a native document keeps its own title (the tab shows the
+ // file name once it has a path).
+ if !matches!(format.id, "vectorcraft" | "template") || doc.title.is_empty() {
+ doc.title = title;
+ }
warnings.extend(doc.images.values().filter_map(|b| size_note(&b.bytes)));
Ok(Loaded { doc, format, warnings, restored, converted, preview_only, editing_data })
}
@@ -540,6 +538,7 @@ fn open_loaded(s: &mut Session, loaded: Loaded, links: Resolved, path: Option Res
// With the artboards' background colors, as the pages draw them.
let art = super::export::with_artboard_fills(art, ¶ms, 0..art.artboards.len()).map_err(|e| bad(cmd, e))?;
let o = vectorcraft_eps::AiEditingOptions {
- title: doc.title.clone(),
+ title: doc.info_title().to_owned(),
created: doc.metadata.created.or_else(vectorcraft_doc::metadata::output_time),
};
let (data, lost) = vectorcraft_eps::ai_private_data(&art, &o).map_err(|e| bad(cmd, e))?;
diff --git a/crates/engine/src/cmd/fileio/tests.rs b/crates/engine/src/cmd/fileio/tests.rs
index d3714e82e8..69158c04b8 100644
--- a/crates/engine/src/cmd/fileio/tests.rs
+++ b/crates/engine/src/cmd/fileio/tests.rs
@@ -67,8 +67,7 @@ fn opens_every_readable_format() {
] {
let r = open(&mut s, name, &bytes);
assert_eq!(r["format"], format, "{name}");
- // The document that wrote the file never had a title of its own, so the file gives none and the name (without its extension) titles it.
- assert_eq!(r["title"], if format == "vectorcraft" { "Untitled-1" } else { "a" }, "{name}");
+ assert_eq!(r["title"], if format == "vectorcraft" { "Untitled-1" } else { name }, "{name}");
assert!(s.doc().unwrap().doc.node_count() >= 2, "{name}: the rectangle came through");
}
for (name, kind) in [
diff --git a/crates/engine/src/cmd/fileio/tests_dxfimport.rs b/crates/engine/src/cmd/fileio/tests_dxfimport.rs
index c7de9d9e16..ec7b295c23 100644
--- a/crates/engine/src/cmd/fileio/tests_dxfimport.rs
+++ b/crates/engine/src/cmd/fileio/tests_dxfimport.rs
@@ -120,11 +120,7 @@ const MM: f64 = 72.0 / 25.4;
fn document_open_reads_a_dxf_drawing() {
let mut s = Session::new();
let r = open(&mut s, &plan(), json!({})).unwrap();
- assert_eq!(
- (r["format"].as_str(), r["title"].as_str()),
- (Some("dxf"), Some("plan")),
- "a file that carries no title opens as its name without the extension"
- );
+ assert_eq!((r["format"].as_str(), r["title"].as_str()), (Some("dxf"), Some("plan.dxf")));
assert_eq!(layer_names(&s), ["Walls", "Notes"]);
let st = s.doc().unwrap();
// Millimetres at 1:1, the artboard the art's size.
diff --git a/crates/engine/src/cmd/fileio/tests_epsimport.rs b/crates/engine/src/cmd/fileio/tests_epsimport.rs
index 0e9b8e805f..8c4141902c 100644
--- a/crates/engine/src/cmd/fileio/tests_epsimport.rs
+++ b/crates/engine/src/cmd/fileio/tests_epsimport.rs
@@ -64,7 +64,7 @@ fn other_eps_files_are_read_by_the_postscript_interpreter() {
// The page is the bounding box: the art's bounds.
assert_eq!(d.artboards[0].rect.size(), vectorcraft_geom::Size::new(101.0, 51.0), "the stroke's half width rounds up to whole points");
assert_eq!(objects(&s), 1);
- assert_eq!(s.doc().unwrap().title(), "plain");
+ assert_eq!(s.doc().unwrap().title(), "plain.eps");
}
/// A CMYK image the PostScript interpreter reads keeps its ink amounts when the EPS opens and when
diff --git a/crates/engine/src/cmd/fileio/tests_svg.rs b/crates/engine/src/cmd/fileio/tests_svg.rs
index ff3a73432c..73ee604a98 100644
--- a/crates/engine/src/cmd/fileio/tests_svg.rs
+++ b/crates/engine/src/cmd/fileio/tests_svg.rs
@@ -138,7 +138,7 @@ fn preserve_editing_reopens_the_native_document() {
let doc = &s.doc().unwrap().doc;
assert_eq!(doc.artboards.len(), 2, "both artboards came back");
assert_eq!(doc.artboards[1].name, "Back");
- assert_eq!(doc.title, "both");
+ assert_eq!(doc.title, "both.svg");
// Without it the SVG is imported (one artboard).
let text = svg(&mut s, json!({}));
s.execute("document.open", &json!({"name": "plain.svg", "dataBase64": vectorcraft_format::base64_encode(text.as_bytes())})).unwrap();
diff --git a/crates/engine/src/cmd/webexport.rs b/crates/engine/src/cmd/webexport.rs
index af0f313ea1..f31c82e29e 100644
--- a/crates/engine/src/cmd/webexport.rs
+++ b/crates/engine/src/cmd/webexport.rs
@@ -644,7 +644,7 @@ fn flatten(rgba: &[u8], matte: [u8; 3]) -> impl Iterator- + '_ {
/// The File Info text `s.metadata` lets into the files: `(keyword, text)`.
fn metadata(doc: &Document, s: &WebSettings) -> Vec<(&'static str, String)> {
- doc.metadata.png_text(&doc.title).into_iter().filter(|(k, _)| s.metadata.keeps(k)).map(|(k, v)| (k, v.into_owned())).collect()
+ doc.metadata.png_text(doc.info_title()).into_iter().filter(|(k, _)| s.metadata.keeps(k)).map(|(k, v)| (k, v.into_owned())).collect()
}
/// Encode straight RGBA pixels (`w`×`h`) as `s` says; `doc` gives the metadata.
diff --git a/crates/engine/src/inspect.rs b/crates/engine/src/inspect.rs
index 14df8529d7..a60ffe7b14 100644
--- a/crates/engine/src/inspect.rs
+++ b/crates/engine/src/inspect.rs
@@ -270,8 +270,8 @@ fn document_base(s: &Session) -> Value {
json!({
"uid": st.uid,
"title": st.title(),
- // The File Info title (`file.info`), where `title` comes from the file name once the document has one.
- "fileInfoTitle": d.title,
+ // The File Info title (`file.info`): the title the file gave itself, else the document's name. `title` is the tab's name.
+ "fileInfoTitle": d.info_title(),
"path": st.path,
"dirty": st.is_dirty(),
"revision": st.revision,
diff --git a/crates/engine/src/tests/fileinfo.rs b/crates/engine/src/tests/fileinfo.rs
index 4cb511b99c..249af96abc 100644
--- a/crates/engine/src/tests/fileinfo.rs
+++ b/crates/engine/src/tests/fileinfo.rs
@@ -161,7 +161,8 @@ fn an_exported_pdf_opens_with_its_file_info() {
assert_eq!(back["description"], "A poster\nfor the fair");
assert_eq!(back["keywords"], json!(["fair", "Poster", "print"]));
assert!(back["created"].as_str().is_some_and(|c| c.ends_with('Z')), "the file's creation date: {}", back["created"]);
- assert_eq!(back["title"], "Poster", "the title is the one the PDF carries, not its file name");
+ assert_eq!(back["title"], "Poster", "File Info shows the title the PDF carries");
+ assert_eq!(s.doc().unwrap().title(), "poster.pdf", "the document stays named after the file");
assert_eq!(back["copyrightStatus"], "copyrighted");
assert_eq!(back["copyrightNotice"], "(c) 2026 Ada");
assert_eq!(back["copyrightUrl"], "https://example.com/rights");
@@ -307,67 +308,129 @@ fn pdf_titled(info: Option<&str>, xmp_title: Option<&str>) -> Vec
{
String::from_utf8(bytes).unwrap().replacen("/Root 1 0 R", &format!("/Root 1 0 R /Info {info_at} 0 R"), 1).into_bytes()
}
-/// The title `document.open` gives a file called `name` with content `bytes`.
-fn opened_title(name: &str, bytes: &[u8]) -> String {
+/// A document called `name` with content `bytes` opened (as `document.open` with no path: the tab
+/// shows the document's name), `s` holding it.
+fn open_named(s: &mut Session, name: &str, bytes: &[u8]) -> Value {
+ s.execute("document.open", &json!({"name": name, "dataBase64": vectorcraft_format::base64_encode(bytes)})).unwrap()
+}
+
+/// The document's name (its tab) and its File Info title.
+fn titles(s: &mut Session) -> [String; 2] {
+ let info = s.execute("file.info", &json!({})).unwrap();
+ [s.doc().unwrap().title(), info["title"].as_str().unwrap().to_string()]
+}
+
+/// What opening `bytes` as a file called `name` gives: the document's name and its File Info title.
+fn opened(name: &str, bytes: &[u8]) -> [String; 2] {
let mut s = Session::new();
- let r = s.execute("document.open", &json!({"name": name, "dataBase64": vectorcraft_format::base64_encode(bytes)})).unwrap();
- assert_eq!(r["fileInfoTitle"], s.doc().unwrap().doc.title.as_str());
- s.doc().unwrap().doc.title.clone()
+ let r = open_named(&mut s, name, bytes);
+ let t = titles(&mut s);
+ assert_eq!((r["title"].as_str(), r["fileInfoTitle"].as_str()), (Some(t[0].as_str()), Some(t[1].as_str())), "the open reply");
+ assert_eq!(s.doc().unwrap().doc.title, t[0], "the tab is the document's title");
+ t
+}
+
+fn svg_titled(inner: &str) -> String {
+ format!(
+ "{inner}Tooltip "
+ )
}
#[test]
-fn import_uses_the_files_own_title() {
- // SVG: the root's ``, its white space made single spaces; not a shape's tooltip.
- let svg = |inner: &str| {
- format!(
- "{inner}Tooltip "
- )
- };
- assert_eq!(opened_title("box.svg", svg("\n Access\n paths ").as_bytes()), "Access paths");
+fn import_puts_the_files_own_title_in_file_info_only() {
+ // SVG: the root's ``, its white space made single spaces (not a shape's tooltip), is the
+ // File Info title; the document keeps the file's name, with its extension.
+ assert_eq!(opened("box.svg", svg_titled("\n Access\n paths ").as_bytes()), ["box.svg", "Access paths"]);
assert_eq!(
- opened_title("box.svg", svg("Zugangswege Rechenzentrum – Prüfdiagramm ").as_bytes()),
- "Zugangswege Rechenzentrum – Prüfdiagramm"
+ opened("/work/box.svg", svg_titled("Zugangswege Rechenzentrum – Prüfdiagramm ").as_bytes()),
+ ["box.svg", "Zugangswege Rechenzentrum – Prüfdiagramm"]
);
// PDF: the XMP `dc:title` (its `x-default` item) beats the Info `Title`; the Info `Title` stands alone.
- assert_eq!(opened_title("plan.pdf", &pdf_titled(Some("/Title (Info title)"), Some("XMP title"))), "XMP title");
- assert_eq!(opened_title("plan.pdf", &pdf_titled(None, Some("XMP title"))), "XMP title");
- assert_eq!(opened_title("plan.pdf", &pdf_titled(Some("/Title (Info title)"), None)), "Info title");
- assert_eq!(opened_title("plan.ai", &pdf_titled(Some("/Title (Info title)"), None)), "Info title");
- // A file that gives none (or a blank one): its name without the extension, in a folder too.
- assert_eq!(opened_title("box.svg", svg("").as_bytes()), "box");
- assert_eq!(opened_title("/work/box.svg", svg(" ").as_bytes()), "box");
- assert_eq!(opened_title("plan.pdf", &pdf_titled(None, None)), "plan");
- assert_eq!(opened_title("plan.pdf", &pdf_titled(Some("/Author (Ada)"), None)), "plan");
+ assert_eq!(opened("plan.pdf", &pdf_titled(Some("/Title (Info title)"), Some("XMP title"))), ["plan.pdf", "XMP title"]);
+ assert_eq!(opened("plan.pdf", &pdf_titled(None, Some("XMP title"))), ["plan.pdf", "XMP title"]);
+ assert_eq!(opened("plan.pdf", &pdf_titled(Some("/Title (Info title)"), None)), ["plan.pdf", "Info title"]);
+ assert_eq!(opened("plan.ai", &pdf_titled(Some("/Title (Info title)"), None)), ["plan.ai", "Info title"]);
+ // Compressed SVG too.
+ let svgz = |inner: &str| vectorcraft_svg::compress(&svg_titled(inner));
+ assert_eq!(opened("box.svgz", &svgz("Access paths ")), ["box.svgz", "Access paths"]);
+ // A file that gives none (or a blank one) gives File Info the document's name.
+ assert_eq!(opened("box.svg", svg_titled("").as_bytes()), ["box.svg", "box.svg"]);
+ assert_eq!(opened("box.svg", svg_titled(" ").as_bytes()), ["box.svg", "box.svg"]);
+ assert_eq!(opened("plan.pdf", &pdf_titled(None, None)), ["plan.pdf", "plan.pdf"]);
+ assert_eq!(opened("plan.pdf", &pdf_titled(Some("/Author (Ada)"), None)), ["plan.pdf", "plan.pdf"]);
// The Untitled-N name New gives is no title (a document that never had one writes it).
- assert_eq!(opened_title("plan.pdf", &pdf_titled(Some("/Title (Untitled-2)"), None)), "plan");
- // A native file keeps the title it has.
- let mut s = session();
- let native = vectorcraft_format::base64_encode(&b64(&s.execute("document.export", &json!({"format": "vectorcraft"})).unwrap()));
+ assert_eq!(opened("plan.pdf", &pdf_titled(Some("/Title (Untitled-2)"), None)), ["plan.pdf", "plan.pdf"]);
+ // A template opens as a new untitled document, whatever title its file gave.
+ let [name, info] = opened("plan.ait", &pdf_titled(Some("/Title (Info title)"), None));
+ assert!(name.starts_with("Untitled-") && info == name, "{name} / {info}");
+}
+
+#[test]
+fn a_file_with_a_title_opened_from_a_path_is_named_after_the_file() {
+ let dir = std::env::temp_dir().join(format!("vc-infotitle-open-{}", std::process::id()));
+ std::fs::create_dir_all(&dir).unwrap();
+ let path = dir.join("box.svg");
+ std::fs::write(&path, svg_titled("Access paths ")).unwrap();
+ let mut s = Session::new();
+ let r = s.execute("document.open", &json!({"path": path.to_str().unwrap()})).unwrap();
+ assert_eq!((r["title"].as_str(), r["fileInfoTitle"].as_str()), (Some("box.svg"), Some("Access paths")));
+ let r = s.execute("document.inspect", &json!({"depth": 0})).unwrap();
+ assert_eq!((r["title"].as_str(), r["fileInfoTitle"].as_str()), (Some("box.svg"), Some("Access paths")));
+ // The default names of what the document exports are made from the file's name, not its title.
+ assert_eq!(s.doc().unwrap().doc.title, "box.svg");
+ assert_eq!(crate::cmd::fileio::default_name(&s.doc().unwrap().doc, "png"), "box.png");
+ let _ = std::fs::remove_dir_all(dir);
+}
+
+#[test]
+fn file_info_edits_a_files_own_title_and_the_document_follows() {
+ let mut s = Session::new();
+ open_named(&mut s, "box.svg", svg_titled("Access paths ").as_bytes());
+ // The dialog sends back the title it was given: nothing changes (no undo step).
+ let before = s.doc().unwrap().revision;
+ let shown = s.execute("file.info", &json!({})).unwrap();
+ s.execute("file.info", &shown).unwrap();
+ assert_eq!(s.doc().unwrap().revision, before, "the title it gave is no edit");
+ assert_eq!(titles(&mut s), ["box.svg", "Access paths"]);
+ // Another title is the document's own, as ever, and the file's is gone.
+ let r = s.execute("file.info", &json!({"title": "Plan B"})).unwrap();
+ assert_eq!(r["title"], "Plan B");
+ assert_eq!(titles(&mut s), ["Plan B", "Plan B"]);
+ assert_eq!(s.doc().unwrap().doc.metadata.title, None);
+ // Undo brings the file's title back, and the name.
+ s.execute("edit.undo", &json!({})).unwrap();
+ assert_eq!(titles(&mut s), ["box.svg", "Access paths"]);
+}
+
+#[test]
+fn the_files_own_title_is_kept_by_saves_and_written_by_exports() {
+ let mut s = Session::new();
+ open_named(&mut s, "box.svg", svg_titled("Access paths ").as_bytes());
+ // The native file: its own title is the document's name, the File Info title survives.
+ let native = b64(&s.execute("document.export", &json!({"format": "vectorcraft"})).unwrap());
let mut t = Session::new();
- t.execute("document.open", &json!({"name": "other.vectorcraft", "dataBase64": native})).unwrap();
- assert_eq!(t.doc().unwrap().doc.title, "Poster");
-}
-
-#[test]
-fn compressed_svg_keeps_its_title() {
- let svgz = |inner: &str| {
- vectorcraft_svg::compress(&format!(
- "{inner} "
- ))
- };
- assert_eq!(opened_title("box.svgz", &svgz("Access paths ")), "Access paths");
- assert_eq!(opened_title("box.svgz", &svgz("")), "box");
-}
-
-#[test]
-fn file_name_title_is_cleaned_like_an_imported_one() {
- let svg = b" ";
- // A name `file.info` would reject (white space only) or that keeps control characters.
- assert_eq!(opened_title(" .svg", svg), "Untitled-1");
- assert_eq!(opened_title("\u{1}\u{7f}.svg", svg), "Untitled-1");
- assert_eq!(opened_title("bo\u{1}x two\t.svg", svg), "box two");
- // The Untitled-N name stays the stem.
- assert_eq!(opened_title("Untitled-7.svg", svg), "Untitled-7");
+ open_named(&mut t, "other.vectorcraft", &native);
+ assert_eq!(titles(&mut t), ["box.svg", "Access paths"]);
+ // An SVG with the editing data it carries, reopened under another name.
+ let svg = s.execute("document.serialize", &json!({"format": "svg", "preserveEditing": true, "metadata": true})).unwrap()["text"]
+ .as_str()
+ .unwrap()
+ .to_string();
+ assert!(svg.contains("Access paths ") && svg.contains("Access paths "), "{svg}");
+ let mut u = Session::new();
+ let r = open_named(&mut u, "again.svg", svg.as_bytes());
+ assert_eq!(r["restored"], true);
+ assert_eq!(titles(&mut u), ["again.svg", "Access paths"]);
+ // PDF: the Info `Title` and the XMP `dc:title`, shown by the viewer.
+ for pdf in pdf_texts(&mut s) {
+ assert!(pdf.contains("/Title(Access paths)") && xmp_title(&pdf).contains("Access paths"), "{}", xmp_title(&pdf));
+ assert!(pdf.contains("/ViewerPreferences<>"), "{pdf}");
+ }
+ // PNG text.
+ let png = b64(&s.execute("document.export", &json!({"format": "png"})).unwrap());
+ assert!(crate::cmd::fileio::pngtext::text(&png).iter().any(|(k, v)| k == "Title" && v == "Access paths"));
+ // The default file names are made from the document's name.
+ assert_eq!(crate::cmd::fileio::default_name(&s.doc().unwrap().doc, "pdf"), "box.pdf");
}
#[test]
diff --git a/crates/metafile/src/lib.rs b/crates/metafile/src/lib.rs
index 5326e2f307..a517d516a6 100644
--- a/crates/metafile/src/lib.rs
+++ b/crates/metafile/src/lib.rs
@@ -84,7 +84,7 @@ pub fn export(doc: &Document, region: Rect, kind: Kind) -> Result emf::write(&ops, r, &doc.title),
+ Kind::Emf => emf::write(&ops, r, doc.info_title()),
Kind::Wmf => wmf::write(&ops, r, &mut warnings),
};
Ok(Output { bytes, warnings })
diff --git a/crates/pdf/src/export/entry.rs b/crates/pdf/src/export/entry.rs
index 6a4294c699..54d1f207a9 100644
--- a/crates/pdf/src/export/entry.rs
+++ b/crates/pdf/src/export/entry.rs
@@ -48,7 +48,9 @@ fn export_with_report_inner(doc: &Document, opts: &PdfOptions, left_out: &mut Ha
let doc = baked.as_ref().unwrap_or(doc);
let pages = pages(doc, opts)?;
- let title = crate::pdfx::title(set.standard, opts.title.clone().unwrap_or_else(|| doc.title.clone()));
+ // The file's Title is File Info's; the page information names the document, as its tab does.
+ let title = crate::pdfx::title(set.standard, opts.title.clone().unwrap_or_else(|| doc.info_title().to_owned()));
+ let name = opts.title.as_deref().unwrap_or(&doc.title);
// The time of writing (none on the web) dates the editing data and the page information.
let now = vectorcraft_doc::metadata::output_time();
let created_at = opts.created.or(now);
@@ -86,7 +88,7 @@ fn export_with_report_inner(doc: &Document, opts: &PdfOptions, left_out: &mut Ha
vectorcraft_doc::cancel::check().map_err(|_| PdfError::Cancelled)?;
vectorcraft_doc::cancel::progress(written as u64 + 1, total, &format!("Writing page {} of {total}", written + 1));
let (m, r) = (boxes.media, boxes.bleed);
- let info = if marks.page_info { crate::marks::page_info(doc, &title, i, now) } else { String::new() };
+ let info = if marks.page_info { crate::marks::page_info(doc, name, i, now) } else { String::new() };
let art = crate::marks::art(doc, &marks, &boxes, bleed, &info);
// The page is the media box, y down from its top-left corner (like ours), in units of
// `unit` points.
diff --git a/crates/pdf/src/tests/file_info.rs b/crates/pdf/src/tests/file_info.rs
index f7c5d694b6..4c837ba67f 100644
--- a/crates/pdf/src/tests/file_info.rs
+++ b/crates/pdf/src/tests/file_info.rs
@@ -220,6 +220,16 @@ fn a_written_pdf_gives_its_file_info_back() {
assert_eq!((f.created, f.modified), (Some(CREATED), Some(CREATED)));
}
+#[test]
+fn a_written_pdf_carries_the_file_info_title_not_the_documents_name() {
+ let mut d = Document::new(100.0, 100.0);
+ d.title = "poster.svg".into();
+ d.metadata.title = Some("Fair poster".into());
+ let bytes = export(&d, &PdfOptions { created: Some(CREATED), ..PdfOptions::uncompressed() }).unwrap();
+ assert_eq!(file_info(&bytes, None).unwrap().title.as_deref(), Some("Fair poster"));
+ assert!(!String::from_utf8_lossy(&bytes).contains("poster.svg"));
+}
+
#[test]
fn a_written_pdf_gives_its_copyright_back() {
use vectorcraft_doc::CopyrightStatus;
diff --git a/crates/svg/src/export.rs b/crates/svg/src/export.rs
index 13c4268472..e905a7189a 100644
--- a/crates/svg/src/export.rs
+++ b/crates/svg/src/export.rs
@@ -186,7 +186,7 @@ fn write(doc: &Document, opts: &ExportOptions, native: Option<&[u8]>, id_prefix:
// An artboard exported on its own is named after it (#3544), else after the document.
// A name that is blank once the characters XML can't hold are dropped falls back too.
let board = opts.artboard.filter(|_| opts.artboard_title).and_then(|i| doc.artboards.get(i)).map(|a| xml_text(&a.name));
- let title = board.filter(|n| !n.trim().is_empty()).unwrap_or_else(|| xml_text(&doc.title));
+ let title = board.filter(|n| !n.trim().is_empty()).unwrap_or_else(|| xml_text(doc.info_title()));
if !title.is_empty() {
out.push_str(&w.indent(1));
out.push_str(&format!("{title} {nl}"));
diff --git a/crates/svg/src/export/output.rs b/crates/svg/src/export/output.rs
index 01d33c833b..e3ad5722a1 100644
--- a/crates/svg/src/export/output.rs
+++ b/crates/svg/src/export/output.rs
@@ -88,7 +88,7 @@ fn dublin_core(doc: &Document) -> Vec<(&'static str, String)> {
let info = &doc.metadata;
let mut terms = vec![("format", "image/svg+xml".to_string())];
let created = info.created.map(vectorcraft_doc::metadata::iso8601).unwrap_or_default();
- let fields = [("title", doc.title.as_str()), ("creator", info.author.as_str()), ("description", info.description.as_str())];
+ let fields = [("title", doc.info_title()), ("creator", info.author.as_str()), ("description", info.description.as_str())];
let rights = [("rights", info.copyright_notice.as_str()), ("rights", info.copyright_url.as_str()), ("date", created.as_str())];
let keywords = info.keywords.iter().map(|k| ("subject", k.as_str()));
terms.extend(fields.into_iter().chain(keywords).chain(rights).filter(|(_, v)| !v.trim().is_empty()).map(|(k, v)| (k, v.to_string())));
diff --git a/crates/svg/src/import.rs b/crates/svg/src/import.rs
index aa625de695..78e1f16a46 100644
--- a/crates/svg/src/import.rs
+++ b/crates/svg/src/import.rs
@@ -142,11 +142,9 @@ pub(crate) fn import(svg: &str, opts: &ImportOptions, max_nodes: usize) -> Resul
let k = units.k;
let mut doc = Document::new(size.width() as f64 * k, size.height() as f64 * k);
doc.units = units.unit;
- // The file's own title, when it gives one; else the document keeps the placeholder name
- // `Document::new` gave it, for the caller to name after the file.
- if let Some(title) = root_title(xml.root_element()) {
- doc.title = title;
- }
+ // The file's own title, when it gives one, is the document's File Info title; the document's
+ // name stays what `Document::new` gave it, for the caller to name after the file.
+ doc.metadata.title = root_title(xml.root_element());
let mut im = Importer {
doc,
warnings,
diff --git a/crates/svg/tests/it/title_control_chars.rs b/crates/svg/tests/it/title_control_chars.rs
index 3318ed346f..2318eebc67 100644
--- a/crates/svg/tests/it/title_control_chars.rs
+++ b/crates/svg/tests/it/title_control_chars.rs
@@ -69,3 +69,29 @@ fn dublin_core_metadata_control_chars_are_filtered() {
assert!(svg.contains("kw "));
assert!(svg.contains("(c) me "));
}
+
+/// The root's `` is the File Info title of the imported document ([`Document::info_title`]);
+/// its name stays what `Document::new` gave it, and a shape's `` is that shape's tooltip.
+#[test]
+fn the_roots_title_is_the_file_info_title_not_the_documents_name() {
+ let svg = |inner: &str| {
+ format!(r#"{inner}Tip "#)
+ };
+ let d = import(&svg("\n Access\n paths ")).unwrap();
+ assert_eq!((d.title.as_str(), d.metadata.title.as_deref(), d.info_title()), ("Untitled-1", Some("Access paths"), "Access paths"));
+ for none in [svg(""), svg(" ")] {
+ let d = import(&none).unwrap();
+ assert_eq!((d.title.as_str(), d.metadata.title.as_deref(), d.info_title()), ("Untitled-1", None, "Untitled-1"));
+ }
+}
+
+/// Exports write the File Info title, where the document has one, in place of its name.
+#[test]
+fn exports_write_the_file_info_title() {
+ let mut d = Document::new(200.0, 200.0);
+ d.title = "box.svg".into();
+ d.metadata.title = Some("Access paths".into());
+ let svg = export(&d, &ExportOptions { metadata: true, ..ExportOptions::default() });
+ assert!(svg.contains("Access paths ") && svg.contains("Access paths "), "{svg}");
+ assert!(!svg.contains("box.svg"), "{svg}");
+}
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index 5b5101a5f2..f7ff2021c9 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,6 +1,6 @@
# File format parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (an imported document takes the title its file carries; previously: native format: dynamic symbols, #4938) · **Target:** Adobe Illustrator 2026 (30.x)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (an imported document's own title goes into File Info only; previously: native format: dynamic symbols, #4938) · **Target:** Adobe Illustrator 2026 (30.x)
Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`,
`OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public
@@ -166,7 +166,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri
| Date | Change | Summary |
|---|---|---|
-| 2026-11-03 | minor | An imported document takes the title its file carries: an SVG's root ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title` else its Info `Title`; a file that gives none opens with its file name without the extension (#3626). |
+| 2026-11-03 | minor | An imported document's own title goes into File Info only (#3626): an SVG's root ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title` else its Info `Title` is File Info's title (`metadata.title` in the native format, left out when unset so other documents save unchanged and older versions ignore it; written by exports); the document's name, which the tab, Save As and the default export names use, stays the file's name. |
| 2026-11-01 | minor | Native format: a symbol's Symbol Type (`dynamic`) and a dynamic symbol instance's appearance changes to objects of its art (`symbol_overrides`) round-trip; both are left out when unset, so other documents save unchanged (#4938). `.ai` reading and writing of dynamic symbols remains. |
| 2026-11-01 | minor | Exports draw each artboard's background color behind its art (#4937): PNG, JPEG, GIF, TIFF, WebP, BMP, Targa and PSD (a layer of its own; on a transparent background too), PDF, SVG and EPS pages, a `.ai` file's PDF pages and PostScript and PDF print; `includeArtboardFill: false` leaves it out. Files with editing data (Preserve Editing, `.ai`, EPS, native) keep it as the artboard's color and reopen without extra art. Not read from the reference app's own `.ai` data, nor written to it. DXF, EMF and WMF leave it out |
| 2026-10-31 | minor | PDF import finds an installed font whose PDF name holds hyphens (`Noto-Sans-Bold` is Noto Sans, Bold: the longest part before a hyphen that names an installed family) and a composite font by its CIDFont's name rather than its base name, which ends in the CMap's (`Name-Identity-H`, [ISO 32000-1 §9.7.6.1](https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf)); a missing font is split only before a style part (`Helvetica-BoldOblique`), so it is reported as `MS PGothic`, not `MS`; scores unchanged (estimated) |
diff --git a/docs/gaps.md b/docs/gaps.md
index bd4f5488f3..463fe76b82 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -1,6 +1,6 @@
# Gaps
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (an imported document takes the title its file carries; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (an imported document's own title goes into File Info only; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
## Feature submission evidence
@@ -733,7 +733,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv
| Date | Change | Summary |
|---|---|---|
-| 2026-11-03 | minor | An imported document takes the title its file carries (an SVG's root ``, a PDF's XMP `dc:title` else its Info `Title`), else its file name without the extension, instead of the file name with it (#3626); no scored gap or estimate reassessed. |
+| 2026-11-03 | minor | An imported document's own title (an SVG's root ``, a PDF's XMP `dc:title` else its Info `Title`) goes into File Info only; the document's name stays the file's name (#3626); no scored gap or estimate reassessed. |
| 2026-11-02 | minor | G15: the renderer keeps a compound path's assembled path between frames and drops unused geometry entries after a few frames however few there are. Estimate unchanged. |
| 2026-11-02 | minor | G15: hit testing culls paths and compound paths by their control points' box and tests a compound path's outline and fill against only its members near the click; the same objects are hit. Estimate unchanged. |
| 2026-11-03 | minor | Symbol editing shows draggable 9-slice guides within the artwork (#5280). Guides outside the artwork remain unsupported. The G5 estimate remains 14–24 h. |
diff --git a/docs/mcp.md b/docs/mcp.md
index 72bf8f8885..8c2e228bd7 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -3940,9 +3940,16 @@ that its XMP packet (`dc:title`, `dc:creator`, `dc:description`, `dc:subject` or
(`Title`, `Author`, `Subject`, `Keywords`, `CreationDate`, `ModDate`) give, the XMP packet's value where both give
one (for `dc:title` and `dc:description`, the `x-default` language item first). An SVG opens with the `title` of its
root `` element (not a shape's or group's). A title is read with its white space made single spaces and
-without control characters, at most 65,536 characters, as `file.info` takes one. A file that gives no title, a blank
-one or the `Untitled-N` name New gives, opens with its file name without the extension (`box.svg` opens as `box`), and a native file keeps its own
-title. A value that `file.info` would refuse is left out, and a template opens with a new untitled name.
+without control characters, at most 65,536 characters, as `file.info` takes one. A value that `file.info` would
+refuse is left out. A file that gives no title, a blank one or the `Untitled-N` name New gives leaves File Info with
+the document's name as its title, and a template opens with a new untitled name.
+The title a file gave is File Info's alone: the document's name, which is what its tab shows until it has a file and
+what Save As and the default export names start from, stays the file's name with its extension (`box.svg`), or the
+title a native file holds. File Info's `title` is the one the file gave, else the document's name. It is saved with the
+document (a native file, and the editing data of an SVG, PDF, `.ai` or EPS that carries it), and the files an export
+writes carry it (PDF `Title` and XMP `dc:title`, SVG `` and Dublin Core, PNG text, EPS and `.ai` `%%Title`),
+where the document has one. Changing the `title` with `file.info` sets the document's name, as it always did, and drops
+the title the file gave.
`document.inspect` (`inspect_document`) and the `document.open` (`open_file`) reply report the File Info title as
`fileInfoTitle`. Their `title` is the document's tab name, which comes from the file name once the document is saved
to or opened from a file (with ` [Converted]` or ` [Recovered]` where that applies).
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index 412dbba039..23627465dc 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1,6 +1,6 @@
# Parity with Adobe Illustrator
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (Type core options status and Kashidas feature revision corrected; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; an imported document takes the title its file carries; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (an imported document's own title goes into File Info only; previously: Type core options status and Kashidas feature revision corrected; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026)
## Feature submission evidence
@@ -1180,7 +1180,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- File › Place with Bounding Box (`file.place {crop: "bounding"}`) measures the art that shows, with its strokes and effects, as an export does: hidden objects, guides and template layers do not count, a group whose only part on the page or artboard is hidden is not placed, and symbol instances are measured by their art, for `at`, `rect`, the place cursor and `file.place.info` (`crates/engine/src/tests/place.rs`).
- Separations Preview shows placed and embedded raster images on the visible plates, as it shows vector art (#4153): an RGB image's pixels are separated into process inks with the proof setup's intent, a CMYK image shows its own inks, a hidden plate's ink leaves the image, and with one plate visible the image shows that plate's ink as a grey. Raster images carry no spot ink, so a spot plate shown alone shows them as paper; a colorized image shows its color's plates. Emoji and other bitmap glyphs follow the same rule. The plate-filtered pixels and their reduced-size copies are kept apart from the image's own pixels, for each set of visible plates, proof setup and color settings, and with the preview off nothing changes. Evidence: `tests::colorize::separations_preview_shows_an_rgb_images_process_inks`, `separations_preview_shows_a_cmyk_images_own_inks`, `separations_preview_keeps_an_images_pixels_per_plate_set`. Print preview fidelity remains the open gap, so scores and hours are unchanged.
- Desktop print transport uses `craft-print` for CUPS and modern Windows. Sheet composition, copies, separations and colour management remain in VectorCraft. The Print dialog's Media list also carries the Japanese papers — JIS B4 257 × 364 mm, JIS B5 182 × 257 mm and JIS B6 128 × 182 mm beside the ISO B4/B5 (250 × 353 and 176 × 250 mm, kept so settings and presets saved before them keep their paper), and はがき 100 × 148 mm, 往復はがき 148 × 200 mm, 封筒 長形3号 120 × 235 mm, 長形4号 90 × 225 mm, 角形2号 240 × 332 mm, 角形3号 216 × 277 mm and 四六判 127 × 188 mm; the JSON id or the dialog label names a paper, any case and spacing (`B5 (JIS)` or `b5jis`) (`crates/pdf/src/print/settings.rs`, `crates/pdf/src/tests/print.rs`). The print-preview and physical-device fidelity gaps remain, so print scores and hours are unchanged.
- - A PDF, PDF-compatible `.ai` or `.ait` opened from its pages or its editing copy opens with the File Info that its XMP packet and its document information dictionary give: the title (`dc:title`, its `x-default` item first, else Info `Title`), the author, description, keywords, copyright status, notice and URL, and the created and modified dates, the XMP packet's value where both give one (`crates/pdf/src/tests/file_info.rs`, `crates/engine/src/tests/fileinfo.rs`). An SVG opens with the title of its root ``; a file that gives no title opens with its file name without the extension, and a native file keeps its own title (#3626).
+ - A PDF, PDF-compatible `.ai` or `.ait` opened from its pages or its editing copy opens with the File Info that its XMP packet and its document information dictionary give: the title (`dc:title`, its `x-default` item first, else Info `Title`), the author, description, keywords, copyright status, notice and URL, and the created and modified dates, the XMP packet's value where both give one (`crates/pdf/src/tests/file_info.rs`, `crates/engine/src/tests/fileinfo.rs`). An SVG opens with the title of its root ``. The title is File Info's alone (`DocMetadata::title`): the document's name stays the file's name with its extension, a file that gives no title leaves File Info with that name, and exports (PDF, SVG, PNG, EPS, `.ai`) and native saves carry it; changing the title in File Info sets the document's name as before (#3626).
- PDF export and PDF-compatible `.ai` and `.ait` saves write the document's File Info created date as the file's creation date, or the time of writing when the document has none, and the time of writing as its modification date; the page information mark still prints the time of writing (`crates/engine/src/tests/fileinfo.rs`, `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/marks.rs`).
- PDF export and PDF-compatible `.ai` and `.ait` saves write File Info's copyright notice, URL and status to the XMP packet (`dc:rights`, `xmpRights:WebStatement`, `xmpRights:Marked`), so a PDF or `.ai` opened from its pages keeps them (`crates/pdf/src/tests/file_info.rs`, `crates/engine/src/tests/fileinfo.rs`).
- Opening a PDF or PDF-compatible `.ai` whose XMP packet nests elements more than 256 deep no longer overflows the stack: File Info leaves the packet out and takes the document information dictionary's values (`crates/pdf/src/tests/file_info.rs`).
@@ -1573,7 +1573,7 @@ A double-click on a Repeat (Radial, Grid or Mirror) with the Selection tool ente
| Date | Change | Summary |
|---|---|---|
-| 2026-11-03 | minor | File Info on open: an imported document takes the title its file carries (an SVG's root ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title` else its Info `Title`), else its file name without the extension, instead of the file name with it (#3626); scores and estimates unchanged. |
+| 2026-11-03 | minor | File Info on open: an imported document's own title (an SVG's root ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title` else its Info `Title`) goes into File Info only; the document's name (tab, Save As, default export names) stays the file's name (#3626); scores and estimates unchanged. |
| 2026-11-03 | minor | Enclosing Lasso is an add-on with no default shortcut or Basic toolbar slot. Scores and estimates remain unchanged. |
| 2026-11-02 | minor | Wheel input over closed font-family fields changes selected text (#5253); public documentation and application choices distinguished; scores and estimates unchanged. |
| 2026-11-03 | minor | Find Font's replacement-source chooser offers Document, Recent and System (#5217); scores and estimates unchanged. |
From 3a1421e95ee5b33ab813c865482d48536183f60f Mon Sep 17 00:00:00 2001
From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com>
Date: Sat, 7 Nov 2026 13:51:03 +0430
Subject: [PATCH 04/38] docs: restore the status lines damaged by merges
(main's line plus this PR's note)
---
docs/file-format-parity.md | 2 +-
docs/gaps.md | 2 +-
docs/target-app-parity.md | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index 384ce0a882..a2a37c1ff7 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,6 +1,6 @@
# File format parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (EPS and `.ai` editing data: a transparency set inside a clipping group stays after its `Q`; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x; an imported document's own title goes into File Info only; previously: native format: dynamic symbols, #4938) · **Target:** Adobe Illustrator 2026 (30.x)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (an imported file's own title goes into File Info only (#3626); EPS and `.ai` editing data: a transparency set inside a clipping group stays after its `Q`; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x)
Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`,
`OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public
diff --git a/docs/gaps.md b/docs/gaps.md
index 91d447aa27..74cc72c256 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -1,6 +1,6 @@
# Gaps
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; an imported document's own title goes into File Info only; previously: new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (an imported file's own title goes into File Info only (#3626); Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
## Feature submission evidence
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index 0c353bb930..041226f90c 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1,6 +1,6 @@
# Parity with Adobe Illustrator
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-03 · **Change:** minor (the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; an imported document's own title goes into File Info only; previously: Type core options status and Kashidas feature revision corrected; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (an imported file's own title goes into File Info only (#3626); the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026)
## Feature submission evidence
From cd11b62b74a8b50c299690007bf83d1989b9f69d Mon Sep 17 00:00:00 2001
From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com>
Date: Wed, 11 Nov 2026 13:13:48 +0430
Subject: [PATCH 05/38] Keep authored File Info titles unchanged on native
restore
---
crates/engine/src/cmd/fileio/load.rs | 9 ++++-----
crates/engine/src/tests/fileinfo.rs | 14 ++++++++++++++
docs/file-format-parity.md | 3 ++-
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/crates/engine/src/cmd/fileio/load.rs b/crates/engine/src/cmd/fileio/load.rs
index 3824dbf226..26380383bd 100644
--- a/crates/engine/src/cmd/fileio/load.rs
+++ b/crates/engine/src/cmd/fileio/load.rs
@@ -522,12 +522,11 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result
super::super::colormgmt::set_color_mode(&mut doc, mode, true, None, opts.grays);
}
// The title the file gives itself (an SVG's ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title`
- // or Info `Title`, which the readers put in File Info; the one a native document holds) is the
- // File Info title, cleaned as `file.info` takes one. A file restored from the editing data it
- // carries gives the title that document had, unless that is the file's name. The document's own
- // name stays what it has always been: the file's name (#3626).
+ // or Info `Title`, which the readers put in File Info) is separate from the document's name.
+ // Existing File Info is preserved exactly; only a restored document's legacy name fallback is
+ // cleaned as imported text. The document's name stays the file's name (#3626).
let held = restored.then_some(doc.title.as_str()).filter(|t| *t != title);
- doc.metadata.title = doc.metadata.title.as_deref().or(held).and_then(imported_title);
+ doc.metadata.title = doc.metadata.title.or_else(|| held.and_then(imported_title));
// Imports are named after the file; a native document keeps its own title (the tab shows the
// file name once it has a path).
if !matches!(format.id, "vectorcraft" | "template") || doc.title.is_empty() {
diff --git a/crates/engine/src/tests/fileinfo.rs b/crates/engine/src/tests/fileinfo.rs
index 249af96abc..daae68d86e 100644
--- a/crates/engine/src/tests/fileinfo.rs
+++ b/crates/engine/src/tests/fileinfo.rs
@@ -402,6 +402,20 @@ fn file_info_edits_a_files_own_title_and_the_document_follows() {
assert_eq!(titles(&mut s), ["box.svg", "Access paths"]);
}
+#[test]
+fn restored_file_info_title_keeps_authored_spaces() {
+ let mut s = session();
+ std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc).metadata.title = Some("Release Plan".into());
+ for format in ["vectorcraft", "svg", "pdf"] {
+ let bytes = b64(&s.execute("document.export", &json!({"format": format, "preserveEditing": true})).unwrap());
+ let mut reopened = Session::new();
+ let reply = open_named(&mut reopened, &format!("again.{format}"), &bytes);
+ assert_eq!(reply["restored"], format != "vectorcraft", "{format}");
+ assert_eq!(reopened.doc().unwrap().doc.metadata.title.as_deref(), Some("Release Plan"), "{format}");
+ assert_eq!(titles(&mut reopened)[1], "Release Plan", "{format}");
+ }
+}
+
#[test]
fn the_files_own_title_is_kept_by_saves_and_written_by_exports() {
let mut s = Session::new();
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index 1b7b7ce089..159a53fe55 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,6 +1,6 @@
# File format parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (`.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (restored File Info titles retain authored spaces, #3626; previously: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x)
Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`,
`OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public
@@ -339,6 +339,7 @@ Stop opacity on translated artboards remains outside this regression coverage.
| Date | Change | Summary |
|---|---|---|
+| 2026-11-11 | minor | Native and Preserve Editing restores keep an existing File Info title exactly, including repeated spaces; imported-text fallback titles alone are normalized (#3626). |
| 2026-11-03 | minor | An imported document's own title goes into File Info only (#3626): an SVG's root ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title` else its Info `Title` is File Info's title (`metadata.title` in the native format, left out when unset so other documents save unchanged and older versions ignore it; written by exports); the document's name, which the tab, Save As and the default export names use, stays the file's name. |
| 2026-11-11 | minor | `.ai` and EPS import: a warp of type (an envelope made with a warp around type) whose own warp, VectorCraft's, doesn't draw as its drawn art is tried again as a mesh envelope on the warp grid the file saves, with the same drawn-art check, budget and page comparison as #6421: where it passes, the type is editable and keeps the file's shape, and the warp's settings (style, bend) are lost. A second try is only made while more checks are left than there are envelopes of type and warped text objects still to come. Type with strokes in an envelope with Distort Appearance on is also tried mapped from its box with strokes, where the size the file saves for it doesn't already give that box (a rule chosen by measuring real files). An envelope's grid (warp, mesh or top object) now reads its way round from all its rows and columns, not its first row alone: a mesh bent far round (its end columns leaning more than halfway over) reads the way it runs, not turned a quarter round, and a grid symmetric about its middle reads the same wherever it is on the page. Tests `tests_native::a_warp_of_type_opens_as_a_mesh_on_its_saved_grid_and_keeps_its_shape_when_its_text_changes`, `a_warp_of_stroked_type_maps_from_its_bounds_with_strokes_where_its_drawn_art_does`, `a_warp_of_type_without_a_saved_grid_keeps_its_drawn_art`, `a_warp_of_type_tried_again_leaves_the_next_envelope_its_check`, `ai::tests::a_mesh_envelope_bent_far_round_opens_the_way_it_runs`, `a_mesh_envelope_bent_halfway_round_opens_the_same_way_wherever_it_is` (part of #3179) |
| 2026-11-11 | minor | `.ai` and EPS import: type stroked in the text document keeps its stroke's cap, join and miter limit (keys 61, 62 and 64 of its character attributes, numbered as PostScript's `setlinecap` and `setlinejoin`: 0 butt or miter, 1 round, 2 projecting or bevel). They were left at a miter join with a limit of 10 whatever the file said, so type the file strokes with round joins, or with the usual limit of 4 or less, drew spikes at its sharp corners, some many points long. In users' files, used locally and never committed, the page strokes the type with the cap, join and miter limit these keys give; no file had a bevel join, which is read by the same numbering. A value that isn't one of theirs keeps the default, a miter limit past 500 is 500, and type without a stroke keeps the defaults. Dashes are not read: no file had dashed type to tell which keys hold them. Tests `ate::tests::a_run_keeps_its_stroke_cap_join_and_miter_limit`, `tests_native::stroked_type_keeps_its_cap_join_and_miter_limit`; scores unchanged |
From 54f9c03dfffd90ad3b0bc3241be7753cf2b6fe7d Mon Sep 17 00:00:00 2001
From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com>
Date: Wed, 11 Nov 2026 19:32:15 +0430
Subject: [PATCH 06/38] Normalize imported SVG titles without changing restored
metadata
---
crates/engine/src/cmd/fileio/load.rs | 7 +++++--
crates/engine/src/tests/fileinfo.rs | 17 +++++++++++++++++
docs/file-format-parity.md | 3 ++-
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/crates/engine/src/cmd/fileio/load.rs b/crates/engine/src/cmd/fileio/load.rs
index 26380383bd..97727c2251 100644
--- a/crates/engine/src/cmd/fileio/load.rs
+++ b/crates/engine/src/cmd/fileio/load.rs
@@ -523,8 +523,11 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result
}
// The title the file gives itself (an SVG's ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title`
// or Info `Title`, which the readers put in File Info) is separate from the document's name.
- // Existing File Info is preserved exactly; only a restored document's legacy name fallback is
- // cleaned as imported text. The document's name stays the file's name (#3626).
+ // Restored File Info is preserved exactly; newly imported SVG candidates and a restored
+ // document's legacy name fallback are cleaned as imported text. The name stays the file's (#3626).
+ if !restored && matches!(format.id, "svg" | "svgz") {
+ doc.metadata.title = doc.metadata.title.as_deref().and_then(imported_title);
+ }
let held = restored.then_some(doc.title.as_str()).filter(|t| *t != title);
doc.metadata.title = doc.metadata.title.or_else(|| held.and_then(imported_title));
// Imports are named after the file; a native document keeps its own title (the tab shows the
diff --git a/crates/engine/src/tests/fileinfo.rs b/crates/engine/src/tests/fileinfo.rs
index daae68d86e..4d86a84b3c 100644
--- a/crates/engine/src/tests/fileinfo.rs
+++ b/crates/engine/src/tests/fileinfo.rs
@@ -365,6 +365,23 @@ fn import_puts_the_files_own_title_in_file_info_only() {
assert!(name.starts_with("Untitled-") && info == name, "{name} / {info}");
}
+#[test]
+fn imported_svg_titles_are_filtered_and_bounded() {
+ for (raw, expected) in [
+ ("Untitled-2".to_string(), None),
+ ("\u{7f}".to_string(), None),
+ ("Re\u{7f}lease Plan".to_string(), Some("Release Plan".to_string())),
+ ("λ".repeat(65_537), Some("λ".repeat(65_536))),
+ ] {
+ let svg = svg_titled(&format!("{raw} "));
+ for format in ["svg", "svgz"] {
+ let name = format!("box.{format}");
+ let bytes = if format == "svgz" { vectorcraft_svg::compress(&svg) } else { svg.as_bytes().to_vec() };
+ assert_eq!(opened(&name, &bytes), [name.clone(), expected.clone().unwrap_or(name)], "{format}");
+ }
+ }
+}
+
#[test]
fn a_file_with_a_title_opened_from_a_path_is_named_after_the_file() {
let dir = std::env::temp_dir().join(format!("vc-infotitle-open-{}", std::process::id()));
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index 11090d9d18..7f6407f5f0 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,6 +1,6 @@
# File format parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (restored File Info titles retain authored spaces, #3626; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (newly imported SVG/SVGZ titles are filtered and bounded without changing restored titles, #3626; previously: restored File Info titles retain authored spaces, #3626; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x)
Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`,
`OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public
@@ -339,6 +339,7 @@ Stop opacity on translated artboards remains outside this regression coverage.
| Date | Change | Summary |
|---|---|---|
+| 2026-11-11 | minor | Newly imported SVG/SVGZ titles use the imported-text rules: generated Untitled names and control-only titles give the filename fallback, other control characters are removed, and titles are limited to 65,536 characters. Native and Preserve Editing titles remain unchanged (#3626). |
| 2026-11-11 | minor | Native and Preserve Editing restores keep an existing File Info title exactly, including repeated spaces; imported-text fallback titles alone are normalized (#3626). |
| 2026-11-03 | minor | An imported document's own title goes into File Info only (#3626): an SVG's root ``, a PDF's, `.ai`'s or `.ait`'s XMP `dc:title` else its Info `Title` is File Info's title (`metadata.title` in the native format, left out when unset so other documents save unchanged and older versions ignore it; written by exports); the document's name, which the tab, Save As and the default export names use, stays the file's name. |
| 2026-11-11 | minor | `.ai` and EPS import, PDF import, SVG export and `.ai` save: type with a Horizontal Scale other than 100% and tracking or manual kerning is spaced as a `.ai`'s own page spaces it. Layout now measures tracking and manual kerning in thousandths of the em as the scale draws it (see type-parity.md, same date); they were added at the full em, so such type drifted from the page letter by letter. A `.ai`'s page writes that type's character spacing as the tracking itself in a text space as wide as the scale, which PDF scales by it (ISO 32000-1 §9.4.4). In 224 users' files (used locally, never committed), 93 render differently. Of the 25 whose render moved by more than 1% of its pixels against the page, 23 came closer. The note on the type differing from the page shows a smaller share in 5 files (11.0% to 4.4% at most) and a larger one in 2 (by 0.2 to 0.3 points). 9 more envelopes of type open live (113 to 122 of 203, none fewer in any file), and no file switched between its layers and its PDF part. PDF import: the tracking of horizontally scaled type is the file's `Tc` in thousandths of its size (it was that times the scale), the glyphs where they were (test `tests::text_placement::character_spacing_in_horizontally_scaled_type_is_the_files_tc`). SVG export writes the letter spacing in thousandths of the font size it writes (the vertical scale), so type scaled uniformly keeps its spacing in a viewer (test `text_layout::spacing_in_uniformly_scaled_type_takes_the_scale`); tracked type scaled horizontally alone still differs a little there, as before. A `.ai` saved here writes the same values as before; VectorCraft now lays them out as the file's own PDF part draws them. Scores and estimates unchanged. |
From f0e50437c22649353e53f80ac6f572d7df686420 Mon Sep 17 00:00:00 2001
From: Ahmed Gomaa
Date: Wed, 11 Nov 2026 23:16:03 +0200
Subject: [PATCH 07/38] Save on a read-only location offers Save As
A plain Save that the location refuses (read-only filesystem or permission denied) now opens Save As with the name filled in, instead of ending in an error dialog. The refusal travels as a typed engine error (READ_ONLY_LOCATION), so the control protocol and MCP still return an error and never open a panel. Recovery failures, explicit destinations, a busy picker and Close/Quit keep their existing flow.
Closes #6146
---
apps/vectorcraft/src/host_services.rs | 2 +
crates/engine/src/cmd/fileio.rs | 11 +-
crates/engine/src/cmd/fileio/access.rs | 25 ++
crates/engine/src/cmd/fileio/save.rs | 9 +-
.../engine/src/cmd/fileio/tests_readonly.rs | 52 ++++
crates/engine/src/error.rs | 7 +
crates/engine/src/lib.rs | 2 +-
crates/format/src/atomic.rs | 48 +++-
crates/format/src/lib.rs | 2 +-
crates/mcp/src/tests/fileio.rs | 23 ++
crates/ui-egui/src/io.rs | 5 +
crates/ui-egui/src/io/read_only_save.rs | 64 +++++
crates/ui-egui/src/io/save.rs | 96 ++++++-
crates/ui-egui/src/io/tests_read_only_save.rs | 266 ++++++++++++++++++
crates/ui-egui/src/lib.rs | 3 +-
crates/ui-egui/src/menus/run.rs | 2 +-
crates/ui-egui/src/menus/ui_commands.rs | 2 +-
crates/ui-egui/src/picks.rs | 9 +
crates/ui-egui/src/services.rs | 11 +
docs/control-protocol.md | 25 +-
docs/file-format-parity.md | 5 +
docs/gaps.md | 5 +-
docs/mcp.md | 25 +-
docs/roadmap.md | 5 +-
docs/target-app-parity.md | 9 +-
docs/ui-parity.md | 4 +
26 files changed, 684 insertions(+), 33 deletions(-)
create mode 100644 crates/engine/src/cmd/fileio/tests_readonly.rs
create mode 100644 crates/ui-egui/src/io/read_only_save.rs
create mode 100644 crates/ui-egui/src/io/tests_read_only_save.rs
diff --git a/apps/vectorcraft/src/host_services.rs b/apps/vectorcraft/src/host_services.rs
index 187c42cde7..bd7c8aec80 100644
--- a/apps/vectorcraft/src/host_services.rs
+++ b/apps/vectorcraft/src/host_services.rs
@@ -358,6 +358,8 @@ pub(crate) fn services(parent: Parent, ui: egui::Context) -> Services {
exists: Some(Box::new(|p: &str| std::path::Path::new(p).exists())),
// Background Save and Export write from a worker thread.
write_shared: Some(std::sync::Arc::new(write_file)),
+ save_write: Some(std::sync::Arc::new(fileio::write_save_file)),
+ save_stream: Some(std::sync::Arc::new(fileio::write_save_file_with)),
// Native saves stream into the file as they are encoded.
stream_shared: Some(std::sync::Arc::new(|p: &str, fill: &mut dyn FnMut(&mut dyn std::io::Write) -> std::io::Result<()>| {
fileio::write_file_with(p, fill).map_err(|e| e.to_string())
diff --git a/crates/engine/src/cmd/fileio.rs b/crates/engine/src/cmd/fileio.rs
index 04a443ed4c..2b7969a434 100644
--- a/crates/engine/src/cmd/fileio.rs
+++ b/crates/engine/src/cmd/fileio.rs
@@ -89,9 +89,9 @@ pub use pdfimport::{LoadOptions, page_document};
pub(crate) use save::job_for;
pub(crate) use save::save as save_document;
pub use save::{
- SAVE_FORMATS, SaveJob, SaveMode, SavePlan, StreamWrite, TEMPLATE_FORMATS, dialog_folder, export_folder, reads_option as save_reads_option,
- remembered_save_options, save_filters, save_format, save_job, save_plan, save_with, stamp_save_dates, template_filters, templates_dialog_folder,
- templates_folder,
+ SAVE_FORMATS, SaveJob, SaveMode, SavePlan, StreamWrite, TEMPLATE_FORMATS, dialog_folder, documents_dialog_folder, export_folder,
+ reads_option as save_reads_option, remembered_save_options, save_filters, save_format, save_job, save_plan, save_with, stamp_save_dates,
+ template_filters, templates_dialog_folder, templates_folder,
};
pub(crate) use screens::{
PARAM_KEYS as SCREEN_PARAM_KEYS, ROW_KEYS as SCREEN_ROW_KEYS, UNWRITTEN_FORMATS as SCREEN_UNWRITTEN_FORMATS,
@@ -120,7 +120,10 @@ mod formats;
#[cfg(not(target_arch = "wasm32"))]
pub(crate) use access::list_dir;
-pub use access::write_file_with;
+pub use access::{write_file_with, write_save_file, write_save_file_with};
+
+#[cfg(all(test, not(target_arch = "wasm32")))]
+mod tests_readonly;
#[cfg(not(target_arch = "wasm32"))]
pub(crate) use access::{Placed, copy_new, file_metadata};
pub(crate) use access::{absolute_path, create_dir, document_path, file_created, file_stamp, read_file, read_file_head, write_file, write_new_file};
diff --git a/crates/engine/src/cmd/fileio/access.rs b/crates/engine/src/cmd/fileio/access.rs
index 4dce2023bb..0e69147a32 100644
--- a/crates/engine/src/cmd/fileio/access.rs
+++ b/crates/engine/src/cmd/fileio/access.rs
@@ -89,6 +89,31 @@ pub fn write_file_with(path: &str, fill: &mut dyn FnMut(&mut dyn std::io::Write)
vectorcraft_format::write_atomic_with(std::path::Path::new(path), |f| fill(f)).map_err(|e| EngineError::Other(format!("{path}: {e}")))
}
+/// The save commands' writer: preserves a filesystem location refusal as a typed error. Other
+/// writers keep their existing errors; an automation-root refusal is never reclassified.
+pub fn write_save_file(path: &str, bytes: &[u8]) -> Result<()> {
+ write_save_file_with(path, &mut |w| w.write_all(bytes))
+}
+
+/// [`write_save_file`] for a streamed save.
+#[cfg(not(target_arch = "wasm32"))]
+pub fn write_save_file_with(path: &str, fill: &mut dyn FnMut(&mut dyn std::io::Write) -> std::io::Result<()>) -> Result<()> {
+ vectorcraft_doc::cancel::check()?;
+ may_write(path)?;
+ vectorcraft_format::write_atomic_with(std::path::Path::new(path), |f| fill(f)).map_err(|e| save_write_error(path, e))
+}
+
+#[cfg(not(target_arch = "wasm32"))]
+pub(super) fn save_write_error(path: &str, error: std::io::Error) -> EngineError {
+ let reason = format!("{path}: {error}");
+ if vectorcraft_format::read_only_location(&error) { EngineError::ReadOnlyLocation(reason) } else { EngineError::Other(reason) }
+}
+
+#[cfg(target_arch = "wasm32")]
+pub fn write_save_file_with(path: &str, fill: &mut dyn FnMut(&mut dyn std::io::Write) -> std::io::Result<()>) -> Result<()> {
+ write_file_with(path, fill)
+}
+
#[cfg(not(target_arch = "wasm32"))]
pub(crate) fn create_dir(path: &str) -> Result<()> {
may_write(path)?;
diff --git a/crates/engine/src/cmd/fileio/save.rs b/crates/engine/src/cmd/fileio/save.rs
index 9f4e5b0572..791c25a9a2 100644
--- a/crates/engine/src/cmd/fileio/save.rs
+++ b/crates/engine/src/cmd/fileio/save.rs
@@ -157,6 +157,11 @@ fn documents_folder() -> Option {
Some(home.join("Documents"))
}
+/// A Save As after a refused Save starts in Documents, else home, never the refused folder.
+pub fn documents_dialog_folder() -> Option {
+ documents_folder().filter(|p| p.is_dir()).map(|p| p.to_string_lossy().into_owned()).or_else(home_folder)
+}
+
/// `XDG_DOCUMENTS_DIR` in a `user-dirs.dirs` file's `text`, `$HOME` being `home`. None when it isn't
/// set, is relative, or is the home folder itself (the spec's way of turning it off).
fn xdg_documents(text: &str, home: &std::path::Path) -> Option {
@@ -1032,7 +1037,7 @@ pub(crate) fn save(s: &mut Session, mode: SaveMode, p: &Value) -> Result
let plan = save_plan(s, mode, p)?;
let job = save_job(s, plan)?;
let uid = s.doc()?.uid;
- let out = job.write_streamed(&mut super::write_file_with)?;
+ let out = job.write_streamed(&mut super::write_save_file_with)?;
job.complete(s, uid);
Ok(out)
}
@@ -1104,7 +1109,7 @@ pub(super) fn specs() -> Vec {
"Save Document",
[],
None,
- "{path?, format?: vectorcraft|template|pdf|svg|svgz|ai|eps (default: the path's extension, else the document's own format), options?: {…the format's options, see file.formatOptions; default: as last saved}, svg?: {…SVG options} (an SVG save keeps hidden layers, display:none, unless hiddenLayers is false), …the SVG and PDF options given flat instead (an option given flat or in svg and in options with different values is an error), compress?: bool (native, also in options: gzip; default: the useCompression preference; warnings say when the format doesn't read compress, version, preview or precision given flat, or a key given in options), version?: 4 (3, 2 or 1: for older VectorCraft versions; 1 and 2 are never compressed), preview?: false (embed a PNG of the first artboard, at most 256 px), precision?: 0..9 (native: round path anchors and handles to this many decimal places, a smaller file; colors, transforms and type stay exact; default: exact, and a later save without it writes exactly again), separateArtboards?: false (native and .ai: also save each artboard of `range` to -. beside the file, holding that artboard and the art touching it; the result's files lists every file written), range?: \"1-3, 5\"|\"all\" (default; with separateArtboards), includeLinked?: false (keep linked files' own pixels, not just their previews; they stay linked), embedProfiles?: true (carry the ICC profiles loaded from files that the document is tagged with; opening the file installs them where missing), pdfCompatible?: true (native: also carry a PDF of every artboard; false omits it) | true for .ai (false: blank pages, only the native document; a .ai file's compress, default true, is its compression.compressText), modified?: Unix seconds|null (the File Info modified date, and created date when there is none, a save to a file stamps; default now, recorded in the journal so a replay matches; null: leave the dates)} → {path, format, bytes, warnings, files?: [path…] (the file and its artboards' files), linked?: [path…] (images an SVG links to)}. Save writes one artboard, except a .ai file: a PDF-compatible file of every artboard carrying the native document (preserveEditing always on; PDF options flat or in options), which document.open restores exactly, on the active artboard (the app's, else the one the document opened on; with editingData: false, the first); separateArtboards writes more files, one per artboard. EPS saves the chosen artboard (first by default), retaining its page margins and the whole editable document; its PostScript appearance flattens transparency, as EPS requires. Without a path it writes the document's own file in its own format: a document opened from or saved as SVG/PDF/EPS saves as that again (warnings name what the format loses). No path known (never saved, converted from an older version, restored by Data Recovery, or another format) → {dataBase64, format, name, folder?, warnings} and the document stays modified. A key that no save format takes, beside the path or in options, and an unknown key inside a PDF option's object or svg, are refused",
+ "{path?, format?: vectorcraft|template|pdf|svg|svgz|ai|eps (default: the path's extension, else the document's own format), options?: {…the format's options, see file.formatOptions; default: as last saved}, svg?: {…SVG options} (an SVG save keeps hidden layers, display:none, unless hiddenLayers is false), …the SVG and PDF options given flat instead (an option given flat or in svg and in options with different values is an error), compress?: bool (native, also in options: gzip; default: the useCompression preference; warnings say when the format doesn't read compress, version, preview or precision given flat, or a key given in options), version?: 4 (3, 2 or 1: for older VectorCraft versions; 1 and 2 are never compressed), preview?: false (embed a PNG of the first artboard, at most 256 px), precision?: 0..9 (native: round path anchors and handles to this many decimal places, a smaller file; colors, transforms and type stay exact; default: exact, and a later save without it writes exactly again), separateArtboards?: false (native and .ai: also save each artboard of `range` to -. beside the file, holding that artboard and the art touching it; the result's files lists every file written), range?: \"1-3, 5\"|\"all\" (default; with separateArtboards), includeLinked?: false (keep linked files' own pixels, not just their previews; they stay linked), embedProfiles?: true (carry the ICC profiles loaded from files that the document is tagged with; opening the file installs them where missing), pdfCompatible?: true (native: also carry a PDF of every artboard; false omits it) | true for .ai (false: blank pages, only the native document; a .ai file's compress, default true, is its compression.compressText), modified?: Unix seconds|null (the File Info modified date, and created date when there is none, a save to a file stamps; default now, recorded in the journal so a replay matches; null: leave the dates)} → {path, format, bytes, warnings, files?: [path…] (the file and its artboards' files), linked?: [path…] (images an SVG links to)}. Save writes one artboard, except a .ai file: a PDF-compatible file of every artboard carrying the native document (preserveEditing always on; PDF options flat or in options), which document.open restores exactly, on the active artboard (the app's, else the one the document opened on; with editingData: false, the first); separateArtboards writes more files, one per artboard. EPS saves the chosen artboard (first by default), retaining its page margins and the whole editable document; its PostScript appearance flattens transparency, as EPS requires. Without a path it writes the document's own file in its own format: a document opened from or saved as SVG/PDF/EPS saves as that again (warnings name what the format loses). No path known (never saved, converted from an older version, restored by Data Recovery, or another format) → {dataBase64, format, name, folder?, warnings} and the document stays modified. A key that no save format takes, beside the path or in options, and an unknown key inside a PDF option's object or svg, are refused. A terminal filesystem permission/read-only refusal returns READ_ONLY_LOCATION: followed by the reason; recovery-copy failures keep their original error. Non-UI callers never open a save panel",
has_doc,
|s, p| save(s, SaveMode::Save, p)
),
diff --git a/crates/engine/src/cmd/fileio/tests_readonly.rs b/crates/engine/src/cmd/fileio/tests_readonly.rs
new file mode 100644
index 0000000000..badf82a8cf
--- /dev/null
+++ b/crates/engine/src/cmd/fileio/tests_readonly.rs
@@ -0,0 +1,52 @@
+//! Save errors retain their type without changing the other filesystem writers (#6146).
+
+use std::io::{self, ErrorKind};
+
+use serde_json::json;
+
+use super::{SaveMode, access, save_plan, save_with, write_file_with, write_save_file_with};
+use crate::{EngineError, READ_ONLY_LOCATION, Session};
+
+#[test]
+fn readonly_error_is_typed_and_other_writers_keep_their_error() {
+ let dir = vectorcraft_testkit::temp_dir("save-refusal");
+ let path = dir.join("Poster.vectorcraft").to_string_lossy().into_owned();
+ for kind in [ErrorKind::PermissionDenied, ErrorKind::ReadOnlyFilesystem, ErrorKind::StorageFull, ErrorKind::NotFound, ErrorKind::Other] {
+ let typed = write_save_file_with(&path, &mut |_| Err(io::Error::new(kind, "injected"))).unwrap_err();
+ let ordinary = write_file_with(&path, &mut |_| Err(io::Error::new(kind, "injected"))).unwrap_err();
+ let reason = format!("{path}: injected");
+ assert!(matches!(&ordinary, EngineError::Other(_)));
+ assert_eq!(ordinary.to_string(), reason);
+ if matches!(kind, ErrorKind::PermissionDenied | ErrorKind::ReadOnlyFilesystem) {
+ assert!(matches!(&typed, EngineError::ReadOnlyLocation(_)));
+ assert_eq!(typed.to_string(), format!("{READ_ONLY_LOCATION}: {reason}"));
+ } else {
+ assert!(matches!(&typed, EngineError::Other(_)));
+ assert_eq!(typed.to_string(), reason);
+ }
+ assert!(!std::path::Path::new(&path).exists());
+ }
+ std::fs::remove_dir_all(dir).unwrap();
+}
+
+#[test]
+fn readonly_failed_save_keeps_document_and_options() {
+ let mut session = Session::new();
+ session.execute("file.new", &json!({"width": 40, "height": 40})).unwrap();
+ session.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 10, "height": 10})).unwrap();
+ let st = session.doc_mut().unwrap();
+ st.path = Some("Poster.svg".into());
+ st.format = "svg";
+ st.save_options = json!({"decimals": 3}).as_object().unwrap().clone();
+ let before = serde_json::to_value(&*st.doc).unwrap();
+ let options = st.save_options.clone();
+ let plan = save_plan(&session, SaveMode::Save, &json!({"modified": null})).unwrap();
+ let e = save_with(&mut session, plan, |path, _| Err(access::save_write_error(path, io::Error::from(ErrorKind::PermissionDenied)))).unwrap_err();
+ assert!(matches!(e, EngineError::ReadOnlyLocation(_)));
+ let st = session.doc().unwrap();
+ assert_eq!(st.path.as_deref(), Some("Poster.svg"));
+ assert_eq!(st.format, "svg");
+ assert_eq!(st.save_options, options);
+ assert!(st.is_dirty());
+ assert_eq!(serde_json::to_value(&*st.doc).unwrap(), before);
+}
diff --git a/crates/engine/src/error.rs b/crates/engine/src/error.rs
index d32fda613d..6ab1608bd7 100644
--- a/crates/engine/src/error.rs
+++ b/crates/engine/src/error.rs
@@ -3,6 +3,9 @@ use super::{NodeId, cancel};
/// The text of [`EngineError::Busy`], which ends every error a frontend reports for it.
pub const SCRIPT_BUSY: &str = "a script is running: stop it or wait for it to finish";
+/// Stable prefix for a save refused by the filesystem: choose another destination.
+pub const READ_ONLY_LOCATION: &str = "READ_ONLY_LOCATION";
+
#[derive(Debug, thiserror::Error)]
pub enum EngineError {
#[error("unknown command `{0}`")]
@@ -20,6 +23,10 @@ pub enum EngineError {
NoNode(NodeId),
#[error("{0}")]
Other(String),
+ /// The save's terminal filesystem error refuses writes here. The reason keeps the path and
+ /// system message. This never means an automation-root refusal or a recovery-copy failure.
+ #[error("{code}: {0}", code = READ_ONLY_LOCATION)]
+ ReadOnlyLocation(String),
/// The caller asked for the command to stop ([`cancel`]). It changed nothing.
#[error("cancelled; nothing was changed")]
Cancelled,
diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs
index 091348a6bd..6bc570623d 100644
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@ -370,7 +370,7 @@ pub(crate) use command_sets::SELECTS_GIVEN_IDS;
use command_sets::given_ids;
pub use command_sets::{FIT_ACTIVE_ARTBOARD, ON_ACTIVE_ARTBOARD, waits_for_tool_edit};
pub use doc_state::{DocState, OpenRows, RecalledSelection};
-pub use error::{EngineError, Result, SCRIPT_BUSY};
+pub use error::{EngineError, READ_ONLY_LOCATION, Result, SCRIPT_BUSY};
#[cfg(test)]
use history::history_budget_for;
pub use history::{History, HistoryEntry, NamedStep, default_history_budget};
diff --git a/crates/format/src/atomic.rs b/crates/format/src/atomic.rs
index 863c6fdd34..8e7149cad2 100644
--- a/crates/format/src/atomic.rs
+++ b/crates/format/src/atomic.rs
@@ -18,6 +18,25 @@ use std::io::{self, Write as _};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicU64, Ordering};
+/// Whether the returned write error refuses this location. Recovery errors must still be shown:
+/// their message names copies the user may need, even when their kind is PermissionDenied.
+pub fn read_only_location(error: &io::Error) -> bool {
+ matches!(error.kind(), io::ErrorKind::ReadOnlyFilesystem | io::ErrorKind::PermissionDenied)
+ && !error.get_ref().is_some_and(|e| e.is::())
+}
+
+/// Marks the existing recovery message without changing its text or the returned error kind.
+#[derive(Debug)]
+struct RecoveryError(String);
+
+impl std::fmt::Display for RecoveryError {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.write_str(&self.0)
+ }
+}
+
+impl std::error::Error for RecoveryError {}
+
/// Write `bytes` to `path` atomically (see the module docs).
pub fn write_atomic(path: &Path, bytes: &[u8]) -> io::Result<()> {
write_atomic_with(path, |f| f.write_all(bytes))
@@ -102,7 +121,7 @@ fn write_over(tmp: &Path, target: &Path, refused: io::Error) -> io::Result<()> {
let _ = std::fs::remove_file(old);
let why =
format!("{refused}, and the file can't be copied aside before it is overwritten ({e}); the new content is kept in {}", tmp.display());
- return Err(io::Error::new(refused.kind(), why));
+ return Err(io::Error::new(refused.kind(), RecoveryError(why)));
}
let copied = to.set_len(0).and_then(|()| io::copy(&mut from, &mut to)).and_then(|_| sync_file(&to));
drop((from, to));
@@ -115,10 +134,11 @@ fn write_over(tmp: &Path, target: &Path, refused: io::Error) -> io::Result<()> {
}
Ok(())
}
- (Err(e), Some(old)) => {
- Err(io::Error::new(e.kind(), format!("{e} (the new content is kept in {}, the file as it was in {})", tmp.display(), old.display())))
- }
- (Err(e), None) => Err(io::Error::new(e.kind(), format!("{e} (the new content is kept in {})", tmp.display()))),
+ (Err(e), Some(old)) => Err(io::Error::new(
+ e.kind(),
+ RecoveryError(format!("{e} (the new content is kept in {}, the file as it was in {})", tmp.display(), old.display())),
+ )),
+ (Err(e), None) => Err(io::Error::new(e.kind(), RecoveryError(format!("{e} (the new content is kept in {})", tmp.display())))),
}
}
@@ -318,6 +338,24 @@ fn keep_permissions(_: &Path, _: &Path) -> io::Result<()> {
mod tests {
use super::*;
+ #[test]
+ fn readonly_classification_uses_the_terminal_kind_and_excludes_recovery() {
+ for (kind, expected) in [
+ (io::ErrorKind::PermissionDenied, true),
+ (io::ErrorKind::ReadOnlyFilesystem, true),
+ (io::ErrorKind::StorageFull, false),
+ (io::ErrorKind::QuotaExceeded, false),
+ (io::ErrorKind::NotFound, false),
+ (io::ErrorKind::Other, false),
+ ] {
+ assert_eq!(read_only_location(&io::Error::new(kind, "injected")), expected, "{kind:?}");
+ let recovery = io::Error::new(kind, RecoveryError("the new content is kept in a.tmp".into()));
+ assert!(!read_only_location(&recovery), "recovery: {kind:?}");
+ assert_eq!(recovery.kind(), kind);
+ assert_eq!(recovery.to_string(), "the new content is kept in a.tmp");
+ }
+ }
+
fn dir(name: &str) -> PathBuf {
let d = std::env::temp_dir().join(format!("vc-atomic-{name}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&d);
diff --git a/crates/format/src/lib.rs b/crates/format/src/lib.rs
index 38545b8292..ed1777b6de 100644
--- a/crates/format/src/lib.rs
+++ b/crates/format/src/lib.rs
@@ -55,7 +55,7 @@ use serde::{Deserializer, Serialize};
use vectorcraft_doc::{Document, ImageBlob};
#[cfg(not(target_arch = "wasm32"))]
-pub use atomic::{sync_file, write_atomic, write_atomic_with, write_new_with};
+pub use atomic::{read_only_location, sync_file, write_atomic, write_atomic_with, write_new_with};
pub use craft_vectorcraft_format::base64::{decode as base64_decode, decoded_len as base64_decoded_len, encode as base64_encode};
pub use craft_vectorcraft_format::{
BLOB_MAGIC, COMPRESSED_SINCE, EXTENSION, ICC_MIME, INLINE_MAX, LEGACY_EXTENSION, MIN_VERSION, PREVIEW_MAX, VERSION, is_compressed, json_part,
diff --git a/crates/mcp/src/tests/fileio.rs b/crates/mcp/src/tests/fileio.rs
index 00ff3a2d77..d29161a68b 100644
--- a/crates/mcp/src/tests/fileio.rs
+++ b/crates/mcp/src/tests/fileio.rs
@@ -357,6 +357,29 @@ fn save_file_waits_for_the_file_in_the_app() {
}
}
+#[test]
+fn readonly_save_file_keeps_the_stable_error_prefix() {
+ struct Refused(bool);
+ impl Backend for Refused {
+ fn call(&mut self, method: &str, params: Value) -> Result {
+ assert_eq!(method, "app.save");
+ assert_eq!(params.get("wait").and_then(Value::as_bool), self.0.then_some(true));
+ Err(vectorcraft_engine::EngineError::ReadOnlyLocation("Poster.svg: injected refusal".into()).to_string())
+ }
+ fn has_ui(&self) -> bool {
+ self.0
+ }
+ fn describe(&self) -> String {
+ "injected save refusal".into()
+ }
+ }
+ for desktop in [false, true] {
+ let r = call_tool(&mut Refused(desktop), "save_file", &json!({}));
+ assert!(r.is_error);
+ assert_eq!(r.content[0]["text"], "save_file: READ_ONLY_LOCATION: Poster.svg: injected refusal");
+ }
+}
+
fn pdf_pages(pdf: &[u8]) -> usize {
let mut h = Headless::new();
h.call("engine.execute", json!({"command": "document.open", "params": {"name": "p.pdf", "dataBase64": vectorcraft_format::base64_encode(pdf)}}))
diff --git a/crates/ui-egui/src/io.rs b/crates/ui-egui/src/io.rs
index cc6f5d2262..a3a41c922a 100644
--- a/crates/ui-egui/src/io.rs
+++ b/crates/ui-egui/src/io.rs
@@ -15,8 +15,12 @@ use crate::{FilePick, Services, VectorcraftApp, dialogs};
mod export;
mod open;
+mod read_only_save;
mod save;
+#[cfg(test)]
+mod tests_read_only_save;
+
pub use export::{EXPORT_CANCELLED, cancel_exports, export, export_for_screens, export_pdf, hide_exports, reveal, save_command_output};
pub(crate) use export::{
export_files, exported_with_notes, file_url, open_in_app, open_original, reveal_path, run_to_file, save_command_output_named,
@@ -29,6 +33,7 @@ pub use open::{
};
#[cfg(test)]
pub(crate) use open::{open_file, opened_with_notes};
+pub(crate) use save::save_current;
pub use save::{ask_format_options, ask_pdf_options, remember_active_artboard, remember_view, save, save_pdf};
pub(crate) use save::{export_path, is_web, report_saved, target_path, write_named, write_reporting, write_to};
#[cfg(test)]
diff --git a/crates/ui-egui/src/io/read_only_save.rs b/crates/ui-egui/src/io/read_only_save.rs
new file mode 100644
index 0000000000..f49603eba2
--- /dev/null
+++ b/crates/ui-egui/src/io/read_only_save.rs
@@ -0,0 +1,64 @@
+//! The continuation of ordinary File > Save when its own location refuses writes (#6146).
+//! It reuses Save As, including extension and overwrite checks, under its own picker entry.
+
+use std::rc::Rc;
+
+use serde_json::{Value, json};
+use vectorcraft_engine::cmd::fileio::{self, SaveMode, SavePlan};
+
+use crate::picks::{self, Entry};
+use crate::{FilePick, VectorcraftApp};
+
+pub(super) struct Retry {
+ path: Option,
+ pick: FilePick,
+ params: Value,
+}
+
+impl Retry {
+ pub(super) fn new(plan: &SavePlan, folder: Option) -> Self {
+ let name = plan.path.as_deref().map(fileio::file_name).unwrap_or_else(|| plan.name.clone());
+ let mut params = json!({ "format": plan.format.id, "options": plan.options });
+ if let Some(modified) = plan.modified {
+ params["modified"] = json!(modified);
+ }
+ Self { path: plan.path.clone(), pick: FilePick { name, folder, filters: vec![] }, params }
+ }
+
+ /// None when this continuation is stale or another picker prevents it. The existing failed-save
+ /// dialog then stays in charge; there is no queue of deferred Save As requests.
+ pub(super) fn instead(self, app: &mut VectorcraftApp, uid: u64) -> Option> {
+ if app.automation_is_acting() || app.services.pick_save.is_none() || app.picks.is_waiting() || super::save::is_web(app) {
+ return None;
+ }
+ let index = app.session.documents().iter().position(|st| st.uid == uid && st.path == self.path)?;
+ if app.session.active_index() != Some(index) && app.run("document.activate", json!({ "index": index })).is_err() {
+ return None;
+ }
+ let name = &self.pick.name;
+ let status = format!("Cannot write to the location of “{name}”; choose where to save it");
+ app.status(status.clone());
+ let save = Rc::new(move |app: &mut VectorcraftApp| {
+ // An agent can retarget this document while the sheet is open. Its answer must not
+ // replace that later choice. The picker itself already checks the document's uid.
+ if !app.session.active().is_some_and(|st| st.uid == uid && st.path == self.path) {
+ return Err("cancelled".into());
+ }
+ super::save::save_suggesting(app, SaveMode::SaveAs, &self.params, false, Some(&self.pick))
+ });
+ let again = save.clone();
+ let entry = Entry::Call(Rc::new(move |app| {
+ if let Err(e) = again(app) {
+ app.status(e);
+ }
+ }));
+ let r = picks::as_own_entry(app, entry, |app| save(app));
+ Some(match r {
+ Err(e) if e == "cancelled" && app.picks.is_waiting() => {
+ app.status(status);
+ Ok(json!({ "pending": "fileDialog" }))
+ }
+ r => r,
+ })
+ }
+}
diff --git a/crates/ui-egui/src/io/save.rs b/crates/ui-egui/src/io/save.rs
index cfbdaaadba..5efe776d64 100644
--- a/crates/ui-egui/src/io/save.rs
+++ b/crates/ui-egui/src/io/save.rs
@@ -241,6 +241,31 @@ fn plan(app: &VectorcraftApp, mode: SaveMode, p: &Value) -> Result Save alone offers another destination when its own location refuses writes.
+/// Save Changes during Close/Quit continues to use [`save`].
+pub(crate) fn save_current(app: &mut VectorcraftApp, p: &Value) -> Result {
+ save_current_in(app, p, fileio::documents_dialog_folder())
+}
+
+/// The same entry with a resolved Documents folder (also permits deterministic host-free tests).
+pub(super) fn save_current_in(app: &mut VectorcraftApp, p: &Value, folder: Option) -> Result {
+ remember_view(app);
+ let first = plan(app, SaveMode::Save, &acknowledged(p))?;
+ let own = !app.automation_is_acting()
+ && !is_web(app)
+ && p.get("path").is_none_or(Value::is_null)
+ && first.path.is_some()
+ && app.session.active().is_some_and(|st| !st.converted && !st.recovered && st.path == first.path && st.format == first.format.id);
+ if !own {
+ return save(app, SaveMode::Save, p, true);
+ }
+ if let Some(r) = first.path.as_deref().and_then(|path| ask_before_losing(app, path, "file.save", p)) {
+ return Ok(r);
+ }
+ let retry = super::read_only_save::Retry::new(&first, folder);
+ write_plan(app, first, Some(retry))
+}
+
/// File → Save, Save As…, Save a Copy…, Save as Template… and the options dialogs' OK. `p` is the
/// engine command's `{path?, format?, options?, svg?}`.
///
@@ -253,6 +278,17 @@ fn plan(app: &VectorcraftApp, mode: SaveMode, p: &Value) -> Result,
/// path?}` while a dialog is open.
pub fn save(app: &mut VectorcraftApp, mode: SaveMode, p: &Value, ask_options: bool) -> Result {
+ save_suggesting(app, mode, p, ask_options, None)
+}
+
+/// Reuse Save As with a captured name and folder, without changing the document before writing.
+pub(super) fn save_suggesting(
+ app: &mut VectorcraftApp,
+ mode: SaveMode,
+ p: &Value,
+ ask_options: bool,
+ suggestion: Option<&FilePick>,
+) -> Result {
remember_view(app);
// Writing over the file the document was read from is asked about here, not refused.
let first = plan(app, mode, &acknowledged(p))?;
@@ -264,7 +300,7 @@ pub fn save(app: &mut VectorcraftApp, mode: SaveMode, p: &Value, ask_options: bo
if ask && matches!(mode, SaveMode::SaveAs | SaveMode::Copy) && matches!(first.format.id, "svg" | "svgz") {
return ask_format_options(app, mode, first.format, &path);
}
- return write_plan(app, first);
+ return write_plan(app, first, None);
}
if is_web(app) && ask_options {
return Ok(open_options(app, mode.command(), first.format, &first.name, true));
@@ -273,8 +309,12 @@ pub fn save(app: &mut VectorcraftApp, mode: SaveMode, p: &Value, ask_options: bo
SaveMode::Template => fileio::template_filters(first.format.id),
_ => fileio::save_filters(first.format.id),
});
- let pick = FilePick { name: first.name.clone(), folder: first.folder.clone(), filters };
- let picked = pick_finished(app, &pick, |picked, file_type| with_picked_type(picked, &first.name, file_type, first.format, mode))?;
+ let pick = FilePick {
+ name: suggestion.map_or_else(|| first.name.clone(), |s| s.name.clone()),
+ folder: suggestion.map_or_else(|| first.folder.clone(), |s| s.folder.clone()),
+ filters,
+ };
+ let picked = pick_finished(app, &pick, |picked, file_type| with_picked_type(picked, &pick.name, file_type, first.format, mode))?;
// The picked file type wins over a `format` param.
let mut q = if p.is_object() { p.clone() } else { json!({}) };
if let Some(o) = q.as_object_mut() {
@@ -291,7 +331,7 @@ pub fn save(app: &mut VectorcraftApp, mode: SaveMode, p: &Value, ask_options: bo
crate::dialogs::opened_by_panel(app);
return r;
}
- write_plan(app, chosen)
+ write_plan(app, chosen, None)
}
/// The UI command that runs a save in `mode`.
@@ -418,7 +458,7 @@ pub(crate) fn saved_status(path: &str, r: &Value) -> String {
/// ([`background`]): this returns `{path, background: true, status, format, warnings}` at once
/// (`warnings`: what the format loses, then the save's notes on its params, such as an option the format
/// doesn't read), and the document takes the file (and counts as saved, as of the snapshot) once it is written.
-fn write_plan(app: &mut VectorcraftApp, plan: SavePlan) -> Result {
+fn write_plan(app: &mut VectorcraftApp, plan: SavePlan, retry: Option) -> Result {
let uid = app.session.active().ok_or("no document")?.uid;
// Saves of one document finish in order.
if app.background.busy_with(uid) {
@@ -444,19 +484,53 @@ fn write_plan(app: &mut VectorcraftApp, plan: SavePlan) -> Result
let enabled = app.session.prefs.background_save && target.is_some();
// The work writes the file; the copy makes it the document's own afterwards.
let done = job.clone();
+ // Capture the caller before background work leaves the request: it must never open a panel
+ // or error dialog later, when answering_control has been reset.
+ let by_control = app.automation_is_acting();
+ let location_refused = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false));
+ let refused_by_work = location_refused.clone();
+ let own_path = target.clone();
+ let save_write = app.services.save_write.clone().filter(|_| !is_web(app));
+ let save_stream = app.services.save_stream.clone().filter(|_| job.streams() && !is_web(app));
// A native file streams into the file as it is encoded (desktop; not to a download).
let stream = app.services.stream_shared.clone().filter(|_| job.streams() && !is_web(app));
let work = move |write: Writer| {
- match stream {
- Some(stream) => job.write_streamed(&mut |p, fill| stream(p, fill).map_err(EngineError::Other)),
- None => job.write(|p, b| write(p, b).map_err(EngineError::Other)),
- }
- .map_err(|e| e.to_string())
+ let mut own_refused = false;
+ let mut observed = |p: &str, r: vectorcraft_engine::Result<()>| {
+ own_refused = own_path.as_deref() == Some(p) && matches!(&r, Err(EngineError::ReadOnlyLocation(_)));
+ r
+ };
+ let r = match (save_stream, save_write, stream) {
+ (Some(stream), _, _) => job.write_streamed(&mut |p, fill| observed(p, stream(p, fill))),
+ (_, Some(write), _) => job.write(|p, b| observed(p, write(p, b))),
+ (_, _, Some(stream)) => job.write_streamed(&mut |p, fill| stream(p, fill).map_err(EngineError::Other)),
+ _ => job.write(|p, b| write(p, b).map_err(EngineError::Other)),
+ };
+ r.map_err(|e| {
+ if let EngineError::ReadOnlyLocation(reason) = &e {
+ refused_by_work.store(own_refused, std::sync::atomic::Ordering::Relaxed);
+ if !by_control {
+ return reason.clone();
+ }
+ }
+ e.to_string()
+ })
};
let failed = target.clone().unwrap_or_default();
let then = move |app: &mut VectorcraftApp, r: Result| {
+ if r.is_err()
+ && location_refused.load(std::sync::atomic::Ordering::Relaxed)
+ && let Some(retry) = retry
+ && let Some(r) = retry.instead(app, uid)
+ {
+ return r;
+ }
// Not written: the document keeps its file, format and modified state, and the user is told.
- let r = r.inspect_err(|e| report_write_error(app, false, &failed, e))?;
+ let r = r.inspect_err(|e| {
+ if !by_control {
+ report_write_error(app, false, &failed, e);
+ }
+ })?;
// The document may have closed meanwhile: the file is written all the same.
done.complete(&mut app.session, uid);
let path = r["path"].as_str().unwrap_or_default().to_string();
diff --git a/crates/ui-egui/src/io/tests_read_only_save.rs b/crates/ui-egui/src/io/tests_read_only_save.rs
new file mode 100644
index 0000000000..8a01003a90
--- /dev/null
+++ b/crates/ui-egui/src/io/tests_read_only_save.rs
@@ -0,0 +1,266 @@
+//! Injected writers and picker answers: no native panel or filesystem permissions are needed.
+
+use std::io::ErrorKind;
+use std::sync::{Arc, Mutex, mpsc};
+
+use serde_json::{Value, json};
+use vectorcraft_engine::{EngineError, READ_ONLY_LOCATION, Session};
+
+use super::{fileio, save};
+use crate::control::ControlRequest;
+use crate::tests::picks::off_the_ui_thread;
+use crate::{Services, VectorcraftApp, background, dialogs, picks};
+
+const DOCUMENTS: &str = "/home/artist/Documents";
+
+#[derive(Default)]
+struct Files {
+ original: String,
+ attempts: Vec,
+ kind: Option,
+ fail_second: bool,
+}
+
+fn write(files: &Mutex, path: &str) -> vectorcraft_engine::Result<()> {
+ let mut files = files.lock().unwrap();
+ files.attempts.push(path.into());
+ if path == files.original || files.fail_second {
+ let reason = format!("{path}: injected refusal");
+ return Err(match files.kind {
+ Some(ErrorKind::PermissionDenied | ErrorKind::ReadOnlyFilesystem) => EngineError::ReadOnlyLocation(reason),
+ _ => EngineError::Other(reason),
+ });
+ }
+ Ok(())
+}
+
+fn app(format: &str, kind: ErrorKind) -> (VectorcraftApp, Arc>) {
+ let files = Arc::new(Mutex::new(Files { original: format!("/locked/Poster.{format}"), kind: Some(kind), ..Default::default() }));
+ let typed = files.clone();
+ let ordinary = files.clone();
+ let services = Services {
+ save_write: Some(Arc::new(move |path, _| write(&typed, path))),
+ write: Some(Box::new(move |path, _| {
+ write(&ordinary, path).map_err(|e| match e {
+ EngineError::ReadOnlyLocation(reason) => reason,
+ e => e.to_string(),
+ })
+ })),
+ ..Default::default()
+ };
+ let mut app = VectorcraftApp::new(Session::new(), services);
+ app.run("file.new", json!({"width": 40, "height": 40})).unwrap();
+ app.run("shape.rectangle", json!({"x": 1, "y": 1, "width": 10, "height": 10})).unwrap();
+ let st = app.session.doc_mut().unwrap();
+ st.path = Some(files.lock().unwrap().original.clone());
+ st.format = fileio::format(format).unwrap().id;
+ st.save_options = if format == "svg" {
+ json!({"decimals": 2, "preserveEditing": false})
+ } else {
+ json!({"pdfCompatible": false, "compress": true, "preview": false})
+ }
+ .as_object()
+ .unwrap()
+ .clone();
+ (app, files)
+}
+
+fn state(app: &VectorcraftApp) -> (Option, bool, &'static str, Value) {
+ let st = app.session.doc().unwrap();
+ (st.path.clone(), st.is_dirty(), st.format, json!(st.save_options))
+}
+
+fn poll(app: &mut VectorcraftApp) {
+ picks::poll(app, &egui::Context::default());
+}
+
+fn normal_error(app: &VectorcraftApp) {
+ let d = app.ui.dialog.as_ref().expect("a persistent error dialog");
+ assert_eq!(d.kind, dialogs::confirm::MESSAGE);
+ assert!(d.str("detail").contains("injected refusal"));
+ assert!(!d.str("detail").contains(READ_ONLY_LOCATION));
+ assert!(app.ui.told.is_empty(), "no duplicate error dialog");
+}
+
+#[test]
+fn readonly_fallback_prefills_save_as_and_cancel_keeps_the_failed_save_state() {
+ for kind in [ErrorKind::PermissionDenied, ErrorKind::ReadOnlyFilesystem] {
+ let (mut app, files) = app("svg", kind);
+ let before = state(&app);
+ let (shown, _) = off_the_ui_thread(&mut app.services);
+ let r = save::save_current_in(&mut app, &json!({"modified": null}), Some(DOCUMENTS.into())).unwrap();
+ assert_eq!(r["pending"], "fileDialog");
+ let requests = shown.requests();
+ let [picks::PickRequest::Save(pick)] = requests.as_slice() else { panic!("expected one save panel: {requests:?}") };
+ assert_eq!(pick.name, "Poster.svg");
+ assert_eq!(pick.folder.as_deref(), Some(DOCUMENTS));
+ assert_eq!(pick.filters.first(), crate::FilePick::filters(fileio::save_filters("svg")).first());
+ assert!(app.ui.status.contains("choose where to save it"));
+ assert_eq!(state(&app), before);
+ assert!(app.ui.dialog.is_none());
+ shown.answer(&[]);
+ poll(&mut app);
+ assert_eq!(state(&app), before);
+ assert_eq!(files.lock().unwrap().attempts, ["/locked/Poster.svg"]);
+ assert!(!app.picks.is_waiting());
+ }
+}
+
+#[test]
+fn readonly_save_as_retargets_only_after_write_and_keeps_options() {
+ let (mut app, files) = app("svg", ErrorKind::PermissionDenied);
+ let before = state(&app);
+ let uid = app.session.doc().unwrap().uid;
+ let (shown, _) = off_the_ui_thread(&mut app.services);
+ assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "fileDialog");
+ // Hold the second write after the picker answers: the chosen path is not yet the document's.
+ let (entered, writing) = mpsc::channel();
+ let (release, released) = mpsc::channel();
+ let released = Mutex::new(released);
+ let f = files.clone();
+ app.services.save_write = Some(Arc::new(move |path, _| {
+ entered.send(()).unwrap();
+ released.lock().unwrap().recv().unwrap();
+ write(&f, path)
+ }));
+ app.services.write_shared = Some(Arc::new(|_, _| panic!("typed saves must use their own writer")));
+ app.session.prefs.background_save = true;
+ shown.answer(&["/home/artist/Documents/Poster.svg"]);
+ poll(&mut app);
+ writing.recv().unwrap();
+ assert_eq!(state(&app), before);
+ release.send(()).unwrap();
+ background::wait_all(&mut app);
+ let st = app.session.document_mut(uid).unwrap();
+ assert_eq!(st.path.as_deref(), Some("/home/artist/Documents/Poster.svg"));
+ assert!(!st.is_dirty());
+ assert_eq!(st.format, before.2);
+ assert_eq!(json!(st.save_options), before.3);
+ assert_eq!(files.lock().unwrap().attempts, ["/locked/Poster.svg", "/home/artist/Documents/Poster.svg"]);
+ assert!(shown.requests().is_empty() && app.ui.dialog.is_none());
+}
+
+#[test]
+fn readonly_second_failure_shows_one_dialog_without_reopening_the_picker() {
+ let (mut app, files) = app("svg", ErrorKind::PermissionDenied);
+ files.lock().unwrap().fail_second = true;
+ let before = state(&app);
+ let (shown, _) = off_the_ui_thread(&mut app.services);
+ app.run("file.save", json!({})).unwrap();
+ shown.answer(&["/elsewhere/Poster.svg"]);
+ poll(&mut app);
+ normal_error(&app);
+ assert_eq!(state(&app), before);
+ assert!(shown.requests().is_empty() && !app.picks.is_waiting());
+ assert_eq!(files.lock().unwrap().attempts, ["/locked/Poster.svg", "/elsewhere/Poster.svg"]);
+}
+
+#[test]
+fn readonly_other_errors_and_explicit_destinations_keep_the_dialog() {
+ for (command, params, kind) in [
+ ("file.save", json!({}), ErrorKind::StorageFull),
+ ("file.save", json!({}), ErrorKind::NotFound),
+ ("file.save", json!({}), ErrorKind::Other),
+ ("file.save", json!({"path": "/locked/Poster.svg"}), ErrorKind::PermissionDenied),
+ ("file.saveAs", json!({"path": "/locked/Poster.svg", "options": {"decimals": 2}}), ErrorKind::PermissionDenied),
+ ("file.saveCopy", json!({"path": "/locked/Poster.svg", "options": {"decimals": 2}}), ErrorKind::PermissionDenied),
+ ("file.exportAs", json!({"path": "/locked/Poster.svg", "format": "svg"}), ErrorKind::PermissionDenied),
+ ] {
+ let (mut app, _) = app("svg", kind);
+ let before = state(&app);
+ // A fallback would return pending, so no inline/native dialog is necessary here.
+ app.services.pick_save = Some(Box::new(move |_| panic!("{command}: no fallback")));
+ assert!(app.run(command, params).is_err(), "{command}");
+ normal_error(&app);
+ assert_eq!(state(&app), before);
+ }
+}
+
+#[test]
+fn readonly_control_returns_the_prefix_and_never_opens_a_panel_even_after_completion() {
+ for wait in [true, false] {
+ let (mut app, _) = app("svg", ErrorKind::PermissionDenied);
+ app.services.pick_save = Some(Box::new(|_| panic!("automation never picks")));
+ app.services.write_shared = Some(Arc::new(|_, _| panic!("typed writer required")));
+ app.session.prefs.background_save = true;
+ let before = state(&app);
+ let (tx, rx) = mpsc::channel();
+ app = app.with_control(rx);
+ let (req, reply) = ControlRequest::new("app.save", json!({"wait": wait}));
+ tx.send(req).unwrap();
+ app.drain_control(&egui::Context::default());
+ let reply = reply.try_recv().unwrap();
+ if wait {
+ assert_eq!(reply["ok"], false);
+ assert!(reply["error"].as_str().unwrap().starts_with("READ_ONLY_LOCATION: "), "{reply}");
+ } else {
+ assert_eq!(reply["result"]["background"], true);
+ assert!(!app.ui.answering_control);
+ background::wait_all(&mut app);
+ assert!(app.ui.status.contains("READ_ONLY_LOCATION: "));
+ }
+ assert_eq!(state(&app), before);
+ assert!(app.ui.dialog.is_none() && app.ui.told.is_empty() && !app.picks.is_waiting());
+ }
+}
+
+#[test]
+fn readonly_background_completion_resumes_the_original_uid_without_repeating_save() {
+ for streamed in [false, true] {
+ let format = if streamed { "vectorcraft" } else { "svg" };
+ let (mut app, files) = app(format, ErrorKind::ReadOnlyFilesystem);
+ let original = files.lock().unwrap().original.clone();
+ let uid = app.session.doc().unwrap().uid;
+ let (shown, _) = off_the_ui_thread(&mut app.services);
+ if streamed {
+ let f = files.clone();
+ app.services.save_stream = Some(Arc::new(move |path, fill| {
+ let mut bytes = Vec::new();
+ fill(&mut bytes).unwrap();
+ write(&f, path)
+ }));
+ app.services.save_write = Some(Arc::new(|_, _| panic!("native save must stream")));
+ }
+ app.services.write_shared = Some(Arc::new(|_, _| panic!("typed writer required")));
+ app.session.prefs.background_save = true;
+ assert_eq!(app.run("file.save", json!({})).unwrap()["background"], true);
+ app.run("file.new", json!({"width": 20, "height": 20})).unwrap();
+ let other = app.session.doc().unwrap().uid;
+ background::wait_all(&mut app);
+ assert_eq!(app.session.doc().unwrap().uid, uid);
+ assert_eq!(shown.requests().len(), 1);
+ // Switch again while the native panel is open: its answer belongs to the original uid.
+ app.run("document.activate", json!({"index": 1})).unwrap();
+ let chosen = format!("/elsewhere/Poster.{format}");
+ shown.answer(&[&chosen]);
+ poll(&mut app);
+ background::wait_all(&mut app);
+ assert_eq!(app.session.doc().unwrap().uid, uid);
+ assert_eq!(app.session.doc().unwrap().path.as_deref(), Some(chosen.as_str()));
+ assert!(!app.session.doc().unwrap().is_dirty());
+ assert!(app.session.document_mut(other).unwrap().path.is_none());
+ assert_eq!(files.lock().unwrap().attempts, [original, chosen]);
+ assert!(shown.requests().is_empty());
+ }
+}
+
+#[test]
+fn readonly_busy_picker_and_save_changes_keep_the_existing_error_flow() {
+ let (mut app, _) = app("svg", ErrorKind::PermissionDenied);
+ let (shown, _) = off_the_ui_thread(&mut app.services);
+ app.run("file.saveAs", json!({})).unwrap_err();
+ assert_eq!(shown.requests().len(), 1);
+ assert!(app.run("file.save", json!({})).is_err());
+ normal_error(&app);
+ assert_eq!(shown.requests().len(), 1);
+ shown.answer(&[]);
+ poll(&mut app);
+ app.ui.dialog = None;
+ let st = app.session.doc().unwrap();
+ app.ui.dialog = Some(crate::state::Dialog::new(crate::unsaved::KIND, json!({"index": 0, "uid": st.uid, "then": "close"})));
+ assert!(crate::unsaved::confirm(&mut app).is_err());
+ normal_error(&app);
+ assert!(shown.requests().is_empty());
+ assert_eq!(app.session.documents().len(), 1);
+ assert!(app.session.doc().unwrap().is_dirty());
+}
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 644125b545..c4d7c21c1a 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -120,7 +120,8 @@ pub use craft_ui::docking::Monitor as DockMonitor;
#[cfg(test)]
pub(crate) use services::browsable_url;
pub use services::{
- DownloadFn, ExistsFn, FileFilter, FilePick, Inbox, NativeInputHook, OpenUrlFn, PickOpen, PickSave, ReadFn, RevealFn, Services, WriteFn,
+ DownloadFn, ExistsFn, FileFilter, FilePick, Inbox, NativeInputHook, OpenUrlFn, PickOpen, PickSave, ReadFn, RevealFn, SaveStreamFn, SaveWriteFn,
+ Services, WriteFn,
};
use state::{GeometryStamp, InputGeneration, PendingScreenshot, QueuedScreenshot};
pub(crate) use state::{InputFrame, take_frame_once};
diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs
index 1223e1e426..0e29e99e12 100644
--- a/crates/ui-egui/src/menus/run.rs
+++ b/crates/ui-egui/src/menus/run.rs
@@ -122,7 +122,7 @@ fn run_ui_part1(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option io::open_with(app, p),
// Saves write through the app (save panel, download); with no path known the panel and the
// format's options dialog ask first.
- "file.save" => io::save(app, SaveMode::Save, p, true),
+ "file.save" => io::save_current(app, p),
"file.saveAs" => io::save(app, SaveMode::SaveAs, p, true),
"file.saveCopy" => io::save(app, SaveMode::Copy, p, true),
"file.saveAsTemplate" => io::save(app, SaveMode::Template, p, true),
diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs
index a96f13e67c..e21c1f1787 100644
--- a/crates/ui-egui/src/menus/ui_commands.rs
+++ b/crates/ui-egui/src/menus/ui_commands.rs
@@ -40,7 +40,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"file.save",
"Save",
"Cmd+S",
- "{path?, format?, options?, svg?: {…SVG options}} = document.save, written through the app (a document saved as SVG, PDF or .ai, or opened from one Save can write back, saves as that again, with the same options); with no path known (never saved, converted) the Save As panel asks first",
+ "{path?, format?, options?, svg?: {…SVG options}} = document.save, written through the app (a document saved as SVG, PDF or .ai, or opened from one Save can write back, saves as that again, with the same options); with no path known (never saved, converted) the Save As panel asks first; ordinary Save to the document's existing file refused by filesystem permissions or a read-only volume opens Save As in Documents with the same name, format and options; cancelling keeps the original path and modified state. Explicit destinations and Close/Quit keep their existing error dialog. Automation gets READ_ONLY_LOCATION: followed by the reason and no panel",
),
(
"file.place",
diff --git a/crates/ui-egui/src/picks.rs b/crates/ui-egui/src/picks.rs
index 4122c19410..080c335d4c 100644
--- a/crates/ui-egui/src/picks.rs
+++ b/crates/ui-egui/src/picks.rs
@@ -188,6 +188,15 @@ pub(crate) fn as_entry(app: &mut VectorcraftApp, entry: impl FnOnce() -> Entr
r
}
+/// Run a continuation under its own entry: a refused Save's panel must resume Save As, not retry
+/// the original Save. Restore the enclosing entry for any work it does afterwards.
+pub(crate) fn as_own_entry(app: &mut VectorcraftApp, entry: Entry, f: impl FnOnce(&mut VectorcraftApp) -> R) -> R {
+ let outer = app.picks.entry.replace(entry);
+ let r = f(app);
+ app.picks.entry = outer;
+ r
+}
+
/// [`as_entry`] for a panel's or a dialog's button that `f` handles.
pub(crate) fn button(app: &mut VectorcraftApp, f: impl Fn(&mut VectorcraftApp) + 'static) {
let f = Rc::new(f);
diff --git a/crates/ui-egui/src/services.rs b/crates/ui-egui/src/services.rs
index 901c0a3409..3b0bc7caa9 100644
--- a/crates/ui-egui/src/services.rs
+++ b/crates/ui-egui/src/services.rs
@@ -43,6 +43,13 @@ pub type ReadHeadFn = Box Result, String>>;
pub type WriteFn = Box Result<(), String>>;
+/// A save writer that keeps typed filesystem failures, on either the UI or background thread.
+pub type SaveWriteFn = Arc vectorcraft_engine::Result<()> + Send + Sync>;
+
+/// A typed save writer for native files encoded directly into the output.
+pub type SaveStreamFn =
+ Arc std::io::Result<()>) -> vectorcraft_engine::Result<()> + Send + Sync>;
+
pub type ExistsFn = Box bool>;
pub type Inbox = Arc)>>>;
@@ -129,6 +136,10 @@ pub struct Services {
/// stream into the file as they are encoded instead of being held whole in memory first.
/// Without it they are encoded, then written with `write` / `write_shared`.
pub stream_shared: Option,
+ /// Typed writers for document saves only. Without them the existing string writers are used
+ /// and failures keep their normal dialog. Downloads never use these callbacks.
+ pub save_write: Option,
+ pub save_stream: Option,
/// Open a file (or a folder) in the system's default app for it (desktop: Edit Original, Show
/// Package). Without it (the web) those answer with an error.
pub open_file: Option,
diff --git a/docs/control-protocol.md b/docs/control-protocol.md
index 04715474d0..abf5a0e4cb 100644
--- a/docs/control-protocol.md
+++ b/docs/control-protocol.md
@@ -1,5 +1,7 @@
# Control protocol
+> **Last updated:** 2026-11-11 · **Change:** Save location-refusal error (#6146); existing response shapes retained.
+
> **Last updated:** 2026-10-31 · **Change:** Confining file access refuses a `:` in a name after the drive on Windows, an NTFS alternate data stream such as `x.svg:evil` (#3604); previously: Object → Expand… dimmed while the selection has an appearance Expand Appearance expands (`object.expand.info`'s `appearance`, #3089); previously: brush library panels (`window.brushLibrary`, `window.brushLibrary.other`, `ui.saveBrushLibrary`); previously: Transform Each opens on the values it was last confirmed with; its Copy button confirms with `copy: true` (#1732); previously: panel docking on craft-ui's layout: `ui.docking`, the parameters of `window.panel.float` and `window.panel.dock`; previously: `ui.screenshot`'s 64 MiB inline-PNG cap and its path-plus-data downgrade; symbol library panels (`window.symbolLibrary`, `window.symbolLibrary.other`, `ui.saveSymbolLibrary`); synthetic input budgets (#1709); bounded transport waits (#1726).
`vectorcraft --control ` listens on `127.0.0.1:` (loopback only). The port must be a number
@@ -111,7 +113,7 @@ the two can still win that race.
| `app.export` with `useArtboards` | `{path, useArtboards: true, range? \| artboards?, …}` | Export As: PNG, JPEG and WebP write one file per chosen artboard (default all; SVG does so for a `range`), `-.`, and return `{path, files: [path…]}`; a PDF keeps them as pages of `path`. `useArtboards: false` covers the bounds of the visible art. The menu's Export As… is `file.exportAs`: the `exportAs` dialog (`format`, `useArtboards`, `all`, `range`), then a save dialog and the format's options: `pngOptions` / `jpgOptions` / `webpOptions`, `svgOptions`, or `savePdf` for a PDF with Use Artboards |
| `ui.dialog.*` on `gradientStop` | `{field: "color" \| "opacity" \| "location", value}` | double-clicking a stop on the Gradient tool's annotator opens its popover (fields `index`, `x`, `y`, `tab`); set `color` (hex), `opacity` or `location` (percentages) and `ui.dialog.confirm` to apply them to the selected stop. `gradient.selectStop {index}` picks the stop the annotator, the panels and Delete/←/→ (`ui.key`) act on |
| `engine.execute` `ui.savePdfDialog` | `{path?, preset?, range?, …document.exportPdf options}` | opens the Save PDF dialog (`file.export.pdf` with no params opens it too). Its fields are the `document.exportPdf` options: set `compatibility` with `ui.dialog.set {field: "compatibility", value: "1.5"}`, a whole section with `{field: "compression", value: {…}}`, the artboards with `__allArtboards: false` and `range`, the visible section with `__section` (General, Compression, Marks and Bleeds, Output, Advanced, Security, Summary). `ui.dialog.confirm` writes `path` (else asks for one), returns `{path, bytes, warnings}` and opens the file when `viewAfterSaving` is set |
-| `file.save` / `file.saveAs` / `file.saveCopy` / `file.saveAsTemplate` (via `engine.execute`) | `{path?, format?, options?, svg?}` | Save writes the document's own file in its own format (a document opened from or saved as SVG/PDF saves as that again; the result's `warnings` say what the format loses). With `path` the file is written at once (Save As or a Copy to an SVG path without SVG options first opens SVG Options, below). Without one (never saved, a converted older file, Save As, a Copy, a Template) the app shows a save panel with one file type per save format (`vectorcraft`, `template`, `pdf`, `svg`, `svgz`, `ai`; for a Template, `template` and `ait`), then the format's options: SVG opens the `svgOptions` dialog (below; returns `{"pending": "svgOptions", "path"}`), PDF the `savePdf` dialog (its `__save` field names the save command); `ui.dialog.confirm` finishes the save. A name typed in the panel without the file type's extension gets it, and a name the panel returns with the extension of a format the panel does not list has it replaced (in a native save, `card.png` and `card.ait` are saved as `card.vectorcraft`, and `notes.v2`, whose extension names no format, is saved as `notes.v2.vectorcraft`); when a file of that name exists, which the panel did not ask about, the save (and every export or other write through a save panel) answers `cancelled` and opens a `replaceFile` dialog (fields `message`, `detail`, `path`): `ui.dialog.confirm` writes that file, `ui.dialog.cancel` writes nothing. On the web a `saveOptions` dialog (fields `path`, `format`) first names the file and picks the format. `file.formatOptions {format?}` reads the options a save would use. `file.revert` opens a `confirm` dialog (`{"pending": "confirm"}`); `ui.dialog.confirm` reloads the saved file in the same tab |
+| `file.save` / `file.saveAs` / `file.saveCopy` / `file.saveAsTemplate` (via `engine.execute`) | `{path?, format?, options?, svg?}` | Save writes the document's own file in its own format (a document opened from or saved as SVG/PDF saves as that again; the result's `warnings` say what the format loses). With `path` the file is written at once (Save As or a Copy to an SVG path without SVG options first opens SVG Options, below). Without one (never saved, a converted older file, Save As, a Copy, a Template) the app shows a save panel with one file type per save format (`vectorcraft`, `template`, `pdf`, `svg`, `svgz`, `ai`; for a Template, `template` and `ait`), then the format's options: SVG opens the `svgOptions` dialog (below; returns `{"pending": "svgOptions", "path"}`), PDF the `savePdf` dialog (its `__save` field names the save command); `ui.dialog.confirm` finishes the save. A name typed in the panel without the file type's extension gets it, and a name the panel returns with the extension of a format the panel does not list has it replaced (in a native save, `card.png` and `card.ait` are saved as `card.vectorcraft`, and `notes.v2`, whose extension names no format, is saved as `notes.v2.vectorcraft`); when a file of that name exists, which the panel did not ask about, the save (and every export or other write through a save panel) answers `cancelled` and opens a `replaceFile` dialog (fields `message`, `detail`, `path`): `ui.dialog.confirm` writes that file, `ui.dialog.cancel` writes nothing. On the web a `saveOptions` dialog (fields `path`, `format`) first names the file and picks the format. `file.formatOptions {format?}` reads the options a save would use. `file.revert` opens a `confirm` dialog (`{"pending": "confirm"}`); `ui.dialog.confirm` reloads the saved file in the same tab Location refusals return `READ_ONLY_LOCATION: ` without a fallback panel for automation; see [Save location errors](#save-location-errors). |
| SVG Options (`engine.execute` of `file.export.svg`, `file.saveAs`, `file.saveCopy`) | `{}` / `{path?, svg?: {…}}` | `file.export.svg` without params, and Save As or Save a Copy to an `.svg`/`.svgz` path without SVG options, open the `svgOptions` dialog (`ui.dialog.set` its fields: `styling`, `outlineText`, `images`, `objectIds`, `decimals`, `minify`, `responsive`, `fewerTspans`, `metadata`, `preserveEditing`, `useArtboards`, `allArtboards`, `range`, `showCode`, `profile` (`svg11`/`tiny12`), `encoding` (`utf8`/`utf16`/`latin1`), `embedFonts`; `ui.dialog.confirm` exports or saves and remembers the choices). With `svg: {…}` (the `document.formats` SVG options) they run directly. `app.save {path?, svg?}` takes the same options; a document saved as SVG saves as SVG again with the same options |
| `engine.execute` `file.place` | `{paths?}` / `{path \| name+dataBase64, …file.place params}` | with no file, picks files and opens the `place` dialog; with `paths`, opens it for them (fields `files`, `link`, `template`, `replace`; `__replace` says whether Replace applies, `__info` describes each file). `ui.dialog.confirm` places one file centered in the view (or in place of the selected object) and loads the place cursor with several (`file.place.queue`). In the desktop app the dialog reads its files off the UI thread: `__info` is empty until they are read, `ui.dialog.confirm` returns `{background: true, status}`, `ui.inspect` lists the files still being read in `placing`, and the file is placed (or the cursor loaded) once it is read. With a file, it runs `file.place` centered in the view, at once. Files dropped on the window with no document open open. On the web, files dropped on the canvas are placed at the drop point (linked; Shift embeds) and files dropped off it (the tab bar) open, as in Illustrator; desktop drops carry no pointer position, so documents (native, SVG, PDF, `.ai`, EPS, DXF, EMF/WMF) open as tabs of their own and pictures and text are placed in the middle of the view. Swatch libraries and color books (`.vcswatches`, `.gpl`, `.ase`, `.acb`), graphic style libraries (`.vcstyles`), Libraries panel files (`.vclibrary`), presets (`.vcflattener`, `.vcpdfpresets`, `.vcprintpresets`, `.vcperspective`, `.vcexportpresets`), plug-ins (`.wasm`) and shortcut sets (`.kys`, in Import Shortcut Set) open wherever they are dropped, as File › Open opens them. With the cursor loaded (`ui.inspect` → `tool: "place"`, `toolOptions: {count, current, name, names}`), `ui.pointer` clicks and drags place files (in the desktop app each file is read off the UI thread and placed once it is read, and `ui.inspect` lists it in `placing` until then) and `ui.key` ←/→/↑/↓ and Escape cycle and discard them |
| `app.export` raster options | `{path?, format: png \| jpg \| webp, ppi?, width?, height?, background?, antiAlias?, interlaced?, quality?}` | `ppi` sets the pixel size (72 = one pixel per point) and is stored in PNG and JPEG files (WebP files store no resolution); `width` or `height` sets the size of each file in pixels instead (`width` wins), and PNG and JPEG files store the resolution that results; `background` is `transparent`, `white`, `black` or `"#rrggbb"`; `antiAlias` is `none`, `art` or `type` (text snapped to pixels); `interlaced` writes an Adam7 PNG. The PNG Options dialog (`pngOptions`; `jpgOptions` / `webpOptions` for the other raster formats) has the same fields: fill them with `ui.dialog.set` and press OK with `ui.dialog.confirm` |
@@ -1072,3 +1074,24 @@ hidden tab (whose frames the browser pauses) answers when it is shown again.
| 2026-10-13 | minor | Documented count, pending-event and per-frame request budgets (#1709). |
| 2026-10-13 | minor | Documented transport deadlines and connection-slot recovery (#1726). |
| 2026-10-18 | minor | Documented `window.vectorcraft`, the web build's control channel. |
+
+## Save location errors
+
+A save refused by the filesystem with PermissionDenied or ReadOnlyFilesystem returns
+`READ_ONLY_LOCATION: `. The reason retains the path and system message. This is a
+stable prefix within the existing error string, not a new response field or JSON-RPC code.
+An automation-root denial, an encoding failure, and an error retaining recovery copies do
+not use this code. Choose a writable destination and explicitly save there; automation never
+opens the fallback Save As panel. Failed saves keep the original document path and modified
+state; multi-file saves may already have written other output files.
+
+`app.save` with `wait: true` returns the write failure in its reply (`save_file` already asks
+for this on the desktop). Without waiting, an accepted background save still replies before
+completion; any later failure opens no panel. MCP retains its usual tool-name prefix around
+the error text. The interactive fallback applies only to ordinary File > Save, not Close/Quit.
+
+## Revision history
+
+| Date | Change |
+|---|---|
+| 2026-11-11 | Document READ_ONLY_LOCATION for saves (#6146); no response-shape change. |
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index d42e770df0..c83419fe64 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,5 +1,7 @@
# File format parity
+> **Last updated:** 2026-11-11 · **Change:** Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending.
+
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (`.ai` and EPS import: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as the file's page aligns them, #6610; `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art, #6570; `.ai` save and open: layer colour presets Yellow, Magenta and Cyan keep their colour, as the `Lb` colour index now follows the file's numbering, #6502; `.ai` save: stroked type keeps its stroke's cap, join and miter limit in the text document, #6472; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x)
Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`,
@@ -15,6 +17,8 @@ from the public specifications, and users' own `.ai` files are used locally only
## Summary
+Ordinary File > Save offers Save As when its own location refuses writes with a terminal permission/read-only error (#6146). The picker keeps the filename, format and options and starts in Documents (home or host default if unavailable). Cancel leaves the document modified at its original path. Explicit Save As/Copy/export, recovery failures and Close/Quit keep their existing error dialog. Non-UI saves return `READ_ONLY_LOCATION: ` without opening a panel. Regression execution and native panel acceptance pending; format scores unchanged.
+
| | Illustrator | VectorCraft | Notes |
|---|---:|---:|---|
| Formats opened or placed | ~30 | 30 | missing: FreeHand, CorelDRAW, DWG, PICT, PS |
@@ -339,6 +343,7 @@ Stop opacity on translated artboards remains outside this regression coverage.
| Date | Change | Summary |
|---|---|---|
+| 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. |
| 2026-11-11 | minor | `.ai` and EPS import, and what SVG export, PDF export and `.ai` save draw: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as a `.ai`'s own page aligns them (see type-parity.md, same date). In 224 users' files (used locally, never committed), 63 render differently: 54 closer to the page, 7 further, 1 alike and 1 that couldn't be compared; among them the median share of pixels that differ from the page went from 4.4% to 1.0%. Of the 7: one now opens from its layers instead of its PDF part (they differ from the page by less than the import's 5% limit now; type note 3.8%); one has a centred line whose spacing inside it differs from the page's, which now centres on the page's line while half of it no longer lies on the page's glyphs (type note 1.4% to 2.4%); five moved by less than 0.05 of a percentage point, in type the page draws in other glyphs. The type note shows a smaller share in 6 files; 2 more envelopes of type open live (129 to 131, none fewer in any file). SVG import: `text-anchor` aligns a line's advance, which ends after its last character's letter spacing, so a centred or right-aligned letter-spaced line moves back by half or all of it and stays where a reader draws it; SVG export, which anchors lines so, reads back unchanged (test `import_text::anchored_letter_spaced_lines_stay_where_a_reader_draws_them`). Affinity import: centred or right-aligned tracked artistic text moves by half or all of its last character's tracking, as layout now aligns it (unverified against Affinity, whose files we don't have), and differently aligned paragraphs line up by the widths layout aligns them by (`affinity_features::artistic_text_aligns_its_lines_within_the_longest`). Scores and estimates unchanged. (#6610) |
| 2026-11-11 | minor | `.ai` and EPS import: while an envelope's contents are edited, the editing data keeps its mesh (a mesh's, a top object's or a warp's grid) in its dictionary, and in some files that mesh lies away from the drawn art by a move, the contents with the drawn art, as if the mesh hadn't followed the envelope when it moved: the envelope drew its contents elsewhere and kept its drawn art. A mesh or top object saved in Edit Contents (or a warp of type tried on its saved grid) whose mesh draws the contents as large as the drawn art, within half a point over width and height together, but further from it than that, is now tried again, after every other way and with one more of the import's checks, with its mesh moved by as far as the drawn art's box lies from the box of what it draws; it opens live there where it then draws as the drawn art. In users' files, used locally and never committed, only envelopes saved in Edit Contents draw elsewhere than their drawn art, and nothing in their dictionaries says by how much they moved. Tests `ai::tests::an_envelope_in_edit_contents_whose_mesh_stayed_behind_opens_live_on_its_drawn_art`, `tests_native::a_warp_of_type_in_edit_contents_whose_grid_stayed_behind_opens_on_its_drawn_art` (#6570) |
| 2026-11-11 | minor | `.ai` save (PDF-compatible editing copy and legacy) and `.ai`/EPS open: a layer's `Lb` colour index follows the file's numbering, where Magenta, Cyan and Yellow are 4, 5 and 6 and `LAYER_COLORS` has Yellow, Magenta and Cyan; Yellow, Magenta and Cyan layers no longer come out as Magenta, Cyan and Yellow, and the other 24 presets are unchanged (#6502, from the index and RGB pairs in users' files). `LAYER_COLORS` keeps its order, so `.vectorcraft` files and the Layers panel don't change. Scores and estimates unchanged. |
diff --git a/docs/gaps.md b/docs/gaps.md
index b722ace84c..fc003737cc 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -1,5 +1,7 @@
# Gaps
+> **Last updated:** 2026-11-11 · **Change:** Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending.
+
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (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; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
## Feature submission evidence
@@ -337,7 +339,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
selected with Direct Selection (#1839, #1824); Snap to Grid wins over Snap to Pixel (#1840, #1816 unconfirmed); Redo
during a drag keeps the drag (#1856, #1719); a template layer dims its images by Dim Images instead of fading the
whole layer (#1864, #1683); a failed save or export is reported in a dialog that names the file and stays until
- closed, the document left modified (#1865, #1685).
+ closed, the document left modified (#1865, #1685). Ordinary File > Save now offers Save As for terminal permission/read-only refusals (#6146), unless another picker is open; recovery errors retain the dialog. Regression execution pending; G11 estimate unchanged.
- **Done:** the Shape Builder offers the empty areas closed shapes enclose as regions, such as the middle of four
circles that touch, and merges them with the regions around them (#1691).
- **Done (#2523):** Shape Builder Gap Detection shares Live Paint's spatially indexed gap finder,
@@ -854,6 +856,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv
| Date | Change | Summary |
|---|---|---|
+| 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. |
| 2026-11-11 | minor | G5: built-in Energy Beams brush library (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail); Missing trimmed; estimate 5–15 → 4–14 h; MCP Brush libraries list Energy Beams. |
| 2026-11-11 | minor | G5: built-in Skill Icons symbol library (Attack, Defend, Heal, Buff, Ult); Missing trimmed; estimate 6–16 → 5–15 h; MCP Symbol libraries list Skill Icons. |
| 2026-11-10 | minor | G6: MCP catalogue (#6460): headless lists `UI_COMMANDS` (`ui: true`), eight prompts, effect vs command ids, 33 tools, commands/reference; estimate unchanged. |
diff --git a/docs/mcp.md b/docs/mcp.md
index 5826c5c8c4..d8e00fbdb1 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -1,5 +1,7 @@
# VectorCraft MCP server
+> **Last updated:** 2026-11-11 · **Change:** Save location-refusal error (#6146); existing response shapes retained.
+
`vectorcraft-cli mcp` runs a [Model Context Protocol](https://modelcontextprotocol.io) server on stdio
(newline-delimited JSON-RPC 2.0; see [Protocol](#protocol) for version negotiation). Agents use it to
draw, inspect and look at VectorCraft documents.
@@ -491,7 +493,7 @@ opens the picker through `run_command` with the remote backend.
| `open_panel` | `{panel}` | Remote only. `panel` is a panel id (`layers`, `swatches`, `colorGuide`, …, as `window.panel` takes) or its display label (`"Color Guide"`), in any case. |
| `screenshot` | `{path?, scale?, artboard?, window?, max_side?, traceViews?}` | Returns MCP image content (`image/png`, base64) plus a text block. Renders the artboard with the pixels of a PNG `export` with `background: "white"` at the same scale; `traceViews:true` draws Image Trace objects in the view set with `imageTrace.setView`, as in the app's window; `window:true` captures the app window (remote only), as `ui_screenshot` does, and `max_side` (1–4096, window captures only) scales the returned image down as described for `ui_screenshot`. With `path` the backend (the headless session or the app) writes the PNG there too; a window capture written there keeps its full size with `max_side`. |
| `open_file` | `{path, importer?, params?}` | Opens any readable file as a new active document: `.vectorcraft`/`.drawcraft`, `.vctemplate`, `.svg`/`.svgz`, `.pdf`/`.ai`, `.ait`, `.eps`/`.epsf`, `.ps`, `.dxf`, `.emf`, `.wmf`, PNG (`.png`/`.pns`), JPEG, GIF, WebP, TIFF, BMP (`.bmp`/`.dib`/`.rle`), Targa (`.tga`/`.vda`/`.icb`/`.vst`), PCX, Pixar (`.pxr`), JPEG 2000 (`.jpf`/`.jpx`/`.jp2`/`.j2k`/`.j2c`/`.jpc`), HEIC/HEIF (`.heic`/`.heif`), JPEG XL (`.jxl`), PSD (`.psd`/`.pdd`)/PSB (an image opens as a document of its pixel size; a Photoshop file as its merged image; a JPEG XL file as its first frame). Templates (`.vctemplate`, `.ait`) open as a new untitled document. PDF, `.ai` and SVG files saved with Preserve Editing reopen as the document they carry. The reply is `document.open`'s: its `warnings` say what didn't come in as it was (an EPS whose PostScript can't be read opens as its preview, and the warning names the PostScript error, the operator and the procedure). A file of an extension only an installed importer plug-in lists opens with that importer ([Plug-ins](#plug-ins)); `importer: "plugin."` opens the file with the importer it names, which must list the file's extension, also one a built-in format reads (in the app, as File › Open With does), and `params` gives that importer's parameters (their defaults when omitted). `run_command document.formats` lists the formats. |
-| `save_file` | `{path?, compress?, version?, preview?, precision?, options?}` | Runs `document.save`: the document's own file in its own format (native `.vectorcraft` unless it was opened from or saved as SVG, PDF or a restorable `.ai`; then `warnings` say what that format loses). A path's extension picks the format (`.vectorcraft`, `.vctemplate`, `.pdf`, `.svg`, `.svgz`, `.ai`: a PDF carrying the native document, which reopens editable). For a native file, `compress: true` gzips it (default: the `useCompression` preference, Preferences › File Handling › Use Compression), `version` (1 to 4) writes it for an older VectorCraft (1 and 2 are never compressed, and `version: 2` with `compress: true` is an error), `preview: true` embeds a PNG of the first artboard, and `precision` (0 to 9) rounds path anchors and handles to that many decimal places for that save only (colors, transforms and type stay exact). `options` passes the format's save options as `run_command document.formats` lists them. When `compress`, `version`, `preview` or `precision` is given both at the top level and in `options` with different values, the call is an error (`` `compress: true` and `options.compress: false` disagree: give the option once ``) and nothing is written. A key in `options` that no save format takes is an error, and nothing is written (see Parameter keys). The save drops each option the written format doesn't read. The reply's `warnings` then name each such option given (for example `` `compress` was not used: SVG files don't read it `` for an `.svg` path, and `` `options.preview` was not used: … `` for a key in `options`; a `.ai` file reads `compress` but not `version`, `preview` or `precision`). For a `.ai` file, these warnings name the kind of `.ai` written: a legacy .ai (version 7) for `aiVersion: "7"`, a non-PDF-compatible .ai for `pdfCompatible: false`, and a PDF-compatible .ai otherwise, including a save that reuses the options the document was last saved with. `run_command document.save` and the other save commands refuse any option given beside the path and in `options` with different values, and give the same warnings for a top-level `compress`, `version`, `preview` or `precision` and for each key in `options` that the format doesn't read. The headless session and the app receive the same `app.save` params, and the app is also sent `wait: true`: the call returns once the file is written, or with the error (such as a path outside the write root), even with Background Save on. When the save asks first (the question before replacing a file that opened with losses, or on macOS and Linux the file dialog for an untitled document without `path`), the reply is `{pending}` or `"cancelled"` as before, and the save that runs after the answer uses the Background Save preference. |
+| `save_file` | `{path?, compress?, version?, preview?, precision?, options?}` | Runs `document.save`: the document's own file in its own format (native `.vectorcraft` unless it was opened from or saved as SVG, PDF or a restorable `.ai`; then `warnings` say what that format loses). A path's extension picks the format (`.vectorcraft`, `.vctemplate`, `.pdf`, `.svg`, `.svgz`, `.ai`: a PDF carrying the native document, which reopens editable). For a native file, `compress: true` gzips it (default: the `useCompression` preference, Preferences › File Handling › Use Compression), `version` (1 to 4) writes it for an older VectorCraft (1 and 2 are never compressed, and `version: 2` with `compress: true` is an error), `preview: true` embeds a PNG of the first artboard, and `precision` (0 to 9) rounds path anchors and handles to that many decimal places for that save only (colors, transforms and type stay exact). `options` passes the format's save options as `run_command document.formats` lists them. When `compress`, `version`, `preview` or `precision` is given both at the top level and in `options` with different values, the call is an error (`` `compress: true` and `options.compress: false` disagree: give the option once ``) and nothing is written. A key in `options` that no save format takes is an error, and nothing is written (see Parameter keys). The save drops each option the written format doesn't read. The reply's `warnings` then name each such option given (for example `` `compress` was not used: SVG files don't read it `` for an `.svg` path, and `` `options.preview` was not used: … `` for a key in `options`; a `.ai` file reads `compress` but not `version`, `preview` or `precision`). For a `.ai` file, these warnings name the kind of `.ai` written: a legacy .ai (version 7) for `aiVersion: "7"`, a non-PDF-compatible .ai for `pdfCompatible: false`, and a PDF-compatible .ai otherwise, including a save that reuses the options the document was last saved with. `run_command document.save` and the other save commands refuse any option given beside the path and in `options` with different values, and give the same warnings for a top-level `compress`, `version`, `preview` or `precision` and for each key in `options` that the format doesn't read. The headless session and the app receive the same `app.save` params, and the app is also sent `wait: true`: the call returns once the file is written, or with the error (such as a path outside the write root), even with Background Save on. When the save asks first (the question before replacing a file that opened with losses, or on macOS and Linux the file dialog for an untitled document without `path`), the reply is `{pending}` or `"cancelled"` as before, and the save that runs after the answer uses the Background Save preference. Location refusals return `READ_ONLY_LOCATION: ` without a fallback panel for automation; see [Save location errors](#save-location-errors). |
| `export` | `{path?, format?, scale?, artboard?, range?, selection?, outlineText?, options?}` | `svg`, `svgz`, `pdf`, `ai` (the PDF-compatible `.ai` that Save writes, which carries the document when every artboard is written in order), `eps`, `dxf`, `emf`, `wmf`, `png`, `jpg`, `webp`, `gif`, `png8` (an indexed `.png`), `tiff`, `bmp`, `tga`, `psd` (layered), `txt` (the document's text), `vectorcraft` or `template` (a native template). The tool's `format` enum and `document.formats` list them, generated from the engine's format table. When `format` is omitted, it comes from the path's extension. PDF and `.ai` write one page per artboard: all of them, or `artboard` (0-based) / `range` (`"1-3, 5"`, 1-based). SVG and SVGZ write one file per chosen artboard. EPS writes one file of the visible art; with `artboard`, `range`, `options.artboards` or `options: {"useArtboards": true}` it writes one file per chosen artboard, after a central file of the visible art when there are two or more, and `useArtboards: false` keeps the one file. Rasters, DXF, EMF and WMF write one artboard, or one file per chosen artboard with `options: {"useArtboards": true}`. Rasters also take `options: {"rect": [x, y, width, height]}` (page points, y down): that area of the page at the given `ppi`/`scale`, without an artboard and without changing the document; it is refused with `artboard`, `artboards`, `range` or `useArtboards`, with a non-positive or non-finite size, and for non-raster formats. `options` carries more format options (e.g. `{"quality": 80}` for JPEG). `selection: true` exports the selected objects cropped to their bounds (the reply adds their `bounds`, and reports `format` and the encoder's `warnings` as a whole-document export does); `outlineText: true` writes SVG text as paths. Template layers are left out, live effects are kept, and exporting `vectorcraft` never changes the document's path. Without `path` the bytes come back as `dataBase64`. Both backends run the same `document.export` call. |
| `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` (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`; SVG export writes type on a path with any effect other than `rainbow` as outlines, with a warning); `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. |
@@ -9031,3 +9033,24 @@ Path Options' Preview does (#5360).
{"name":"run_command","arguments":{"command":"addon.type.releasePath","params":{}}}
{"name":"run_command","arguments":{"command":"addon.type.releasePath","params":{"mode":"path","keepOriginal":true}}}
```
+
+## Save location errors
+
+A save refused by the filesystem with PermissionDenied or ReadOnlyFilesystem returns
+`READ_ONLY_LOCATION: `. The reason retains the path and system message. This is a
+stable prefix within the existing error string, not a new response field or JSON-RPC code.
+An automation-root denial, an encoding failure, and an error retaining recovery copies do
+not use this code. Choose a writable destination and explicitly save there; automation never
+opens the fallback Save As panel. Failed saves keep the original document path and modified
+state; multi-file saves may already have written other output files.
+
+`app.save` with `wait: true` returns the write failure in its reply (`save_file` already asks
+for this on the desktop). Without waiting, an accepted background save still replies before
+completion; any later failure opens no panel. MCP retains its usual tool-name prefix around
+the error text. The interactive fallback applies only to ordinary File > Save, not Close/Quit.
+
+## Revision history
+
+| Date | Change |
+|---|---|
+| 2026-11-11 | Document READ_ONLY_LOCATION for saves (#6146); no response-shape change. |
diff --git a/docs/roadmap.md b/docs/roadmap.md
index 1b55740614..4f75ce5008 100644
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -1,5 +1,7 @@
# Roadmap: milestones and what's next
+> **Last updated:** 2026-11-11 · **Change:** Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending.
+
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
>
> Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369).
@@ -143,7 +145,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l
| M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 |
| M2 | Drawing tools + smart guides | ✅ mostly done (#3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 |
| M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel, Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls | 4–8 |
-| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts | 3–6 (existing scope; Affinity export unestimated) |
+| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | Save refusal continuation (#6146): ordinary Save offers Save As; cancellation/automation isolation; validation pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts | 3–6 (existing scope; Affinity export unestimated) |
| M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 |
| M6 | Path operations (Pathfinder, Shape Builder, offset…) | ✅ mostly done (live compound shapes: Make, Alt-click a Shape Mode, member modes, Release, Expand (#4522); single-result Pathfinder names and SVG IDs retained (#1293); Divide open-cutting-path geometry, appearance and history verified (#1307; existing segment cap remains); Simplify preview/counts and rewritten-path component selection verified (#1272; the slider opens at the Auto-Simplify level; a Direct Selection part of a path simplifies on its own); Compound appearance and member fill-rule edits verified (#1197); Boolean precision on almost-horizontal edges fixed and the property tests made deterministic; Shape Builder gap detection, large-offset bug open); Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog | 3–6 |
| M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof and the custom dictionary and Ignore All commands and Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, and Spelling › Auto Spell Check in the context menu of type, and the Edit Custom Dictionary dialog (#4936; the Check Spelling dialog remains); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs, OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, spell check, vertical type pending | 45–60 |
@@ -190,6 +192,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development
| Date | Change | Summary |
|---|---|---|
+| 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. |
| 2026-11-11 | minor | M10/G5: Energy Beams built-in brush library; MCP docs catch-up; estimates unchanged |
| 2026-11-11 | minor | M10/G5: Skill Icons built-in symbol library; MCP docs catch-up; estimates unchanged |
| 2026-11-10 | minor | M10/G5: Status Effects built-in graphic style library; MCP docs catch-up for UI Frames and Map Markers; estimates unchanged |
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index b4c949f742..46059e55f9 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1,5 +1,7 @@
# Parity with Adobe Illustrator
+> **Last updated:** 2026-11-11 · **Change:** Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending.
+
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged)
>
> Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369).
@@ -238,7 +240,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de
| View & navigation | 3 | 70% | multiple windows and the rest of Arrange (Cascade, Float in Window, Float All in Windows) | 9–14 | estimated; Window › Arrange › Tile and Consolidate All Windows done (score/hours unchanged); document-tab artwork hover/copy and lossless transfer tested (2026-10-22; score/hours unchanged); cached canvas reprojection preserves scale during resize, rotation and DPI changes (regression and contributor original-file evidence below; scores/hours unchanged); cached canvas dimensions match the renderer limit before cache-key creation, view construction and worker submission (regression evidence below) |
| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), no writing of Illustrator's editing data (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`; the distance from the path under Align to Path is measured from the top of each character's em box, half the height of the top of its H or the bottom of its font's bounding box (`tests_native::aligned_type_lies_as_far_from_its_path_as_the_file_lays_it_out`), and the fit under Gravity does not reproduce the file's layout), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. |
| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, textures, map art and shading in 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. |
-| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. |
+| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.| 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Save refusal continuation (#6146): `READ_ONLY_LOCATION`, Save As on ordinary UI Save only; regression execution pending; score/hours unchanged. |
| View & navigation | 3 | 70% | multiple windows and the rest of Arrange (Cascade, Float in Window, Float All in Windows) | 9–14 | estimated; Window › Arrange › Tile and Consolidate All Windows done (score/hours unchanged); document-tab artwork hover/copy and lossless transfer tested (2026-10-22; score/hours unchanged); cached canvas reprojection preserves scale during resize, rotation and DPI changes (regression and contributor original-file evidence below; scores/hours unchanged) |
| View & navigation | 3 | 70% | multiple windows and the rest of Arrange (Cascade, Float in Window, Float All in Windows) | 9–14 | estimated; Window › Arrange › Tile and Consolidate All Windows done (score/hours unchanged) |
| Guides, grids, smart guides, snapping, rulers | 3 | 80% | "intersect" smart guides for a moved selection's anchors (drawn points and dragged anchors snap to intersections, #1658), distance readouts while drawing | 4–7 | estimated (lowered from 85%: target moved); Control bar snapping quick access includes Snap to Glyph and Alignment Guides (#6164); new ruler-guide Alt orientation implemented; global/artboard ruler modes (`view.globalRulers`) and video rulers (View › Rulers › Show Video Rulers, #2849) done; status-bar X/Y uses the active ruler origin and General units; score unchanged |
@@ -551,6 +553,8 @@ since 2026-10-01.
## Evidence: what ships today, by area
+- **Save refusal (#6146):** ordinary File > Save to its own location offers Save As after a terminal permission/read-only refusal, preserving name, format and options. Cancel keeps the failed-save state. Busy pickers, recovery-copy errors, other failures, explicit destinations and Close/Quit keep the existing dialog. Engine, UI and MCP regression cases are in `cmd/fileio/tests_readonly.rs`, `io/tests_read_only_save.rs` and MCP `tests/fileio.rs`; execution and native panel acceptance pending. Scores and hours unchanged.
+
- **PDF authored replacement text (#6165):** `crates/pdf/src/tests/actual_text.rs` covers replacement once with suffix placement, PDF text-string decoding, empty and nested owners, sibling spans, page reset, multiple text-show operations, style/line changes, fill-and-stroke, reader windows and bounded input. Authored logical-order stretches are protected while adjacent ordinary text still undergoes reconstruction. The replacement takes its first placed glyph's style and line; its characters are not redistributed over later lines/styles. Exact mixed-direction paragraph layout is not claimed. No export changes; scores and hours stay at 75% / 10–20 h.
@@ -1981,6 +1985,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s
| Date | Change | Summary |
|---|---|---|
+| 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. |
| 2026-11-11 | minor | Bundled content: built-in Energy Beams brush library (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail); brush libraries evidence updated; ~44% → ~46%; more built-in brush libraries remain. |
| 2026-11-11 | minor | Bundled content: built-in Skill Icons symbol library (Attack, Defend, Heal, Buff, Ult); symbol libraries evidence updated; ~42% → ~44%; more built-in symbol libraries remain. |
| 2026-11-10 | minor | Automation: MCP tool count 33; headless `command_list` lists `UI_COMMANDS` (`ui: true`); eight prompts; effect-id vs command-id clarified (#6460); scores and hours unchanged. |
@@ -2367,4 +2372,4 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s
2026-10-28 Flare interaction: the center drag turns only the rays by one degree per document point of increasing pointer y and back at the same rate for decreasing y. This is an application rule independent of event frequency. Shift keeps the current turn; Space during either drag moves the flare without changing its size or turn, including the first drag sample. Releasing a modifier resumes from the current pointer position without catching up skipped rotation. Scores and remaining estimates unchanged.
## EPS Save evidence (2026-10-26)
-Ordinary Save and Save As keep EPS as EPS, with the chosen page frame, transparent margins and the complete editable VectorCraft document. Existing import-loss confirmation and transparency warnings remain; the Save TIFF preview is capped at 1024 pixels, while Export retains 2048. See [file-format-parity.md](file-format-parity.md#eps-save-and-source-protection) for limits and regression evidence. This narrows G9 save-back workflow coverage; native Illustrator editing-data fidelity, parity scores and hour estimates are unchanged.
\ No newline at end of file
+Ordinary Save and Save As keep EPS as EPS, with the chosen page frame, transparent margins and the complete editable VectorCraft document. Existing import-loss confirmation and transparency warnings remain; the Save TIFF preview is capped at 1024 pixels, while Export retains 2048. See [file-format-parity.md](file-format-parity.md#eps-save-and-source-protection) for limits and regression evidence. This narrows G9 save-back workflow coverage; native Illustrator editing-data fidelity, parity scores and hour estimates are unchanged.
diff --git a/docs/ui-parity.md b/docs/ui-parity.md
index 296826671f..9b654cc363 100644
--- a/docs/ui-parity.md
+++ b/docs/ui-parity.md
@@ -1,5 +1,7 @@
# UI and interaction parity
+> **Last updated:** 2026-11-11 · **Change:** Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending.
+
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (Outline view: images and gradient meshes are picked on what Outline draws, so a click inside them reaches the path behind, #6437; previously minor: a middle-click on a document tab closes it, #6506; previously minor: Blob Brush: a round tip's preview is the outline of the area it adds, round at both ends, as the stroke it commits (#4343); scores and estimates unchanged; previously:; ruler double-click adds a guide at the pointer, #5239; G5: Inventory Icons built-in symbol library (four built-ins); previously minor: files that record no units open in Preferences › Units › General, #5820; previously minor: 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; floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Layers: Rename (`ui.rename`) opens the name field of the selected layer, group or object, #5324; Properties in Edit Artboards: Transform section above the Artboards section, #5219; scrubby labels: the Control bar's Stroke: and Opacity: links and the Properties panel's Stroke link scrub their fields, #4088; Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; shape tools: a press on the selection's centre point moves it and one in the rotate zone outside a box corner turns it, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged)
>
> Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369).
@@ -363,6 +365,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
| Interaction | Status | Evidence |
|---|---|---|
+| Ordinary Save refused by filesystem permissions/read-only storage offers Save As | implemented; validation pending | #6146; `io::tests_read_only_save`; same name/format/options, Documents folder, UID-bound continuation; cancellation and automation isolation |
| Selection artwork drag hovers a visible document tab to activate it, then drops editable artwork on its canvas | done | `tests_document_drag`, `edit.dropSelection`, lossless resource and one-step Undo regressions; overflow and cross-window drag remain separate |
| A document tab dragged along the tab strip moves its document; a line marks where it goes, the current document and every document's view stay as they were, and a drag off the strip still floats it | done | #5663, [public source](https://helpx.adobe.com/illustrator/using/customizing-workspace.html); `document.move`; `tests::tab_reorder`, `chrome::tests` (drop index with floating and view tabs), `engine` `tests::document_move` |
| A middle-click on a document tab or its × closes it as the × does; closing a modified document's last view asks to save first (VectorCraft addition, as in PhotoCraft) | done | #6506; `chrome::tests::a_middle_click_on_a_tab_closes_it_as_the_close_box_does`; not scored |
@@ -511,6 +514,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development
| Date | Change | Summary |
|---|---|---|
+| 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. |
| 2026-11-11 | minor | Outline view: a click on a path's outline selects it through an image or a gradient mesh in front, which Outline draws as a frame or mesh lines (#6437). |
| 2026-11-11 | minor | A middle-click on a document tab (or its ×) closes it as the × does; closing a document's last view with unsaved changes asks to save first (#6506). VectorCraft addition; scores and estimates unchanged. |
| 2026-11-03 | minor | A double-click on a ruler adds a guide at the pointer (#5239): a vertical one on the top ruler, a horizontal one on the left ruler; scores and estimates unchanged. |
From 9a77c2ee11750528ce55d3fc5e4129423a30fc09 Mon Sep 17 00:00:00 2001
From: Ahmed Gomaa
Date: Thu, 12 Nov 2026 01:27:25 +0200
Subject: [PATCH 08/38] Save As fallback asks for a changed format's options
When the read-only fallback's Save As panel returns a different format, drop the options captured for the original format and open the picked format's normal Save options; an unchanged format keeps its options. Regenerate the file.save entry in the MCP command catalogue.
---
crates/mcp/src/ui_catalog.rs | 2 +-
crates/ui-egui/src/io/save.rs | 8 +++++++-
crates/ui-egui/src/io/tests_read_only_save.rs | 15 +++++++++++++++
docs/file-format-parity.md | 5 +++--
docs/roadmap.md | 5 +++--
docs/target-app-parity.md | 5 +++--
docs/ui-parity.md | 5 +++--
7 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs
index e15244580d..2fc406440f 100644
--- a/crates/mcp/src/ui_catalog.rs
+++ b/crates/mcp/src/ui_catalog.rs
@@ -39,7 +39,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"file.save",
"Save",
"Cmd+S",
- "{path?, format?, options?, svg?: {…SVG options}} = document.save, written through the app (a document saved as SVG, PDF or .ai, or opened from one Save can write back, saves as that again, with the same options); with no path known (never saved, converted) the Save As panel asks first",
+ "{path?, format?, options?, svg?: {…SVG options}} = document.save, written through the app (a document saved as SVG, PDF or .ai, or opened from one Save can write back, saves as that again, with the same options); with no path known (never saved, converted) the Save As panel asks first; ordinary Save to the document's existing file refused by filesystem permissions or a read-only volume opens Save As in Documents with the same name, format and options; cancelling keeps the original path and modified state. Explicit destinations and Close/Quit keep their existing error dialog. Automation gets READ_ONLY_LOCATION: followed by the reason and no panel",
),
(
"file.place",
diff --git a/crates/ui-egui/src/io/save.rs b/crates/ui-egui/src/io/save.rs
index 5efe776d64..03a03b4c3a 100644
--- a/crates/ui-egui/src/io/save.rs
+++ b/crates/ui-egui/src/io/save.rs
@@ -315,17 +315,23 @@ pub(super) fn save_suggesting(
filters,
};
let picked = pick_finished(app, &pick, |picked, file_type| with_picked_type(picked, &pick.name, file_type, first.format, mode))?;
+ // Only the read-only retry carries options for the original format through Save As.
+ // A different format must use its own normal options flow instead.
+ let changed_retry_format = suggestion.is_some() && fileio::format_for_name(&picked).is_some_and(|f| f.id != first.format.id);
// The picked file type wins over a `format` param.
let mut q = if p.is_object() { p.clone() } else { json!({}) };
if let Some(o) = q.as_object_mut() {
o.remove("format");
+ if changed_retry_format {
+ o.remove("options");
+ }
o.insert("path".into(), json!(picked));
}
let chosen = plan(app, mode, &acknowledged(&q))?;
if let Some(r) = chosen.path.as_deref().and_then(|path| ask_before_losing(app, path, save_command(mode), &q)) {
return Ok(r);
}
- if ask && asks_options(mode, chosen.format) {
+ if (ask || changed_retry_format) && asks_options(mode, chosen.format) {
let path = chosen.path.clone().unwrap_or_default();
let r = ask_format_options(app, mode, chosen.format, &path);
crate::dialogs::opened_by_panel(app);
diff --git a/crates/ui-egui/src/io/tests_read_only_save.rs b/crates/ui-egui/src/io/tests_read_only_save.rs
index 8a01003a90..6568a7e281 100644
--- a/crates/ui-egui/src/io/tests_read_only_save.rs
+++ b/crates/ui-egui/src/io/tests_read_only_save.rs
@@ -264,3 +264,18 @@ fn readonly_busy_picker_and_save_changes_keep_the_existing_error_flow() {
assert_eq!(app.session.documents().len(), 1);
assert!(app.session.doc().unwrap().is_dirty());
}
+
+#[test]
+fn readonly_changed_format_asks_for_its_options_before_writing() {
+ let (mut app, files) = app("svg", ErrorKind::PermissionDenied);
+ let before = state(&app);
+ let (shown, _) = off_the_ui_thread(&mut app.services);
+ assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "fileDialog");
+ shown.answer(&["/elsewhere/Poster.pdf"]);
+ poll(&mut app);
+ let dialog = app.ui.dialog.as_ref().expect("the picked format's Save dialog");
+ assert_eq!(dialog.kind, "savePdf");
+ assert_eq!(dialog.str("path"), "/elsewhere/Poster.pdf");
+ assert_eq!(state(&app), before);
+ assert_eq!(files.lock().unwrap().attempts, ["/locked/Poster.svg"]);
+}
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index c83419fe64..f8261eef13 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,6 +1,6 @@
# File format parity
-> **Last updated:** 2026-11-11 · **Change:** Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending.
+> **Last updated:** 2026-11-12 · **Change:** Save refusal follow-up (#6146): changing format in fallback Save As opens that format’s options; unchanged format keeps the original options. Focused UI regressions passed; native panel acceptance pending; scores and estimates unchanged.
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (`.ai` and EPS import: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as the file's page aligns them, #6610; `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art, #6570; `.ai` save and open: layer colour presets Yellow, Magenta and Cyan keep their colour, as the `Lb` colour index now follows the file's numbering, #6502; `.ai` save: stroked type keeps its stroke's cap, join and miter limit in the text document, #6472; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x)
@@ -17,7 +17,7 @@ from the public specifications, and users' own `.ai` files are used locally only
## Summary
-Ordinary File > Save offers Save As when its own location refuses writes with a terminal permission/read-only error (#6146). The picker keeps the filename, format and options and starts in Documents (home or host default if unavailable). Cancel leaves the document modified at its original path. Explicit Save As/Copy/export, recovery failures and Close/Quit keep their existing error dialog. Non-UI saves return `READ_ONLY_LOCATION: ` without opening a panel. Regression execution and native panel acceptance pending; format scores unchanged.
+Ordinary File > Save offers Save As when its own location refuses writes with a terminal permission/read-only error (#6146). The picker suggests the original filename and format, keeps the original options when the format is unchanged, and opens the chosen format’s Save options when it changes. It starts in Documents (home or host default if unavailable). Cancel leaves the document modified at its original path. Explicit Save As/Copy/export, recovery failures and Close/Quit keep their existing error dialog. Non-UI saves return `READ_ONLY_LOCATION: ` without opening a panel. Focused UI regressions passed; engine regression execution and native panel acceptance pending; format scores unchanged.
| | Illustrator | VectorCraft | Notes |
|---|---:|---:|---|
@@ -343,6 +343,7 @@ Stop opacity on translated artboards remains outside this regression coverage.
| Date | Change | Summary |
|---|---|---|
+| 2026-11-12 | minor | Save refusal follow-up (#6146): changed format opens its Save options; unchanged format retains original options. Focused UI regressions passed, including the format-change case that failed before the fix; native panel acceptance pending. Scores and estimates unchanged. |
| 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. |
| 2026-11-11 | minor | `.ai` and EPS import, and what SVG export, PDF export and `.ai` save draw: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as a `.ai`'s own page aligns them (see type-parity.md, same date). In 224 users' files (used locally, never committed), 63 render differently: 54 closer to the page, 7 further, 1 alike and 1 that couldn't be compared; among them the median share of pixels that differ from the page went from 4.4% to 1.0%. Of the 7: one now opens from its layers instead of its PDF part (they differ from the page by less than the import's 5% limit now; type note 3.8%); one has a centred line whose spacing inside it differs from the page's, which now centres on the page's line while half of it no longer lies on the page's glyphs (type note 1.4% to 2.4%); five moved by less than 0.05 of a percentage point, in type the page draws in other glyphs. The type note shows a smaller share in 6 files; 2 more envelopes of type open live (129 to 131, none fewer in any file). SVG import: `text-anchor` aligns a line's advance, which ends after its last character's letter spacing, so a centred or right-aligned letter-spaced line moves back by half or all of it and stays where a reader draws it; SVG export, which anchors lines so, reads back unchanged (test `import_text::anchored_letter_spaced_lines_stay_where_a_reader_draws_them`). Affinity import: centred or right-aligned tracked artistic text moves by half or all of its last character's tracking, as layout now aligns it (unverified against Affinity, whose files we don't have), and differently aligned paragraphs line up by the widths layout aligns them by (`affinity_features::artistic_text_aligns_its_lines_within_the_longest`). Scores and estimates unchanged. (#6610) |
| 2026-11-11 | minor | `.ai` and EPS import: while an envelope's contents are edited, the editing data keeps its mesh (a mesh's, a top object's or a warp's grid) in its dictionary, and in some files that mesh lies away from the drawn art by a move, the contents with the drawn art, as if the mesh hadn't followed the envelope when it moved: the envelope drew its contents elsewhere and kept its drawn art. A mesh or top object saved in Edit Contents (or a warp of type tried on its saved grid) whose mesh draws the contents as large as the drawn art, within half a point over width and height together, but further from it than that, is now tried again, after every other way and with one more of the import's checks, with its mesh moved by as far as the drawn art's box lies from the box of what it draws; it opens live there where it then draws as the drawn art. In users' files, used locally and never committed, only envelopes saved in Edit Contents draw elsewhere than their drawn art, and nothing in their dictionaries says by how much they moved. Tests `ai::tests::an_envelope_in_edit_contents_whose_mesh_stayed_behind_opens_live_on_its_drawn_art`, `tests_native::a_warp_of_type_in_edit_contents_whose_grid_stayed_behind_opens_on_its_drawn_art` (#6570) |
diff --git a/docs/roadmap.md b/docs/roadmap.md
index 4f75ce5008..67a5a17a1a 100644
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -1,6 +1,6 @@
# Roadmap: milestones and what's next
-> **Last updated:** 2026-11-11 · **Change:** Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending.
+> **Last updated:** 2026-11-12 · **Change:** Save refusal follow-up (#6146): changing format in fallback Save As opens that format’s options; unchanged format keeps the original options. Focused UI regressions passed; native panel acceptance pending; scores and estimates unchanged.
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
>
@@ -145,7 +145,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l
| M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 |
| M2 | Drawing tools + smart guides | ✅ mostly done (#3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 |
| M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel, Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls | 4–8 |
-| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | Save refusal continuation (#6146): ordinary Save offers Save As; cancellation/automation isolation; validation pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts | 3–6 (existing scope; Affinity export unestimated) |
+| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts | 3–6 (existing scope; Affinity export unestimated) |
| M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 |
| M6 | Path operations (Pathfinder, Shape Builder, offset…) | ✅ mostly done (live compound shapes: Make, Alt-click a Shape Mode, member modes, Release, Expand (#4522); single-result Pathfinder names and SVG IDs retained (#1293); Divide open-cutting-path geometry, appearance and history verified (#1307; existing segment cap remains); Simplify preview/counts and rewritten-path component selection verified (#1272; the slider opens at the Auto-Simplify level; a Direct Selection part of a path simplifies on its own); Compound appearance and member fill-rule edits verified (#1197); Boolean precision on almost-horizontal edges fixed and the property tests made deterministic; Shape Builder gap detection, large-offset bug open); Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog | 3–6 |
| M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof and the custom dictionary and Ignore All commands and Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, and Spelling › Auto Spell Check in the context menu of type, and the Edit Custom Dictionary dialog (#4936; the Check Spelling dialog remains); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs, OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, spell check, vertical type pending | 45–60 |
@@ -192,6 +192,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development
| Date | Change | Summary |
|---|---|---|
+| 2026-11-12 | minor | Save refusal follow-up (#6146): changed format opens its Save options; unchanged format retains original options. Focused UI regressions passed, including the format-change case that failed before the fix; native panel acceptance pending. Scores and estimates unchanged. |
| 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. |
| 2026-11-11 | minor | M10/G5: Energy Beams built-in brush library; MCP docs catch-up; estimates unchanged |
| 2026-11-11 | minor | M10/G5: Skill Icons built-in symbol library; MCP docs catch-up; estimates unchanged |
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index 46059e55f9..fb42bb6a8c 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1,6 +1,6 @@
# Parity with Adobe Illustrator
-> **Last updated:** 2026-11-11 · **Change:** Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending.
+> **Last updated:** 2026-11-12 · **Change:** Save refusal follow-up (#6146): changing format in fallback Save As opens that format’s options; unchanged format keeps the original options. Focused UI regressions passed; native panel acceptance pending; scores and estimates unchanged.
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged)
>
@@ -553,7 +553,7 @@ since 2026-10-01.
## Evidence: what ships today, by area
-- **Save refusal (#6146):** ordinary File > Save to its own location offers Save As after a terminal permission/read-only refusal, preserving name, format and options. Cancel keeps the failed-save state. Busy pickers, recovery-copy errors, other failures, explicit destinations and Close/Quit keep the existing dialog. Engine, UI and MCP regression cases are in `cmd/fileio/tests_readonly.rs`, `io/tests_read_only_save.rs` and MCP `tests/fileio.rs`; execution and native panel acceptance pending. Scores and hours unchanged.
+- **Save refusal (#6146):** ordinary File > Save to its own location offers Save As after a terminal permission/read-only refusal, suggesting the original name and format, preserving options for the unchanged format and opening the chosen format’s Save options on a change. Cancel keeps the failed-save state. Busy pickers, recovery-copy errors, other failures, explicit destinations and Close/Quit keep the existing dialog. Engine, UI and MCP regression cases are in `cmd/fileio/tests_readonly.rs`, `io/tests_read_only_save.rs` and MCP `tests/fileio.rs`; focused UI regressions passed; engine regression execution and native panel acceptance pending. Scores and hours unchanged.
- **PDF authored replacement text (#6165):** `crates/pdf/src/tests/actual_text.rs` covers replacement once with suffix placement, PDF text-string decoding, empty and nested owners, sibling spans, page reset, multiple text-show operations, style/line changes, fill-and-stroke, reader windows and bounded input. Authored logical-order stretches are protected while adjacent ordinary text still undergoes reconstruction. The replacement takes its first placed glyph's style and line; its characters are not redistributed over later lines/styles. Exact mixed-direction paragraph layout is not claimed. No export changes; scores and hours stay at 75% / 10–20 h.
@@ -1985,6 +1985,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s
| Date | Change | Summary |
|---|---|---|
+| 2026-11-12 | minor | Save refusal follow-up (#6146): changed format opens its Save options; unchanged format retains original options. Focused UI regressions passed, including the format-change case that failed before the fix; native panel acceptance pending. Scores and estimates unchanged. |
| 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. |
| 2026-11-11 | minor | Bundled content: built-in Energy Beams brush library (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail); brush libraries evidence updated; ~44% → ~46%; more built-in brush libraries remain. |
| 2026-11-11 | minor | Bundled content: built-in Skill Icons symbol library (Attack, Defend, Heal, Buff, Ult); symbol libraries evidence updated; ~42% → ~44%; more built-in symbol libraries remain. |
diff --git a/docs/ui-parity.md b/docs/ui-parity.md
index 9b654cc363..dc580549cb 100644
--- a/docs/ui-parity.md
+++ b/docs/ui-parity.md
@@ -1,6 +1,6 @@
# UI and interaction parity
-> **Last updated:** 2026-11-11 · **Change:** Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending.
+> **Last updated:** 2026-11-12 · **Change:** Save refusal follow-up (#6146): changing format in fallback Save As opens that format’s options; unchanged format keeps the original options. Focused UI regressions passed; native panel acceptance pending; scores and estimates unchanged.
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (Outline view: images and gradient meshes are picked on what Outline draws, so a click inside them reaches the path behind, #6437; previously minor: a middle-click on a document tab closes it, #6506; previously minor: Blob Brush: a round tip's preview is the outline of the area it adds, round at both ends, as the stroke it commits (#4343); scores and estimates unchanged; previously:; ruler double-click adds a guide at the pointer, #5239; G5: Inventory Icons built-in symbol library (four built-ins); previously minor: files that record no units open in Preferences › Units › General, #5820; previously minor: 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; floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Layers: Rename (`ui.rename`) opens the name field of the selected layer, group or object, #5324; Properties in Edit Artboards: Transform section above the Artboards section, #5219; scrubby labels: the Control bar's Stroke: and Opacity: links and the Properties panel's Stroke link scrub their fields, #4088; Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; shape tools: a press on the selection's centre point moves it and one in the rotate zone outside a box corner turns it, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged)
>
@@ -365,7 +365,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
| Interaction | Status | Evidence |
|---|---|---|
-| Ordinary Save refused by filesystem permissions/read-only storage offers Save As | implemented; validation pending | #6146; `io::tests_read_only_save`; same name/format/options, Documents folder, UID-bound continuation; cancellation and automation isolation |
+| Ordinary Save refused by filesystem permissions/read-only storage offers Save As | focused UI regressions passed; native acceptance pending | #6146; `io::tests_read_only_save`; same name/format suggested; unchanged format keeps options, changed format opens its Save options; Documents folder, UID-bound continuation; cancellation and automation isolation |
| Selection artwork drag hovers a visible document tab to activate it, then drops editable artwork on its canvas | done | `tests_document_drag`, `edit.dropSelection`, lossless resource and one-step Undo regressions; overflow and cross-window drag remain separate |
| A document tab dragged along the tab strip moves its document; a line marks where it goes, the current document and every document's view stay as they were, and a drag off the strip still floats it | done | #5663, [public source](https://helpx.adobe.com/illustrator/using/customizing-workspace.html); `document.move`; `tests::tab_reorder`, `chrome::tests` (drop index with floating and view tabs), `engine` `tests::document_move` |
| A middle-click on a document tab or its × closes it as the × does; closing a modified document's last view asks to save first (VectorCraft addition, as in PhotoCraft) | done | #6506; `chrome::tests::a_middle_click_on_a_tab_closes_it_as_the_close_box_does`; not scored |
@@ -514,6 +514,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development
| Date | Change | Summary |
|---|---|---|
+| 2026-11-12 | minor | Save refusal follow-up (#6146): changed format opens its Save options; unchanged format retains original options. Focused UI regressions passed, including the format-change case that failed before the fix; native panel acceptance pending. Scores and estimates unchanged. |
| 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. |
| 2026-11-11 | minor | Outline view: a click on a path's outline selects it through an image or a gradient mesh in front, which Outline draws as a frame or mesh lines (#6437). |
| 2026-11-11 | minor | A middle-click on a document tab (or its ×) closes it as the × does; closing a document's last view with unsaved changes asks to save first (#6506). VectorCraft addition; scores and estimates unchanged. |
From e05f40d7f8c8023408b96a5166e22025352524f6 Mon Sep 17 00:00:00 2001
From: dotCooCoo
Date: Wed, 11 Nov 2026 14:41:24 -0800
Subject: [PATCH 09/38] Type: Center on Top and Center on Bottom for type on a
closed path
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Type › Type on a Path › Center on Top and Center on Bottom
(type.pathCenter.top and type.pathCenter.bottom, also on the Contextual
Task Bar for type on a closed path) slide the type along its path so that
the middle of the span between its brackets lands on the path's topmost or
bottommost point as the object is drawn, after its transform. On a level
stretch, such as a rectangle's top edge, the middle of the stretch is used.
The span keeps its length, and the first paragraph is set to Center unless
it is Center or Justify Center. The type is not flipped. Type on an open or
compound path, type in a thread, and type on a path with no length or no
height are refused with an error that names them. When the type is already
centered there, no undo step is recorded. This is VectorCraft's own
behavior.
Docs: docs/mcp.md, docs/target-app-parity.md.
---
crates/engine/src/cmd/plugin_call/reviewed.rs | 2 +
crates/engine/src/cmd/typemenu.rs | 148 +++++++++++++++
crates/engine/src/tests/pathtype.rs | 178 ++++++++++++++++++
crates/geom/src/arc.rs | 134 ++++++++++++-
crates/ui-egui/src/canvas/task_bar.rs | 13 ++
crates/ui-egui/src/i18n/bg.tsv | 2 +
crates/ui-egui/src/i18n/bs.tsv | 2 +
crates/ui-egui/src/i18n/ca.tsv | 6 +
crates/ui-egui/src/i18n/cs.tsv | 6 +
crates/ui-egui/src/i18n/da.tsv | 2 +
crates/ui-egui/src/i18n/de.tsv | 6 +
crates/ui-egui/src/i18n/el.tsv | 6 +
crates/ui-egui/src/i18n/es.tsv | 6 +
crates/ui-egui/src/i18n/fi.tsv | 6 +
crates/ui-egui/src/i18n/fr.tsv | 6 +
crates/ui-egui/src/i18n/hi.tsv | 6 +
crates/ui-egui/src/i18n/hu.tsv | 6 +
crates/ui-egui/src/i18n/id.tsv | 2 +
crates/ui-egui/src/i18n/it.tsv | 6 +
crates/ui-egui/src/i18n/ja.tsv | 6 +
crates/ui-egui/src/i18n/ka.tsv | 6 +
crates/ui-egui/src/i18n/ko.tsv | 6 +
crates/ui-egui/src/i18n/nl.tsv | 2 +
crates/ui-egui/src/i18n/pl.tsv | 6 +
crates/ui-egui/src/i18n/pt-br.tsv | 6 +
crates/ui-egui/src/i18n/ru.tsv | 6 +
crates/ui-egui/src/i18n/sv.tsv | 6 +
crates/ui-egui/src/i18n/tr.tsv | 6 +
crates/ui-egui/src/i18n/uk.tsv | 6 +
crates/ui-egui/src/i18n/vi.tsv | 6 +
crates/ui-egui/src/i18n/zh-hans.tsv | 6 +
crates/ui-egui/src/i18n/zh-hant.tsv | 6 +
crates/ui-egui/src/menus/tests.rs | 52 +++++
crates/ui-egui/src/menus/tree.rs | 8 +-
crates/ui-egui/src/tests/taskbar.rs | 28 +++
docs/mcp.md | 20 ++
docs/target-app-parity.md | 1 +
37 files changed, 724 insertions(+), 2 deletions(-)
diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs
index 541389bb89..07ff0ded2e 100644
--- a/crates/engine/src/cmd/plugin_call/reviewed.rs
+++ b/crates/engine/src/cmd/plugin_call/reviewed.rs
@@ -638,6 +638,8 @@ pub(super) const ALLOWED: &[&str] = &[
"type.opticalMarginAlignment",
"type.orientation.horizontal",
"type.orientation.vertical",
+ "type.pathCenter.bottom",
+ "type.pathCenter.top",
"type.pathOptions",
"type.resetHorizontalScale",
"type.resetTracking",
diff --git a/crates/engine/src/cmd/typemenu.rs b/crates/engine/src/cmd/typemenu.rs
index deaac8acc4..e9fd191676 100644
--- a/crates/engine/src/cmd/typemenu.rs
+++ b/crates/engine/src/cmd/typemenu.rs
@@ -60,6 +60,24 @@ pub fn specs() -> Vec {
has_selection,
path_options
),
+ cmd!(
+ "type.pathCenter.top",
+ "Center on Top",
+ ["Type", "Type on a Path"],
+ None,
+ "{ids?|id?} slide the selected type on a closed path along it so that the middle of the span between its start and end brackets lands on the path's topmost point as the object is drawn (after its transform, so a rotated, scaled or skewed path is measured as it appears; on a level stretch such as a rectangle's top edge, its middle; with several separate topmost points, the middle of the shortest part of the path that holds them all), keeping the span's length (a full turn stays a full turn), and set the first paragraph's alignment to Center unless it is Center or Justify Center, so the type is centered there. Point type and area type in the selection are left as they are. Type on an open or compound path, type in a thread, and type on a path with no length or no height are refused with an error that names them, and nothing changes. When every object is already centered there, nothing changes and no undo step is recorded → {ids, start, end} (the first object's brackets)",
+ has_closed_path_type,
+ path_center_top
+ ),
+ cmd!(
+ "type.pathCenter.bottom",
+ "Center on Bottom",
+ ["Type", "Type on a Path"],
+ None,
+ "{ids?|id?} as type.pathCenter.top, on the path's bottommost point as drawn. The type is not flipped: on the bottom of a path that runs clockwise it reads upside down until Type on a Path Options › Flip turns it → {ids, start, end} (the first object's brackets)",
+ has_closed_path_type,
+ path_center_bottom
+ ),
cmd!(
"type.dynamicText",
"Dynamic Text",
@@ -410,6 +428,136 @@ fn to_point(s: &mut Session, p: &Value) -> Result {
Ok(ids_json(&ids))
}
+/// Whether type on a path `t` runs along one closed path (no open or compound path).
+fn on_one_closed_path(t: &TextObject) -> bool {
+ matches!(&t.kind, TextKind::OnPath { path, .. } if path.subpaths.len() == 1 && path.is_closed())
+}
+
+/// Why `type.pathCenter.top` and `.bottom` refuse type on a path `ids`: those on an open or
+/// compound path, then those in a thread; None when they take every one.
+fn path_center_refusal(d: &Document, ids: &[NodeId]) -> Option {
+ let open = ids.iter().filter(|id| !path_text(d.node(**id)).is_some_and(on_one_closed_path)).map(|id| id.0.to_string()).collect::>();
+ if !open.is_empty() {
+ let open = open.join(", ");
+ return Some(format!("type on an open or compound path cannot be centered on its top or bottom: {open}"));
+ }
+ let frames = threaded_ids(d, ids);
+ (!frames.is_empty()).then(|| format!("type on a path in a thread cannot be centered on its top or bottom: {frames}"))
+}
+
+/// `type.pathCenter.top` and `.bottom` are enabled for a selection holding type on a path, all of
+/// it on one closed path and none of it in a thread.
+fn has_closed_path_type(s: &Session) -> std::result::Result<(), String> {
+ has_selection(s)?;
+ let st = s.active().ok_or("no document open")?;
+ let d = &st.doc;
+ let selected: Vec = st.selection.objects.to_vec();
+ let paths: Vec = text_ids(d, &selected).into_iter().filter(|id| path_text(d.node(*id)).is_some()).collect();
+ if paths.is_empty() {
+ return Err("select type on a closed path".into());
+ }
+ path_center_refusal(d, &paths).map_or(Ok(()), Err)
+}
+
+/// The brackets that center type on a path `t` on its path's topmost point (`bottom`: its
+/// bottommost) as `t.xf` draws it, its span keeping its length; None for a path with no length or
+/// no height.
+fn centered_brackets(t: &TextObject, bottom: bool) -> Option<(f64, Option)> {
+ let TextKind::OnPath { path, end, .. } = &t.kind else { return None };
+ let (from, to) = t.kind.path_span()?;
+ let arc = vectorcraft_geom::ArcPath::new(path);
+ if arc.is_empty() {
+ return None;
+ }
+ let flip = if bottom { Affine::FLIP_Y } else { Affine::IDENTITY };
+ let middle = arc.topmost(flip * t.xf)? / arc.len();
+ let run = to - from;
+ let start = (middle - run * 0.5).rem_euclid(1.0).clamp(0.0, 1.0);
+ // Without an end bracket the type runs once round; a full turn's end stays on its start.
+ let end = end.map(|_| if run >= 1.0 - 1e-12 { start } else { (start + run).rem_euclid(1.0).clamp(0.0, 1.0) });
+ Some((start, end))
+}
+
+/// Whether brackets `a` and `b`, fractions of a closed path's length, are at one place within
+/// rounding (0 and 1 are one place).
+fn same_bracket(a: f64, b: f64) -> bool {
+ let d = (a - b).rem_euclid(1.0);
+ d.min(1.0 - d) <= 1e-9
+}
+
+fn path_center_top(s: &mut Session, p: &Value) -> Result {
+ path_center(s, p, false)
+}
+
+fn path_center_bottom(s: &mut Session, p: &Value) -> Result {
+ path_center(s, p, true)
+}
+
+/// Type › Type on a Path › Center on Top and Center on Bottom: slide the selected type on closed
+/// paths along them so the middle of each span lands on the path's top (`bottom`: its bottom) as
+/// drawn, and center the first paragraph, in one undo step; none when nothing changes.
+fn path_center(s: &mut Session, p: &Value, bottom: bool) -> Result {
+ let c = if bottom { "type.pathCenter.bottom" } else { "type.pathCenter.top" };
+ let centered = |j: Justify| matches!(j, Justify::Center | Justify::JustifyCenter);
+ // Each object the command changes, with its new brackets when they move and whether its first
+ // paragraph is set to Center.
+ let (ids, changes) = {
+ let d = &s.doc()?.doc;
+ let ids: Vec = texts(s, p, c)?.into_iter().filter(|i| path_text(d.node(*i)).is_some()).collect();
+ if ids.is_empty() {
+ return Err(bad(c, "select type on a closed path"));
+ }
+ if let Some(why) = path_center_refusal(d, &ids) {
+ return Err(bad(c, why));
+ }
+ let (mut changes, mut flat) = (vec![], vec![]);
+ for id in &ids {
+ let Some(t) = path_text(d.node(*id)) else { continue };
+ let TextKind::OnPath { start, end, .. } = &t.kind else { continue };
+ let Some((to_start, to_end)) = centered_brackets(t, bottom) else {
+ flat.push(id.0.to_string());
+ continue;
+ };
+ let stays = same_bracket(*start, to_start)
+ && match (end, to_end) {
+ (None, None) => true,
+ (Some(a), Some(b)) => same_bracket(*a, b),
+ _ => false,
+ };
+ let align = !centered(t.para_at(0).justify);
+ if !stays || align {
+ changes.push((*id, (!stays).then_some((to_start, to_end)), align));
+ }
+ }
+ if !flat.is_empty() {
+ let flat = flat.join(", ");
+ return Err(bad(c, format!("type on a path with no length or no height cannot be centered: {flat}")));
+ }
+ (ids, changes)
+ };
+ if !changes.is_empty() {
+ s.edit(if bottom { "Center on Bottom" } else { "Center on Top" }, |d, _| {
+ for (id, brackets, align) in &changes {
+ let Some(NodeKind::Text(t)) = d.node_mut(*id).map(|n| &mut n.kind) else { continue };
+ if let (Some(b), TextKind::OnPath { start, end, .. }) = (brackets, &mut t.kind) {
+ (*start, *end) = *b;
+ }
+ if *align {
+ t.edit_paras(Some(0..1), |para| para.justify = Justify::Center);
+ }
+ refresh_bounds(t);
+ }
+ Ok(())
+ })?;
+ }
+ let d = &s.doc()?.doc;
+ let (start, end) = ids.first().and_then(|id| path_text(d.node(*id))).map_or((0.0, None), |t| match &t.kind {
+ TextKind::OnPath { start, end, .. } => (*start, *end),
+ _ => (0.0, None),
+ });
+ Ok(json!({"ids": ids.iter().map(|i| i.0).collect::>(), "start": start, "end": end}))
+}
+
/// The options `type.pathOptions` sets; with none of them given it queries.
const PATH_OPTIONS: [&str; 6] = ["start", "end", "flip", "effect", "alignToPath", "spacing"];
diff --git a/crates/engine/src/tests/pathtype.rs b/crates/engine/src/tests/pathtype.rs
index 5ead0cbd22..8aa8c05684 100644
--- a/crates/engine/src/tests/pathtype.rs
+++ b/crates/engine/src/tests/pathtype.rs
@@ -184,6 +184,184 @@ fn a_flip_round_a_closed_path_keeps_the_type_in_place() {
assert!(origins(&s, id)[0].distance(first) < 8.0);
}
+/// A circle of radius 100 round (200, 200), starting at 9 o'clock and running clockwise, with
+/// type on it from its start.
+fn on_circle(s: &mut Session, text: &str) -> NodeId {
+ path_type(s, "M100 200 A100 100 0 1 1 300 200 A100 100 0 1 1 100 200 Z", [90.0, 200.0], text)
+}
+
+#[test]
+fn center_on_top_and_bottom_of_a_circle() {
+ let mut s = session();
+ let id = on_circle(&mut s, "OOOO");
+ assert!(near(brackets(&s, id).0, 0.0), "{:?}", brackets(&s, id));
+ let steps = undo_len(&s);
+ let r = s.execute("type.pathCenter.top", &json!({})).unwrap();
+ // Once round, its middle at 12 o'clock, a quarter of the way round: the type sits on the top, centered.
+ let (start, end) = brackets(&s, id);
+ assert!(near(start, 0.75) && end.is_none(), "{start} {end:?}");
+ assert_eq!((r["ids"].clone(), r["end"].clone()), (json!([id.0]), Value::Null));
+ assert_eq!(text(&s, id).para_at(0).justify, vectorcraft_doc::Justify::Center);
+ let top = ink(&s, id);
+ assert!((top.center().x - 200.0).abs() < 0.5 && top.y1 < 101.0, "{top:?}");
+ assert_eq!((undo_len(&s), last_step(&s)), (steps + 1, "Center on Top".to_string()));
+ // Again: nothing moves, and no undo step is recorded.
+ s.execute("type.pathCenter.top", &json!({})).unwrap();
+ assert_eq!(undo_len(&s), steps + 1);
+ // The bottom: 6 o'clock, outside the circle (the type is not flipped).
+ s.execute("type.pathCenter.bottom", &json!({})).unwrap();
+ let (start, end) = brackets(&s, id);
+ assert!(near(start, 0.25) && end.is_none(), "{start} {end:?}");
+ let bottom = ink(&s, id);
+ assert!((bottom.center().x - 200.0).abs() < 0.5 && bottom.y0 > 299.0, "{bottom:?}");
+ assert_eq!((undo_len(&s), last_step(&s)), (steps + 2, "Center on Bottom".to_string()));
+ // Justify Center stays as it is.
+ s.execute("text.setStyle", &json!({"justify": "justifyCenter"})).unwrap();
+ s.execute("type.pathCenter.top", &json!({})).unwrap();
+ assert_eq!(text(&s, id).para_at(0).justify, vectorcraft_doc::Justify::JustifyCenter);
+ s.execute("edit.undo", &json!({})).unwrap();
+ assert!(near(brackets(&s, id).0, 0.25));
+ // Brackets already in place with another alignment: only the alignment changes, in one step.
+ s.execute("text.setStyle", &json!({"justify": "left"})).unwrap();
+ let (steps, before) = (undo_len(&s), brackets(&s, id));
+ s.execute("type.pathCenter.bottom", &json!({})).unwrap();
+ assert_eq!((undo_len(&s), brackets(&s, id)), (steps + 1, before));
+ assert_eq!(text(&s, id).para_at(0).justify, vectorcraft_doc::Justify::Center);
+}
+
+#[test]
+fn center_on_top_twice_records_one_step_for_any_span() {
+ let mut s = session();
+ let id = on_circle(&mut s, "OOOO");
+ for (start, end) in [(0.0, 0.2), (0.13, 0.41), (0.37, 0.52), (0.61, 0.97), (0.89, 0.07), (0.3, 0.3001)] {
+ s.execute("type.pathOptions", &json!({"start": start, "end": end})).unwrap();
+ for c in ["type.pathCenter.top", "type.pathCenter.bottom"] {
+ s.execute(c, &json!({})).unwrap();
+ let (steps, placed) = (undo_len(&s), brackets(&s, id));
+ // Again: the brackets stay exactly where they are, and no undo step is recorded.
+ s.execute(c, &json!({})).unwrap();
+ assert_eq!((undo_len(&s), brackets(&s, id)), (steps, placed), "{c} {start} {end}");
+ }
+ }
+}
+
+#[test]
+fn center_on_top_keeps_the_span_and_measures_the_path_as_drawn() {
+ let mut s = session();
+ let id = on_circle(&mut s, "OOOO");
+ // A span of a fifth of the path keeps its length.
+ s.execute("type.pathOptions", &json!({"end": 0.2})).unwrap();
+ s.execute("type.pathCenter.top", &json!({})).unwrap();
+ let (start, end) = brackets(&s, id);
+ assert!(near(start, 0.15) && end.is_some_and(|e| near(e, 0.35)), "{start} {end:?}");
+ // Turned a quarter turn counter-clockwise, its 3 o'clock point, halfway round, is at the top.
+ s.execute("type.pathOptions", &json!({"start": 0, "end": null})).unwrap();
+ s.execute("object.rotate", &json!({"angle": 90})).unwrap();
+ s.execute("type.pathCenter.top", &json!({})).unwrap();
+ let (start, _) = brackets(&s, id);
+ assert!(near(start.rem_euclid(1.0), 0.0) || near(start, 1.0), "{start}");
+ let bounds = text(&s, id).bounds().unwrap();
+ let top = ink(&s, id);
+ assert!((top.center().x - bounds.center().x).abs() < 0.5 && top.y1 < bounds.y0 + 1.0, "{top:?} {bounds:?}");
+ // A rectangle: the middle of its top edge.
+ let id = path_type(&mut s, "M100 100 L300 100 L300 300 L100 300 Z", [90.0, 100.0], "OOOO");
+ s.execute("type.pathCenter.top", &json!({})).unwrap();
+ let (start, end) = brackets(&s, id);
+ assert!(near(start, 0.625) && end.is_none(), "{start} {end:?}");
+ assert!((ink(&s, id).center().x - 200.0).abs() < 0.5);
+}
+
+#[test]
+fn center_on_top_moves_every_selected_type_on_a_path_in_one_step() {
+ let mut s = session();
+ let a = on_circle(&mut s, "OOOO");
+ let b = path_type(&mut s, "M100 100 L300 100 L300 300 L100 300 Z", [90.0, 100.0], "OOOO");
+ let p = s.execute("text.create", &json!({"x": 40, "y": 40, "text": "Point"})).unwrap()["id"].as_u64().unwrap();
+ s.execute("select.set", &json!({"ids": [a.0, b.0, p]})).unwrap();
+ let steps = undo_len(&s);
+ let r = s.execute("type.pathCenter.top", &json!({})).unwrap();
+ assert_eq!(r["ids"], json!([a.0, b.0]));
+ assert!(near(brackets(&s, a).0, 0.75) && near(brackets(&s, b).0, 0.625));
+ assert_eq!(undo_len(&s), steps + 1);
+ // Dynamic Text stays on, and the layout fits the text to the span where it now runs: a fifth of
+ // the circle, at its bottom.
+ s.execute("select.set", &json!({"ids": [a.0]})).unwrap();
+ s.execute("type.pathOptions", &json!({"start": 0, "end": 0.2})).unwrap();
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ s.execute("type.pathCenter.bottom", &json!({})).unwrap();
+ assert!(text(&s, a).dynamic_text && near(brackets(&s, a).0, 0.65), "{:?}", brackets(&s, a));
+ let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &text(&s, a));
+ assert!(lay.fit_scale > 1.5 && !lay.overflow, "{}", lay.fit_scale);
+ let bottom = ink(&s, a);
+ assert!((bottom.center().x - 200.0).abs() < 1.0 && bottom.y1 > 300.0, "{bottom:?}");
+ // Vertical type on a path moves the same way.
+ s.execute("type.pathOptions", &json!({"start": 0, "end": null})).unwrap();
+ s.execute("type.orientation.vertical", &json!({})).unwrap();
+ s.execute("type.pathCenter.top", &json!({})).unwrap();
+ assert!(near(brackets(&s, a).0, 0.75));
+}
+
+#[test]
+fn center_on_top_refuses_open_compound_and_threaded_type() {
+ let mut s = session();
+ let circle = on_circle(&mut s, "OOOO");
+ let line = on_line(&mut s);
+ s.execute("select.set", &json!({"ids": [circle.0, line.0]})).unwrap();
+ let steps = undo_len(&s);
+ let before = brackets(&s, circle);
+ let e = s.execute("type.pathCenter.top", &json!({})).unwrap_err().to_string();
+ assert!(e.contains("type on an open or compound path cannot be centered on its top or bottom") && e.ends_with(&line.0.to_string()), "{e}");
+ // Nothing changes, the type on the circle included, and the same holds for an explicit list.
+ assert_eq!((undo_len(&s), brackets(&s, circle)), (steps, before));
+ let e = s.execute("type.pathCenter.bottom", &json!({"ids": [circle.0, line.0]})).unwrap_err().to_string();
+ assert!(e.contains("open or compound path") && e.ends_with(&line.0.to_string()), "{e}");
+ s.execute("select.set", &json!({"ids": [circle.0]})).unwrap();
+ for bad in [json!({"ids": "all"}), json!({"ids": [999_999]})] {
+ assert!(s.execute("type.pathCenter.top", &bad).is_err(), "{bad}");
+ }
+ assert_eq!(undo_len(&s), steps);
+ // Two circles side by side in one path: a compound path.
+ let pair = path_type(
+ &mut s,
+ "M100 450 A40 40 0 1 1 180 450 A40 40 0 1 1 100 450 Z M300 450 A40 40 0 1 1 380 450 A40 40 0 1 1 300 450 Z",
+ [90.0, 450.0],
+ "OOOO",
+ );
+ let e = s.execute("type.pathCenter.top", &json!({})).unwrap_err().to_string();
+ assert!(e.contains("open or compound path") && e.ends_with(&pair.0.to_string()), "{e}");
+ // A closed path that is level all round has no height.
+ let flat = path_type(&mut s, "M100 400 L300 400 Z", [90.0, 400.0], "OOOO");
+ let e = s.execute("type.pathCenter.top", &json!({})).unwrap_err().to_string();
+ assert!(e.contains("type on a path with no length or no height cannot be centered") && e.ends_with(&flat.0.to_string()), "{e}");
+ // A frame of a thread is refused, alone or with other type on a closed path.
+ let threaded = on_circle(&mut s, "Threaded story");
+ let frame = s.execute("shape.rectangle", &json!({"x": 400, "y": 100, "width": 200, "height": 100})).unwrap()["id"].as_u64().unwrap();
+ s.execute("select.set", &json!({"ids": [threaded.0, frame]})).unwrap();
+ s.execute("text.thread.create", &json!({})).unwrap();
+ s.execute("select.set", &json!({"ids": [threaded.0]})).unwrap();
+ let before = brackets(&s, threaded);
+ for ids in [json!([threaded.0]), json!([circle.0, threaded.0])] {
+ let steps = undo_len(&s);
+ let e = s.execute("type.pathCenter.top", &json!({ "ids": ids })).unwrap_err().to_string();
+ assert!(e.contains("type on a path in a thread cannot be centered on its top or bottom") && e.ends_with(&threaded.0.to_string()), "{e}");
+ assert_eq!((undo_len(&s), brackets(&s, threaded)), (steps, before));
+ }
+ // Without type on one closed path selected, the commands are not available.
+ let p = s.execute("text.create", &json!({"x": 40, "y": 40, "text": "Point"})).unwrap()["id"].as_u64().unwrap();
+ for (ids, why) in [
+ (json!([p]), "select type on a closed path"),
+ (json!([line.0]), "open or compound path"),
+ (json!([circle.0, line.0]), "open or compound path"),
+ (json!([threaded.0]), "in a thread"),
+ ] {
+ s.execute("select.set", &json!({ "ids": ids })).unwrap();
+ for c in ["type.pathCenter.top", "type.pathCenter.bottom"] {
+ let e = s.execute(c, &json!({})).unwrap_err().to_string();
+ assert!(e.contains(why), "{c} {ids}: {e}");
+ }
+ }
+}
+
#[test]
fn align_to_path_and_spacing() {
let mut s = session();
diff --git a/crates/geom/src/arc.rs b/crates/geom/src/arc.rs
index c4fe640ae2..644dc44f6a 100644
--- a/crates/geom/src/arc.rs
+++ b/crates/geom/src/arc.rs
@@ -2,7 +2,7 @@
//! distance along it of the point nearest another (type on a path lays its glyphs out and the
//! selection tools drag its brackets by distance along the path).
-use kurbo::{ParamCurve, ParamCurveArclen, ParamCurveNearest, PathSeg, Point, Vec2};
+use kurbo::{Affine, ParamCurve, ParamCurveArclen, ParamCurveExtrema, ParamCurveNearest, PathSeg, Point, Vec2};
use crate::PathData;
@@ -76,6 +76,78 @@ impl ArcPath {
pub fn fraction_at(&self, p: Point) -> Option {
(self.len > 0.0).then(|| self.nearest(p)).flatten().map(|s| (s / self.len).clamp(0.0, 1.0))
}
+
+ /// The distance along the path of the middle of its topmost points (the least y) where `xf`
+ /// draws it: the topmost point when there is one, the middle of a level stretch (a
+ /// rectangle's top edge), and when several points or stretches are topmost, the middle of the
+ /// shortest part of the path that holds them all. None for a path with no length, or a closed
+ /// path whose every point is topmost.
+ pub fn topmost(&self, xf: Affine) -> Option {
+ let drawn: Vec<(PathSeg, PathSeg, f64, f64)> = self.segs.iter().map(|&(s, c, l)| (s, xf * s, c, l)).collect();
+ // The candidates for the least y in each segment: its ends and where it turns.
+ let turns = |d: &PathSeg| [0.0, 1.0].into_iter().chain(d.extrema()).collect::>();
+ let mut bounds: Option = None;
+ let mut top = f64::INFINITY;
+ for (_, d, _, _) in &drawn {
+ let b = d.bounding_box();
+ bounds = Some(bounds.map_or(b, |a| a.union(b)));
+ top = turns(d).into_iter().map(|t| d.eval(t).y).fold(top, f64::min);
+ }
+ let b = bounds?;
+ if !(top.is_finite() && b.width().is_finite() && b.height().is_finite()) {
+ return None;
+ }
+ // Points this close to the top count as topmost: a part of the drawn size, and no less than
+ // the rounding error of coordinates this far from the origin.
+ let tol = (1e-9 * (b.width() + b.height())).max(64.0 * f64::EPSILON * b.y0.abs().max(b.y1.abs()));
+ // Stretches this close along the path meet.
+ let near = 1e-9 * self.len;
+ // The topmost points as stretches of distance along the path, in order.
+ let mut runs: Vec<(f64, f64)> = vec![];
+ for (s, d, c, l) in &drawn {
+ let db = d.bounding_box();
+ if db.y1 - db.y0 <= tol && db.y0 <= top + tol {
+ runs.push((*c, c + l));
+ continue;
+ }
+ for t in turns(d) {
+ if d.eval(t).y <= top + tol {
+ let at = c + s.subsegment(0.0..t).arclen(ACCURACY).min(*l);
+ runs.push((at, at));
+ }
+ }
+ }
+ runs.sort_by(|a, b| a.0.total_cmp(&b.0));
+ // Stretches that meet or overlap are one.
+ let mut merged: Vec<(f64, f64)> = vec![];
+ for (a, z) in runs {
+ match merged.last_mut() {
+ Some(last) if a <= last.1 + near => last.1 = last.1.max(z),
+ _ => merged.push((a, z)),
+ }
+ }
+ let (first, last) = (*merged.first()?, *merged.last()?);
+ if !self.closed {
+ return Some((first.0 + last.1) * 0.5);
+ }
+ let len = self.len;
+ // Round a closed path, the shortest part holding every stretch leaves out the longest
+ // gap between two of them (the gap from the last round to the first included).
+ let wrap = first.0 + len - last.1;
+ let (mut gap, mut from, mut to) = (wrap, first.0, last.1);
+ for w in merged.windows(2) {
+ if let [a, b] = w
+ && b.0 - a.1 > gap
+ {
+ (gap, from, to) = (b.0 - a.1, b.0, a.1);
+ }
+ }
+ if gap <= near {
+ return None;
+ }
+ let run = (to - from).rem_euclid(len);
+ Some((from + run * 0.5).rem_euclid(len))
+ }
}
#[cfg(test)]
@@ -99,4 +171,64 @@ mod tests {
assert!(sq.at(45.0).0.distance(sq.at(5.0).0) < 1e-6);
assert!(ArcPath::new(&PathData::default()).is_empty());
}
+
+ fn polyline(points: &[Point], closed: bool) -> PathData {
+ PathData::single(crate::SubPath::polyline(points, closed))
+ }
+
+ /// Where `topmost` puts the middle, drawn by `xf`.
+ fn top_point(a: &ArcPath, xf: Affine) -> Point {
+ xf * a.at(a.topmost(xf).unwrap()).0
+ }
+
+ #[test]
+ fn topmost_points_as_drawn() {
+ // A circle starts at 9 o'clock and runs clockwise (y down): its top is a quarter of the way round, its
+ // bottom three quarters.
+ let circle = ArcPath::new(&shapes::ellipse(Rect::new(0.0, 0.0, 100.0, 100.0)));
+ assert!((circle.topmost(Affine::IDENTITY).unwrap() - circle.len() * 0.25).abs() < 1e-6);
+ assert!((circle.topmost(Affine::FLIP_Y).unwrap() - circle.len() * 0.75).abs() < 1e-6);
+ // As the transform draws it: turned a quarter turn the other way, 3 o'clock is at the top.
+ let turned = Affine::rotate_about(-std::f64::consts::FRAC_PI_2, Point::new(50.0, 50.0));
+ assert!((circle.topmost(turned).unwrap() - circle.len() * 0.5).abs() < 1e-6);
+ // Turned part way, the top lies inside a segment.
+ let tilted = Affine::rotate_about(0.4, Point::new(50.0, 50.0));
+ assert!(top_point(&circle, tilted).distance(Point::new(50.0, 0.0)) < 0.05, "{:?}", top_point(&circle, tilted));
+ // An ellipse squashed and skewed by its transform.
+ let skewed = Affine::skew(0.5, 0.0) * Affine::scale_non_uniform(2.0, 0.5);
+ let p = top_point(&circle, skewed);
+ let lowest = (0..3600).map(|i| (skewed * circle.at(circle.len() * i as f64 / 3600.0).0).y).fold(f64::INFINITY, f64::min);
+ assert!((p.y - lowest).abs() < 1e-3, "{p:?} {lowest}");
+ // A level top: the middle of the top edge, for a rectangle and a rounded rectangle.
+ for path in [shapes::rectangle(Rect::new(10.0, 20.0, 110.0, 70.0)), shapes::rounded_rectangle(Rect::new(10.0, 20.0, 110.0, 70.0), 8.0)] {
+ let a = ArcPath::new(&path);
+ assert!(top_point(&a, Affine::IDENTITY).distance(Point::new(60.0, 20.0)) < 1e-6, "{:?}", top_point(&a, Affine::IDENTITY));
+ assert!(top_point(&a, Affine::FLIP_Y).distance(Point::new(60.0, -70.0)) < 1e-6);
+ }
+ // Far from the origin the top is still the top edge's middle.
+ let square = ArcPath::new(&shapes::rectangle(Rect::new(0.0, 0.0, 100.0, 100.0)));
+ let far = Affine::translate((1e12, 1e12));
+ assert!(top_point(&square, far).distance(Point::new(1e12 + 50.0, 1e12)) < 1e-3, "{:?}", top_point(&square, far));
+ // A level top across the path's start: the start in the middle of the top edge.
+ let across = ArcPath::new(&polyline(
+ &[Point::new(50.0, 0.0), Point::new(100.0, 0.0), Point::new(100.0, 50.0), Point::new(0.0, 50.0), Point::new(0.0, 0.0)],
+ true,
+ ));
+ assert!(top_point(&across, Affine::IDENTITY).distance(Point::new(50.0, 0.0)) < 1e-6);
+ // Two peaks: the middle of the shortest part that holds both, the dip between them.
+ let peaks = ArcPath::new(&polyline(
+ &[Point::new(0.0, 10.0), Point::new(2.0, 0.0), Point::new(4.0, 5.0), Point::new(6.0, 0.0), Point::new(8.0, 10.0)],
+ true,
+ ));
+ assert!(top_point(&peaks, Affine::IDENTITY).distance(Point::new(4.0, 5.0)) < 1e-6, "{:?}", top_point(&peaks, Affine::IDENTITY));
+ // An open path: the middle of its topmost points too.
+ let open = ArcPath::new(&polyline(&[Point::new(0.0, 10.0), Point::new(5.0, 0.0), Point::new(10.0, 10.0)], false));
+ assert!(top_point(&open, Affine::IDENTITY).distance(Point::new(5.0, 0.0)) < 1e-6);
+ // No top: a closed path that is level all round, and a path with no length.
+ let flat = ArcPath::new(&shapes::ellipse(Rect::new(0.0, 10.0, 100.0, 10.0)));
+ assert!(!flat.is_empty() && flat.topmost(Affine::IDENTITY).is_none());
+ assert!(ArcPath::new(&PathData::default()).topmost(Affine::IDENTITY).is_none());
+ let point = ArcPath::new(&polyline(&[Point::new(5.0, 5.0), Point::new(5.0, 5.0)], true));
+ assert!(point.topmost(Affine::IDENTITY).is_none());
+ }
}
diff --git a/crates/ui-egui/src/canvas/task_bar.rs b/crates/ui-egui/src/canvas/task_bar.rs
index eb038f0790..3fe0f99a92 100644
--- a/crates/ui-egui/src/canvas/task_bar.rs
+++ b/crates/ui-egui/src/canvas/task_bar.rs
@@ -158,6 +158,7 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
if crate::menus::enabled(app, "type.dynamicText") {
items.push((tl!("Dynamic Text"), "maximize-2", "type.dynamicText", none()));
}
+ center_on_path_items(app, &mut items);
}
}
} else if is_image {
@@ -349,6 +350,18 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
}
}
+/// The Contextual Task Bar's Center on Top and Center on Bottom, as in the Type menu, for type on a
+/// closed path.
+fn center_on_path_items(app: &VectorcraftApp, items: &mut Vec<(&'static str, &'static str, &'static str, serde_json::Value)>) {
+ for (label, icon, id) in
+ [(tl!("Center on Top"), "dc-al-top", "type.pathCenter.top"), (tl!("Center on Bottom"), "dc-al-bottom", "type.pathCenter.bottom")]
+ {
+ if crate::menus::enabled(app, id) {
+ items.push((label, icon, id, json!({})));
+ }
+ }
+}
+
/// The Contextual Task Bar's Image Trace button: a trace with the Default preset.
const TASK_BAR_IMAGE_TRACE: &str = "taskBar.imageTrace";
diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv
index d83b5ac3c6..d1658c0e24 100644
--- a/crates/ui-egui/src/i18n/bg.tsv
+++ b/crates/ui-egui/src/i18n/bg.tsv
@@ -3584,6 +3584,8 @@ digits Malayalam Малаялам
Type on a Path Текст по пътя
Type on a Path Options Опции за текст по пътя
Type on a Path Options… Опции за текст по път…
+ Center on Top Центриране горе
+ Center on Bottom Центриране долу
Type on a Path Tool Инструмент „Текст по път“
Type Orientation Ориентация на текста
Type stays text, and every stroke is a line with its lineweight and dashes. Текстът остава текст, а всеки щрих е линия с дебелина и чертички.
diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv
index 663e95ceaa..f8ed0e1588 100644
--- a/crates/ui-egui/src/i18n/bs.tsv
+++ b/crates/ui-egui/src/i18n/bs.tsv
@@ -384,6 +384,8 @@
Stair Step Stepenice
Gravity Gravitacija
Type on a Path Options… Opcije teksta na putanji…
+ Center on Top Centriraj na vrhu
+ Center on Bottom Centriraj na dnu
Threaded Text Povezani tekst
Create Kreiraj
Release Selection Oslobodi odabir
diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv
index 9c60e87e00..a8c2f0e2a5 100644
--- a/crates/ui-egui/src/i18n/ca.tsv
+++ b/crates/ui-egui/src/i18n/ca.tsv
@@ -2886,6 +2886,10 @@ digits Malayalam Malaiàlam
Optical Margin Alignment Alineació òptica de marges
Dynamic Text Text dinàmic
@msg type on a path in a thread cannot use Dynamic Text: {frames} el text sobre un traçat d’un text enllaçat no pot fer servir el text dinàmic: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} el text sobre un traçat obert o compost no es pot centrar a dalt o a baix: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} el text sobre un traçat sense longitud o sense alçada no es pot centrar: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} el text sobre un traçat d’un text enllaçat no es pot centrar a dalt o a baix: {frames}
+@msg select type on a closed path seleccioneu text sobre un traçat tancat
Optimize for fast web view Optimitza per a la visualització web ràpida
Optimized Optimitzat
Options Opcions
@@ -4626,6 +4630,8 @@ digits Malayalam Malaiàlam
Type on a Path Text sobre un traçat
Type on a Path Options Opcions de text sobre un traçat
Type on a Path Options… Opcions de text sobre un traçat…
+ Center on Top Centra a dalt
+ Center on Bottom Centra a baix
Type on a Path Tool Eina de text sobre un traçat
Type Optimized Optimitzat per al text
Type Orientation Orientació del text
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index e8f9666fae..af7e79a8ea 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -391,6 +391,8 @@
Stair Step Schody
Gravity Gravitace
Type on a Path Options… Možnosti textu na cestě…
+ Center on Top Vystředit nahoře
+ Center on Bottom Vystředit dole
Threaded Text Zřetězený text
Create Vytvořit
Release Selection Uvolnit výběr
@@ -408,6 +410,10 @@
Optical Margin Alignment Optické zarovnání okrajů
Dynamic Text Dynamický text
@msg type on a path in a thread cannot use Dynamic Text: {frames} text na cestě ve zřetězeném textu nemůže používat dynamický text: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} text na otevřené nebo složené cestě nelze vystředit nahoře ani dole: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} text na cestě bez délky nebo bez výšky nelze vystředit: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} text na cestě ve zřetězeném textu nelze vystředit nahoře ani dole: {frames}
+@msg select type on a closed path vyberte text na uzavřené cestě
Fill with Placeholder Text Vyplnit zástupným textem
Insert Inline Symbol Vložit symbol do textu
Show Hidden Characters Zobrazit skryté znaky
diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv
index 31915ed6bf..9c0e6205f9 100644
--- a/crates/ui-egui/src/i18n/da.tsv
+++ b/crates/ui-egui/src/i18n/da.tsv
@@ -352,6 +352,8 @@
Stair Step Trappetrin
Gravity Tyngdekraft
Type on a Path Options… Indstillinger for tekst på kurve…
+ Center on Top Centrer øverst
+ Center on Bottom Centrer nederst
Threaded Text Sammenkædet tekst
Create Opret
Release Selection Frigør markering
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index 2c5424d81f..0654e68296 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -2291,6 +2291,10 @@ file-filter Templates Vorlagen
Optical Margin Alignment Optischer Randausgleich
Dynamic Text Dynamischer Text
@msg type on a path in a thread cannot use Dynamic Text: {frames} Pfadtext in verkettetem Text kann keinen dynamischen Text verwenden: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} Pfadtext auf einem offenen oder zusammengesetzten Pfad lässt sich nicht oben oder unten zentrieren: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} Pfadtext auf einem Pfad ohne Länge oder ohne Höhe lässt sich nicht zentrieren: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} Pfadtext in verkettetem Text lässt sich nicht oben oder unten zentrieren: {frames}
+@msg select type on a closed path wählen Sie Pfadtext auf einem geschlossenen Pfad aus
Optimize for fast web view Für schnelle Webanzeige optimieren
Optimized Optimiert
Options Optionen
@@ -3618,6 +3622,8 @@ effect Points Punkte
Type on a Path Pfadtext
Type on a Path Options Pfadtextoptionen
Type on a Path Options… Pfadtextoptionen…
+ Center on Top Oben zentrieren
+ Center on Bottom Unten zentrieren
Type on a Path Tool Pfadtext-Werkzeug
Type Orientation Textrichtung
Type stays text, and every stroke is a line with its lineweight and dashes. Text bleibt Text, und jede Kontur ist eine Linie mit ihrer Linienstärke und ihren Strichen.
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index 6071ed5be4..7993587dac 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -3053,6 +3053,10 @@ theme Appearance Εμφάνιση
Optical Margin Alignment Οπτική στοίχιση περιθωρίου
Dynamic Text Δυναμικό κείμενο
@msg type on a path in a thread cannot use Dynamic Text: {frames} το κείμενο σε διαδρομή μέσα σε συνδεδεμένο κείμενο δεν μπορεί να χρησιμοποιήσει δυναμικό κείμενο: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} κείμενο σε ανοιχτή ή σύνθετη διαδρομή δεν μπορεί να κεντραριστεί επάνω ή κάτω: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} κείμενο σε διαδρομή χωρίς μήκος ή χωρίς ύψος δεν μπορεί να κεντραριστεί: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} το κείμενο σε διαδρομή μέσα σε συνδεδεμένο κείμενο δεν μπορεί να κεντραριστεί επάνω ή κάτω: {frames}
+@msg select type on a closed path επιλέξτε κείμενο σε κλειστή διαδρομή
Optimize for fast web view Βελτιστοποίηση για γρήγορη προβολή στον ιστό
Options for Selection… Επιλογές για την επιλογή…
or more spaces with a tab ή περισσότερα διαστήματα με στηλοθέτη
@@ -4005,6 +4009,8 @@ digits Malayalam Μαλαγιάλαμ
Type on a Path Κείμενο σε διαδρομή
Type on a Path Options Επιλογές κειμένου σε διαδρομή
Type on a Path Options… Επιλογές κειμένου σε διαδρομή…
+ Center on Top Κεντράρισμα επάνω
+ Center on Bottom Κεντράρισμα κάτω
Type on a Path Tool Κείμενο σε διαδρομή (Type on a Path Tool)
Type Orientation Προσανατολισμός κειμένου
Type stays text, and every stroke is a line with its lineweight and dashes. Το κείμενο διατηρείται ως κείμενο και κάθε περίγραμμα γίνεται γραμμή με το πάχος και τις παύλες του.
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index 4a74e3ae39..84f6114c87 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -2337,6 +2337,10 @@ font-technology Variable Variables
Optical Margin Alignment Alineación óptica de márgenes
Dynamic Text Texto dinámico
@msg type on a path in a thread cannot use Dynamic Text: {frames} el texto en trazado de un texto enlazado no puede usar texto dinámico: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} el texto en un trazado abierto o compuesto no se puede centrar arriba o abajo: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} el texto en un trazado sin longitud o sin altura no se puede centrar: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} el texto en trazado de un texto enlazado no se puede centrar arriba o abajo: {frames}
+@msg select type on a closed path seleccione texto en un trazado cerrado
Optimize for fast web view Optimizar para vista web rápida
Optimized Optimizado
Options Opciones
@@ -3672,6 +3676,8 @@ digits Malayalam Malayálam
Type on a Path Texto en trazado
Type on a Path Options Opciones de texto en trazado
Type on a Path Options… Opciones de texto en trazado…
+ Center on Top Centrar arriba
+ Center on Bottom Centrar abajo
Type on a Path Tool Herramienta Texto en trazado
Type Orientation Orientación del texto
Type stays text, and every stroke is a line with its lineweight and dashes. El texto sigue siendo texto, y cada trazo es una línea con su grosor y guiones.
diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv
index f2ec64f602..3c688e2b93 100644
--- a/crates/ui-egui/src/i18n/fi.tsv
+++ b/crates/ui-egui/src/i18n/fi.tsv
@@ -388,6 +388,8 @@
Stair Step Porras
Gravity Painovoima
Type on a Path Options… Teksti polulla -asetukset…
+ Center on Top Keskitä ylös
+ Center on Bottom Keskitä alas
Threaded Text Ketjutettu teksti
Create Luo
Release Selection Vapauta valinta
@@ -405,6 +407,10 @@
Optical Margin Alignment Optinen reunustasaus
Dynamic Text Dynaaminen teksti
@msg type on a path in a thread cannot use Dynamic Text: {frames} ketjutetun tekstin polkuteksti ei voi käyttää dynaamista tekstiä: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} avoimella polulla tai yhdistelmäpolulla olevaa tekstiä ei voi keskittää ylös tai alas: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} polkutekstiä ei voi keskittää polulle, jolla ei ole pituutta tai korkeutta: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} ketjutetun tekstin polkutekstiä ei voi keskittää ylös tai alas: {frames}
+@msg select type on a closed path valitse suljetulla polulla oleva teksti
Fill with Placeholder Text Täytä paikkamerkkitekstillä
Insert Inline Symbol Lisää tekstinsisäinen symboli
Show Hidden Characters Näytä piilotetut merkit
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index 807b3363b4..9c48aaeb56 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -2329,6 +2329,10 @@ font-technology Variable Variables
Optical Margin Alignment Alignement optique des marges
Dynamic Text Texte dynamique
@msg type on a path in a thread cannot use Dynamic Text: {frames} le texte curviligne d’un texte lié ne peut pas utiliser le texte dynamique : {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} un texte curviligne sur un tracé ouvert ou un tracé transparent ne peut pas être centré en haut ou en bas : {open}
+@msg type on a path with no length or no height cannot be centered: {flat} un texte curviligne sur un tracé sans longueur ou sans hauteur ne peut pas être centré : {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} le texte curviligne d’un texte lié ne peut pas être centré en haut ou en bas : {frames}
+@msg select type on a closed path sélectionnez un texte curviligne sur un tracé fermé
Optimize for fast web view Optimiser pour un affichage web rapide
Optimized Optimisé
Options Options
@@ -3663,6 +3667,8 @@ digits Malayalam Malayalam
Type on a Path Texte curviligne
Type on a Path Options Options de texte curviligne
Type on a Path Options… Options de texte curviligne…
+ Center on Top Centrer en haut
+ Center on Bottom Centrer en bas
Type on a Path Tool Outil Texte curviligne
Type Orientation Orientation du texte
Type stays text, and every stroke is a line with its lineweight and dashes. Le texte reste du texte, et chaque contour devient une ligne avec son épaisseur et ses tirets.
diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv
index 572a19779f..8f5e9e7121 100644
--- a/crates/ui-egui/src/i18n/hi.tsv
+++ b/crates/ui-egui/src/i18n/hi.tsv
@@ -3139,6 +3139,10 @@ antiAlias Sharp शार्प
Optical Margin Alignment ऑप्टिकल मार्जिन संरेखण
Dynamic Text डायनैमिक टेक्स्ट
@msg type on a path in a thread cannot use Dynamic Text: {frames} थ्रेडेड टेक्स्ट में पाथ पर टाइप डायनैमिक टेक्स्ट का उपयोग नहीं कर सकता: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} खुले पाथ या कंपाउंड पाथ पर टाइप को ऊपर या नीचे केंद्रित नहीं किया जा सकता: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} बिना लंबाई या बिना ऊँचाई वाले पाथ पर टाइप केंद्रित नहीं किया जा सकता: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} थ्रेडेड टेक्स्ट में पाथ पर टाइप को ऊपर या नीचे केंद्रित नहीं किया जा सकता: {frames}
+@msg select type on a closed path बंद पाथ पर टाइप चुनें
Optimize for fast web view तेजी से वेब दृश्य के लिए ऑप्टिमाइज़
Optimized ऑप्टिमाइज़्ड
Options ऑप्शन्स
@@ -5014,6 +5018,8 @@ antiAlias Sharp शार्प
Type on a Path पाथ पर टाइप
Type on a Path Options पाथ पर टाइप ऑप्शन्स
Type on a Path Options… पाथ पर टाइप ऑप्शन्स…
+ Center on Top ऊपर केंद्रित करें
+ Center on Bottom नीचे केंद्रित करें
Type on a Path Tool पाथ पर टाइप टूल
Type Optimized टाइप ऑप्टिमाइज़
Type Orientation प्रकार अभिविन्यास
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index 8c2d2339bc..42b92d9e7d 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -2824,6 +2824,10 @@ file-filter Templates Sablonok
Optical Margin Alignment Optikai margóigazítás
Dynamic Text Dinamikus szöveg
@msg type on a path in a thread cannot use Dynamic Text: {frames} a láncolt szövegben lévő útvonalszöveg nem használhat dinamikus szöveget: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} nyitott vagy összetett útvonalon lévő útvonalszöveg nem igazítható középre felül vagy alul: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} a hossz vagy magasság nélküli útvonalon lévő útvonalszöveg nem igazítható középre: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} a láncolt szövegben lévő útvonalszöveg nem igazítható középre felül vagy alul: {frames}
+@msg select type on a closed path jelöljön ki zárt útvonalon lévő útvonalszöveget
Optimize for fast web view Optimalizálás gyors webes megtekintéshez
Optimized Optimalizált
Options Beállítások
@@ -4382,6 +4386,8 @@ mark-style Japanese Japán
Type on a Path Útvonalszöveg
Type on a Path Options Útvonalszöveg beállításai
Type on a Path Options… Útvonalszöveg beállításai…
+ Center on Top Középre igazítás felül
+ Center on Bottom Középre igazítás alul
Type on a Path Tool Útvonalszöveg
Type Optimized Szövegre optimalizált
Type Orientation Szöveg iránya
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 606ffae97c..f717f4b892 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -352,6 +352,8 @@
Stair Step Undakan tangga
Gravity Gravitasi
Type on a Path Options… Opsi teks pada jalur…
+ Center on Top Pusatkan di atas
+ Center on Bottom Pusatkan di bawah
Threaded Text Teks beruntun
Create Buat
Release Selection Lepaskan seleksi
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index bf4c9e7b58..f47795e013 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -2367,6 +2367,10 @@ file-filter Templates Modelli
Optical Margin Alignment Allineamento ottico dei margini
Dynamic Text Testo dinamico
@msg type on a path in a thread cannot use Dynamic Text: {frames} il testo su tracciato in un testo concatenato non può usare il testo dinamico: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} il testo su un tracciato aperto o composto non può essere centrato in alto o in basso: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} il testo su un tracciato senza lunghezza o senza altezza non può essere centrato: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} il testo su tracciato in un testo concatenato non può essere centrato in alto o in basso: {frames}
+@msg select type on a closed path seleziona del testo su un tracciato chiuso
Optimize for fast web view Ottimizza per visualizzazione web veloce
Optimized Ottimizzato
Options Opzioni
@@ -3710,6 +3714,8 @@ digits Malayalam Malayalam
Type on a Path Testo su tracciato
Type on a Path Options Opzioni testo su tracciato
Type on a Path Options… Opzioni testo su tracciato…
+ Center on Top Centra in alto
+ Center on Bottom Centra in basso
Type on a Path Tool Strumento Testo su tracciato
Type Orientation Orientamento testo
Type stays text, and every stroke is a line with its lineweight and dashes. Il testo resta testo e ogni traccia diventa una linea con il suo spessore e i suoi tratteggi.
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 7a12afcadb..3910041eaf 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -409,6 +409,8 @@ digits Malayalam マラヤーラム数字
Stair Step 階段
Gravity 引力
Type on a Path Options… パス上文字オプション…
+ Center on Top 上端に中央揃え
+ Center on Bottom 下端に中央揃え
Threaded Text スレッドテキストオプション
Create 作成
Release Selection 選択部分をリリース
@@ -436,6 +438,10 @@ digits Malayalam マラヤーラム数字
Optical Margin Alignment 最適なマージン揃え
Dynamic Text ダイナミックテキスト
@msg type on a path in a thread cannot use Dynamic Text: {frames} スレッドテキスト内のパス上文字にはダイナミックテキストを使用できません: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} オープンパスや複合パス上のパス上文字は上端または下端に中央揃えできません: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} 長さや高さのないパスのパス上文字は中央揃えできません: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} スレッドテキスト内のパス上文字は上端または下端に中央揃えできません: {frames}
+@msg select type on a closed path クローズパス上のパス上文字を選択してください
Fill with Placeholder Text サンプルテキストの割り付け
Insert Inline Symbol インラインシンボルを挿入
Show Hidden Characters 制御文字を表示
diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv
index c58480c426..570ca353a1 100644
--- a/crates/ui-egui/src/i18n/ka.tsv
+++ b/crates/ui-egui/src/i18n/ka.tsv
@@ -317,6 +317,8 @@
Stair Step საფეხურები
Gravity გრავიტაცია
Type on a Path Options… ტრაექტორიაზე ტექსტის პარამეტრები…
+ Center on Top ზემოთ ცენტრში მოთავსება
+ Center on Bottom ქვემოთ ცენტრში მოთავსება
Threaded Text დაკავშირებული ტექსტი
Create შექმნა
Release Selection მონიშნულის მოხსნა
@@ -334,6 +336,10 @@
Optical Margin Alignment ოპტიკური არშიის სწორება
Dynamic Text დინამიკური ტექსტი
@msg type on a path in a thread cannot use Dynamic Text: {frames} დაკავშირებულ ტექსტში ტრაექტორიაზე ტექსტი ვერ გამოიყენებს დინამიკურ ტექსტს: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} ღია ან შედგენილ ტრაექტორიაზე ტექსტი ვერ მოთავსდება ზემოთ ან ქვემოთ ცენტრში: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} ტექსტი ვერ მოთავსდება ცენტრში ტრაექტორიაზე, რომელსაც არ აქვს სიგრძე ან სიმაღლე: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} დაკავშირებულ ტექსტში ტრაექტორიაზე ტექსტი ვერ მოთავსდება ზემოთ ან ქვემოთ ცენტრში: {frames}
+@msg select type on a closed path მონიშნეთ დახურულ ტრაექტორიაზე ტექსტი
Fill with Placeholder Text შემავსებელი ტექსტით შევსება
Insert Inline Symbol ჩადგმული სიმბოლოს ჩასმა
Show Hidden Characters დამალული სიმბოლოების ჩვენება
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 39efdecf2e..3d42eb69d8 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -402,6 +402,8 @@ digits Malayalam 말라얄람어
Stair Step 계단
Gravity 중력
Type on a Path Options… 패스 위 문자 옵션…
+ Center on Top 위쪽에 가운데 맞춤
+ Center on Bottom 아래쪽에 가운데 맞춤
Threaded Text 연결된 문자
Create 만들기
Release Selection 선택 해제
@@ -429,6 +431,10 @@ digits Malayalam 말라얄람어
Optical Margin Alignment 시각적 여백 정렬
Dynamic Text 동적 텍스트
@msg type on a path in a thread cannot use Dynamic Text: {frames} 연결된 문자의 패스 위 문자에는 동적 텍스트를 사용할 수 없습니다: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} 열린 패스나 컴파운드 패스 위 문자는 위쪽이나 아래쪽에 가운데 맞춤할 수 없습니다: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} 길이나 높이가 없는 패스 위 문자는 가운데 맞춤할 수 없습니다: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} 연결된 문자의 패스 위 문자는 위쪽이나 아래쪽에 가운데 맞춤할 수 없습니다: {frames}
+@msg select type on a closed path 닫힌 패스 위 문자를 선택하세요
Fill with Placeholder Text 자리 표시 문자로 채우기
Insert Inline Symbol 인라인 심볼 삽입
Show Hidden Characters 숨겨진 문자 표시
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index dd1d22edc0..3ef28b6895 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -366,6 +366,8 @@
Stair Step Trap
Gravity Zwaartekracht
Type on a Path Options… Opties voor tekst op pad…
+ Center on Top Boven centreren
+ Center on Bottom Onder centreren
Threaded Text Gekoppelde tekst
Create Maken
Release Selection Selectie vrijgeven
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index dd850a3a4a..600552b22b 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -350,6 +350,8 @@
Stair Step Schodki
Gravity Grawitacja
Type on a Path Options… Opcje tekstu na ścieżce…
+ Center on Top Wyśrodkuj na górze
+ Center on Bottom Wyśrodkuj na dole
Threaded Text Tekst wątkowy
Create Utwórz
Release Selection Uwolnij zaznaczenie
@@ -367,6 +369,10 @@
Optical Margin Alignment Optyczne wyrównanie marginesów
Dynamic Text Tekst dynamiczny
@msg type on a path in a thread cannot use Dynamic Text: {frames} tekst na ścieżce w tekście wątkowym nie może używać tekstu dynamicznego: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} nie można wyśrodkować na górze ani na dole tekstu na ścieżce otwartej lub złożonej: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} nie można wyśrodkować tekstu na ścieżce bez długości lub bez wysokości: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} nie można wyśrodkować na górze ani na dole tekstu na ścieżce w tekście wątkowym: {frames}
+@msg select type on a closed path zaznacz tekst na zamkniętej ścieżce
Fill with Placeholder Text Wypełnij tekstem zastępczym
Insert Inline Symbol Wstaw symbol w tekście
Show Hidden Characters Pokaż ukryte znaki
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index f67ae6cda2..13e9424fdd 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -1933,6 +1933,10 @@ antiAlias Sharp Nítido
Optical Margin Alignment Alinhamento de Margem Óptica
Dynamic Text Texto Dinâmico
@msg type on a path in a thread cannot use Dynamic Text: {frames} o texto em um caminho de um texto encadeado não pode usar Texto Dinâmico: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} o texto em um caminho aberto ou composto não pode ser centralizado em cima ou embaixo: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} o texto em um caminho sem comprimento ou sem altura não pode ser centralizado: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} o texto em um caminho de um texto encadeado não pode ser centralizado em cima ou embaixo: {frames}
+@msg select type on a closed path selecione texto em um caminho fechado
Optimize for fast web view Otimizar para visualização rápida na web
Optimized Otimizado
Options Opções
@@ -3021,6 +3025,8 @@ digits Malayalam Malaiala
Type becomes outlines, and strokes a CAD line can't draw become filled shapes. O texto vira contornos, e os traços que uma linha CAD não pode desenhar viram formas preenchidas.
Type on a Path Texto em um Caminho
Type on a Path Options… Opções de Texto em um Caminho…
+ Center on Top Centralizar em Cima
+ Center on Bottom Centralizar em Baixo
Type on a Path Tool Ferramenta Texto em um Caminho
Type stays text, and every stroke is a line with its lineweight and dashes. O texto permanece texto, e todo traço é uma linha com sua espessura e tracejados.
Type: Tipo:
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 8eb5425823..e66f350c6a 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -2362,6 +2362,10 @@ file-filter Templates Шаблоны
Optical Margin Alignment Оптическое выравнивание полей
Dynamic Text Динамический текст
@msg type on a path in a thread cannot use Dynamic Text: {frames} текст по контуру в связанном тексте не может использовать динамический текст: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} нельзя центрировать вверху или внизу текст по незамкнутому или составному контуру: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} нельзя центрировать текст по контуру без длины или без высоты: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} нельзя центрировать вверху или внизу текст по контуру в связанном тексте: {frames}
+@msg select type on a closed path выделите текст по замкнутому контуру
Optimize for fast web view Оптимизировать для быстрого просмотра в web
Optimized Оптимизировано
Options Параметры
@@ -3704,6 +3708,8 @@ digits Malayalam Малаялам
Type on a Path Текст по контуру
Type on a Path Options Параметры текста по контуру
Type on a Path Options… Параметры текста по контуру…
+ Center on Top Центрировать вверху
+ Center on Bottom Центрировать внизу
Type on a Path Tool Инструмент «Текст по контуру»
Type Orientation Ориентация текста
Type stays text, and every stroke is a line with its lineweight and dashes. Текст остаётся текстом, и каждая обводка — линия с её толщиной и штрихами.
diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv
index fb2c463de0..cfdd5bef9d 100644
--- a/crates/ui-egui/src/i18n/sv.tsv
+++ b/crates/ui-egui/src/i18n/sv.tsv
@@ -2276,6 +2276,10 @@ font-technology Variable Variabla
Optical Margin Alignment Optisk marginaljustering
Dynamic Text Dynamisk text
@msg type on a path in a thread cannot use Dynamic Text: {frames} text på bana i länkad text kan inte använda dynamisk text: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} text på en öppen eller sammansatt bana kan inte centreras överst eller nederst: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} text på en bana utan längd eller utan höjd kan inte centreras: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} text på bana i länkad text kan inte centreras överst eller nederst: {frames}
+@msg select type on a closed path markera text på en sluten bana
Optimize for fast web view Optimera för snabb webbvisning
Optimized Optimerad
Options Alternativ
@@ -3593,6 +3597,8 @@ digits Malayalam Malayalam
Type on a Path Text på bana
Type on a Path Options Alternativ för text på bana
Type on a Path Options… Alternativ för text på bana…
+ Center on Top Centrera överst
+ Center on Bottom Centrera nederst
Type on a Path Tool Verktyg för text på bana
Type Orientation Textorientering
Type stays text, and every stroke is a line with its lineweight and dashes. Text förblir text, och varje kontur blir en linje med sin linjetjocklek och sina streck.
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index d45a171cc6..606e994763 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -2148,6 +2148,10 @@ shape Open Açık
Optical Margin Alignment Optik Kenar Boşluğu Hizalaması
Dynamic Text Dinamik Metin
@msg type on a path in a thread cannot use Dynamic Text: {frames} zincirli metindeki yol üzerindeki yazı dinamik metin kullanamaz: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} açık veya bileşik bir yol üzerindeki yazı üstte veya altta ortalanamaz: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} uzunluğu ya da yüksekliği olmayan yol üzerindeki yazı ortalanamaz: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} zincirli metindeki yol üzerindeki yazı üstte veya altta ortalanamaz: {frames}
+@msg select type on a closed path kapalı bir yol üzerindeki yazıyı seçin
Optimize for fast web view Hızlı web görünümü için optimize edin
Optimized Optimize edilmiş
Options Seçenekler
@@ -3481,6 +3485,8 @@ digits Malayalam Malayalam
Type on a Path Bir Yola Yazın
Type on a Path Options Yol Seçenekleri Üzerine Yazma
Type on a Path Options… Yol Seçenekleri Üzerine Yazma…
+ Center on Top Üstte ortala
+ Center on Bottom Altta ortala
Type on a Path Tool Yola Yazma Aracı
Type Orientation Tip Yönü
Type stays text, and every stroke is a line with its lineweight and dashes. Yazı metin olarak kalır ve her kontur, çizgi kalınlığı ve tireleriyle birlikte bir çizgidir.
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index acaf20b6b9..fa5cd060d6 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -2359,6 +2359,10 @@ file-filter Templates Шаблони
Optical Margin Alignment Оптичне вирівнювання полів
Dynamic Text Динамічний текст
@msg type on a path in a thread cannot use Dynamic Text: {frames} текст за контуром у пов’язаному тексті не може використовувати динамічний текст: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} не можна центрувати вгорі чи внизу текст за незамкненим або складеним контуром: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} не можна центрувати текст за контуром без довжини або без висоти: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} не можна центрувати вгорі чи внизу текст за контуром у пов’язаному тексті: {frames}
+@msg select type on a closed path виділіть текст за замкненим контуром
Optimize for fast web view Оптимізувати для швидкого перегляду web
Optimized Оптимізовано
Options Параметри
@@ -3703,6 +3707,8 @@ effect Points Точки
Type on a Path Текст за контуром
Type on a Path Options Параметри тексту за контуром
Type on a Path Options… Параметри тексту за контуром…
+ Center on Top Центрувати вгорі
+ Center on Bottom Центрувати внизу
Type on a Path Tool Інструмент «Текст за контуром»
Type Orientation Орієнтація тексту
Type stays text, and every stroke is a line with its lineweight and dashes. Текст залишається текстом, і кожне обведення — лінія з її товщиною та штрихами.
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index 4a2bbd5a62..22ccb6572a 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -2637,6 +2637,10 @@ digits Hindi Hindi
Optical Margin Alignment Căn lề quang học
Dynamic Text Văn bản động
@msg type on a path in a thread cannot use Dynamic Text: {frames} chữ trên đường dẫn trong văn bản chuỗi không thể dùng văn bản động: {frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} không thể căn giữa ở trên hoặc ở dưới chữ trên đường dẫn mở hoặc đường dẫn phức: {open}
+@msg type on a path with no length or no height cannot be centered: {flat} không thể căn giữa chữ trên đường dẫn không có độ dài hoặc không có chiều cao: {flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} không thể căn giữa ở trên hoặc ở dưới chữ trên đường dẫn trong văn bản chuỗi: {frames}
+@msg select type on a closed path hãy chọn chữ trên một đường dẫn khép kín
Optimize for fast web view Tối ưu để xem web nhanh
Optimized Đã tối ưu
Options Tùy chọn
@@ -4079,6 +4083,8 @@ mark-style Japanese Kiểu Nhật
Type on a Path Chữ trên đường dẫn
Type on a Path Options Tùy chọn chữ trên đường dẫn
Type on a Path Options… Tùy chọn chữ trên đường dẫn…
+ Center on Top Căn giữa ở trên
+ Center on Bottom Căn giữa ở dưới
Type on a Path Tool Công cụ Chữ trên đường dẫn
Type Orientation Hướng chữ
Type stays text, and every stroke is a line with its lineweight and dashes. Chữ vẫn là văn bản, và mỗi nét là đường thẳng với độ dày và nét đứt.
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 0eb7c7ebe5..a5d29edb93 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -2235,6 +2235,10 @@ file-filter Templates 模板
Optical Margin Alignment 视觉边界对齐
Dynamic Text 动态文本
@msg type on a path in a thread cannot use Dynamic Text: {frames} 串接文本中的路径文字不能使用动态文本:{frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} 开放路径或复合路径上的路径文字无法在顶部或底部居中:{open}
+@msg type on a path with no length or no height cannot be centered: {flat} 路径没有长度或没有高度时,其路径文字无法居中:{flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} 串接文本中的路径文字无法在顶部或底部居中:{frames}
+@msg select type on a closed path 请选择闭合路径上的路径文字
Optimize for fast web view 优化快速 Web 查看
Optimized 优化
Options 选项
@@ -3538,6 +3542,8 @@ digits Malayalam 马拉雅拉姆数字
Type on a Path 路径文字
Type on a Path Options 路径文字选项
Type on a Path Options… 路径文字选项…
+ Center on Top 在顶部居中
+ Center on Bottom 在底部居中
Type on a Path Tool 路径文字工具
Type Orientation 文字方向
Type stays text, and every stroke is a line with its lineweight and dashes. 文字维持为文字,每个描边都是带有线宽与虚线的线条。
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 084a7e7708..7c9b433b5e 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -3307,6 +3307,10 @@ file-filter Templates 範本
Optical Margin Alignment 視覺邊界對齊
Dynamic Text 動態文字
@msg type on a path in a thread cannot use Dynamic Text: {frames} 串連文字中的路徑文字無法使用動態文字:{frames}
+@msg type on an open or compound path cannot be centered on its top or bottom: {open} 開放路徑或複合路徑上的路徑文字無法在頂端或底端置中:{open}
+@msg type on a path with no length or no height cannot be centered: {flat} 路徑沒有長度或沒有高度時,其路徑文字無法置中:{flat}
+@msg type on a path in a thread cannot be centered on its top or bottom: {frames} 串連文字中的路徑文字無法在頂端或底端置中:{frames}
+@msg select type on a closed path 請選取封閉路徑上的路徑文字
Optimize for fast web view 最佳化以便快速網頁檢視
Optimized 最佳化
Options 選項
@@ -4655,6 +4659,8 @@ digits Malayalam 馬來亞拉姆數字
Type on a Path 路徑文字
Type on a Path Options 路徑文字選項
Type on a Path Options… 路徑文字選項…
+ Center on Top 在頂端置中
+ Center on Bottom 在底端置中
Type on a Path Tool 路徑文字工具
Type Orientation 文字方向
Type stays text, and every stroke is a line with its lineweight and dashes. 文字維持為文字,每個筆畫都是帶有線寬與虛線的線條。
diff --git a/crates/ui-egui/src/menus/tests.rs b/crates/ui-egui/src/menus/tests.rs
index a449fb0361..d38e16cffd 100644
--- a/crates/ui-egui/src/menus/tests.rs
+++ b/crates/ui-egui/src/menus/tests.rs
@@ -351,6 +351,58 @@ fn dynamic_text_is_a_checked_type_menu_item() {
assert!(!enabled(&app, id), "type on a path in a thread");
}
+/// Type › Type on a Path › Center on Top and Center on Bottom run `type.pathCenter.top` and
+/// `.bottom`, which the command palette also runs without params, and are enabled for type on a
+/// closed path only.
+#[test]
+fn center_on_top_and_bottom_are_type_on_a_path_items() {
+ let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
+ app.run("file.new", json!({})).unwrap();
+ let items: Vec<(&str, &str)> = menu_tree()
+ .into_iter()
+ .filter(|(menu, _)| *menu == "Type")
+ .flat_map(|(_, items)| items)
+ .filter_map(|item| match item {
+ Item::Sub("Type on a Path", children) => Some(children),
+ _ => None,
+ })
+ .flatten()
+ .filter_map(|item| match item {
+ Item::Cmd(label, id, Value::Null) if id.starts_with("type.pathCenter") => Some((label, id)),
+ _ => None,
+ })
+ .collect();
+ let ids = ["type.pathCenter.top", "type.pathCenter.bottom"];
+ assert_eq!(items, [("Center on Top", ids[0]), ("Center on Bottom", ids[1])]);
+ let palette = crate::palette::items();
+ for (label, id) in items {
+ assert!(palette.iter().any(|(l, i, _)| l == &format!("Type › Type on a Path › {label}") && i == id), "{label}");
+ }
+ let line = app.run("path.create", json!({"d": "M60 150 L340 150"})).unwrap()["id"].clone();
+ let open = app.run("text.createInPath", json!({"path": line, "mode": "onPath", "text": "Along", "at": [60, 150]})).unwrap()["id"].clone();
+ app.run("select.set", json!({"ids": [open]})).unwrap();
+ assert!(ids.iter().all(|id| !enabled(&app, id)), "type on an open path");
+ let square = app.run("path.create", json!({"d": "M60 200 L160 200 L160 300 L60 300 Z"})).unwrap()["id"].clone();
+ let closed = app.run("text.createInPath", json!({"path": square, "mode": "onPath", "text": "Round", "at": [60, 200]})).unwrap()["id"].clone();
+ app.run("select.set", json!({"ids": [closed]})).unwrap();
+ assert!(ids.iter().all(|id| enabled(&app, id)));
+ app.run("select.set", json!({"ids": [closed, open]})).unwrap();
+ assert!(ids.iter().all(|id| !enabled(&app, id)), "type on a closed path and on an open one");
+ // A palette pick runs the command with no params.
+ app.run("select.set", json!({"ids": [closed]})).unwrap();
+ crate::palette::run_pick(&mut app, ids[0]);
+ let doc = &app.session.active().unwrap().doc;
+ let start = match &doc.node(vectorcraft_doc::NodeId(closed.as_u64().unwrap())).unwrap().kind {
+ vectorcraft_doc::NodeKind::Text(t) => match t.kind {
+ vectorcraft_doc::TextKind::OnPath { start, .. } => start,
+ ref k => panic!("{k:?}"),
+ },
+ k => panic!("{k:?}"),
+ };
+ // Once round, the middle of the top edge an eighth of the way round.
+ assert!((start - 0.625).abs() < 1e-6, "{start}");
+}
+
/// Type › Optical Margin Alignment menu check uses `shared_text_flag`; mixed values stay unchecked.
#[test]
fn optical_margin_alignment_menu_unchecked_when_shared_flag_none() {
diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs
index 0c46950f37..3a0996c819 100644
--- a/crates/ui-egui/src/menus/tree.rs
+++ b/crates/ui-egui/src/menus/tree.rs
@@ -396,7 +396,13 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec- )> {
PATH_EFFECTS
.iter()
.map(|&(label, effect)| cp(label, "type.pathOptions", json!({ "effect": effect })))
- .chain([Sep, c("Type on a Path Options…", "type.pathOptions")])
+ .chain([
+ Sep,
+ c("Center on Top", "type.pathCenter.top"),
+ c("Center on Bottom", "type.pathCenter.bottom"),
+ Sep,
+ c("Type on a Path Options…", "type.pathOptions"),
+ ])
.collect(),
),
c("Dynamic Text", "type.dynamicText"),
diff --git a/crates/ui-egui/src/tests/taskbar.rs b/crates/ui-egui/src/tests/taskbar.rs
index 53042baa69..4617f9ddeb 100644
--- a/crates/ui-egui/src/tests/taskbar.rs
+++ b/crates/ui-egui/src/tests/taskbar.rs
@@ -208,6 +208,34 @@ fn type_on_a_path_offers_dynamic_text() {
assert!(!has(&texts, "Dynamic Text"), "{texts:?}");
}
+/// Type on a closed path offers Center on Top and Center on Bottom; type on an open path does not.
+#[test]
+fn type_on_a_closed_path_offers_center_on_top_and_bottom() {
+ let mut app = app();
+ app.run("tool.select", json!({"tool": "selection"})).unwrap();
+ let line = id(app.run("path.create", json!({"d": "M60 150 L340 150"})).unwrap());
+ let open = id(app.run("text.createInPath", json!({"path": line, "mode": "onPath", "text": "Along", "at": [60, 150]})).unwrap());
+ select(&mut app, &[open]);
+ let (_, texts) = bar(&mut app);
+ assert!(has(&texts, "Type on a Path Options") && !has(&texts, "Center on Top") && !has(&texts, "Center on Bottom"), "{texts:?}");
+ let circle = id(app.run("path.create", json!({"d": "M100 300 A100 100 0 1 1 300 300 A100 100 0 1 1 100 300 Z"})).unwrap());
+ let t = id(app.run("text.createInPath", json!({"path": circle, "mode": "onPath", "text": "Round", "at": [90, 300]})).unwrap());
+ select(&mut app, &[t]);
+ let start = |app: &VectorcraftApp| match kind(app, t) {
+ NodeKind::Text(t) => match t.kind {
+ TextKind::OnPath { start, .. } => start,
+ k => panic!("{k:?}"),
+ },
+ k => panic!("{k:?}"),
+ };
+ let (_, texts) = bar(&mut app);
+ assert!(has(&texts, "Center on Top") && has(&texts, "Center on Bottom"), "{texts:?}");
+ click(&mut app, "Center on Top");
+ assert!((start(&app) - 0.75).abs() < 1e-3, "{}", start(&app));
+ click(&mut app, "Center on Bottom");
+ assert!((start(&app) - 0.25).abs() < 1e-3, "{}", start(&app));
+}
+
/// The path's anchors (its first subpath).
fn anchors(app: &VectorcraftApp, id: u64) -> Vec
{
match kind(app, id) {
diff --git a/docs/mcp.md b/docs/mcp.md
index 5826c5c8c4..8a9f1db840 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -7301,6 +7301,26 @@ begins or ends, dragging the centre bracket slides the type along its path and,
{"name":"run_command","arguments":{"command":"type.pathOptions","params":{"start":0.25,"end":0.75,"flip":true}}}
```
+`type.pathCenter.top {ids?|id?}` and `type.pathCenter.bottom {ids?|id?}` (Type › Type on a Path › Center on Top and
+Center on Bottom, and the Contextual Task Bar for type on a closed path) slide the selected type on a closed path along
+it so that the middle of the span between its brackets lands on the path's topmost or bottommost point. This is
+VectorCraft's own behavior. The path is measured as the object is drawn, after its transform, so a rotated, scaled or
+skewed circle centers on its drawn top. On a level stretch, such as a rectangle's top edge, the middle of the stretch
+is used; with several separate topmost points, the middle of the shortest part of the path that holds them all is
+used. The span keeps its length, and type that runs once round stays once round. The first paragraph's alignment
+becomes Center unless it is Center or Justify Center, so the type is centered there. The type is not flipped: on the
+bottom of a circle, whose path runs clockwise, it reads upside down outside the circle until `type.pathOptions {flip:
+true}` turns it inside. Point type and area type in the selection are left as they are. Type on an open or compound
+path, type in a thread, and type on a path with no length or no height are refused with an error that names them,
+and nothing changes. The menu items are enabled, and the task bar shows them, only while every selected type on a
+path is on one closed path and none of it is in a thread. Several objects move in one undo step. When every object is
+already centered there, nothing changes and no undo step is recorded. Each replies `{ids, start, end}` with the first
+object's brackets.
+
+```json
+{"name":"run_command","arguments":{"command":"type.pathCenter.top","params":{}}}
+```
+
## Dynamic Text
`type.dynamicText {on?: bool, ids?}` (Type › Dynamic Text, and the Contextual Task Bar for type on a path) turns
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index b4c949f742..b27ef671ba 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1157,6 +1157,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
Object › Flatten Transparency, the Flattener Preview, and EPS, PDF and print output that flatten transparency stop building a group's flat regions at the first region past the raster/vector balance's limit (10^(balance/20), rounded down) and rasterize the whole group without building the remaining regions. Building every region gives the same flattened art and the same files. With Clip Complex Regions on, a group builds every region and its image is clipped to them.
New Symbol and Redefine Symbol on a frame of threaded text take it out of the thread with the text it shows, which the symbol's art holds, and the other frames keep the text they hold. When the last frame goes into the symbol, the text it has no room for goes after the text of the last frame that stays. When every frame of a thread goes into the symbol, the copy of the last frame keeps all its text.
With Optical Margin Alignment on, or Roman Hanging Punctuation on in the first paragraph, the glyphs at the ends of left-to-right type on a path hang outside its brackets, measured along the path. The type hangs at the start bracket when its line is placed there, hangs at the end bracket when the line is placed there, and hangs at both when it is centered. Glyphs that hang past the end bracket do not make the type overflow, and a hang stops at an open path's end. SVG export writes such type as outlines.
+ Type › Type on a Path › Center on Top and Center on Bottom (`type.pathCenter.top`, `type.pathCenter.bottom`, also on the Contextual Task Bar for type on a closed path) slide type on a closed path so the middle of its span lands on the path's topmost or bottommost point as drawn, keep the span's length, and set the first paragraph to Center unless it is Center or Justify Center. This is VectorCraft's own behavior (`crates/geom/src/arc.rs`, `crates/engine/src/tests/pathtype.rs`).
Type on a Path Options › Align to Path (option names as in [Create type on a path](https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/create-type-on-a-path.html)) moves each character by its own font, size and vertical scale: Ascender runs the top of the font's em box along the path (the ideographic em box that its `BASE` table, its typographic or `hhea` box or its ideographs give, else an em box centered on the cap height), Descender runs the bottom of the font's bounding box along it, and Center runs a line at half the height of the top of the font's H above the baseline along it. In vertical type, Ascender and Descender move the characters half an em, and Center leaves them on the path. These distances are VectorCraft's own values (`tests::on_path_align_runs_each_glyph_by_its_own_metrics`, `tests::on_path_align_finds_the_em_box_of_each_kind_of_face`, `tests::on_path_align_in_vertical_type_moves_half_an_em`).
Type › Dynamic Text (`type.dynamicText`, also on the Contextual Task Bar for type on a path) sizes type on a path to fill the span between its start and end brackets and fits it again after each edit to the text, the path or a bracket ([Dynamic Text overview](https://helpx.adobe.com/photoshop/desktop/text-typography/work-with-dynamic-text/dynamic-text-overview.html), [start and end points](https://helpx.adobe.com/photoshop/desktop/text-typography/work-with-dynamic-text/reposition-start-and-end-points.html)). VectorCraft's own rules: one factor scales every size, leading and baseline shift; the first character's size moves in 0.1 pt steps within 0.1 to 1,296 pt; turning it off or threading the type keeps the drawn sizes; SVG, EPS and the editing data write the drawn sizes (`crates/text/src/tests/fit.rs`, `crates/engine/src/tests/dynamic_text.rs`).
The frames of threaded text share one Optical Margin Alignment setting: turning it on or off in one frame sets it in every frame, threading frames gives the thread its first frame's setting, and frames taken out of a thread keep it.
From e609b26a95946f0330bc87ce3cb938ad9310767f Mon Sep 17 00:00:00 2001
From: dotCooCoo
Date: Wed, 11 Nov 2026 17:55:07 -0800
Subject: [PATCH 10/38] =?UTF-8?q?Warp:=20bend=20each=20style=20as=20one=20?=
=?UTF-8?q?B=C3=A9zier=20patch,=20and=20keep=20saved=20warps'=20look?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Each of the fifteen Warp styles now bends the bounds as one Bézier patch.
The style sets the patch's control points from the bend and the size of
the bounds, the horizontal distortion scales each column of control
points about its middle, and the vertical distortion scales each row.
The Warp effects and warp envelopes share the map (`WarpNet`). Content
with no width or no height takes the middle of the patch along that
side.
A warp carries the map it draws with as `version`. New warps, the
built-in graphic styles' Warps and warps opened from .ai files get 1.
Warps in .vectorcraft documents saved before the version existed read
as 0 and keep the earlier map, so those documents keep their look.
Edits keep a warp's version, and Warp Options editing several objects
keeps each one's own. effect.apply, effect.setParams and the warp
envelope commands take `version` 0 or 1 (`1.0` counts as 1) and refuse
any other value. An .ai file holds a warp's settings and not its
version, so a version 0 warp saved to .ai opens again with version 1.
The .ai writer compares a style's settings without the version, so
saved warps still export as editable effects.
Docs: docs/mcp.md (Envelopes), docs/effects-parity.md (Warp),
docs/target-app-parity.md.
---
crates/doc/src/hit/tests.rs | 4 +-
crates/doc/src/live.rs | 198 +++++++++++-
crates/doc/src/live/envelope.rs | 8 +
crates/doc/src/live/mesh.rs | 13 +-
crates/doc/src/live/warp.rs | 331 ++++++++++++++++++++
crates/doc/src/style_libs.rs | 28 +-
crates/effects/src/catalog.rs | 2 +-
crates/effects/src/lib.rs | 2 +-
crates/effects/src/params.rs | 27 +-
crates/effects/src/tests.rs | 51 +++
crates/effects/src/warp.rs | 35 ++-
crates/engine/src/cmd/live/commands.rs | 8 +-
crates/engine/src/cmd/live/envelope.rs | 17 +-
crates/engine/src/cmd/params.rs | 8 +
crates/engine/src/tests/effectedit.rs | 34 ++
crates/engine/src/tests/envelope.rs | 49 ++-
crates/engine/src/tests/envelope_distort.rs | 7 +-
crates/engine/src/tests/live.rs | 4 +-
crates/eps/src/ai_editing/tests.rs | 18 ++
crates/eps/src/ai_editing/writer/styles.rs | 9 +-
crates/eps/src/import/ai/envelope.rs | 1 +
crates/eps/src/import/ai/read/directives.rs | 2 +-
crates/eps/src/import/ai/style.rs | 1 +
crates/eps/src/import/ai/style/tests.rs | 2 +
crates/eps/src/import/ai/tests.rs | 14 +-
crates/eps/src/import/tests_native.rs | 9 +-
crates/render/src/live.rs | 4 +-
crates/render/src/tests/fontchange.rs | 6 +-
crates/render/src/tests/memory.rs | 4 +-
crates/render/src/tests/objectfx.rs | 2 +-
crates/render/src/tests/placed_document.rs | 2 +-
crates/tools/src/xform/eyedropper.rs | 4 +-
crates/ui-egui/src/dialogs/effect.rs | 7 +
crates/ui-egui/src/dialogs/envelope.rs | 2 +-
crates/ui-egui/src/dialogs/tests_warp.rs | 30 ++
crates/ui-egui/src/dialogs/warp_effect.rs | 8 +-
docs/effects-parity.md | 2 +-
docs/mcp.md | 14 +
docs/target-app-parity.md | 1 +
39 files changed, 906 insertions(+), 62 deletions(-)
diff --git a/crates/doc/src/hit/tests.rs b/crates/doc/src/hit/tests.rs
index 2c0a6984d0..3eac4202b6 100644
--- a/crates/doc/src/hit/tests.rs
+++ b/crates/doc/src/hit/tests.rs
@@ -450,7 +450,7 @@ fn a_marquee_meets_blends_and_envelopes_by_their_box() {
envelope,
NodeKind::Envelope {
content,
- kind: Box::new(crate::live::EnvelopeKind::Warp { style: "arc".to_string(), bend: 0.0, h: 0.0, v: 0.0, horizontal: true }),
+ kind: Box::new(crate::live::EnvelopeKind::Warp { style: "arc".to_string(), bend: 0.0, h: 0.0, v: 0.0, horizontal: true, version: 0 }),
fidelity: 100.0,
editing: false,
options: Default::default(),
@@ -1192,7 +1192,7 @@ fn objects_at_edit_contents_uses_general_order() {
d.alloc_id(),
NodeKind::Envelope {
content: vec![inner(a), inner(b)],
- kind: Box::new(crate::live::EnvelopeKind::Warp { style: "arc".to_string(), bend: 0.0, h: 0.0, v: 0.0, horizontal: true }),
+ kind: Box::new(crate::live::EnvelopeKind::Warp { style: "arc".to_string(), bend: 0.0, h: 0.0, v: 0.0, horizontal: true, version: 0 }),
fidelity: 100.0,
editing: true,
options: Default::default(),
diff --git a/crates/doc/src/live.rs b/crates/doc/src/live.rs
index 304c4e70f6..983b93419b 100644
--- a/crates/doc/src/live.rs
+++ b/crates/doc/src/live.rs
@@ -65,7 +65,7 @@ pub use expand::{
#[cfg(test)]
use mesh::grid_eval;
pub use mesh::{Coons, GradientMesh, MeshAppearance, MeshPiece, MeshPoint, MeshQuad, default_fidelity, grid_points, nodes_bounds};
-pub use warp::{WarpStyle, fit_piece, map_nonlinear, map_nonlinear_within, pieces, warp_point};
+pub use warp::{WARP_NET, WarpNet, WarpStyle, fit_piece, map_nonlinear, map_nonlinear_within, pieces, uses_net, warp_point, warp_version};
#[cfg(test)]
mod tests {
@@ -132,6 +132,200 @@ mod tests {
let (r0, a) = (4.0 / PI, 0.5 / (4.0 / PI));
assert!((nx - (r0 - 0.25) * a.sin()).abs() < 1e-12 && (ny - (r0 - (r0 - 0.25) * a.cos())).abs() < 1e-12);
}
+
+ /// Each warp style's Bézier net, at points worked out by a separate implementation of the same
+ /// nets: (style, bend %, horizontal and vertical distortion %, vertical, box w × h, (u, v)) →
+ /// the point in the box (origin at its top left, y down).
+ #[test]
+ fn warp_nets_bend_each_style_as_its_own_patch() {
+ #[rustfmt::skip]
+ let samples = [
+ ("arc", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, -31.1605665, 30.1243045),
+ ("arc", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 170.241998, 58.8743443),
+ ("arc", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 50.6087118, 47.6275948),
+ ("arcLower", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 18.8784581, 35.5028749),
+ ("arcLower", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 164.486168, 119.348666),
+ ("arcLower", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 38.1073767, 36.0911629),
+ ("arcUpper", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 17.3830689, 17.1599587),
+ ("arcUpper", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 160.498463, 86.7390371),
+ ("arcUpper", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 46.1081993, 36.0252855),
+ ("arch", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 16.261527, 11.6570838),
+ ("arch", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 164.984631, 57.3903712),
+ ("arch", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 49.2508226, 36.2064484),
+ ("bulge", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 16.261527, 22.6628335),
+ ("bulge", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 164.984631, 116.087703),
+ ("bulge", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 42.965576, 36.2064484),
+ ("shellLower", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 10.6489723, 25.9914004),
+ ("shellLower", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 208.565464, 99.4817585),
+ ("shellLower", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 41.043987, 36.1302767),
+ ("shellUpper", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, -21.8346746, 41.6042708),
+ ("shellUpper", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 160.791499, 90.3680631),
+ ("shellUpper", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 42.9282896, 36.1475509),
+ ("flag", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 20.0, 55.92),
+ ("flag", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 160.0, 55.44),
+ ("flag", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 58.098, 35.91),
+ ("wave", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 20.0, 40.8864),
+ ("wave", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 160.0, 83.7792),
+ ("wave", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 42.33, 35.91),
+ ("fish", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 20.0, 19.632),
+ ("fish", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 160.0, 62.352),
+ ("fish", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 44.994, 35.91),
+ ("rise", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 20.0, 146.64),
+ ("rise", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 160.0, 102.48),
+ ("rise", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 118.686, 35.91),
+ ("fisheye", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 9.1136, 27.2784),
+ ("fisheye", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 166.2208, 94.1472),
+ ("fisheye", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 47.514, 35.7048),
+ ("inflate", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, -0.16, 27.84),
+ ("inflate", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 166.48, 97.68),
+ ("inflate", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 45.75, 36.54),
+ ("squeeze", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 40.16, 27.84),
+ ("squeeze", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 153.52, 97.68),
+ ("squeeze", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 45.75, 36.0),
+ ("twist", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.1, 0.3, 32.2472, 27.9588),
+ ("twist", 60.0, 0.0, 0.0, false, 200.0, 100.0, 0.8, 0.9, 149.1136, 89.2224),
+ ("twist", -40.0, 30.0, -50.0, true, 150.0, 60.0, 0.25, 0.6, 45.56325, 33.8769),
+ ];
+ for (style, bend, dh, dv, vertical, w, h, u, v, x, y) in samples {
+ let Some(st) = WarpStyle::from_id(style) else { panic!("{style}") };
+ let p = WarpNet::new(st, bend / 100.0, dh / 100.0, dv / 100.0, w, h, vertical).at(u, v);
+ assert!(p.distance(Point::new(x, y)) < 1e-6, "{style} {bend} {dh} {dv} {vertical} ({u}, {v}): {p:?} vs ({x}, {y})");
+ }
+ }
+
+ /// Arc's edges are concentric circles: at 100 % on a 200 × 100 box the bottom edge is the half
+ /// circle through the bottom corners about the bottom's middle, and the top edge the one 100
+ /// further out. One cubic for a half circle strays up to 1.84 % of the radius from the circle.
+ #[test]
+ fn warp_net_arc_edges_are_concentric_circles() {
+ let net = WarpNet::new(WarpStyle::Arc, 1.0, 0.0, 0.0, 200.0, 100.0, false);
+ let center = Point::new(100.0, 100.0);
+ for i in 0..=20 {
+ let u = f64::from(i) / 20.0;
+ for (v, r) in [(0.0, 200.0), (1.0, 100.0)] {
+ let d = net.at(u, v).distance(center);
+ assert!((d - r).abs() < 0.0184 * r, "u {u}, v {v}: {d} from the center, not {r}");
+ // Its ends and middle lie on the circle.
+ if i % 10 == 0 {
+ assert!((d - r).abs() < 1e-9, "u {u}, v {v}: {d} from the center, not {r}");
+ }
+ }
+ }
+ // Bend 0 leaves the box as it is.
+ for st in [WarpStyle::Arc, WarpStyle::ShellLower, WarpStyle::Bulge, WarpStyle::Twist] {
+ let flat = WarpNet::new(st, 0.0, 0.0, 0.0, 200.0, 100.0, false);
+ assert!(flat.at(0.3, 0.7).distance(Point::new(60.0, 70.0)) < 1e-9, "{st:?}");
+ }
+ }
+
+ /// The horizontal distortion scales each column of the net about its middle (narrowing the left
+ /// side for a positive value), then the vertical one each row (narrowing the top).
+ #[test]
+ fn warp_net_distortion_scales_the_columns_then_the_rows() {
+ let corners = |dh: f64, dv: f64| {
+ let net = WarpNet::new(WarpStyle::Arc, 0.0, dh, dv, 200.0, 100.0, false);
+ [net.at(0.0, 0.0), net.at(1.0, 0.0), net.at(0.0, 1.0), net.at(1.0, 1.0)]
+ };
+ let near = |got: [Point; 4], want: [(f64, f64); 4]| got.iter().zip(want).all(|(p, (x, y))| p.distance(Point::new(x, y)) < 1e-9);
+ assert!(near(corners(0.5, 0.0), [(0.0, 25.0), (200.0, -25.0), (0.0, 75.0), (200.0, 125.0)]), "{:?}", corners(0.5, 0.0));
+ assert!(near(corners(0.0, 0.5), [(50.0, 0.0), (150.0, 0.0), (-50.0, 100.0), (250.0, 100.0)]), "{:?}", corners(0.0, 0.5));
+ // Both coordinates scale: after the columns the top row runs from (0, 15) to (200, -15), and
+ // it then scales by 1.4 about its middle, (100, 0).
+ assert!(near(corners(0.3, -0.4), [(-40.0, 21.0), (240.0, -21.0), (40.0, 91.0), (160.0, 109.0)]), "{:?}", corners(0.3, -0.4));
+ }
+
+ /// Numbers no warp can take still give a finite net: a bend or distortion that isn't a number
+ /// counts as 0, and out of range as its limit; a size that isn't a number as 0.
+ #[test]
+ fn warp_net_takes_any_numbers() {
+ for st in [WarpStyle::Arc, WarpStyle::ShellUpper, WarpStyle::Wave, WarpStyle::Inflate, WarpStyle::Twist] {
+ for (b, dh, w, h) in
+ [(f64::NAN, 0.2, 10.0, 10.0), (5.0, f64::INFINITY, 10.0, 0.0), (-1e300, -3.0, f64::NAN, 1e-300), (1e-300, 0.0, 0.0, 0.0)]
+ {
+ for vertical in [false, true] {
+ let p = WarpNet::new(st, b, dh, dh, w, h, vertical).at(0.3, 0.6);
+ assert!(p.x.is_finite() && p.y.is_finite(), "{st:?} {b} {dh} {w} {h}: {p:?}");
+ }
+ }
+ }
+ let clamped = WarpNet::new(WarpStyle::Flag, 7.0, 0.0, 0.0, 200.0, 100.0, false);
+ assert_eq!(clamped, WarpNet::new(WarpStyle::Flag, 1.0, 0.0, 0.0, 200.0, 100.0, false));
+ }
+
+ /// A box near the largest finite size still warps: Flag on a 1e308 × 100 box moves points only
+ /// up and down, as on a 1 × 1e-306 one scaled up, and on a 1e308 × 1e-300 box keeps the box's
+ /// height. Fisheye at 100 % on a 1.7e308 square, whose net goes past the largest finite number,
+ /// gives finite points inside the box and past it, and the unit square's points scaled up where
+ /// those are finite. Fisheye moves y by the height alone, so on boxes of the largest finite
+ /// width and a height of 1e-300 or 100 every y is the unit square's times the height, also
+ /// where x goes past the largest finite number.
+ #[test]
+ fn warp_net_bends_a_huge_box_without_overflowing() {
+ let w = 1e308;
+ let flag = WarpNet::new(WarpStyle::Flag, 0.5, 0.0, 0.0, w, 100.0, false);
+ let small = WarpNet::new(WarpStyle::Flag, 0.5, 0.0, 0.0, 1.0, 100.0 / w, false);
+ for (u, v) in [(0.0, 0.0), (0.3, 0.6), (0.9, 1.0), (1.0, 0.5)] {
+ let (p, q) = (flag.at(u, v), small.at(u, v));
+ assert!(p.is_finite(), "({u}, {v}): {p:?}");
+ assert!((p.x - u * w).abs() <= 1e-12 * w, "({u}, {v}): {p:?}");
+ assert!((p.y - q.y * w).abs() <= 1e-9 * p.y.abs().max(1.0), "({u}, {v}): {p:?} against {q:?}");
+ }
+ let thin = WarpNet::new(WarpStyle::Flag, 0.5, 0.0, 0.0, w, 1e-300, false);
+ assert_eq!(thin.at(0.0, 1.0), Point::new(0.0, 1e-300));
+ let fisheye = WarpNet::new(WarpStyle::Fisheye, 1.0, 0.0, 0.0, 1.7e308, 1.7e308, false);
+ for (u, v) in [(0.1, 0.1), (0.8, 0.3), (1.5, 0.5), (3.0, 3.0)] {
+ let p = fisheye.at(u, v);
+ assert!(p.is_finite(), "({u}, {v}): {p:?}");
+ }
+ let unit = WarpNet::new(WarpStyle::Fisheye, 1.0, 0.0, 0.0, 1.0, 1.0, false);
+ let near = |a: f64, b: f64| (a - b).abs() <= 1e-12 * b.abs().max(f64::MIN_POSITIVE);
+ let (p, q) = (fisheye.at(0.1, 0.1), unit.at(0.1, 0.1));
+ assert!(near(p.x, q.x * 1.7e308) && near(p.y, q.y * 1.7e308), "{p:?} against {q:?}");
+ // The bottom of a box with a subnormal height stays exactly at that height: the net is
+ // built on the box halved, and the height's lowest bit but one is set.
+ let low = f64::MIN_POSITIVE / 4.0 + f64::from_bits(2);
+ let sub = WarpNet::new(WarpStyle::Fisheye, 1.0, 0.0, 0.0, f64::MAX, low, false).at(0.0, 1.0);
+ assert_eq!(sub.y, low, "{sub:?}");
+ for h in [1e-300, 100.0] {
+ let tall = WarpNet::new(WarpStyle::Fisheye, 1.0, 0.0, 0.0, f64::MAX, h, false);
+ for (u, v) in [(0.1, 0.1), (0.9, 0.4), (0.5, 0.8)] {
+ let (p, q) = (tall.at(u, v), unit.at(u, v));
+ assert!(p.is_finite() && near(p.y, q.y * h), "h {h}, ({u}, {v}): {p:?} against {q:?}");
+ }
+ }
+ }
+
+ /// Content with no width or no height takes the middle of a warp envelope's patch along that
+ /// side: under Arc a vertical line stays vertical, under Bulge a horizontal line stays straight.
+ #[test]
+ fn warp_envelopes_bend_flat_content_as_the_middle_of_the_patch() {
+ let warp = |style: &str| EnvelopeKind::Warp { style: style.into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true, version: WARP_NET };
+ let arc = warp("arc");
+ let map = envelope_mapper(&arc, Rect::new(100.0, 0.0, 100.0, 100.0));
+ for y in [0.0, 30.0, 100.0] {
+ let p = map(Point::new(100.0, y));
+ assert!((p.x - 100.0).abs() <= 1e-9, "{y}: {p:?}");
+ }
+ let bulge = warp("bulge");
+ let map = envelope_mapper(&bulge, Rect::new(0.0, 50.0, 200.0, 50.0));
+ for x in [0.0, 70.0, 200.0] {
+ let p = map(Point::new(x, 50.0));
+ assert!((p.y - 50.0).abs() <= 1e-9, "{x}: {p:?}");
+ }
+ }
+
+ /// A warp envelope's map version: none in a file reads as 0 (the earlier map), 0 is written
+ /// as none, so files keep their bytes, and the nets' version is written.
+ #[test]
+ fn warp_envelopes_write_their_map_version_only_when_it_has_one() {
+ let old: EnvelopeKind = serde_json::from_str(r#"{"type":"warp","style":"arc","bend":20}"#).unwrap();
+ assert!(matches!(old, EnvelopeKind::Warp { version: 0, .. }), "{old:?}");
+ assert!(!serde_json::to_string(&old).unwrap().contains("version"));
+ let new = EnvelopeKind::Warp { style: "arc".into(), bend: 20.0, h: 0.0, v: 0.0, horizontal: true, version: WARP_NET };
+ let text = serde_json::to_string(&new).unwrap();
+ assert!(text.contains(r#""version":1"#), "{text}");
+ assert_eq!(serde_json::from_str::(&text).unwrap(), new);
+ }
use vectorcraft_geom::shapes;
fn rect_node(x: f64, y: f64, w: f64, h: f64, c: Color) -> Arc {
@@ -537,7 +731,7 @@ mod tests {
#[test]
fn an_envelope_maps_from_its_box_with_its_margins() {
let rect = Node::path(NodeId(2), vectorcraft_geom::shapes::rectangle(Rect::new(10.0, 20.0, 110.0, 70.0)), crate::Appearance::default_art());
- let kind = EnvelopeKind::Warp { style: "arc".into(), bend: 0.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = EnvelopeKind::Warp { style: "arc".into(), bend: 0.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let content = [Arc::new(rect)];
let src = |content: &[Arc], frame: Affine, options: EnvelopeOptions| EnvelopeMap::new(content, &kind, frame, options).unwrap().src();
// Top, bottom, left and right.
diff --git a/crates/doc/src/live/envelope.rs b/crates/doc/src/live/envelope.rs
index 8abe961841..f197837020 100644
--- a/crates/doc/src/live/envelope.rs
+++ b/crates/doc/src/live/envelope.rs
@@ -3,6 +3,10 @@ use super::mesh::{GradientMesh, MeshPoint, grid_len, grid_points, surface_of};
use super::{Affine, Arc, Color, Deserialize, Node, NodeId, NodeKind, PathData, Point, Rect, Serialize, Vec2, yes};
use vectorcraft_geom::Homography;
+fn is_zero(n: &u32) -> bool {
+ *n == 0
+}
+
/// How an envelope distorts its content.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "camelCase")]
@@ -19,6 +23,10 @@ pub enum EnvelopeKind {
v: f64,
#[serde(default = "yes")]
horizontal: bool,
+ /// The map the warp draws with: [`WARP_NET`](super::WARP_NET) for its style's Bézier net,
+ /// 0 (as in files from before the version existed) for [`warp_point`](super::warp_point).
+ #[serde(default, skip_serializing_if = "is_zero")]
+ version: u32,
},
/// A `(rows+1)×(cols+1)` grid of points (row-major) the content's bounding box maps onto.
Mesh {
diff --git a/crates/doc/src/live/mesh.rs b/crates/doc/src/live/mesh.rs
index c59374dee9..be865e2769 100644
--- a/crates/doc/src/live/mesh.rs
+++ b/crates/doc/src/live/mesh.rs
@@ -1,5 +1,5 @@
use super::envelope::{EnvelopeKind, H_DOWN, H_LEFT, H_RIGHT, H_UP, envelope_grid, mesh_at};
-use super::warp::{WarpStyle, flatten_subpath, resample, warp_point};
+use super::warp::{WarpNet, WarpStyle, flatten_subpath, resample, uses_net, warp_point};
use super::{
Affine, Anchor, Arc, Color, CubicBez, Deserialize, Node, ParamCurve, PathData, Point, Rect, Serialize, Shape, SubPath, Vec2, fifty, lerp_color,
one,
@@ -1731,10 +1731,19 @@ pub(super) fn grid_eval(rows: usize, cols: usize, pts: &[Point], u: f64, v: f64)
pub(super) fn surface_of<'a>(kind: &'a EnvelopeKind, src: Rect, frame: Affine) -> Box Point + 'a> {
let flat = move |u: f64, v: f64| frame * Point::new(src.x0 + u * src.width(), src.y0 + v * src.height());
match kind {
- EnvelopeKind::Warp { style, bend, h: dh, v: dv, horizontal } => {
+ EnvelopeKind::Warp { style, bend, h: dh, v: dv, horizontal, version } => {
let st = WarpStyle::from_id(style).unwrap_or(WarpStyle::Arc);
let b = bend.clamp(-100.0, 100.0) / 100.0;
let (dh, dv) = (dh.clamp(-100.0, 100.0) / 100.0, dv.clamp(-100.0, 100.0) / 100.0);
+ if uses_net(*version) {
+ let net = WarpNet::new(st, b, dh, dv, src.width(), src.height(), !*horizontal);
+ // Content with no width or no height takes the middle of the patch along that side.
+ let (flat_u, flat_v) = (src.width() <= 0.0, src.height() <= 0.0);
+ return Box::new(move |u: f64, v: f64| {
+ let (u, v) = (if flat_u { 0.5 } else { u }, if flat_v { 0.5 } else { v });
+ frame * (src.origin() + net.at(u, v).to_vec2())
+ });
+ }
let c = src.center();
let (hw, hh) = (src.width() / 2.0, src.height() / 2.0);
let horizontal = *horizontal;
diff --git a/crates/doc/src/live/warp.rs b/crates/doc/src/live/warp.rs
index 6d7392ac5f..08bef91140 100644
--- a/crates/doc/src/live/warp.rs
+++ b/crates/doc/src/live/warp.rs
@@ -109,6 +109,337 @@ pub fn warp_point(style: WarpStyle, b: f64, dh: f64, dv: f64, aspect: f64, x: f6
(x2, y2)
}
+// =====================================================================================
+// Warp nets: each style as one Bézier patch over its box
+// =====================================================================================
+
+/// The `version` a Warp effect's params or a warp envelope carries for the [`WarpNet`] map. With
+/// none (or 0) a warp draws with [`warp_point`], as every warp did before, so saved documents keep
+/// their look; new and imported warps are given this one.
+pub const WARP_NET: u32 = 1;
+
+/// Does a warp of map `version` draw with [`WarpNet`]? A version newer than this build knows draws
+/// with the newest map it has.
+pub fn uses_net(version: u32) -> bool {
+ version >= WARP_NET
+}
+
+/// The map version `v` names when it is one this build draws: a whole number from 0 to
+/// [`WARP_NET`], written as an integer or as a float (`1` or `1.0`).
+pub fn warp_version(v: &serde_json::Value) -> Option {
+ let n = v.as_f64()?;
+ (n.fract() == 0.0 && (0.0..=f64::from(WARP_NET)).contains(&n)).then_some(n as u32)
+}
+
+/// A style's own control net: `rows` × `cols` points (2 to 4 each) of a Bézier patch, row by row
+/// from the top, in the box's coordinates (origin at its top left, y down).
+#[derive(Clone, Copy, Debug)]
+struct Net {
+ rows: usize,
+ cols: usize,
+ p: [[Point; 4]; 4],
+}
+
+impl Net {
+ /// The undistorted box `w` × `h` as a `rows` × `cols` net.
+ fn flat(w: f64, h: f64, rows: usize, cols: usize) -> Self {
+ let mut p = [[Point::ZERO; 4]; 4];
+ for (r, row) in p.iter_mut().enumerate().take(rows) {
+ for (c, q) in row.iter_mut().enumerate().take(cols) {
+ *q = Point::new(w * (c as f64 / (cols - 1) as f64), h * (r as f64 / (rows - 1) as f64));
+ }
+ }
+ Self { rows, cols, p }
+ }
+
+ /// Upside down within a box `h` high: the rows in reverse order, each point mirrored.
+ fn mirrored(self, h: f64) -> Self {
+ let mut out = self;
+ for (to, from) in out.p[..self.rows].iter_mut().zip(self.p[..self.rows].iter().rev()) {
+ for (q, f) in to.iter_mut().zip(from).take(self.cols) {
+ *q = Point::new(f.x, h - f.y);
+ }
+ }
+ out
+ }
+
+ /// Rows and columns exchanged, and x with y: a net made on the box turned on its side.
+ fn transposed(self) -> Self {
+ let mut out = Self { rows: self.cols, cols: self.rows, p: [[Point::ZERO; 4]; 4] };
+ for (r, row) in self.p[..self.rows].iter().enumerate() {
+ for (c, q) in row[..self.cols].iter().enumerate() {
+ out.p[c][r] = Point::new(q.y, q.x);
+ }
+ }
+ out
+ }
+
+ /// Each column scaled about the midpoint of its end points by `1 + a (2t - 1)`, `t` running from
+ /// 0 at the left column to 1 at the right: a horizontal distortion `a` (-1..1).
+ fn distort_columns(&mut self, a: f64) {
+ let (rows, cols) = (self.rows, self.cols);
+ for c in 0..cols {
+ let s = 1.0 + a * (2.0 * c as f64 / (cols - 1) as f64 - 1.0);
+ let mid = half_way(self.p[0][c], self.p[rows - 1][c]);
+ for row in &mut self.p[..rows] {
+ row[c] = mid + (row[c] - mid) * s;
+ }
+ }
+ }
+
+ /// Each row scaled about the midpoint of its end points by `1 + a (2t - 1)`, `t` running from 0
+ /// at the top row to 1 at the bottom: a vertical distortion `a` (-1..1).
+ fn distort_rows(&mut self, a: f64) {
+ let (rows, cols) = (self.rows, self.cols);
+ for (r, row) in self.p[..rows].iter_mut().enumerate() {
+ let s = 1.0 + a * (2.0 * r as f64 / (rows - 1) as f64 - 1.0);
+ let mid = half_way(row[0], row[cols - 1]);
+ for q in &mut row[..cols] {
+ *q = mid + (*q - mid) * s;
+ }
+ }
+ }
+
+ /// The same patch as a bicubic net (degree elevation, which leaves the surface as it is).
+ fn bicubic(self) -> [[Point; 4]; 4] {
+ let rows: Vec<[Point; 4]> = self.p[..self.rows].iter().map(|row| cubic_line(&row[..self.cols])).collect();
+ let mut out = [[Point::ZERO; 4]; 4];
+ for c in 0..4 {
+ let col: Vec = rows.iter().map(|row| row[c]).collect();
+ for (to, q) in out.iter_mut().zip(cubic_line(&col)) {
+ to[c] = q;
+ }
+ }
+ out
+ }
+}
+
+/// The point half way from `a` to `b`, as halves added: two finite points always give a finite one.
+fn half_way(a: Point, b: Point) -> Point {
+ Point::new(0.5 * a.x + 0.5 * b.x, 0.5 * a.y + 0.5 * b.y)
+}
+
+/// A Bézier curve of 2 to 4 control points as the 4 of the same curve's cubic form.
+fn cubic_line(p: &[Point]) -> [Point; 4] {
+ match *p {
+ [a, b] => [a, a.lerp(b, 1.0 / 3.0), a.lerp(b, 2.0 / 3.0), b],
+ [a, b, c] => [a, a.lerp(b, 2.0 / 3.0), c.lerp(b, 2.0 / 3.0), c],
+ [a, b, c, d] => [a, b, c, d],
+ _ => [Point::ZERO; 4],
+ }
+}
+
+/// The handle offsets (along the chord, across it) of a cubic circular arc over a chord `chord`
+/// long that turns through θ = |`b`| × 180°: each handle is 4/3 tan(θ/4) of the radius long, along
+/// the arc's end tangent. With the radius `chord / (2 sin(θ/2))` that length is
+/// `chord / (3 cos²(θ/4))`, which a bend near 0 leaves at a third of the chord.
+fn arc_handles(chord: f64, b: f64) -> (f64, f64) {
+ let th = b.abs().min(1.0) * PI;
+ let len = chord / (3.0 * (th / 4.0).cos().powi(2));
+ (len * (th / 2.0).cos(), len * (th / 2.0).sin())
+}
+
+/// A row from (0, `y`) to (`w`, `y`) bent into a circular arc of |`b`| × 180°: up for a positive
+/// `b` when `up`, down when not, the other way for a negative one.
+fn arc_row(w: f64, y: f64, b: f64, up: bool) -> [Point; 4] {
+ let (ax, ay) = arc_handles(w, b);
+ let dy = if (b > 0.0) == up { -ay } else { ay };
+ [Point::new(0.0, y), Point::new(ax, y + dy), Point::new(w - ax, y + dy), Point::new(w, y)]
+}
+
+/// Arc at bend |`b`| as four rows: the bottom edge bends up through the bottom corners, the top
+/// edge is the arc around the same center `h` further out, and the rows between are spaced evenly
+/// along the radii. The top corners lie `h` out from the bottom ones along the radii, which lean
+/// out by θ/2.
+fn arc_rows(w: f64, h: f64, b: f64) -> [[Point; 4]; 4] {
+ let th = b.abs().min(1.0) * PI;
+ let (s, c) = (th / 2.0).sin_cos();
+ let (tl, tr) = (Point::new(-h * s, h * (1.0 - c)), Point::new(w + h * s, h * (1.0 - c)));
+ let (ax, ay) = arc_handles(tr.x - tl.x, b);
+ let top = [tl, Point::new(tl.x + ax, tl.y - ay), Point::new(tr.x - ax, tr.y - ay), tr];
+ let bottom = arc_row(w, h, b.abs(), true);
+ let mut out = [[Point::ZERO; 4]; 4];
+ for (r, row) in out.iter_mut().enumerate() {
+ for (q, (t, u)) in row.iter_mut().zip(top.iter().zip(bottom)) {
+ *q = t.lerp(u, r as f64 / 3.0);
+ }
+ }
+ out
+}
+
+/// Warp style `style`'s own net at bend `b` (-1..1) over the box `w` × `h`, before distortion.
+/// `vertical`: the net of the box turned on its side, where Rise moves the other half.
+fn style_net(style: WarpStyle, b: f64, w: f64, h: f64, vertical: bool) -> Net {
+ use WarpStyle::*;
+ let two = |top: [Point; 4], bottom: [Point; 4]| {
+ let mut p = [[Point::ZERO; 4]; 4];
+ (p[0], p[1]) = (top, bottom);
+ Net { rows: 2, cols: 4, p }
+ };
+ let flat_row = |y: f64| [0.0, 1.0, 2.0, 3.0].map(|c| Point::new(w * c / 3.0, y));
+ match style {
+ Arc => {
+ let rows = arc_rows(w, h, b);
+ let net = two(rows[0], rows[3]);
+ if b < 0.0 { net.mirrored(h) } else { net }
+ }
+ ArcUpper => two(arc_row(w, 0.0, b, true), flat_row(h)),
+ ArcLower => two(flat_row(0.0), arc_row(w, h, b, false)),
+ Arch => {
+ let top = arc_row(w, 0.0, b, true);
+ two(top, top.map(|q| Point::new(q.x, q.y + h)))
+ }
+ Bulge => two(arc_row(w, 0.0, b, true), arc_row(w, h, b, false)),
+ ShellLower | ShellUpper => {
+ let a = arc_rows(w, h, b);
+ let mut net = Net::flat(w, h, 4, 4);
+ if b >= 0.0 {
+ // The outer arc and the ends of the row inside it, upside down for Shell Lower.
+ net.p[0] = a[0];
+ (net.p[1][0], net.p[1][3]) = (a[1][0], a[1][3]);
+ if style == ShellLower { net.mirrored(h) } else { net }
+ } else {
+ // The inner arc and the ends of the row outside it, upside down for Shell Upper.
+ net.p[3] = a[3];
+ (net.p[2][0], net.p[2][3]) = (a[2][0], a[2][3]);
+ if style == ShellUpper { net.mirrored(h) } else { net }
+ }
+ }
+ Flag | Fish | Rise => {
+ let mut net = Net::flat(w, h, 2, 4);
+ let d = 2.0 * b * h;
+ match style {
+ Flag => {
+ for row in &mut net.p[..2] {
+ (row[1].y, row[2].y) = (row[1].y + d, row[2].y - d);
+ }
+ }
+ Fish => {
+ (net.p[0][1].y, net.p[0][2].y) = (net.p[0][1].y - d, net.p[0][2].y + d);
+ (net.p[1][1].y, net.p[1][2].y) = (net.p[1][1].y + d, net.p[1][2].y - d);
+ }
+ _ => {
+ for row in &mut net.p[..2] {
+ if vertical {
+ (row[2].y, row[3].y) = (row[2].y - d, row[3].y - d);
+ } else {
+ (row[0].y, row[1].y) = (row[0].y + d, row[1].y + d);
+ }
+ }
+ }
+ }
+ net
+ }
+ Wave => {
+ let mut net = Net::flat(w, h, 3, 4);
+ let d = 2.0 * b * h;
+ (net.p[1][1].y, net.p[1][2].y) = (net.p[1][1].y + d, net.p[1][2].y - d);
+ net
+ }
+ Fisheye => {
+ let mut net = Net::flat(w, h, 4, 4);
+ let c = Point::new(w / 2.0, h / 2.0);
+ for row in &mut net.p[1..3] {
+ for q in &mut row[1..3] {
+ *q = c + (*q - c) * (1.0 + 4.0 * b);
+ }
+ }
+ net
+ }
+ Inflate | Squeeze => {
+ let mut net = Net::flat(w, h, 3, 3);
+ let side = if style == Inflate { b * w / 2.0 } else { -b * w / 2.0 };
+ net.p[0][1].y -= b * h / 2.0;
+ net.p[2][1].y += b * h / 2.0;
+ net.p[1][0].x -= side;
+ net.p[1][2].x += side;
+ net
+ }
+ Twist => {
+ // The four inner points move round: clockwise for a positive bend.
+ let mut net = Net::flat(w, h, 4, 4);
+ let (dx, dy) = (b.abs() * w, b.abs() * h);
+ if b >= 0.0 {
+ net.p[1][1].x += dx;
+ net.p[1][2].y += dy;
+ net.p[2][2].x -= dx;
+ net.p[2][1].y -= dy;
+ } else {
+ net.p[1][1].y += dy;
+ net.p[1][2].x -= dx;
+ net.p[2][2].y -= dy;
+ net.p[2][1].x += dx;
+ }
+ net
+ }
+ }
+}
+
+/// A warp as one bicubic Bézier patch over its box: the style's own net at the bend, its columns
+/// scaled by the horizontal distortion and then its rows by the vertical one. Points are in the
+/// box's coordinates (origin at its top left, y down).
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct WarpNet {
+ /// The control points over the box divided by `scale`.
+ net: [[Point; 4]; 4],
+ /// 1, or a power of two when the net over the box itself does not fit in finite numbers.
+ scale: f64,
+ w: f64,
+ h: f64,
+}
+
+impl WarpNet {
+ /// The net of `style` over a box `w` × `h` at bend `b` and distortions `dh` and `dv` (each
+ /// -1..1, clamped); `vertical` bends along the box's height.
+ pub fn new(style: WarpStyle, b: f64, dh: f64, dv: f64, w: f64, h: f64, vertical: bool) -> Self {
+ let unit = |x: f64| if x.is_finite() { x.clamp(-1.0, 1.0) } else { 0.0 };
+ let size = |x: f64| if x.is_finite() { x.max(0.0) } else { 0.0 };
+ let (b, dh, dv, w, h) = (unit(b), unit(dh), unit(dv), size(w), size(h));
+ let build = |w: f64, h: f64| {
+ let mut net = if vertical { style_net(style, b, h, w, true).transposed() } else { style_net(style, b, w, h, false) };
+ net.distort_columns(dh);
+ net.distort_rows(dv);
+ net.bicubic()
+ };
+ // A box near the largest finite size can overflow the net. The net is then built on the box
+ // divided by the smallest power of two that fits (2 to 4096), an exact division for every
+ // side above the subnormal range, and points are multiplied back as they are read.
+ let mut out = Self { net: build(w, h), scale: 1.0, w, h };
+ while out.scale < 4096.0 && !out.net.iter().flatten().all(|q| q.is_finite()) {
+ let scale = out.scale * 2.0;
+ out = Self { net: build(w / scale, h / scale), scale, w, h };
+ }
+ out
+ }
+
+ /// The point at `(u, v)` of the box (0..1 across and down; outside, the patch goes on). A
+ /// coordinate the patch would send past the largest finite number is the box's own, held to
+ /// the finite range.
+ pub fn at(&self, u: f64, v: f64) -> Point {
+ let p = self.at_scaled(u, v);
+ let held = |x: f64| if x.is_nan() { 0.0 } else { x.clamp(-f64::MAX, f64::MAX) };
+ let coord = |x: f64, flat: f64| if (x * self.scale).is_finite() { x * self.scale } else { held(flat) };
+ Point::new(coord(p.x, u * self.w), coord(p.y, v * self.h))
+ }
+
+ /// [`Self::at`] divided by the net's scale.
+ fn at_scaled(&self, u: f64, v: f64) -> Point {
+ let bern = |t: f64| {
+ let s = 1.0 - t;
+ [s * s * s, 3.0 * t * s * s, 3.0 * t * t * s, t * t * t]
+ };
+ let (bu, bv) = (bern(u), bern(v));
+ let (mut x, mut y) = (0.0, 0.0);
+ for (row, wv) in self.net.iter().zip(bv) {
+ for (q, wu) in row.iter().zip(bu) {
+ x += wv * wu * q.x;
+ y += wv * wu * q.y;
+ }
+ }
+ Point::new(x, y)
+ }
+}
+
/// Segment as a cubic; straight lines get handles at 1/3 and 2/3 so a non-linear map bends them.
fn seg_cubic(sp: &SubPath, i: usize) -> CubicBez {
let c = sp.segment(i);
diff --git a/crates/doc/src/style_libs.rs b/crates/doc/src/style_libs.rs
index f64bdb4300..5b90427162 100644
--- a/crates/doc/src/style_libs.rs
+++ b/crates/doc/src/style_libs.rs
@@ -192,8 +192,14 @@ fn round(h: &str, width: f64) -> StrokeLayer {
StrokeLayer { cap: LineCap::Round, join: LineJoin::Round, ..stroke(h, width) }
}
-/// Live effect `id` with `params` (the others keep the effect's defaults).
-fn fx(id: &str, params: Value) -> Effect {
+/// Live effect `id` with `params` (the others keep the effect's defaults). A Warp draws with its
+/// style's Bézier net, as a new Warp does.
+fn fx(id: &str, mut params: Value) -> Effect {
+ if id.starts_with("warp.")
+ && let Value::Object(m) = &mut params
+ {
+ m.entry("version").or_insert(json!(crate::live::WARP_NET));
+ }
Effect { id: id.into(), params, visible: true }
}
@@ -552,6 +558,24 @@ mod tests {
assert_eq!(status_names, ["Poison Tint", "Freeze Edge", "Burn Aura", "Stun Pulse", "Stealth Fade", "Shield Buff"]);
}
+ /// The built-in styles' Warps draw with the map a new Warp takes.
+ #[test]
+ fn builtin_warp_styles_take_the_nets_map() {
+ let mut warps = 0;
+ for b in STYLE_LIBRARIES {
+ let lib = builtin_style_library(b.id).unwrap();
+ for g in &lib.styles {
+ let mut effects: Vec<&Effect> = g.appearance.effects.iter().collect();
+ effects.extend(g.appearance.items.iter().flat_map(|i| i.effects()));
+ for e in effects.into_iter().filter(|e| e.id.starts_with("warp.")) {
+ assert_eq!(e.params["version"], json!(crate::live::WARP_NET), "{} › {}: {}", b.id, g.name, e.id);
+ warps += 1;
+ }
+ }
+ }
+ assert!(warps >= 3, "{warps}");
+ }
+
#[test]
fn vcstyles_round_trip() {
let mut lib = (*builtin_style_library("gradient-finishes").unwrap()).clone();
diff --git a/crates/effects/src/catalog.rs b/crates/effects/src/catalog.rs
index 5c18f2d5f0..a827bea0e2 100644
--- a/crates/effects/src/catalog.rs
+++ b/crates/effects/src/catalog.rs
@@ -112,7 +112,7 @@ fn lengths_of(id: &str) -> Lengths {
}
}
-const WARP_DOC: &str = "{bend: % (-100..100, 50; with a bend or a distortion, placed gradients move and scale from the object's bounds to its warped bounds), horizontal: % distortion (0), vertical: % distortion (0), orientation: \"horizontal\"|\"vertical\"}";
+const WARP_DOC: &str = "{bend: % (-100..100, 50; with a bend or a distortion, placed gradients move and scale from the object's bounds to its warped bounds), horizontal: % distortion (0), vertical: % distortion (0), orientation: \"horizontal\"|\"vertical\", version: 0|1 (the map: 1 bends each style as one Bézier patch over the bounds, which new and imported warps get; 0, or none, is VectorCraft's earlier map, which warps saved without a version keep)}";
const DT: &[&str] = &["Effect", "Distort & Transform"];
diff --git a/crates/effects/src/lib.rs b/crates/effects/src/lib.rs
index 67b4b464fd..6165aa9a9b 100644
--- a/crates/effects/src/lib.rs
+++ b/crates/effects/src/lib.rs
@@ -94,7 +94,7 @@ pub use stylize::{ScribbleSetting, scribble_setting_id, scribble_settings};
pub use svg_filter::SVG_FILTER;
pub use trap::TRAP;
pub use vectorcraft_three_d::Mesh;
-pub use warp::{WarpStyle, warp_point};
+pub use warp::{WARP_NET, WarpNet, WarpStyle, map_version, warp_point, warp_version};
mod catalog;
mod geometry;
diff --git a/crates/effects/src/params.rs b/crates/effects/src/params.rs
index 7785aff335..1e3c8c1d31 100644
--- a/crates/effects/src/params.rs
+++ b/crates/effects/src/params.rs
@@ -31,7 +31,8 @@ pub fn merged_params(id: &str, params: &Value) -> Value {
/// (`lightRotation`, `lightHeight`, `lightBehind`). Scribble took one `variation` before its
/// separate `overlapVariation` and `spacingVariation`. Earlier values (from a file or a script of
/// then) become the current ones that show exactly the same, unless those are given too, which win.
-/// Scribble's angle is also stored above -180° and up to 180° (270° becomes -90°).
+/// Scribble's angle is also stored above -180° and up to 180° (270° becomes -90°), and a Warp's
+/// map `version` given as a whole float is stored as an integer.
pub fn upgrade_params(id: &str, params: &Value) -> Value {
match params {
Value::Object(m) => {
@@ -39,6 +40,7 @@ pub fn upgrade_params(id: &str, params: &Value) -> Value {
upgrade_perspective(id, &mut m);
upgrade_light(id, &mut m);
upgrade_scribble(id, &mut m);
+ upgrade_warp_version(id, &mut m);
Value::Object(m)
}
other => other.clone(),
@@ -71,6 +73,19 @@ fn upgrade_perspective(id: &str, m: &mut Map) {
}
}
+/// A Warp's map `version` given as a whole float (`1.0`) is stored as the integer.
+fn upgrade_warp_version(id: &str, m: &mut Map) {
+ if !id.starts_with("warp.") {
+ return;
+ }
+ if let Some(v) = m.get_mut("version")
+ && !v.is_u64()
+ && let Some(n) = crate::warp::warp_version(v)
+ {
+ *v = json!(n);
+ }
+}
+
fn upgrade_scribble(id: &str, m: &mut Map) {
if id != "stylize.scribble" {
return;
@@ -91,7 +106,15 @@ pub fn new_effect(id: &str, params: &Value) -> Option {
if !catalog_index().contains_key(id) {
vectorcraft_plugins::effect::installed(id)?;
}
- Some(Effect { id: id.to_string(), params: merged_params(id, params), visible: true })
+ let mut params = merged_params(id, params);
+ // A new Warp takes its style's Bézier net unless a map is given; the catalog's defaults carry
+ // no version, so warps saved without one keep the earlier map.
+ if id.starts_with("warp.")
+ && let Value::Object(m) = &mut params
+ {
+ m.entry("version").or_insert(json!(crate::warp::WARP_NET));
+ }
+ Some(Effect { id: id.to_string(), params, visible: true })
}
/// Scale the distance parameters of `e` by `s` (Scale Strokes & Effects; see
diff --git a/crates/effects/src/tests.rs b/crates/effects/src/tests.rs
index 532251bd73..adc518043e 100644
--- a/crates/effects/src/tests.rs
+++ b/crates/effects/src/tests.rs
@@ -209,6 +209,57 @@ fn warp_arc_bends_the_top_edge() {
assert!(b.x0 < -1.0 || b.x1 > 101.0, "{b:?}");
}
+/// A Warp of `version` 1 bends its bounds as its style's Bézier net; one without a version, as
+/// saved before the version existed, draws as it always did. Flag at 60 % on a 200 × 100 box: the
+/// net moves the top edge up to 6 × 0.6 × 100 × max u(1 - u)(1 - 2u) = 34.64 out, the earlier map
+/// moves it 0.6 × 25 = 15.
+#[test]
+fn a_warp_draws_with_the_map_its_version_names() {
+ let rect = shapes::rectangle(Rect::new(10.0, 20.0, 210.0, 120.0));
+ // u(1 - u)(1 - 2u) peaks at √3 / 18.
+ let peak = 360.0 * 3f64.sqrt() / 18.0;
+ for (version, out) in [(json!(1), peak), (json!(null), 15.0), (json!(0), 15.0)] {
+ let b = run("warp.flag", json!({"bend": 60, "version": version}), &rect).bounds().unwrap();
+ assert!(close(b.y0, 20.0 - out, 0.1) && close(b.y1, 120.0 + out, 0.1), "version {version}: {b:?}");
+ assert!(close(b.x0, 10.0, 1e-9) && close(b.x1, 210.0, 1e-9), "version {version}: {b:?}");
+ }
+}
+
+/// A straight line has a box with no width or no height, and the net bends it as the middle of
+/// the patch along that side: under Arc a vertical line stays vertical, and under Bulge, Fisheye,
+/// Inflate and Squeeze a horizontal line stays straight.
+#[test]
+fn a_warp_bends_a_flat_box_as_the_middle_of_its_patch() {
+ let anchors = |p: &PathData| p.subpaths.iter().flat_map(|s| s.anchors.clone()).collect::>();
+ let vertical = shapes::line(Point::new(100.0, 0.0), Point::new(100.0, 100.0));
+ let out = run("warp.arc", json!({"bend": 50, "version": 1}), &vertical);
+ assert!(anchors(&out).iter().all(|a| close(a.p.x, 100.0, 1e-9) && close(a.h_in.x, 100.0, 1e-9) && close(a.h_out.x, 100.0, 1e-9)), "{out:?}");
+ let horizontal = shapes::line(Point::new(0.0, 50.0), Point::new(200.0, 50.0));
+ for style in ["bulge", "fisheye", "inflate", "squeeze"] {
+ let out = run(&format!("warp.{style}"), json!({"bend": 50, "version": 1}), &horizontal);
+ assert!(
+ anchors(&out).iter().all(|a| close(a.p.y, 50.0, 1e-9) && close(a.h_in.y, 50.0, 1e-9) && close(a.h_out.y, 50.0, 1e-9)),
+ "{style}: {out:?}"
+ );
+ }
+}
+
+/// A new Warp takes the nets' version unless one is given, and the catalog's defaults carry none,
+/// so a saved warp's params don't gain one.
+#[test]
+fn new_warps_take_the_nets_version() {
+ for (s, _) in WARP_STYLES {
+ let id = format!("warp.{s}");
+ let Some(e) = crate::new_effect(&id, &json!({"bend": 20})) else { panic!("{id}") };
+ assert_eq!(e.params["version"], json!(crate::WARP_NET), "{id}");
+ let Some(e) = crate::new_effect(&id, &json!({"version": 0})) else { panic!("{id}") };
+ assert_eq!(e.params["version"], json!(0), "{id}");
+ assert!(crate::merged_params(&id, &json!({"bend": 20})).get("version").is_none(), "{id}");
+ }
+ let Some(e) = crate::new_effect("distort.twist", &json!({})) else { panic!("twist") };
+ assert!(e.params.get("version").is_none());
+}
+
#[test]
fn transform_copies_and_move() {
let out = run("distort.transform", json!({"moveH": 20, "copies": 3}), &square());
diff --git a/crates/effects/src/warp.rs b/crates/effects/src/warp.rs
index 84f196a8b4..f607abacdf 100644
--- a/crates/effects/src/warp.rs
+++ b/crates/effects/src/warp.rs
@@ -1,14 +1,22 @@
//! Warp effects: 15 envelope styles plus horizontal/vertical perspective distortion.
//!
-//! Each style is a map on normalised box coordinates (x, y) ∈ [-1, 1]² (y down). The path is
-//! split into short pieces whose control points are mapped (see `map_nonlinear`).
+//! A warp with `version` [`WARP_NET`] is its style's Bézier patch over the box ([`WarpNet`]);
+//! one without (saved before the version existed) is a map on normalized box coordinates
+//! (x, y) ∈ [-1, 1]² (y down), [`warp_point`]. The path is split into short pieces whose control
+//! points are mapped (see `map_nonlinear`).
use serde_json::Value;
use vectorcraft_geom::{PathData, Point, Rect};
use crate::util::{map_nonlinear_within, num, text};
-pub use vectorcraft_doc::live::{WarpStyle, warp_point};
+pub use vectorcraft_doc::live::{WARP_NET, WarpNet, WarpStyle, uses_net, warp_point, warp_version};
+
+/// The map version warp params `p` ask for: their `version`, 0 (the first map) when absent.
+pub fn map_version(p: &Value) -> u32 {
+ let v = num(p, "version", 0.0);
+ if v.is_finite() && v >= 0.0 { v.min(f64::from(u32::MAX)) as u32 } else { 0 }
+}
/// Apply a warp to `path` using box `b`, making at most `max` anchors ([`map_nonlinear_within`]).
pub fn warp(path: &PathData, b: Rect, style: WarpStyle, p: &Value, max: usize) -> PathData {
@@ -16,6 +24,17 @@ pub fn warp(path: &PathData, b: Rect, style: WarpStyle, p: &Value, max: usize) -
let dh = num(p, "horizontal", 0.0).clamp(-100.0, 100.0) / 100.0;
let dv = num(p, "vertical", 0.0).clamp(-100.0, 100.0) / 100.0;
let vertical = text(p, "orientation", "horizontal").eq_ignore_ascii_case("vertical");
+ let piece = b.width().hypot(b.height()) / 24.0;
+ if uses_net(map_version(p)) {
+ let net = WarpNet::new(style, bend, dh, dv, b.width(), b.height(), vertical);
+ let (w, h) = (b.width(), b.height());
+ // A box with no width or no height takes the middle of the patch along that side.
+ let f = |q: Point| {
+ let (u, v) = (if w > 0.0 { (q.x - b.x0) / w } else { 0.5 }, if h > 0.0 { (q.y - b.y0) / h } else { 0.5 });
+ b.origin() + net.at(u, v).to_vec2()
+ };
+ return map_nonlinear_within(path, piece, max, f);
+ }
let c = b.center();
let hw = (b.width() / 2.0).max(1e-9);
let hh = (b.height() / 2.0).max(1e-9);
@@ -29,17 +48,17 @@ pub fn warp(path: &PathData, b: Rect, style: WarpStyle, p: &Value, max: usize) -
};
Point::new(c.x + x2 * hw, c.y + y2 * hh)
};
- let piece = b.width().hypot(b.height()) / 24.0;
map_nonlinear_within(path, piece, max, f)
}
/// Does warp effect `id` with params `p` move any point? Every style leaves the box as it is with
-/// no bend and no distortion, and Arc (`warp.arc`) takes a bend under 0.0001 % as none: the
-/// threshold must match the one in [`warp_point`]'s Arc case (`warp_bends_when_the_warp_moves_the_outline`
-/// tests both sides of it).
+/// no bend and no distortion. With the first map, Arc (`warp.arc`) takes a bend under 0.0001 % as
+/// none: the threshold must match the one in [`warp_point`]'s Arc case
+/// (`warp_bends_when_the_warp_moves_the_outline` tests both sides of it). With [`WarpNet`] any
+/// bend moves the outline.
pub(crate) fn bends(id: &str, p: &Value) -> bool {
let share = |key: &str, default: f64| num(p, key, default).clamp(-100.0, 100.0) / 100.0;
let bend = share("bend", 50.0);
- let bent = if id == "warp.arc" { bend.abs() >= 1e-6 } else { bend != 0.0 };
+ let bent = if id == "warp.arc" && !uses_net(map_version(p)) { bend.abs() >= 1e-6 } else { bend != 0.0 };
bent || share("horizontal", 0.0) != 0.0 || share("vertical", 0.0) != 0.0
}
diff --git a/crates/engine/src/cmd/live/commands.rs b/crates/engine/src/cmd/live/commands.rs
index b69b4e869d..005d892639 100644
--- a/crates/engine/src/cmd/live/commands.rs
+++ b/crates/engine/src/cmd/live/commands.rs
@@ -136,7 +136,7 @@ pub fn specs() -> Vec {
"Make with Warp…",
["Object", "Envelope Distort"],
Some("Cmd+Alt+Shift+W"),
- "{ids?, style?: arc|arcLower|arcUpper|arch|bulge|shellLower|shellUpper|flag|wave|fish|rise|fisheye|inflate|squeeze|twist (arc), bend?: % -100..100 (50), h?: horizontal distortion % -100..100 (0), v?: vertical distortion % (0), horizontal?: bool (true) | orientation?: horizontal|vertical, horizontalDistortion?: as h, verticalDistortion?: as v} envelope the selected objects with a warp (Envelope Options from object.envelope.options with nothing selected; type maps from its glyph outline bounds) → {id}",
+ "{ids?, style?: arc|arcLower|arcUpper|arch|bulge|shellLower|shellUpper|flag|wave|fish|rise|fisheye|inflate|squeeze|twist (arc), bend?: % -100..100 (50), h?: horizontal distortion % -100..100 (0), v?: vertical distortion % (0), horizontal?: bool (true) | orientation?: horizontal|vertical, horizontalDistortion?: as h, verticalDistortion?: as v, version?: 0|1 (1: each style bends the bounds as one Bézier patch; 0: VectorCraft's earlier map)} envelope the selected objects with a warp (Envelope Options from object.envelope.options with nothing selected; type maps from its glyph outline bounds) → {id}",
has_selection,
env_make_warp
),
@@ -163,7 +163,7 @@ pub fn specs() -> Vec {
"Reset with Warp…",
["Object", "Envelope Distort"],
None,
- "{style?, bend?, h?, v?, horizontal? | orientation? (as makeWithWarp; unset: the envelope's current warp, else arc 50 %), horizontalDistortion?: as h, verticalDistortion?: as v} make the selected envelopes warp envelopes, keeping their content",
+ "{style?, bend?, h?, v?, horizontal? | orientation? (as makeWithWarp; unset: the envelope's current warp, else arc 50 %), horizontalDistortion?: as h, verticalDistortion?: as v, version?: as makeWithWarp (unset: a warp envelope's own, else 1)} make the selected envelopes warp envelopes, keeping their content",
has_envelope,
env_reset_warp
),
@@ -181,7 +181,7 @@ pub fn specs() -> Vec {
"Envelope Info",
[],
None,
- "{} the selected envelope's settings, or with none selected the defaults new envelopes get → {id: n|null, type: warp|mesh|topObject, style, bend, h, v, horizontal, rows, cols, fidelity, antiAlias, preserveShape: clippingMask|transparency, distortAppearance, distortLinearGradients, distortPatternFills, boundsMargin?: [top, bottom, left, right] (shares of the content's height and width, reported only when not zero: with distortAppearance, how far the box the content maps from reaches past its geometric bounds), editing}",
+ "{} the selected envelope's settings, or with none selected the defaults new envelopes get → {id: n|null, type: warp|mesh|topObject, style, bend, h, v, horizontal, version (a warp's map: 1, each style as one Bézier patch; 0, the earlier map), rows, cols, fidelity, antiAlias, preserveShape: clippingMask|transparency, distortAppearance, distortLinearGradients, distortPatternFills, boundsMargin?: [top, bottom, left, right] (shares of the content's height and width, reported only when not zero: with distortAppearance, how far the box the content maps from reaches past its geometric bounds), editing}",
has_doc,
env_info
),
@@ -199,7 +199,7 @@ pub fn specs() -> Vec {
"Envelope Options…",
["Object", "Envelope Distort"],
None,
- "{fidelity?: 0..100, antiAlias?: bool, preserveShape?: clippingMask|transparency, distortAppearance?: bool, distortLinearGradients?: bool, distortPatternFills?: bool (the last two work with distortAppearance; on an envelope with boundsMargin, distortAppearance also switches the content between the box with the margins and its geometric box), style?, bend?, h?, v?, horizontal? (warp envelopes), horizontalDistortion?: as h, verticalDistortion?: as v, orientation?: horizontal|vertical} set the selected envelopes' options; with no envelope selected, the options new envelopes get (see object.envelope.info)",
+ "{fidelity?: 0..100, antiAlias?: bool, preserveShape?: clippingMask|transparency, distortAppearance?: bool, distortLinearGradients?: bool, distortPatternFills?: bool (the last two work with distortAppearance; on an envelope with boundsMargin, distortAppearance also switches the content between the box with the margins and its geometric box), style?, bend?, h?, v?, horizontal? (warp envelopes), horizontalDistortion?: as h, verticalDistortion?: as v, orientation?: horizontal|vertical, version?: 0|1 (warp envelopes' map, as makeWithWarp)} set the selected envelopes' options; with no envelope selected, the options new envelopes get (see object.envelope.info)",
has_doc,
env_options
),
diff --git a/crates/engine/src/cmd/live/envelope.rs b/crates/engine/src/cmd/live/envelope.rs
index 1aceb49b54..a91fd8edd0 100644
--- a/crates/engine/src/cmd/live/envelope.rs
+++ b/crates/engine/src/cmd/live/envelope.rs
@@ -13,9 +13,14 @@ const WARP_NUMBERS: &[&str] = &["bend", "h", "v", "horizontalDistortion", "verti
fn warp_kind(p: &Value, cmd: &str, cur: Option<&EnvelopeKind>) -> Result {
check_numbers(p, WARP_NUMBERS, cmd)?;
- let (mut style, mut bend, mut h, mut v, mut horizontal) = ("arc".to_string(), 50.0, 0.0, 0.0, true);
- if let Some(EnvelopeKind::Warp { style: s0, bend: b0, h: h0, v: v0, horizontal: z0 }) = cur {
- (style, bend, h, v, horizontal) = (s0.clone(), *b0, *h0, *v0, *z0);
+ // A new warp takes its style's Bézier net; an edited one keeps the map it has unless `version`
+ // names one.
+ let (mut style, mut bend, mut h, mut v, mut horizontal, mut version) = ("arc".to_string(), 50.0, 0.0, 0.0, true, live::WARP_NET);
+ if let Some(EnvelopeKind::Warp { style: s0, bend: b0, h: h0, v: v0, horizontal: z0, version: n0 }) = cur {
+ (style, bend, h, v, horizontal, version) = (s0.clone(), *b0, *h0, *v0, *z0, *n0);
+ }
+ if let Some(n) = p.get("version") {
+ version = live::warp_version(n).ok_or_else(|| bad(cmd, format!("`version` must be 0 or {}", live::WARP_NET)))?;
}
if let Some(s) = text_param(p, "style", cmd)? {
let s = s.strip_prefix("warp.").unwrap_or(s);
@@ -32,7 +37,7 @@ fn warp_kind(p: &Value, cmd: &str, cur: Option<&EnvelopeKind>) -> Result o == "horizontal",
None => given,
};
- Ok(EnvelopeKind::Warp { style, bend, h, v, horizontal })
+ Ok(EnvelopeKind::Warp { style, bend, h, v, horizontal, version })
}
/// The options and fidelity new envelopes get (Envelope Options with no envelope selected).
@@ -206,8 +211,8 @@ pub(super) fn env_info(s: &mut Session, _: &Value) -> Result {
return Ok(envelope_options_json(json!({ "id": null }), &options, fidelity));
};
let v = match &**kind {
- EnvelopeKind::Warp { style, bend, h, v, horizontal } => {
- json!({"type": "warp", "style": style, "bend": bend, "h": h, "v": v, "horizontal": horizontal})
+ EnvelopeKind::Warp { style, bend, h, v, horizontal, version } => {
+ json!({"type": "warp", "style": style, "bend": bend, "h": h, "v": v, "horizontal": horizontal, "version": version})
}
EnvelopeKind::Mesh { rows, cols, .. } => json!({"type": "mesh", "rows": rows, "cols": cols}),
EnvelopeKind::TopObject { .. } => json!({"type": "topObject"}),
diff --git a/crates/engine/src/cmd/params.rs b/crates/engine/src/cmd/params.rs
index 4b8ae5d2be..60fa90c32c 100644
--- a/crates/engine/src/cmd/params.rs
+++ b/crates/engine/src/cmd/params.rs
@@ -317,6 +317,14 @@ pub fn check_effect_params(id: &str, effect: &str, params: &Value) -> Result<()>
if effect == vectorcraft_render::effects::SVG_FILTER && given.contains_key("name") && !given.contains_key("xml") {
return Err(bad(id, "an SVG filter is named by its id: give `xml` with `name`"));
}
+ // A Warp's map is one this build draws: 0, the earlier map, or its style's Bézier net.
+ let newest = vectorcraft_render::effects::WARP_NET;
+ if effect.starts_with("warp.")
+ && let Some(v) = given.get("version")
+ && vectorcraft_render::effects::warp_version(v).is_none()
+ {
+ return Err(bad(id, format!("`version` must be 0 or {newest}")));
+ }
check_effect_color(id, effect, params)?;
check_effect_channel(id, effect, params)
}
diff --git a/crates/engine/src/tests/effectedit.rs b/crates/engine/src/tests/effectedit.rs
index 2d10c3f5d9..34e01bf31e 100644
--- a/crates/engine/src/tests/effectedit.rs
+++ b/crates/engine/src/tests/effectedit.rs
@@ -147,3 +147,37 @@ fn show_all_hidden_attributes() {
s.execute("edit.undo", &json!({})).unwrap();
assert!(node(&s, id).appearance.has_hidden());
}
+
+/// A Warp applied now takes its style's Bézier net (`version` 1) unless a map is given, an edit
+/// keeps the map the effect has (one saved before the version existed keeps the earlier map), and
+/// a map this build doesn't draw is refused.
+#[test]
+fn warps_keep_the_map_their_version_names() {
+ let (mut s, id) = session_with_rect();
+ let version = |s: &Session| node(s, id).appearance.effects[0].params.get("version").cloned();
+ run(&mut s, "effect.apply", json!({"effect": "warp.flag", "params": {"bend": 40}}));
+ assert_eq!(version(&s), Some(json!(vectorcraft_doc::live::WARP_NET)));
+ run(&mut s, "effect.setParams", json!({"index": 0, "params": {"bend": 20}, "warpStyle": "arc"}));
+ assert_eq!(version(&s), Some(json!(vectorcraft_doc::live::WARP_NET)));
+ // As a file saved before the version existed gives it.
+ let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
+ if let Some(Value::Object(p)) = doc.node_mut(id).and_then(|n| n.appearance.effects.first_mut()).map(|e| &mut e.params) {
+ p.remove("version");
+ }
+ run(&mut s, "effect.setParams", json!({"index": 0, "params": {"bend": 10, "horizontal": 20}}));
+ assert_eq!(version(&s), None);
+ run(&mut s, "effect.setParams", json!({"index": 0, "params": {"version": 1}}));
+ assert_eq!(version(&s), Some(json!(1)));
+ run(&mut s, "effect.apply", json!({"effect": "warp.arc", "params": {"version": 0}}));
+ assert_eq!(node(&s, id).appearance.effects[1].params["version"], json!(0));
+ // A whole number given as a float is that version.
+ run(&mut s, "effect.setParams", json!({"index": 1, "params": {"version": 1.0}}));
+ assert_eq!(node(&s, id).appearance.effects[1].params["version"], json!(1));
+ run(&mut s, "effect.setParams", json!({"index": 1, "params": {"version": 0.0}}));
+ assert_eq!(node(&s, id).appearance.effects[1].params["version"], json!(0));
+ for bad in [json!(2), json!(-1), json!(0.5), json!("1")] {
+ assert!(s.execute("effect.apply", &json!({"effect": "warp.arc", "params": {"version": bad}})).is_err(), "{bad}");
+ assert!(s.execute("effect.setParams", &json!({"index": 0, "params": {"version": bad}})).is_err(), "{bad}");
+ }
+ assert_eq!(node(&s, id).appearance.effects.len(), 2);
+}
diff --git a/crates/engine/src/tests/envelope.rs b/crates/engine/src/tests/envelope.rs
index e4d030d387..4ffd7a361a 100644
--- a/crates/engine/src/tests/envelope.rs
+++ b/crates/engine/src/tests/envelope.rs
@@ -123,6 +123,51 @@ fn reset_with_warp_and_mesh_switch_the_kind_and_keep_the_content() {
assert!(s.execute("object.envelope.resetWithMesh", &json!({})).is_err());
}
+/// A new warp envelope bends with its style's Bézier net (`version` [`live::WARP_NET`]) and keeps
+/// it through Reset with Warp. One saved before the version existed keeps the earlier map when its
+/// warp or its options change.
+#[test]
+fn new_warp_envelopes_take_the_net_and_saved_ones_keep_their_map() {
+ // The surface point a quarter of the way along the top edge.
+ let quarter = |s: &Session, e| live::EnvelopeMap::of(&node(s, e)).unwrap().surface_mesh(4, 4, vectorcraft_color::Color::BLACK).points[1].p;
+ let at = |x, y| vectorcraft_geom::Point::new(x, y);
+ let mut s = session();
+ let (_, e) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "flag", "bend": 40}));
+ assert!(matches!(kind(&s, e), EnvelopeKind::Warp { version: live::WARP_NET, .. }), "{:?}", kind(&s, e));
+ assert_eq!(s.execute("object.envelope.info", &json!({})).unwrap()["version"], json!(live::WARP_NET));
+ // Flag moves the top edge 6 × bend × height × u(1 - u)(1 - 2u) down at u: 22.5 at u = 1/4.
+ assert!(quarter(&s, e).distance(at(150.0, 122.5)) < 1e-9, "{:?}", quarter(&s, e));
+ s.execute("object.envelope.resetWithWarp", &json!({"bend": -40})).unwrap();
+ assert!(matches!(kind(&s, e), EnvelopeKind::Warp { version: live::WARP_NET, .. }), "{:?}", kind(&s, e));
+ assert!(quarter(&s, e).distance(at(150.0, 77.5)) < 1e-9, "{:?}", quarter(&s, e));
+ // As a file saved before the version existed gives it.
+ let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
+ if let Some(NodeKind::Envelope { kind, .. }) = doc.node_mut(e).map(|n| &mut n.kind)
+ && let EnvelopeKind::Warp { version, .. } = &mut **kind
+ {
+ *version = 0;
+ }
+ s.execute("object.envelope.options", &json!({"fidelity": 75})).unwrap();
+ s.execute("object.envelope.resetWithWarp", &json!({"bend": 40})).unwrap();
+ assert!(matches!(kind(&s, e), EnvelopeKind::Warp { version: 0, .. }), "{:?}", kind(&s, e));
+ // The earlier map's flag: half the bend times sin(π x), x = -1/2 here, in half heights.
+ assert!(quarter(&s, e).distance(at(150.0, 90.0)) < 1e-9, "{:?}", quarter(&s, e));
+ // `version` moves a warp to a map, and a new warp can take the earlier one.
+ s.execute("object.envelope.options", &json!({"version": 1.0})).unwrap();
+ assert!(matches!(kind(&s, e), EnvelopeKind::Warp { version: live::WARP_NET, .. }), "{:?}", kind(&s, e));
+ assert!(quarter(&s, e).distance(at(150.0, 122.5)) < 1e-9, "{:?}", quarter(&s, e));
+ s.execute("object.envelope.resetWithWarp", &json!({"version": 0})).unwrap();
+ assert!(matches!(kind(&s, e), EnvelopeKind::Warp { version: 0, .. }), "{:?}", kind(&s, e));
+ let (_, old) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "flag", "bend": 40, "version": 0}));
+ assert!(matches!(kind(&s, old), EnvelopeKind::Warp { version: 0, .. }), "{:?}", kind(&s, old));
+ for bad in [json!(2), json!(-1), json!(0.5), json!("1"), json!(null)] {
+ for cmd in ["object.envelope.makeWithWarp", "object.envelope.resetWithWarp", "object.envelope.options"] {
+ let r = s.execute(cmd, &json!({"version": bad}));
+ assert!(r.as_ref().is_err_and(|e| e.to_string().contains("`version` must be 0 or 1")), "{cmd} {bad}: {r:?}");
+ }
+ }
+}
+
#[test]
fn release_gives_back_the_warp_shape_as_a_mesh_and_keeps_the_transparency() {
let mut s = session();
@@ -141,9 +186,9 @@ fn release_gives_back_the_warp_shape_as_a_mesh_and_keeps_the_transparency() {
let content = node(&s, a);
assert_eq!((content.opacity, content.blend, content.extras().mask.is_some()), (0.4, BlendMode::Multiply, true), "the content keeps the look");
let NodeKind::Mesh(m) = node(&s, ids[1]).kind else { panic!("the warp's shape comes back as a mesh") };
- // The mesh follows the arc: its outline reaches below the content's bottom edge at the sides.
+ // The mesh follows the arc: its top corners swing out past the content's sides and up.
let b = m.outline().bounds().unwrap();
- assert!(b.y1 > 201.0, "{b:?}");
+ assert!(b.x0 < 99.0 && b.x1 > 301.0 && b.y0 < 99.0, "{b:?}");
assert_eq!(s.doc().unwrap().selection.objects, ids);
}
diff --git a/crates/engine/src/tests/envelope_distort.rs b/crates/engine/src/tests/envelope_distort.rs
index 8a1e46c68a..2dbef41238 100644
--- a/crates/engine/src/tests/envelope_distort.rs
+++ b/crates/engine/src/tests/envelope_distort.rs
@@ -286,17 +286,18 @@ fn symbols_bend_with_the_envelope() {
let e = arch(&mut s, 60.0, json!({}));
let pts = anchors(&evaluated(&s, e));
assert!(pts.iter().any(|p| p.y < 90.0), "the symbol's art rose in the middle");
- // Editing the symbol redraws the envelope (the renderer's cache follows the symbol's art).
+ // Editing the symbol redraws the envelope (the renderer's cache follows the symbol's art). The
+ // arch lifts the middle of the 100..200 box by about 51, so (200, 120) is inside it.
let mut r = vectorcraft_render::Renderer::new();
let region = Rect::new(0.0, 0.0, 400.0, 300.0);
- assert!(r.render_region(&s.doc().unwrap().doc, region, 1.0, true).pixel(200, 150)[1] < 60);
+ assert!(r.render_region(&s.doc().unwrap().doc, region, 1.0, true).pixel(200, 120)[1] < 60);
s.edit("edit symbol", |d, _| {
let art = Node::path(NodeId(0), shapes::rectangle(Rect::new(-10.0, -10.0, -8.0, -8.0)), Default::default());
d.symbols[0].art = Arc::new(art);
Ok(())
})
.unwrap();
- assert!(r.render_region(&s.doc().unwrap().doc, region, 1.0, true).pixel(200, 150)[1] > 200);
+ assert!(r.render_region(&s.doc().unwrap().doc, region, 1.0, true).pixel(200, 120)[1] > 200);
}
fn strokes(nodes: &[Node]) -> usize {
diff --git a/crates/engine/src/tests/live.rs b/crates/engine/src/tests/live.rs
index 9fc790efa2..33cc5749e1 100644
--- a/crates/engine/src/tests/live.rs
+++ b/crates/engine/src/tests/live.rs
@@ -483,8 +483,8 @@ fn envelope_warp_make_and_content_stays_inside_bounds() {
let pts = all_anchors(&out);
assert!(pts.len() > 4, "curves are subdivided");
assert!(pts.iter().all(|p| b.contains(*p)), "{b:?}");
- // It really is bent: the sides moved down.
- assert!(pts.iter().any(|p| p.y > 201.0));
+ // It really is bent: the top corners swung out past the sides.
+ assert!(pts.iter().any(|p| p.x < 99.0) && pts.iter().any(|p| p.x > 301.0));
}
#[test]
diff --git a/crates/eps/src/ai_editing/tests.rs b/crates/eps/src/ai_editing/tests.rs
index a99646c9c2..6549004c7d 100644
--- a/crates/eps/src/ai_editing/tests.rs
+++ b/crates/eps/src/ai_editing/tests.rs
@@ -6627,6 +6627,7 @@ fn every_effect_a_graphic_style_holds_is_read_back() {
for id in &ids {
cases.push((id, json!({"bend": 30.0, "horizontal": -10.0, "vertical": 20.0, "orientation": "vertical"})));
cases.push((id, json!({"bend": -30.0, "horizontal": 0.0, "vertical": 0.0, "orientation": "horizontal"})));
+ cases.push((id, json!({"bend": 45.0, "horizontal": 15.0, "vertical": -5.0, "orientation": "horizontal", "version": 1})));
}
for (id, params) in cases {
let effect = fx(id, params.clone());
@@ -6643,6 +6644,10 @@ fn every_effect_a_graphic_style_holds_is_read_back() {
let got = &back.graphic_styles[0].appearance.effects;
assert_eq!(got.len(), 1, "{id} {params}");
assert_eq!(got[0].id, effect.id);
+ // A warp read from a file bends as its style's Bézier net.
+ if id.starts_with("warp.") {
+ assert_eq!(got[0].params["version"], json!(vectorcraft_doc::live::WARP_NET), "{id} {params}");
+ }
let (g, w) = (vectorcraft_effects::merged_params(&got[0].id, &got[0].params), vectorcraft_effects::merged_params(&effect.id, &effect.params));
for (key, value) in w.as_object().unwrap() {
// Random isn't written, and a style with it isn't read; its seed is the default.
@@ -6663,6 +6668,19 @@ fn every_effect_a_graphic_style_holds_is_read_back() {
}
}
}
+ // A warp saved before the map version existed is written with its settings too, and reads back on
+ // the nets' map.
+ let old = vectorcraft_doc::Effect { id: "warp.flag".into(), params: json!({"bend": 40.0, "horizontal": 10.0}), visible: true };
+ let mut doc = Document::new(200.0, 100.0);
+ let mut g = vectorcraft_doc::GraphicStyle::new("Old", Appearance { effects: vec![old], ..Appearance::basic(black_fill(), Paint::None, 0.0) });
+ g.id = 3;
+ *doc.graphic_styles = vec![g];
+ let out = export_ai_editing(&doc, &opts()).unwrap();
+ assert!(!out.warnings.iter().any(|w| w == writer::PANEL_STYLES), "{:?}", out.warnings);
+ let back = read_back(&doc);
+ let [warp] = back.graphic_styles[0].appearance.effects.as_slice() else { panic!("{:?}", back.graphic_styles) };
+ assert_eq!((warp.id.as_str(), &warp.params["bend"], &warp.params["horizontal"]), ("warp.flag", &json!(40.0), &json!(10.0)));
+ assert_eq!(warp.params["version"], json!(vectorcraft_doc::live::WARP_NET));
// A Zig Zag with its 0 to 1 settings written under the size's own key, and a turn in radians.
let mut doc = Document::new(200.0, 100.0);
let effects = vec![
diff --git a/crates/eps/src/ai_editing/writer/styles.rs b/crates/eps/src/ai_editing/writer/styles.rs
index c4ae9fda3b..c28c538bcf 100644
--- a/crates/eps/src/ai_editing/writer/styles.rs
+++ b/crates/eps/src/ai_editing/writer/styles.rs
@@ -889,9 +889,16 @@ pub(in crate::ai_editing) fn same_appearance(a: &Appearance, b: &Appearance) ->
}
/// Effect `e`'s settings with its defaults filled in, its blending mode in lower case and its color as
-/// `#rrggbb`.
+/// `#rrggbb`. A Warp's map `version` is left out: the file holds the warp's settings, and the reader
+/// gives every warp it reads the newest map, so a warp saved before the version existed is written
+/// with its settings as before.
fn normalized_params(e: &Effect) -> Value {
let mut p = vectorcraft_effects::merged_params(&e.id, &e.params);
+ if e.id.starts_with("warp.")
+ && let Value::Object(m) = &mut p
+ {
+ m.remove("version");
+ }
if let Some(m) = word(&p, "mode") {
p["mode"] = Value::String(m);
}
diff --git a/crates/eps/src/import/ai/envelope.rs b/crates/eps/src/import/ai/envelope.rs
index 8b3fceecf3..50674860a6 100644
--- a/crates/eps/src/import/ai/envelope.rs
+++ b/crates/eps/src/import/ai/envelope.rs
@@ -244,6 +244,7 @@ fn warp(o: &Obj) -> Option {
h: percent("DeformHoriz")?,
v: percent("DeformVert")?,
horizontal: !vertical,
+ version: vectorcraft_doc::live::WARP_NET,
})
}
diff --git a/crates/eps/src/import/ai/read/directives.rs b/crates/eps/src/import/ai/read/directives.rs
index f7df4f35d6..911d8340cc 100644
--- a/crates/eps/src/import/ai/read/directives.rs
+++ b/crates/eps/src/import/ai/read/directives.rs
@@ -1259,7 +1259,7 @@ mod tests {
fn envelopes_in_symbol_definitions_spend_the_imports_checks() {
use crate::import::ai::tests::{drawn_content, envelope_content, envelope_of, straight_mesh, warp_keys};
use vectorcraft_doc::live::EnvelopeKind;
- let want = EnvelopeKind::Warp { style: "arc".into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true };
+ let want = EnvelopeKind::Warp { style: "arc".into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true, version: vectorcraft_doc::live::WARP_NET };
let envelope =
envelope_of(&straight_mesh(1, 1, (120.0, 60.0)), &warp_keys(1, 0.5, 0.0, 0.0, 0), &envelope_content(), 1, &drawn_content(&want));
let mut reader = Reader::new(b"");
diff --git a/crates/eps/src/import/ai/style.rs b/crates/eps/src/import/ai/style.rs
index f15744f30c..ef661c1446 100644
--- a/crates/eps/src/import/ai/style.rs
+++ b/crates/eps/src/import/ai/style.rs
@@ -1159,6 +1159,7 @@ fn effect(f: &Filter, under: Under) -> Option {
"horizontal": pct("DeformHoriz"),
"vertical": pct("DeformVert"),
"orientation": if flag("Rotate") { "vertical" } else { "horizontal" },
+ "version": vectorcraft_doc::live::WARP_NET,
}),
)
}
diff --git a/crates/eps/src/import/ai/style/tests.rs b/crates/eps/src/import/ai/style/tests.rs
index d39a87b5c0..47086ca171 100644
--- a/crates/eps/src/import/ai/style/tests.rs
+++ b/crates/eps/src/import/ai/style/tests.rs
@@ -495,6 +495,8 @@ fn a_stack_of_fills_with_effects_of_their_own_is_read_as_itself() {
// The warp is the whole object's; the characters paint below every item.
let [warp] = st.effects.as_slice() else { panic!("{:?}", st.effects) };
assert_eq!((warp.id.as_str(), &warp.params["bend"], &warp.params["orientation"]), ("warp.arch", &json!(5.0), &json!("horizontal")));
+ // A file's warp bends as its style's Bézier net.
+ assert_eq!(warp.params["version"], json!(vectorcraft_doc::live::WARP_NET));
assert_eq!(st.contents_index, None);
}
diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs
index 46386d2200..8fa0a58346 100644
--- a/crates/eps/src/import/ai/tests.rs
+++ b/crates/eps/src/import/ai/tests.rs
@@ -5,6 +5,7 @@ use std::sync::Arc;
use kurbo::{Affine, Point, Rect};
use vectorcraft_color::gradient::GradientKind;
use vectorcraft_color::{BlendMode, Color, Paint};
+use vectorcraft_doc::live::WARP_NET;
use vectorcraft_doc::{AppearanceItem, ColorMode, Document, Guide, Knockout, LayerColor, LineCap, LineJoin, Node, NodeKind, Unit};
use super::*;
@@ -7403,15 +7404,16 @@ fn a_warp_envelope_opens_live() {
for (style, bend, h, v, rotate, id) in
[(1, 0.5, 0.0, 0.0, 0, "arc"), (1, 0.5, -0.2, 0.3, 1, "arc"), (8, 0.5, 0.0, 0.0, 0, "flag"), (15, 0.5, 0.0, 0.0, 0, "twist")]
{
- let want = EnvelopeKind::Warp { style: id.into(), bend: bend * 100.0, h: h * 100.0, v: v * 100.0, horizontal: rotate == 0 };
+ let want =
+ EnvelopeKind::Warp { style: id.into(), bend: bend * 100.0, h: h * 100.0, v: v * 100.0, horizontal: rotate == 0, version: WARP_NET };
let body =
envelope_of(&straight_mesh(1, 1, (120.0, 60.0)), &warp_keys(style, bend, h, v, rotate), &envelope_content(), 1, &drawn_content(&want));
let r = read_ok(&layer(&body));
let a = art(&r.doc);
assert_eq!(a.len(), 1, "{a:#?}");
let (content, kind, fidelity, editing, options) = live_envelope(&a[0]);
- let EnvelopeKind::Warp { style: s, bend: b, h: dh, v: dv, horizontal } = kind else { panic!("{kind:?}") };
- assert_eq!((s.as_str(), *horizontal), (id, rotate == 0));
+ let EnvelopeKind::Warp { style: s, bend: b, h: dh, v: dv, horizontal, version } = kind else { panic!("{kind:?}") };
+ assert_eq!((s.as_str(), *horizontal, *version), (id, rotate == 0, WARP_NET));
assert!([(*b, bend), (*dh, h), (*dv, v)].iter().all(|(got, f)| (got - f * 100.0).abs() < 1e-9), "{kind:?}");
assert_eq!((fidelity, editing, options), (50.0, false, vectorcraft_doc::live::EnvelopeOptions::NEW));
assert_eq!(content.len(), 1, "{content:#?}");
@@ -7443,7 +7445,7 @@ fn warp_envelopes_read_every_style() {
"twist",
];
for (n, id) in ids.iter().enumerate() {
- let want = EnvelopeKind::Warp { style: (*id).into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true };
+ let want = EnvelopeKind::Warp { style: (*id).into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: WARP_NET };
let keys = warp_keys(n as u32 + 1, 0.3, 0.0, 0.0, 0);
let r = read_ok(&layer(&envelope_of(&straight_mesh(1, 1, (120.0, 60.0)), &keys, &envelope_content(), 1, &drawn_content(&want))));
let a = art(&r.doc);
@@ -7974,7 +7976,7 @@ fn an_envelope_that_doesnt_read_keeps_its_drawn_art() {
#[test]
fn an_envelope_that_doesnt_come_out_as_drawn_keeps_its_drawn_art() {
use vectorcraft_doc::live::EnvelopeKind;
- let other = EnvelopeKind::Warp { style: "arc".into(), bend: -50.0, h: 0.0, v: 0.0, horizontal: true };
+ let other = EnvelopeKind::Warp { style: "arc".into(), bend: -50.0, h: 0.0, v: 0.0, horizontal: true, version: WARP_NET };
let body = envelope_of(&straight_mesh(1, 1, (120.0, 60.0)), &warp_keys(1, 0.5, 0.0, 0.0, 0), &envelope_content(), 1, &drawn_content(&other));
let r = read_ok(&layer(&body));
let a = art(&r.doc);
@@ -7989,7 +7991,7 @@ fn an_envelope_that_doesnt_come_out_as_drawn_keeps_its_drawn_art() {
fn a_white_envelope_that_doesnt_come_out_as_drawn_keeps_its_drawn_art() {
use vectorcraft_doc::live::EnvelopeKind;
const WHITE: &str = "0 0 0 0 1 1 1 Xa\n";
- let other = EnvelopeKind::Warp { style: "arc".into(), bend: -50.0, h: 0.0, v: 0.0, horizontal: true };
+ let other = EnvelopeKind::Warp { style: "arc".into(), bend: -50.0, h: 0.0, v: 0.0, horizontal: true, version: WARP_NET };
let content = envelope_content().replace(RED, WHITE);
let drawn = drawn_content(&other).replace(RED, WHITE);
let body = envelope_of(&straight_mesh(1, 1, (120.0, 60.0)), &warp_keys(1, 0.5, 0.0, 0.0, 0), &content, 1, &drawn);
diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs
index 8f64280367..7353c5c190 100644
--- a/crates/eps/src/import/tests_native.rs
+++ b/crates/eps/src/import/tests_native.rs
@@ -5419,7 +5419,14 @@ fn type_envelope_text(family: &str, paint: Option<&str>) -> String {
fn arc_envelope(text: &Node, bend: f64) -> Node {
let mut text = text.clone();
text.visible = true;
- let kind = vectorcraft_doc::live::EnvelopeKind::Warp { style: "arc".into(), bend, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::live::EnvelopeKind::Warp {
+ style: "arc".into(),
+ bend,
+ h: 0.0,
+ v: 0.0,
+ horizontal: true,
+ version: vectorcraft_doc::live::WARP_NET,
+ };
Node::new(
vectorcraft_doc::NodeId(1_000_000),
NodeKind::Envelope {
diff --git a/crates/render/src/live.rs b/crates/render/src/live.rs
index 3f5ebbb2fe..2b6610beb1 100644
--- a/crates/render/src/live.rs
+++ b/crates/render/src/live.rs
@@ -781,7 +781,7 @@ mod tests {
d.symbols.push(Symbol { dynamic: false, name: format!("S{k}"), art: Arc::new(art) });
}
let first = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "S0".into(), xf: Affine::IDENTITY });
- let kind = EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let envelope = NodeKind::Envelope {
content: vec![Arc::new(first)],
kind: Box::new(kind),
@@ -815,7 +815,7 @@ mod tests {
d.symbols.push(Symbol { dynamic: false, name: name.into(), art: art.clone() });
}
let content = ["A", "B", "C"].map(|s| Arc::new(Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: s.into(), xf: Affine::IDENTITY })));
- let kind = EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let envelope = NodeKind::Envelope {
content: content.to_vec(),
kind: Box::new(kind),
diff --git a/crates/render/src/tests/fontchange.rs b/crates/render/src/tests/fontchange.rs
index 8f6d68f575..0e7864b0b9 100644
--- a/crates/render/src/tests/fontchange.rs
+++ b/crates/render/src/tests/fontchange.rs
@@ -338,7 +338,7 @@ fn enveloped_type_redraws_when_its_font_becomes_available() {
let shown = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Word".into(), xf: Affine::translate((150.0, 120.0)) });
let l = d.layers[0].id;
for (i, content) in [typed, shown].into_iter().enumerate() {
- let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let envelope = NodeKind::Envelope {
content: vec![Arc::new(content)],
kind: Box::new(kind),
@@ -376,7 +376,7 @@ fn enveloped_type_under_effects_redraws_when_its_font_becomes_available() {
let mut d = Document::new(300.0, 150.0);
let style = CharStyle { size: 50.0, font_family: family.into(), ..Default::default() };
let typed = Node::new(d.alloc_id(), NodeKind::Text(Box::new(TextObject::point(Point::new(10.0, 80.0), "Hamburg", style))));
- let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let envelope = NodeKind::Envelope {
content: vec![Arc::new(typed)],
kind: Box::new(kind),
@@ -420,7 +420,7 @@ fn a_renderer_maps_enveloped_type_from_its_glyphs_in_the_current_font() {
const FAMILY: &str = "Mapped Serif 4";
let style = CharStyle { size: 50.0, font_family: FAMILY.into(), ..Default::default() };
let t = TextObject::point(Point::new(10.0, 60.0), "Hamburg", style);
- let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let envelope = Node::new(
vectorcraft_doc::NodeId(1),
NodeKind::Envelope {
diff --git a/crates/render/src/tests/memory.rs b/crates/render/src/tests/memory.rs
index d5e6919f0d..f95735baec 100644
--- a/crates/render/src/tests/memory.rs
+++ b/crates/render/src/tests/memory.rs
@@ -1252,7 +1252,7 @@ fn art_with_live_objects_draws_pattern_layout_edits() {
d.patterns.push(def);
let band = vectorcraft_geom::shapes::rectangle(Rect::new(-80.0, -40.0, 80.0, 40.0));
let filled = Node::path(d.alloc_id(), band, vectorcraft_doc::Appearance::basic(pattern_paint("Checks"), Paint::None, 0.0));
- let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let options = EnvelopeOptions { distort_appearance: true, distort_pattern_fills: true, ..Default::default() };
let envelope = Node::new(
d.alloc_id(),
@@ -1398,7 +1398,7 @@ fn live_objects_in_symbol_art_draw_symbol_and_pattern_edits() {
/// An envelope of `d` bending `content` with an arc warp (30%); with `patterns`, Distort
/// Appearance and Distort Pattern Fills are on, and the tiles of its pattern fills bend with it.
fn arc_envelope(d: &mut Document, content: Vec, patterns: bool) -> Node {
- let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let options = vectorcraft_doc::live::EnvelopeOptions { distort_appearance: patterns, distort_pattern_fills: patterns, ..Default::default() };
let content = content.into_iter().map(Arc::new).collect();
Node::new(
diff --git a/crates/render/src/tests/objectfx.rs b/crates/render/src/tests/objectfx.rs
index fe1e5ee1d1..7e4007c6ac 100644
--- a/crates/render/src/tests/objectfx.rs
+++ b/crates/render/src/tests/objectfx.rs
@@ -439,7 +439,7 @@ fn transforms_of(t: &Node) -> [(Value, Affine); 3] {
/// A 100×100 document holding `content` in an envelope that leaves it as it is (an arc with no
/// bend), with Distort Appearance on or off.
fn envelope_doc(content: Node, distort_appearance: bool) -> Document {
- let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 0.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 0.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let options = vectorcraft_doc::live::EnvelopeOptions { distort_appearance, ..Default::default() };
let envelope = NodeKind::Envelope {
content: vec![Arc::new(content)],
diff --git a/crates/render/src/tests/placed_document.rs b/crates/render/src/tests/placed_document.rs
index c3c00a4cf0..3a65b1abe0 100644
--- a/crates/render/src/tests/placed_document.rs
+++ b/crates/render/src/tests/placed_document.rs
@@ -135,7 +135,7 @@ fn an_enveloped_placed_document_shows_its_file_once_read() {
let placed = d.remove(NodeId(50)).unwrap();
let NodeKind::PlacedDocument(p) = &placed.kind else { panic!("a placed document") };
let p = (**p).clone();
- let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let envelope = NodeKind::Envelope {
content: vec![placed],
kind: Box::new(kind),
diff --git a/crates/tools/src/xform/eyedropper.rs b/crates/tools/src/xform/eyedropper.rs
index db3aad793e..32e1df2a16 100644
--- a/crates/tools/src/xform/eyedropper.rs
+++ b/crates/tools/src/xform/eyedropper.rs
@@ -1543,7 +1543,7 @@ mod tests {
let d = doc_with_live_over_green(|d| {
let a = vectorcraft_doc::Appearance::basic(Paint::solid(Color::rgb(1.0, 0.0, 0.0)), Paint::solid(Color::rgb(0.0, 0.0, 1.0)), 10.0);
let red = Node::path(d.alloc_id(), vectorcraft_geom::shapes::rectangle(Rect::new(300.0, 300.0, 420.0, 320.0)), a);
- let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let content = vec![std::sync::Arc::new(red)];
let n = Node::new(
d.alloc_id(),
@@ -1574,7 +1574,7 @@ mod tests {
use vectorcraft_geom::{Affine, Rect};
let d = doc_with_live_over_green(|d| {
let red = solid_rect(d, Rect::new(300.0, 300.0, 420.0, 320.0), Color::rgb(1.0, 0.0, 0.0));
- let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true };
+ let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true, version: 0 };
let content = vec![std::sync::Arc::new(red)];
let options = Default::default();
Node::new(
diff --git a/crates/ui-egui/src/dialogs/effect.rs b/crates/ui-egui/src/dialogs/effect.rs
index 3a58ee3a9e..9e5c531c94 100644
--- a/crates/ui-egui/src/dialogs/effect.rs
+++ b/crates/ui-egui/src/dialogs/effect.rs
@@ -879,6 +879,13 @@ fn command(d: &Dialog) -> (&'static str, Value) {
p["item"] = item.unwrap_or(Value::Null);
p["params"] = params;
let id = d.str("__effect");
+ // Each target keeps the map its own Warp draws with: the dialog's `version` is the first
+ // target's.
+ if super::warp_effect::is_warp(&id)
+ && let Some(Value::Object(m)) = p.get_mut("params")
+ {
+ m.remove("version");
+ }
// The displayed style comes from the first target. Preserve other targets' Warp IDs
// unless the user deliberately chooses Style, including after a preview rollback.
if super::warp_effect::is_warp(&id) && d.bool("__warp_style_changed") {
diff --git a/crates/ui-egui/src/dialogs/envelope.rs b/crates/ui-egui/src/dialogs/envelope.rs
index f537595ebc..6c9d95b601 100644
--- a/crates/ui-egui/src/dialogs/envelope.rs
+++ b/crates/ui-egui/src/dialogs/envelope.rs
@@ -239,7 +239,7 @@ fn bar_of(app: &VectorcraftApp) -> Option<(bool, Bar)> {
let env = st.selection.objects.first().and_then(|id| vectorcraft_doc::live::envelope_of(&st.doc, *id))?;
let NodeKind::Envelope { kind, editing, .. } = &env.kind else { return None };
let bar = match &**kind {
- EnvelopeKind::Warp { style, bend, h, v, horizontal } => {
+ EnvelopeKind::Warp { style, bend, h, v, horizontal, .. } => {
Bar::Warp { style: style.clone(), bend: *bend, h: *h, v: *v, horizontal: *horizontal }
}
EnvelopeKind::Mesh { rows, cols, .. } => Bar::Mesh { rows: *rows, cols: *cols },
diff --git a/crates/ui-egui/src/dialogs/tests_warp.rs b/crates/ui-egui/src/dialogs/tests_warp.rs
index e7cbfcc5b7..21d3e8e1a4 100644
--- a/crates/ui-egui/src/dialogs/tests_warp.rs
+++ b/crates/ui-egui/src/dialogs/tests_warp.rs
@@ -616,3 +616,33 @@ fn warp_options_style_keyboard_enter_does_not_accept_dialog() {
assert_eq!(app.session.doc().unwrap().doc, moved);
}
}
+
+/// Warp Options editing the Warps of two objects, one new and one saved without a map version,
+/// changes the Bend of both and keeps each one's own `version`.
+#[test]
+fn warp_options_edit_keeps_each_targets_map_version() {
+ let (mut app, first) = app();
+ app.run("effect.apply", json!({"effect": "warp.arc"})).unwrap();
+ let second = NodeId(app.run("shape.rectangle", json!({"x": 230, "y": 60, "width": 120, "height": 80})).unwrap()["id"].as_u64().unwrap());
+ app.run("effect.apply", json!({"effect": "warp.arc"})).unwrap();
+ // As a file saved before the version existed gives it.
+ let doc = std::sync::Arc::make_mut(&mut app.session.doc_mut().unwrap().doc);
+ if let Some(Value::Object(p)) = doc.node_mut(second).and_then(|n| n.appearance.effects.first_mut()).map(|e| &mut e.params) {
+ p.remove("version");
+ }
+ app.run("select.set", json!({"ids": [first.0, second.0]})).unwrap();
+ app.run("effect.dialog", json!({"effect": "warp.arc"})).unwrap();
+ assert_eq!(app.ui.dialog.as_ref().unwrap().kind, effect::EXISTS);
+ let ctx = context();
+ settle(&mut app, &ctx);
+ click_text(&mut app, &ctx, "Edit");
+ settle(&mut app, &ctx);
+ make_warp_edit(&mut app, &ctx, "bend");
+ click_text(&mut app, &ctx, "OK");
+ assert!(app.ui.dialog.is_none());
+ let doc = app.session.doc().unwrap().doc.clone();
+ let params = |id: NodeId| doc.node(id).unwrap().appearance.effects[0].params.clone();
+ assert_eq!((¶ms(first)["bend"], ¶ms(first)["version"]), (&json!(25.0), &json!(vectorcraft_doc::live::WARP_NET)));
+ assert_eq!(params(second)["bend"], json!(25.0));
+ assert!(params(second).get("version").is_none(), "{:?}", params(second));
+}
diff --git a/crates/ui-egui/src/dialogs/warp_effect.rs b/crates/ui-egui/src/dialogs/warp_effect.rs
index ff530fbdf2..e8ef2bb6b7 100644
--- a/crates/ui-egui/src/dialogs/warp_effect.rs
+++ b/crates/ui-egui/src/dialogs/warp_effect.rs
@@ -1,7 +1,7 @@
//! Effect > Warp controls. The style remains an effect ID; Envelope Warp has a different schema.
use egui::{Pos2, Rect, Stroke, vec2};
use serde_json::{Map, Value, json};
-use vectorcraft_effects::{WARP_STYLES, WarpStyle, warp_point};
+use vectorcraft_effects::{WARP_STYLES, WarpNet, WarpStyle};
use super::form;
use crate::state::Dialog;
@@ -38,6 +38,8 @@ fn shown(label: &str) -> String {
fn style_preview(ui: &mut egui::Ui, suffix: &str) {
let (rect, _) = ui.allocate_exact_size(vec2(30.0, 22.0), egui::Sense::hover());
let Some(style) = WarpStyle::from_id(suffix) else { return };
+ // The map new warps take, on a box 0.55 times as high as it is wide.
+ let net = WarpNet::new(style, 0.45, 0.0, 0.0, 2.0, 1.1, false);
let mut lines = vec![];
let mut bounds = Rect::NOTHING;
for vertical in [false, true] {
@@ -46,8 +48,8 @@ fn style_preview(ui: &mut egui::Ui, suffix: &str) {
.map(|i| {
let along = -1.0 + f64::from(i) / 8.0;
let (x, y) = if vertical { (fixed, along) } else { (along, fixed) };
- let (x, y) = warp_point(style, 0.45, 0.0, 0.0, 0.55, x, y);
- let p = Pos2::new(x as f32, y as f32);
+ let q = net.at((x + 1.0) / 2.0, (y + 1.0) / 2.0);
+ let p = Pos2::new(q.x as f32, q.y as f32);
bounds.extend_with(p);
p
})
diff --git a/docs/effects-parity.md b/docs/effects-parity.md
index 2602b78bc4..c3aa528e54 100644
--- a/docs/effects-parity.md
+++ b/docs/effects-parity.md
@@ -28,7 +28,7 @@ Part of [target-app-parity.md](target-app-parity.md); open work is in [gaps.md](
| Rasterize | Rasterize… (as a live effect) | 1/1 | — |
| Stylize | Drop Shadow, Feather, Inner Glow, Outer Glow, Round Corners, Scribble | 6/6 | Scribble Options' Settings presets |
| SVG Filters | Apply SVG Filter… and the filter list | 1/1 | The submenu lists the document's own filters: VectorCraft ships no default filters. A filter that is the object's last effect is written to SVG as a `` element; otherwise SVG export draws the object as an image. A filter on a turned or skewed object in an imported SVG is left out with a warning |
-| Warp | Arc, Arc Lower, Arc Upper, Arch, Bulge, Shell Lower, Shell Upper, Flag, Wave, Fish, Rise, Fisheye, Inflate, Squeeze, Twist | 15/15 | warp point editing in envelopes; Arc is a circular arc in the object's own proportions (#1578) |
+| Warp | Arc, Arc Lower, Arc Upper, Arch, Bulge, Shell Lower, Shell Upper, Flag, Wave, Fish, Rise, Fisheye, Inflate, Squeeze, Twist | 15/15 | warp point editing in envelopes; each style bends the bounds as one Bézier patch (`version` 1), so Arc's edges are cubic curves close to concentric arcs; warps saved without a version keep the earlier map, where Arc is a circular arc in the object's own proportions (#1578) |
Document Raster Effects Settings exists. When the 64 million pixel cap on an effect image lowers
its resolution, PDF export warns once per object with the requested and the lowest achieved ppi
diff --git a/docs/mcp.md b/docs/mcp.md
index da260b6823..8003354a7a 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -8238,6 +8238,20 @@ share of the content's width or height in proportion to the length of its contro
its curve parameter, so content spreads evenly along a segment without handles. An envelope opened from an `.ai` file
keeps the corners the file saves, and they stay on the same anchors when the envelope is moved, rotated or
reflected. These are VectorCraft's own rules, and existing top-object envelopes redraw by them.
+A warp bends the content's bounds as one Bézier patch. The style sets the patch's control points from the bend and
+the size of the bounds (Arc's top and bottom edges, for example, are cubic curves close to arcs around one center), then
+the horizontal distortion scales each column of control points about its middle, and the vertical distortion scales
+each row. Content with no width or no height takes the middle of the patch along that side. New warp envelopes, and
+those opened from `.ai` files, carry `version` 1 for this map, and `object.envelope.info` reports it. Envelopes in
+`.vectorcraft` documents saved before the version existed read as `version` 0, the earlier map, and keep their look,
+and editing an envelope keeps its version. `version` (0 or 1) on `object.envelope.makeWithWarp`,
+`object.envelope.resetWithWarp` and `object.envelope.options` sets the map. The Warp effects (`warp.arc` …
+`warp.twist`) take the same map through the same `version` param: `effect.apply` gives a new Warp `version` 1 unless
+`params.version` is 0, the built-in graphic styles' Warps have 1, and Effect › Warp edits keep each Warp's own version.
+These commands refuse any other value with `` `version` must be 0 or 1 ``; `1.0` counts as 1. An `.ai` file holds a
+warp's settings and not its version, so a `version` 0 warp saved to `.ai` and opened again draws with `version` 1.
+These patches are VectorCraft's own rules; the styles and the ranges of Bend and the distortions are those of the Warp
+options (https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/distort-and-transform-effects-in-illustrator.html).
`object.envelope.info` reads the selected envelope's settings (`type`, the warp's or mesh's values, `fidelity` and
the options, `editing`), or with no envelope selected the options new envelopes get. With an envelope selected,
`object.envelope.resetWithWarp` and `object.envelope.resetWithMesh` (`rows`, `cols`, `maintainShape`: true keeps
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index cf4c0df1a9..f4c35ddd41 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -588,6 +588,7 @@ since 2026-10-01.
- **Transform effect options (#885):** Effect › Distort & Transform › Transform… has visible Transform Objects, Transform Patterns and Scale Strokes & Effects checkboxes (`distort.transform` params `objects`, `patterns`, `strokes`; files without them draw as before). With Transform Objects off the geometry stays and makes no copies; Scale Strokes & Effects scales stroke weights, dashes and the fills' and strokes' effect distances by the mean scale, and Transform Patterns moves pattern tiles, each copy `k` by the transformation `k` times. Such objects draw, export and expand through the same per-copy art, so the canvas and Expand Appearance agree (engine `tests_transformfx`, effects `tests_transformfx`, the dialog test). A Transform effect in a fill's or stroke's own effects applies the same options to that fill or stroke: its weight and dashes, the distances of its later effects and its pattern follow the transformation, and with copies each copy is an object of its own; the canvas, export, Expand Appearance and Use Preview Bounds use the same art (effects `tests_transformfx`). Not yet: object effects after a Transform effect keep their distances. Public reference: [Scale objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/scale-objects.html), [How to apply effects](https://helpx.adobe.com/illustrator/using/effects.html), [Distort and transform effects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/distort-and-transform-effects-in-illustrator.html). Scores and hours unchanged.
- **Warp Options (#1760):** Effect > Warp and existing Appearance effect links share the fifteen existing styles, original schematic previews, orientation choices and percent Bend/Distortion controls. Focused tests passed for real numeric entry and slider input, Preview/Cancel, immediate Enter/OK, mixed-style edits, target/slot/visibility preservation and Undo/Redo. Each applied style stays unchanged until an explicit Style choice. Original style-menu and live-preview captures were reviewed; their numeric values were supplied programmatically. Public references: [Reshaping with effects](https://helpx.adobe.com/illustrator/using/reshaping-objects-effects.html) and [Using effects](https://helpx.adobe.com/illustrator/using/effects.html). Warp geometry, optional Properties integration and remembered defaults are unchanged; no broader parity claim.
- **Placed gradients follow the Warp effects:** under each of the fifteen Warp styles with a bend or a distortion, a gradient placed with the Gradient tool moves and scales from the object's bounds before the warp to its bounds after it, as under Free Distort; a stroke's gradient uses those bounds inflated by the stroke. This holds for an object's own Warp and for a fill's or stroke's own, on the canvas and in Object › Expand of the fill. In a group with a Warp effect, each path's and compound path's gradients follow its own bounds, a nested group's own fills and strokes follow the nested group's bounds, and the group's own fills and strokes follow the group's bounds. In the art Pathfinder and compound shapes take, a symbol instance's Warp moves the gradients of its symbol's art by the art's bounds, and a compound shape's Warp moves its gradients by the bounds of its area. A gradient fitted to the object still fits the warped outline, and a warp with no bend and no distortion leaves the gradient exactly in place. Existing documents with a Warp effect on art with a placed gradient draw differently: before, the gradient stayed where it was while the outline changed. How gradients follow the warp is VectorCraft's own rule; what the Warp effects do to the object is described in [Reshaping with effects](https://helpx.adobe.com/illustrator/using/reshaping-objects-effects.html) (effects `tests::warp_bends_when_the_warp_moves_the_outline`, `bake::tests::baked_warps_move_placed_gradients_from_the_bounds_to_the_warped_bounds`, `bake::tests::a_warp_with_no_bend_leaves_a_placed_gradient_exactly_in_place`, `bake::tests::a_fills_and_a_strokes_own_warp_move_its_placed_gradient_with_the_bounds`, `group::tests::a_groups_warp_moves_the_gradients_placed_on_its_paths_by_each_paths_bounds`, `group::tests::a_groups_warp_moves_its_own_a_nested_groups_and_a_compound_paths_gradients_by_their_bounds`, `group::tests::shape_art_moves_the_gradients_of_a_symbol_instances_art_and_a_compound_shape_with_a_warp`; render `objectfx::a_paths_gradient_moves_and_scales_with_its_warped_bounds`; engine `objexpand::a_placed_gradient_moved_by_a_warp_expands_as_the_canvas_draws_it`). Scores and hours unchanged.
+- **Warp as a Bézier patch per style:** each of the fifteen Warp styles bends the object's bounds as one Bézier patch whose control points the style sets from the bend and the size of the bounds; the horizontal distortion then scales each column of control points about its middle and the vertical distortion scales each row. The Warp effects and warp envelopes share the map, and content with no width or no height takes the middle of the patch along that side. New warps, the built-in graphic styles' Warps and warps opened from `.ai` files carry `version` 1 for it. Warps in `.vectorcraft` documents saved before it read as `version` 0 and keep their earlier look, and edits keep a warp's version; a `version` 0 warp saved to `.ai` opens again with `version` 1, since the file holds only its settings. The patches are VectorCraft's own rules; the styles and ranges are those of the Warp options in [Distort and transform effects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/distort-and-transform-effects-in-illustrator.html) (doc `live::tests::warp_nets_bend_each_style_as_its_own_patch`, `warp_net_arc_edges_are_concentric_circles`, `warp_net_distortion_scales_the_columns_then_the_rows`, `warp_net_takes_any_numbers`, `warp_net_bends_a_huge_box_without_overflowing`, `warp_envelopes_bend_flat_content_as_the_middle_of_the_patch`, `warp_envelopes_write_their_map_version_only_when_it_has_one`, `style_libs::tests::builtin_warp_styles_take_the_nets_map`; effects `tests::a_warp_draws_with_the_map_its_version_names`, `tests::a_warp_bends_a_flat_box_as_the_middle_of_its_patch`, `tests::new_warps_take_the_nets_version`; engine `effectedit::warps_keep_the_map_their_version_names`, `envelope::new_warp_envelopes_take_the_net_and_saved_ones_keep_their_map`; eps `ai_editing::tests::every_effect_a_graphic_style_holds_is_read_back`, `import::ai::tests::a_warp_envelope_opens_live`, `import::ai::tests::warp_envelopes_read_every_style`, `import::ai::style::tests::a_stack_of_fills_with_effects_of_their_own_is_read_as_itself`; ui-egui `dialogs::tests_warp::warp_options_edit_keeps_each_targets_map_version`). Scores and hours unchanged.
- **Distort Appearance with Transform effect options:** with Envelope Options › Distort Appearance on, a path whose Transform effect has Scale Strokes & Effects or Transform Patterns on, or copies it with a gradient, is bent as the same per-copy art it draws and expands as outside the envelope: each copy's own stroke weight, dashes, pattern placement and gradient (effects `bake::tests`). Scores and hours unchanged.
- **Fitted gradients turn with the Transform effect:** a gradient fitted to the object (not placed with the Gradient tool) turns, reflects and stretches with the object when its Transform effect rotates, reflects or scales it unevenly, as Object › Transform already does: the gradient is fixed to its fit on the geometry the effect takes, then follows the effect and the effects after it as a placed gradient does. Under moves and even scales it draws as a refit does, and a Transform effect that scales the object to nothing across leaves it fitted, with Scale Strokes & Effects or Transform Patterns on too, and on each copy. This holds on the canvas and in Object › Expand of the fill, for an object's own effects, a fill's or stroke's own, and a group's, where the gradients fitted to its paths, to its own fill, to the groups inside it and to its images' and symbol instances' own fills each fix to their own object's fit. Existing documents with such a Transform effect on fitted-gradient art draw differently: before, the gradient refit to the turned outline. The Gradient tool still shows a fitted gradient's vector at its unturned fit. How gradients follow the effect is VectorCraft's own rule; what the effect does to the object is described in [Distort and transform effects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/distort-and-transform-effects-in-illustrator.html) (effects `bake::tests::a_fitted_gradient_turns_reflects_and_stretches_with_a_transform_effect`, `bake::tests::a_transform_effect_that_scales_to_nothing_leaves_a_fitted_gradient_fitted`, `group::tests::a_groups_transform_turns_the_gradients_fitted_to_its_members_and_its_own_fill`; render `objectfx::a_fitted_gradient_turns_and_reflects_with_its_transform_on_the_canvas`; engine `objexpand::a_fitted_gradient_turned_by_a_transform_expands_as_the_canvas_draws_it`). Scores and hours unchanged.
- **Placed gradients follow Transform and Free Distort effects:** a gradient placed with the Gradient tool moves, turns and scales with the object when the object's Transform effect moves its outline, and each copy of the Transform effect takes it as many times as it takes the transform. Under Free Distort it moves and scales from the path's bounds before the effect to its bounds after it. This holds on the canvas, in export, in Expand Appearance, in Pathfinder and compound shapes, and in Object › Expand of the fill, for an object's own effects, a group's (the own fills of the group, of the groups inside it, of a symbol's art, and of the images and symbol instances it moves, included) and a fill's or stroke's own. A gradient on a path inside a group with a Transform effect now moves with the path (#2214 moved only the gradients of type), and so does a gradient on an image's or symbol instance's own fill. When a path keeps its shape because the effect would pass the geometry budget, the group's own gradients stay in place; a hidden path in a layer, which the layer's bounds leave out, does not hold them. A freeform gradient whose points were edited moves its points in the same way. How gradients follow each effect is VectorCraft's own rule; what each effect does to the object is described in [Distort and transform effects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/distort-and-transform-effects-in-illustrator.html) (effects `bake::tests::a_baked_transform_moves_a_placed_gradient_with_the_path`, `bake::tests::a_strokes_own_transform_and_free_distort_move_its_placed_gradient`, `bake::tests::a_fills_gradient_follows_the_effects_around_its_transform_with_options`, `bake::tests::baked_free_distort_moves_placed_gradients_from_the_bounds_to_the_distorted_bounds`, `group::tests::a_groups_transform_and_free_distort_move_the_gradients_placed_on_its_paths`, `group::tests::a_groups_transform_moves_the_gradient_of_its_own_fill`, `group::tests::a_nested_groups_own_gradient_follows_the_outer_groups_transform_and_free_distort`, `group::tests::a_groups_transform_moves_the_gradients_placed_on_an_images_own_fills`, `group::tests::shape_art_moves_gradients_with_a_transform_effect`, `group::tests::shape_art_moves_the_gradient_of_a_symbol_instances_art_with_its_transform`, `tests::art_past_the_budget_keeps_its_own_gradients_in_place`, `tests::a_hidden_path_past_the_budget_leaves_a_layers_gradients_free_to_move`, `tests::edited_freeform_points_follow_a_transform_effect_and_free_distort`; render `objectfx::a_paths_gradient_moves_with_its_transform_and_free_distort`; engine `objexpand::a_placed_gradient_moved_by_a_transform_or_free_distort_expands_as_the_canvas_draws_it`). Scores and hours unchanged.
From 880cdea33cbdbf26c7ec10405e10e025fe0c1d1f Mon Sep 17 00:00:00 2001
From: dotCooCoo
Date: Wed, 11 Nov 2026 21:16:20 -0800
Subject: [PATCH 11/38] Brushes: a built-in Dry Media library of grainy chalk,
pencil, crayon and charcoal art brushes
Window > Brush Libraries > Dry Media (`dry-media`) holds four art brushes:
Chalk Grain, Graphite Pencil, Wax Crayon and Charcoal Dust. Each is 100 pt
of filled vector paths generated from a fixed seed with integer steps and
plain arithmetic, at most 80 paths and 500 anchors, stretched along the
path with Tints colorization. The chalk and crayon art has even-odd gaps
cut out of its band.
The names, sizes and art are VectorCraft's own. A new i18n test checks
that every complete catalog names each built-in brush library.
---
crates/engine/src/cmd/brushlib.rs | 165 ++++++++++++++++++
crates/engine/src/tests/brushlib.rs | 140 ++++++++++++++-
crates/ui-egui/src/i18n/bg.tsv | 5 +
crates/ui-egui/src/i18n/bs.tsv | 5 +
crates/ui-egui/src/i18n/ca.tsv | 5 +
crates/ui-egui/src/i18n/cs.tsv | 5 +
crates/ui-egui/src/i18n/da.tsv | 5 +
crates/ui-egui/src/i18n/de.tsv | 5 +
crates/ui-egui/src/i18n/el.tsv | 5 +
crates/ui-egui/src/i18n/es.tsv | 5 +
crates/ui-egui/src/i18n/fi.tsv | 5 +
crates/ui-egui/src/i18n/fr.tsv | 5 +
crates/ui-egui/src/i18n/hi.tsv | 5 +
crates/ui-egui/src/i18n/hu.tsv | 5 +
crates/ui-egui/src/i18n/id.tsv | 5 +
crates/ui-egui/src/i18n/it.tsv | 5 +
crates/ui-egui/src/i18n/ja.tsv | 5 +
crates/ui-egui/src/i18n/ka.tsv | 5 +
crates/ui-egui/src/i18n/ko.tsv | 5 +
crates/ui-egui/src/i18n/nl.tsv | 5 +
crates/ui-egui/src/i18n/pl.tsv | 5 +
crates/ui-egui/src/i18n/pt-br.tsv | 5 +
crates/ui-egui/src/i18n/ru.tsv | 5 +
crates/ui-egui/src/i18n/sv.tsv | 5 +
crates/ui-egui/src/i18n/tests.rs | 14 ++
crates/ui-egui/src/i18n/tr.tsv | 5 +
crates/ui-egui/src/i18n/uk.tsv | 5 +
crates/ui-egui/src/i18n/vi.tsv | 5 +
crates/ui-egui/src/i18n/zh-hans.tsv | 5 +
crates/ui-egui/src/i18n/zh-hant.tsv | 5 +
.../src/panels/tests_brush_libraries.rs | 12 +-
docs/gaps.md | 6 +-
docs/mcp.md | 5 +-
docs/roadmap.md | 2 +-
docs/target-app-parity.md | 9 +-
35 files changed, 476 insertions(+), 12 deletions(-)
diff --git a/crates/engine/src/cmd/brushlib.rs b/crates/engine/src/cmd/brushlib.rs
index 300d9f6aa1..c6d0b573c4 100644
--- a/crates/engine/src/cmd/brushlib.rs
+++ b/crates/engine/src/cmd/brushlib.rs
@@ -173,6 +173,7 @@ pub const BUILTIN: &[BuiltinBrushLibrary] = &[
BuiltinBrushLibrary { id: "scatter-shapes", name: "Scatter Shapes", make: scatter_shapes },
BuiltinBrushLibrary { id: "game-trails", name: "Game Trails", make: game_trails },
BuiltinBrushLibrary { id: "energy-beams", name: "Energy Beams", make: energy_beams },
+ BuiltinBrushLibrary { id: "dry-media", name: "Dry Media", make: dry_media },
];
/// Built-in library `id`, made once.
@@ -446,6 +447,170 @@ fn energy_beams() -> BrushLibrary {
built("Energy Beams", Document::new(100.0, 100.0), brushes)
}
+/// The fixed-seed number source of the Dry Media grain: integer steps and plain arithmetic, so the
+/// art is the same on every run and every platform.
+struct Grain(u64);
+
+impl Grain {
+ /// The next number in 0..1.
+ fn next(&mut self) -> f64 {
+ self.0 = self.0.wrapping_mul(6_364_136_223_846_793_005).wrapping_add(1_442_695_040_888_963_407);
+ (self.0 >> 11) as f64 / (1u64 << 53) as f64
+ }
+ /// The next number in `a`..`b`.
+ fn range(&mut self, a: f64, b: f64) -> f64 {
+ a + (b - a) * self.next()
+ }
+}
+
+/// `floor` at x = `x0` and `x1`, rising smoothly to 1 within `ramp` pt of each.
+fn ends(x: f64, x0: f64, x1: f64, ramp: f64, floor: f64) -> f64 {
+ let t = ((x - x0).min(x1 - x) / ramp).clamp(0.0, 1.0);
+ floor + (1.0 - floor) * t * t * (3.0 - 2.0 * t)
+}
+
+/// A closed band from x = `x0` to `x1` in `n` steps, at most `half` pt either side of y = 0 times
+/// `taper(x)`; each edge point is pulled in by up to `rough` of that.
+fn rough_band(g: &mut Grain, (x0, x1): (f64, f64), n: usize, half: f64, rough: f64, taper: impl Fn(f64) -> f64) -> PathData {
+ let xs: Vec = (0..=n).map(|i| x0 + (x1 - x0) * i as f64 / n as f64).collect();
+ let mut pts: Vec = xs.iter().map(|&x| Point::new(x, -half * taper(x) * (1.0 - rough * g.next()))).collect();
+ let bottom: Vec = xs.iter().rev().map(|&x| Point::new(x, half * taper(x) * (1.0 - rough * g.next()))).collect();
+ pts.extend(bottom);
+ PathData::single(SubPath::polyline(&pts, true))
+}
+
+/// A small four-cornered fleck around (`cx`, `cy`), at most `w` × `h` pt either side; one corner
+/// in each direction, so its outline never crosses itself.
+fn fleck(g: &mut Grain, cx: f64, cy: f64, w: f64, h: f64) -> PathData {
+ let mut side = |a: f64, b: f64| g.range(a, b);
+ let pts = [
+ (cx - w * side(0.6, 1.0), cy + h * side(-0.3, 0.3)),
+ (cx + w * side(-0.3, 0.3), cy - h * side(0.6, 1.0)),
+ (cx + w * side(0.6, 1.0), cy + h * side(-0.3, 0.3)),
+ (cx + w * side(-0.3, 0.3), cy + h * side(0.6, 1.0)),
+ ];
+ polygon(&pts)
+}
+
+/// `body` with `holes` (inside it, apart from each other) cut out, even-odd, in gray `k`: what
+/// lies under the stroke shows through the holes.
+fn holed(body: PathData, holes: Vec, k: f32) -> Node {
+ let children = std::iter::once(body).chain(holes).map(|p| Arc::new(Node::path(NodeId(0), p, Appearance::default()))).collect();
+ let mut n = Node::new(NodeId(0), NodeKind::Compound { children, rule: FillRule::EvenOdd });
+ n.appearance = Appearance { items: vec![AppearanceItem::Fill(FillLayer::new(Paint::solid(Color::gray(k))))], ..Default::default() }.into();
+ n
+}
+
+/// Path `p` filled with gray `k` (1 is black).
+fn ink(p: PathData, k: f32) -> Node {
+ filled(p, Paint::solid(Color::gray(k)))
+}
+
+/// Slivers `w` × `h` pt (ranges) in `count` slots along x = 6..94 inside a band `half` pt wide
+/// times `taper`. Each stays within `reach` of the band's half width from y = 0, taken where the
+/// band is narrowest over the sliver and the 3 pt either side of it, so with `reach` below the
+/// band's roughness margin no sliver touches the band's edge or another sliver.
+fn slivers(g: &mut Grain, count: usize, half: f64, reach: f64, (w, h): ((f64, f64), (f64, f64)), taper: impl Fn(f64) -> f64) -> Vec {
+ let slot = 88.0 / count as f64;
+ (0..count)
+ .map(|i| {
+ let cx = 6.0 + slot * (i as f64 + 0.5);
+ let (w, h) = (g.range(w.0, w.1), g.range(h.0, h.1));
+ let room = reach * half * taper(cx - w - 3.0).min(taper(cx + w + 3.0));
+ let cy = g.range(-1.0, 1.0) * (room - h).max(0.0);
+ fleck(g, cx, cy, w, h)
+ })
+ .collect()
+}
+
+/// Dry Media: art brushes of grainy dry drawing marks, chalk, pencil, crayon and charcoal (original
+/// vector grain from fixed seeds; every brush 100 pt long, black and grays that take the stroke
+/// color as tints, gaps cut out so the paper shows).
+pub(crate) fn dry_media() -> BrushLibrary {
+ // Chalk Grain, 100 × 8 pt: a soft band with narrow scratches and chips along its edges.
+ let chalk = {
+ let mut g = Grain(0x0c4a_1c0a);
+ let taper = |x: f64| ends(x, 0.0, 100.0, 10.0, 0.35);
+ let body = rough_band(&mut g, (0.0, 100.0), 36, 4.0, 0.25, taper);
+ let scratches = slivers(&mut g, 14, 4.0, 0.7, ((1.2, 2.4), (0.15, 0.3)), taper);
+ let mut parts = vec![holed(body, scratches, 0.8)];
+ for i in 0..18 {
+ let cx = 3.0 + 94.0 * (i as f64 + g.range(0.2, 0.8)) / 18.0;
+ let side = if i % 2 == 0 { -1.0 } else { 1.0 };
+ let cy = side * 4.0 * taper(cx) * g.range(0.7, 0.95);
+ let (w, h) = (g.range(0.3, 0.7), g.range(0.25, 0.5));
+ let f = fleck(&mut g, cx, cy, w, h);
+ parts.push(ink(f, 1.0));
+ }
+ group(parts)
+ };
+ // Graphite Pencil, 100 × 2.5 pt: a solid tapered core with fine slanted hatching at its edges.
+ let pencil = {
+ let mut g = Grain(0x009e_4c11);
+ let core = rough_band(&mut g, (0.0, 100.0), 40, 0.8, 0.12, |x| ends(x, 0.0, 100.0, 18.0, 0.25));
+ let mut parts = vec![ink(core, 1.0)];
+ for i in 0..24 {
+ let x0 = 2.0 + 92.0 * (i as f64 + g.range(0.0, 0.4)) / 24.0;
+ let len = g.range(1.5, 3.0);
+ let t = g.range(0.12, 0.2);
+ let slant = g.range(0.1, 0.3);
+ let y0 = if i % 2 == 0 { -g.range(0.85, 1.05) } else { g.range(0.85, 1.25) - t - slant };
+ parts.push(ink(polygon(&[(x0, y0 + slant), (x0 + len, y0), (x0 + len, y0 + t), (x0, y0 + slant + t)]), 0.6));
+ }
+ group(parts)
+ };
+ // Wax Crayon, 100 × 6 pt: a dense band with small gaps in its middle and short overlapping
+ // marks along both edges.
+ let crayon = {
+ let mut g = Grain(0x00c0_a7e5);
+ let taper = |x: f64| ends(x, 0.0, 100.0, 6.0, 0.5);
+ let body = rough_band(&mut g, (0.0, 100.0), 30, 2.6, 0.2, taper);
+ let gaps = slivers(&mut g, 16, 2.6, 0.34, ((0.6, 1.6), (0.15, 0.3)), taper);
+ let mut parts = vec![holed(body, gaps, 0.9)];
+ for i in 0..36 {
+ let w = g.range(1.0, 2.2);
+ let cx = (1.0 + w).max(98.0 * (i as f64 + g.range(0.0, 1.0)) / 36.0).min(99.0 - w);
+ let side = if i % 2 == 0 { -1.0 } else { 1.0 };
+ let h = g.range(0.4, 0.6);
+ // Clear of the gaps, which stay within 0.9 pt of the middle.
+ let inner = 0.9 + h;
+ let cy = side * g.range(inner, (2.4 * taper(cx)).max(inner));
+ let f = fleck(&mut g, cx, cy, w, h);
+ parts.push(ink(f, 1.0));
+ }
+ group(parts)
+ };
+ // Charcoal Dust, 100 × 7 pt: a dark band broken into pieces, with flecks of dust either side.
+ let dust = {
+ let mut g = Grain(0xc4a2_c0a1);
+ let mut parts = vec![];
+ let mut x0 = 0.0;
+ while x0 < 100.0 {
+ let x1 = (x0 + g.range(14.0, 24.0)).min(100.0);
+ let x1 = if 100.0 - x1 < 8.0 { 100.0 } else { x1 };
+ let piece = rough_band(&mut g, (x0, x1), 10, 2.0, 0.3, |x| ends(x, 0.0, 100.0, 8.0, 0.4) * ends(x, x0, x1, 2.0, 0.3));
+ parts.push(ink(piece, 1.0));
+ x0 = x1 + g.range(1.5, 3.0);
+ }
+ for i in 0..30 {
+ let cx = 2.0 + 96.0 * (i as f64 + g.range(0.2, 0.8)) / 30.0;
+ let side = if g.next() < 0.5 { -1.0 } else { 1.0 };
+ let s = g.range(0.15, 0.3);
+ let cy = side * g.range(2.3, 3.5 - s);
+ let f = fleck(&mut g, cx, cy, s, s);
+ parts.push(ink(f, if i % 3 == 0 { 0.7 } else { 1.0 }));
+ }
+ group(parts)
+ };
+ let brushes = vec![
+ art("Chalk Grain", chalk, Colorization::Tints),
+ art("Graphite Pencil", pencil, Colorization::Tints),
+ art("Wax Crayon", crayon, Colorization::Tints),
+ art("Charcoal Dust", dust, Colorization::Tints),
+ ];
+ built("Dry Media", Document::new(100.0, 100.0), brushes)
+}
+
// ---------- commands ----------
fn builtin_info(b: &BuiltinBrushLibrary) -> LibraryInfo {
diff --git a/crates/engine/src/tests/brushlib.rs b/crates/engine/src/tests/brushlib.rs
index 491a471088..73b43b1a76 100644
--- a/crates/engine/src/tests/brushlib.rs
+++ b/crates/engine/src/tests/brushlib.rs
@@ -104,7 +104,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
let list = run(&mut s, "brush.libraries", json!({}));
let libs = list["libraries"].as_array().unwrap();
let ids: Vec<&str> = libs.iter().map(|l| l["id"].as_str().unwrap()).collect();
- assert_eq!(ids, ["art-ribbons", "calligraphic-nibs", "pattern-borders", "scatter-shapes", "game-trails", "energy-beams"]);
+ assert_eq!(ids, ["art-ribbons", "calligraphic-nibs", "pattern-borders", "scatter-shapes", "game-trails", "energy-beams", "dry-media"]);
assert!(libs.iter().all(|l| l["category"] == "builtIn"));
let lib = run(&mut s, "brush.library", json!({"library": "art ribbons"}));
assert_eq!(
@@ -124,6 +124,12 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
["Laser Bolt", "Plasma Arc", "Charge Wave", "Spark Trail"]
);
assert_eq!(libs[5]["count"].as_u64(), Some(4));
+ let dry = run(&mut s, "brush.library", json!({"library": "Dry Media"}));
+ assert_eq!(
+ dry["brushes"].as_array().unwrap().iter().map(|b| (b["name"].as_str().unwrap(), b["type"].as_str().unwrap())).collect::>(),
+ [("Chalk Grain", "art"), ("Graphite Pencil", "art"), ("Wax Crayon", "art"), ("Charcoal Dust", "art")]
+ );
+ assert_eq!((libs[6]["name"].as_str(), libs[6]["count"].as_u64()), (Some("Dry Media"), Some(4)));
run(&mut s, "file.new", json!({"width": 200, "height": 200}));
let id = run(&mut s, "shape.rectangle", json!({"x": 10, "y": 20, "width": 40, "height": 8}))["id"].as_u64().unwrap();
let added = run(&mut s, "brush.addFromLibrary", json!({"library": "energy-beams", "name": "Laser Bolt", "apply": true, "ids": [id]}));
@@ -136,6 +142,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
("scatter-shapes", "scatter"),
("game-trails", "art"),
("energy-beams", "art"),
+ ("dry-media", "art"),
] {
let (_, lib) = cmd::brushlib::library(&s, id).unwrap();
assert!(lib.len() >= 4, "{id}");
@@ -165,6 +172,137 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
assert!(s.execute("brush.library", &json!({"library": "nope"})).is_err());
}
+/// Whether `p` lies inside the polygon through `pts` (even-odd ray cast).
+fn inside(p: vectorcraft_geom::Point, pts: &[vectorcraft_geom::Point]) -> bool {
+ let mut odd = false;
+ for (i, a) in pts.iter().enumerate() {
+ let b = pts[(i + 1) % pts.len()];
+ if (a.y > p.y) != (b.y > p.y) && p.x < a.x + (p.y - a.y) * (b.x - a.x) / (b.y - a.y) {
+ odd = !odd;
+ }
+ }
+ odd
+}
+
+/// Every anchor of the paths in `nodes` and their descendants.
+fn anchors(nodes: &[&vectorcraft_doc::Node]) -> Vec {
+ let mut out = vec![];
+ for n in nodes {
+ n.walk(&mut |c| out.extend(c.path_data().into_iter().flat_map(|p| p.subpaths.iter().flat_map(|sp| sp.anchors.iter().map(|a| a.p)))));
+ }
+ out
+}
+
+/// Dry Media: four art brushes of grainy dry marks (chalk, pencil, crayon, charcoal) with names
+/// of their own. Each one's art is a bounded set of filled vector paths 100 pt long that takes the
+/// stroke color as tints, with real even-odd gaps in the chalk and the crayon; it draws finite art
+/// on curved and short paths, is the same every time it is made, and goes into a document in one
+/// undo step, once, applied, and through a saved library unchanged.
+#[test]
+fn the_dry_media_library_holds_grainy_art_brushes_with_bounded_art() {
+ use vectorcraft_brush::{ArtScale, Colorization};
+ use vectorcraft_geom::FillRule;
+ let mut s = session();
+ let (info, lib) = cmd::brushlib::library(&s, "dry-media").unwrap();
+ assert_eq!((info.name.as_str(), info.category, lib.name.as_str()), ("Dry Media", "builtIn", "Dry Media"));
+ let names: Vec = lib.brushes.iter().map(|b| b.name.clone()).collect();
+ assert_eq!(names, ["Chalk Grain", "Graphite Pencil", "Wax Crayon", "Charcoal Dust"]);
+ let mut total = 0;
+ for (b, (height, gaps)) in lib.brushes.iter().zip([(8.0, true), (2.5, false), (6.0, true), (7.0, false)]) {
+ let BrushKind::Art(a) = &b.kind else { panic!("{} is not an art brush", b.name) };
+ assert_eq!((a.colorization, a.scale, a.width), (Colorization::Tints, ArtScale::Stretch, 100.0), "{}", b.name);
+ let (mut paths, mut holes) = (0, 0);
+ a.art.walk(&mut |n| match &n.kind {
+ NodeKind::Path { path, .. } => {
+ paths += 1;
+ assert!(path.subpaths.iter().all(|sp| sp.closed && sp.anchors.len() >= 4), "{}", b.name);
+ }
+ NodeKind::Compound { children, rule } => {
+ assert_eq!(*rule, FillRule::EvenOdd, "{}", b.name);
+ // The gaps lie inside the band and apart from each other, so each one is a hole.
+ let body = anchors(&[&*children[0]]);
+ let boxes: Vec = children[1..].iter().map(|c| c.path_data().unwrap().bounds().unwrap()).collect();
+ for (i, c) in children[1..].iter().enumerate() {
+ assert!(anchors(&[&**c]).iter().all(|p| inside(*p, &body)), "{}: gap {i} leaves the band", b.name);
+ let r = boxes[i];
+ assert!(boxes[..i].iter().all(|o| r.x0 >= o.x1 || o.x0 >= r.x1 || r.y0 >= o.y1 || o.y0 >= r.y1), "{}: gap {i} overlaps", b.name);
+ }
+ holes += children.len() - 1;
+ }
+ NodeKind::Group { .. } => {}
+ other => panic!("{}: unexpected {other:?}", b.name),
+ });
+ let pts = anchors(&[&a.art]);
+ assert!(pts.iter().all(|p| p.x.is_finite() && p.y.is_finite()));
+ assert!(paths <= 80 && pts.len() <= 500, "{}: {paths} paths, {} anchors", b.name, pts.len());
+ assert_eq!(holes > 0, gaps, "{}: {holes} gaps", b.name);
+ let r = vectorcraft_geom::Rect::from_points(pts[0], pts[0]);
+ let r = pts.iter().fold(r, |r, p| r.union_pt(*p));
+ assert!(r.x0 >= 0.0 && r.x0 < 0.5 && r.x1 <= 100.0 && r.x1 > 99.5, "{}: {r:?}", b.name);
+ assert!((r.height() - height).abs() <= height * 0.25 && r.y0 < 0.0 && r.y1 > 0.0, "{}: {r:?}", b.name);
+ total += pts.len();
+ // Finite art on a curve and on a 2 pt path.
+ for (line, width) in [(vec![(0.0, 0.0), (60.0, -40.0), (140.0, 40.0), (200.0, 0.0)], 1.0), (vec![(0.0, 0.0), (2.0, 0.0)], 3.0)] {
+ let mut bp = vectorcraft_geom::BezPath::new();
+ bp.move_to(line[0]);
+ if line.len() == 4 {
+ bp.curve_to(line[1], line[2], line[3]);
+ } else {
+ bp.line_to(line[1]);
+ }
+ let stroke = vectorcraft_doc::StrokeLayer::new(vectorcraft_color::Paint::solid(vectorcraft_color::Color::BLACK), width);
+ let pieces = vectorcraft_brush::stroke_pieces(&lib.doc, b, &bp, &stroke);
+ let drawn = anchors(&pieces.iter().collect::>());
+ assert!(!drawn.is_empty() && drawn.iter().all(|p| p.x.is_finite() && p.y.is_finite()), "{} on {line:?}", b.name);
+ }
+ }
+ assert!(total <= 1200, "{total} anchors");
+ // Made again, the same bytes; the checksum pins them across runs and platforms.
+ let bytes = serde_json::to_string(&cmd::brushlib::dry_media().brushes).unwrap();
+ assert_eq!(bytes, serde_json::to_string(&lib.brushes).unwrap());
+ let fnv = bytes.bytes().fold(0xcbf2_9ce4_8422_2325_u64, |h, b| (h ^ u64::from(b)).wrapping_mul(0x0100_0000_01b3));
+ assert_eq!(fnv, 12_859_086_488_513_909_464, "the Dry Media art changed");
+ // Names of their own: no default brush's, no other built-in library's.
+ let defaults: Vec<&str> = vectorcraft_brush::defaults().iter().map(|b| b.name.as_str()).collect();
+ let others: Vec = cmd::brushlib::BUILTIN
+ .iter()
+ .filter(|b| b.id != "dry-media")
+ .flat_map(|b| cmd::brushlib::library(&s, b.id).unwrap().1.brushes.iter().map(|x| x.name.clone()).collect::>())
+ .collect();
+ assert!(names.iter().all(|n| !defaults.contains(&n.as_str()) && !others.contains(n)), "{names:?}");
+
+ // Added and applied to a path in one undo step, which undo takes back.
+ let path = run(&mut s, "shape.line", json!({"x1": 10, "y1": 10, "x2": 150, "y2": 60}))["id"].as_u64().unwrap();
+ let stroke_brush = |s: &Session| doc(s).node(NodeId(path)).unwrap().appearance.stroke().and_then(|st| st.brush.clone());
+ let before = (undo_len(&s), brushes(&s));
+ let r = run(&mut s, "brush.addFromLibrary", json!({"library": "Dry Media", "name": "Wax Crayon", "apply": true, "ids": [path]}));
+ assert_eq!((strs(&r["added"]), r["applied"].clone()), (vec!["Wax Crayon"], json!([path])));
+ assert_eq!((undo_len(&s), stroke_brush(&s).as_deref()), (before.0 + 1, Some("Wax Crayon")));
+ assert_eq!(&brush(&s, "Wax Crayon"), lib.brush("Wax Crayon").unwrap());
+ run(&mut s, "edit.undo", json!({}));
+ assert_eq!((brushes(&s), stroke_brush(&s)), (before.1.clone(), None));
+ run(&mut s, "edit.redo", json!({}));
+ // The rest in one more step; then nothing new to add.
+ let r = run(&mut s, "brush.addFromLibrary", json!({"library": "dry-media"}));
+ assert_eq!((strs(&r["added"]), strs(&r["existing"])), (vec!["Chalk Grain", "Graphite Pencil", "Charcoal Dust"], vec!["Wax Crayon"]));
+ assert_eq!(undo_len(&s), before.0 + 2);
+ assert_eq!(
+ brushes(&s),
+ [before.1.clone(), vec!["Wax Crayon".into(), "Chalk Grain".into(), "Graphite Pencil".into(), "Charcoal Dust".into()]].concat()
+ );
+ let r = run(&mut s, "brush.addFromLibrary", json!({"library": "dry-media"}));
+ assert_eq!((strs(&r["added"]).len(), undo_len(&s)), (0, before.0 + 2));
+ // Saved as a library and loaded back: the same brushes, in the document's order.
+ let saved = run(&mut s, "brush.saveLibrary", json!({ "names": names, "name": "Dry" }));
+ let b64 = saved["dataBase64"].as_str().unwrap().to_string();
+ let r = run(&mut s, "brush.loadLibrary", json!({"dataBase64": b64, "name": "Dry.vectorcraft"}));
+ let (_, reopened) = cmd::brushlib::library(&s, r["library"].as_str().unwrap()).unwrap();
+ assert_eq!(reopened.len(), lib.len());
+ for b in &lib.brushes {
+ assert_eq!(reopened.brush(&b.name), Some(b), "{}", b.name);
+ }
+}
+
#[test]
fn a_saved_library_reopens_and_its_brushes_join_another_document_in_one_step() {
let dir = folder("user");
diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv
index bc67d8fd87..67f69080db 100644
--- a/crates/ui-egui/src/i18n/bg.tsv
+++ b/crates/ui-egui/src/i18n/bg.tsv
@@ -6022,6 +6022,11 @@ axis Y Axis Y ос
Calligraphic Nibs Калиграфски писци
Pattern Borders Бордюри с мостри
Scatter Shapes Разсеяни фигури
+ Dry Media Сухи материали
+ Chalk Grain Тебеширено зърно
+ Graphite Pencil Графитен молив
+ Wax Crayon Восъчен пастел
+ Charcoal Dust Въглен прах
Save Brush Library… Запази библиотека с четки…
@msg no empty artboards to delete няма празни работни области за изтриване
Scale Presets Пресети за мащаб
diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv
index 6454cffcc9..9e20a00f2c 100644
--- a/crates/ui-egui/src/i18n/bs.tsv
+++ b/crates/ui-egui/src/i18n/bs.tsv
@@ -6072,6 +6072,11 @@ axis Y Axis Y osa
Calligraphic Nibs Kaligrafski vrhovi
Pattern Borders Ivice od uzoraka
Scatter Shapes Raspršeni oblici
+ Dry Media Suhi mediji
+ Chalk Grain Zrno krede
+ Graphite Pencil Grafitna olovka
+ Wax Crayon Voštana bojica
+ Charcoal Dust Ugljena prašina
Save Brush Library… Sačuvaj biblioteku četkica…
@msg `{_1}` has no brushes to apply `{_1}` nema četkica za primjenu
@msg missing `library` (see brush.libraries) nedostaje `library` (pogledajte brush.libraries)
diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv
index 1567e0e8b5..40f96d0859 100644
--- a/crates/ui-egui/src/i18n/ca.tsv
+++ b/crates/ui-egui/src/i18n/ca.tsv
@@ -3824,6 +3824,11 @@ digits Malayalam Malaiàlam
Scatter Brush Options Opcions del pinzell de dispersió
Scatter Graph Tool Eina de gràfic de dispersió
Scatter Shapes Formes de dispersió
+ Dry Media Tècniques seques
+ Chalk Grain Gra de guix
+ Graphite Pencil Llapis de grafit
+ Wax Crayon Cera de colors
+ Charcoal Dust Pols de carbó
Scatter: Dispersió:
Scissors Tisores
Scissors Tool Eina de tisores
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index e9df0812f2..78f43ab4a2 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -6271,6 +6271,11 @@ axis Y Axis osa Y
Calligraphic Nibs Kaligrafická pera
Pattern Borders Vzorkové okraje
Scatter Shapes Rozptýlené tvary
+ Dry Media Suché techniky
+ Chalk Grain Křídové zrno
+ Graphite Pencil Grafitová tužka
+ Wax Crayon Vosková pastelka
+ Charcoal Dust Uhlový prach
Save Brush Library… Uložit knihovnu štětců…
@msg `{_1}` has no brushes to apply `{_1}` nemá žádné štětce k použití
@msg missing `library` (see brush.libraries) chybí `library` (viz brush.libraries)
diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv
index e259ecba84..22fe87c421 100644
--- a/crates/ui-egui/src/i18n/da.tsv
+++ b/crates/ui-egui/src/i18n/da.tsv
@@ -6037,6 +6037,11 @@ axis Y Axis Y-akse
Calligraphic Nibs Kalligrafiske penne
Pattern Borders Mønsterborter
Scatter Shapes Spredte former
+ Dry Media Tørre medier
+ Chalk Grain Kridtkorn
+ Graphite Pencil Grafitblyant
+ Wax Crayon Vokskridt
+ Charcoal Dust Kulstøv
Save Brush Library… Gem penselbibliotek…
@msg no empty artboards to delete ingen tomme tegneflader at slette
Scale Presets Skaleringsforudindstillinger
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index abfaaa13a7..87f5876eba 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -5854,6 +5854,11 @@ axis Y Axis Y-Achse
Calligraphic Nibs Kalligrafie-Federn
Pattern Borders Musterbordüren
Scatter Shapes Streuformen
+ Dry Media Trockene Medien
+ Chalk Grain Kreidekorn
+ Graphite Pencil Graphitstift
+ Wax Crayon Wachsmalstift
+ Charcoal Dust Kohlestaub
Save Brush Library… Pinsel-Bibliothek speichern…
@msg `{_1}` has no brushes to apply `{_1}` hat keine Pinsel zum Anwenden
@msg missing `library` (see brush.libraries) `library` fehlt (siehe brush.libraries)
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index 4611904ff0..efab4b490e 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -6222,6 +6222,11 @@ axis Y Axis Άξονας Y
Calligraphic Nibs Καλλιγραφικές πένες
Pattern Borders Περιθώρια μοτίβου
Scatter Shapes Σχήματα διασποράς
+ Dry Media Ξηρά μέσα
+ Chalk Grain Κόκκος κιμωλίας
+ Graphite Pencil Μολύβι γραφίτη
+ Wax Crayon Κηρομπογιά
+ Charcoal Dust Σκόνη κάρβουνου
Save Brush Library… Αποθήκευση βιβλιοθήκης πινέλων…
@msg `{_1}` has no brushes to apply Η `{_1}` δεν έχει πινέλα για εφαρμογή
@msg missing `library` (see brush.libraries) λείπει το `library` (δείτε brush.libraries)
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index b91d89b8c0..cbce0ab008 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -6213,6 +6213,11 @@ axis Y Axis Eje Y
Calligraphic Nibs Plumillas caligráficas
Pattern Borders Bordes de motivo
Scatter Shapes Formas de dispersión
+ Dry Media Técnicas secas
+ Chalk Grain Grano de tiza
+ Graphite Pencil Lápiz de grafito
+ Wax Crayon Cera de colores
+ Charcoal Dust Polvo de carboncillo
Save Brush Library… Guardar biblioteca de pinceles…
@msg `{_1}` has no brushes to apply `{_1}` no tiene pinceles para aplicar
@msg missing `library` (see brush.libraries) falta `library` (consulte brush.libraries)
diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv
index e296459895..f4154755b7 100644
--- a/crates/ui-egui/src/i18n/fi.tsv
+++ b/crates/ui-egui/src/i18n/fi.tsv
@@ -6301,6 +6301,11 @@ axis Y Axis Y-akseli
Calligraphic Nibs Kalligrafiakärjet
Pattern Borders Kuvioreunukset
Scatter Shapes Sirontamuodot
+ Dry Media Kuivat välineet
+ Chalk Grain Liitujyvä
+ Graphite Pencil Grafiittikynä
+ Wax Crayon Vahaliitu
+ Charcoal Dust Hiilipöly
Save Brush Library… Tallenna sivellinkirjasto…
@msg `{_1}` has no brushes to apply Kohteessa `{_1}` ei ole käytettäviä siveltimiä
@msg missing `library` (see brush.libraries) `library` puuttuu (katso brush.libraries)
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index ff206b9317..4be80cbfba 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -6266,6 +6266,11 @@ axis Y Axis Axe Y
Calligraphic Nibs Plumes calligraphiques
Pattern Borders Bordures de motif
Scatter Shapes Formes de dispersion
+ Dry Media Techniques sèches
+ Chalk Grain Grain de craie
+ Graphite Pencil Crayon graphite
+ Wax Crayon Craie grasse
+ Charcoal Dust Poussière de fusain
Save Brush Library… Enregistrer la bibliothèque de formes…
@msg `{_1}` has no brushes to apply `{_1}` n'a aucune forme à appliquer
@msg missing `library` (see brush.libraries) `library` manquant (voir brush.libraries)
diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv
index 6698f10a4b..d8407860f2 100644
--- a/crates/ui-egui/src/i18n/hi.tsv
+++ b/crates/ui-egui/src/i18n/hi.tsv
@@ -434,6 +434,11 @@ antiAlias Sharp शार्प
Plasma Arc प्लाज़्मा चाप
Charge Wave चार्ज तरंग
Spark Trail चिंगारी पथ
+ Dry Media सूखे माध्यम
+ Chalk Grain चॉक के दाने
+ Graphite Pencil ग्रेफाइट पेंसिल
+ Wax Crayon मोम क्रेयॉन
+ Charcoal Dust चारकोल धूल
Art using a deleted global swatch keeps its colour. हटाए गए ग्लोबल स्वॉच वाला आर्टवर्क अपना रंग बनाए रखता है।
Artboard आर्टबोर्ड
Artboard {n} of {total} {total} में से आर्टबोर्ड {n}
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index a8d02ca4c4..a24dcf20ee 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -6254,6 +6254,11 @@ axis Y Axis Y tengely
Calligraphic Nibs Kalligrafikus tollhegyek
Pattern Borders Mintázatszegélyek
Scatter Shapes Szórt alakzatok
+ Dry Media Száraz technikák
+ Chalk Grain Krétaszemcse
+ Graphite Pencil Grafitceruza
+ Wax Crayon Zsírkréta
+ Charcoal Dust Szénpor
Save Brush Library… Ecsetkönyvtár mentése…
@msg `{_1}` has no brushes to apply A(z) `{_1}` nem tartalmaz alkalmazható ecsetet
@msg missing `library` (see brush.libraries) hiányzik a `library` (lásd: brush.libraries)
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 04581cd727..bf4bf9af40 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -6037,6 +6037,11 @@ axis Y Axis Sumbu Y
Calligraphic Nibs Pena kaligrafi
Pattern Borders Bingkai pola
Scatter Shapes Bentuk sebar
+ Dry Media Media kering
+ Chalk Grain Butiran kapur
+ Graphite Pencil Pensil grafit
+ Wax Crayon Krayon lilin
+ Charcoal Dust Debu arang
Save Brush Library… Simpan pustaka kuas…
@msg no empty artboards to delete tidak ada artboard kosong untuk dihapus
Scale Presets Preset skala
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 82827964fe..e1d073b1f2 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -5888,6 +5888,11 @@ axis Y Axis Asse Y
Calligraphic Nibs Pennini calligrafici
Pattern Borders Bordi a motivo
Scatter Shapes Forme a dispersione
+ Dry Media Tecniche secche
+ Chalk Grain Grana di gesso
+ Graphite Pencil Matita di grafite
+ Wax Crayon Pastello a cera
+ Charcoal Dust Polvere di carboncino
Save Brush Library… Salva libreria pennelli…
@msg `{_1}` has no brushes to apply `{_1}` non ha pennelli da applicare
@msg missing `library` (see brush.libraries) manca `library` (vedi brush.libraries)
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 42a4aa3cf2..babf405210 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -5953,6 +5953,11 @@ axis Y Axis Y 軸
Calligraphic Nibs カリグラフィペン先
Pattern Borders パターンボーダー
Scatter Shapes 散布シェイプ
+ Dry Media ドライメディア
+ Chalk Grain チョークの粒子
+ Graphite Pencil 黒鉛鉛筆
+ Wax Crayon ワックスクレヨン
+ Charcoal Dust 木炭の粉
Save Brush Library… ブラシライブラリを保存…
@msg `{_1}` has no brushes to apply `{_1}` に適用できるブラシがありません
@msg missing `library` (see brush.libraries) `library` がありません (brush.libraries を参照)
diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv
index 30b0abd6bf..db7edfa9e7 100644
--- a/crates/ui-egui/src/i18n/ka.tsv
+++ b/crates/ui-egui/src/i18n/ka.tsv
@@ -6222,6 +6222,11 @@ axis Y Axis Y ღერძი
Calligraphic Nibs კალიგრაფიული წვერები
Pattern Borders პატერნის ბორდიურები
Scatter Shapes გაბნეული ფიგურები
+ Dry Media მშრალი მასალები
+ Chalk Grain ცარცის მარცვალი
+ Graphite Pencil გრაფიტის ფანქარი
+ Wax Crayon ცვილის ფანქარი
+ Charcoal Dust ნახშირის მტვერი
Save Brush Library… ფუნჯების ბიბლიოთეკის შენახვა…
@msg `{_1}` has no brushes to apply `{_1}`-ში გამოსაყენებელი ფუნჯები არ არის
@msg missing `library` (see brush.libraries) `library` აკლია (იხ. brush.libraries)
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 3bc8360b49..3af02c656c 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -5849,6 +5849,11 @@ axis Y Axis Y축
Calligraphic Nibs 서예 펜촉
Pattern Borders 패턴 테두리
Scatter Shapes 흩뿌리기 모양
+ Dry Media 건식 재료
+ Chalk Grain 분필 입자
+ Graphite Pencil 흑연 연필
+ Wax Crayon 왁스 크레용
+ Charcoal Dust 목탄 가루
Save Brush Library… 브러시 라이브러리 저장…
@msg `{_1}` has no brushes to apply `{_1}`에 적용할 브러시가 없습니다
@msg missing `library` (see brush.libraries) `library`가 없습니다(brush.libraries 참조)
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index c6f37b432a..254a77856b 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -6088,6 +6088,11 @@ axis Y Axis Y-as
Calligraphic Nibs Kalligrafische penpunten
Pattern Borders Patroonranden
Scatter Shapes Strooivormen
+ Dry Media Droge media
+ Chalk Grain Krijtkorrel
+ Graphite Pencil Grafietpotlood
+ Wax Crayon Waskrijt
+ Charcoal Dust Houtskoolstof
Save Brush Library… Penseelbibliotheek opslaan…
@msg no empty artboards to delete geen lege tekengebieden om te verwijderen
Scale Presets Schaalvoorinstellingen
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 3647b56f54..833c381071 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -6125,6 +6125,11 @@ axis Y Axis Oś Y
Calligraphic Nibs Stalówki kaligraficzne
Pattern Borders Obramowania wzorków
Scatter Shapes Kształty rozproszone
+ Dry Media Techniki suche
+ Chalk Grain Ziarno kredy
+ Graphite Pencil Ołówek grafitowy
+ Wax Crayon Kredka woskowa
+ Charcoal Dust Pył węglowy
Save Brush Library… Zapisz bibliotekę pędzli…
@msg `{_1}` has no brushes to apply `{_1}` nie ma pędzli do zastosowania
@msg missing `library` (see brush.libraries) brak `library` (zobacz brush.libraries)
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 530a62719a..e39abfa421 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -6186,6 +6186,11 @@ axis Y Axis Eixo Y
Calligraphic Nibs Penas Caligráficas
Pattern Borders Bordas de Padrão
Scatter Shapes Formas de Dispersão
+ Dry Media Técnicas Secas
+ Chalk Grain Grão de Giz
+ Graphite Pencil Lápis de Grafite
+ Wax Crayon Giz de Cera
+ Charcoal Dust Pó de Carvão
Save Brush Library… Salvar Biblioteca de Pincéis…
@msg `{_1}` has no brushes to apply `{_1}` não tem pincéis para aplicar
@msg missing `library` (see brush.libraries) falta `library` (consulte brush.libraries)
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 341dc196f4..75a556f585 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -5882,6 +5882,11 @@ axis Y Axis Ось Y
Calligraphic Nibs Каллиграфические перья
Pattern Borders Узорные каймы
Scatter Shapes Рассеянные фигуры
+ Dry Media Сухие материалы
+ Chalk Grain Меловое зерно
+ Graphite Pencil Графитный карандаш
+ Wax Crayon Восковой мелок
+ Charcoal Dust Угольная пыль
Save Brush Library… Сохранить библиотеку кистей…
@msg `{_1}` has no brushes to apply В `{_1}` нет кистей для применения
@msg missing `library` (see brush.libraries) не указан `library` (см. brush.libraries)
diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv
index ed59d98113..0cb3950ca9 100644
--- a/crates/ui-egui/src/i18n/sv.tsv
+++ b/crates/ui-egui/src/i18n/sv.tsv
@@ -6290,6 +6290,11 @@ axis Y Axis Y-axel
Calligraphic Nibs Kalligrafiska pennspetsar
Pattern Borders Mönsterbårder
Scatter Shapes Spridningsformer
+ Dry Media Torra medier
+ Chalk Grain Kritkorn
+ Graphite Pencil Grafitpenna
+ Wax Crayon Vaxkrita
+ Charcoal Dust Koldamm
Save Brush Library… Spara penselbibliotek…
@msg `{_1}` has no brushes to apply `{_1}` har inga penslar att använda
@msg missing `library` (see brush.libraries) `library` saknas (se brush.libraries)
diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs
index c63e000795..47b860d0d1 100644
--- a/crates/ui-egui/src/i18n/tests.rs
+++ b/crates/ui-egui/src/i18n/tests.rs
@@ -184,6 +184,20 @@ fn font_height_reference_labels_are_in_complete_catalogs() {
}
}
+/// The Window › Brush Libraries menu, built from the built-in library table, names each library.
+#[test]
+fn built_in_brush_library_names_are_in_complete_catalogs() {
+ let mut bad = vec![];
+ for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus) {
+ let missing: Vec<&str> =
+ vectorcraft_engine::cmd::brushlib::BUILTIN.iter().map(|b| b.name).filter(|l| lang.catalog().plain(l).is_none()).collect();
+ if !missing.is_empty() {
+ bad.push(format!("{} is missing {missing:?}", lang.code));
+ }
+ }
+ assert!(bad.is_empty(), "{}", bad.join("\n"));
+}
+
/// Preference choices and the marquee's E hint share the same translated labels.
#[test]
fn marquee_selection_labels_are_in_complete_catalogs() {
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index dc89f33802..6d16b3e5f5 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -6227,6 +6227,11 @@ axis Y Axis Y ekseni
Calligraphic Nibs Kaligrafi Uçları
Pattern Borders Desen Kenarlıkları
Scatter Shapes Dağılım Şekilleri
+ Dry Media Kuru Teknikler
+ Chalk Grain Tebeşir Dokusu
+ Graphite Pencil Grafit Kalem
+ Wax Crayon Mum Boya
+ Charcoal Dust Kömür Tozu
Save Brush Library… Fırça Kitaplığını Kaydet…
@msg `{_1}` has no brushes to apply `{_1}` içinde uygulanacak fırça yok
@msg missing `library` (see brush.libraries) `library` eksik (bkz. brush.libraries)
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 8d67846ecd..8ca9966c75 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -5868,6 +5868,11 @@ axis Y Axis Вісь Y
Calligraphic Nibs Каліграфічні пера
Pattern Borders Візерункові облямівки
Scatter Shapes Розсіяні фігури
+ Dry Media Сухі матеріали
+ Chalk Grain Крейдяне зерно
+ Graphite Pencil Графітний олівець
+ Wax Crayon Восковий олівець
+ Charcoal Dust Вугільний пил
Save Brush Library… Зберегти бібліотеку пензлів…
@msg `{_1}` has no brushes to apply У `{_1}` немає пензлів для застосування
@msg missing `library` (see brush.libraries) не вказано `library` (див. brush.libraries)
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index 8f1ea434fd..a07a2f65b5 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -5869,6 +5869,11 @@ axis Y Axis Trục Y
Calligraphic Nibs Ngòi bút thư pháp
Pattern Borders Viền họa tiết
Scatter Shapes Hình phân tán
+ Dry Media Chất liệu khô
+ Chalk Grain Hạt phấn
+ Graphite Pencil Bút chì than chì
+ Wax Crayon Bút sáp màu
+ Charcoal Dust Bụi than
Save Brush Library… Lưu thư viện cọ…
@msg `{_1}` has no brushes to apply `{_1}` không có cọ nào để áp dụng
@msg missing `library` (see brush.libraries) thiếu `library` (xem brush.libraries)
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 05c6539bf7..b009ebb080 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -6109,6 +6109,11 @@ axis Y Axis Y 轴
Calligraphic Nibs 书法笔尖
Pattern Borders 图案边框
Scatter Shapes 散布形状
+ Dry Media 干性画材
+ Chalk Grain 粉笔颗粒
+ Graphite Pencil 石墨铅笔
+ Wax Crayon 蜡笔
+ Charcoal Dust 炭粉
Save Brush Library… 保存画笔库…
@msg `{_1}` has no brushes to apply `{_1}` 中没有可应用的画笔
@msg missing `library` (see brush.libraries) 缺少 `library`(请参阅 brush.libraries)
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index cb8a61362e..9e51e4c17d 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -5906,6 +5906,11 @@ axis Y Axis Y 軸
Calligraphic Nibs 書法筆尖
Pattern Borders 圖樣邊框
Scatter Shapes 散佈形狀
+ Dry Media 乾性畫材
+ Chalk Grain 粉筆顆粒
+ Graphite Pencil 石墨鉛筆
+ Wax Crayon 蠟筆
+ Charcoal Dust 炭粉
Save Brush Library… 儲存筆刷資料庫…
@msg `{_1}` has no brushes to apply `{_1}` 中沒有可套用的筆刷
@msg missing `library` (see brush.libraries) 未提供 `library`(請參閱 brush.libraries)
diff --git a/crates/ui-egui/src/panels/tests_brush_libraries.rs b/crates/ui-egui/src/panels/tests_brush_libraries.rs
index 6918e9118f..e57c127319 100644
--- a/crates/ui-egui/src/panels/tests_brush_libraries.rs
+++ b/crates/ui-egui/src/panels/tests_brush_libraries.rs
@@ -135,9 +135,12 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() {
json!("pattern-borders"),
json!("scatter-shapes"),
json!("game-trails"),
- json!("energy-beams")
+ json!("energy-beams"),
+ json!("dry-media")
]
);
+ let dry = entries.iter().find(|e| under(e) && e.params["library"] == "dry-media").map(|e| e.label.as_str());
+ assert_eq!(dry, Some("Dry Media"));
let enabled = |cmd: &str| entries.iter().find(|e| under(e) && e.command.as_deref() == Some(cmd)).map(|e| e.enabled);
assert_eq!(enabled("window.brushLibrary.other"), Some(true));
assert_eq!(enabled("ui.saveBrushLibrary"), Some(true), "a new document has the default brushes");
@@ -151,6 +154,13 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() {
for t in ["Open Brush Library", "Save Brush Library…"] {
assert!(texts.iter().any(|x| x.ends_with(t)), "{t}: {texts:?}");
}
+ // Dry Media opens in a library panel, and a click on Chalk Grain adds it in one step.
+ let r = app.run("window.brushLibrary", json!({"library": "Dry Media"})).unwrap();
+ assert_eq!((r["open"].as_str(), r["count"].as_u64()), (Some("dry-media"), Some(4)));
+ let undo = undo_len(&app);
+ click(&mut app, &ctx, "Chalk Grain", Modifiers::NONE, 1.0);
+ assert!(has(&app, "Chalk Grain") && !has(&app, "Wax Crayon"));
+ assert_eq!(undo_len(&app), undo + 1);
// Without brushes there is nothing to save.
let all: Vec = vectorcraft_brush::library(&app.session.doc().unwrap().doc).into_iter().map(|b| b.name).collect();
app.run("brush.delete", json!({ "names": all })).unwrap();
diff --git a/docs/gaps.md b/docs/gaps.md
index a228181abb..271bce11b4 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -631,8 +631,8 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
libraries ([public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html),
[import](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html)):
Window › Brush Libraries and the Brushes panel's Brush Libraries Menu open each library in a library panel of
- its own (six original libraries generated in code: Art Ribbons, Calligraphic Nibs, Pattern Borders, Scatter
- Shapes, Game Trails and Energy Beams; User Defined; Other Library… reads the brushes of any document VectorCraft opens); a
+ its own (seven original libraries generated in code: Art Ribbons, Calligraphic Nibs, Pattern Borders, Scatter
+ Shapes, Game Trails, Energy Beams and Dry Media (grainy chalk, pencil, crayon and charcoal art brushes); User Defined; Other Library… reads the brushes of any document VectorCraft opens); a
click adds a
brush to the document's Brushes with the patterns, symbols and other resources its art uses, as one undo
step (applied to the selected paths in the same step), dragging one onto a path adds and applies it and
@@ -650,7 +650,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
Game HUD with Health Fill, Mana Glow, Damage Flash, Quest Outline, Coin Shine and Boss Alert, and Status Effects
with Poison Tint, Freeze Edge, Burn Aura, Stun Pulse, Stealth Fade and Shield Buff; User Defined; Other
Library…; `graphicStyle.libraries`, `graphicStyle.addFromLibrary`).
-- **Missing:** more built-in brush libraries beyond the six shipped (and further graphic-style libraries beyond the eight shipped, and further symbol libraries beyond Basic
+- **Missing:** more built-in brush libraries beyond the seven shipped (and further graphic-style libraries beyond the eight shipped, and further symbol libraries beyond Basic
Shapes, UI Frames, Map Markers, Inventory Icons and Skill Icons; original, generated in code, never Adobe's); dynamic symbols' `.ai` read and write;
Global Edit of groups holding type or images, rotated copies as matches and highlighting matches before the
start; 9-slice guides outside the symbol's art (a dragged guide stops at the art's edge).
diff --git a/docs/mcp.md b/docs/mcp.md
index 7f6df79837..501e24d284 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -3402,8 +3402,9 @@ error.
## Brush libraries
-Brush libraries are read-only sets of brushes: six generated in code (Art Ribbons, Calligraphic Nibs, Pattern
-Borders, Scatter Shapes, Game Trails, Energy Beams), the `.vectorcraft` files in the user library folder of the desktop app (User
+Brush libraries are read-only sets of brushes: seven generated in code (Art Ribbons, Calligraphic Nibs, Pattern
+Borders, Scatter Shapes, Game Trails, Energy Beams, and Dry Media with the Chalk Grain, Graphite Pencil, Wax Crayon and
+Charcoal Dust art brushes, id `dry-media`), the `.vectorcraft` files in the user library folder of the desktop app (User
Defined) and the brushes of any document loaded with `brush.loadLibrary` (a document without brushes of its own has
the default ones). `brush.libraries` lists them (`id`, `name`, `category`: `builtIn`, `user` or `loaded`, `count`) and
`brush.library {library}` returns one's brushes (`name`, `type`; `library` is an id or a name).
diff --git a/docs/roadmap.md b/docs/roadmap.md
index 41066cbb49..92275336aa 100644
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -149,7 +149,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l
| M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof and the custom dictionary and Ignore All commands and Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, and Spelling › Auto Spell Check in the context menu of type, and the Edit Custom Dictionary dialog (#4936; the Check Spelling dialog remains); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs, OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, spell check, vertical type pending | 45–60 |
| M8 | Transform & distort (Puppet Warp, Liquify tools, Envelopes, Blends, Perspective Grid) | ✅ done (M8.1–M8.20 on 2026-10-06, fidelity pass): Liquify Tool Options with one shared brush, pen pressure, hold-to-apply, a safe scope and incremental strokes; tool options that last; Puppet Warp rotation, multi-select, Control bar and a rest-shape session that follows Undo; Width tool on compound paths; Envelope dialogs with preview, Reset with Warp/Mesh, full Envelope Options, type/images/symbols/appearance/gradients/patterns distorted on canvas and in every export, warps that keep their frame, Edit Contents, mesh handles and Control bar; Blend Options, anchor-targeted Blend tool, editable spine, keys picked on the canvas, faithful interpolation and knockout; Anchor Point spine conversion/handle editing and selection priority (#2544), with #2425 Shift reshape preserved; Perspective Grid with Define Grid, presets, lock/snap/rulers, widgets, the 1–4 plane switch, movable planes, Perspective Selection scale/copy/perpendicular/Transform Again, and type and symbols truly projected with Edit Text. Left: Anti-Alias and Preserve Shape output, warp-envelope point editing, brush interpolation in blends, Free Transform/Scale/Reflect along a rotated box | 2–4 |
| M9 | Live effects (+ 3D & Materials) | 🟡 2D effects done incl. Effect → Pathfinder, Color Adjustments and Document Raster Effects Settings; PDF export warns when the pixel cap lowers raster-effect resolution; Artistic › Colored Pencil, Cutout, Dry Brush, Film Grain, Fresco, Neon Glow, Paint Daubs, Palette Knife, Poster Edges, Rough Pastels, Smudge Stick, Sponge, Underpainting and Watercolor and Sketch › Halftone Pattern, Bas Relief, Charcoal, Conté Crayon, Photocopy, Stamp, Torn Edges and Water Paper done (57/57 Photoshop filters); Revolve with automatic smooth vector shading, default-on circular caps and continuous rims, Extrude & Bevel, Inflate and Rotate with one to ten colored directional lights and four original lighting presets; SVG Filters, remaining raster effects and 3D materials and shadows pending | 81–130 |
-| M10 | Brushes, symbols, patterns, Repeat | 🟡 pattern swatches (5 tile types, Pattern Options, editing mode, SVG ``/PDF export) and live Repeat (radial/grid/mirror) done; interactive selected mirror axis implemented (focused and native checks passed; full CI blocked by an unrelated text test); symbol libraries done (Window › Symbol Libraries, five generated libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons), User Defined, Other Library…, Save Symbols); brush libraries done (Window › Brush Libraries, six generated libraries, User Defined, Other Library…, Save Brushes); symbol editing shows draggable 9-slice guides (#5280), with guides outside the artwork still unsupported; brushes/symbols in progress | 23–37 |
+| M10 | Brushes, symbols, patterns, Repeat | 🟡 pattern swatches (5 tile types, Pattern Options, editing mode, SVG ``/PDF export) and live Repeat (radial/grid/mirror) done; interactive selected mirror axis implemented (focused and native checks passed; full CI blocked by an unrelated text test); symbol libraries done (Window › Symbol Libraries, five generated libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons), User Defined, Other Library…, Save Symbols); brush libraries done (Window › Brush Libraries, seven generated libraries including Dry Media, User Defined, Other Library…, Save Brushes); symbol editing shows draggable 9-slice guides (#5280), with guides outside the artwork still unsupported; brushes/symbols in progress | 23–37 |
| 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) | 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 |
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index 908895ad64..7269f440a0 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -218,7 +218,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de
| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged |
| Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) |
| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | Eyedropper copies effective character dimensions across text transforms (#6404); 30.0's gradient additions are done (dither, perceptual blending, presets); freeform gradients in SVG/PDF, mixed spot/process gradients in SVG, PDF gradients mixing a spot color with RGB or Lab stops, and dithered spot gradient fills and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, which PDF export writes as images in process colors| 4–7 | estimated; Recolor model selection is available through the engine and MCP (#2520), and the dialog's color sliders (HSB, RGB, CMYK, Lab, Tint for a spot color) edit the selected row's new color in its mode, and the Edit tab's Global Adjust sliders (Saturation, Brightness, Temperature, Luminosity, -100% to 100%) change every recolored color at once (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged |
-| Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (six generated libraries including Game Trails and Energy Beams, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) |
+| Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (seven generated libraries including Game Trails, Energy Beams and Dry Media, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) |
| Appearance, transparency, graphic styles, masks | 5 | 97% | raster effect reach in preview bounds | 1–2 | estimated; Transform typing, sliders, preview, and undo are covered in `crates/ui-egui/src/panels/tests_appearance.rs` |
| 3D and Materials (and Turntable) | 4 | ~25% | live Revolve with automatic smooth vector shading and default-on continuous circular caps, Extrude & Bevel (twist, taper, caps, five bevel shapes), Inflate and Rotate with Position presets (colored Inflate uses smooth membrane lighting; white-light Inflate retains its existing shading; Extrude & Bevel and Rotate retain planar shading; one to ten colored lights, shared neutral ambient, painter visibility); materials, light presets, shadows, ray tracing, the rest of 3D Classic (Revolve, Rotate, Map Art), Turntable views, textures, map art and shading in 3D export | 30–55 | estimated (Extrude & Bevel, Inflate and Rotate added 2026-10-12) |
| Type core | 9 | 80% | Auto-leading style resets are implemented; Hyphenation… and Justification… options are done (#2310, #2755), and a paragraph's Auto Leading also sets the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; remaining: Optical Margin Alignment, Middle Eastern features beyond bidi layout, optional group font-size preservation; transformed character controls fixed (#1034), see [type-parity.md](type-parity.md) | 14–19 | estimated; eleven-language pattern hyphenation in both composers, with grapheme and shaping-cluster protection (#4947, `hyphen::tests` and `layout::wrapping_tests`); Sanskrit patterns pending an allowlisted source; recent-font groups in font pickers (#3515); full-name font matches regression-tested (#1258); mixed paragraph alignment indication implemented; headless regressions, full integration CI and visual review pass; localized legacy family-name fallback with loaded/catalog regressions (#2208); Fractional Widths per type object regression-tested; color emoji fonts with bitmap glyphs (`sbix`, `CBDT`) draw and export; threading ports: every selected area type and type on a path shows its in and out ports (empty, arrow, red "+"), and the Selection tool threads from either, the in port into a frame before it, and a double-click on a threaded port breaks the thread there (`threads::tests::break_splits_the_thread_and_the_story_flows_into_the_first_part`, `select::tests::a_double_click_on_a_threaded_port_breaks_the_thread`, `canvas::tests::a_double_click_on_a_threaded_out_port_breaks_the_thread`) (#2572; `select::tests::a_click_on_the_in_port_threads_into_a_frame_before_it`, `text::tests::selected_type_shows_its_ports_in_each_state`, `threads::tests::add_before_threads_the_story_from_the_new_frame_into_the_clicked_one`, live screenshot); the Glyphs panel highlights and scrolls to the character selected with the Type tool (#4908, `panels::glyphs` tests); the OpenType panel lists only `ss01`–`ss20` sets present in the selected font and uses its custom names when supplied; Type-range desktop Copy publishes styled art and keeps font family, size and color on canvas Paste after editing (#5636); paint-only Arabic harakat keep joining with conditional GDEF-mark ownership and Insert Kashidas base-letter paint (`tests::harakat`) |
@@ -487,7 +487,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale)
| Drawing tools | 7 | 86% | rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 |
| Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 86% | Live Paint gap options, Shape Builder gap detection, options (Tool Options dialog, clicking a stroke in merge mode) and Shift-drag marquee | 3–6 |
| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 96% | freeform gradients in SVG/PDF and mixed spot/process gradients in SVG (exported as stops; PDF export keeps the spot inks in a DeviceN shading, except next to RGB or Lab stops; dithered fills and Perceptual gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve are written as images in process colors), pattern fills in Expand | 2–4; Eyedropper source reads regression-tested (#1251) |
-| Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (six generated in code including Game Trails and Energy Beams are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 |
+| Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (seven generated in code including Game Trails, Energy Beams and Dry Media are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 |
| Appearance, transparency, graphic styles, masks | 5 | 98% | raster effect reach in preview bounds (flattener presets apply in PDF, EPS and print) | 1–2 |
| Live vector effects | 5 | 85% | Outline Object, Pathfinder Hard/Soft Mix and Trap (since done: #3061, #3063, #3785), SVG Filters, Transform Patterns and Scale Strokes & Effects on a fill's or stroke's own Transform effect | 6–10 |
| 3D and Materials | 4 | ~25% | Initial Revolve, Extrude & Bevel, Inflate and Rotate, with simple lighting; materials, light presets, shadows, ray tracing, Revolve (Classic), Rotate (Classic), Map Art and more complete visibility remain | 25–45 |
@@ -539,7 +539,7 @@ since 2026-10-01.
| **Interaction fidelity:** modifiers, cursors, small behaviours | ~30–40% | The dedicated pass hasn't started, and there has been no side-by-side session with Illustrator yet. A power user notices this first |
| **Look & feel** | ~75–80% | Measured against Illustrator 2026 screenshots (2026-10-02); the panels added since haven't been re-measured |
| **File interop** | ~85% | SVG/SVGZ, PDF and PDF-compatible `.ai` (and legacy version 7 `.ai` out, keeping layers, groups and type as text), EPS, DXF, EMF/WMF, raster formats, PSD export and PSD/PSB placement (merged image), Place and Links, Package, Print, clipboard flavours. Affinity documents (Affinity 1–3) open natively as editable art, checked against 51 pinned public files (33 current `.af`), with selected saved-thumbnail comparisons and every-board native/SVG/PDF/PSD checks for current files; Affinity export is missing and effects, adjustments and brushes don't import. Affinity isn't an Illustrator feature, so this doesn't raise the parity score. The editing copy inside an Illustrator EPS or `.ai` is read for its structure: layers, groups, names, hidden objects and type, colours, gradients, transparency, images and every artboard (see Out of scope for what it doesn't read yet); DWG has no open spec |
-| **Bundled content:** brush, symbol, style and swatch libraries | ~46% | Ours are original and generated in code, and far fewer than Illustrator ships; symbol libraries have five (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons), graphic style libraries eight (including Game HUD and Status Effects) and brush libraries six (Art Ribbons, Calligraphic Nibs, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams) beside User Defined and Other Library… |
+| **Bundled content:** brush, symbol, style and swatch libraries | ~46% | Ours are original and generated in code, and far fewer than Illustrator ships; symbol libraries have five (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons), graphic style libraries eight (including Game HUD and Status Effects) and brush libraries seven (Art Ribbons, Calligraphic Nibs, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media) beside User Defined and Other Library… |
| **Performance** | unverified | Multithreaded, off-thread rendering and caches are in place. The last budget run (2026-10-01, loaded machine) measured 290 ms for a 50k-path fit against a 16 ms budget. Re-run `vectorcraft-cli perf` on an idle machine |
| **Robustness** | good, new | ~2,840 tests, property tests, no panics in shipped code (lints, the `guard` safety net, import fuzzing), Data Recovery. Missing: a corpus of real-world files, Windows/Linux/browser QA |
| **Platforms and 1.0 polish** | ~60% | The macOS app and the web build work, and Finder opens every readable format with the macOS app (#295, #354); on macOS the menus are in the system menu bar, laid out as a Mac app's, with the in-window menus as a fallback (`--in-window-menus`; verified on Windows and by cross-compilation, not yet by hand on a Mac); hybrid-graphics laptops render on the power-saving GPU by default on Windows and macOS (#306), and Windows starts on Direct3D 12, falling back to OpenGL, and loads no Vulkan driver unless `WGPU_BACKEND` asks for it (#545: Vulkan flickered black on an Intel GPU, DX12 and OpenGL didn't; #806: a faulty Vulkan driver crashed the app before its window appeared; verified by unit tests and the reporter's runs with `WGPU_BACKEND`), and Linux on the GPU the desktop runs on, since a Wayland compositor may refuse frames from the other one; a window that fails on its GPU while starting up starts again on the next one instead of crashing (#502; the dual-GPU Wayland case is verified by unit tests and cross-compilation, not on such hardware); web drops land in the document they were dropped on (#359); desktop drops carry no pointer position (winit 0.30), so a dropped document opens as a tab of its own and a picture or text is placed in the middle of the view, while the web places anything dropped on the canvas and opens what is dropped off it, as Illustrator does (#472); a web page that loses its WebGPU device or WebGL context restarts its graphics with the same documents (#369); on Linux/Wayland the clipboard reads the compositor's own (data-control) and copied image files paste, but files can't be dropped on the window under native Wayland until eframe moves to winit 0.31 (#398; the Wayland side is verified by compilation only), so Preferences › Performance › Linux Display Server › X11 (XWayland) opens the window through XWayland, where drops work (#1151; verified by unit tests and cross-compilation, not on a Wayland desktop); on Linux the Paste menu checks the system clipboard on a background thread, so a clipboard owner that never answers no longer freezes the window, while Windows and macOS keep their quick in-line check (#510; the X11 hang verified by the contributor, here by headless tests); on KDE Plasma 6.3+ under Wayland, pens and pen displays reach the app only under XWayland (`WAYLAND_DISPLAY=`) or with KWin's `KWIN_WAYLAND_EMULATE_TABLET=1`, since winit 0.30 has no Wayland tablet input (#491, not verified on hardware); Windows/Linux packaging and accessibility are pending |
@@ -836,7 +836,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Expand of symbol instances:** Object › Expand turns selected symbol instances (without effects, not in perspective, in groups or placed documents too) into their art as Break Link to Symbol places it, one level deep, as one undo step; the Expand dialog's Fill and Stroke reach that art (`object.expand`, `crates/engine/src/tests/expand_symbols.rs`; estimated, score unchanged).
- **Reset Transformation** ([Transform symbols](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/transform-symbols.html), [Symbols panel options](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/symbols-panel-options.html)): the Symbols panel menu's Reset Transformation and the Control bar's Reset, shown while symbol instances are selected, give the selected instances their symbol's own scale again, without rotation or shear, as one undo step (`symbol.instance.resetTransform`); an instance in perspective is left as it is. VectorCraft's own rules: each instance keeps the center of its bounding box in place, reflection is removed too, and the menu item and the button are enabled only while a selected instance would change. Tests: `tests::brushsym::reset_transformation_restores_the_symbols_scale_and_keeps_the_center`, `reset_transformation_keeps_the_center_of_art_away_from_the_origin`, `reset_transformation_ignores_a_stored_size_that_is_not_positive`, `reset_transformation_leaves_unchanged_instances_and_refuses_bad_ids`, `panels::symbols::tests::reset_transformation_is_enabled_for_a_transformed_instance_and_resets_it`.
- **Expand of dimensions:** Object › Expand, Expand Appearance, Create Outlines and Outline Stroke turn a dimension whose art they change into a plain group of that art, which stays as it is through later moves, scales and edits of what it measured; undo gives the live dimension back (`crates/engine/tests/it/dimensions.rs`; VectorCraft's own rule; estimated, score unchanged).
- - **Brush libraries** ([public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html), [import](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html), [Brushes panel](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html)): Window › Brush Libraries, the Brushes panel's Brush Libraries Menu and its menu's Open Brush Library open each library in a library panel of its own, as swatch, graphic style and symbol libraries do. The built-in libraries (Art Ribbons, Calligraphic Nibs, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams) are original brushes generated in code (`crates/engine/src/cmd/brushlib.rs`); Striped Ribbon's art is filled with the library's own pattern and Sparkles scatters the library's own symbol; Game Trails adds motion art brushes (Speed Line, Dash Trail, Burst Ray, Zigzag); Energy Beams adds laser and plasma art brushes (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail). A click on a brush adds it to the document's Brushes as one undo step with every resource its art uses (patterns, symbols, swatches, graphic styles, images), makes it the current brush and, with paths selected, applies it to them in the same step; a brush the document already has is not added again and a different brush of the same name comes in numbered ("Wave 2"). Shift/Cmd-clicks select brushes for Add to Brushes; a brush dragged onto a path is added and applied to it, and one dragged onto the Brushes panel is added. Save Brushes… / the Brushes panel's Save Brush Library… write the document's brushes (or the selected ones) as a `.vectorcraft` library into the `Brushes` folder next to the preferences, listed under User Defined, or to a file; Other Library… reads the brushes of any document VectorCraft opens. Thumbnails, in the library panels, the Brushes panel and Brush Options, render brush art with the patterns and symbols it uses. Copying brushed art now carries the patterns and symbols its brush's art uses too. Tests: `crates/engine/src/tests/brushlib.rs`, `crates/ui-egui/src/panels/tests_brush_libraries.rs`, `panels::brushes::tests::library_brush_previews_show_the_patterns_their_art_uses`, `canvas::tests::a_library_brush_dropped_on_a_path_is_added_and_applied_in_one_step`.
+ - **Brush libraries** ([public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html), [import](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html), [Brushes panel](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html)): Window › Brush Libraries, the Brushes panel's Brush Libraries Menu and its menu's Open Brush Library open each library in a library panel of its own, as swatch, graphic style and symbol libraries do. The built-in libraries (Art Ribbons, Calligraphic Nibs, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media) are original brushes generated in code (`crates/engine/src/cmd/brushlib.rs`); Striped Ribbon's art is filled with the library's own pattern and Sparkles scatters the library's own symbol; Game Trails adds motion art brushes (Speed Line, Dash Trail, Burst Ray, Zigzag); Energy Beams adds laser and plasma art brushes (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail). A click on a brush adds it to the document's Brushes as one undo step with every resource its art uses (patterns, symbols, swatches, graphic styles, images), makes it the current brush and, with paths selected, applies it to them in the same step; a brush the document already has is not added again and a different brush of the same name comes in numbered ("Wave 2"). Shift/Cmd-clicks select brushes for Add to Brushes; a brush dragged onto a path is added and applied to it, and one dragged onto the Brushes panel is added. Save Brushes… / the Brushes panel's Save Brush Library… write the document's brushes (or the selected ones) as a `.vectorcraft` library into the `Brushes` folder next to the preferences, listed under User Defined, or to a file; Other Library… reads the brushes of any document VectorCraft opens. Thumbnails, in the library panels, the Brushes panel and Brush Options, render brush art with the patterns and symbols it uses. Copying brushed art now carries the patterns and symbols its brush's art uses too. Tests: `crates/engine/src/tests/brushlib.rs`, `crates/ui-egui/src/panels/tests_brush_libraries.rs`, `panels::brushes::tests::library_brush_previews_show_the_patterns_their_art_uses`, `canvas::tests::a_library_brush_dropped_on_a_path_is_added_and_applied_in_one_step`.
+ - **Dry Media library** ([help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Dry Media holds four art brushes with textured strokes like dry drawing materials, each 100 pt long: Chalk Grain (about 8 pt high), Graphite Pencil (about 2.3 pt), Wax Crayon (about 5.5 pt) and Charcoal Dust (about 7 pt). The brushes, their names, sizes and art are VectorCraft's own: each is filled vector paths from a fixed seed, at most 80 paths and 500 anchors, stretched along the path with Tints colorization, and the chalk and crayon art has even-odd gaps where the paper shows (`brush.libraries`, `brush.addFromLibrary`; `the_dry_media_library_holds_grainy_art_brushes_with_bounded_art`).
- A canvas context menu: right-click selects the object under the pointer and lists what applies to the selection (Undo/Redo, clipboard, group, isolation, join, Remove Anchor Points when anchors are selected, masks, compound paths, guides, Transform, Arrange, Select, Export Selection, and on type Bullets and Numbering and Spelling › Auto Spell Check, checked while it is on), or the view commands on empty canvas.
- A right-click over locked objects adds an Unlock submenu to the canvas context menu. The submenu lists up to 20 locked objects under the pointer, topmost first, by the name the Layers panel shows, and choosing one unlocks it (`layer.setProps`). A locked group is listed as one item. Objects on hidden, locked or template layers are not listed.
- Native macOS save sheets offer a localised Format menu (#866), built from the request's existing format filters. It selects the suggested filename's format and updates the suffix when changed, including legacy `.drawcraft` names. `apps/vectorcraft/src/mac_save_format.rs` has filename regressions; an actual native SVG save, selection of PDF and cancellation without changing the saved document were verified.
From 5a9c297608fc5456bb682c71cbd441339d4504e7 Mon Sep 17 00:00:00 2001
From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com>
Date: Thu, 12 Nov 2026 11:36:34 +0430
Subject: [PATCH 12/38] Compile clipboard failure helper only for its callers
---
apps/vectorcraft/src/clipboard.rs | 1 +
docs/development.md | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/apps/vectorcraft/src/clipboard.rs b/apps/vectorcraft/src/clipboard.rs
index 5756600281..c5ef4d5579 100644
--- a/apps/vectorcraft/src/clipboard.rs
+++ b/apps/vectorcraft/src/clipboard.rs
@@ -651,6 +651,7 @@ mod portable {
impl Answer {
/// The answer to `request` when it couldn't be read: `why`, or no files.
+ #[cfg(any(test, target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd", target_os = "openbsd"))]
fn failed(request: Request, why: String) -> Self {
match request {
Request::Text => Self::Text(Err(why)),
diff --git a/docs/development.md b/docs/development.md
index 2362fc6f1a..e7831adf1b 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -1,6 +1,6 @@
# Development
-> **Last updated:** 2026-11-06 · **Change:** Hindi catalog and zero/one plural rule; desktop Devanagari fallback and optional craft-fonts UI face; native review pending.
+> **Last updated:** 2026-11-12 · **Change:** minor (clipboard failure helper follows its Linux/BSD and test callers; previously: Hindi catalog and zero/one plural rule; desktop Devanagari fallback and optional craft-fonts UI face; native review pending).
> **Last updated:** 2026-11-01 · **Change:** Linux: Automatic Linux Display Server opens the window through XWayland when a pen is attached on a Wayland session, so the pen draws (#4967); `VECTORCRAFT_NATIVE_WAYLAND=1` keeps Wayland.
> **Last updated:** 2026-10-31 · **Change:** files opened while the app runs open in its window on Windows and Linux (#4892); `--new-instance`.
> **Last updated:** 2026-10-29 · **Change:** Linux clipboard: the Flatpak on GNOME copies and pastes text through the core Wayland protocol.
@@ -351,6 +351,10 @@ parameters. Shipped code therefore never panics. Anything that can fail returns
### Enforced by lints
+The clipboard timeout failure helper is compiled for Linux/BSD workers and unit tests; production
+macOS reads synchronously. Keep helper target gates aligned with their callers instead of disabling
+dead-code warnings across the workspace.
+
`Cargo.toml` denies these clippy lints for the whole workspace, and `cargo xtask ci` runs clippy with
`-D warnings`. The gate targets the current stable Rust (`rust-version` in `Cargo.toml` is only the
minimum that builds the app, and no toolchain is pinned): when a new stable adds lints, they are fixed
@@ -508,6 +512,7 @@ Scores and hour estimates are unchanged.
| Date | Change | Summary |
|---|---|---|
+| 2026-11-12 | minor | Compile the clipboard failure helper only for Linux/BSD worker callers and unit tests; keep production macOS free of the unused helper without suppressing workspace dead-code warnings. |
| 2026-11-06 | minor | Localisation: Hindi catalog, zero/one plurals, desktop and web font requirements; AI/MT draft, native review pending. |
| 2026-10-31 | minor | Files opened while the app runs open in its window on Windows and Linux (#4892); `--new-instance` opts out. |
| 2026-10-29 | minor | Linux clipboard: core Wayland protocol text fallback where arboard has neither data-control nor X11 (the Flatpak on GNOME).; its reads wait 2 s at most. |
From f8c234e67030e5b765ccf3ba3ae02e8d79a0c5be Mon Sep 17 00:00:00 2001
From: dotCooCoo
Date: Wed, 11 Nov 2026 21:08:07 -0800
Subject: [PATCH 13/38] Type: Dynamic Text turns point type into area type with
Block on
Type > Dynamic Text and the Contextual Task Bar now also take point
type. Turning it on makes the point type area type with Block on, in
the same undo step:
- Along the lines, the frame is as wide as the widest line as typed
with its paragraph's indents, measured with the word gap, so that
line keeps its size and stays where it was across the page by its
own alignment. The other lines are set to that width. When negative
indents take more than that line's width, the frame is as wide as
the line, placed so the line keeps its aligned point, and Block makes
the line larger.
- The frame starts at the top of the text and grows down (to the left
for vertical type) to hold every fitted line, around any Text Wrap
objects above it, so nothing overflows.
- The new frame takes the default Area Type Options and keeps only the
gaps; options kept from an earlier frame do not carry over.
- Point type with no line to fit (empty, or only spaces and breaks) is
left as it is, and so is point type when `on` is false. Without `on`,
point type counts as off, and the Type menu item is unchecked when
point type comes first in the selection. A gap given with nothing it
can apply to is an error.
Block now subtracts a list level's indent from the room it sets each
line to, as the layout does. Before, a nested list item was first set
too large for its line and then made smaller on a later pass.
Docs: docs/mcp.md, docs/target-app-parity.md.
---
crates/engine/src/cmd/typecmd.rs | 1 +
crates/engine/src/cmd/typecmd/block.rs | 35 ++-
crates/engine/src/cmd/typecmd/block_tests.rs | 252 ++++++++++++++++++-
crates/engine/src/cmd/typemenu.rs | 173 +++++++++++--
crates/engine/src/tests/dynamic_text.rs | 10 +-
crates/ui-egui/src/canvas/task_bar.rs | 4 +-
crates/ui-egui/src/menus/state.rs | 6 +-
crates/ui-egui/src/menus/tests.rs | 12 +-
crates/ui-egui/src/tests/taskbar.rs | 16 ++
docs/mcp.md | 19 +-
docs/target-app-parity.md | 1 +
11 files changed, 487 insertions(+), 42 deletions(-)
diff --git a/crates/engine/src/cmd/typecmd.rs b/crates/engine/src/cmd/typecmd.rs
index 33dad39d93..d492917bfe 100644
--- a/crates/engine/src/cmd/typecmd.rs
+++ b/crates/engine/src/cmd/typecmd.rs
@@ -1365,6 +1365,7 @@ fn set_path_handle(s: &mut Session, p: &Value) -> Result {
#[cfg(test)]
mod area_tests;
mod block;
+pub(crate) use block::needed_room;
#[cfg(test)]
mod block_tests;
diff --git a/crates/engine/src/cmd/typecmd/block.rs b/crates/engine/src/cmd/typecmd/block.rs
index 06453f4983..c10abbc965 100644
--- a/crates/engine/src/cmd/typecmd/block.rs
+++ b/crates/engine/src/cmd/typecmd/block.rs
@@ -89,6 +89,39 @@ fn line_widths(db: &vectorcraft_text::FontDb, t: &TextObject) -> std::collection
out
}
+/// The room along its lines that a frame of `t`'s text needs for Block to keep the widest line as
+/// typed at its present size: that line's width plus its paragraph's indents, as [`block_fit`]
+/// measures them, and a margin of under half a size step so that the line is not made a step
+/// smaller; with the widest line's first byte and its paragraph's index. A line whose negative
+/// indents take more than its width needs its own width. None when no line has a width.
+pub(crate) fn needed_room(t: &TextObject) -> Option<(f64, usize, usize)> {
+ let points = t.style_scale().map(|s| s.points).filter(|p| p.is_finite() && *p > 1e-12)?;
+ let text = t.plain_text();
+ let lines = typed_lines(&text);
+ let widths = line_widths(vectorcraft_text::FontDb::global(), t);
+ let sizes = first_sizes(&t.runs, &lines);
+ lines
+ .iter()
+ .zip(&sizes)
+ .filter_map(|(l, size)| {
+ let width = widths.get(&l.start).copied().filter(|w| w.is_finite() && *w > 1e-9)?;
+ let size = size * points;
+ if l.content == l.start || !(size.is_finite() && size > 0.0) {
+ return None;
+ }
+ let para = t.para_at(l.para);
+ let first = if l.para_start { para.first_line_indent } else { 0.0 };
+ let indents = para.laid_out_left_indent() + para.right_indent + first;
+ // Negative indents that take more than the line's width leave the line no room at its
+ // size; the frame is then as wide as the line itself, and Block makes it larger.
+ let room = if width + indents > 1e-9 { width + indents } else { width };
+ // A tenth of a point more size widens the line by 0.1 * width / size.
+ Some((room + 0.04 * width / size, l.start, l.para))
+ })
+ .filter(|r| r.0.is_finite() && r.0 > 1e-9)
+ .reduce(|a, b| if b.0 > a.0 { b } else { a })
+}
+
/// The size a line set at `size` points and `width` wide takes to fill `avail`, its width growing
/// by `slope` a point of size (`width / size` when the whole line follows its size): rounded down
/// to tenths and kept within [`SIZES`]. A line that fits and would not fit a tenth larger keeps its
@@ -152,7 +185,7 @@ pub(crate) fn block_fit(t: &mut TextObject) -> bool {
let width = widths.get(&l.start).copied().filter(|w| w.is_finite() && *w > 1e-9)?;
let para = t.para_at(l.para);
let first = if l.para_start { para.first_line_indent } else { 0.0 };
- let avail = cell - para.left_indent - para.right_indent - first;
+ let avail = cell - para.laid_out_left_indent() - para.right_indent - first;
let size = size * points;
if !(size.is_finite() && size > 0.0) {
return None;
diff --git a/crates/engine/src/cmd/typecmd/block_tests.rs b/crates/engine/src/cmd/typecmd/block_tests.rs
index ec458a0c9b..0354a630b3 100644
--- a/crates/engine/src/cmd/typecmd/block_tests.rs
+++ b/crates/engine/src/cmd/typecmd/block_tests.rs
@@ -188,13 +188,25 @@ fn bad_params_and_other_type_are_refused() {
assert!(!text(&s, id).dynamic_text);
let point = s.execute("text.create", &json!({"x": 10, "y": 500, "text": "point"})).unwrap()["id"].as_u64().unwrap();
s.execute("select.set", &json!({"ids": [point]})).unwrap();
+ // Off leaves point type as it is, with no undo step, and a gap needs it turned on.
+ let n = undo_len(&s);
+ assert_eq!(s.execute("type.dynamicText", &json!({"on": false})).unwrap()["ids"], json!([point]));
+ let e = s.execute("type.dynamicText", &json!({"on": false, "wordGap": 200})).unwrap_err().to_string();
+ assert!(e.contains("need area type"), "{e}");
+ assert_eq!(undo_len(&s), n);
+ assert!(matches!(text(&s, point).kind, TextKind::Point));
+ let shape = s.execute("shape.rectangle", &json!({"x": 500, "y": 500, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap();
+ s.execute("select.set", &json!({"ids": [shape]})).unwrap();
let e = s.execute("type.dynamicText", &json!({})).unwrap_err().to_string();
assert!(e.contains("select type on a path or area type"), "{e}");
- // With point type selected too, only the area type changes.
+ // With point type selected too, both turn on, the point type as area type with Block on.
s.execute("select.set", &json!({"ids": [id, point]})).unwrap();
+ let n = undo_len(&s);
let r = s.execute("type.dynamicText", &json!({})).unwrap();
- assert_eq!(r["ids"], json!([id]));
- assert!(text(&s, id).dynamic_text && !text(&s, point).dynamic_text);
+ assert_eq!(r["ids"], json!([id, point]));
+ assert!(text(&s, id).dynamic_text && text(&s, point).dynamic_text);
+ assert!(matches!(text(&s, point).kind, TextKind::Area { .. }));
+ assert_eq!(undo_len(&s), n + 1);
// A gap with only type on a path selected is an error, and nothing changes.
let path = s.execute("path.create", &json!({"d": "M60 550 L340 550"})).unwrap()["id"].as_u64().unwrap();
let along = s.execute("text.createInPath", &json!({"path": path, "mode": "onPath", "text": "Along"})).unwrap()["id"].as_u64().unwrap();
@@ -438,6 +450,228 @@ fn threaded_frames_are_refused_and_threading_turns_block_off() {
assert!(matches!(text(&s, a).kind, TextKind::Area { .. }));
}
+/// 12 pt point type at (300, 100) with `extra` params for `text.create`, selected.
+fn point(s: &mut Session, text: &str, extra: Value) -> u64 {
+ let mut p = json!({"x": 300, "y": 100, "size": 12, "text": text});
+ if let (Some(p), Some(extra)) = (p.as_object_mut(), extra.as_object()) {
+ p.extend(extra.clone());
+ }
+ let id = s.execute("text.create", &p).unwrap()["id"].as_u64().unwrap();
+ s.execute("select.set", &json!({"ids": [id]})).unwrap();
+ id
+}
+
+/// Where the first glyph of the laid-out line starting at byte `start` is in the document.
+fn line_start(t: &TextObject, start: usize) -> vectorcraft_geom::Point {
+ let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), t);
+ let l = lay.lines.iter().find(|l| l.start == start).expect("a line starts there");
+ t.xf * lay.glyphs[l.glyph_start].origin
+}
+
+#[test]
+fn point_type_becomes_area_type_with_block_at_its_widest_line() {
+ for justify in ["left", "center", "right"] {
+ let mut s = session();
+ let id = point(&mut s, "Short\nA much longer line", json!({}));
+ s.execute("text.setStyle", &json!({"ids": [id], "justify": justify})).unwrap();
+ let before = line_start(&text(&s, id), 6);
+ let n = undo_len(&s);
+ let r = s.execute("type.dynamicText", &json!({})).unwrap();
+ assert_eq!((r["on"].clone(), r["ids"].clone()), (json!(true), json!([id])));
+ assert_eq!((r["wordGap"].clone(), r["lineGap"].clone()), (json!(100.0), json!(0.0)), "the reply gives the new frame's gaps");
+ assert_eq!(undo_len(&s), n + 1, "{justify}: one undo step");
+ assert_eq!(s.doc().unwrap().history.undo.last().unwrap().label, "Dynamic Text");
+ let t = text(&s, id);
+ assert!(t.dynamic_text && matches!(t.kind, TextKind::Area { .. }), "{justify}");
+ assert_eq!(t.area.fit, AreaFit::None);
+ assert_block(&t);
+ assert_eq!(size_at(&t, 6), 12.0, "{justify}: the widest line keeps its size");
+ assert!(size_at(&t, 0) > 24.0, "{justify}: the short line grows to the frame's width: {}", size_at(&t, 0));
+ // Across, the widest line stays where it was; the short line above it grew, so it moved down.
+ let after = line_start(&t, 6);
+ assert!((after.x - before.x).abs() < 0.05, "{justify}: the widest line stays where it was across: {before:?} → {after:?}");
+ assert!(after.y > before.y + 12.0, "{justify}");
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow, "{justify}: the frame holds every line");
+ // Edits fit it again as area type; undo brings the point type back as it was.
+ s.execute("edit.undo", &json!({})).unwrap();
+ let back = text(&s, id);
+ assert!(matches!(back.kind, TextKind::Point) && !back.dynamic_text && size_at(&back, 0) == 12.0, "{justify}");
+ }
+}
+
+#[test]
+fn point_type_with_gaps_indents_and_vertical_type_turns_into_block() {
+ let mut s = session();
+ // The gaps apply to the frame point type becomes.
+ let id = point(&mut s, "one\ntwo words here", json!({}));
+ let r = s.execute("type.dynamicText", &json!({"wordGap": 300, "lineGap": 4})).unwrap();
+ assert_eq!((r["wordGap"].clone(), r["lineGap"].clone()), (json!(300.0), json!(4.0)));
+ let t = text(&s, id);
+ assert!(t.dynamic_text && (t.area.word_gap, t.area.line_gap) == (300.0, 4.0));
+ assert_block(&t);
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow);
+ // Indents: the frame takes them in, so the widest line keeps its size.
+ let id = point(&mut s, "Tiny\nThe widest line of all", json!({"y": 300}));
+ s.execute("text.setFormat", &json!({"ids": [id], "leftIndent": 20, "firstLineIndent": 10})).unwrap();
+ let before = line_start(&text(&s, id), 5);
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let t = text(&s, id);
+ assert_block(&t);
+ assert_eq!(size_at(&t, 5), 12.0);
+ assert!((line_start(&t, 5).x - before.x).abs() < 0.05, "{before:?} → {:?}", line_start(&t, 5));
+ // A nested list item: the frame takes in the level's indent too.
+ let id = point(&mut s, "Tiny\nThe widest item of all", json!({"y": 200}));
+ s.execute("text.setFormat", &json!({"ids": [id], "list": "bullet", "listLevel": 3})).unwrap();
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let t = text(&s, id);
+ assert_eq!(size_at(&t, 5), 12.0, "nested list");
+ assert!(size_at(&t, 0) > 12.0);
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow);
+ // Mixed alignments: the widest line keeps its size and its place.
+ let id = point(&mut s, "Left\nThe widest line, right aligned", json!({"y": 400}));
+ let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
+ if let Some(NodeKind::Text(t)) = doc.node_mut(NodeId(id)).map(|n| &mut n.kind) {
+ let right = vectorcraft_doc::ParaStyle { justify: vectorcraft_doc::Justify::Right, ..t.para.clone() };
+ t.set_paragraph_styles(vec![t.para.clone(), right]);
+ }
+ let before = line_start(&text(&s, id), 5);
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let t = text(&s, id);
+ assert_eq!(size_at(&t, 5), 12.0, "mixed alignments");
+ assert!((line_start(&t, 5).x - before.x).abs() < 0.05, "{before:?} → {:?}", line_start(&t, 5));
+ // A right-to-left list, whose indents the layout mirrors.
+ let id = point(&mut s, "קצר\nשורה ארוכה בהרבה מהראשונה", json!({"y": 450}));
+ s.execute("text.setFormat", &json!({"ids": [id], "list": "bullet", "rightIndent": 9})).unwrap();
+ let widest = "קצר\n".len();
+ let before = line_start(&text(&s, id), widest);
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let t = text(&s, id);
+ assert_eq!(size_at(&t, widest), 12.0, "right-to-left list");
+ assert!((line_start(&t, widest).x - before.x).abs() < 0.05, "{before:?} → {:?}", line_start(&t, widest));
+ // Point type that was area type with its own options: the new frame takes the defaults but the
+ // gaps.
+ let id = point(&mut s, "Was\nonce a frame of two columns", json!({"y": 500}));
+ s.execute("type.convertToAreaType", &json!({"ids": [id]})).unwrap();
+ s.execute(
+ "text.areaOptions",
+ &json!({"columns": 2, "gutter": 12, "inset": 6, "verticalAlign": "bottom", "firstBaselineMin": 40, "wordGap": 150}),
+ )
+ .unwrap();
+ s.execute("type.convertToPointType", &json!({"ids": [id]})).unwrap();
+ let before = line_start(&text(&s, id), 4);
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let t = text(&s, id);
+ let defaults = vectorcraft_doc::AreaOptions { word_gap: 150.0, ..Default::default() };
+ assert_eq!(t.area, defaults);
+ assert_eq!(size_at(&t, 4), 12.0, "options from an earlier frame");
+ assert!((line_start(&t, 4).x - before.x).abs() < 0.05, "{before:?} → {:?}", line_start(&t, 4));
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow);
+ // Vertical type: the frame is as tall as the longest column and grows to the left.
+ let id = point(&mut s, "縦書き\nもっと長い縦書きの行", json!({"x": 600, "y": 40, "vertical": true}));
+ let before = line_start(&text(&s, id), "縦書き\n".len());
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let t = text(&s, id);
+ assert!(t.vertical && t.dynamic_text && matches!(t.kind, TextKind::Area { .. }));
+ assert_block(&t);
+ assert_eq!(size_at(&t, "縦書き\n".len()), 12.0);
+ let after = line_start(&t, "縦書き\n".len());
+ assert!((after.y - before.y).abs() < 0.05, "the longest column stays where it was down the page: {before:?} → {after:?}");
+ assert!(after.x < before.x - 12.0, "the short column before it grew, so it moved left: {before:?} → {after:?}");
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow);
+}
+
+#[test]
+fn point_type_with_negative_indents_wider_than_its_line_turns_into_block() {
+ // Block makes the line larger; it keeps its start, center or end by its alignment.
+ let ends = |t: &TextObject| {
+ let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), t);
+ let l = &lay.lines[0];
+ ((t.xf * vectorcraft_geom::Point::new(l.x0, l.baseline)).x, (t.xf * vectorcraft_geom::Point::new(l.x1 - l.trailing, l.baseline)).x)
+ };
+ for justify in ["left", "center", "right"] {
+ let mut s = session();
+ let id = point(&mut s, "Short", json!({}));
+ s.execute("text.setStyle", &json!({"ids": [id], "justify": justify})).unwrap();
+ s.execute("text.setFormat", &json!({"ids": [id], "leftIndent": -200})).unwrap();
+ let (b0, b1) = ends(&text(&s, id));
+ let n = undo_len(&s);
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ assert_eq!(undo_len(&s), n + 1, "{justify}");
+ let t = text(&s, id);
+ assert!(t.dynamic_text && matches!(t.kind, TextKind::Area { .. }), "{justify}: the frame is as wide as the line");
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow, "{justify}");
+ assert!(size_at(&t, 0) > 12.0, "{justify}: Block makes the line larger");
+ let (a0, a1) = ends(&t);
+ let kept = match justify {
+ "left" => (a0, b0),
+ "center" => ((a0 + a1) / 2.0, (b0 + b1) / 2.0),
+ _ => (a1, b1),
+ };
+ assert!((kept.0 - kept.1).abs() < 0.05, "{justify}: the line keeps its aligned point: {b0},{b1} → {a0},{a1}");
+ }
+}
+
+#[test]
+fn point_type_under_a_text_wrap_object_turns_into_block_that_holds_every_line() {
+ let mut s = session();
+ let id = point(&mut s, "One\nTwo\nThree\nA much longer line than the rest", json!({}));
+ // A wrap object above the type, across the top of the frame it becomes.
+ let r = s.execute("shape.rectangle", &json!({"x": 250, "y": 80, "width": 400, "height": 40})).unwrap()["id"].as_u64().unwrap();
+ s.execute("select.set", &json!({"ids": [r]})).unwrap();
+ s.execute("object.textWrap.make", &json!({})).unwrap();
+ s.execute("select.set", &json!({"ids": [id]})).unwrap();
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let t = text(&s, id);
+ assert!(t.dynamic_text && matches!(t.kind, TextKind::Area { .. }));
+ assert!(!t.wrap.is_empty(), "the new area type takes the wrap object");
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow, "the frame holds every line around the wrap");
+ // A wrap object deeper than any size Block sets, across the whole frame: the lines go below it.
+ let id = point(&mut s, "Below", json!({"x": 1000, "y": 100}));
+ let r = s.execute("shape.rectangle", &json!({"x": 900, "y": 80, "width": 400, "height": 9000})).unwrap()["id"].as_u64().unwrap();
+ s.execute("select.set", &json!({"ids": [r]})).unwrap();
+ s.execute("object.textWrap.make", &json!({})).unwrap();
+ s.execute("select.set", &json!({"ids": [id]})).unwrap();
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let t = text(&s, id);
+ assert!(t.dynamic_text && !t.wrap.is_empty());
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow, "the frame reaches past a deep wrap object");
+ // An inverted wrap object far below the type holds the lines inside it: the frame reaches it.
+ let id = point(&mut s, "Inside", json!({"x": 1600, "y": 100}));
+ let r = s.execute("shape.rectangle", &json!({"x": 1550, "y": 9000, "width": 400, "height": 100})).unwrap()["id"].as_u64().unwrap();
+ s.execute("select.set", &json!({"ids": [r]})).unwrap();
+ s.execute("object.textWrap.make", &json!({})).unwrap();
+ s.execute("object.textWrap.options", &json!({"invert": true})).unwrap();
+ s.execute("select.set", &json!({"ids": [id]})).unwrap();
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let t = text(&s, id);
+ assert!(t.dynamic_text && !t.wrap.is_empty());
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow, "the frame reaches a distant inverted wrap object");
+}
+
+#[test]
+fn point_type_with_nothing_to_fit_is_left_as_it_is() {
+ let mut s = session();
+ for blank in ["", " ", "\n\n"] {
+ let id = point(&mut s, blank, json!({}));
+ let before = text(&s, id);
+ let n = undo_len(&s);
+ let r = s.execute("type.dynamicText", &json!({})).unwrap();
+ assert_eq!(r["on"], json!(true));
+ assert_eq!(undo_len(&s), n, "{blank:?}: no undo step");
+ assert_eq!(text(&s, id), before, "{blank:?}");
+ // A gap needs type it can apply to.
+ let e = s.execute("type.dynamicText", &json!({"wordGap": 200})).unwrap_err().to_string();
+ assert!(e.contains("need area type"), "{blank:?}: {e}");
+ }
+ // A line far shorter than the widest one stops at the size limit, and the frame still holds it.
+ let id = point(&mut s, &format!(".\n{}", "w".repeat(400)), json!({"size": 6}));
+ s.execute("type.dynamicText", &json!({})).unwrap();
+ let t = text(&s, id);
+ assert!(t.dynamic_text);
+ assert_eq!(size_at(&t, 0), 1296.0);
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow);
+}
+
#[test]
fn long_text_fits_in_a_bounded_number_of_layouts() {
let mut s = session();
@@ -451,4 +685,16 @@ fn long_text_fits_in_a_bounded_number_of_layouts() {
// pass and the caches), plus the reply's own.
let bound = 2 * (2 + 2 * super::block::BLOCK_PASSES as u64) + 4;
assert!(used <= bound, "{used} layouts");
+ // Long point type: measured, fitted in its frame and fitted again at its depth, with the
+ // layouts that place and measure the frame.
+ let id = point(&mut s, &story, json!({}));
+ let before = vectorcraft_text::test_fonts::layouts_on_this_thread();
+ s.execute("type.dynamicText", &json!({"on": true})).unwrap();
+ let used = vectorcraft_text::test_fonts::layouts_on_this_thread() - before;
+ let t = text(&s, id);
+ assert!(t.dynamic_text && matches!(t.kind, TextKind::Area { .. }));
+ assert_block(&t);
+ assert!(!vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).overflow);
+ let bound = 2 * (2 + 2 * super::block::BLOCK_PASSES as u64) + 8;
+ assert!(used <= bound, "point type: {used} layouts");
}
diff --git a/crates/engine/src/cmd/typemenu.rs b/crates/engine/src/cmd/typemenu.rs
index bb0e426c9b..78dab584b3 100644
--- a/crates/engine/src/cmd/typemenu.rs
+++ b/crates/engine/src/cmd/typemenu.rs
@@ -7,7 +7,7 @@ use vectorcraft_doc::{AreaFit, CharStyle, Document, Justify, LockedArtboards, No
use vectorcraft_geom::{Affine, Rect, shapes};
use super::object::choice;
-use super::typecmd::{area_text, block_gaps, refresh_bounds};
+use super::typecmd::{area_text, block_gaps, needed_room, refresh_bounds};
use super::{
CommandSpec, EngineError, Result, Session, bad, checked_ids_param, cmd, find_command, has_clipboard, has_doc, has_selection, number_or,
switch_or, targets, text_param,
@@ -65,7 +65,7 @@ pub fn specs() -> Vec {
"Dynamic Text",
["Type"],
None,
- "{ids?|id?, on?: bool, wordGap?: % of a word space 0..1000 (100), lineGap?: pt -1296..1296 (0)} turn Dynamic Text on or off for the selected type on a path and area type (on omitted: the opposite of the first object's setting, or on when a gap is given). On type on a path, the layout scales the text by one factor (every character's size, leading and baseline shift; Type on a Path Options › Spacing stays) so that it fills the span between its start and end brackets, larger or smaller, and fits it again after every edit to the text, the path or the brackets; the first character's size moves in steps of 0.1 pt within 0.1 to 1,296 pt, and at 0.1 pt text that still runs past the end bracket overflows. The stored sizes keep their proportions. On area type it is Block: each line as typed (each paragraph, and each forced line break in one; lines are not broken again) is set to the frame's width, less the inset, the gutters and the paragraph's indents, by changing its font size only: its first character's size, in steps of 0.1 pt within 0.1 to 1,296 pt, the line's other characters keeping their proportions to it, with baseline shifts following. Every character's leading is its size plus lineGap, and the layout sets every paragraph with wordGap as its Desired word spacing, its Minimum or Maximum moving out to wordGap when wordGap lies outside it (the paragraphs keep their own Justification… values, which apply again when Block is off; the gaps are area type's, and are kept while Block is off; a gap with no area type in the selection is an error). The sizes are written into the characters and fitted again after every edit to the text or the frame, in the same undo step; at a size limit a line can be narrower than the frame or wrap. An empty line keeps its size. Block replaces Auto Size and Shrink Text to Fit (Area Type Options › Block is the same setting). Off, the text keeps the sizes it was drawn at. Point type in the selection is left as it is; a selection holding type in a thread is refused (threading type turns Dynamic Text off, keeping its drawn sizes). When nothing changes, no undo step is recorded → {on, ids, fitScale (the first object's factor; 1 when off and for area type), wordGap?, lineGap? (the first area type's; left out without area type)}",
+ "{ids?|id?, on?: bool, wordGap?: % of a word space 0..1000 (100), lineGap?: pt -1296..1296 (0)} turn Dynamic Text on or off for the selected type on a path and area type, or turn it on for point type (on omitted: the opposite of the first object's setting, point type counting as off, or on when a gap is given). On type on a path, the layout scales the text by one factor (every character's size, leading and baseline shift; Type on a Path Options › Spacing stays) so that it fills the span between its start and end brackets, larger or smaller, and fits it again after every edit to the text, the path or the brackets; the first character's size moves in steps of 0.1 pt within 0.1 to 1,296 pt, and at 0.1 pt text that still runs past the end bracket overflows. The stored sizes keep their proportions. On area type it is Block: each line as typed (each paragraph, and each forced line break in one; lines are not broken again) is set to the frame's width, less the inset, the gutters and the paragraph's indents, by changing its font size only: its first character's size, in steps of 0.1 pt within 0.1 to 1,296 pt, the line's other characters keeping their proportions to it, with baseline shifts following. Every character's leading is its size plus lineGap, and the layout sets every paragraph with wordGap as its Desired word spacing, its Minimum or Maximum moving out to wordGap when wordGap lies outside it (the paragraphs keep their own Justification… values, which apply again when Block is off; the gaps are area type's, and are kept while Block is off; a gap with no area type in the selection, and no point type it turns into area type, is an error). The sizes are written into the characters and fitted again after every edit to the text or the frame, in the same undo step; at a size limit a line can be narrower than the frame or wrap. An empty line keeps its size. Block replaces Auto Size and Shrink Text to Fit (Area Type Options › Block is the same setting). Off, the text keeps the sizes it was drawn at. Turning it on turns point type into area type with Block on, with the default Area Type Options but the gaps (options kept from an earlier frame do not carry over): the frame is as wide (along the lines) as the widest line as typed with its paragraph's indents, so that line keeps its size and sits where it was (by its own alignment), the other lines are set to that width (when negative indents take more than that line's width, the frame is as wide as the line, and Block makes it larger), and the frame then grows in depth (down, or to the left for vertical type) to hold every fitted line, around any Text Wrap objects above it; the gaps apply to it as to area type. Point type with no line to fit (empty, or only spaces and breaks) is left as it is, and so is point type when it is turned off; a selection holding type in a thread is refused (threading type turns Dynamic Text off, keeping its drawn sizes). When nothing changes, no undo step is recorded → {on, ids, fitScale (the first object's factor; 1 when off and for area type), wordGap?, lineGap? (the first area type's; left out without area type)}",
has_dynamic_type,
dynamic_text
),
@@ -325,13 +325,7 @@ fn to_area(s: &mut Session, p: &Value) -> Result {
// A little slack on the right so the text doesn't rewrap.
let top = lay.lines.first().map(|l| l.baseline - l.ascent).unwrap_or(b.y0).min(b.y0);
let slack = size * 0.5 + trailing;
- // Slack goes where the alignment leaves room, so the text doesn't move or rewrap.
- let (sl, sr) = match t.para_at(0).justify {
- Justify::Center | Justify::JustifyCenter => (slack * 0.5, slack * 0.5),
- Justify::Right | Justify::JustifyRight => (slack, 0.0),
- Justify::Auto if lay.lines.first().is_some_and(|l| l.rtl) => (slack, 0.0),
- _ => (0.0, slack),
- };
+ let (sl, sr) = slack_sides(t.para_at(0).justify, lay.lines.first().is_some_and(|l| l.rtl), slack);
let frame = Rect::new(b.x0 - sl, top, b.x1 + sr, b.y1.max(top + 1.0));
t.kind = TextKind::Area { frame: shapes::rectangle(frame) };
refresh_bounds(t);
@@ -341,6 +335,107 @@ fn to_area(s: &mut Session, p: &Value) -> Result {
Ok(ids_json(&ids))
}
+/// How `slack` added to point type's lines in a frame is shared before and after them: where the
+/// alignment leaves room, so the text doesn't move or rewrap.
+fn slack_sides(justify: Justify, rtl: bool, slack: f64) -> (f64, f64) {
+ match justify {
+ Justify::Center | Justify::JustifyCenter => (slack * 0.5, slack * 0.5),
+ Justify::Right | Justify::JustifyRight => (slack, 0.0),
+ Justify::Auto if rtl => (slack, 0.0),
+ _ => (0.0, slack),
+ }
+}
+
+/// Point type `t` turned into area type with Dynamic Text's Block on, with the default Area Type
+/// Options but its gaps: the frame takes the room along the lines that keeps the widest line as
+/// typed at its size ([`needed_room`]), placed so that line stays where it is by its own
+/// alignment, and after the fit it takes the depth that holds every line, so nothing overflows.
+/// Lines run in line space (for vertical type, down the page), and the frame is mapped to the
+/// type's own space by the layout's `line_xf`. `wrap` is the Text Wrap shapes the new area type
+/// takes, in the type's own space, which the fit and the depth follow. When negative indents take
+/// more than the widest line's width, the frame is as wide as that line and placed so that the
+/// line keeps its aligned point. None when no line has a
+/// width (empty text, or only spaces and breaks), which Block leaves at its size.
+fn point_to_block(t: &TextObject, wrap: &[vectorcraft_doc::WrapShape]) -> Option {
+ let db = vectorcraft_text::FontDb::global();
+ // Options point type kept from a frame it had before (columns, inset, alignment, first
+ // baseline) do not carry over to the new frame.
+ let mut t = t.clone();
+ let (word_gap, line_gap) = (t.area.word_gap, t.area.line_gap);
+ t.area = vectorcraft_doc::AreaOptions { word_gap, line_gap, ..Default::default() };
+ t.wrap = wrap.to_vec();
+ let t = &t;
+ // The room is measured as Block sets the lines in a frame, with the word gap.
+ let as_block = TextObject { dynamic_text: true, kind: TextKind::Area { frame: shapes::rectangle(Rect::new(0.0, 0.0, 1.0, 1.0)) }, ..t.clone() };
+ let (room, widest, para_index) = needed_room(&as_block)?;
+ let lay = vectorcraft_text::layout(db, t);
+ let first = lay.lines.first()?;
+ let line = lay.lines.iter().find(|l| l.start == widest)?;
+ // Across, the widest line as it is aligned, with its paragraph's indents, which the frame holds.
+ let para = t.para_at(para_index);
+ let starts = widest == 0 || t.plain_text().as_bytes().get(widest - 1) == Some(&b'\n');
+ let start_indent = para.laid_out_left_indent() + if starts { para.first_line_indent } else { 0.0 };
+ // A horizontal right-to-left list paragraph has its indents mirrored, as the layout sets them.
+ let mirror = line.rtl && !t.vertical && para.list.is_some();
+ let (left, right) = if mirror { (para.right_indent, start_indent) } else { (start_indent, para.right_indent) };
+ let (lo, hi) = (line.x0 - left, line.x1 - line.trailing + right);
+ let top = lay.lines.iter().map(|l| l.baseline - l.ascent).fold(first.baseline - first.ascent, f64::min);
+ let bottom = lay.lines.iter().map(|l| l.baseline + l.descent).fold(top, f64::max);
+ if ![lo, hi, top, bottom, room].iter().all(|v| v.is_finite()) {
+ return None;
+ }
+ // Negative indents can take more than the line's width (hi below lo); the frame is then wider
+ // than the line with its indents, and the same split of the difference keeps the line's
+ // aligned point (its start, center or end) where it was when Block makes the line fill it.
+ let (sl, _) = slack_sides(para.justify, line.rtl, room - (hi - lo));
+ let frame = |depth: f64| lay.line_xf.transform_rect_bbox(Rect::new(lo - sl, top, lo - sl + room, top + depth.max(1.0)));
+ let start = frame(bottom - top);
+ let mut out = t.clone();
+ out.kind = TextKind::Area { frame: shapes::rectangle(start) };
+ out.dynamic_text = true;
+ refresh_bounds(&mut out);
+ // The lines fitted in one cell from the frame's top deep enough for all of them (every line at
+ // the largest size Block sets), around any wrap shapes, give the depth the frame takes.
+ let mut probe = out.clone();
+ let points = t.style_scale().map_or(1.0, |s| s.points).max(1e-12);
+ let deep = (bottom - top) + (lay.lines.len() as f64 + 1.0) * 3.0 * (1296.0 + out.area.line_gap.abs()) / points;
+ // Wrap shapes push lines on past them (an inverted one holds them inside it), so the cell also
+ // reaches as far again as the farthest one reaches past the frame's top.
+ let inv = lay.line_xf.inverse();
+ let deep = deep
+ + wrap
+ .iter()
+ .filter_map(|w| w.path.bounds().map(|r| inv.transform_rect_bbox(r)).map(|r| (r.y1 - top).max(0.0) + 2.0 * w.wrap.offset.abs()))
+ .filter(|d| d.is_finite())
+ .fold(0.0, f64::max);
+ probe.kind = TextKind::Area { frame: shapes::rectangle(frame(deep)) };
+ if !wrap.is_empty() {
+ refresh_bounds(&mut probe);
+ }
+ let laid = vectorcraft_text::layout(db, &probe);
+ if laid.overflow {
+ return Some(out);
+ }
+ let mut grown = start;
+ for l in &laid.lines {
+ for y in [l.baseline - l.ascent, l.baseline + l.descent] {
+ grown = grown.union_pt(laid.line_xf * vectorcraft_geom::Point::new(l.x0, y));
+ }
+ }
+ // Only the depth grows (for vertical type, the columns run on to the left), with a hundredth
+ // of a point to spare.
+ if t.vertical {
+ (grown.y0, grown.y1, grown.x0) = (start.y0, start.y1, grown.x0 - 0.01);
+ } else {
+ (grown.x0, grown.x1, grown.y1) = (start.x0, start.x1, grown.y1 + 0.01);
+ }
+ if grown.is_finite() && grown != start {
+ out.kind = TextKind::Area { frame: shapes::rectangle(grown) };
+ refresh_bounds(&mut out);
+ }
+ Some(out)
+}
+
/// (run, byte within the run) for a byte offset into the plain text.
fn locate(runs: &[TextRun], byte: usize) -> Option<(usize, usize)> {
let mut off = 0;
@@ -542,14 +637,23 @@ fn dynamic_type(n: Option<&Node>) -> Option<&TextObject> {
path_text(n).or_else(|| area_text(n))
}
-/// `type.dynamicText` is enabled for a selection holding type on a path or area type, none of it
-/// in a thread.
+/// Type `type.dynamicText` takes: type on a path, area type, and point type, which it turns into
+/// area type with Block on.
+fn dynamic_target(n: Option<&Node>) -> Option<&TextObject> {
+ match n.map(|n| &n.kind) {
+ Some(NodeKind::Text(t)) if matches!(t.kind, TextKind::Point) => Some(t),
+ _ => dynamic_type(n),
+ }
+}
+
+/// `type.dynamicText` is enabled for a selection holding type on a path, area type or point type,
+/// none of it in a thread.
fn has_dynamic_type(s: &Session) -> std::result::Result<(), String> {
has_selection(s)?;
let st = s.active().ok_or("no document open")?;
let d = &st.doc;
let selected: Vec = st.selection.objects.to_vec();
- let types: Vec = text_ids(d, &selected).into_iter().filter(|id| dynamic_type(d.node(*id)).is_some()).collect();
+ let types: Vec = text_ids(d, &selected).into_iter().filter(|id| dynamic_target(d.node(*id)).is_some()).collect();
if types.is_empty() {
return Err("select type on a path or area type".into());
}
@@ -575,32 +679,46 @@ fn threaded_ids(d: &Document, ids: &[NodeId]) -> String {
/// Type › Dynamic Text: set `on` (without it, the opposite of the first object's setting, or on
/// when a gap is given) on the selected type on a path and area type (Block, with its gaps), in
-/// one undo step, and none when nothing changes. Turning it off keeps the sizes the text was drawn
-/// at ([`bake_dynamic_text`]).
+/// one undo step, and none when nothing changes. Turning it on also turns the selected point type
+/// into area type with Block on ([`point_to_block`]). Turning it off keeps the sizes the text was
+/// drawn at ([`bake_dynamic_text`]).
fn dynamic_text(s: &mut Session, p: &Value) -> Result {
const C: &str = "type.dynamicText";
let (word_gap, line_gap) = block_gaps(p, C)?;
- let (ids, on, planned) = {
+ let (ids, on, planned, converted) = {
let d = &s.doc()?.doc;
- let ids: Vec = texts(s, p, C)?.into_iter().filter(|i| dynamic_type(d.node(*i)).is_some()).collect();
+ let ids: Vec = texts(s, p, C)?.into_iter().filter(|i| dynamic_target(d.node(*i)).is_some()).collect();
let first = *ids.first().ok_or_else(|| bad(C, "select type on a path or area type"))?;
if let Some(why) = threaded_refusal(d, &ids) {
return Err(bad(C, why));
}
let gap_given = word_gap.is_some() || line_gap.is_some();
- if gap_given && !ids.iter().any(|id| area_text(d.node(*id)).is_some()) {
+ let on = switch_or(p, "on", gap_given || !dynamic_type(d.node(first)).is_some_and(|t| t.dynamic_text), C)?;
+ // Point type with a line to fit, which turning it on makes area type.
+ let converts = |id: &NodeId| on && dynamic_target(d.node(*id)).is_some_and(|t| matches!(t.kind, TextKind::Point) && needed_room(t).is_some());
+ if gap_given && !ids.iter().any(|id| area_text(d.node(*id)).is_some() || converts(id)) {
return Err(bad(C, "wordGap and lineGap need area type in the selection"));
}
- let on = switch_or(p, "on", gap_given || !dynamic_type(d.node(first)).is_some_and(|t| t.dynamic_text), C)?;
// Each object as the command leaves it, and only those it changes.
let mut planned: Vec<(NodeId, TextObject)> = vec![];
+ // The point type that becomes area type, with the gaps applied, by id.
+ let mut converted: Vec<(NodeId, TextObject)> = vec![];
for id in &ids {
- let Some(t) = dynamic_type(d.node(*id)) else { continue };
+ let Some(t) = dynamic_target(d.node(*id)) else { continue };
let mut after = t.clone();
- if matches!(t.kind, TextKind::Area { .. }) {
+ if matches!(t.kind, TextKind::Area { .. } | TextKind::Point) {
after.area.word_gap = word_gap.unwrap_or(t.area.word_gap);
after.area.line_gap = line_gap.unwrap_or(t.area.line_gap);
}
+ if matches!(t.kind, TextKind::Point) {
+ // Point type has no Dynamic Text of its own: on, it becomes area type with Block
+ // on; off, or with no line to fit, it stays as it is.
+ if let Some(block) = on.then(|| point_to_block(&after, &[])).flatten() {
+ planned.push((*id, block));
+ converted.push((*id, after));
+ }
+ continue;
+ }
match (on, t.dynamic_text) {
(true, true) => refresh_bounds(&mut after),
(true, false) => {
@@ -620,7 +738,7 @@ fn dynamic_text(s: &mut Session, p: &Value) -> Result {
planned.push((*id, after));
}
}
- (ids, on, planned)
+ (ids, on, planned, converted)
};
if !planned.is_empty() {
s.edit("Dynamic Text", |d, _| {
@@ -629,6 +747,19 @@ fn dynamic_text(s: &mut Session, p: &Value) -> Result {
**t = after.clone();
}
}
+ if converted.is_empty() {
+ return Ok(());
+ }
+ // The new area type takes the Text Wrap shapes above it; one that has any is fitted
+ // again around them, with the depth that holds every line.
+ for id in vectorcraft_doc::text::resolve_wrap(None, d) {
+ let Some(NodeKind::Text(t)) = d.node_mut(id).map(|n| &mut n.kind) else { continue };
+ let block = converted.iter().find(|(c, _)| *c == id).and_then(|(_, src)| point_to_block(src, &t.wrap));
+ match block {
+ Some(block) => **t = block,
+ None => refresh_bounds(t),
+ }
+ }
Ok(())
})?;
}
diff --git a/crates/engine/src/tests/dynamic_text.rs b/crates/engine/src/tests/dynamic_text.rs
index ae1a72fa08..6b221590b0 100644
--- a/crates/engine/src/tests/dynamic_text.rs
+++ b/crates/engine/src/tests/dynamic_text.rs
@@ -88,19 +88,17 @@ fn dynamic_text_refuses_bad_params_and_other_type() {
assert!(err(s.execute("type.dynamicText", &json!({"on": 1}))).contains("on"));
assert_eq!(undo_len(&s), before);
assert!(!text(&s, id).dynamic_text);
- // Point type alone: refused (area type takes Block, `typecmd::block_tests`).
let point = s.execute("text.create", &json!({"x": 10, "y": 10, "text": "Point"})).unwrap()["id"].as_u64().unwrap();
- s.execute("select.set", &json!({"ids": [point]})).unwrap();
- assert!(err(s.execute("type.dynamicText", &json!({}))).contains("select type on a path or area type"));
let empty = s.execute("shape.rectangle", &json!({"x": 300, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap();
s.execute("select.set", &json!({"ids": [empty]})).unwrap();
assert!(s.execute("type.dynamicText", &json!({})).is_err());
- // With point type selected too, only the type on a path changes.
+ // With point type selected too, both change in one undo step: the point type becomes area
+ // type with Block on (`typecmd::block_tests`).
let before = undo_len(&s);
s.execute("select.set", &json!({"ids": [point, id.0]})).unwrap();
let r = s.execute("type.dynamicText", &json!({"on": true})).unwrap();
- assert_eq!(r["ids"], json!([id.0]));
- assert!(!text(&s, NodeId(point)).dynamic_text);
+ assert_eq!(r["ids"], json!([point, id.0]));
+ assert!(text(&s, NodeId(point)).dynamic_text && text(&s, id).dynamic_text);
assert_eq!(undo_len(&s), before + 1);
}
diff --git a/crates/ui-egui/src/canvas/task_bar.rs b/crates/ui-egui/src/canvas/task_bar.rs
index a7a7f0a45c..77e21e49bc 100644
--- a/crates/ui-egui/src/canvas/task_bar.rs
+++ b/crates/ui-egui/src/canvas/task_bar.rs
@@ -153,8 +153,8 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) {
TextKind::Point => items.push((tl!("Convert To Area Type"), "dc-type-area", "type.convertToAreaType", none())),
TextKind::OnPath { .. } => items.push((tl!("Type on a Path Options"), "dc-type-path", "type.pathOptions", none())),
}
- // Dynamic Text turns on or off for type on a path and area type (Block), as the Type menu's item does;
- // left out for point type and type in a thread
+ // Dynamic Text turns on or off for type on a path and area type (Block), and turns point type into area
+ // type with Block on, as the Type menu's item does; left out for type in a thread
// ().
if crate::menus::enabled(app, "type.dynamicText") {
items.push((tl!("Dynamic Text"), "maximize-2", "type.dynamicText", none()));
diff --git a/crates/ui-egui/src/menus/state.rs b/crates/ui-egui/src/menus/state.rs
index ae7b7bb891..8b731c95b7 100644
--- a/crates/ui-egui/src/menus/state.rs
+++ b/crates/ui-egui/src/menus/state.rs
@@ -41,9 +41,9 @@ pub fn checked(app: &VectorcraftApp, id: &str, p: &Value) -> Option {
crate::panels::character::shared_text_flag(app, |t| t.vertical) == Some(id == "type.orientation.vertical")
}
"type.opticalMarginAlignment" => crate::panels::character::shared_text_flag(app, |t| t.optical_margin) == Some(true),
- // Dynamic Text of the first selected type on a path or area type, which the item turns the
- // other way.
- "type.dynamicText" => selected_text(|k| !matches!(k, vectorcraft_engine::doc::TextKind::Point)).is_some_and(|t| t.dynamic_text),
+ // Dynamic Text of the first selected type, which the item turns the other way (point type
+ // counts as off: the item turns it into area type with Block on).
+ "type.dynamicText" => selected_text(|_| true).is_some_and(|t| t.dynamic_text && !matches!(t.kind, vectorcraft_engine::doc::TextKind::Point)),
"view.outline" => app.outline_view(),
"view.pixelPreview" => v.pixel_preview,
"view.trimView" => v.trim_view,
diff --git a/crates/ui-egui/src/menus/tests.rs b/crates/ui-egui/src/menus/tests.rs
index 3d1577e1be..f4dff96dd8 100644
--- a/crates/ui-egui/src/menus/tests.rs
+++ b/crates/ui-egui/src/menus/tests.rs
@@ -313,8 +313,8 @@ fn optical_margin_alignment_is_a_checked_type_menu_item() {
assert_eq!(checked(&app, "type.orientation.horizontal", &Value::Null), Some(false));
}
-/// Type › Dynamic Text runs `type.dynamicText`, is enabled for type on a path and area type that
-/// are in no thread, and is checked while the selected type has it on.
+/// Type › Dynamic Text runs `type.dynamicText`, is enabled for point type and for type on a path
+/// and area type that are in no thread, and is checked while the selected type has it on.
#[test]
fn dynamic_text_is_a_checked_type_menu_item() {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
@@ -334,7 +334,8 @@ fn dynamic_text_is_a_checked_type_menu_item() {
assert!(!enabled(&app, id));
let point = app.run("text.create", json!({"x": 10, "y": 10, "text": "Point"})).unwrap()["id"].clone();
app.run("select.set", json!({"ids": [point]})).unwrap();
- assert!(!enabled(&app, id), "point type");
+ assert!(enabled(&app, id), "point type, which it turns into area type with Block on");
+ assert_eq!(checked(&app, id, &Value::Null), Some(false), "point type");
let path = app.run("path.create", json!({"d": "M60 150 L340 150"})).unwrap()["id"].clone();
let t = app.run("text.createInPath", json!({"path": path, "mode": "onPath", "text": "Along", "at": [60, 150]})).unwrap()["id"].clone();
app.run("select.set", json!({"ids": [t]})).unwrap();
@@ -356,6 +357,11 @@ fn dynamic_text_is_a_checked_type_menu_item() {
assert_eq!(checked(&app, id, &Value::Null), Some(false));
app.run(id, json!({})).unwrap();
assert_eq!(checked(&app, id, &Value::Null), Some(true));
+ // Point type first: unchecked, as the item turns it on.
+ app.run("select.set", json!({"ids": [point, area]})).unwrap();
+ assert_eq!(checked(&app, id, &Value::Null), Some(false), "point type first");
+ app.run(id, json!({})).unwrap();
+ assert_eq!(checked(&app, id, &Value::Null), Some(true), "both on");
}
/// Type › Dynamic Text Presets › Circle, Arch and Bow run `type.dynamicTextPreset` with their
diff --git a/crates/ui-egui/src/tests/taskbar.rs b/crates/ui-egui/src/tests/taskbar.rs
index d42be49ff9..47015639c8 100644
--- a/crates/ui-egui/src/tests/taskbar.rs
+++ b/crates/ui-egui/src/tests/taskbar.rs
@@ -232,6 +232,22 @@ fn area_type_offers_dynamic_text() {
assert!(has(&texts, "Convert To Point Type") && !has(&texts, "Dynamic Text"), "{texts:?}");
}
+/// Point type offers Dynamic Text beside Convert To Area Type, which turns it into area type with
+/// Block on; the bar then offers what area type does.
+#[test]
+fn point_type_offers_dynamic_text() {
+ let mut app = app();
+ let t = id(app.run("text.create", json!({"x": 60, "y": 80, "text": "Fit\nme in a frame"})).unwrap());
+ app.run("tool.select", json!({"tool": "selection"})).unwrap();
+ select(&mut app, &[t]);
+ let (_, texts) = bar(&mut app);
+ assert!(has(&texts, "Convert To Area Type") && has(&texts, "Dynamic Text"), "{texts:?}");
+ click(&mut app, "Dynamic Text");
+ assert!(matches!(kind(&app, t), NodeKind::Text(ref t) if t.dynamic_text && matches!(t.kind, TextKind::Area { .. })));
+ let (_, texts) = bar(&mut app);
+ assert!(has(&texts, "Convert To Point Type") && has(&texts, "Dynamic Text"), "{texts:?}");
+}
+
/// The path's anchors (its first subpath).
fn anchors(app: &VectorcraftApp, id: u64) -> Vec {
match kind(app, id) {
diff --git a/docs/mcp.md b/docs/mcp.md
index aeed51157a..2c23a0b0f1 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -6923,7 +6923,7 @@ lines. The rest are VectorCraft's own rules:
- The layout sets every paragraph with `wordGap` as its Desired word spacing (Justification…), and its Minimum or
Maximum word spacing moves out to `wordGap` when `wordGap` lies outside it. The paragraphs keep their own
Justification… values, which apply again when Block is off. Each character's leading is its size plus `lineGap`. A
- gap given with no area type in the selection is an error.
+ gap given with no area type in the selection, and no point type that it turns into area type, is an error.
- The sizes are written into the characters, so every export and the Character panel see them. After every edit to
the text or the frame (typing, `text.editRange`, character and paragraph changes, `text.areaOptions {width}`, a
frame resize) the lines are fitted again, in the edit's own undo step. The lines are then measured again, in at
@@ -6932,14 +6932,27 @@ lines. The rest are VectorCraft's own rules:
- An empty line, or a line of spaces, keeps its size. At 1,296 pt a line can be narrower than the frame; at 0.1 pt it
can still wrap. A frame with no room along its lines changes nothing. Right-to-left lines are fitted as left-to-right
ones are.
-- Off keeps the sizes the text was drawn at. On replaces Auto Size and Shrink Text to Fit. Point type in the selection
- is left as it is. Area type in a thread is refused with an error that names it (`text.areaOptions {fit: "block"}`
+- Off keeps the sizes the text was drawn at. On replaces Auto Size and Shrink Text to Fit. Area type in a thread is refused with an error that names it (`text.areaOptions {fit: "block"}`
refuses it too); threading a frame turns Block off, keeping its sizes. Without `on`, it toggles from the first
object's setting, or turns on when a gap is given. A value that is not a boolean, or a gap outside its range, is an
error. When nothing changes, no undo step is recorded.
- Saved and opened, the native file keeps Block on with its gaps and the sizes in the characters; with Block off it
keeps the sizes.
+Turning it on also takes point type, in the same undo step (the Contextual Task Bar offers it beside Convert To Area
+Type). [Adjust formatting and resize text](https://helpx.adobe.com/photoshop/desktop/text-typography/work-with-dynamic-text/adjust-formatting-and-resize-text-with-dynamic-text.html)
+applies Dynamic Text, Block among its shapes, to existing text. VectorCraft's own rules for point type:
+
+- It becomes area type with Block on and the default Area Type Options, keeping only its gaps: options it kept from
+ an earlier frame (columns, inset, vertical alignment, first baseline) do not carry over. Along its lines, the frame
+ is as wide as the widest line as typed with its paragraph's indents, so that line keeps its size and stays where it
+ was across the page by its own alignment; the other lines are set to that width. When negative indents take more
+ than the widest line's width, the frame is as wide as that line, and Block makes it larger. The frame starts at the
+ top of the text and then grows down (to the left for vertical type) to hold every fitted line, around any Text Wrap
+ objects above it, so nothing overflows.
+- The gaps given apply to its frame. Point type with no line to fit (empty, or only spaces and breaks) is left as it
+ is, and so is point type when `on` is false. Without `on`, point type counts as off.
+
The reply is `{on, ids, fitScale, wordGap, lineGap}` (`fitScale` as for type on a path, 1 when the first object is area
type; the gaps are the first area type's).
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index 5e0cf03a3a..3ef8845ca8 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1189,6 +1189,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
Type on a Path Options › Align to Path (option names as in [Create type on a path](https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/create-type-on-a-path.html)) moves each character by its own font, size and vertical scale: Ascender runs the top of the font's em box along the path (the ideographic em box that its `BASE` table, its typographic or `hhea` box or its ideographs give, else an em box centered on the cap height), Descender runs the bottom of the font's bounding box along it, and Center runs a line at half the height of the top of the font's H above the baseline along it. In vertical type, Ascender and Descender move the characters half an em, and Center leaves them on the path. These distances are VectorCraft's own values (`tests::on_path_align_runs_each_glyph_by_its_own_metrics`, `tests::on_path_align_finds_the_em_box_of_each_kind_of_face`, `tests::on_path_align_in_vertical_type_moves_half_an_em`).
Type › Dynamic Text (`type.dynamicText`, also on the Contextual Task Bar for type on a path) sizes type on a path to fill the span between its start and end brackets and fits it again after each edit to the text, the path or a bracket ([Dynamic Text overview](https://helpx.adobe.com/photoshop/desktop/text-typography/work-with-dynamic-text/dynamic-text-overview.html), [start and end points](https://helpx.adobe.com/photoshop/desktop/text-typography/work-with-dynamic-text/reposition-start-and-end-points.html)). VectorCraft's own rules: one factor scales every size, leading and baseline shift; the first character's size moves in 0.1 pt steps within 0.1 to 1,296 pt; turning it off or threading the type keeps the drawn sizes; SVG, EPS and the editing data write the drawn sizes (`crates/text/src/tests/fit.rs`, `crates/engine/src/tests/dynamic_text.rs`).
Dynamic Text on area type is Block (Type › Dynamic Text, the Contextual Task Bar, Area Type Options › Block, the Properties panel's Dynamic Text checkbox with Word Gap and Line Gap; [Dynamic Text overview](https://helpx.adobe.com/photoshop/desktop/text-typography/work-with-dynamic-text/dynamic-text-overview.html)): each line as typed is set to the frame's width by its font size, again after every edit to the text or the frame. VectorCraft's own rules: lines are not broken again, the first character's size moves in 0.1 pt steps within 0.1 to 1,296 pt, Word Gap (0 to 1,000 %, default 100) is the Desired word spacing and Line Gap (-1,296 to 1,296 pt, default 0) is added to each size for the leading, the sizes are written into the characters, threaded frames cannot use it, and Convert To Point Type turns it off, keeping the sizes (`crates/engine/src/cmd/typecmd/block_tests.rs`).
+ Dynamic Text on point type (Type › Dynamic Text, the Contextual Task Bar; [Adjust formatting and resize text](https://helpx.adobe.com/photoshop/desktop/text-typography/work-with-dynamic-text/adjust-formatting-and-resize-text-with-dynamic-text.html) applies it to existing text) turns it into area type with Block on. VectorCraft's own rules: the frame is as wide as the widest line with its indents, so that line keeps its size and place across the page, and it grows in depth to hold every fitted line (`crates/engine/src/cmd/typecmd/block_tests.rs`).
Type › Dynamic Text Presets › Circle, Arch and Bow (`type.dynamicTextPreset`) put point type or type on a path on a circular, upward-curving or downward-curving path with Dynamic Text on, with the text's position against the path (above, center, below) and its direction ([Dynamic Text overview](https://helpx.adobe.com/photoshop/desktop/text-typography/work-with-dynamic-text/dynamic-text-overview.html)). VectorCraft's own rules: the circle is as wide as the text and the text starts at its bottom; Arch and Bow are a 120° arc whose chord is as wide as the text; above, center and below are Align to Path's Descender, Center and Ascender (`crates/engine/src/tests/dynamic_text.rs`).
The frames of threaded text share one Optical Margin Alignment setting: turning it on or off in one frame sets it in every frame, threading frames gives the thread its first frame's setting, and frames taken out of a thread keep it.
The frames of threaded text share one writing direction: Type › Type Orientation (`type.orientation.vertical`, `type.orientation.horizontal`) in one frame sets every frame, threading frames gives the thread its first frame's direction, frames taken out of a thread keep theirs, and the story flows through every frame in the thread's direction.
From 9c5a2fa2b87309916d4331afdd3f1456cb67cbcf Mon Sep 17 00:00:00 2001
From: dotCooCoo
Date: Thu, 12 Nov 2026 00:37:18 -0800
Subject: [PATCH 14/38] 3D: a solid in a transparent gradient keeps the shared
face order
With Extrude & Bevel, Extrude & Bevel (Classic) or Inflate on a group
or an object with fills and strokes, a solid whose gradient has
transparent stops carries an opacity mask, and it was drawn as one
whole surface in the order of the members. It could cover a solid in
front of it or hide behind one it is in front of. Its faces now take
their places in the one back-to-front order of every solid's faces, in
runs that each carry the solid's opacity mask. A run splits only where
a face drawn after it overlaps the next face.
---
crates/effects/src/revolve.rs | 12 ++--
crates/effects/src/solids.rs | 88 ++++++++++++++++++++++++++----
crates/effects/src/solids/tests.rs | 80 ++++++++++++++++++++++++---
3 files changed, 155 insertions(+), 25 deletions(-)
diff --git a/crates/effects/src/revolve.rs b/crates/effects/src/revolve.rs
index 4795e8848a..9b85185e2f 100644
--- a/crates/effects/src/revolve.rs
+++ b/crates/effects/src/revolve.rs
@@ -20,7 +20,7 @@ const MAX_PAINT_COPIES: usize = 256 << 20;
/// The most face and box tests a group's transparent members' faces take together to rejoin their
/// members' last runs; past them each starts a run of its own.
-const MAX_OVERLAP_TESTS: usize = 1 << 22;
+pub(crate) const MAX_OVERLAP_TESTS: usize = 1 << 22;
/// The width of the stroke around each face that covers the seams between faces.
const SEAM_WIDTH: f64 = 0.75;
@@ -576,14 +576,14 @@ pub(crate) fn scoped<'a>(id: NodeId, surfaces: Vec<(&'a [Scope], Arc)>, le
/// What a face can paint, to tell whether two faces overlap: the convex hull of the points and
/// control points of its outline, which holds the outline, and the hull's box grown by half the
/// seam stroke.
-struct Coverage {
- bounds: Rect,
+pub(crate) struct Coverage {
+ pub(crate) bounds: Rect,
hull: Vec,
}
impl Coverage {
/// `None` for a face with no outline and no box.
- fn of(face: &Node) -> Option {
+ pub(crate) fn of(face: &Node) -> Option {
let points: Vec = match face.path_data() {
Some(path) => path
.to_bezpath()
@@ -611,7 +611,7 @@ impl Coverage {
/// Do the two faces' hulls, each grown by half the seam stroke, overlap? A test of the
/// separating axes of their edges and of the page's axes: `true` whenever they overlap, and
/// sometimes near a corner when they don't.
- fn meets(&self, other: &Coverage) -> bool {
+ pub(crate) fn meets(&self, other: &Coverage) -> bool {
fn normals(hull: &[Point]) -> impl Iterator- + '_ {
(0..hull.len()).filter_map(|i| {
let (a, b) = (hull.get(i)?, hull.get((i + 1) % hull.len())?);
@@ -658,7 +658,7 @@ fn convex_hull(mut points: Vec
) -> Vec {
}
/// Do boxes `a` and `b` overlap with some area?
-fn overlaps(a: Rect, b: Rect) -> bool {
+pub(crate) fn overlaps(a: Rect, b: Rect) -> bool {
a.x0 < b.x1 && b.x0 < a.x1 && a.y0 < b.y1 && b.y0 < a.y1
}
diff --git a/crates/effects/src/solids.rs b/crates/effects/src/solids.rs
index ff5b1c9711..4744202dd0 100644
--- a/crates/effects/src/solids.rs
+++ b/crates/effects/src/solids.rs
@@ -686,10 +686,11 @@ type ShadowAndSurfaces = (Vec>, Vec>);
/// Rotate turns every fill and stroke, each in its own paint. Extrude & Bevel and Inflate build a
/// solid from the path for the top visible fill and one from the outline of each visible stroke,
/// each in its own paint. When every one is opaque with normal blending and no colored light makes
-/// a surface one composite or masks it, their faces are drawn in one back-to-front order (where
-/// depths tie, as for the caps turned toward the viewer, in the order of the appearance, and with
-/// caps, a shape's fill walls before the faces of its covering strokes that overlap them:
-/// [`draw_order`]);
+/// a surface one composite, their faces are drawn in one back-to-front order (where depths tie, as
+/// for the caps turned toward the viewer, in the order of the appearance, and with caps, a shape's
+/// fill walls before the faces of its covering strokes that overlap them: [`draw_order`]), the
+/// faces of a solid in a gradient with transparent stops in runs that carry its opacity mask
+/// ([`in_runs`]);
/// otherwise each solid is a surface of its own, in that order. A member's opacity mask and
/// blending mode, and those of a group it is in, apply to the surfaces of the members it holds
/// ([`masked`]). The art comes in two parts: the effect's shadow ([`cast_shadow`], none with it
@@ -841,19 +842,20 @@ fn surfaces_for(n: &Node, fx: &Effect, shapes: &[Profile]) -> Option>> = surfaces.iter().map(|(_, s, _)| s.extras().mask.clone()).collect();
let (mut placed, mut faces) = (vec![], vec![]);
- for (depths, s, _) in surfaces {
+ for (surface, (depths, s, _)) in surfaces.into_iter().enumerate() {
if let NodeKind::Group { children, .. } = s.kind {
placed.extend(depths);
- faces.extend(children.into_iter().map(Some));
+ faces.extend(children.into_iter().map(|face| Some((surface, face))));
}
}
let sealed = match fx.id.as_str() {
@@ -862,7 +864,69 @@ fn surfaces_for(n: &Node, fx: &Effect, shapes: &[Profile]) -> Option extrude_options(&p).cap,
};
let order = draw_order(&placed, sealed);
- Some(vec![Arc::new(Node::group(n.id, order.into_iter().filter_map(|k| faces.get_mut(k).and_then(Option::take)).collect()))])
+ let faces: Vec<(usize, Arc)> = order.into_iter().filter_map(|k| faces.get_mut(k).and_then(Option::take)).collect();
+ let children = if masks.iter().all(Option::is_none) { faces.into_iter().map(|(_, face)| face).collect() } else { in_runs(n.id, faces, &masks) };
+ Some(vec![Arc::new(Node::group(n.id, children))])
+}
+
+/// `faces` in their back-to-front order, each with the index of its surface, where some surfaces
+/// carry an opacity mask (`masks`, by surface). A face of a surface without one goes in the order
+/// on its own. The faces of a masked surface share a run, one group with the surface's mask. Such a
+/// face joins its surface's last run unless a face drawn after that run overlaps it: only then does
+/// the surface split, where one group can't be both behind and in front of another face.
+fn in_runs(id: NodeId, faces: Vec<(usize, Arc)>, masks: &[Option>]) -> Vec> {
+ use crate::revolve::{Coverage, overlaps};
+ struct Run {
+ surface: Option,
+ bounds: Rect,
+ faces: Vec>,
+ cover: Vec,
+ }
+ let mut runs: Vec = vec![];
+ let mut last_run = vec![None; masks.len()];
+ // Past this many tests a face starts a run of its own, which never draws out of order.
+ let mut budget = crate::revolve::MAX_OVERLAP_TESTS;
+ for (surface, face) in faces {
+ let Some(cover) = Coverage::of(&face) else {
+ // A face with no outline and no box overlaps nothing.
+ runs.push(Run { surface: None, bounds: Rect::ZERO, faces: vec![face], cover: vec![] });
+ continue;
+ };
+ if masks.get(surface).is_none_or(Option::is_none) {
+ runs.push(Run { surface: None, bounds: cover.bounds, faces: vec![face], cover: vec![cover] });
+ continue;
+ }
+ let mut clear = |r: &Run| {
+ budget = budget.saturating_sub(1);
+ if !overlaps(r.bounds, cover.bounds) {
+ return budget > 0;
+ }
+ budget = budget.saturating_sub(r.cover.len());
+ budget > 0 && r.cover.iter().all(|c| !overlaps(c.bounds, cover.bounds) || !c.meets(&cover))
+ };
+ let joins = last_run.get(surface).copied().flatten().filter(|&i: &usize| runs.get(i + 1..).is_some_and(|later| later.iter().all(&mut clear)));
+ match joins.and_then(|i| runs.get_mut(i)) {
+ Some(run) => {
+ run.bounds = run.bounds.union(cover.bounds);
+ run.faces.push(face);
+ run.cover.push(cover);
+ }
+ None => {
+ if let Some(last) = last_run.get_mut(surface) {
+ *last = Some(runs.len());
+ }
+ runs.push(Run { surface: Some(surface), bounds: cover.bounds, faces: vec![face], cover: vec![cover] });
+ }
+ }
+ }
+ runs.into_iter()
+ .filter_map(|mut r| {
+ let Some(mask) = r.surface.and_then(|s| masks.get(s)).cloned().flatten() else { return r.faces.pop() };
+ let mut group = Node::group(id, r.faces);
+ group.extras_mut().mask = Some(mask);
+ Some(Arc::new(group))
+ })
+ .collect()
}
fn geometry(path: &PathData, fx: &[Effect], ctx: &GeomContext) -> PathData {
diff --git a/crates/effects/src/solids/tests.rs b/crates/effects/src/solids/tests.rs
index 248473f428..a79f209381 100644
--- a/crates/effects/src/solids/tests.rs
+++ b/crates/effects/src/solids/tests.rs
@@ -415,15 +415,16 @@ fn a_translucent_stroke_is_a_surface_of_its_own() {
}
/// With a light that is not white, a fill in a gradient with transparent stops is drawn with an
-/// opacity mask over its whole surface: the fill's solid and the stroke's stay surfaces of their
-/// own, and the mask stays on the fill's. Under a white light the same object is one surface.
+/// opacity mask: its faces still take their places in the one order of the fill's and the
+/// stroke's faces, in runs that each carry the mask. Under a white light the faces carry the
+/// gradient itself and no mask.
#[test]
-fn a_masked_surface_under_a_colored_light_stays_whole() {
+fn a_masked_surface_under_a_colored_light_keeps_the_shared_face_order() {
use vectorcraft_doc::color::{Gradient, GradientKind, GradientPaint, GradientStop};
let mut half = GradientStop::new(1.0, RED);
half.opacity = 0.5;
let gradient = GradientPaint::new(Gradient::new(GradientKind::Linear, vec![GradientStop::new(0.0, RED), half]));
- for (lights, surfaces) in [(json!({"lights": [{"color": "#ff8080"}]}), 2), (json!({}), 1)] {
+ for (lights, masked) in [(json!({"lights": [{"color": "#ff8080"}]}), true), (json!({}), false)] {
let mut n = stroked_rect(100.0);
if let Some(AppearanceItem::Fill(f)) = n.appearance.items.iter_mut().find(|i| matches!(i, AppearanceItem::Fill(_))) {
f.paint = Paint::Gradient(Box::new(gradient.clone()));
@@ -431,8 +432,10 @@ fn a_masked_surface_under_a_colored_light_stays_whole() {
n.appearance.effects.push(fx(EXTRUDE, lights.clone()));
let art = solid_art(&n).unwrap();
let drawn = art.children().unwrap();
- assert_eq!(drawn.len(), surfaces, "{lights}");
- assert_eq!(drawn[0].extras().mask.is_some(), surfaces == 2, "{lights}");
+ assert_eq!(drawn.len(), 1, "{lights}: one order of faces");
+ let runs: Vec<&Arc> = drawn[0].children().unwrap().iter().filter(|c| c.extras().mask.is_some()).collect();
+ assert_eq!(!runs.is_empty(), masked, "{lights}");
+ assert!(runs.iter().all(|r| r.children().unwrap().iter().all(|f| !blue(f))), "{lights}: the mask stays on the fill's faces");
}
}
@@ -847,7 +850,9 @@ fn classic_shading_keeps_a_gradients_transparency() {
}
let art = solid_art(&n).unwrap();
let surface = &art.children().unwrap()[0];
- assert_eq!(surface.extras().mask.is_some(), masked, "{end}");
+ let mut has_mask = false;
+ surface.walk(&mut |c| has_mask |= c.extras().mask.is_some());
+ assert_eq!(has_mask, masked, "{end}");
let mut opaque = true;
surface.walk(&mut |c| {
for item in &c.appearance.items {
@@ -862,6 +867,67 @@ fn classic_shading_keeps_a_gradients_transparency() {
}
}
+/// A group member in a gradient with transparent stops keeps the shared back-to-front order of
+/// every member's faces: its faces go in runs that carry its opacity mask, and the other member's
+/// faces are drawn between them where they are in front of some and behind others. Here a square
+/// frame in the gradient holds a square in its hole: the frame's inner walls are behind the square
+/// and its front cap is in front of the square's walls.
+#[test]
+fn a_member_in_a_transparent_gradient_keeps_the_shared_face_order() {
+ use vectorcraft_doc::color::{Gradient, GradientKind, GradientPaint, GradientStop};
+ let square = |b: &mut BezPath, x0: f64, x1: f64, clockwise: bool| {
+ let corners = [(x0, x0), (x1, x0), (x1, x1), (x0, x1)];
+ let mut points = corners.to_vec();
+ if !clockwise {
+ points.reverse();
+ }
+ b.move_to(points[0]);
+ for p in &points[1..] {
+ b.line_to(*p);
+ }
+ b.close_path();
+ };
+ let art = |id: &str, params: &Value, end_opacity: f32| {
+ let mut end = GradientStop::new(1.0, Color::BLACK);
+ end.opacity = end_opacity;
+ let gradient = Paint::Gradient(Box::new(GradientPaint::new(Gradient::new(GradientKind::Linear, vec![GradientStop::new(0.0, RED), end]))));
+ let mut b = BezPath::new();
+ square(&mut b, 100.0, 300.0, true);
+ square(&mut b, 150.0, 250.0, false);
+ let frame = Node::path(NodeId(1), PathData::from_bezpath(&b), Appearance::basic(gradient, Paint::None, 0.0));
+ let mut b = BezPath::new();
+ square(&mut b, 185.0, 215.0, true);
+ let inner = Node::path(NodeId(2), PathData::from_bezpath(&b), Appearance::basic(Paint::solid(BLUE), Paint::None, 0.0));
+ let mut g = Node::group(NodeId(3), vec![Arc::new(frame), Arc::new(inner)]);
+ g.appearance.effects.push(fx(id, params.clone()));
+ solid_art(&g).unwrap_or_else(|| panic!("{id}"))
+ };
+ // The drawing order: `M` for a group with an opacity mask, `F` for a face outside one.
+ fn visit(n: &Node, order: &mut String) {
+ if n.extras().mask.is_some() {
+ order.push('M');
+ return;
+ }
+ if n.path_data().is_some() {
+ order.push('F');
+ }
+ for c in n.children().into_iter().flatten() {
+ visit(c, order);
+ }
+ }
+ let order = |art: &Node| {
+ let mut order = String::new();
+ visit(art, &mut order);
+ order
+ };
+ for (id, params) in [(CLASSIC_EXTRUDE, json!({})), (EXTRUDE, json!({"lights": [{"color": "#ff8080"}]}))] {
+ assert!(!order(&art(id, ¶ms, 1.0)).contains('M'), "{id}: an opaque gradient needs no mask");
+ let masked = order(&art(id, ¶ms, 0.5));
+ let (first, last) = (masked.find('M').unwrap(), masked.rfind('M').unwrap());
+ assert!(masked.get(first..last).is_some_and(|between| between.contains('F')), "{id}: faces between the member's runs: {masked}");
+ }
+}
+
#[test]
fn classic_parameters_are_checked() {
let n = classic(json!({}));
From 2bb8cd0b92785fd287dc2bdada0cfd921b247f43 Mon Sep 17 00:00:00 2001
From: dotCooCoo
Date: Thu, 12 Nov 2026 00:04:53 -0800
Subject: [PATCH 15/38] =?UTF-8?q?Swatch=20libraries:=20Patterns=20?=
=?UTF-8?q?=E2=80=BA=20Optical=20Effects=20adds=20wave,=20moir=C3=A9=20and?=
=?UTF-8?q?=20op-art=20patterns?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Window › Swatch Libraries › Patterns and the Swatches panel's library
menu gain Optical Effects (`optical-effects`), a built-in pattern library
of eight black tiles drawn in code: Sine Bands, Ripple Lines,
Interference Rings, Offset Rings, Warped Checks, Pinched Stripes,
Chevron Pulse and Radiating Lenses. The names and designs are
VectorCraft's own. Each tile is 32 to 48 pt, one period of its design,
with fixed sample counts (at most 600 paths and 20,000 segments), so a
band that leaves one edge comes back at the same place on the opposite
edge, and rings and lenses that cross an edge are kept whole for the
tiling to draw on the next tile. Clicking a swatch adds its pattern and
swatch once and applies it, as with Geometric Patterns
(`swatch.library.add`).
The menu label has a row in every catalog; docs/mcp.md, the parity doc
and ROADMAP name the library.
---
ROADMAP.md | 1 +
crates/engine/src/cmd/patternlib.rs | 254 ++++++++++++++++++
crates/engine/src/tests/swatchlib.rs | 45 +++-
crates/ui-egui/src/i18n/bg.tsv | 1 +
crates/ui-egui/src/i18n/bs.tsv | 1 +
crates/ui-egui/src/i18n/ca.tsv | 1 +
crates/ui-egui/src/i18n/cs.tsv | 1 +
crates/ui-egui/src/i18n/da.tsv | 1 +
crates/ui-egui/src/i18n/de.tsv | 1 +
crates/ui-egui/src/i18n/el.tsv | 1 +
crates/ui-egui/src/i18n/es.tsv | 1 +
crates/ui-egui/src/i18n/fi.tsv | 1 +
crates/ui-egui/src/i18n/fr.tsv | 1 +
crates/ui-egui/src/i18n/hi.tsv | 1 +
crates/ui-egui/src/i18n/hu.tsv | 1 +
crates/ui-egui/src/i18n/id.tsv | 1 +
crates/ui-egui/src/i18n/it.tsv | 1 +
crates/ui-egui/src/i18n/ja.tsv | 1 +
crates/ui-egui/src/i18n/ka.tsv | 1 +
crates/ui-egui/src/i18n/ko.tsv | 1 +
crates/ui-egui/src/i18n/nl.tsv | 1 +
crates/ui-egui/src/i18n/pl.tsv | 1 +
crates/ui-egui/src/i18n/pt-br.tsv | 1 +
crates/ui-egui/src/i18n/ru.tsv | 1 +
crates/ui-egui/src/i18n/sv.tsv | 1 +
crates/ui-egui/src/i18n/tr.tsv | 1 +
crates/ui-egui/src/i18n/uk.tsv | 1 +
crates/ui-egui/src/i18n/vi.tsv | 1 +
crates/ui-egui/src/i18n/zh-hans.tsv | 1 +
crates/ui-egui/src/i18n/zh-hant.tsv | 1 +
.../ui-egui/src/panels/library_panel/tests.rs | 3 +-
docs/mcp.md | 7 +-
docs/target-app-parity.md | 2 +-
33 files changed, 333 insertions(+), 6 deletions(-)
diff --git a/ROADMAP.md b/ROADMAP.md
index b1f75b2735..af46cb5a4e 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -127,6 +127,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap
- 2026-11-02: Mouse wheel over a closed font-family field in Character, Properties or Control changes selected text through the family list using saved font filters (excluding search text), one undo step per notch, stopping at the ends (#5253). Scores and estimates unchanged.
- 2026-10-31: Pattern libraries: Window › Swatch Libraries › Patterns and the Swatches panel's library menu open Geometric Patterns, a built-in library of eleven pattern swatches (dots, stripes, checks, a grid and shapes); clicking one adds its pattern and swatch to the document, once, and applies it to the active fill or stroke (`swatch.library.add`).
- 2026-11-11: Pattern libraries: Patterns › Grit Textures, a second built-in pattern library, holds eight seamless black textures (Fine Grain, Coarse Grit, Sand, Speckle, Stipple, Scratches, Sparse Flecks and Dense Flecks) on tiles of 18 to 36 pt, each drawn the same way every time; marks that reach past a tile edge continue on the next tile, so the tiles join without a seam (`swatch.library.add`). Scores and estimates unchanged.
+- 2026-11-11: Pattern libraries: Patterns › Optical Effects, a third built-in pattern library, of VectorCraft's own designs, holds eight black wave, moiré and op-art tiles (Sine Bands, Ripple Lines, Interference Rings, Offset Rings, Warped Checks, Pinched Stripes, Chevron Pulse and Radiating Lenses) of 32 to 48 pt, each drawn the same way every time; each tile is one period of its design, and art that reaches past a tile edge continues on the next tile, so the tiles join without a seam (`swatch.library.add`). Scores and estimates unchanged.
- 2026-11-01: Find Nearest Swatch joins the Color Effects add-on (Object › Plug-ins › Color Effects): for each colour of the selection, the closest swatches of the document, a built-in library or a library or colour book the user loaded, with their CIEDE2000 difference; Apply gives each colour its nearest swatch as one undo step, linking global and spot swatches and adding a library's to the document first, so a process colour becomes the closest spot colour (`addon.color.nearestSwatch`, `addon.color.applyNearestSwatch`, #4923).
- 2026-11-01: Expand Dashes into Paths joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): each selected path's dashed stroke becomes separate open paths, one per dash, laid out exactly as the stroke draws them (pattern, offset, Align Dashes to Corners and Path Ends), each keeping the stroke with the dashes off, so the gaps are real gaps for cutters and plotters, as one undo step (`addon.pathtools.expandDashes`, #4922).
- 2026-11-01: Randomize Opacity joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): each selected object gets its own opacity at random between a minimum and a maximum percent, with a seed that repeats the result, as one undo step (`addon.arrange.randomizeOpacity`, #4925).
diff --git a/crates/engine/src/cmd/patternlib.rs b/crates/engine/src/cmd/patternlib.rs
index 8fd2a0ea5e..f69e4b889e 100644
--- a/crates/engine/src/cmd/patternlib.rs
+++ b/crates/engine/src/cmd/patternlib.rs
@@ -26,6 +26,7 @@ pub struct BuiltinPatternLibrary {
pub const PATTERN_LIBRARIES: &[BuiltinPatternLibrary] = &[
BuiltinPatternLibrary { id: "geometric-patterns", name: "Geometric Patterns", make: geometric_patterns },
BuiltinPatternLibrary { id: "grit-textures", name: "Grit Textures", make: grit_textures },
+ BuiltinPatternLibrary { id: "optical-effects", name: "Optical Effects", make: optical_effects },
];
/// The library category of the built-in pattern libraries.
@@ -256,6 +257,162 @@ fn grit_textures(d: &mut Document) {
});
}
+/// `n` + 1 points of the curve `(t, f(t))` for `t` from `t0` to `t1`, evenly spaced.
+fn curve(t0: f64, t1: f64, n: u32, f: impl Fn(f64) -> f64) -> Vec<(f64, f64)> {
+ (0..=n)
+ .map(|i| {
+ let t = t0 + (t1 - t0) * f64::from(i) / f64::from(n);
+ (t, f(t))
+ })
+ .collect()
+}
+
+/// The closed band between two curves drawn from the same side to the same side: `upper` forward,
+/// then `lower` back.
+fn band(upper: &[(f64, f64)], lower: &[(f64, f64)]) -> PathData {
+ let points: Vec<(f64, f64)> = upper.iter().chain(lower.iter().rev()).copied().collect();
+ polygon(&points)
+}
+
+/// 72 corners of the circle of radius `r` about (`cx`, `cy`), turning the other way with `reverse`.
+fn circle(cx: f64, cy: f64, r: f64, reverse: bool) -> SubPath {
+ const CORNERS: u32 = 72;
+ let turn = if reverse { -std::f64::consts::TAU } else { std::f64::consts::TAU };
+ let points: Vec = (0..CORNERS)
+ .map(|i| {
+ let a = turn * f64::from(i) / f64::from(CORNERS);
+ Point::new(cx + r * a.cos(), cy + r * a.sin())
+ })
+ .collect();
+ SubPath::polyline(&points, true)
+}
+
+/// The ring from radius `inner` to `outer` about (`cx`, `cy`): the outer circle and the inner one
+/// turning the other way, so the middle stays clear under either fill rule. An `inner` of 0 gives
+/// a disk.
+fn ring(cx: f64, cy: f64, inner: f64, outer: f64) -> PathData {
+ let mut subpaths = vec![circle(cx, cy, outer, false)];
+ if inner > 0.0 {
+ subpaths.push(circle(cx, cy, inner, true));
+ }
+ PathData::new(subpaths)
+}
+
+/// A lens `2 × l` long and `2 × h` high about (`cx`, `cy`), lying along x: two half sine waves that
+/// meet at its tips, turning the other way with `reverse`.
+fn lens(cx: f64, cy: f64, l: f64, h: f64, reverse: bool) -> SubPath {
+ const STEPS: u32 = 32;
+ let at = |i: u32, side: f64| {
+ let t = f64::from(i) / f64::from(STEPS);
+ Point::new(cx - l + 2.0 * l * t, cy + side * h * (std::f64::consts::PI * t).sin())
+ };
+ let mut points: Vec = (0..=STEPS).map(|i| at(i, -1.0)).chain((1..STEPS).rev().map(|i| at(i, 1.0))).collect();
+ if reverse {
+ points.reverse();
+ }
+ SubPath::polyline(&points, true)
+}
+
+/// Optical Effects: black waves, rings, warped checks, pinched stripes, chevrons and lenses on a
+/// clear background. Each tile is one period of its design, so a band that leaves one edge comes
+/// back at the same place on the opposite edge. Art that reaches past an edge is kept whole: the
+/// tiling draws the part outside the tile on the next tile.
+fn optical_effects(d: &mut Document) {
+ use std::f64::consts::TAU;
+ // Three bands 5 pt wide, 12 pt apart, each one sine wave across the tile.
+ let bands = (0..3u32)
+ .map(|k| {
+ let mid = move |x: f64| 6.0 + 12.0 * f64::from(k) + 3.0 * (TAU * x / 36.0).sin();
+ band(&curve(0.0, 36.0, 48, |x| mid(x) - 2.5), &curve(0.0, 36.0, 48, |x| mid(x) + 2.5))
+ })
+ .collect();
+ add(d, "Sine Bands", 36.0, 36.0, TileType::Grid, bands);
+ // Nine thin waves 4 pt apart, two waves across the tile, each a ninth of a wave on from the one
+ // above it, so the ninth leads into the first wave of the next tile down.
+ let lines = (0..9u32)
+ .map(|k| {
+ let (y, phase) = (2.0 + 4.0 * f64::from(k), TAU * f64::from(k) / 9.0);
+ let mid = move |x: f64| y + 2.5 * (TAU * x / 18.0 + phase).sin();
+ band(&curve(0.0, 36.0, 72, |x| mid(x) - 0.6), &curve(0.0, 36.0, 72, |x| mid(x) + 0.6))
+ })
+ .collect();
+ add(d, "Ripple Lines", 36.0, 36.0, TileType::Grid, lines);
+ // Thin rings 3 pt apart about the center and rings 3.3 pt apart about a point 4 pt to its
+ // right. The two sets cross, and the outer rings reach into the next tile across.
+ let rings = (1..=7u32)
+ .map(|k| (24.0, 3.0 * f64::from(k)))
+ .chain((1..=7u32).map(|k| (28.0, 3.3 * f64::from(k))))
+ .map(|(cx, r)| ring(cx, 24.0, r - 0.6, r + 0.6))
+ .collect();
+ add(d, "Interference Rings", 48.0, 48.0, TileType::Grid, rings);
+ // Rings 2 pt and 1 pt wide by turns about the tile's corner and about its center, the center's
+ // starting with the narrower one. The corner's rings are the same rings at all four corners.
+ let mut rings = vec![];
+ for (c, first) in [(0.0, 0), (20.0, 1)] {
+ let mut r = 0.0;
+ for k in 0..5 {
+ let width = if (k + first) % 2 == 0 { 2.0 } else { 1.0 };
+ rings.push(ring(c, c, r, r + width));
+ r += width + 1.2;
+ }
+ }
+ add(d, "Offset Rings", 40.0, 40.0, TileType::Grid, rings);
+ // An 8 × 8 checkerboard of 4 pt cells whose columns are bent by a sine wave down the tile and
+ // whose rows by one across it, each edge drawn through five points.
+ let warp = |x: f64, y: f64| (x + 2.0 * (TAU * y / 32.0).sin(), y + 2.0 * (TAU * x / 32.0).sin());
+ let cells = (0..8u32)
+ .flat_map(|row| (0..8u32).map(move |col| (col, row)))
+ .filter(|(col, row)| (col + row) % 2 == 0)
+ .map(|(col, row)| {
+ let (x, y) = (4.0 * f64::from(col), 4.0 * f64::from(row));
+ let corners = [(x, y), (x + 4.0, y), (x + 4.0, y + 4.0), (x, y + 4.0), (x, y)];
+ let points: Vec<(f64, f64)> = corners
+ .windows(2)
+ .flat_map(|e| {
+ let (a, b) = (e[0], e[1]);
+ (0..4u32).map(move |i| {
+ let t = f64::from(i) / 4.0;
+ warp(a.0 + (b.0 - a.0) * t, a.1 + (b.1 - a.1) * t)
+ })
+ })
+ .collect();
+ polygon(&points)
+ })
+ .collect();
+ add(d, "Warped Checks", 32.0, 32.0, TileType::Grid, cells);
+ // Six upright stripes 6 pt apart that widen from 0.8 pt to 5.6 pt and narrow again down the tile,
+ // each a sixth of a wave on from the one to its left.
+ let stripes = (0..6u32)
+ .map(|k| {
+ let (x, phase) = (3.0 + 6.0 * f64::from(k), TAU * f64::from(k) / 6.0);
+ let half = move |y: f64| 1.6 + 1.2 * (TAU * y / 36.0 + phase).cos();
+ let side = |s: f64| -> Vec<(f64, f64)> { curve(0.0, 36.0, 48, |y| x + s * half(y)).into_iter().map(|(y, at)| (at, y)).collect() };
+ band(&side(-1.0), &side(1.0))
+ })
+ .collect();
+ add(d, "Pinched Stripes", 36.0, 36.0, TileType::Grid, stripes);
+ // Four zigzag bands 8 pt apart, two zigzags across the tile; the bend and the width of the bands
+ // rise and fall from band to band.
+ let chevrons = [(0.0, 3.0, 4.0), (8.0, 4.5, 2.5), (16.0, 3.0, 1.0), (24.0, 1.5, 2.5)]
+ .into_iter()
+ .map(|(y, bend, width)| {
+ let upper: Vec<(f64, f64)> = (0..=4u32).map(|i| (8.0 * f64::from(i), if i % 2 == 1 { y + bend } else { y })).collect();
+ let lower: Vec<(f64, f64)> = upper.iter().map(|&(x, y)| (x, y + width)).collect();
+ band(&upper, &lower)
+ })
+ .collect();
+ add(d, "Chevron Pulse", 32.0, 32.0, TileType::Grid, chevrons);
+ // Five nested lens outlines 1.5 pt wide about the center, 14 pt to 78 pt long. The longer ones
+ // reach across the side edges and cross the next tiles' lenses.
+ let lenses = (0..5u32)
+ .map(|k| {
+ let (l, h) = (7.0 + 8.0 * f64::from(k), 4.0 + 4.0 * f64::from(k));
+ PathData::new(vec![lens(24.0, 24.0, l, h, false), lens(24.0, 24.0, l - 1.5, h - 1.5, true)])
+ })
+ .collect();
+ add(d, "Radiating Lenses", 48.0, 48.0, TileType::Grid, lenses);
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -326,4 +483,101 @@ mod tests {
}
assert!(crossing > 0, "no mark reaches past an edge");
}
+
+ const OPTICAL: [&str; 8] =
+ ["Sine Bands", "Ripple Lines", "Interference Rings", "Offset Rings", "Warped Checks", "Pinched Stripes", "Chevron Pulse", "Radiating Lenses"];
+
+ fn optical_doc() -> Document {
+ let mut d = Document::new(100.0, 100.0);
+ optical_effects(&mut d);
+ d
+ }
+
+ /// The paths of pattern `p`'s art, each with its fill rule.
+ fn paths(p: &PatternDef) -> Vec<(&PathData, vectorcraft_geom::FillRule)> {
+ p.art
+ .iter()
+ .map(|n| match &n.kind {
+ vectorcraft_doc::NodeKind::Path { path, rule, .. } => (path, *rule),
+ _ => panic!("{}: art that is not a path", p.name),
+ })
+ .collect()
+ }
+
+ #[test]
+ fn optical_effects_is_a_pattern_library_of_eight_bounded_tiles() {
+ let b = PATTERN_LIBRARIES.iter().find(|b| b.id == "optical-effects").expect("Optical Effects is listed");
+ assert_eq!(b.name, "Optical Effects");
+ let names: Vec = library_doc(b.id).unwrap().patterns.iter().map(|p| p.name.clone()).collect();
+ assert_eq!(names, OPTICAL);
+ // Made twice, the art is the same.
+ let (a, again) = (optical_doc(), optical_doc());
+ assert_eq!(a.patterns, again.patterns);
+ for p in &a.patterns {
+ let (w, h) = (p.width(), p.height());
+ assert!((32.0..=48.0).contains(&w) && w == h && p.tile.x0 == 0.0 && p.tile.y0 == 0.0, "{}", p.name);
+ assert_eq!(p.tile_type, TileType::Grid, "{}", p.name);
+ let paths = paths(p);
+ let segments: usize = paths.iter().flat_map(|(path, _)| &path.subpaths).map(SubPath::segment_count).sum();
+ assert!(!paths.is_empty() && paths.len() <= 600 && segments <= 20_000, "{}: {} paths, {segments} segments", p.name, paths.len());
+ for (path, _) in &paths {
+ let b = path.bounds().unwrap_or_else(|| panic!("{}: an empty path", p.name));
+ assert!([b.x0, b.y0, b.x1, b.y1].iter().all(|v| v.is_finite()) && b.width() > 0.0 && b.height() > 0.0, "{}: {b:?}", p.name);
+ assert!(b.x1 > 0.0 && b.y1 > 0.0 && b.x0 < w && b.y0 < h, "{}: {b:?} does not touch the tile", p.name);
+ }
+ }
+ }
+
+ /// Just either side of a tile's right and bottom edges, the tiling paints the same points: a band
+ /// cut off at an edge, or one that comes back at another height or width, paints one side only.
+ /// No path is another moved by a whole tile, which the tiling would draw twice in one place.
+ #[test]
+ fn optical_tiles_join_without_a_seam() {
+ const SAMPLES: u32 = 400;
+ const STEP: f64 = 1e-4;
+ for p in &optical_doc().patterns {
+ let (w, h) = (p.width(), p.height());
+ let shapes: Vec<(BezPathFill, Rect)> =
+ paths(p).into_iter().map(|(path, rule)| ((path.to_bezpath(), rule), path.bounds().unwrap_or(Rect::ZERO))).collect();
+ let paints = |q: Point| {
+ let near = Rect::new(q.x - STEP, q.y - STEP, q.x + STEP, q.y + STEP);
+ p.offsets_covering(near).into_iter().any(|o| {
+ let at = q - o;
+ shapes.iter().any(|((bp, rule), b)| {
+ let inside = b.x0 <= at.x && at.x <= b.x1 && b.y0 <= at.y && at.y <= b.y1;
+ let turns = if inside { kurbo::Shape::winding(bp, at) } else { 0 };
+ match rule {
+ vectorcraft_geom::FillRule::EvenOdd => turns % 2 != 0,
+ vectorcraft_geom::FillRule::NonZero => turns != 0,
+ }
+ })
+ })
+ };
+ let (mut differ, mut painted) = (0, 0);
+ for i in 0..SAMPLES {
+ let t = (f64::from(i) + 0.37) / f64::from(SAMPLES);
+ let (right, bottom) = (Point::new(w, t * h), Point::new(t * w, h));
+ let (dx, dy) = (kurbo::Vec2::new(STEP, 0.0), kurbo::Vec2::new(0.0, STEP));
+ for (a, b) in [(right - dx, right + dx), (bottom - dy, bottom + dy)] {
+ let (pa, pb) = (paints(a), paints(b));
+ differ += usize::from(pa != pb);
+ painted += usize::from(pa);
+ }
+ }
+ assert!(differ <= 2, "{}: {differ} of {} points across the edges differ", p.name, 2 * SAMPLES);
+ assert!(painted > 0, "{}: nothing crosses an edge", p.name);
+ let bounds: Vec = shapes.iter().map(|(_, b)| *b).collect();
+ let same = |a: &Rect, b: Rect| {
+ (a.x0 - b.x0).abs() < 1e-9 && (a.y0 - b.y0).abs() < 1e-9 && (a.x1 - b.x1).abs() < 1e-9 && (a.y1 - b.y1).abs() < 1e-9
+ };
+ for b in &bounds {
+ for (dx, dy) in [(w, 0.0), (-w, 0.0), (0.0, h), (0.0, -h), (w, h), (w, -h), (-w, h), (-w, -h)] {
+ let moved = *b + kurbo::Vec2::new(dx, dy);
+ assert!(!bounds.iter().any(|o| same(o, moved)), "{}: {b:?} is drawn twice by the tiling", p.name);
+ }
+ }
+ }
+ }
+
+ type BezPathFill = (vectorcraft_geom::BezPath, vectorcraft_geom::FillRule);
}
diff --git a/crates/engine/src/tests/swatchlib.rs b/crates/engine/src/tests/swatchlib.rs
index 57d6c23d06..a02fb079c9 100644
--- a/crates/engine/src/tests/swatchlib.rs
+++ b/crates/engine/src/tests/swatchlib.rs
@@ -806,7 +806,7 @@ fn a_grit_texture_adds_once_undoes_and_saves() {
let list = run(&mut s, "swatch.library.list", json!({}));
let ids: Vec<&str> =
list["libraries"].as_array().unwrap().iter().filter(|l| l["category"] == "patterns").map(|l| l["id"].as_str().unwrap()).collect();
- assert_eq!(ids, ["geometric-patterns", "grit-textures"]);
+ assert_eq!(ids, ["geometric-patterns", "grit-textures", "optical-effects"]);
let got = run(&mut s, "swatch.library.get", json!({"library": "Grit Textures"}));
let names: Vec<&str> = got["swatches"].as_array().unwrap().iter().map(|w| w["name"].as_str().unwrap()).collect();
assert_eq!(names, ["Fine Grain", "Coarse Grit", "Sand", "Speckle", "Stipple", "Scratches", "Sparse Flecks", "Dense Flecks"]);
@@ -831,6 +831,49 @@ fn a_grit_texture_adds_once_undoes_and_saves() {
assert_eq!(back.swatch("Stipple").map(|w| &w.paint), doc(&s).swatch("Stipple").map(|w| &w.paint));
}
+/// Optical Effects is listed after Grit Textures, and reading it adds nothing. Clicking one of
+/// its patterns brings it with its swatch and fills the selection with it, once, as one undo step
+/// that also takes both away, and both stay after a save and reopen.
+#[test]
+fn an_optical_effect_adds_once_fills_undoes_and_saves() {
+ let mut s = session();
+ let counts = |d: &vectorcraft_doc::Document| (d.patterns.len(), d.swatches_iter().count());
+ let empty = counts(doc(&s));
+ let list = run(&mut s, "swatch.library.list", json!({}));
+ let ids: Vec<&str> =
+ list["libraries"].as_array().unwrap().iter().filter(|l| l["category"] == "patterns").map(|l| l["id"].as_str().unwrap()).collect();
+ assert_eq!(ids, ["geometric-patterns", "grit-textures", "optical-effects"]);
+ let got = run(&mut s, "swatch.library.get", json!({"library": "Optical Effects"}));
+ let names: Vec<&str> = got["swatches"].as_array().unwrap().iter().map(|w| w["name"].as_str().unwrap()).collect();
+ assert_eq!(
+ names,
+ ["Sine Bands", "Ripple Lines", "Interference Rings", "Offset Rings", "Warped Checks", "Pinched Stripes", "Chevron Pulse", "Radiating Lenses"]
+ );
+ assert_eq!(counts(doc(&s)), empty, "reading a library adds no pattern or swatch");
+ let id = vectorcraft_doc::NodeId(run(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50}))["id"].as_u64().unwrap());
+ let undo = undo_len(&s);
+ let r = run(&mut s, "swatch.library.add", json!({"library": "optical-effects", "names": ["Warped Checks"], "apply": "fill"}));
+ assert_eq!((r["added"].clone(), r["applied"].clone()), (json!(["Warped Checks"]), json!("Warped Checks")));
+ assert_eq!((counts(doc(&s)), undo_len(&s)), ((empty.0 + 1, empty.1 + 1), undo + 1));
+ let def = doc(&s).pattern("Warped Checks").expect("the pattern comes with its swatch").clone();
+ assert_eq!(def.art.len(), 32, "the black cells of an 8 × 8 checkerboard");
+ assert!(matches!(doc(&s).swatch("Warped Checks").map(|w| &w.paint), Some(Paint::Pattern { pattern, .. }) if pattern == "Warped Checks"));
+ let filled = |d: &vectorcraft_doc::Document| matches!(d.node(id).unwrap().appearance.fill_paint(), Paint::Pattern { pattern, .. } if pattern == "Warped Checks");
+ assert!(filled(doc(&s)));
+ let r = run(&mut s, "swatch.library.add", json!({"library": "optical-effects", "names": ["Warped Checks"]}));
+ assert_eq!((r["added"].clone(), r["existing"].clone()), (json!([]), json!(["Warped Checks"])));
+ assert_eq!((counts(doc(&s)), undo_len(&s)), ((empty.0 + 1, empty.1 + 1), undo + 1), "added once");
+ run(&mut s, "edit.undo", json!({}));
+ assert_eq!(counts(doc(&s)), empty);
+ assert!(doc(&s).pattern("Warped Checks").is_none() && doc(&s).swatch("Warped Checks").is_none() && !filled(doc(&s)));
+ run(&mut s, "edit.redo", json!({}));
+ assert!(filled(doc(&s)));
+ let back = vectorcraft_format::load(&vectorcraft_format::save(doc(&s), false)).unwrap();
+ assert_eq!(back.pattern("Warped Checks"), Some(&def));
+ assert_eq!(back.swatch("Warped Checks").map(|w| &w.paint), doc(&s).swatch("Warped Checks").map(|w| &w.paint));
+ assert!(filled(&back));
+}
+
/// A device name is saved with a `-` after it, which can be another library's own name: neither
/// library replaces the other, and saving either again replaces only itself.
#[test]
diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv
index 97e5b335d3..240444ac20 100644
--- a/crates/ui-egui/src/i18n/bg.tsv
+++ b/crates/ui-egui/src/i18n/bg.tsv
@@ -5851,6 +5851,7 @@ theme Appearance Външен вид
Ruby… Руби…
Ruby Руби
Geometric Guides Геометрични водачи
+ Optical Effects Оптични ефекти
Geometric Patterns Геометрични мостри
Grit Textures Зърнести текстури
Ease In Плавно начало
diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv
index 75353321ff..22d1455f73 100644
--- a/crates/ui-egui/src/i18n/bs.tsv
+++ b/crates/ui-egui/src/i18n/bs.tsv
@@ -5868,6 +5868,7 @@ mark-style Japanese Japanski
Ruby… Ruby…
Ruby Ruby
Geometric Guides Geometrijske vodilice
+ Optical Effects Optički efekti
Geometric Patterns Geometrijski uzorci
Grit Textures Zrnaste teksture
Ease In Ublaži ulaz
diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv
index 75e0b9ea20..2d6e8799d0 100644
--- a/crates/ui-egui/src/i18n/ca.tsv
+++ b/crates/ui-egui/src/i18n/ca.tsv
@@ -2914,6 +2914,7 @@ digits Malayalam Malaiàlam
Opens network connections Obre connexions de xarxa
Open… Obre…
Optical Òptic
+ Optical Effects Efectes òptics
Optical Margin Alignment Alineació òptica de marges
Dynamic Text Text dinàmic
Dynamic Text Presets Valors predefinits de text dinàmic
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 5d37ee136e..3c1170bf9d 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -6033,6 +6033,7 @@ mark-style Japanese Japonské
Ruby… Ruby…
Ruby Ruby
Geometric Guides Geometrická vodítka
+ Optical Effects Optické efekty
Geometric Patterns Geometrické vzorky
Grit Textures Zrnité textury
Ease In Pozvolný začátek
diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv
index 8167f80138..2a1b9d8007 100644
--- a/crates/ui-egui/src/i18n/da.tsv
+++ b/crates/ui-egui/src/i18n/da.tsv
@@ -5866,6 +5866,7 @@ swatch Bright Violet Kraftig violet
Ruby… Ruby…
Ruby Ruby
Geometric Guides Geometriske hjælpelinjer
+ Optical Effects Optiske effekter
Geometric Patterns Geometriske mønstre
Grit Textures Kornede teksturer
Ease In Langsom start
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index bd4bb38b43..0805be2caf 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -5622,6 +5622,7 @@ effect Soft Weich
Ruby… Ruby…
Ruby Ruby
Geometric Guides Geometrische Hilfslinien
+ Optical Effects Optische Effekte
Geometric Patterns Geometrische Muster
Grit Textures Körnige Texturen
Ease In Langsam starten
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index 9860f8ad50..278b6cf81a 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -5984,6 +5984,7 @@ effect Points Σημεία
Ruby… Ruby…
Ruby Ruby
Geometric Guides Γεωμετρικοί οδηγοί
+ Optical Effects Οπτικά εφέ
Geometric Patterns Γεωμετρικά μοτίβα
Grit Textures Κοκκώδεις υφές
Ease In Ομαλή αρχή
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index 10c0c0bf87..f0f804e008 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -5975,6 +5975,7 @@ mark-style Japanese Japonesas
Ruby… Ruby…
Ruby Ruby
Geometric Guides Guías geométricas
+ Optical Effects Efectos ópticos
Geometric Patterns Motivos geométricos
Grit Textures Texturas granuladas
Ease In Entrada suave
diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv
index 7845235f65..471b98e76c 100644
--- a/crates/ui-egui/src/i18n/fi.tsv
+++ b/crates/ui-egui/src/i18n/fi.tsv
@@ -6063,6 +6063,7 @@ swatch Bright Violet Kirkas violetti
Ruby… Ruby…
Ruby Ruby
Geometric Guides Geometriset apuviivat
+ Optical Effects Optiset tehosteet
Geometric Patterns Geometriset kuviot
Grit Textures Rakeiset tekstuurit
Ease In Hidas alku
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index 5e2895f9c2..fe3b98d0e8 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -6028,6 +6028,7 @@ theme Appearance Apparence
Ruby… Ruby…
Ruby Ruby
Geometric Guides Repères géométriques
+ Optical Effects Effets optiques
Geometric Patterns Motifs géométriques
Grit Textures Textures granuleuses
Ease In Accélération progressive
diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv
index aca21d7eec..74fb288598 100644
--- a/crates/ui-egui/src/i18n/hi.tsv
+++ b/crates/ui-egui/src/i18n/hi.tsv
@@ -3170,6 +3170,7 @@ antiAlias Sharp शार्प
Opens network connections नेटवर्क कनेक्शन ओपन करें
OpenType Features ओपन टाइप सुविधाएँ
Optical ऑप्टिकल
+ Optical Effects ऑप्टिकल इफ़ेक्ट्स
Optical Margin Alignment ऑप्टिकल मार्जिन संरेखण
Dynamic Text डायनैमिक टेक्स्ट
Dynamic Text Presets डायनैमिक टेक्स्ट प्रीसेट
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index 45d19b0ca9..55b97d4d21 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -6016,6 +6016,7 @@ imageTrace Outline Körvonal
Ruby… Ruby…
Ruby Ruby
Geometric Guides Geometriai segédvonalak
+ Optical Effects Optikai effektusok
Geometric Patterns Geometriai mintázatok
Grit Textures Szemcsés textúrák
Ease In Lassú kezdés
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 8e2b383e2d..a55f7699bf 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -5866,6 +5866,7 @@ swatch Bright Violet Violet cerah
Ruby… Ruby…
Ruby Ruby
Geometric Guides Panduan Geometris
+ Optical Effects Efek Optis
Geometric Patterns Pola Geometris
Grit Textures Tekstur Butiran
Ease In Awal Lambat
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 26e1f29651..a9ba306b9f 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -5656,6 +5656,7 @@ lighting Light Luce
Ruby… Ruby…
Ruby Ruby
Geometric Guides Guide geometriche
+ Optical Effects Effetti ottici
Geometric Patterns Motivi geometrici
Grit Textures Texture granulose
Ease In Inizio graduale
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 30873028e8..fab0450610 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -5706,6 +5706,7 @@ lighting Light ライト
Ruby… ルビ…
Ruby ルビ
Geometric Guides 幾何ガイド
+ Optical Effects オプティカル効果
Geometric Patterns 幾何パターン
Grit Textures 粒状テクスチャ
Ease In イーズイン
diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv
index 8e9d9d049d..c8274c9b31 100644
--- a/crates/ui-egui/src/i18n/ka.tsv
+++ b/crates/ui-egui/src/i18n/ka.tsv
@@ -5973,6 +5973,7 @@ imageTrace Outline კონტური
Ruby… რუბი…
Ruby რუბი
Geometric Guides გეომეტრიული მიმმართველები
+ Optical Effects ოპტიკური ეფექტები
Geometric Patterns გეომეტრიული პატერნები
Grit Textures მარცვლოვანი ტექსტურები
Ease In ნელი დასაწყისი
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index f00e6cdeba..93b4ce1bb9 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -5617,6 +5617,7 @@ lighting Light 광원
Ruby… 루비…
Ruby 루비
Geometric Guides 기하학적 안내선
+ Optical Effects 광학 효과
Geometric Patterns 기하학적 패턴
Grit Textures 입자 텍스처
Ease In 서서히 시작
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index bc00b76698..282b409a58 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -5917,6 +5917,7 @@ swatch Bright Violet Felviolet
Ruby… Ruby…
Ruby Ruby
Geometric Guides Geometrische hulplijnen
+ Optical Effects Optische effecten
Geometric Patterns Geometrische patronen
Grit Textures Korrelige texturen
Ease In Langzaam beginnen
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 23940fb80f..1899b72951 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -5887,6 +5887,7 @@ mark-style Japanese Japońskie
Ruby… Ruby…
Ruby Ruby
Geometric Guides Geometryczne linie pomocnicze
+ Optical Effects Efekty optyczne
Geometric Patterns Wzorki geometryczne
Grit Textures Tekstury ziarniste
Ease In Łagodny początek
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 32c4b4bcc0..13eee61ed3 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -5948,6 +5948,7 @@ mark-style Japanese Japonesas
Ruby… Ruby…
Ruby Ruby
Geometric Guides Guias geométricas
+ Optical Effects Efeitos ópticos
Geometric Patterns Padrões geométricos
Grit Textures Texturas granuladas
Ease In Entrada suave
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 15d3c3a380..f1321b48d8 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -5642,6 +5642,7 @@ lighting Light Свет
Ruby… Руби…
Ruby Руби
Geometric Guides Геометрические направляющие
+ Optical Effects Оптические эффекты
Geometric Patterns Геометрические узоры
Grit Textures Зернистые текстуры
Ease In Плавное начало
diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv
index 5ffc963fad..999be89513 100644
--- a/crates/ui-egui/src/i18n/sv.tsv
+++ b/crates/ui-egui/src/i18n/sv.tsv
@@ -6055,6 +6055,7 @@ font-script Japanese Japanska
Ruby… Ruby…
Ruby Ruby
Geometric Guides Geometriska stödlinjer
+ Optical Effects Optiska effekter
Geometric Patterns Geometriska mönster
Grit Textures Korniga texturer
Ease In Långsam start
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index 86356d74ba..753f6024f6 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -6028,6 +6028,7 @@ axis Y Axis Y ekseni
Snap to Tangent Teğete Yasla
Snap to Perpendicular Dikeye Yasla
Geometric Guides Geometrik Kılavuzlar
+ Optical Effects Optik Efektler
Geometric Patterns Geometrik Desenler
Grit Textures Grenli Dokular
@msg `method` must be classic or perceptual `method` classic veya perceptual olmalıdır
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index ebba0f5c19..ad649f4ab0 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -5636,6 +5636,7 @@ lighting Light Світло
Ruby… Рубі…
Ruby Рубі
Geometric Guides Геометричні напрямні
+ Optical Effects Оптичні ефекти
Geometric Patterns Геометричні візерунки
Grit Textures Зернисті текстури
Ease In Плавний початок
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index 0ec0fd4e40..93e9d93881 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -5637,6 +5637,7 @@ theme Appearance Giao diện
Ruby… Ruby…
Ruby Ruby
Geometric Guides Đường dẫn hình học
+ Optical Effects Hiệu ứng quang học
Geometric Patterns Họa tiết hình học
Grit Textures Kết cấu hạt
Ease In Chậm lúc đầu
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 9fc1cdc4e8..45cd676f69 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -5870,6 +5870,7 @@ lighting Light 光源
Ruby… 注音…
Ruby 注音
Geometric Guides 几何参考线
+ Optical Effects 光学效果
Geometric Patterns 几何图案
Grit Textures 颗粒纹理
Ease In 缓入
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 685f7887fb..e6393341b3 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -5674,6 +5674,7 @@ lighting Light 光源
Ruby… 注音…
Ruby 注音
Geometric Guides 幾何參考線
+ Optical Effects 光學效果
Geometric Patterns 幾何圖樣
Grit Textures 顆粒紋理
Ease In 緩入
diff --git a/crates/ui-egui/src/panels/library_panel/tests.rs b/crates/ui-egui/src/panels/library_panel/tests.rs
index f28e7e5540..10acd4603e 100644
--- a/crates/ui-egui/src/panels/library_panel/tests.rs
+++ b/crates/ui-egui/src/panels/library_panel/tests.rs
@@ -155,9 +155,10 @@ fn find_filters_list_view_and_arrows_step_through_the_libraries() {
assert!(ctx.read_response(tile_id(panel, "#00FF00")).is_none());
let first = SWATCH_IDS[0];
let last = SwatchLibraries::list(&app).pop().unwrap().id;
- assert_eq!(last, "grit-textures", "gradient and then pattern libraries come after the swatch libraries");
+ assert_eq!(last, "optical-effects", "gradient and then pattern libraries come after the swatch libraries");
assert_eq!(neighbour::(&app, "radial-glows", 1).as_deref(), Some("geometric-patterns"));
assert_eq!(neighbour::(&app, "geometric-patterns", 1).as_deref(), Some("grit-textures"));
+ assert_eq!(neighbour::(&app, "grit-textures", 1).as_deref(), Some("optical-effects"));
assert_eq!(neighbour::(&app, first, -1), Some(last), "wraps around");
assert_eq!(neighbour::(&app, "web-safe-216", 1).as_deref(), Some(SWATCH_IDS[1]));
}
diff --git a/docs/mcp.md b/docs/mcp.md
index 7bf5ae9956..dd910b162a 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -3373,9 +3373,10 @@ in the `swatch.list` shape (`library` is an id or a name). `swatch.library.add {
into the document as one undo step: a colour group's name brings the whole group, a swatch's name the swatch alone,
no names the whole library; swatches the document already has (same name and paint) are reported under `existing`
and not added again. `apply: "fill"|"stroke"` also applies the first one, in the same undo step (what clicking a
-swatch in the library panel does). The pattern libraries Geometric Patterns (`geometric-patterns`) and Grit Textures
-(`grit-textures`: seamless black grain, grit, sand, speckle, stipple, scratch and fleck tiles), category `patterns`,
-hold pattern swatches drawn in code; adding one also adds its pattern, as pasting art painted with it does
+swatch in the library panel does). The pattern libraries Geometric Patterns (`geometric-patterns`), Grit Textures
+(`grit-textures`: seamless black grain, grit, sand, speckle, stipple, scratch and fleck tiles) and Optical Effects
+(`optical-effects`: VectorCraft's own black wave, ring, warped-check, pinched-stripe, chevron and lens tiles),
+category `patterns`, hold pattern swatches drawn in code; adding one also adds its pattern, as pasting art painted with it does
(the same pattern the document has is reused, and a name another pattern or swatch has gets a number).
`swatch.resetDefaults {replace?}` brings back the missing default swatches.
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index b1ceaf70ea..e6bcb23301 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1294,7 +1294,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
Double-clicking the Objects on Path tool opens Objects on Path Tool Options ([Objects on Path](https://helpx.adobe.com/illustrator/using/objects-on-path.html)): the nine-point Pivot grid and the Rotate field set the attachment point and angle of the objects attached next, and groups already attached keep theirs; Reset puts the center and 0° back. Save keeps the options across tool switches and saves them with the preferences (`tool.setOption {tool: "objectsOnPath"}`).
- **Paint and appearance (M3):**
- **CSS swatch libraries:** fractional linear and radial gradient stop positions are preserved, so nearby stops such as 12.5% and 12.890625% remain distinct instead of collapsing to 13%. Reference: [CSS Images 3 color stops](https://www.w3.org/TR/css-images-3/#color-stop-syntax). The original synthetic regression is `palette_io::tests::css_preserves_fractional_gradient_stop_positions` in `crates/color/src/palette_io.rs`. Scores and hours are unchanged.
- - **Swatches:** names follow the colour model and are unique; Swatch Options (process/spot, Global, Gray/RGB/HSB/CMYK/Web, live preview); editing a global or spot swatch recolours every linked fill, stroke and text run in one undo step; multi-select and delete with confirmation; New Swatch and New Color Group dialogs (a group from the selected artwork's colours); swatches in colour groups convert, separate and count like any other. The Swatches panel selects ranges and whole groups, has a find field, and drags swatches to reorder, regroup or paint art; Add Used Colors, Select All Unused, Merge, Ungroup and Sort by Kind; a CMYK document keeps applied colours in CMYK. Swatch libraries: nine generated colour libraries, six gradient libraries (Organic Fades among them: soft, perceptually mixed multi-stop fades that thin out to transparent) and two pattern libraries (Geometric Patterns, and Grit Textures with eight seamless grain, speckle, stipple, scratch and fleck tiles; their swatches bring their patterns) in a library panel, saved as `.vcswatches`, `.gpl`, swatch exchange (`.ase`) or CSS, and loaded from `.vcswatches`, `.gpl` and `.ase` files (`.ase` both ways: RGB, CMYK, Lab and Gray; global, spot and process; groups) and from color books (`.acb`, read only: the RGB, CMYK or Lab colors of a book such as a Pantone book a user owns, named with its prefix and suffix, spot unless it says process, #831); `swatch.library.copyToUser` copies a loaded library into the User Defined folder without replacing a file, and a file with the same extension and bytes as a User Defined library opens as that library. Tints of global and spot colours ("Name 40%") stay linked and separate as a percentage of their plate. Spot colours can be defined in Lab (Spot Colors options). A built-in [Registration] swatch prints on every plate.
+ - **Swatches:** names follow the colour model and are unique; Swatch Options (process/spot, Global, Gray/RGB/HSB/CMYK/Web, live preview); editing a global or spot swatch recolours every linked fill, stroke and text run in one undo step; multi-select and delete with confirmation; New Swatch and New Color Group dialogs (a group from the selected artwork's colours); swatches in colour groups convert, separate and count like any other. The Swatches panel selects ranges and whole groups, has a find field, and drags swatches to reorder, regroup or paint art; Add Used Colors, Select All Unused, Merge, Ungroup and Sort by Kind; a CMYK document keeps applied colours in CMYK. Swatch libraries: nine generated colour libraries, six gradient libraries (Organic Fades among them: soft, perceptually mixed multi-stop fades that thin out to transparent) and three pattern libraries (Geometric Patterns; Grit Textures with eight seamless grain, speckle, stipple, scratch and fleck tiles; and Optical Effects with eight of VectorCraft's own seamless wave, ring, warped-check, stripe, chevron and lens tiles; their swatches bring their patterns) in a library panel, saved as `.vcswatches`, `.gpl`, swatch exchange (`.ase`) or CSS, and loaded from `.vcswatches`, `.gpl` and `.ase` files (`.ase` both ways: RGB, CMYK, Lab and Gray; global, spot and process; groups) and from color books (`.acb`, read only: the RGB, CMYK or Lab colors of a book such as a Pantone book a user owns, named with its prefix and suffix, spot unless it says process, #831); `swatch.library.copyToUser` copies a loaded library into the User Defined folder without replacing a file, and a file with the same extension and bytes as a User Defined library opens as that library. Tints of global and spot colours ("Name 40%") stay linked and separate as a percentage of their plate. Spot colours can be defined in Lab (Spot Colors options). A built-in [Registration] swatch prints on every plate.
Editing, renaming, deleting or merging a global swatch also changes the colors linked to it in graph designs, the art of brushes and the tile that pattern editing's Cancel puts back, in the same undo step as the rest of the art; Default Swatches with replace unlinks them there too.
Add Used Colors (`swatch.addUsedColors`) and Select All Unused (`swatch.unused`) look colors, swatch names, links, tints and gradients up in hash sets instead of searching every swatch and color for each color or linked paint (New Color Group from artwork too), and New Swatch with several colors (`swatch.new`), New Color Group (`swatch.newGroup`) and Edit Color Group (`swatch.editGroup`) name their new swatches from one set of the names already taken. The new swatches keep their names, order and links, and Select All Unused lists the same swatches. Evidence: `add_used_colors_adds_each_new_color_once_with_free_names`, `add_used_colors_global_links_every_paint_of_a_new_color`, `unused_matches_links_tints_colors_gradients_and_patterns_exactly`, `new_swatches_from_colors_are_numbered_after_names_already_taken`, `new_color_group_numbers_its_colors_after_the_group_and_its_moved_swatches`, `new_color_group_from_artwork_lists_each_color_once_with_free_names` and `edit_color_group_numbers_extra_colors_after_the_names_it_keeps` in `crates/engine/src/tests/swatchcmds.rs`; `free_swatch_names_match_naming_each_swatch_as_it_is_added` and `free_swatch_names_match_new_swatch_names_as_swatches_are_added` in `crates/doc/src/swatches.rs`.
- **Colorized images (#1466):** a fill color applied to a selected grayscale or 1-bit image (`paint.setFill`) colorizes it with black, white, a process color or a spot color, and refuses a process color when the image has an alpha channel ([Convert color modes](https://web.archive.org/web/20251220223850/https://helpx.adobe.com/illustrator/desktop/manage-colors/select-and-adjust-colors/convert-color-modes.html), "Colorize Grayscale or 1-bit images"); black and white are accepted there too. The canvas draws each pixel in the color as far as the pixel is dark, with white pixels transparent; PDF export writes the image in the color (a spot color as its ink, Registration in every ink) with the image as its soft mask; Separations Preview and printed separations show it on its color's plates; native files keep the color. SVG writes the fill color through a coverage mask (or a colorized PNG in Tiny 1.2); EPS writes binary coverage as an image mask in the color's ink, and a grayscale image as ink samples scaled by coverage, with white pixels left out at Level 3 and gray midtones written over white.
From 3c1e3cc1120f48dc0dcb8ea158f9067caf110ede Mon Sep 17 00:00:00 2001
From: dotCooCoo
Date: Thu, 12 Nov 2026 01:00:55 -0800
Subject: [PATCH 16/38] 3D: say that a clipped composite keeps the whole solid
in member order
With colored lights a surface can be one clipped composite of its facets. The comment above the plain check now states that every surface of such a solid, masked ones included, draws whole in member order.
---
crates/effects/src/solids.rs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/crates/effects/src/solids.rs b/crates/effects/src/solids.rs
index 4744202dd0..65bff78e7e 100644
--- a/crates/effects/src/solids.rs
+++ b/crates/effects/src/solids.rs
@@ -842,8 +842,9 @@ fn surfaces_for(n: &Node, fx: &Effect, shapes: &[Profile]) -> Option
Date: Thu, 12 Nov 2026 01:03:41 -0800
Subject: [PATCH 17/38] Read roots: links.findFiles and image.info follow the
configured read roots
With automation read roots in force, links.findFiles and text.findFontFiles
replies, including later polls and stops of a search another client started,
leave out the files found outside the caller's read roots, a sought link's
saved path outside them and the folder searched when it is outside them. A
failed search then gives its reason without the path. The rows keep their
names, ids and status, and the counts stay.
image.info gives link: null for a linked file outside the read roots, as
links.info does. text.addFontFiles gives folder: null when the Fonts folder
is outside the read roots and names the copies there by their file names;
the fonts are still copied.
Docs: docs/mcp.md, docs/target-app-parity.md.
---
crates/engine/src/cmd/findfiles/tests.rs | 12 ++-
crates/engine/src/cmd/findfiles/walk.rs | 66 ++++++++++---
crates/engine/src/cmd/fontfiles.rs | 28 ++++--
crates/engine/src/cmd/linkfiles.rs | 23 +++--
crates/engine/src/cmd/links.rs | 4 +-
crates/engine/src/cmd/place.rs | 6 +-
crates/engine/src/tests/fontfiles.rs | 37 ++++++++
crates/engine/src/tests/linkfiles.rs | 112 ++++++++++++++++++++++-
crates/engine/tests/font_folder.rs | 7 ++
docs/mcp.md | 8 ++
docs/target-app-parity.md | 1 +
11 files changed, 266 insertions(+), 38 deletions(-)
diff --git a/crates/engine/src/cmd/findfiles/tests.rs b/crates/engine/src/cmd/findfiles/tests.rs
index ec3ce57e3a..bf51ebdac7 100644
--- a/crates/engine/src/cmd/findfiles/tests.rs
+++ b/crates/engine/src/cmd/findfiles/tests.rs
@@ -183,6 +183,16 @@ fn a_picked_folder_inside_other_apps_folders_is_refused() {
assert!(p.error().is_some_and(|e| e.ends_with("is not a folder")), "{p:?}");
let p = search(&root, "missing", Limits::default(), 1, &[]);
assert!(p.error().is_some_and(|e| e.starts_with(&root.join("missing").display().to_string())), "{p:?}");
+ // Each failure has the same reason without the folder's path.
+ let briefs = [
+ ("missing", "the folder can't be read"),
+ ("file.ttf", "the path isn't a folder"),
+ ("refused", "VectorCraft doesn't search other apps' or the system's folders"),
+ ("Users/Public/x", "VectorCraft doesn't search the Shared or Public folder in Users"),
+ ];
+ for (picked, why) in briefs {
+ assert_eq!(search(&root, picked, Limits::default(), 1, &[]).failure(), Some(why), "{picked}");
+ }
}
#[test]
@@ -362,7 +372,7 @@ fn a_picked_folder_that_cant_be_listed_fails_the_search() {
let p = search(&root, "locked", Limits::default(), 2, &["y.ttf"]);
std::fs::set_permissions(&locked, std::fs::Permissions::from_mode(0o755)).unwrap();
if enforced {
- assert!(matches!(&p.end, Some(End::Failed(e)) if e.contains("locked")), "{p:?}");
+ assert!(matches!(&p.end, Some(End::Failed(e, "the folder can't be listed")) if e.contains("locked")), "{p:?}");
} else {
assert_eq!(found(&root, &p), ["locked/y.ttf"]);
}
diff --git a/crates/engine/src/cmd/findfiles/walk.rs b/crates/engine/src/cmd/findfiles/walk.rs
index 8d35515717..ae05a04838 100644
--- a/crates/engine/src/cmd/findfiles/walk.rs
+++ b/crates/engine/src/cmd/findfiles/walk.rs
@@ -23,6 +23,13 @@ const CHECK_EVERY: u64 = 1024;
/// How a search ends when every walker thread stopped on a bug.
const INTERNAL: &str = "every search thread stopped on an internal error (please report this bug)";
+/// Why a search couldn't start, without the folder's path ([`Progress::failure`]).
+const UNREADABLE: &str = "the folder can't be read";
+const NOT_A_FOLDER: &str = "the path isn't a folder";
+const SHARED: &str = "VectorCraft doesn't search the Shared or Public folder in Users";
+const APPS: &str = "VectorCraft doesn't search other apps' or the system's folders";
+const UNLISTED: &str = "the folder can't be listed";
+
/// What a search looks for.
pub trait Visitor: Send + Sync {
/// Whether the regular file named `name` is to be read: asked of the files a folder lists until
@@ -77,8 +84,9 @@ pub enum End {
/// reached their [`Limits`]. Folders deeper than [`Limits::depth`] are skipped and an item
/// keeps at most [`Limits::per_item`] files, without ending the search.
Limit,
- /// It couldn't start: the folder can't be read, isn't a folder or isn't one to search.
- Failed(String),
+ /// It couldn't start: the folder can't be read, isn't a folder or isn't one to search. Why,
+ /// and the same without the folder's path.
+ Failed(String, &'static str),
}
/// Where a search stands ([`Search::progress`]).
@@ -114,7 +122,7 @@ impl Progress {
None => "searching",
Some(End::Done | End::Found) => "done",
Some(End::Stopped | End::Time | End::Limit) => "stopped",
- Some(End::Failed(_)) => "failed",
+ Some(End::Failed(..)) => "failed",
}
}
@@ -131,10 +139,38 @@ impl Progress {
/// Why a failed search failed.
pub fn error(&self) -> Option<&str> {
match &self.end {
- Some(End::Failed(e)) => Some(e),
+ Some(End::Failed(e, _)) => Some(e),
_ => None,
}
}
+
+ /// Why a failed search failed, without the folder's path.
+ pub fn failure(&self) -> Option<&'static str> {
+ match &self.end {
+ Some(End::Failed(_, why)) => Some(why),
+ _ => None,
+ }
+ }
+
+ /// Keep what the caller asking now may read under its read roots ([`crate::file_access::current`]),
+ /// for a reply to it: the files found inside them. Returns the folder searched (`given` until a
+ /// walker checked it) and why the search failed, when that folder lies inside them too;
+ /// otherwise no folder and why without its path ([`Self::failure`]). Without read roots in
+ /// force, everything is kept.
+ pub fn keep_readable(&mut self, given: &str) -> (Option, Option) {
+ let folder = if self.folder.as_os_str().is_empty() { given.to_string() } else { self.folder.to_string_lossy().into_owned() };
+ if crate::file_access::current().is_none() {
+ return (Some(folder), self.error().map(str::to_string));
+ }
+ // A path that isn't valid text is never shown: its lossy form names another file.
+ let readable = |p: &Path| p.to_str().is_some_and(|p| crate::file_access::check_read(p).is_ok());
+ self.hits.retain(|(path, _)| readable(path));
+ if readable(Path::new(given)) && (self.folder.as_os_str().is_empty() || readable(&self.folder)) {
+ (Some(folder), self.error().map(str::to_string))
+ } else {
+ (None, self.failure().map(str::to_string))
+ }
+ }
}
/// Walker threads shared out among searches: all of them together run at most `cap` threads.
@@ -306,7 +342,7 @@ pub(crate) fn start_in(
return Err("the search couldn't start: try again in a moment".into());
}
if w.alive == 0 && w.end.is_none() {
- shared.finish(&mut w, End::Failed(INTERNAL.into()));
+ shared.finish(&mut w, End::Failed(INTERNAL.into(), INTERNAL));
}
}
Ok(Search { shared })
@@ -401,13 +437,13 @@ impl Shared {
fn prepare(&self, root: &Path) {
let rules = self.rules.get_or_init(|| self.given.clone().unwrap_or_else(Rules::system));
let path = root.display();
- let checked = match std::fs::canonicalize(root) {
- Err(e) => Err(format!("{path}: {e}")),
- Ok(folder) if !folder.is_dir() => Err(format!("{path} is not a folder")),
+ let (checked, brief) = match std::fs::canonicalize(root) {
+ Err(e) => (Err(format!("{path}: {e}")), UNREADABLE),
+ Ok(folder) if !folder.is_dir() => (Err(format!("{path} is not a folder")), NOT_A_FOLDER),
Ok(folder) => match rules.refusal(&folder) {
- None => Ok(folder),
- Some(Refusal::Shared) => Err(format!("VectorCraft doesn't search the Shared or Public folder in Users: {path}")),
- Some(Refusal::Apps) => Err(format!("VectorCraft doesn't search other apps' or the system's folders: {path}")),
+ None => (Ok(folder), INTERNAL),
+ Some(Refusal::Shared) => (Err(format!("VectorCraft doesn't search the Shared or Public folder in Users: {path}")), SHARED),
+ Some(Refusal::Apps) => (Err(format!("VectorCraft doesn't search other apps' or the system's folders: {path}")), APPS),
},
};
let mut w = self.lock();
@@ -416,7 +452,7 @@ impl Shared {
w.folder = folder.clone();
w.stack.push((folder, 0));
}
- Err(e) => self.finish(&mut w, End::Failed(e)),
+ Err(e) => self.finish(&mut w, End::Failed(e, brief)),
}
}
@@ -430,7 +466,7 @@ impl Shared {
let mut w = self.lock();
// The picked folder itself: the search can't run, and says why.
if depth == 0 {
- self.finish(&mut w, End::Failed(format!("{}: {e}", plain(dir.to_path_buf()).display())));
+ self.finish(&mut w, End::Failed(format!("{}: {e}", plain(dir.to_path_buf()).display()), UNLISTED));
} else {
w.unreadable += 1;
w.folders += 1;
@@ -610,7 +646,7 @@ fn walker(s: &Shared) {
if done.is_err() {
let mut w = s.lock();
match job {
- Job::Prepare(_) => s.finish(&mut w, End::Failed(INTERNAL.into())),
+ Job::Prepare(_) => s.finish(&mut w, End::Failed(INTERNAL.into(), INTERNAL)),
Job::List(..) => w.unreadable += 1,
}
}
@@ -640,7 +676,7 @@ impl Drop for Alive {
let mut w = self.0.lock();
w.alive = w.alive.saturating_sub(1);
if w.alive == 0 && w.end.is_none() {
- self.0.finish(&mut w, End::Failed(INTERNAL.into()));
+ self.0.finish(&mut w, End::Failed(INTERNAL.into(), INTERNAL));
}
drop(w);
self.0.pool.release(1);
diff --git a/crates/engine/src/cmd/fontfiles.rs b/crates/engine/src/cmd/fontfiles.rs
index 309347985c..0ccf1ab94a 100644
--- a/crates/engine/src/cmd/fontfiles.rs
+++ b/crates/engine/src/cmd/fontfiles.rs
@@ -76,7 +76,7 @@ pub fn specs() -> Vec {
"Find Font Files",
[],
None,
- "{folder?: an absolute path, fonts?: [{family, style?}] (1 to 1000; default: the active document's missing fonts, as text.missingFonts lists them), maxSeconds?: 60 (1 to 600), stop?: false (true: stop the last search)} with folder: look in it and its subfolders for font files that make the fonts available, on separate threads, and answer at once (state: searching); without folder: the last search's state, with the files found so far. A search reads the table directories and the name, fvar and OS/2 tables of .ttf, .otf, .ttc and .otc files of at most 256 MB and, on macOS, of suitcase fonts (files without an extension or with .suit, whose fonts are in a resource fork of at most 8 MB), and lists a file for a font when the file, added with text.addFontFiles, makes the font resolve exactly as text.fonts resolves it; fonts that resolve exactly already are left out. It doesn't enter app packages, folders named Program Files (also x86 and Arm), ProgramData, $Recycle.Bin or System Volume Information, the system's folders at the root of a volume, the Shared and Public folders in Users, a home folder's Library, AppData, Applications, snap and dot folders, a Library folder's app data folders or the folders the environment names for apps' data, and a search of a folder inside one of them fails; the walk also skips other hidden folders, folders whose contents are in the cloud and folders more than 64 levels deep, and follows no links (a picked path is resolved through its links); none on the web → {id (absent while idle), state: idle|searching|done|stopped|failed, folder?, fonts: [{family, style, status, files: [paths]}], searched?: {folders, files, fontFiles}, skipped?, unreadable?, stopped?: stop|time|limit, error?, seconds?}",
+ "{folder?: an absolute path, fonts?: [{family, style?}] (1 to 1000; default: the active document's missing fonts, as text.missingFonts lists them), maxSeconds?: 60 (1 to 600), stop?: false (true: stop the last search)} with folder: look in it and its subfolders for font files that make the fonts available, on separate threads, and answer at once (state: searching); without folder: the last search's state, with the files found so far. A search reads the table directories and the name, fvar and OS/2 tables of .ttf, .otf, .ttc and .otc files of at most 256 MB and, on macOS, of suitcase fonts (files without an extension or with .suit, whose fonts are in a resource fork of at most 8 MB), and lists a file for a font when the file, added with text.addFontFiles, makes the font resolve exactly as text.fonts resolves it; fonts that resolve exactly already are left out. It doesn't enter app packages, folders named Program Files (also x86 and Arm), ProgramData, $Recycle.Bin or System Volume Information, the system's folders at the root of a volume, the Shared and Public folders in Users, a home folder's Library, AppData, Applications, snap and dot folders, a Library folder's app data folders or the folders the environment names for apps' data, and a search of a folder inside one of them fails; the walk also skips other hidden folders, folders whose contents are in the cloud and folders more than 64 levels deep, and follows no links (a picked path is resolved through its links). With automation read roots, a reply leaves out the files found outside the caller's roots, and the folder when it is outside them (error then gives the reason without the path); none on the web → {id (absent while idle), state: idle|searching|done|stopped|failed, folder?, fonts: [{family, style, status, files: [paths]}], searched?: {folders, files, fontFiles}, skipped?, unreadable?, stopped?: stop|time|limit, error?, seconds?}",
always,
find
),
@@ -85,7 +85,7 @@ pub fn specs() -> Vec {
"Add Font Files",
[],
None,
- "{files: [paths the last text.findFontFiles search found] (1 to 1000)} copy the font files into VectorCraft's own Fonts folder (next to the preferences; the desktop app and vectorcraft-cli read it), never replacing a file there: the names Name.otf, Name 2.otf … Name 99.otf are tried in turn until one is free, which gets the copy, or is a file with the same contents, which is kept; then scan the fonts again, as text.rescanFonts does, and type set in them redraws. Only regular .ttf, .otf, .ttc, .otc, .woff and .woff2 files and suitcase fonts (with their resource fork) are copied, at most 256 MB a file and 1 GB in all; any other file is skipped. Add only fonts you own or are licensed to install; none on the web → {folder, copied: [{from, to}], kept: [{from, to}], skipped: [{file, reason}], families?, faces?}",
+ "{files: [paths the last text.findFontFiles search found] (1 to 1000)} copy the font files into VectorCraft's own Fonts folder (next to the preferences; the desktop app and vectorcraft-cli read it), never replacing a file there: the names Name.otf, Name 2.otf … Name 99.otf are tried in turn until one is free, which gets the copy, or is a file with the same contents, which is kept; then scan the fonts again, as text.rescanFonts does, and type set in them redraws. Only regular .ttf, .otf, .ttc, .otc, .woff and .woff2 files and suitcase fonts (with their resource fork) are copied, at most 256 MB a file and 1 GB in all; any other file is skipped. Add only fonts you own or are licensed to install. With automation read roots, folder is null when the Fonts folder is outside them, and a to or file path outside them is given as its file name; none on the web → {folder, copied: [{from, to}], kept: [{from, to}], skipped: [{file, reason}], families?, faces?}",
always,
add
),
@@ -275,7 +275,9 @@ fn find(s: &mut Session, p: &Value) -> Result {
/// Where the session's last search stands (`text.findFontFiles` without `folder`).
fn state(s: &Session) -> Value {
let Some(f) = &s.font_search else { return json!({ "state": "idle", "fonts": [] }) };
- let p = f.search.progress();
+ let mut p = f.search.progress();
+ // Only what the caller asking now may read: a search another caller started can hold more.
+ let (folder, error) = p.keep_readable(&f.folder);
let mut files: Vec> = vec![vec![]; f.fonts.len()];
for (path, items) in &p.hits {
for i in items {
@@ -293,16 +295,18 @@ fn state(s: &Session) -> Value {
json!({ "family": font.family, "style": font.style, "status": font.status.as_str(), "files": files })
})
.collect();
- let folder = if p.folder.as_os_str().is_empty() { f.folder.clone() } else { p.folder.to_string_lossy().into_owned() };
let mut out = json!({
- "id": f.id, "state": p.state(), "folder": folder, "fonts": fonts,
+ "id": f.id, "state": p.state(), "fonts": fonts,
"searched": { "folders": p.folders, "files": p.files, "fontFiles": p.read },
"skipped": p.skipped, "unreadable": p.unreadable, "seconds": (p.seconds * 10.0).round() / 10.0,
});
+ if let Some(folder) = folder {
+ out["folder"] = json!(folder);
+ }
if let Some(why) = p.stopped() {
out["stopped"] = json!(why);
}
- if let Some(e) = p.error() {
+ if let Some(e) = error {
out["error"] = json!(e);
}
out
@@ -348,12 +352,16 @@ fn add(s: &mut Session, p: &Value) -> Result {
// VectorCraft's own Fonts folder: no automation root applies to it.
crate::file_access::unconfined(|| super::fileio::create_dir(&dir.to_string_lossy()))?;
let report = copy_into(&files, dir);
- let pairs = |v: &[(PathBuf, PathBuf)]| {
- v.iter().map(|(from, to)| json!({ "from": from.to_string_lossy(), "to": to.to_string_lossy() })).collect::