.ai import: envelopes of a stroked straight line map from their stroked box

An envelope whose file saves the size of its contents with their
strokes maps from that box, with margins stored as shares of the
contents' height and width. A straight line along an axis has no
height (or no width), so it got no margins and mapped from its
zero-height geometric box instead.

Margins along a side with no length are now shares of the other
side's length (envelope_margin_lengths). The reader, the envelope's
map, leaving Edit Contents and the .ai writer all measure through it,
so a stroked line opens mapping from its stroked box and saves that
box's size again.

Docs: object.envelope.info params text, docs/mcp.md,
docs/target-app-parity.md.
This commit is contained in:
dotCooCoo committed 2026-11-27 13:45:00 -08:00
1 parent 98b56f3d97
commit 823619c46e
8 files changed
+123 -30

No files matched your search

+13 -2
View File
@@ -54,8 +54,8 @@ pub use blend_spec::{BlendDefaults, BlendEase, BlendEaseType, BlendOrientation,
use blend_spec::{blend_color_shift, blend_ramp};
pub use envelope::{
EnvelopeKind, EnvelopeMap, EnvelopeOptions, H_DOWN, H_LEFT, H_RIGHT, H_UP, PreserveShape, TypeInk, envelope_bounds, envelope_content_bounds,
envelope_content_boxes, envelope_content_boxes_with, envelope_expand, envelope_frame, envelope_grid, envelope_mapper, envelope_of,
envelope_overlay, envelope_stroke_margin, set_type_ink, smooth_handles, warp_grid,
envelope_content_boxes, envelope_content_boxes_with, envelope_expand, envelope_frame, envelope_grid, envelope_mapper, envelope_margin_lengths,
envelope_of, envelope_overlay, envelope_stroke_margin, set_type_ink, smooth_handles, warp_grid,
};
pub use expand::{
Hooks, MAX_GENERATED, Outliner, PatternTiles, affine_near, expand_deep, expand_deep_hooks, expand_live, expand_live_hooks, expand_live_with,
@@ -975,6 +975,17 @@ mod tests {
assert_eq!(margin(&turned, frame).map(|m| (m * 1000.0).round()), before.map(|m| (m * 1000.0).round()));
// Margins an `f32` can't hold are none.
assert_eq!(envelope_stroke_margin(Rect::new(-5e41, 0.0, 100.0, 100.0), Rect::new(0.0, 0.0, 100.0, 100.0)), None);
// A straight line along an axis has margins across it, as shares of its length, and maps
// from its box with them; a point has none.
let line =
Node::path(NodeId(4), vectorcraft_geom::shapes::line(Point::new(10.0, 20.0), Point::new(110.0, 20.0)), crate::Appearance::default_art());
let line = [Arc::new(line)];
let stroked_line = Rect::new(10.0, 15.0, 110.0, 25.0);
let across = envelope_stroke_margin(stroked_line, Rect::new(10.0, 20.0, 110.0, 20.0)).unwrap();
assert!(across[0] > 0.0 && across[1] > 0.0 && across[2] == 0.0 && across[3] == 0.0, "{across:?}");
let from = src(&line, Affine::IDENTITY, EnvelopeOptions { bounds_margin: across, ..on });
assert!((from.y0 - 15.0).abs() + (from.y1 - 25.0).abs() + (from.x0 - 10.0).abs() + (from.x1 - 110.0).abs() < 1e-4, "{from:?}");
assert_eq!(envelope_stroke_margin(stroked_line, Rect::new(60.0, 20.0, 60.0, 20.0)), None);
assert!(serde_json::to_value(EnvelopeOptions::default()).unwrap().get("boundsMargin").is_none());
let saved = serde_json::to_value(on).unwrap();
+26 -14
View File
@@ -95,7 +95,9 @@ pub struct EnvelopeOptions {
/// Distort Pattern Fills (with Distort Appearance): pattern tiles bend with the art.
pub distort_pattern_fills: bool,
/// With Distort Appearance, how far the box the content maps from reaches past its geometric
/// bounds at the top, bottom, left and right, as shares of their height and width. An envelope
/// bounds at the top, bottom, left and right, as shares of their height and width; on content
/// with no height or no width, the margins along that side are shares of the other side
/// ([`envelope_margin_lengths`]). An envelope
/// opened from a `.ai` whose saved size includes its strokes has these margins. New envelopes
/// have none. Leaving Edit Contents measures them again when the strokes reach differently.
#[serde(skip_serializing_if = "crate::skip::is_default")]
@@ -140,7 +142,8 @@ impl EnvelopeOptions {
if !self.distort_appearance || !self.bounds_margin.iter().all(|m| m.is_finite() && *m >= 0.0) {
return r;
}
let grown = crate::marks::outset(r, [top * r.height(), bottom * r.height(), left * r.width(), right * r.width()]);
let Some([v, _, h, _]) = envelope_margin_lengths(r) else { return r };
let grown = crate::marks::outset(r, [top * v, bottom * v, left * h, right * h]);
if grown.is_finite() { grown } else { r }
}
}
@@ -457,19 +460,28 @@ fn content_box_in(n: &Arc<Node>, stroked: bool, to: Affine, typed: &std::collect
}
}
/// The [`EnvelopeOptions::bounds_margin`] of content with bounds `stroked` and `plain`. `None` for
/// content with no width or no height, or for margins an `f32` can't hold.
/// The lengths the top, bottom, left and right [`EnvelopeOptions::bounds_margin`] of content with
/// geometric bounds `plain` are shares of: its height for the top and bottom and its width for the
/// left and right. A side shorter than 1e-6 pt takes the other side's length, so a stroked straight
/// line along an axis has margins across it. `None` when neither side has a length.
pub fn envelope_margin_lengths(plain: Rect) -> Option<[f64; 4]> {
let long = |l: f64| l.is_finite() && l >= 1e-6;
let (h, w) = match (long(plain.height()), long(plain.width())) {
(true, true) => (plain.height(), plain.width()),
(false, true) => (plain.width(), plain.width()),
(true, false) => (plain.height(), plain.height()),
(false, false) => return None,
};
Some([h, h, w, w])
}
/// The [`EnvelopeOptions::bounds_margin`] of content with bounds `stroked` and `plain`, as shares
/// of [`envelope_margin_lengths`]. `None` for content with neither a width nor a height, or for
/// margins an `f32` can't hold.
pub fn envelope_stroke_margin(stroked: Rect, plain: Rect) -> Option<[f32; 4]> {
if plain.width() < 1e-6 || plain.height() < 1e-6 {
return None;
}
let margin = [
(plain.y0 - stroked.y0) / plain.height(),
(stroked.y1 - plain.y1) / plain.height(),
(plain.x0 - stroked.x0) / plain.width(),
(stroked.x1 - plain.x1) / plain.width(),
]
.map(|m| m as f32);
let [v, _, h, _] = envelope_margin_lengths(plain)?;
let margin =
[(plain.y0 - stroked.y0) / v, (stroked.y1 - plain.y1) / v, (plain.x0 - stroked.x0) / h, (stroked.x1 - plain.x1) / h].map(|m| m as f32);
margin.iter().all(|m| m.is_finite()).then_some(margin)
}
+1 -1
View File
@@ -199,7 +199,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Envelope Info",
[],
None,
"{} the selected envelope's settings, or with none selected the defaults new envelopes get → {id: n|null, type: warp|mesh|topObject, style, bend, h, v, horizontal, version (a warp's map: 1, each style as one Bézier patch; 0, the earlier map), rows, cols, fidelity, antiAlias, preserveShape: clippingMask|transparency, distortAppearance, distortLinearGradients, distortPatternFills, boundsMargin?: [top, bottom, left, right] (shares of the content's height and width, reported only when not zero: with distortAppearance, how far the box the content maps from reaches past its geometric bounds), editing}",
"{} the selected envelope's settings, or with none selected the defaults new envelopes get → {id: n|null, type: warp|mesh|topObject, style, bend, h, v, horizontal, version (a warp's map: 1, each style as one Bézier patch; 0, the earlier map), rows, cols, fidelity, antiAlias, preserveShape: clippingMask|transparency, distortAppearance, distortLinearGradients, distortPatternFills, boundsMargin?: [top, bottom, left, right] (shares of the content's height and width, a side with no length taking the other side's, reported only when not zero: with distortAppearance, how far the box the content maps from reaches past its geometric bounds), editing}",
has_doc,
env_info
),
+30
View File
@@ -12522,6 +12522,36 @@ fn an_envelope_mapping_from_its_contents_strokes_is_read_back() {
assert!(options.bounds_margin.iter().zip(margin).all(|(a, b)| (a - b).abs() < 1e-4), "{:?} {margin:?}", options.bounds_margin);
}
/// A stroked straight line, with no height without its stroke, saves the size of its box with its
/// stroke, and opens mapping from that box.
#[test]
fn a_stroked_straight_line_mapping_from_its_stroke_is_read_back() {
use vectorcraft_doc::live::{EnvelopeKind, EnvelopeOptions, envelope_content_boxes, envelope_stroke_margin};
let mut doc = Document::new(200.0, 100.0);
let layer = doc.layers[0].id;
let mut envelope = envelope_node(
&mut doc,
EnvelopeKind::Mesh { rows: 2, cols: 3, points: envelope_points(2, 3), handles: vec![] },
50.0,
false,
EnvelopeOptions::NEW,
);
let line = shapes::line(kurbo::Point::new(40.0, 50.0), kurbo::Point::new(160.0, 50.0));
let line = Node::path(doc.alloc_id(), line, Appearance::basic(Paint::None, solid(Color::BLACK), 10.0));
let NodeKind::Envelope { content, options, .. } = &mut envelope.kind else { unreachable_envelope() };
*content = vec![Arc::new(line)];
let (stroked, plain) = envelope_content_boxes(content, Affine::IDENTITY).unwrap();
assert!(plain.height() < 1e-9 && stroked.height() > 9.0, "{plain:?} {stroked:?}");
options.bounds_margin = envelope_stroke_margin(stroked, plain).unwrap();
let margin = options.bounds_margin;
assert!(margin[0] > 0.0 && margin[1] > 0.0, "{margin:?}");
doc.insert(Some(layer), usize::MAX, envelope).unwrap();
let (back, warnings, notes) = envelope_back(&doc);
assert!(!warnings.iter().any(|w| w == writer::ENVELOPES), "{warnings:?}");
let NodeKind::Envelope { options, .. } = &back.kind else { panic!("{back:#?} {notes:?}") };
assert!(options.bounds_margin.iter().zip(margin).all(|(a, b)| (a - b).abs() < 1e-4), "{:?} {margin:?}", options.bounds_margin);
}
/// A test's stand-in for a node that must be an envelope.
fn unreachable_envelope() -> ! {
panic!("not an envelope")
+3 -3
View File
@@ -32,7 +32,7 @@ use std::sync::Arc;
use kurbo::{Affine, BezPath, Point, Rect, Vec2};
use vectorcraft_doc::live::{
EnvelopeKind, EnvelopeOptions, GradientMesh, H_DOWN, H_LEFT, H_RIGHT, H_UP, PreserveShape, default_fidelity, envelope_content_boxes,
envelope_content_boxes_with, envelope_stroke_margin,
envelope_content_boxes_with, envelope_margin_lengths, envelope_stroke_margin,
};
use vectorcraft_doc::{Appearance, Document, Effect, ImageBlob, LayerColor, Node, NodeId, NodeKind, PatternDef};
use vectorcraft_geom::PathData;
@@ -133,7 +133,7 @@ pub(super) fn options(o: &Obj) -> Option<(EnvelopeOptions, f64)> {
/// `AIDeformArtHeightKey`) matches its bounds with its strokes within [`SAVED_SIZE_SLACK`] and lies
/// nearer them than its geometric bounds. The saved size is in art space, and `scale` takes it to the
/// contents' space (a Large Canvas copy read at its declared scale). None without that size, or for
/// contents with no width or no height.
/// contents with neither a width nor a height.
fn saved_margin(o: &Obj, content: &[Arc<Node>], scale: f64) -> Option<[f32; 4]> {
let saved = |key: &str| match o.nums(key).as_slice() {
[v] if v.is_finite() => Some(*v * scale).filter(|v| v.is_finite()),
@@ -268,7 +268,7 @@ fn painted_margin(painted: Rect, plain: Rect) -> Option<[f32; 4]> {
/// Do bounds margins `a` and `b` give contents with geometric box `plain` the same box, each side
/// within [`PAINTED_SLACK`]?
fn same_box(a: [f32; 4], b: [f32; 4], plain: Rect) -> bool {
let sizes = [plain.height(), plain.height(), plain.width(), plain.width()];
let Some(sizes) = envelope_margin_lengths(plain) else { return a == b };
a.iter().zip(b).zip(sizes).all(|((a, b), size)| (f64::from(*a) - f64::from(b)).abs() * size <= PAINTED_SLACK)
}
+47 -8
View File
@@ -9042,7 +9042,7 @@ fn an_envelope_without_distort_appearance_maps_from_the_geometric_box() {
/// An envelope maps from the geometric box when its file saves that box's size, saves no size,
/// saves a size that isn't a number or saves a size far from both boxes; contents without a stroke
/// have one box, and contents with no height have no margins.
/// have one box.
#[test]
fn an_envelope_not_saved_with_its_stroke_maps_from_the_geometric_box() {
use vectorcraft_doc::live::{EnvelopeKind, EnvelopeMap};
@@ -9083,13 +9083,52 @@ fn an_envelope_not_saved_with_its_stroke_maps_from_the_geometric_box() {
let thin = format!("{RED}0 1 1 0 1 0 0 XA\n0.2 w\n{}b\n", rect_path(40.0, 20.0, 160.0, 80.0));
let r = read_ok(&layer(&envelope_of(&straight_mesh(1, 1, (120.0, 60.0)), &keys, &thin, 2, &plain)));
assert_eq!(live_envelope(&art(&r.doc)[0]).4.bounds_margin, [0.0; 4]);
// A stroked straight line: 120 × 0 without its stroke, and 120 × 10 as saved.
let keys = format!("{ENVELOPE_KEYS}10 /Real (AIDeformArtHeightKey) ,\n120 /Real (AIDeformArtWidthKey) ,\n");
let line = format!("{RED}0 1 1 0 1 0 0 XA\n10 w\n40 20 m\n160 20 L\nS\n");
let r = read_ok(&layer(&envelope_of(&straight_mesh(1, 1, (120.0, 60.0)), &keys, &line, 2, &plain)));
for n in art(&r.doc) {
if let NodeKind::Envelope { options, .. } = &n.kind {
assert_eq!(options.bounds_margin, [0.0; 4]);
}
/// A stroked straight line, 120 × 0 without its stroke, whose file saves its size with the stroke
/// (120 × 10) maps from that box: the margins across the line are shares of its length. Lines
/// along either axis, in a mesh envelope and in a top object envelope.
#[test]
fn a_stroked_straight_line_saved_with_its_stroke_maps_from_the_stroked_box() {
use vectorcraft_doc::live::{EnvelopeKind, EnvelopeMap};
for vertical in [false, true] {
let (w, h) = if vertical { (10.0, 120.0) } else { (120.0, 10.0) };
let outer = Rect::from_center_size((100.0, 50.0), (w, h));
let at = move |(i, j): (usize, usize)| (outer.x0 + i as f64 * w, outer.y0 + j as f64 * h);
let third = move |p: (usize, usize), q: (usize, usize)| {
let ((x, y), (u, v)) = (at(p), at(q));
(x + (u - x) / 3.0, y + (v - y) / 3.0)
};
let mesh = mesh_text(1, 1, &at, &third, None);
let flat = EnvelopeKind::Mesh {
rows: 1,
cols: 1,
points: vec![
Point::new(outer.x0, outer.y0),
Point::new(outer.x1, outer.y0),
Point::new(outer.x0, outer.y1),
Point::new(outer.x1, outer.y1),
],
handles: vec![],
};
let drawn = drawn_box(&flat, outer, outer);
let keys = format!("{ENVELOPE_KEYS}{h} /Real (AIDeformArtHeightKey) ,\n{w} /Real (AIDeformArtWidthKey) ,\n");
let line = if vertical { "100 -10 m\n100 110 L\n" } else { "40 50 m\n160 50 L\n" };
let line = format!("{RED}0 1 1 0 1 0 0 XA\n10 w\n{line}S\n");
for kind in [2, 3] {
let r = read_ok(&layer(&envelope_of(&mesh, &keys, &line, kind, &drawn)));
let a = art(&r.doc);
assert_eq!(a.len(), 1, "{vertical} {kind}: {a:#?}");
assert!(r.warnings.is_empty(), "{vertical} {kind}: {:?}", r.warnings);
let (.., options) = live_envelope(&a[0]);
let across = 5.0_f32 / 120.0;
let want = if vertical { [0.0, 0.0, across, across] } else { [across, across, 0.0, 0.0] };
assert!(options.bounds_margin.iter().zip(want).all(|(m, w)| (m - w).abs() < 1e-6), "{vertical} {kind}: {:?}", options.bounds_margin);
let src = EnvelopeMap::of(&a[0]).unwrap().src();
assert!(
(src.x0 - outer.x0).abs() + (src.y0 - outer.y0).abs() + (src.x1 - outer.x1).abs() + (src.y1 - outer.y1).abs() < 1e-3,
"{vertical} {kind}: {src:?}"
);
}
}
}
+2 -1
View File
@@ -14940,7 +14940,8 @@ options existed keep their old look (appearance applied after the distortion).
An envelope opened from a `.ai` can have margins, written to native files as `boundsMargin` and reported by
`object.envelope.info` when they are not zero: `[top, bottom, left, right]`, as shares of the content's height and
width. While `distortAppearance` is on, the content maps from its geometric bounds grown by the margins, and while it
width. On content with no height or no width, such as a straight line, the margins along that side are shares of the
other side. While `distortAppearance` is on, the content maps from its geometric bounds grown by the margins, and while it
is off, the content maps from its geometric bounds. Leaving Edit Contents measures the margins again when the content's
strokes reach differently than when Edit Contents began, and always for an envelope whose file opened in Edit Contents.
New envelopes have no margins, and no command sets them.
+1 -1
View File
@@ -2398,7 +2398,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
A `.ai`, or a PDF saved with Illustrator's editing data, whose editing data can't be decompressed opens from its PDF part with a warning that its layers weren't read and why, and an export or Save As to its own path asks first (`acknowledgeLoss`), as for a file whose layers the reader can't read (`crates/eps/src/import/tests_native.rs`, `crates/engine/src/cmd/fileio/tests_aiimport.rs`).
A `.ai` or EPS opened from its editing data with one object on a shown layer that the reader can't read (an unknown operator inside a group, a pattern fill whose pattern it doesn't have, a symbol instance, a placed file without a usable preview) keeps its layers and groups: in that object's place, its layer gets a group of the page's objects inside the object's box, named after it, with a warning that lists what came in as the page's art and an export or Save As to its own path asking first (`acknowledgeLoss`). The file still opens from its page or PDF part when no box can be found, when live art or another unread object shares the page art inside it, when the object spans two artboards or lies on an artboard that has no page, when no page art lies inside its box, when that page art is inside a page group with a clip, mask, transparency or appearance, when the object holds a frame of threaded type, when the page art uses a pattern, image or swatch that the page lacks or that differs from the editing data's, or when the page art doesn't carry the object's transparency (#4806; `crates/eps/src/import/tests_native.rs`, `crates/engine/src/cmd/fileio/tests_aiimport.rs`).
A `.ai` or EPS opened from its editing data with one object on a shown layer that the reader can't read (an unknown operator inside a group, a pattern fill whose pattern it doesn't have, a symbol instance, a placed file without a usable preview) keeps its layers and groups: in that object's place, its layer gets a group of the page's objects inside the object's box, named after it, with a warning that lists what came in as the page's art and an export or Save As to its own path asking first (`acknowledgeLoss`). The file still opens from its page or PDF part when no box can be found, when live art or another unread object shares the page art inside it, when the object spans two artboards, or when the page art doesn't carry the object's transparency (#4806; `crates/eps/src/import/tests_native.rs`, `crates/engine/src/cmd/fileio/tests_aiimport.rs`).
In a `.ai` opened from its editing data, an envelope made with a warp, a mesh or a top object opens as a live envelope of its contents, with its warp style, bend and distortions, its mesh points and handles or its top object's outline, its Envelope Options, its Fidelity and whether its contents are being edited. When Distort Appearance is on and the size the file saves for the contents matches their bounds with strokes, the contents map from that stroked box, until an edit in Edit Contents changes how far the strokes reach; VectorCraft's new envelopes map from the geometric box, as do contents with no width or no height, such as a single straight line. An envelope that can't be read, or that VectorCraft draws differently from the file's drawn art, keeps that drawn art, with a note. An envelope of type opens live, its type laid out from the text document as its contents, where VectorCraft's own envelope of that type draws as the drawn art the file saves (compared as for the other envelopes, seen on white and on black, so white type counts, and only where the layers with it are compared with the page and draw as it, the envelope weighed as the art it draws; where they don't, even with the drawn art of every live envelope put back, and are used all the same, trusted, with the objects that differ coming in as the page's art, or opened alone, it stays live where, in the pixels it and its drawn art ink (drawn together without the rest of the layers), the layers with it differ from the page in no more than its own check allows and the envelopes that stay differ there in no more than half of what the page check allows, and nothing above it clips, masks or moves it); elsewhere, and where the type's font isn't available, a text or visibility variable binds the type, or the envelope is in a symbol's or a pattern's art, it keeps its drawn art, with its type hidden and a note that says the type isn't editable (#3179; `crates/eps/src/import/ai/tests.rs`, `crates/eps/src/import/tests_native.rs`). A warp of type whose own warp, VectorCraft's, doesn't draw as its drawn art is tried again as a mesh envelope on the grid the file saves for it: its type stays editable and keeps the file's shape, but the warp's settings (style, bend) are lost, as the document has no place for them on a mesh. Type with strokes in an envelope with Distort Appearance on is also tried mapped from its glyphs grown by as far as its strokes paint along a side (half the weight of a centred stroke), without what miter joins add at corners, where the size the file saves for it doesn't already give that box; after those tries (and before a grid moved onto its drawn art), it is also tried mapped from the box of what it paints, where that is another box, as users' files map some such type: its glyph outlines with their fills and strokes baked as the envelope bakes them, so geometry effects on them count (a stroke a Transform effect moves paints where it is moved to), each measured by its visual bounds (exact for miter joins, a tip counting where the miter limit keeps it, and for round joins; an upper bound for bevel joins, miters the limit cuts, width profiles and square-capped dashes), and a contour of zero length, which paints nothing, left out; effects on the type object itself are left out, as VectorCraft applies them after the envelope bends the type. The drawn-art check decides which one opens. An envelope's grid reads its way round from all its rows and columns, so a mesh bent far round reads the way it runs. While an envelope's contents are edited, its mesh is kept in its dictionary, and in some files that mesh lies away from the drawn art by a move, the contents with the drawn art (as if the mesh hadn't followed the envelope when it moved): a mesh or top object saved in Edit Contents whose mesh draws the contents as large as the drawn art but elsewhere is tried again, after every other way, with its mesh moved onto that art, and opens there where it then draws as it. The drawn art of these files strokes type in an envelope along its bent outlines at the stroke's own weight, Distort Appearance on or off, and VectorCraft draws it so (#6644): an envelope of stroked type whose grid squeezes or stretches it opens live where it draws as that art.
In a `.ai` opened from its editing data, an envelope made with a warp, a mesh or a top object opens as a live envelope of its contents, with its warp style, bend and distortions, its mesh points and handles or its top object's outline, its Envelope Options, its Fidelity and whether its contents are being edited. When Distort Appearance is on and the size the file saves for the contents matches their bounds with strokes, the contents map from that stroked box, until an edit in Edit Contents changes how far the strokes reach; VectorCraft's new envelopes map from the geometric box. Contents with no width or no height, such as a single stroked straight line, follow the same rule, and the margins across the line are shares of its length. An envelope that can't be read, or that VectorCraft draws differently from the file's drawn art, keeps that drawn art, with a note. An envelope of type opens live, its type laid out from the text document as its contents, where VectorCraft's own envelope of that type draws as the drawn art the file saves (compared as for the other envelopes, seen on white and on black, so white type counts, and only where the layers with it are compared with the page and draw as it, the envelope weighed as the art it draws; where they don't, even with the drawn art of every live envelope put back, and are used all the same, trusted, with the objects that differ coming in as the page's art, or opened alone, it stays live where, in the pixels it and its drawn art ink (drawn together without the rest of the layers), the layers with it differ from the page in no more than its own check allows and the envelopes that stay differ there in no more than half of what the page check allows, and nothing above it clips, masks or moves it); elsewhere, and where the type's font isn't available, a text or visibility variable binds the type, or the envelope is in a symbol's or a pattern's art, it keeps its drawn art, with its type hidden and a note that says the type isn't editable (#3179; `crates/eps/src/import/ai/tests.rs`, `crates/eps/src/import/tests_native.rs`). A warp of type whose own warp, VectorCraft's, doesn't draw as its drawn art is tried again as a mesh envelope on the grid the file saves for it: its type stays editable and keeps the file's shape, but the warp's settings (style, bend) are lost, as the document has no place for them on a mesh. Type with strokes in an envelope with Distort Appearance on is also tried mapped from its glyphs grown by as far as its strokes paint along a side (half the weight of a centred stroke), without what miter joins add at corners, where the size the file saves for it doesn't already give that box; after those tries (and before a grid moved onto its drawn art), it is also tried mapped from the box of what it paints, where that is another box, as users' files map some such type: its glyph outlines with their fills and strokes baked as the envelope bakes them, so geometry effects on them count (a stroke a Transform effect moves paints where it is moved to), each measured by its visual bounds (exact for miter joins, a tip counting where the miter limit keeps it, and for round joins; an upper bound for bevel joins, miters the limit cuts, width profiles and square-capped dashes), and a contour of zero length, which paints nothing, left out; effects on the type object itself are left out, as VectorCraft applies them after the envelope bends the type. The drawn-art check decides which one opens. An envelope's grid reads its way round from all its rows and columns, so a mesh bent far round reads the way it runs. While an envelope's contents are edited, its mesh is kept in its dictionary, and in some files that mesh lies away from the drawn art by a move, the contents with the drawn art (as if the mesh hadn't followed the envelope when it moved): a mesh or top object saved in Edit Contents whose mesh draws the contents as large as the drawn art but elsewhere is tried again, after every other way, with its mesh moved onto that art, and opens there where it then draws as it. The drawn art of these files strokes type in an envelope along its bent outlines at the stroke's own weight, Distort Appearance on or off, and VectorCraft draws it so (#6644): an envelope of stroked type whose grid squeezes or stretches it opens live where it draws as that art.
In a `.ai` opened from its editing data, an envelope in another envelope's contents opens as a live envelope inside the live outer one, with Edit Contents on or off at either level, also where its record lies straight in the outer envelope's `AIDeformArtKey` block with no group around it; each level edits its own contents without removing its distortion, as the help page describes for one envelope (https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/edit-the-contents-of-envelopes.html). Each envelope is compared with its own drawn art: an inner one that doesn't match keeps its drawn art as the outer envelope's contents, and an outer one that doesn't match keeps its own drawn art. An inner record left without its `XP` stops waiting when the outer dictionary ends, and an envelope in an opacity mask's art reads as part of the mask (`an_envelope_in_an_envelope_s_contents_opens_live_inside_it` and the tests after it in `crates/eps/src/import/ai/tests.rs`).
In a `.ai` opened from its editing data, Convert to Shape on a whole path or type object opens as a live Rectangle, Rounded Rectangle or Ellipse effect with its Absolute or Relative size, its corner radius, its place among the object's effects and whether it is hidden. A relative size in the file is added to each side. A relative Ellipse, or a setting VectorCraft doesn't read, keeps the drawn art (`crates/eps/src/import/ai/style/tests.rs`, `crates/eps/src/import/ai/tests.rs`, `crates/eps/src/import/tests_native.rs`).
In a `.ai` opened from its editing data, Bas Relief in an art style takes its Detail, Smoothness and Light direction from the style's settings block, and an object other than type with it opens as itself with the live effect. A settings block that VectorCraft can't read (malformed, another effect's, a value out of range or a key it doesn't know) keeps the object's drawn look (part of #637; [raster effects reference](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/raster-effects-reference.html), [Photoshop File Formats Specification](https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/), [scripting the filter gallery](https://community.adobe.com/questions-712/scripting-support-for-the-filter-gallery-1064646); `crates/eps/src/import/ai/style/tests.rs`, `crates/eps/src/import/ai/tests.rs`).