Skip to content

Commit

Permalink
Fix transformation in COLR fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV authored Jun 11, 2024
1 parent ba1be45 commit ef1905c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Binary file modified crates/resvg/tests/tests/text/color-font/colrv1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion crates/usvg/src/text/colr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ impl<'a> GlyphPainter<'a> {
let gradient_id = format!("rg{}", self.gradient_index);
self.gradient_index += 1;

let gradient_transform = paint_transform(self.outline_transform, self.transform);

self.svg.start_element("radialGradient");
self.svg.write_attribute("id", &gradient_id);
self.svg.write_attribute("cx", &gradient.x1);
Expand All @@ -164,7 +166,7 @@ impl<'a> GlyphPainter<'a> {
self.svg.write_attribute("gradientUnits", &"userSpaceOnUse");
self.svg.write_spread_method_attribute(gradient.extend);
self.svg
.write_transform_attribute("gradientTransform", self.transform);
.write_transform_attribute("gradientTransform", gradient_transform);
self.write_gradient_stops(
gradient.stops(self.palette_index, self.face.variation_coordinates()),
);
Expand Down

0 comments on commit ef1905c

Please sign in to comment.