Merge pull request #7970 from dotCooCoo/feat/ai-save-wrapped-area-type-live

.ai save: area type wrapped by plain paths, compound paths or groups stays type
This commit is contained in:
BFlat
2026-11-16 06:55:50 +07:00
committed by GitHub
11 changed files with 558 additions and 49 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ pub use tabs_lists::{
Bullet, DEFAULT_TAB_INTERVAL, LIST_HANGING_INDENT, LIST_LEVEL_INDENT, LIST_LEVELS, ListAlign, ListCounts, NumberStyle, ParaList, TabAlign,
TabStop,
};
pub use wrap::{resolve_wrap, wrap_work};
pub use wrap::{resolve_wrap, wrap_sources, wrap_work};
/// A text object. `runs` split into paragraphs at `\n`.
///
+58 -34
View File
@@ -4,7 +4,7 @@ use std::sync::Arc;
use vectorcraft_geom::{PathData, shapes};
use super::{TextKind, WrapShape};
use super::{TextKind, TextObject, WrapShape};
use crate::{Document, Node, NodeId, NodeKind};
/// Outline of a wrap object in document coordinates: its paths, or its bounds for other art.
@@ -82,6 +82,57 @@ pub fn wrap_work(doc: &Document) -> usize {
total
}
/// Each area text object of `layer`, from the top down, with the wrap objects above it in the
/// layer whose outlines aren't empty, topmost first, each with the shape its outline makes in
/// document coordinates. Each wrap object's outline is made once.
fn each_text<'a>(layer: &'a Node, mut f: impl FnMut(&'a Node, &[(&'a Node, WrapShape)])) {
let mut items = vec![];
collect(layer, &mut items);
let mut above: Vec<(&Node, WrapShape)> = vec![];
for it in items.iter().rev() {
match it {
Item::Wrap(n) => {
let mut pd = PathData::default();
outline(n, &mut pd);
if !pd.is_empty() {
above.push((n, WrapShape { path: pd, wrap: n.extras().wrap.unwrap_or_default() }));
}
}
Item::Text(n) => f(n, &above),
}
}
}
/// The wrap shapes of text object `t` (text space) from `above`, the wrap objects above it as
/// [`each_text`] gives them: bottom first.
fn shapes_of(t: &TextObject, above: &[(&Node, WrapShape)]) -> Vec<WrapShape> {
let inv = t.xf.inverse();
above
.iter()
.rev()
.map(|(_, s)| {
let mut path = s.path.clone();
path.transform(inv);
WrapShape { path, wrap: s.wrap }
})
.collect()
}
/// Each area text object on `doc`'s layers that [`resolve_wrap`] gives wrap shapes, with the wrap
/// objects whose outlines make them, bottom first, and those shapes (text space), as
/// [`resolve_wrap`] works them out. The copying is [`wrap_work`].
pub fn wrap_sources<'a>(doc: &'a Document, mut f: impl FnMut(&'a Node, Vec<&'a Node>, Vec<WrapShape>)) {
for layer in &doc.layers {
each_text(layer, |n, above| {
if let NodeKind::Text(t) = &n.kind
&& !above.is_empty()
{
f(n, above.iter().rev().map(|(s, _)| *s).collect(), shapes_of(t, above));
}
});
}
}
/// Resolve the wrap shapes (`TextObject::wrap`, text space) of each area text object from the
/// outlines of the wrap objects above it in its layer. With `before`, the layers it holds unchanged
/// are skipped; without it, every layer is resolved. Returns the area text objects whose shapes
@@ -95,41 +146,14 @@ pub fn resolve_wrap(before: Option<&Document>, doc: &mut Document) -> Vec<NodeId
{
continue;
}
let mut items = vec![];
collect(layer, &mut items);
if items.is_empty() {
continue;
}
// From the top down, each wrap object's outline is made once; each area text object takes
// those above it, bottom first.
let mut above: Vec<WrapShape> = vec![];
for it in items.iter().rev() {
match it {
Item::Wrap(n) => {
let mut pd = PathData::default();
outline(n, &mut pd);
if !pd.is_empty() {
above.push(WrapShape { path: pd, wrap: n.extras().wrap.unwrap_or_default() });
}
}
Item::Text(n) => {
let NodeKind::Text(t) = &n.kind else { continue };
let inv = t.xf.inverse();
let shapes: Vec<WrapShape> = above
.iter()
.rev()
.map(|s| {
let mut path = s.path.clone();
path.transform(inv);
WrapShape { path, wrap: s.wrap }
})
.collect();
if shapes != t.wrap {
updates.push((n.id, shapes));
}
each_text(layer, |n, above| {
if let NodeKind::Text(t) = &n.kind {
let shapes = shapes_of(t, above);
if shapes != t.wrap {
updates.push((n.id, shapes));
}
}
}
});
}
let mut changed = Vec::with_capacity(updates.len());
for (id, shapes) in updates {
+15
View File
@@ -265,6 +265,15 @@ pub fn export_ai_editing(doc: &Document, o: &AiEditingOptions) -> Result<AiEditi
/// [`export_ai_editing`] writing at most `max_objects` objects, counted as the reader counts them.
fn export_within(doc: &Document, o: &AiEditingOptions, max_objects: usize) -> Result<AiEditingOutput, String> {
export_held(doc, o, max_objects, true)
}
/// [`export_within`]; with `keep_wraps`, wrapped area type the reader wraps the same is written as
/// type ([`writer::wraps_held`]). When such type is written and art is left out at the object
/// limit, the wrap objects above it may be among what is left out, and the document is written
/// again with that type as its outlines.
fn export_held(source: &Document, o: &AiEditingOptions, max_objects: usize, keep_wraps: bool) -> Result<AiEditingOutput, String> {
let doc = source;
let board = doc.artboards.first().ok_or("the document has no artboard")?.rect;
if !(board.is_finite() && board.width() > 0.0 && board.height() > 0.0) {
return Err("the document has no artboard".into());
@@ -277,6 +286,8 @@ fn export_within(doc: &Document, o: &AiEditingOptions, max_objects: usize) -> Re
let (symbol_styled, pattern_styled) = writer::styled_definitions(doc);
let own_styles = doc.graphic_styles != Document::new(1.0, 1.0).graphic_styles;
let links = writer::style_links(doc);
// Before baking, which leaves the wrap objects that may be written as they are unchanged.
let wraps_held = if keep_wraps { writer::wraps_held(doc, &styled) } else { HashSet::new() };
// Live geometry effects as their result, as the PDF part draws them.
let baked = baked(doc);
let doc = baked.as_ref().unwrap_or(doc);
@@ -309,6 +320,7 @@ fn export_within(doc: &Document, o: &AiEditingOptions, max_objects: usize) -> Re
w.brushes_live = scale == 1.0;
w.symbol_doc = symbol_doc;
w.max_objects = max_objects;
w.wraps_held = wraps_held;
w.reserve_swatch_gradients();
if scale == 1.0 {
w.styled = styled;
@@ -320,6 +332,9 @@ fn export_within(doc: &Document, o: &AiEditingOptions, max_objects: usize) -> Re
for layer in &doc.layers {
w.layer(layer);
}
if w.wrapped_type_cut() {
return export_held(source, o, max_objects, false);
}
// The symbols no instance uses too; their art adds definitions.
w.symbols();
// The brushes, once the layers have said whether an object is written with one.
+343
View File
@@ -11634,6 +11634,349 @@ fn same_region(before: &[(Vec<[f64; 4]>, f64, bool)], after: &[(Vec<[f64; 4]>, f
before.len() == after.len() && before.iter().zip(after).all(|(b, a)| close(&b.0, &a.0) && (b.1 - a.1).abs() < 1e-6 && b.2 == a.2)
}
/// A `w` × `h` document of area type "Body" in the frame `frame`, with `over` above it (bottom
/// first), its wrap shapes resolved as the canvas resolves them.
fn wrapped_body(w: f64, h: f64, frame: Rect, over: impl FnOnce(&mut Document) -> Vec<Node>) -> Document {
use vectorcraft_doc::{TextKind, TextObject, TextRun};
let mut doc = Document::new(w, h);
let layer = doc.layers[0].id;
let size = frame.height() / 20.0;
let mut body = TextObject::point(vectorcraft_geom::Point::ZERO, "", style(size, Color::BLACK));
body.runs = vec![TextRun::new("one two three four five six seven eight nine ten eleven twelve", style(size, Color::BLACK))];
body.kind = TextKind::Area { frame: shapes::rectangle(frame) };
body.xf = Affine::IDENTITY;
let body = named(text_node(&mut doc, body), "Body");
let over = over(&mut doc);
for n in std::iter::once(body).chain(over) {
doc.insert(Some(layer), usize::MAX, n).unwrap();
}
vectorcraft_doc::text::resolve_wrap(None, &mut doc);
doc
}
/// The characters, frame and wrap shapes of the area type on `doc`'s first layer, as it is (its
/// shapes not resolved again).
fn area_type(doc: &Document) -> Option<(String, Option<Rect>, usize)> {
use vectorcraft_doc::TextKind;
doc.layers[0].children().unwrap().iter().find_map(|n| match &n.kind {
NodeKind::Text(t) if matches!(&t.kind, TextKind::Area { .. }) => {
let TextKind::Area { frame } = &t.kind else { return None };
Some((t.runs.iter().map(|r| r.text.as_str()).collect(), frame.transformed(t.xf).bounds(), t.wrap.len()))
}
_ => None,
})
}
/// Area type wrapped only by plain paths, compound paths and groups that don't clip is written as
/// type and reopens as area type with its characters, its frame and the same wrap shapes, which
/// the reader works out again from the objects above it ([`crate::import`]'s
/// `resolve_text_wrap`): a filled path with a negative offset and Invert Wrap, a locked path with
/// only a stroke, a compound path, a group of two squares with a hidden member, an offset of
/// -1000 pt, and an empty group and an open line with options, which wrap nothing.
#[test]
fn area_type_wrapped_by_plain_objects_stays_type() {
type Make = fn(&mut Document) -> Vec<Node>;
fn ring(doc: &mut Document, r: Rect) -> Node {
let outer = Node::path(doc.alloc_id(), shapes::rectangle(r), Appearance::default());
let inner = Node::path(doc.alloc_id(), shapes::rectangle(r.inset(-10.0)), Appearance::default());
let mut ring = Node::new(doc.alloc_id(), NodeKind::Compound { children: vec![Arc::new(outer), Arc::new(inner)], rule: FillRule::EvenOdd });
ring.appearance = Appearance::basic(solid(Color::gray(0.5)), Paint::None, 0.0).into();
ring
}
let cases: [(&str, Make); 6] = [
("a path, a negative offset, Invert Wrap", |doc| {
vec![wrapped(square(doc, Rect::new(100.0, 40.0, 160.0, 120.0), Color::gray(0.5)), -4.25, true)]
}),
("a locked stroked path", |doc| {
let mut n = Node::path(
doc.alloc_id(),
shapes::ellipse(Rect::new(80.0, 30.0, 180.0, 130.0)),
Appearance::basic(Paint::None, solid(Color::BLACK), 2.0),
);
n.locked = true;
vec![wrapped(n, 6.0, false)]
}),
("a compound path", |doc| vec![wrapped(ring(doc, Rect::new(80.0, 30.0, 200.0, 150.0)), 7.0, true)]),
("a group", |doc| {
let a = square(doc, Rect::new(40.0, 40.0, 80.0, 80.0), Color::gray(0.5));
let mut hidden = square(doc, Rect::new(120.0, 40.0, 160.0, 80.0), Color::gray(0.5));
hidden.visible = false;
let b = square(doc, Rect::new(200.0, 100.0, 240.0, 140.0), Color::gray(0.5));
vec![wrapped(group(doc, vec![a, hidden, b], false), -2.0, false)]
}),
("an offset of -1000 pt", |doc| vec![wrapped(square(doc, Rect::new(100.0, 40.0, 160.0, 120.0), Color::gray(0.5)), -1000.0, false)]),
("an empty group and an open line", |doc| {
let line = Node::path(
doc.alloc_id(),
shapes::line((20.0, 20.0).into(), (280.0, 180.0).into()),
Appearance::basic(Paint::None, solid(Color::BLACK), 1.0),
);
let empty = group(doc, vec![], false);
let n = square(doc, Rect::new(100.0, 40.0, 160.0, 120.0), Color::gray(0.5));
vec![wrapped(n, 3.0, false), wrapped(empty, 5.0, false), wrapped(line, 5.0, false)]
}),
];
for (name, make) in cases {
let doc = wrapped_body(300.0, 200.0, Rect::new(10.0, 10.0, 290.0, 190.0), make);
let before = area_type(&doc).unwrap();
assert_ne!(before.2, 0, "{name}: the type is wrapped");
let out = export_ai_editing(&doc, &opts()).unwrap();
let text_out = String::from_utf8_lossy(&out.program).replace("\r\n", "\n");
assert!(!out.warnings.iter().any(|w| w == writer::TYPE), "{name}: {:?}", out.warnings);
assert!(text_out.contains("/AI11Text"), "{name}");
let back = read_back(&doc);
let after = area_type(&back).unwrap_or_else(|| panic!("{name}: no area type\n{text_out}"));
assert_eq!(after.0, before.0, "{name}");
let (b, a) = (before.1.unwrap(), after.1.unwrap());
assert!([b.x0 - a.x0, b.y0 - a.y0, b.x1 - a.x1, b.y1 - a.y1].iter().all(|d| d.abs() < 1e-3), "{name}: {b:?} {a:?}");
assert_eq!(after.2, before.2, "{name}: the reader wrapped it");
assert!(same_region(&area_wrap_region(&doc), &area_wrap_region(&back)), "{name}\n{text_out}");
// The object that wraps it comes back as the same kind, lock and options.
let source = |d: &Document| {
let n = d.layers[0].children().unwrap()[1].clone();
(std::mem::discriminant(&n.kind), n.locked, n.visible, n.extras().wrap)
};
assert_eq!(source(&back), source(&doc), "{name}\n{text_out}");
}
}
/// Area type stays outlines when a wrap object above it is not written as itself, or its shapes
/// are not the ones the objects above it give it: an object with an effect, a blend, a symbol
/// instance, a path with a gradient, a compound path with a hidden member, a group holding type,
/// a compound path of one subpath (read back as a path), an offset past 1000 pt, a clipping group, and shapes of an object that has moved since.
#[test]
fn area_type_wrapped_by_other_objects_stays_outlines() {
type Make = fn(&mut Document) -> Vec<Node>;
let cases: [(&str, Make); 10] = [
("an effect", |doc| {
let n = styled_rect(doc, "Shadowed", Rect::new(100.0, 40.0, 160.0, 120.0), solid(Color::gray(0.5)), Paint::None, vec![drop_shadow()]);
vec![wrapped(n, 4.0, false)]
}),
("a blend", |doc| {
let keys = vec![
Arc::new(square(doc, Rect::new(60.0, 80.0, 70.0, 90.0), Color::gray(0.5))),
Arc::new(square(doc, Rect::new(220.0, 110.0, 230.0, 120.0), Color::gray(0.5))),
];
let spec = vectorcraft_doc::BlendSpec { spacing: vectorcraft_doc::BlendSpacing::Distance(60.0), ..Default::default() };
vec![wrapped(Node::new(doc.alloc_id(), NodeKind::Blend { children: keys, spec: Box::new(spec) }), 4.5, false)]
}),
("a symbol instance", |doc| {
two_leaves(doc);
vec![wrapped(instance(doc, "Leaf", Affine::new([3.0, 0.0, 0.0, 3.0, 150.0, 100.0])), 4.5, false)]
}),
("a gradient", |doc| {
let g = Gradient::new(GradientKind::Linear, vec![GradientStop::new(0.0, Color::BLACK), GradientStop::new(1.0, Color::WHITE)]);
let ap = Appearance::basic(Paint::Gradient(Box::new(GradientPaint::new(g))), Paint::None, 0.0);
vec![wrapped(Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(100.0, 40.0, 160.0, 120.0)), ap), 4.0, false)]
}),
("a compound path with a hidden member", |doc| {
let outer = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(80.0, 30.0, 200.0, 150.0)), Appearance::default());
let mut inner = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(100.0, 50.0, 180.0, 130.0)), Appearance::default());
inner.visible = false;
let mut ring =
Node::new(doc.alloc_id(), NodeKind::Compound { children: vec![Arc::new(outer), Arc::new(inner)], rule: FillRule::EvenOdd });
ring.appearance = Appearance::basic(solid(Color::gray(0.5)), Paint::None, 0.0).into();
vec![wrapped(ring, 4.0, false)]
}),
("a group holding type", |doc| {
let label = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::new(100.0, 100.0), "Label", style(20.0, Color::BLACK));
let label = text_node(doc, label);
let n = square(doc, Rect::new(100.0, 40.0, 160.0, 120.0), Color::gray(0.5));
vec![wrapped(group(doc, vec![n, label], false), 4.0, false)]
}),
("a compound path of one subpath", |doc| {
let only = Node::path(doc.alloc_id(), shapes::rectangle(Rect::new(80.0, 30.0, 200.0, 150.0)), Appearance::default());
let mut one = Node::new(doc.alloc_id(), NodeKind::Compound { children: vec![Arc::new(only)], rule: FillRule::NonZero });
one.appearance = Appearance::basic(solid(Color::gray(0.5)), Paint::None, 0.0).into();
vec![wrapped(one, 4.0, false)]
}),
("an offset past 1000 pt", |doc| vec![wrapped(square(doc, Rect::new(100.0, 40.0, 160.0, 120.0), Color::gray(0.5)), 1000.5, false)]),
("a clipping group", |doc| {
let clip = clipping(doc, shapes::rectangle(Rect::new(80.0, 30.0, 200.0, 150.0)));
let n = square(doc, Rect::new(100.0, 40.0, 160.0, 120.0), Color::gray(0.5));
vec![wrapped(group(doc, vec![clip, n], true), 4.0, false)]
}),
("a path moved since", |doc| vec![wrapped(square(doc, Rect::new(100.0, 40.0, 160.0, 120.0), Color::gray(0.5)), 4.0, false)]),
];
let mut typed = vec![];
for (name, make) in cases {
let mut doc = wrapped_body(300.0, 200.0, Rect::new(10.0, 10.0, 290.0, 190.0), make);
assert_ne!(area_type(&doc).unwrap().2, 0, "{name}: the type is wrapped");
if name == "a path moved since" {
let id = doc.layers[0].children().unwrap()[1].id;
doc.node_mut(id).unwrap().transform(Affine::translate((30.0, 0.0)), false);
}
let out = export_ai_editing(&doc, &opts()).unwrap();
if !out.warnings.iter().any(|w| w == writer::TYPE) || area_type(&read_back(&doc)).is_some() {
typed.push(name);
}
}
assert!(typed.is_empty(), "written as type: {typed:?}");
}
/// Each frame of threaded area type is checked on its own: a thread whose first frame is wrapped
/// by a path and a group and whose second by the group alone is written as type and reopens as the
/// same thread with the same shapes in each frame; with a blend over the second frame, the whole
/// thread is written as outlines.
#[test]
fn threaded_area_type_wrapped_by_plain_objects_stays_type() {
use vectorcraft_doc::{TextKind, TextObject, TextRun};
for blend in [false, true] {
let mut doc = Document::new(400.0, 200.0);
let layer = doc.layers[0].id;
let st = style(10.0, Color::BLACK);
let mut first = TextObject::point(vectorcraft_geom::Point::ZERO, "", st.clone());
first.runs = vec![TextRun::new("one two three four five six seven eight nine ten eleven twelve thirteen fourteen ", st.clone())];
first.kind = TextKind::Area { frame: shapes::rectangle(Rect::new(10.0, 10.0, 190.0, 90.0)) };
first.xf = Affine::IDENTITY;
let mut second = first.clone();
second.runs = vec![TextRun::new("fifteen sixteen seventeen eighteen nineteen twenty", st.clone())];
second.kind = TextKind::Area { frame: shapes::rectangle(Rect::new(210.0, 10.0, 390.0, 90.0)) };
let (first, second) = (named(text_node(&mut doc, first), "First"), named(text_node(&mut doc, second), "Second"));
doc.text_threads.push(vec![first.id, second.id]);
let path = wrapped(square(&mut doc, Rect::new(60.0, 20.0, 100.0, 60.0), Color::gray(0.5)), -3.0, true);
let over_second = if blend {
let keys = vec![
Arc::new(square(&mut doc, Rect::new(250.0, 20.0, 260.0, 30.0), Color::gray(0.5))),
Arc::new(square(&mut doc, Rect::new(340.0, 60.0, 350.0, 70.0), Color::gray(0.5))),
];
let spec = vectorcraft_doc::BlendSpec { spacing: vectorcraft_doc::BlendSpacing::Distance(30.0), ..Default::default() };
wrapped(Node::new(doc.alloc_id(), NodeKind::Blend { children: keys, spec: Box::new(spec) }), 2.0, false)
} else {
let a = square(&mut doc, Rect::new(250.0, 20.0, 290.0, 60.0), Color::gray(0.5));
let b = square(&mut doc, Rect::new(120.0, 50.0, 300.0, 80.0), Color::gray(0.5));
wrapped(group(&mut doc, vec![a, b], false), 2.0, false)
};
// Bottom first: the first frame, the path, the second frame, the group or blend.
for n in [first, path, second, over_second] {
doc.insert(Some(layer), usize::MAX, n).unwrap();
}
vectorcraft_doc::text::resolve_wrap(None, &mut doc);
type Region = Vec<(Vec<[f64; 4]>, f64, bool)>;
let shapes = |d: &Document| -> Vec<Region> {
d.layers[0]
.children()
.unwrap()
.iter()
.filter_map(|n| match &n.kind {
NodeKind::Text(t) => Some(
t.wrap
.iter()
.map(|s| {
let parts = s
.path
.subpaths
.iter()
.map(|sp| {
let b = PathData::new(vec![sp.clone()]).bounds().unwrap_or_default();
[b.x0, b.y0, b.x1, b.y1]
})
.collect();
(parts, s.wrap.offset, s.wrap.invert)
})
.collect(),
),
_ => None,
})
.collect()
};
let before = shapes(&doc);
assert_eq!(before.iter().map(Vec::len).collect::<Vec<_>>(), [2, 1], "blend: {blend}");
let out = export_ai_editing(&doc, &opts()).unwrap();
let back = read_back(&doc);
if blend {
assert!(out.warnings.iter().any(|w| w == writer::TYPE), "{:?}", out.warnings);
assert!(back.text_threads.is_empty());
continue;
}
assert!(!out.warnings.iter().any(|w| w == writer::TYPE), "{:?}", out.warnings);
assert_eq!(back.text_threads.len(), 1);
let names: Vec<_> = back.text_threads[0].iter().map(|id| back.node(*id).and_then(|n| n.name.clone())).collect();
assert_eq!(names, [Some("First".to_string()), Some("Second".to_string())]);
let after = shapes(&back);
assert_eq!(after.len(), 2);
for (b, a) in before.iter().zip(&after) {
assert!(same_region(b, a), "{before:?}\n{after:?}");
}
}
}
/// Wrapped area type is written as type only while the wrap shapes of all the area type the reader
/// reads stay within what it copies: 150 frames under a wrap object of 10,000 anchors are, and
/// with 100 more frames under it, none are.
#[test]
fn area_type_wrapped_past_the_reader_limit_stays_outlines() {
use vectorcraft_doc::{TextKind, TextObject};
let area = |doc: &mut Document| {
let mut t = TextObject::point(vectorcraft_geom::Point::ZERO, "Wrapped", style(10.0, Color::BLACK));
t.kind = TextKind::Area { frame: shapes::rectangle(Rect::new(0.0, 0.0, 100.0, 100.0)) };
t.xf = Affine::IDENTITY;
let n = text_node(doc, t);
doc.insert(Some(doc.layers[0].id), 0, n).unwrap()
};
let mut doc = Document::new(100.0, 100.0);
let ids: Vec<_> = (0..150).map(|_| area(&mut doc)).collect();
let mut zigzag = vec![(40.0, 0.0).into()];
zigzag.extend((1..10_000).map(|i| vectorcraft_geom::Point::new(40.0 + 20.0 * f64::from(i) / 10_000.0, if i % 2 == 0 { 0.0 } else { 100.0 })));
let n = wrapped(
Node::path(doc.alloc_id(), PathData::new(vec![vectorcraft_geom::SubPath::polyline(&zigzag, true)]), Appearance::default()),
6.0,
false,
);
doc.insert(Some(doc.layers[0].id), usize::MAX, n).unwrap();
vectorcraft_doc::text::resolve_wrap(None, &mut doc);
let held = writer::wraps_held(&doc, &std::collections::HashMap::new());
assert!(ids.iter().all(|id| held.contains(id)), "{} of {}", held.len(), ids.len());
for _ in 0..100 {
area(&mut doc);
}
assert!(vectorcraft_doc::text::wrap_work(&doc) > crate::import::MAX_WRAP_WORK);
assert!(writer::wraps_held(&doc, &std::collections::HashMap::new()).is_empty());
}
/// Wrapped area type stays type with room for every object, and is written as outlines when art is
/// left out at the object limit: one object short, the wrap object above it would be left out and
/// the reader would not wrap the type.
#[test]
fn area_type_wrapped_past_the_object_limit_is_written_as_outlines() {
let doc = wrapped_body(300.0, 200.0, Rect::new(10.0, 10.0, 290.0, 190.0), |doc| {
vec![wrapped(square(doc, Rect::new(100.0, 40.0, 160.0, 120.0), Color::gray(0.5)), 4.0, false)]
});
let read = crate::import::objects_read(&export_ai_editing(&doc, &opts()).unwrap().program).unwrap();
let all = export_within(&doc, &opts(), read).unwrap();
assert!(!all.warnings.iter().any(|w| w == writer::OBJECT_LIMIT || w == writer::TYPE), "{:?}", all.warnings);
let short = export_within(&doc, &opts(), read - 1).unwrap();
assert!(short.warnings.iter().any(|w| w == writer::OBJECT_LIMIT), "{:?}", short.warnings);
assert!(short.warnings.iter().any(|w| w == writer::TYPE), "{:?}", short.warnings);
let (back, _) = crate::ai_alone(&short.program).unwrap();
assert!(area_type(&back).is_none(), "{}", String::from_utf8_lossy(&short.program));
}
/// On a large canvas, area type wrapped by a plain path is written as type and reopens with the
/// same wrap shapes, the offset at its size.
#[test]
fn area_type_wrapped_on_a_large_canvas_stays_type() {
let doc = wrapped_body(20_000.0, 20_000.0, Rect::new(1000.0, 1000.0, 9000.0, 9000.0), |doc| {
vec![wrapped(square(doc, Rect::new(3000.0, 3000.0, 5000.0, 6000.0), Color::gray(0.5)), -12.5, true)]
});
let before = area_type(&doc).unwrap();
assert_ne!(before.2, 0);
let out = export_ai_editing(&doc, &opts()).unwrap();
assert!(!out.warnings.iter().any(|w| w == writer::TYPE), "{:?}", out.warnings);
let back = read_back(&doc);
let after = area_type(&back).expect("area type");
assert_eq!((after.0.as_str(), after.2), (before.0.as_str(), before.2));
let (b, a) = (area_wrap_region(&doc), area_wrap_region(&back));
let close = b.len() == a.len()
&& b.iter().zip(&a).all(|(b, a)| {
b.0.len() == a.0.len()
&& b.0.iter().zip(&a.0).all(|(x, y)| x.iter().zip(y).all(|(x, y)| (x - y).abs() < 1e-2))
&& (b.1 - a.1).abs() < 1e-3
&& b.2 == a.2
});
assert!(close, "{b:?}\n{a:?}");
}
/// Type written as its outlines wraps area type below it by its bounds, as it did before saving,
/// not by its glyphs: its text wrap options go on an unpainted rectangle of its bounds, the last
/// member of the outlines' group, which keeps the type's name and has no options of its own.
+21 -3
View File
@@ -31,6 +31,7 @@ pub(super) use envelopes::ENVELOPES;
pub(super) use styles::{LARGE_CANVAS_STYLES, style_links, styled_definitions, styled_objects};
#[cfg(test)]
pub(super) use styles::{PANEL_EMPTY, PANEL_STYLES, STYLE_LINKS, WARPED_IMAGES, same_appearance};
pub(super) use texts::wraps_held;
pub(super) use images::PAYLOAD;
#[cfg(test)]
@@ -49,7 +50,7 @@ pub(super) use variables::{ACTIVE, BINDINGS, LIMITS, VALUES};
/// [`vectorcraft_doc::MAX_DEPTH`].
pub(super) const MAX_NEST: u32 = 8;
pub(super) const TYPE: &str = "type in opacity masks, pattern tiles, symbols and art cut to a clipping object, mirrored type, area type and type on a path that is turned or unevenly scaled or whose frame or path has several parts, area type in an open frame, type on an open path whose ends meet, area type that flows around a text wrap, type of only white space, threads of type on a path, threads whose frames differ in orientation or hold a frame written as outlines, type of sizes past what the reader reads, stories past what the reader reads (1,048,576 bytes a story, 16,777,216 bytes in all, and the size of text document it reads), and type with inline graphics, ruby, gradient or pattern paint, or fills, strokes, effects or an opacity mask of the object's own, is written as its outlines in the editing data for other apps";
pub(super) const TYPE: &str = "type in opacity masks, pattern tiles, symbols and art cut to a clipping object, mirrored type, area type and type on a path that is turned or unevenly scaled or whose frame or path has several parts, area type in an open frame, type on an open path whose ends meet, area type whose text wrap cannot be preserved from the saved objects, type of only white space, threads of type on a path, threads whose frames differ in orientation or hold a frame written as outlines, type of sizes past what the reader reads, stories past what the reader reads (1,048,576 bytes a story, 16,777,216 bytes in all, and the size of text document it reads), and type with inline graphics, ruby, gradient or pattern paint, or fills, strokes, effects or an opacity mask of the object's own, is written as its outlines in the editing data for other apps";
pub(super) const PATTERNS: &str = "pattern fills whose tiles aren't a grid or whose art reaches past the tile, pattern fills in another pattern's tile or in a symbol, and pattern fills nested more than 8 deep are written as their tiles cut to the shape in the editing data for other apps";
pub(super) const PATTERN_TILES: &str = "pattern fills with more tiles than a fill places are written filled gray in the editing data for other apps";
pub(super) const CLIPPING: &str = "clipping groups and clipping layers whose clipping object isn't a path, and the clipping groups inside them, are written as their art cut to that object in the editing data for other apps";
@@ -228,6 +229,10 @@ pub(super) struct Writer<'a> {
bound: Vec<(vectorcraft_doc::NodeId, String, Vec<String>)>,
/// The text document: the stories of the type written as text.
pub(super) texts: texts::TextDoc,
/// The area type with wrap shapes that may be written as type ([`texts::wraps_held`]).
pub(super) wraps_held: HashSet<NodeId>,
/// Area type with wrap shapes was written as type.
wrapped_typed: bool,
/// Symbol instances on the layers may be written as instances ([`Self::live_instance`]); false
/// on a large canvas, where they are written as their art.
pub(super) symbols_live: bool,
@@ -348,6 +353,8 @@ impl<'a> Writer<'a> {
typed: false,
bound: vec![],
texts: texts::TextDoc::default(),
wraps_held: HashSet::new(),
wrapped_typed: false,
cms: vectorcraft_color::cms::active(),
body: String::new(),
warnings: vec![],
@@ -404,6 +411,12 @@ impl<'a> Writer<'a> {
}
}
/// Was area type with wrap shapes written as type, and art left out at the object limit
/// ([`Self::take_objects`])? The reader may then wrap that type by fewer objects than it had.
pub(super) fn wrapped_type_cut(&self) -> bool {
self.wrapped_typed && self.left_out > 0
}
/// Whether `count` more objects may be written: the objects written so far, counted as the
/// reader counts them ([`object_count`]), stay within [`Self::max_objects`]. Past it the art is
/// left out, with a warning.
@@ -1482,7 +1495,11 @@ impl<'a> Writer<'a> {
let thread = doc.text_threads.iter().find(|th| th.contains(&n.id));
let contents = self.contents_level.filter(|(hidden, nest, _)| (*hidden, *nest) == (self.hidden, self.nest));
// Type that can't be a stub is written as its outlines, which count their own objects.
if (self.hidden > 0 && contents.is_none()) || self.clip.is_some() || self.in_symbol || (thread.is_none() && !texts::holds(n, t)) {
if (self.hidden > 0 && contents.is_none())
|| self.clip.is_some()
|| self.in_symbol
|| (thread.is_none() && !texts::holds(n, t, self.wraps_held.contains(&n.id)))
{
self.outlined += 1;
return self.outlined_text(n, xy);
}
@@ -1495,7 +1512,7 @@ impl<'a> Writer<'a> {
}
let placed = if let Some(thread) = thread {
// A thread is checked for what it loses, in every frame, when its story is written.
let placed = self.texts.thread(doc, thread, n.id, self.canvas, &|id| !cut_to_clipping_object(doc, id));
let placed = self.texts.thread(doc, thread, n.id, self.canvas, &|id| !cut_to_clipping_object(doc, id), &self.wraps_held);
placed.map(|p| (p, self.texts.take_lost()))
} else {
self.texts.add(t, self.canvas).map(|story| ((story, 0), texts::loses(t)))
@@ -1507,6 +1524,7 @@ impl<'a> Writer<'a> {
return self.outlined_text(n, xy);
};
self.typed = true;
self.wrapped_typed |= !t.wrap.is_empty();
if lost {
self.warn(texts::TYPE_ATTRIBUTES);
}
+115 -7
View File
@@ -17,6 +17,7 @@
use std::collections::{HashMap, HashSet};
use std::fmt::Write;
use std::sync::Arc;
use kurbo::{ParamCurveArclen, PathSeg};
use vectorcraft_color::{Color, Paint};
@@ -197,8 +198,8 @@ fn solid(p: &Paint) -> Option<Option<Color>> {
/// Can the text document hold type `t` of object `n` as it is: point type that isn't mirrored, or
/// area type or type on a path that is only moved ([`shape`]); characters other than inline graphics
/// and ruby; solid fills and strokes; no fills, strokes, effects or opacity mask of the object's
/// own; some text.
pub(in crate::ai_editing) fn holds(n: &Node, t: &TextObject) -> bool {
/// own; some text. Area type with wrap shapes only when `wrap_held` ([`wraps_held`]).
pub(in crate::ai_editing) fn holds(n: &Node, t: &TextObject, wrap_held: bool) -> bool {
let xf = t.xf.as_coeffs();
let shape_ok = match &t.kind {
TextKind::Point => xf.iter().all(|v| v.is_finite()) && t.xf.determinant() > 1e-12,
@@ -210,10 +211,9 @@ pub(in crate::ai_editing) fn holds(n: &Node, t: &TextObject) -> bool {
}
};
// Area type with wrap shapes: the text document doesn't hold them. The reader works them out
// again from the art above the type, which can wrap it differently (a live object written as
// its drawn pieces) or not at all.
// again from the art above the type, which wraps it the same only where `wraps_held` says so.
shape_ok
&& t.wrap.is_empty()
&& (t.wrap.is_empty() || wrap_held)
&& t.ruby.is_empty()
&& !t.stacks_warichu()
&& t.runs.iter().any(|r| r.text.chars().any(|c| !c.is_whitespace()))
@@ -324,6 +324,112 @@ fn plain(n: &Node) -> bool {
&& n.extras().mask.is_none()
}
/// The area type of `doc` whose wrap shapes the reader of the editing data works out again as they
/// are ([`vectorcraft_doc::text::resolve_wrap`], which the reader runs on what it reads): the
/// shapes are the ones the wrap objects above it give it now, and each of those objects is written
/// as itself and read back with the same outline and options ([`wrap_source_held`]), in layers
/// and groups written as they are ([`plain_containers`]). `styled`: the objects written with an
/// art style. Empty when the shapes of the document's area type would hold more anchors than the
/// reader copies into them ([`crate::import::MAX_WRAP_WORK`]).
pub(in crate::ai_editing) fn wraps_held(doc: &Document, styled: &HashMap<NodeId, Arc<Node>>) -> HashSet<NodeId> {
let mut held = HashSet::new();
if vectorcraft_doc::text::wrap_work(doc) > crate::import::MAX_WRAP_WORK {
return held;
}
let mut plain_in = HashSet::new();
for layer in &doc.layers {
plain_containers(layer, true, styled, &mut plain_in);
}
let mut checked: HashMap<NodeId, bool> = HashMap::new();
vectorcraft_doc::text::wrap_sources(doc, |n, sources, shapes| {
let NodeKind::Text(t) = &n.kind else { return };
if t.wrap.is_empty() || shapes != t.wrap || !plain_in.contains(&n.id) {
return;
}
let ok = sources.iter().all(|s| *checked.entry(s.id).or_insert_with(|| plain_in.contains(&s.id) && wrap_source_held(s, styled)));
if ok {
held.insert(n.id);
}
});
held
}
/// Adds to `out` the objects with text wrap options and the text objects in `n` (a top-level layer
/// when `top`) that sit only in layers and groups written as they are: layers and sublayers that
/// don't clip and have no effects, and groups that don't clip, have no fills, strokes, effects,
/// art style, opacity mask or graph and aren't written with an art style (`styled`).
fn plain_containers(n: &Node, top: bool, styled: &HashMap<NodeId, Arc<Node>>, out: &mut HashSet<NodeId>) {
let plain = match &n.kind {
NodeKind::Layer { clip, .. } => !clip && n.appearance.effects.is_empty(),
NodeKind::Group { clip, .. } => !top && !clip && n.appearance.items.is_empty() && own_plain(n, styled),
_ => false,
};
if !plain {
return;
}
for c in n.children().map(Vec::as_slice).unwrap_or_default() {
if c.extras().wrap.is_some() || matches!(c.kind, NodeKind::Text(_)) {
out.insert(c.id);
}
plain_containers(c, false, styled, out);
}
}
/// Has object `n` no effects, art style, opacity mask or graph, and isn't it a ruler guide or
/// written with an art style (`styled`)?
fn own_plain(n: &Node, styled: &HashMap<NodeId, Arc<Node>>) -> bool {
!styled.contains_key(&n.id)
&& n.appearance.effects.is_empty()
&& n.appearance.items.iter().all(|i| i.effects().is_empty())
&& n.extras().graphic_style.is_none()
&& n.extras().mask.is_none()
&& n.extras().graph.is_none()
&& !n.is_ruler_guide()
}
/// Is wrap object `n` written as itself and read back with the same outline and text wrap options:
/// an offset the writer and the reader keep as it is (-1000 to 1000 pt) and a plain object
/// ([`plain_wrap_art`])?
fn wrap_source_held(n: &Node, styled: &HashMap<NodeId, Arc<Node>>) -> bool {
n.extras().wrap.is_some_and(|w| w.offset.is_finite() && w.offset.abs() <= 1000.0) && plain_wrap_art(n, styled)
}
/// Is `n` written as one object of its own kind that the reader reads back with the same outline
/// ([`vectorcraft_doc::text::resolve_wrap`]): a path of one subpath, a compound path of visible
/// paths with two subpaths or more in all, each painted with no paint, a solid fill, a plain line of a solid color or both, or a
/// group that doesn't clip of such paths, compound paths and groups (hidden ones too) without text
/// wrap options of their own; each without effects, art style, opacity mask or graph
/// ([`own_plain`]). Each subpath has two anchors or more.
fn plain_wrap_art(n: &Node, styled: &HashMap<NodeId, Arc<Node>>) -> bool {
use vectorcraft_doc::AppearanceItem;
let solid = |p: &Paint| matches!(p, Paint::Solid { .. });
let painted = || match super::visible_items(n).as_slice() {
[] => true,
[AppearanceItem::Fill(f)] => solid(&f.paint),
[AppearanceItem::Stroke(s)] => solid(&s.paint) && vectorcraft_effects::stroke::is_plain(s),
[AppearanceItem::Fill(f), AppearanceItem::Stroke(s)] => solid(&f.paint) && solid(&s.paint) && vectorcraft_effects::stroke::is_plain(s),
_ => false,
};
let whole = |p: &PathData| p.subpaths.iter().all(|sp| sp.anchors.len() >= 2);
own_plain(n, styled)
&& match &n.kind {
NodeKind::Path { path, clipping: false, guide: false, .. } => path.subpaths.len() == 1 && whole(path) && painted(),
// One subpath in all would be written, and read back, as a path.
NodeKind::Compound { children, .. } => {
let subpaths: usize = children.iter().filter_map(|c| c.path_data()).map(|p| p.subpaths.len()).sum();
let members = children.iter().all(|c| {
c.visible
&& matches!(&c.kind, NodeKind::Path { path, clipping: false, guide: false, .. } if !path.subpaths.is_empty() && whole(path))
});
painted() && subpaths > 1 && members
}
NodeKind::Group { children, clip: false } => {
n.appearance.items.is_empty() && children.iter().all(|c| c.extras().wrap.is_none() && plain_wrap_art(c, styled))
}
_ => false,
}
}
/// Is the end bracket of type on an open path so near the path's end that the reader reads it as
/// no bracket (`Story::node`: within 0.02 of a segment)?
fn end_read_as_none(t: &TextObject) -> bool {
@@ -1000,7 +1106,8 @@ impl TextDoc {
/// `thread` (its frames in order, all area type the document holds, the first holding the
/// story) the first time one of its frames is written. `None` when the thread can't be written
/// as one story: `writable` says which frames are written where type can be text (every frame
/// of the thread must be).
/// of the thread must be), and `wraps_held` which frames with wrap shapes the reader wraps the
/// same ([`wraps_held`]; every frame with wrap shapes must be one).
pub(in crate::ai_editing) fn thread(
&mut self,
doc: &Document,
@@ -1008,6 +1115,7 @@ impl TextDoc {
id: NodeId,
canvas: Affine,
writable: &dyn Fn(NodeId) -> bool,
wraps_held: &HashSet<NodeId>,
) -> Option<(usize, usize)> {
let first = *thread.first()?;
if self.planned.insert(first) {
@@ -1026,7 +1134,7 @@ impl TextDoc {
&& t.vertical == vertical
&& writable(n.id)
// The text document doesn't hold wrap shapes (see `holds`).
&& t.wrap.is_empty()
&& (t.wrap.is_empty() || wraps_held.contains(&n.id))
&& plain(n)
&& t.ruby.is_empty()
&& !t.stacks_warichu()
+1 -1
View File
@@ -96,7 +96,7 @@ pub(crate) use ai::{
pub(crate) use ai::{ENVELOPE_DRAWN, ENVELOPE_TYPE_DRAWN};
pub(crate) use ate::{MAX_BYTES as MAX_TEXT_DOCUMENT, MAX_FRAMES, MAX_SEGMENTS, MAX_STORY, MAX_VALUES as MAX_TEXT_VALUES, record_version};
pub use native::{AiLayers, ai_alone, ai_alone_on_page, ai_alone_with, ai_layers_alone, ai_opened_artboard, is_loss, layered_ai, layered_ai_from};
pub(crate) use native::{MAX_TEXT, scale_document, scale_symbols};
pub(crate) use native::{MAX_TEXT, MAX_WRAP_WORK, scale_document, scale_symbols};
pub use text::family_style;
pub(crate) use text::{document_font, postscript_face};
+1 -1
View File
@@ -49,7 +49,7 @@ mod slots;
#[cfg(test)]
use build::{Frame, MADE, prune_unseen};
pub(crate) use build::{scale_document, scale_symbols};
pub(crate) use build::{MAX_WRAP_WORK, scale_document, scale_symbols};
#[cfg(test)]
use compare::{
MAX_DIFFERENCE, MAX_SOLID_DIFFERENCE, PageView, Shares, compare, compared, comparison_render, comparison_samples, differ, differ_in_colour,
+1 -1
View File
@@ -773,7 +773,7 @@ fn settle_warped_type(
}
/// Most anchors copied into the wrap shapes of a file's area type ([`vectorcraft_doc::text::wrap_work`]).
const MAX_WRAP_WORK: usize = 2_000_000;
pub(crate) const MAX_WRAP_WORK: usize = 2_000_000;
/// [`relayout_wrapped`], or an error when the wrap shapes would hold more than [`MAX_WRAP_WORK`]
/// anchors.
+1 -1
View File
@@ -140,7 +140,7 @@ private editing data. VectorCraft:
document's defaults and the normal character style carry 1. A run with both Tate-chu-yoko and Standard Vertical Roman
Alignment is written as Tate-chu-yoko, with the type attributes warning. Type in opacity masks, pattern tiles, symbols and art cut to a
clipping object, mirrored type, turned or unevenly scaled area type and type on a path, area type in an open frame,
type on an open path whose ends meet, area type that flows around a text wrap, type of only white space, threads of
type on an open path whose ends meet, area type whose wrap cannot be reconstructed from plain saved paths, compound paths or groups, type of only white space, threads of
type on a path, threads whose frames differ in orientation, type and stories past the sizes VectorCraft's reader reads, and
type with inline graphics, ruby, gradient or pattern paint or an appearance or opacity mask of its own, other patterns, other clipping objects and live
objects (placed documents included) are written as plain filled and stroked paths, and freeform gradients, gradients along
+1
View File
@@ -1826,6 +1826,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
A PDF-compatible `.ai` saved with Include Editing Data for Other Apps writes point type, area type and type on a path as type in its editing copy, and objects next to it keep their own transparency (`crates/eps/src/ai_editing/tests.rs`, `cmd::fileio::tests_pdfedit::type_comes_back_from_the_editing_copy`; [file-format-parity.md](file-format-parity.md) lists what is written as outlines).
A PDF-compatible `.ai` saved with Include Editing Data for Other Apps keeps the document's variables, data sets and the bindings of objects to variables in its editing copy, in the form the variable library reader above reads, so they come back when the file is opened. Bindings to layers, to type written as outlines, to graphs and to linked images written as other objects, data set values of graphs, and variables, data sets, bindings and values past the writer's limits are left out with a warning (#6024; `crates/eps/src/ai_editing/tests.rs` `variables_data_sets_and_bindings_are_read_back`; `crates/eps/src/ai_editing/writer/variables.rs` lists what is left out).
A PDF-compatible `.ai` saved with Include Editing Data for Other Apps keeps each wrap object's Text Wrap Options in its editing copy: the Offset, positive or negative, and Invert Wrap ([the help page](https://helpx.adobe.com/illustrator/desktop/design-with-text/add-manage-text/wrap-or-unwrap-text-around-objects.html)), in the form the `.ai` reader reads them (`text_wrap` in `crates/eps/src/import/ai/read/document.rs`), so they come back when the file is opened. An offset past the -1000 to 1000 pt the reader keeps is written as the nearer end of that range. On a large canvas the offset is written at the art's scale and comes back at its size. Art the writer draws for an object, such as a blend's steps or a symbol instance written as its art, has only that object's options, and a clipping path written as its fills and its strokes has its options once (`crates/eps/src/ai_editing/tests.rs` `text_wrap_options_are_written_and_read_back`, `drawn_art_keeps_only_its_objects_text_wrap`, `text_wrap_offsets_on_a_large_canvas_come_back_at_their_size`, `text_wrap_options_of_type_and_envelopes_are_read_back`, `a_clipping_path_written_as_its_paint_keeps_one_text_wrap`).
Area type wrapped only by plain saved paths, compound paths or groups remains editable in the `.ai` editing copy when each frame's wrap recomputes unchanged; other wrapped area type remains outlines. The `.ai` reader works the wrap out again from the objects above the type (`resolve_text_wrap` in `crates/eps/src/import/native/build.rs`), so the writer keeps type only where each wrap object is written as itself (one path with no paint, a solid fill or a plain solid stroke, a compound path of visible members, or a group of such objects, without effects, an opacity mask or clipping), its offset is within -1000 to 1000 pt, and the shapes of every area type in the file stay within the 2,000,000 anchors the reader copies; when art is left out at the object limit, such type is written as outlines. This is VectorCraft's own round-trip rule (`crates/eps/src/ai_editing/tests.rs` `area_type_wrapped_by_plain_objects_stays_type`, `area_type_wrapped_by_other_objects_stays_outlines`, `threaded_area_type_wrapped_by_plain_objects_stays_type`, `area_type_wrapped_on_a_large_canvas_stays_type`, `area_type_wrapped_past_the_reader_limit_stays_outlines`, `area_type_wrapped_past_the_object_limit_is_written_as_outlines`).
Type written as its outlines in the editing copy still wraps area type by its bounds, not by its glyphs, when the file is opened: the outlines' group ends with an unpainted rectangle at the type's bounds that carries its Text Wrap Options, in the form the `.ai` reader reads a path's options (`text_wrap` in `crates/eps/src/import/ai/read/document.rs`), and the group keeps the type's name (`crates/eps/src/ai_editing/tests.rs` `type_written_as_outlines_keeps_wrapping_by_its_bounds`).
A symbol instance written as its art, and a blend, mesh, repeat, placed document, intertwine or envelope written as a group of its art, likewise still wraps area type by its bounds when the file is opened, as it did before saving, not by the members of that art: the group starts with the same unpainted rectangle, which takes the object's lock and visibility, and the group keeps the object's name and transparency without options of its own. Area type in that art is above the rectangle, so the rectangle does not wrap it. The rectangle takes its place in the object limit before the art; without room for it, the options are left out with the limit's warning. An object without finite bounds keeps the options on its group. This is VectorCraft's own round-trip rule (`crates/eps/src/ai_editing/tests.rs` `live_art_written_as_a_group_keeps_wrapping_by_its_bounds`, `wrap_bounds_of_live_art_fit_the_object_limit_and_leave_area_type_in_the_art_unwrapped`, `live_art_without_bounds_keeps_its_text_wrap_on_the_group`).
In a `.ai` or EPS opened from its editing data, type has its text object's opacity, blend mode and knockout shape flag, whether it is made from the file's text document or taken from the page, and type made from the text document takes its text object's lock. Where such type has transparency and comes in with other art (the rest of its look, or page type and strokes that go with it), a group of them has it. Where the page draws its type, or the strokes around it, with transparency that is neither its text object's nor its text object's combined with that of the objects around it, the page's type and strokes keep their own instead (`crates/eps/src/import/tests_native.rs`). Where the page draws type of no text object over text objects made from the text document, with their words in any case, that type is theirs as the page draws it and is left out; the page's other type of no text object goes only to text objects whose type the text document can't make, or else is left out with a warning.