diff --git a/src/fontations/lib.rs b/src/fontations/lib.rs index ee4ed863a..291ec51af 100644 --- a/src/fontations/lib.rs +++ b/src/fontations/lib.rs @@ -502,8 +502,8 @@ impl ColorPainter for HbColorPainter { p0.y, p1.x, p1.y, - p1.x, // TODO: Where's p2? - p1.y, // TODO: Where's p2? + p0.x, // TODO: Where's p2? + p0.y, ); } } @@ -548,6 +548,12 @@ impl ColorPainter for HbColorPainter { let mut color_line = self.make_color_line(&color_stops); let start_angle = start_angle.to_radians(); let end_angle = end_angle.to_radians(); + // Skrifa has this gem, so we swap end_angle and start_angle + // when passing to our API: + // + // * Convert angles and stops from counter-clockwise to clockwise + // * for the shader if the gradient is not already reversed due to + // * start angle being larger than end angle. unsafe { hb_paint_sweep_gradient( self.paint_funcs, @@ -555,7 +561,7 @@ impl ColorPainter for HbColorPainter { &mut color_line, c0.x, c0.y, - end_angle, // TODO Don't know why end_angle and start_angle are swapped, but produces correct results + end_angle, start_angle, ); }