Skip to content

Commit 2ee4431

Browse files
committed
Handle transforms correctly when decomposing
1 parent 0463a58 commit 2ee4431

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

profile-universal/src/checks/transformed_components.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -226,20 +226,19 @@ fn flatten_component(
226226
let glyph = glyphs
227227
.get(&GlyphId::from(component.glyph))
228228
.ok_or("glyph not found")?;
229+
let my_transform = to_kurbo_transform(&component.transform, &component.anchor);
230+
229231
Ok(match glyph {
230232
WriteGlyph::Empty => vec![],
231-
WriteGlyph::Simple(_) => vec![(
232-
component.glyph.into(),
233-
to_kurbo_transform(&component.transform, &component.anchor),
234-
)],
233+
WriteGlyph::Simple(_) => {
234+
vec![(component.glyph.into(), my_transform)]
235+
}
235236
WriteGlyph::Composite(composite_glyph) => {
236237
let mut all_flattened_components = vec![];
237238
for component in composite_glyph.components() {
238239
all_flattened_components.extend(flatten_component(glyphs, component)?.iter().map(
239240
|(gid, transform)| {
240-
let new_transform =
241-
to_kurbo_transform(&component.transform, &component.anchor)
242-
* *transform;
241+
let new_transform = my_transform * *transform;
243242
(*gid, new_transform)
244243
},
245244
));

0 commit comments

Comments
 (0)