mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-12 00:40:57 -06:00
Type: emoji go with type that effects reshape and Expand Appearance
Squashed from #3879 onto main.
This commit is contained in:
@@ -145,8 +145,9 @@ pub(crate) fn glyph_outlines(t: &vectorcraft_doc::TextObject) -> (Vec<kurbo::Bez
|
||||
(runs, all)
|
||||
}
|
||||
|
||||
/// [`glyph_outlines`], the bounds of `t`'s layout in text space, and the art of its colour glyphs
|
||||
/// (COLR layers, SVG documents), which have no outlines, placed in the document, with their runs.
|
||||
/// [`glyph_outlines`], the bounds of `t`'s layout in text space, and its colour glyphs, which have
|
||||
/// no outlines, placed in the document with their runs: bitmap glyphs (emoji) as images holding
|
||||
/// their pixels, then COLR and SVG glyphs as their art, as the renderer paints them.
|
||||
fn laid_out(t: &vectorcraft_doc::TextObject) -> (Vec<kurbo::BezPath>, kurbo::BezPath, Rect, Vec<(usize, Node)>) {
|
||||
let db = vectorcraft_text::FontDb::global();
|
||||
let layout = vectorcraft_text::layout(db, t);
|
||||
@@ -165,14 +166,15 @@ fn laid_out(t: &vectorcraft_doc::TextObject) -> (Vec<kurbo::BezPath>, kurbo::Bez
|
||||
}
|
||||
all.extend(bar.iter());
|
||||
}
|
||||
let colours = layout.glyphs.iter().filter_map(|g| Some((g.run, g.placed_colour(t.xf)?))).collect();
|
||||
let images = layout.glyphs.iter().filter_map(|g| Some((g.run, g.placed_image_node(t.xf)?)));
|
||||
let colours = images.chain(layout.glyphs.iter().filter_map(|g| Some((g.run, g.placed_colour(t.xf)?)))).collect();
|
||||
(runs, all, layout.bounds, colours)
|
||||
}
|
||||
|
||||
/// Type as glyph outlines in document space: one path per run with the run's fill and stroke,
|
||||
/// its colour glyphs' art, and (when the object has its own fills/strokes) the whole outline with
|
||||
/// the object's items below the characters under them and the others over them, as the renderer
|
||||
/// paints them. Each run's path is placed by the type's transform, which also scales its stroke
|
||||
/// over its colour glyphs (images, art), and (when the object has its own fills/strokes) the whole
|
||||
/// outline with the object's items below the characters under them and the others over them, as
|
||||
/// the renderer paints them. Each run's path is placed by the type's transform, which also scales its stroke
|
||||
/// weights and dashes and transforms its pattern tiles; its unplaced gradients are first fixed to
|
||||
/// the layout's bounds in text space. The object's own unplaced gradients are fixed to the
|
||||
/// bounding box of those bounds in the document. The group is marked as type's outlines
|
||||
|
||||
@@ -262,6 +262,7 @@ fn stacked_transform_copies_stay_within_the_image_budget() {
|
||||
xf: Affine::translate((10.0, 0.0)),
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
})),
|
||||
)
|
||||
};
|
||||
@@ -458,6 +459,7 @@ fn transform_on_a_group_moves_and_copies_its_images() {
|
||||
xf: Affine::translate((10.0, 0.0)),
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
})),
|
||||
);
|
||||
let mut g = Node::group(id, vec![Arc::new(sq), Arc::new(image)]);
|
||||
@@ -479,6 +481,7 @@ fn transform_on_a_group_moves_and_copies_its_images() {
|
||||
xf: Affine::translate((10.0, 0.0)),
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
})),
|
||||
))],
|
||||
);
|
||||
@@ -531,6 +534,7 @@ fn images_and_symbol_instances_share_the_copy_budget() {
|
||||
xf: Affine::translate((10.0, 0.0)),
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
})),
|
||||
);
|
||||
let instance = Node::new(id, NodeKind::SymbolInstance { symbol: "s".into(), xf: Affine::IDENTITY });
|
||||
@@ -560,6 +564,7 @@ fn transform_copies_of_images_stop_at_the_reach_limit() {
|
||||
xf: Affine::translate((10.0, 0.0)),
|
||||
link: None,
|
||||
placement: Default::default(),
|
||||
pixels: None,
|
||||
})),
|
||||
);
|
||||
let mut g = Node::group(id, vec![Arc::new(image)]);
|
||||
|
||||
Reference in New Issue
Block a user