Merge remote-tracking branch 'upstream/main' into fix/all-tools-panel-text-dim-8294

# Conflicts:
#	docs/target-app-parity.md
This commit is contained in:
jayzed80 committed 2026-11-19 06:13:14 +00:00
commit 744b54ee76
12 files changed
+606 -43

No files matched your search

+15
View File
@@ -81,6 +81,21 @@ impl Unit {
Unit::Ha => "H",
}
}
/// Whether this unit is a physical measurement unit (not points or pixels).
pub fn is_physical(self) -> bool {
self.svg_suffix().is_some() || matches!(self, Unit::FeetInches | Unit::Meters | Unit::Yards | Unit::Feet | Unit::Q | Unit::Ha)
}
/// The standard SVG length unit suffix, if this unit is a physical unit supported in SVG
/// (`mm`, `cm`, `in`, `pc`).
pub fn svg_suffix(self) -> Option<&'static str> {
match self {
Unit::Millimeters => Some("mm"),
Unit::Centimeters => Some("cm"),
Unit::Inches => Some("in"),
Unit::Picas => Some("pc"),
_ => None,
}
}
pub const fn label(self) -> &'static str {
match self {
Unit::Points => "Points",
+45
View File
@@ -437,3 +437,48 @@ fn svg_darkness_uses_rendered_shadow_in_non_srgb_working_space() {
assert!(a.iter().zip(b).all(|(a, b)| a.abs_diff(b) <= 8), "at {x}: {a:?} vs {b:?}");
}
}
/// #864 / G11: SVG export preserves the document's physical units on the root `width`/`height` so
/// that the unit setting survives a save/open round-trip. The engine-level test covers the full
/// stack (file.new → document.setUnits → document.serialize → document.open).
#[test]
fn svg_round_trip_preserves_document_units() {
// (unit name the engine accepts, expected unit after re-import)
let cases: &[(&str, vectorcraft_doc::Unit)] = &[
("millimeters", vectorcraft_doc::Unit::Millimeters),
("centimeters", vectorcraft_doc::Unit::Centimeters),
("inches", vectorcraft_doc::Unit::Inches),
("picas", vectorcraft_doc::Unit::Picas),
// Points and pixels both serialise as bare user-unit numbers, so both import as Pixels.
("pixels", vectorcraft_doc::Unit::Pixels),
];
for (name, expected) in cases {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 200, "height": 100, "artboards": 1})).unwrap();
s.execute("document.setUnits", &json!({"units": name})).unwrap();
let r = s.execute("document.serialize", &json!({"format": "svg"})).unwrap();
let svg_text = r["text"].as_str().unwrap();
match *expected {
vectorcraft_doc::Unit::Millimeters => assert!(svg_text.contains("mm\""), "mm suffix missing: {svg_text}"),
vectorcraft_doc::Unit::Centimeters => assert!(svg_text.contains("cm\""), "cm suffix missing: {svg_text}"),
vectorcraft_doc::Unit::Inches => assert!(svg_text.contains("in\""), "in suffix missing: {svg_text}"),
vectorcraft_doc::Unit::Picas => assert!(svg_text.contains("pc\""), "pc suffix missing: {svg_text}"),
_ => {}
}
let b64 = vectorcraft_format::base64_encode(svg_text.as_bytes());
s.execute("document.open", &json!({"name": "test.svg", "dataBase64": b64})).unwrap();
let doc_state = s.doc().unwrap();
assert_eq!(doc_state.doc.units, *expected, "unit mismatch after round-trip for '{name}'");
}
// Points serialise without suffix and re-open as Pixels (equivalent in user units).
let mut s = Session::new();
s.execute("file.new", &json!({"width": 200, "height": 100, "artboards": 1})).unwrap();
s.execute("document.setUnits", &json!({"units": "points"})).unwrap();
let r = s.execute("document.serialize", &json!({"format": "svg"})).unwrap();
let svg_text = r["text"].as_str().unwrap();
assert!(svg_text.contains("width=\"200\" height=\"100\""), "{svg_text}");
let b64 = vectorcraft_format::base64_encode(svg_text.as_bytes());
s.execute("document.open", &json!({"name": "test.svg", "dataBase64": b64})).unwrap();
assert_eq!(s.doc().unwrap().doc.units, vectorcraft_doc::Unit::Pixels);
}
+27 -1
View File
@@ -1189,6 +1189,12 @@ impl Story {
self.text.len()
}
/// Is frame `frame` of the story point type with nothing but spaces and line ends (its last
/// `\r` left out), which [`Self::node`] doesn't make: it draws nothing.
pub(super) fn blank_point(&self, frame: usize) -> bool {
frame == 0 && matches!(self.frames.first(), Some(FrameKind::Point(_))) && self.is_blank()
}
/// The point frame's matrix (the first frame's, when it is one), else the identity.
fn matrix(&self) -> [f64; 6] {
match self.frames.first() {
@@ -1260,6 +1266,24 @@ impl Story {
/// document), or `None` for type that is mirrored, has no size, or a frame past the first of
/// threaded type (the first frame holds the whole story).
pub(super) fn node(&self, id: NodeId, frame: usize, template: (f64, f64), to_doc: Affine) -> Option<Node> {
self.made_node(id, frame, template, to_doc, false)
}
/// For a blank story (nothing but spaces and line ends) in an area frame or on a path, an empty
/// text object with that frame or path, as [`Self::node`] would make it, as VectorCraft's Type
/// tool keeps such an empty frame (#85, #154). Its text is the story's, spaces kept. `None` for
/// any other story or frame.
pub(super) fn blank_frame_node(&self, id: NodeId, frame: usize, template: (f64, f64), to_doc: Affine) -> Option<Node> {
self.is_blank().then(|| self.made_node(id, frame, template, to_doc, true)).flatten()
}
/// Is the story's text nothing but spaces and line ends (`\r`, and `\x03`, a line break)?
pub(super) fn is_blank(&self) -> bool {
self.text.chars().all(|c| c.is_whitespace() || c == '\x03')
}
/// [`Self::node`]; with `blank_frame`, a blank story in an area frame or on a path is made too.
fn made_node(&self, id: NodeId, frame: usize, template: (f64, f64), to_doc: Affine, blank_frame: bool) -> Option<Node> {
let kind = self.frames.get(frame)?;
let threaded = frame > 0;
let (scale, xf, kind) = match kind {
@@ -1301,7 +1325,9 @@ impl Story {
})
.collect()
};
if text.trim().is_empty() && !threaded {
// A blank story isn't made here: the page may still have type for its object. What is left
// of one, an area frame or a path, is made by [`Self::blank_frame_node`].
if text.trim().is_empty() && !threaded && !(blank_frame && !matches!(kind, TextKind::Point)) {
return None;
}
// The text document measures in the art's units too: the document's scale carries its
+102 -11
View File
@@ -531,12 +531,12 @@ pub(super) fn build_weighing(
clip_by_type(&mut layers, &type_clips, &filled);
doc.layers = layers;
made.sort();
let threaded_frames: BTreeSet<NodeId> =
made.chunk_by(|a, b| a.0 == b.0).filter(|thread| thread.len() > 1).flatten().map(|(_, _, id)| *id).collect();
let threads = threads_of(&made);
let threaded_frames: BTreeSet<NodeId> = threads.iter().flat_map(|(_, ids)| ids.iter().copied()).collect();
if !unread.is_empty() {
let Some(frame) = frame.as_ref() else { return Err(unread_error(&unread)) };
let mut copied = BTreeSet::new();
let kinds = replace_unread(&mut doc, frame, &unread, &unread_elsewhere, &threaded_frames, &mut copied)?;
let kinds = replace_unread(&mut doc, frame, &unread, &unread_elsewhere, &held_frames(&infos, &stories, &threads), &mut copied)?;
// With the text objects filled, the page art chosen can differ from the first try's: the
// page's type set aside for it, and no other, must be in it.
let all_copied = |o: &Vec<Arc<Node>>| !o.is_empty() && o.iter().all(|n| copied.contains(&n.id));
@@ -545,12 +545,8 @@ pub(super) fn build_weighing(
}
notes.push(format!("{}: they came in as the page's art", kinds.join(", ")));
}
// A story in several frames is threaded type: its frames in order (the first holds the story).
for thread in made.chunk_by(|a, b| a.0 == b.0) {
if thread.len() > 1 {
doc.text_threads.push(thread.iter().map(|(_, _, id)| *id).collect());
}
}
// The frames still threaded: a blank story's frame an unread object left alone isn't.
let threaded_frames = add_threads(&mut doc, threads, &threaded_frames, !unread.is_empty());
// Area type flows around the wrap objects above it before it is compared with the page.
resolve_text_wrap(&mut doc)?;
let bound_text = bound_slots(&doc, &bindings, &xml_ids, VariableKind::Text);
@@ -1485,7 +1481,9 @@ fn slot_content(
) -> Result<(Vec<Content>, bool), String> {
let made = make_slots(infos, stories, template, to_doc, notes);
if let Some(own) = own.filter(|_| readable_all(infos, &made)) {
return Ok((made_only(infos, made, [own, pages[1]], notes), true));
let mut content = made_only(infos, stories, made, [own, pages[1]], notes);
settle_blank_stories(infos, stories, template, to_doc, &mut content, notes);
return Ok((content, true));
}
// The page's type is matched with every text object whose type isn't made, and weighed against
// where every made one draws: that has its limits (the slots of type that looks draw are within
@@ -1494,7 +1492,100 @@ fn slot_content(
if open > MAX_SLOTS || infos.len().saturating_mul(pages[0].len()) > MAX_PAIRS {
return Err("it has too many text objects".into());
}
Ok((plan(infos, stories, made, template, to_doc, pages, notes), false))
let mut content = plan(infos, stories, made, template, to_doc, pages, notes);
settle_blank_stories(infos, stories, template, to_doc, &mut content, notes);
Ok((content, false))
}
/// The threads of the text objects `made` (story, frame and id of each, sorted): each story in
/// several frames, with its frames in order (the first holds the story).
fn threads_of(made: &[(u32, usize, NodeId)]) -> Vec<(u32, Vec<NodeId>)> {
made.chunk_by(|a, b| a.0 == b.0)
.filter(|thread| thread.len() > 1)
.map(|thread| (thread[0].0, thread.iter().map(|(_, _, id)| *id).collect()))
.collect()
}
/// The frames of `threads` that an unread object can't take with it: those of a blank story's thread
/// hold no type, so they may go.
fn held_frames(infos: &[SlotInfo], stories: &[Option<Arc<Story>>], threads: &[(u32, Vec<NodeId>)]) -> BTreeSet<NodeId> {
let blank: BTreeSet<u32> =
infos.iter().zip(stories).filter(|(_, s)| s.as_ref().is_some_and(|s| s.is_blank())).filter_map(|(i, _)| i.story).collect();
threads.iter().filter(|(story, _)| !blank.contains(story)).flat_map(|(_, ids)| ids.iter().copied()).collect()
}
/// `threads` as `doc`'s text threads, and the frames of the threads added. With `replaced` (unread
/// objects were replaced by page art), the frames they took with them (`frames` that `doc` no longer
/// has, only a blank story's) are left out, and so is a thread left with one frame.
fn add_threads(doc: &mut Document, threads: Vec<(u32, Vec<NodeId>)>, frames: &BTreeSet<NodeId>, replaced: bool) -> BTreeSet<NodeId> {
let present = replaced.then(|| doc.index_paths(frames.iter().copied()));
let mut threaded = BTreeSet::new();
for (_, mut ids) in threads {
if let Some(present) = &present {
ids.retain(|id| present.contains_key(id));
}
if ids.len() > 1 {
threaded.extend(ids.iter().copied());
doc.text_threads.push(ids);
}
}
threaded
}
/// The slots of blank stories (nothing but spaces and line ends) that neither the text document nor
/// the page fills: blank point type draws nothing and has nothing to keep, so it is left out without
/// a note, as VectorCraft's Type tool discards empty point type (#85, #154); blank area type and
/// type on a path come in as an empty text object with their frame or path, as the Type tool keeps
/// such an empty frame, also where the page's type went to another text object (`Merged`). An empty
/// frame draws nothing, so the page can't show it: it is kept without being weighed against the
/// page (`prune_unseen` would take it out), and so are the later frames of its thread, which the
/// text document makes empty. Type that a look draws is left as it is.
fn settle_blank_stories(
infos: &[SlotInfo],
stories: &[Option<Arc<Story>>],
template: Option<(f64, f64)>,
to_doc: Affine,
content: &mut [Content],
notes: &mut Vec<String>,
) {
// The stories whose first frame came in as an empty frame: their later frames stay with it.
let mut kept = BTreeSet::new();
for ((story, info), c) in stories.iter().zip(infos).zip(content.iter_mut()) {
let Some(story) = story.as_ref().filter(|s| s.is_blank() && info.look.is_none()) else { continue };
let unfilled = match c {
Content::Empty => true,
Content::Page(parts) => parts.is_empty(),
_ => false,
};
if story.blank_point(info.frame) {
if unfilled {
*c = Content::Merged;
}
} else if (unfilled || matches!(c, Content::Merged))
&& let Some((node, region)) = template.and_then(|t| super::plan::blank_frame(info, story, t, to_doc))
{
*c = Content::Made(node, region.filter(|_| info.shown), true);
kept.extend(info.story);
// Its paragraphs' settings are read as made type's are, with the same notes.
for (left_out, note) in [
(story.tabs_left_out(), crate::import::ate::TABS_LEFT_OUT),
(story.kinsoku_sets_left_out(), crate::import::ate::KINSOKU_SETS_LEFT_OUT),
] {
if left_out && !notes.iter().any(|n| n == note) {
notes.push(note.into());
}
}
}
}
for (info, c) in infos.iter().zip(content.iter_mut()) {
if let Content::Made(_, _, seen) = c
&& info.frame > 0
&& info.look.is_none()
&& info.story.is_some_and(|s| kept.contains(&s))
{
*seen = true;
}
}
}
/// The layers `doc` don't draw as the page (`why`), `unseen` text objects of them taken out: the
+52 -18
View File
@@ -66,17 +66,10 @@ pub(super) fn make_slots(
.map(|(k, info)| {
let t = template?;
let story = stories.get(k)?.as_ref()?;
let mut node = story.node(NodeId(0), info.frame, t, to_doc)?;
let node = story.node(NodeId(0), info.frame, t, to_doc)?;
tabs_left_out |= story.tabs_left_out();
kinsoku_left_out |= story.kinsoku_sets_left_out();
let mut region = story.region(t, to_doc);
// The first line where the file has it, in the text document's frame (that of a
// copied object is its original's, as its lines are).
story.place_first_line(&mut node, info.frame, t, to_doc);
// Area type and type on a path in the object's own frame: the text document's frame
// of a copied object keeps its original's path.
frame_text_from_art(info, &mut node, &mut region);
story.flip_on_path(&mut node, info.frame);
let (mut node, region) = placed(info, story, node, t, to_doc);
if let NodeKind::Text(text) = &mut node.kind
&& story.fit_first_line(text)
{
@@ -109,6 +102,28 @@ pub(super) fn make_slots(
made
}
/// The empty text object a slot of a blank story in an area frame or on a path comes in as, placed
/// as [`make_slots`] places made type: its frame or path, the object's own where it has one
/// ([`Story::blank_frame_node`]). `None` for any other slot.
pub(super) fn blank_frame(info: &SlotInfo, story: &Story, template: (f64, f64), to_doc: Affine) -> Option<Made> {
let node = story.blank_frame_node(NodeId(0), info.frame, template, to_doc)?;
let (node, region) = placed(info, story, node, template, to_doc);
Some((Box::new(node), region))
}
/// `node`, made from `story` for slot `info`, placed where the file has it, with the region it
/// draws in: the first line where the file has it, in the text document's frame (that of a copied
/// object is its original's, as its lines are); area type and type on a path in the object's own
/// frame (the text document's frame of a copied object keeps its original's path); type on a path
/// flipped as its frame keeps it.
fn placed(info: &SlotInfo, story: &Story, mut node: Node, template: (f64, f64), to_doc: Affine) -> (Node, Option<Rect>) {
let mut region = story.region(template, to_doc);
story.place_first_line(&mut node, info.frame, template, to_doc);
frame_text_from_art(info, &mut node, &mut region);
story.flip_on_path(&mut node, info.frame);
(node, region)
}
/// Does the file's text document make the type of every slot that shows (at least one does)? Type
/// that a look draws doesn't count: only the page has it.
pub(super) fn readable_all(infos: &[SlotInfo], made: &[Option<Made>]) -> bool {
@@ -122,7 +137,13 @@ pub(super) fn readable_all(infos: &[SlotInfo], made: &[Option<Made>]) -> bool {
/// that no made type takes, shown or not, is left out with a note in `warn`. Slots that don't show
/// and whose type isn't made take the page's type that doesn't show (`pages`: the page's text
/// objects that show and that don't), by painting order.
pub(super) fn made_only(infos: &[SlotInfo], made: Vec<Option<Made>>, pages: [&[Vec<Arc<Node>>]; 2], warn: &mut Vec<String>) -> Vec<Content> {
pub(super) fn made_only(
infos: &[SlotInfo],
stories: &[Option<Arc<Story>>],
made: Vec<Option<Made>>,
pages: [&[Vec<Arc<Node>>]; 2],
warn: &mut Vec<String>,
) -> Vec<Content> {
let [shown, hidden] = pages;
let mut content = made_content(infos, made);
// The page's type where no made type draws, in the copies that looks draw, is theirs (past
@@ -154,7 +175,7 @@ pub(super) fn made_only(infos: &[SlotInfo], made: Vec<Option<Made>>, pages: [&[V
None => warn.push(PAGE_TYPE_UNCHECKED.into()),
}
drop_look_slots(infos, &mut content);
fill_hidden(infos, &mut content, hidden);
fill_hidden(infos, stories, &mut content, hidden);
content
}
@@ -421,8 +442,10 @@ pub(super) fn plan(
}
fill_look_slots(infos, &mut content, &mut spare);
// What is left of the page goes by painting order into the shown slots the file can't say.
let loose: Vec<usize> =
infos.iter().enumerate().filter(|(k, i)| i.shown && matches!(content.get(*k), Some(Content::Empty))).map(|(k, _)| k).collect();
let loose = readable_first(
stories,
infos.iter().enumerate().filter(|(k, i)| i.shown && matches!(content.get(*k), Some(Content::Empty))).map(|(k, _)| k).collect(),
);
if loose.is_empty() {
// Type of the page that no text object says it owns goes with the nearest text object that has
// type of the page (never into made type); with none, it is left out.
@@ -466,17 +489,28 @@ pub(super) fn plan(
warn.push("the text is on the layers in the order the page paints it, so a text object may be in another group than it was".into());
}
}
fill_hidden(infos, &mut content, hidden);
fill_hidden(infos, stories, &mut content, hidden);
content
}
/// The slots `open` that are to take the page's type left over, by painting order: those of blank
/// stories (nothing but spaces and line ends) only when no other slot is open, as such a story has
/// no type of its own; the blank ones left out come in empty or not at all (see
/// `settle_blank_stories`).
fn readable_first(stories: &[Option<Arc<Story>>], open: Vec<usize>) -> Vec<usize> {
let blank = |k: &usize| stories.get(*k).and_then(Option::as_ref).is_some_and(|s| s.is_blank());
if open.iter().all(blank) { open } else { open.into_iter().filter(|k| !blank(k)).collect() }
}
/// The page's type that doesn't show (`hidden`) goes by painting order into the slots that don't
/// show and have nothing yet, but for what is the type of made type that doesn't show: a page object
/// show and have nothing yet ([`readable_first`]), but for what is the type of made type that doesn't show: a page object
/// with words and at least half of it where such type draws, while the type has all its words left
/// (each word an object takes is the type's no longer). Past `MAX_PAIRS` comparisons all of it goes.
fn fill_hidden(infos: &[SlotInfo], content: &mut [Content], hidden: &[Vec<Arc<Node>>]) {
let unread: Vec<usize> =
infos.iter().enumerate().filter(|(k, i)| !i.shown && matches!(content.get(*k), Some(Content::Empty))).map(|(k, _)| k).collect();
fn fill_hidden(infos: &[SlotInfo], stories: &[Option<Arc<Story>>], content: &mut [Content], hidden: &[Vec<Arc<Node>>]) {
let unread = readable_first(
stories,
infos.iter().enumerate().filter(|(k, i)| !i.shown && matches!(content.get(*k), Some(Content::Empty))).map(|(k, _)| k).collect(),
);
if unread.is_empty() {
return;
}
+3 -2
View File
@@ -2,7 +2,7 @@ use super::build::MADE;
use super::{AppearanceItem, Arc, BTreeSet, BlendMode, Document, Node, NodeId, NodeKind, PathData, Point, Rect, ai, slot_of};
/// The notes that say the import left out something the file has (see [`is_loss`]).
pub(super) const TEXT_LEFT_OUT: &str = "text objects on hidden layers or hidden objects couldn't be read, so they are left out";
pub(super) const TEXT_LEFT_OUT: &str = "text objects whose type couldn't be read from the file's text document or its page are left out";
/// The same for a file without a page to take shown type from.
pub(super) const TYPE_LEFT_OUT: &str = "text objects of kinds VectorCraft doesn't read from the file's text document yet are left out";
@@ -230,7 +230,8 @@ pub(super) enum Content {
/// Text objects (with the strokes round them) of the page.
Page(Vec<Arc<Node>>),
/// A text object made from the file's text document, where it draws on the document (when it
/// shows), and whether the page has type where it is.
/// shows), and whether it is kept without being weighed against the page: the page has type
/// where it is, or it draws nothing (an empty frame of a blank story).
Made(Box<Node>, Option<Rect>, bool),
/// Nothing the file lets this read.
Empty,
+269 -1
View File
@@ -3830,7 +3830,7 @@ fn type_with_a_frame_it_cant_read_is_left_out_with_a_note() {
let art = native_with_text(&(layer("Back", true, &square(10, 10)) + &layer("Spare", false, &text_object(0))), &doc);
let r = import(&eps(&page_square(10, 10), &art)).unwrap();
assert!(text_of(&r.document.layers[1]).is_empty());
assert!(r.warnings.iter().any(|w| w.contains("1 text objects on hidden layers")), "{:?}", r.warnings);
assert!(r.warnings.iter().any(|w| w.contains("1 text objects whose type couldn't be read")), "{:?}", r.warnings);
assert!(crate::is_loss(r.warnings.iter().find(|w| w.contains("couldn't be read")).unwrap()));
}
@@ -5030,6 +5030,274 @@ fn area_type_keeps_its_area_type_options() {
assert_eq!(texts[2].area, vectorcraft_doc::AreaOptions::default());
}
/// A blank story in an area frame, hidden or shown, comes in as a text object that keeps its frame
/// and draws nothing (its spaces kept), as VectorCraft's Type tool keeps an empty frame (#85, #154).
/// As point type, hidden or shown, it draws nothing and has nothing to keep: it is left out, without
/// a note that something wasn't read.
#[test]
fn blank_stories_keep_their_area_frame_and_leave_point_type_out_quietly() {
let frames = [area_frame(10.0, 50.0, 90.0, 90.0), point_frame(20.0, 20.0), point_frame(30.0, 30.0), area_frame(60.0, 10.0, 90.0, 40.0)];
let stories = [
story("\\r", &[0], "/0 0", "/1 6.0"),
story("\\r", &[1], "/0 0", "/1 6.0"),
story(" \\r", &[2], "/0 0", "/1 6.0"),
story(" \\r", &[3], "/0 0", "/1 6.0"),
];
let doc = document_of(&frames, &stories);
// A shown blank area frame too: it draws nothing, so the page can't show it, and it stays.
let shown = square(10, 10) + &text_object(2) + &text_object(3);
let art = native_with_text(&(layer("Back", true, &shown) + &layer("Spare", false, &(text_object(0) + &text_object(1)))), &doc);
let r = import(&eps(&page_square(10, 10), &art)).unwrap();
let texts = text_of(&r.document.layers[1]);
assert_eq!(texts.len(), 1, "{:?}", r.warnings);
assert_eq!(texts[0].plain_text(), "");
let vectorcraft_doc::TextKind::Area { frame } = &texts[0].kind else { panic!("area type: {:?}", texts[0].kind) };
// Art y 50..90 is 10..50 down the 100 pt page.
let b = frame.bounds().unwrap();
assert!((b.x0 - 10.0).abs() < 1e-6 && (b.y0 - 10.0).abs() < 1e-6 && (b.x1 - 90.0).abs() < 1e-6 && (b.y1 - 50.0).abs() < 1e-6, "{b:?}");
let shown = text_of(&r.document.layers[0]);
assert_eq!(shown.len(), 1, "{:?}", r.warnings);
assert_eq!(shown[0].plain_text(), " ");
let vectorcraft_doc::TextKind::Area { frame } = &shown[0].kind else { panic!("area type: {:?}", shown[0].kind) };
// Art y 10..40 is 60..90 down the page.
let b = frame.bounds().unwrap();
assert!((b.x0 - 60.0).abs() < 1e-6 && (b.y0 - 60.0).abs() < 1e-6 && (b.x1 - 90.0).abs() < 1e-6 && (b.y1 - 90.0).abs() < 1e-6, "{b:?}");
assert!(!r.warnings.iter().any(|w| w.contains("couldn't be read")), "{:?}", r.warnings);
}
/// A blank story whose object the page still draws type for takes the page's type, as before: the
/// empty frame is only for a slot nothing else fills.
#[test]
fn a_blank_area_story_the_page_draws_type_for_takes_the_pages_type() {
let doc = document_of(&[area_frame(10.0, 50.0, 90.0, 90.0)], &[story("\\r", &[0], "/0 0", "/1 6.0")]);
let art = native_with_text(&layer("Art", true, &text_object(0)), &doc);
let page = "0 0 0 1 setcmykcolor /Helvetica findfont 14 scalefont setfont 20 75 moveto (Hi there) show";
let r = import(&eps(page, &art)).unwrap();
let mut all = vec![];
r.document.walk(|n| {
if let NodeKind::Text(t) = &n.kind {
all.push(t.plain_text());
}
});
assert_eq!(all, ["Hi there".to_string()], "{:?}", r.warnings);
}
/// The text objects of `d`: each one's text and kind, in the layers' order.
fn text_kinds(d: &Document) -> Vec<(String, &'static str)> {
let mut out = vec![];
d.walk(|n| {
if let NodeKind::Text(t) = &n.kind {
let kind = match t.kind {
vectorcraft_doc::TextKind::Area { .. } => "area",
vectorcraft_doc::TextKind::OnPath { .. } => "path",
_ => "point",
};
out.push((t.plain_text(), kind));
}
});
out
}
/// A blank story threaded through two shown area frames comes in as both frames, empty and still
/// one thread: the later frame the text document makes empty stays with the first.
#[test]
fn a_blank_story_threaded_through_two_shown_frames_keeps_both() {
let frames = [area_frame(10.0, 60.0, 40.0, 80.0), area_frame(50.0, 60.0, 80.0, 80.0)];
let doc = document_of(&frames, &[story("\\r", &[0, 1], "/0 0", "/1 10.0")]);
let art = native_with_text(&layer("Art", true, &(square(10, 10) + &frame_object(0, 0) + &frame_object(0, 1))), &doc);
let r = import(&eps(&page_square(10, 10), &art)).unwrap();
// The thread names only text objects the document has.
assert!(r.document.text_threads.iter().flatten().all(|id| r.document.node(*id).is_some()), "{:?} {:?}", r.document.text_threads, r.warnings);
assert_eq!(text_kinds(&r.document), [("".to_string(), "area"), ("".to_string(), "area")], "{:?}", r.warnings);
let ids: Vec<_> = r.document.layers[0].children().unwrap().iter().filter(|n| matches!(n.kind, NodeKind::Text(_))).map(|n| n.id).collect();
assert_eq!(r.document.text_threads, [ids]);
}
/// A blank story threaded from a hidden frame into a shown one: both frames come in, one thread.
#[test]
fn a_blank_story_threaded_from_a_hidden_frame_into_a_shown_one_keeps_both() {
let frames = [area_frame(10.0, 60.0, 40.0, 80.0), area_frame(50.0, 60.0, 80.0, 80.0)];
let doc = document_of(&frames, &[story("\\r", &[0, 1], "/0 0", "/1 10.0")]);
let art = native_with_text(&(layer("Back", true, &(square(10, 10) + &frame_object(0, 1))) + &layer("Spare", false, &frame_object(0, 0))), &doc);
let r = import(&eps(&page_square(10, 10), &art)).unwrap();
assert!(r.document.text_threads.iter().flatten().all(|id| r.document.node(*id).is_some()), "{:?} {:?}", r.document.text_threads, r.warnings);
assert_eq!(text_kinds(&r.document), [("".to_string(), "area"), ("".to_string(), "area")], "{:?}", r.warnings);
assert_eq!(r.document.text_threads.len(), 1, "{:?}", r.warnings);
assert_eq!(r.document.text_threads[0].len(), 2, "{:?}", r.warnings);
}
/// An unread group holding a frame of a blank story's thread is replaced by its page art as for
/// any other text object (the frame holds no type): the layers are read, and the thread, left with
/// one frame, isn't one any more.
#[test]
fn unread_group_holding_a_blank_threaded_frame_is_replaced() {
let frames = [
format!("<< /0 << /0 [ 0 0 ] /1 << /0 [ {} ] >> /2 << /0 1 >> >> >>", canvas_rect(50.0, 10.0, 54.0, 14.0)),
format!("<< /0 << /0 [ 0 0 ] /1 << /0 [ {} ] >> /2 << /0 1 >> >> >>", canvas_rect(70.0, 10.0, 74.0, 14.0)),
];
let text = document_of(&frames, &[story("\\r", &[0, 1], "/0 0", "/1 10.0")]);
for removed in [0, 1] {
let grouped = os1_group(&format!("{}\n{}\nZZ", square(if removed == 0 { 50 } else { 70 }, 10), frame_object(0, removed)));
let other = frame_object(0, 1 - removed);
let art = native_with_text(&(layer("Back", true, &square(10, 10)) + &layer("Mixed", true, &format!("{grouped}\n{other}"))), &text);
let (doc, notes, read) = crate::layered_ai(&private(&art), pdf_three_squares(), vec![], false, true, 1.0);
assert!(read, "removed frame {removed}: {notes:?}");
assert!(doc.text_threads.is_empty(), "removed frame {removed}: {:?} {notes:?}", doc.text_threads);
assert_eq!(text_kinds(&doc), [("".to_string(), "area")], "removed frame {removed}: {notes:?}");
}
}
/// A blank story on a path comes in as empty type on that path.
#[test]
fn a_blank_story_on_a_path_keeps_its_path() {
let (a, b, c) = (canvas(10.0, 70.0), canvas(30.0, 70.0), canvas(50.0, 70.0));
let path = format!(
"<< /0 << /0 [ 0 0 ] /1 << /0 [ {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} ] >> /2 << /0 2 /6 [ 0.5 2.0 ] >> >> >>",
a.0, a.1, a.0, a.1, b.0, b.1, b.0, b.1, b.0, b.1, b.0, b.1, c.0, c.1, c.0, c.1
);
let doc = document_of(&[path], &[story("\\r", &[0], "/0 0", "/1 8.0")]);
let art = native_with_text(&layer("Art", true, &(square(10, 10) + &text_object(0))), &doc);
let r = import(&eps(&page_square(10, 10), &art)).unwrap();
assert_eq!(text_kinds(&r.document), [("".to_string(), "path")], "{:?}", r.warnings);
let mut on_path = vec![];
r.document.walk(|n| {
if let NodeKind::Text(t) = &n.kind
&& let vectorcraft_doc::TextKind::OnPath { path, start, end } = &t.kind
{
on_path.push((path.bounds(), *start, *end));
}
});
// The path as `area_type_and_type_on_a_path_come_from_the_text_document` reads it: 40 pt long,
// the type from a quarter of the way along.
let [(Some(b), start, end)] = on_path.as_slice() else { panic!("{on_path:?}") };
assert!((b.width() - 40.0).abs() < 1e-6 && (start - 0.25).abs() < 1e-3 && end.is_none(), "{b:?} {start} {end:?}");
}
/// Where every shown text object's type comes from the text document (the page isn't matched with
/// them), a hidden blank area story still comes in as its empty frame, and blank point type is left
/// out without a note.
#[test]
fn blank_stories_beside_type_the_text_document_makes() {
let frames = [point_frame(20.0, 20.0), area_frame(10.0, 50.0, 90.0, 90.0), point_frame(30.0, 30.0)];
let stories = [story("Hi there\\r", &[0], "/0 0", "/1 6.0"), story("\\r", &[1], "/0 0", "/1 6.0"), story("\\r", &[2], "/0 0", "/1 6.0")];
let doc = document_of(&frames, &stories);
let art = native_with_text(
&(layer("Back", true, &(square(10, 10) + &text_object(0))) + &layer("Spare", false, &(text_object(1) + &text_object(2)))),
&doc,
);
// The page draws the square and "Hi there" where the text document sets it.
let page = format!("{}\n0 0 0 1 setcmykcolor /Helvetica findfont 6 scalefont setfont 20 20 moveto (Hi there) show", page_square(10, 10));
let r = import(&eps(&page, &art)).unwrap();
assert_eq!(text_kinds(&r.document), [("Hi there".to_string(), "point"), ("".to_string(), "area")], "{:?}", r.warnings);
assert!(!r.warnings.iter().any(|w| w.contains("couldn't be read")), "{:?}", r.warnings);
}
/// Without a page (the editing data alone), a blank area story comes in as its empty frame and
/// blank point type is left out, without the note for type of kinds that aren't read.
#[test]
fn blank_stories_without_a_page() {
let frames = [area_frame(10.0, 50.0, 90.0, 90.0), point_frame(30.0, 30.0)];
let doc = document_of(&frames, &[story("\\r", &[0], "/0 0", "/1 6.0"), story(" \\r", &[1], "/0 0", "/1 6.0")]);
let art = native_with_text(&layer("Art", true, &(text_object(0) + &text_object(1))), &doc);
let (d, notes) = crate::ai_alone(&private(&art)).unwrap();
assert_eq!(text_kinds(&d), [("".to_string(), "area")], "{notes:?}");
assert!(!notes.iter().any(|w| w.contains("left out")), "{notes:?}");
}
/// The page's spare type goes to a shown text object the text document can't make, not to a blank
/// story beside it, whichever the page paints first: the blank area story comes in as its empty
/// frame. A blank slot takes the page's type only where no other slot is open.
#[test]
fn spare_page_type_goes_to_the_unread_object_not_the_blank_one() {
// Story 0's frame is of a kind this doesn't read, so neither shown object is made: the page's
// one piece of type is spare.
let frames = [point_frame(20.0, 20.0).replace("/2 << /2 [", "/2 << /0 9 /2 ["), area_frame(10.0, 50.0, 90.0, 90.0)];
let doc = document_of(&frames, &[story("Hi there\\r", &[0], "/0 0", "/1 6.0"), story("\\r", &[1], "/0 0", "/1 6.0")]);
let page = "0 0 0 1 setcmykcolor /Helvetica findfont 6 scalefont setfont 20 20 moveto (Hi there) show";
for (order, body) in [("blank first", text_object(1) + &text_object(0)), ("blank last", text_object(0) + &text_object(1))] {
let art = native_with_text(&layer("Art", true, &body), &doc);
let r = import(&eps(page, &art)).unwrap();
let mut texts = text_kinds(&r.document);
texts.sort();
assert_eq!(texts, [("".to_string(), "area"), ("Hi there".to_string(), "point")], "{order}: {:?}", r.warnings);
}
}
/// Two shown blank area stories and one piece of the page's type that no text object owns: with no
/// other slot open, the blank ones take it by painting order; the one left without type comes in as
/// its empty frame, not dropped as merged type.
#[test]
fn a_blank_area_story_the_spare_page_type_skips_keeps_its_frame() {
let frames = [area_frame(10.0, 50.0, 90.0, 90.0), area_frame(10.0, 5.0, 40.0, 30.0)];
let doc = document_of(&frames, &[story("\\r", &[0], "/0 0", "/1 6.0"), story("\\r", &[1], "/0 0", "/1 6.0")]);
let art = native_with_text(&layer("Art", true, &(text_object(0) + &text_object(1))), &doc);
// Away from both frames, so neither owns it.
let page = "0 0 0 1 setcmykcolor /Helvetica findfont 6 scalefont setfont 60 40 moveto (Hi there) show";
let r = import(&eps(page, &art)).unwrap();
let mut texts = text_kinds(&r.document);
texts.sort();
assert_eq!(texts, [("".to_string(), "area"), ("Hi there".to_string(), "point")], "{:?}", r.warnings);
}
/// A warp or an envelope holding the second frame of a blank story threaded from a frame outside
/// it: a thread names only text objects the document has. The warped frame stays type, and the
/// thread stays whole, as for other threaded type, whatever the warp's look draws; the frame in the
/// envelope comes in as the envelope's drawn art, and no thread is left.
#[test]
fn a_warp_or_an_envelope_holding_a_frame_of_a_blank_thread_keeps_its_thread_of_text() {
let frames = [area_frame(10.0, 5.0, 40.0, 30.0), area_frame(20.0, 40.0, 80.0, 70.0)];
let doc = document_of(&frames, &[story("\\r", &[0, 1], "/0 0", "/1 10.0")]);
let envelope = type_envelope_of(0, &arc_keys(0.3), &format!("{}\n", square(30, 50)), "").replace("%_0 /FrameIndex ,", "%_1 /FrameIndex ,");
assert!(envelope.contains("%_1 /FrameIndex ,"));
let warp: String = frame_object(0, 1).lines().map(|l| format!("%_{l}\n")).collect();
let warped = format!("u\n0 1 1 0 1 0 0 Xa\n2 2 m\n9 2 L\n9 9 L\n2 9 L\nf\nU\n9 () XW\n{warp}1 (Warped) XW\n");
let check = |what: &str, d: &Document, notes: &[String]| {
assert!(
d.text_threads.iter().flatten().all(|id| d.node(*id).is_some_and(|n| matches!(n.kind, NodeKind::Text(_)))),
"{what}: {:?} {notes:?}",
d.text_threads
);
};
let art = native_with_text(&layer("Art", true, &format!("{}\n{}\n{envelope}", square(10, 10), frame_object(0, 0))), &doc);
// The page draws the envelope's drawn art.
let r = import(&eps(&format!("{}\n{}", page_square(10, 10), page_square(30, 50)), &art)).unwrap();
check("envelope, with the page", &r.document, &r.warnings);
assert!(r.document.text_threads.is_empty(), "{:?} {:?}", r.document.text_threads, r.warnings);
let (d, notes) = crate::ai_alone(&private(&art)).unwrap();
check("envelope, editing data alone", &d, &notes);
assert!(d.text_threads.is_empty(), "{:?} {notes:?}", d.text_threads);
let art = native_with_text(&(warped_style(40.0, WarpOn::Object) + &layer("Art", true, &format!("{}\n{warped}", frame_object(0, 0)))), &doc);
let (d, notes) = crate::ai_alone(&private(&art)).unwrap();
check("warp", &d, &notes);
assert_eq!(d.text_threads.len(), 1, "{notes:?}");
assert!(!notes.iter().any(|w| w.starts_with(crate::import::ai::WARPED_TYPE_DRAWN)), "{notes:?}");
}
/// A blank story's thread whose first frame an unread group takes with it leaves its other frame
/// alone, no longer threaded: in a warp, that frame is weighed against its look as any warped text
/// object is (the look draws a square the empty frame doesn't, so the look takes its place).
#[test]
fn a_blank_frame_an_unread_group_leaves_alone_in_a_warp_is_weighed_as_lone_type() {
let frames = [
format!("<< /0 << /0 [ 0 0 ] /1 << /0 [ {} ] >> /2 << /0 1 >> >> >>", canvas_rect(50.0, 10.0, 54.0, 14.0)),
format!("<< /0 << /0 [ 0 0 ] /1 << /0 [ {} ] >> /2 << /0 1 >> >> >>", canvas_rect(70.0, 10.0, 74.0, 14.0)),
];
let text = document_of(&frames, &[story("\\r", &[0, 1], "/0 0", "/1 10.0")]);
let grouped = os1_group(&format!("{}\n{}\nZZ", square(50, 10), frame_object(0, 0)));
let own: String = frame_object(0, 1).lines().map(|l| format!("%_{l}\n")).collect();
let warped = format!("u\n0 1 1 0 1 0 0 Xa\n70 10 m\n74 10 L\n74 14 L\n70 14 L\nf\nU\n9 () XW\n{own}1 (Warped) XW\n");
let art = native_with_text(
&(warped_style(40.0, WarpOn::Object) + &layer("Back", true, &square(10, 10)) + &layer("Mixed", true, &format!("{grouped}\n{warped}"))),
&text,
);
let (doc, notes, read) = crate::layered_ai(&private(&art), pdf_three_squares(), vec![], false, true, 1.0);
assert!(read, "{notes:?}");
assert!(doc.text_threads.is_empty(), "{:?} {notes:?}", doc.text_threads);
assert!(notes.iter().any(|w| w.starts_with(crate::import::ai::WARPED_TYPE_DRAWN)), "{notes:?}");
// The look took the frame's place: no text object is left.
assert!(text_kinds(&doc).is_empty(), "{:?} {notes:?}", text_kinds(&doc));
}
/// A point type frame at the point (`x`, `y`) of the art.
fn point_frame(x: f64, y: f64) -> String {
let (cx, cy) = canvas(x, y);
+22 -3
View File
@@ -78,6 +78,18 @@ fn update_editing_hash(svg: &mut String) {
}
}
/// Format physical dimensions (inches, mm, cm) with enough precision and significant digits
/// that small nonzero sizes do not round to zero or distort relative aspect ratio.
fn physical_num(v: f64) -> String {
if !v.is_finite() || v <= 0.0 {
return "0".into();
}
let leading_zeros = (-v.log10().floor() as i32).max(0);
let decimals = (leading_zeros + 3).clamp(3, 14) as u8;
let s = fmt_num(v, decimals);
if s == "0" && v > 0.0 { format!("{v:.16}").trim_end_matches('0').trim_end_matches('.').to_string() } else { s }
}
/// `doc` as SVG with `opts`, the native file `native` embedded for Preserve Editing, its generated
/// ids starting with `id_prefix`.
fn write(doc: &Document, opts: &ExportOptions, native: Option<&[u8]>, id_prefix: &str) -> Output {
@@ -183,10 +195,17 @@ fn write(doc: &Document, opts: &ExportOptions, native: Option<&[u8]>, id_prefix:
root = root.attr("version", "1.2").attr("baseProfile", "tiny");
}
if !opts.responsive {
// Unitless width/height stay in this one branch so #7105 (physical unit suffixes) can rebase here.
root = root.attr("width", &ww).attr("height", &hh);
if let Some(suffix) = doc.units.svg_suffix() {
let w_val = physical_num(doc.units.from_pt(rect.width()));
let h_val = physical_num(doc.units.from_pt(rect.height()));
root = root.attr("width", format_args!("{w_val}{suffix}")).attr("height", format_args!("{h_val}{suffix}"));
} else {
root = root.attr("width", &ww).attr("height", &hh);
}
}
root.attr("viewBox", format_args!("0 0 {ww} {hh}")).open();
let vb_w = if rect.width() > 0.0 && ww == "0" { physical_num(rect.width()) } else { ww.clone() };
let vb_h = if rect.height() > 0.0 && hh == "0" { physical_num(rect.height()) } else { hh.clone() };
root.attr("viewBox", format_args!("0 0 {vb_w} {vb_h}")).open();
let mut out = svg.as_str().to_string();
out.push_str(nl);
let css = opts.styling == Styling::InternalCss && !w.classes.is_empty();
+63 -1
View File
@@ -3,7 +3,7 @@
use vectorcraft_doc::{Document, Node, NodeKind, Unit};
use vectorcraft_geom::Rect;
use vectorcraft_svg::import;
use vectorcraft_svg::{ExportOptions, export, import};
fn art(d: &Document) -> Vec<&Node> {
let mut v = Vec::new();
@@ -130,3 +130,65 @@ fn absolute_lengths_in_a_pixel_document_keep_their_size() {
assert!(close_rect(n.geometric_bounds().unwrap(), Rect::new(0.0, 0.0, 72.0, 720.0 / 25.4)), "{:?}", n.geometric_bounds());
assert!(close(n.appearance.stroke_width(), 2.0));
}
#[test]
fn export_physical_units_writes_unit_suffixes() {
// Millimeters (#864 / G11: avoid 75% scale in external tools like LightBurn, LaserGRBL, Inkscape)
let mut d = Document::new(50.0 * 72.0 / 25.4, 30.0 * 72.0 / 25.4);
d.units = Unit::Millimeters;
let s = export(&d, &ExportOptions::default());
assert!(s.contains("width=\"50mm\" height=\"30mm\""), "{s}");
assert!(s.contains("viewBox=\"0 0 141.732 85.039\""), "{s}");
// Inches
let mut d = Document::new(8.5 * 72.0, 11.0 * 72.0);
d.units = Unit::Inches;
let s = export(&d, &ExportOptions::default());
assert!(s.contains("width=\"8.5in\" height=\"11in\""), "{s}");
assert!(s.contains("viewBox=\"0 0 612 792\""), "{s}");
// Centimeters
let mut d = Document::new(5.0 * 72.0 / 2.54, 3.0 * 72.0 / 2.54);
d.units = Unit::Centimeters;
let s = export(&d, &ExportOptions::default());
assert!(s.contains("width=\"5cm\" height=\"3cm\""), "{s}");
// Picas
let mut d = Document::new(10.0 * 12.0, 20.0 * 12.0);
d.units = Unit::Picas;
let s = export(&d, &ExportOptions::default());
assert!(s.contains("width=\"10pc\" height=\"20pc\""), "{s}");
// Points and pixels remain unitless
let mut d = Document::new(100.0, 200.0);
d.units = Unit::Points;
let s = export(&d, &ExportOptions::default());
assert!(s.contains("width=\"100\" height=\"200\""), "{s}");
d.units = Unit::Pixels;
let s = export(&d, &ExportOptions::default());
assert!(s.contains("width=\"100\" height=\"200\""), "{s}");
// Responsive export omits width and height even with physical units
d.units = Unit::Millimeters;
let s = export(&d, &ExportOptions { responsive: true, ..Default::default() });
assert!(!s.contains("width="), "{s}");
assert!(!s.contains("height="), "{s}");
// Non-zero small dimensions do not round to zero
let mut d = Document::new(0.001 * 72.0 / 25.4, 0.002 * 72.0 / 25.4);
d.units = Unit::Millimeters;
let s = export(&d, &ExportOptions::default());
assert!(s.contains("width=\"0.001mm\" height=\"0.002mm\""), "{s}");
// Extreme small dimension below 8 decimal places preserves non-zero width and viewBox
let mut d = Document::new(1e-9 * 72.0 / 25.4, 1e-9 * 72.0 / 25.4);
d.units = Unit::Millimeters;
let s = export(&d, &ExportOptions::default());
assert!(!s.contains("width=\"0mm\""), "{s}");
assert!(!s.contains("viewBox=\"0 0 0 0\""), "{s}");
// Re-importing preserved physical units
let back = import(&s).unwrap();
assert_eq!(back.units, Unit::Millimeters);
}
+6 -4
View File
@@ -1,6 +1,6 @@
# Gaps
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (G4 and G13 Missing lists drop the shipped Touch Type, Snap to Glyph and Dimension tool, and G13's snapping entry keeps only what is still missing, the partial Snapping panel and the items not yet checked (#8387); G13 keeps one estimate (13–23 h); estimates unchanged; previously: Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups <g>, or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradienLine truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; G4 and G13 Missing lists drop the shipped Touch Type, Snap to Glyph and Dimension tool, and G13's snapping entry keeps only what is still missing, the partial Snapping panel and the items not yet checked (#8387); G13 keeps one estimate (13–23 h); estimates unchanged; previously: Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups <g>, or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: built-in UI Frames symbol library with dLine truncated
> Selection update (2026-11-11): path and compound-path interiors follow enabled non-None fill rows, including lower fills beneath a top None row (#6625). Hidden-only interiors miss; zero-opacity fills remain selectable. Cap/join follow-up (2026-11-12): hidden-fill and no-fill stroke hits must respect cap and join geometry; focused cap/join CPU regressions passed. Scores and estimates unchanged.
@@ -40,6 +40,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard
| Date | Change | Summary |
|---|---|---|
| 2026-11-18 | minor | G11: SVG export writes physical unit suffixes on the root <svg width="..." height="..."> for documents with physical units (mm, cm, in, pc), preventing drawings from scaling to 75% in external tools and preserving units across round-trips (#864; general unit preference on restart remains open under #864). Estimate 8–15 → 6–13 h. |
| 2026-11-18 | minor | G12: Layers panel ruler guide and blend spine row context menus (#8592): Hide/Show, Lock/Unlock, Release Guides, Delete and Locate Object on guide rows; Select, Blend Options…, Reverse Spine, Reverse Front to Back, Expand, Release and Locate Object on blend spine rows. Scores and estimates unchanged. |
| 2026-11-18 | minor | G19: PDF export writes the document language chosen in Document Setup as the catalog's `/Lang` (its BCP 47 tag, `en-US` by default) and the XMP packet's `dc:language`, in exported and printed PDFs (#3644); `/MarkInfo` stays with tagged PDF (#3643). Scores and estimates unchanged. |
| 2026-11-16 | minor | G1: Recolor Artwork - native Lab entry in Color Picker, swatch libraries access in Color Picker, and row right-click context menu ("Pick from Swatches", "Limit to Library") (#4028); scores and estimates unchanged. |
@@ -102,7 +103,7 @@ stage ([ROADMAP.md](../ROADMAP.md)).
| 2 | [G9 Illustrator `.ai` and EPS files from real users](#g9-illustrator-ai-and-eps-files-from-real-users) | 10–20 | yes | [file-format-parity.md](file-format-parity.md) |
| 3 | [G10 Launch and stability on real machines](#g10-launch-and-stability-on-real-machines) | 20–35 | yes | — |
| 4 | [G8 Hardening at scale](#g8-hardening-at-scale) | 30–50 | yes (part) | — |
| 5 | [G11 Correctness bugs in core tools](#g11-correctness-bugs-in-core-tools) | 8–15 | yes | [target-app-parity.md](target-app-parity.md) |
| 5 | [G11 Correctness bugs in core tools](#g11-correctness-bugs-in-core-tools) | 6–13 | yes | [target-app-parity.md](target-app-parity.md) |
| 6 | [G4 Advanced type](#g4-advanced-type) | 34–47 | core part | [type-parity.md](type-parity.md) |
| 7 | [G12 Preferences and panels that don't act yet](#g12-preferences-and-panels-that-dont-act-yet) | 13–20 | yes | [ui-parity.md](ui-parity.md) |
| 8 | [G2 Photoshop-style raster effects and the Effect Gallery](#g2-photoshop-style-raster-effects-and-the-effect-gallery) | 0 | no | [effects-parity.md](effects-parity.md) |
@@ -403,7 +404,8 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
such stubs into one vertex (within 4× the sweep's tolerance up and down its frame and 1/16 of the 0.01 pt precision
along it, bounded by each cluster's extent so a run of tiny level segments keeps its length); regression tests
in `crates/pathops/src/planar.rs`. Estimate unchanged.
- **Missing:** SVG units reverting to points (#864). Shape Builder regions (#937, closed), PDF text placement
- **Done (#864):** SVG export writes physical unit suffixes on the root `<svg width="..." height="...">` for documents with physical units (`mm`, `cm`, `in`, `pc`), so external vector tools (Inkscape, LightBurn) and browsers render drawings at their intended physical scale rather than scaling to 75% under point-based user-unit assumptions; unitless user coordinates in `viewBox` and path geometry remain in 1:1 internal points per SVG 1.1 coords §7.10, preserving document units on round trips (`export_physical_units_writes_unit_suffixes`, `svg_round_trip_preserves_document_units`). General document unit preferences across restarts remain tracked under #864.
- **Missing:** general document unit preference on restart (#864; SVG export physical units done). Shape Builder regions (#937, closed), PDF text placement
(#722, above), the bezier drag preview (#834, #3065, #3729) and deleting an interior anchor of an open path (above)
are done.
- **Done (#722):** PDF text opens where the file draws it. Each line used to come in as point type laid out by the
@@ -415,7 +417,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
boxes come back as justified area type. Fixtures written from ISO 32000-1 §9 (`tests_text_placement`). A font
that is neither embedded nor installed still draws in a stand-in with the old fit.
- **Impact:** wrong output in everyday work.
- **Estimate:** 8–15 h.
- **Estimate:** 6–13 h.
## G4 Advanced type
+1 -1
View File
@@ -147,7 +147,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule
Selection, smart guides and snapping first. 60–90 h, parallel by tool.
2. **`.ai` files from real users** (G9): layer structure (#951). 10–20 h.
3. **Launch and stability** (G10): the Windows and Linux start-up reports. 20–35 h.
4. **Core-tool bugs** (G11): SVG units reverting to points (#864) and a Transform effect in a fill's or stroke's own effects (#885). Shape Builder regions (#937), Asset Export ghost borders (#983 / #1037) and the stalling bezier drag preview (#834) are fixed. 8–15 h.
4. **Core-tool bugs** (G11): SVG units reverting to points (#864; SVG export physical units fixed) and a Transform effect in a fill's or stroke's own effects (#885). Shape Builder regions (#937), Asset Export ghost borders (#983 / #1037) and the stalling bezier drag preview (#834) are fixed. 6–13 h.
5. **Then:** advanced type (G4) and the Illustrator 2026 additions (G13), then 3D (G3). The Effect Gallery's filter thumbnails and in-dialog preview are in (G2).
## Next
+1 -1
View File
@@ -1,6 +1,6 @@
# Parity with Adobe Illustrator
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, #8294; scores and estimates unchanged; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, InflaLine truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, #8294; scores and estimates unchanged; previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: SnapLine truncated
>
> Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5).
>