use fontcull_skrifa::outline::OutlinePen; use kurbo::BezPath; pub struct PathPen { pub path: BezPath, } impl PathPen { pub fn new() -> Self { Self { path: BezPath::new(), } } } impl OutlinePen for PathPen { fn move_to(&mut self, x: f32, y: f32) { self.path.move_to((x as f64, y as f64)); } fn line_to(&mut self, x: f32, y: f32) { self.path.line_to((x as f64, y as f64)); } fn quad_to(&mut self, cx0: f32, cy0: f32, x: f32, y: f32) { self.path .quad_to((cx0 as f64, cy0 as f64), (x as f64, y as f64)); } fn curve_to(&mut self, cx0: f32, cy0: f32, cx1: f32, cy1: f32, x: f32, y: f32) { self.path.curve_to( (cx0 as f64, cy0 as f64), (cx1 as f64, cy1 as f64), (x as f64, y as f64), ); } fn close(&mut self) { self.path.close_path(); } }