Repository navigation
.ai import: stroked type in an envelope maps from its glyphs grown by half its stroke - #6535
Conversation
… half its stroke With Distort Appearance, the stroked candidate for type in an envelope mapped from the type's bounds with strokes, which for a stroke on the type's appearance (or on a group round it) reach as far as a miter join may at a corner, the miter limit times half the weight. In users' files the drawn art maps from the glyphs grown by what the strokes paint along a side: half the weight of a centred stroke. The candidate now uses that box. Character strokes keep the measure the type's bounds with strokes already give them (they have no miter allowance), and other objects in the contents keep their bounds with strokes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Merged, thanks @jmverges! It passed its CI checks. |
…what it paints (#6824) With Envelope Options > Distort Appearance on, the import tries type in an envelope mapped from its glyphs, and from its glyphs grown by half its strokes' weight (#6535), on its own warp and on its saved grid. In users' files the drawn art of some stroked type maps from the box of what the type paints instead, which differs from those where: - the type has sharp corners at its edges (slanted stems, pointed feet) and miter joins: the miter tip pokes out past half the weight, as far as the miter limit lets it, though not as far as the bounds with strokes allow (a miter at every corner); - a stroke carries a Transform effect that moves it (a drop shadow): the moved stroke paints past the glyphs on that side; - a glyph holds a contour of zero length at its edge, which paints nothing: the glyphs' box counts it. Such an envelope failed the drawn-art check and kept its drawn art. After every way it was tried before, and before a grid moved onto its drawn art, the envelope is now also tried mapped from what its type paints, where that box is another: its glyph outlines with their fills and strokes baked as the envelope bakes them under Distort Appearance (geometry effects applied), each piece measured by its visual bounds. Those are exact for miter joins (a tip counts where the limit keeps it) and round joins, and an upper bound for bevel joins, miters the limit cuts, width profiles and square-capped dashes. Effects on the type object itself are left out, as VectorCraft applies them after the envelope bends the type. Groups round type and other objects in the contents are measured as before. A side within 1e-4 pt of another box's counts as that side, so a box measured two ways isn't tried twice. The box is measured only when its try comes and a check is left for it, and once for an envelope: on a synthetic file of 256 envelopes of 2,000 characters each the import takes 13.3 s, as before, where measuring it up front took 14.7 s. On 224 of our own files (used locally, never committed), envelopes of type that open live go from 154 in 45 files to 161 in 50, none fewer in any file; no file changes whether it opens from its layers or its PDF part. Tests: ai::envelope::tests:: mitred_type_is_also_tried_mapped_from_what_its_stroke_paints_miter_tips_included, type_with_a_mitred_character_stroke_is_also_tried_mapped_from_what_it_paints, a_stroke_moved_by_a_transform_effect_counts_where_it_paints, round_joined_type_is_not_tried_twice_for_the_same_box, a_contour_of_zero_length_paints_nothing, a_side_within_the_slack_of_the_geometric_box_is_that_side, and tests_native::a_warp_of_mitred_type_maps_from_what_its_stroke_paints_where_its_drawn_art_does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What and why
Part of #3179. Follows #6508.
#6508 tries stroked type in an envelope with Distort Appearance on a second time, mapped from the type's bounds with strokes. For a stroke on the type's appearance, or on a group round it, those bounds reach as far as a miter join may at a corner: the miter limit times half the weight. In our files the drawn art maps from a smaller box, the glyphs grown by what the strokes paint along a side (half the weight of a centred stroke). On one design the bounds-with-strokes candidate is 13 times over the drawn-art threshold; the half-stroke box is at 0.19 of it.
The candidate now maps from that box (
half_stroked_box):side_reach;side_reach;Character-stroke-only type maps from the same box as before, upright, turned or stretched.
How it was tested
ai::envelope::tests::stroked_type_is_tried_mapped_from_its_glyphs_grown_by_half_its_stroke(an appearance stroke with miter joins) anda_stroke_on_a_group_of_type_grows_the_box_by_half_its_weightfail with the full-reach box.type_with_a_character_stroke_is_tried_mapped_from_its_bounds_with_strokespins down that character strokes keep their box, for upright, turned and stretched type. It failed against a first version that scaled character strokes by the transform's row sums.mainat 99cbdf9: fmt, clippy, the workspace tests, doctests, layers and wasm pass. The othercargo xtask cisteps (no-bundled-fonts, pdf-deps, assets, brands, cursors, i18n-report) passed on the same change on top of .ai import: warps of type open as mesh envelopes on their saved grid #6508. After rebasing again on the latestmainI re-ran fmt, clippy andcargo test -p vectorcraft-eps(1387 passed). As before, I skippedvectorcraft-text'stests::harakat::coloured_harakat_keep_kashida, which picks up the Arial installed here.vectorcraft-eps's wall-clock testmany_tiling_patterns_and_spot_inks_read_in_linear_timetimed out once under load in a full run, and passes alone.mainwith .ai import: warps of type open as mesh envelopes on their saved grid #6508: envelopes of type that open live go from 113 to 120 (of 203). All 7 are warps in one file. No file loses a live envelope.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm), apart from the one machine-specificvectorcraft-texttest above.unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md(none added).Summary by CodeRabbit
.aiand EPS files. Text bounds now account for stroke weight and appearance strokes, including strokes on groups, helping preserve the expected envelope appearance.