@@ -30,10 +30,15 @@ impl<Upstream: Default + 'static> PathBuilder<Upstream> {
3030 }
3131 }
3232
33+ fn point ( & self , x : f32 , y : f32 ) -> Point {
34+ Point :: new ( x as f64 , -y as f64 )
35+ }
36+
3337 pub fn draw_glyph ( & mut self , glyph : & OutlineGlyph < ' _ > , size : f32 , normalized_coords : & [ NormalizedCoord ] , style_skew : Option < DAffine2 > , final_transform : DAffine2 , per_glyph_instances : bool ) {
3438 self . origin = final_transform. translation ;
3539 self . glyph_subpaths . clear ( ) ;
3640 self . current_segments . clear ( ) ;
41+ self . current_point = Point :: ZERO ;
3742
3843 let settings = DrawSettings :: unhinted ( Size :: new ( size) , normalized_coords) ;
3944 glyph. draw ( settings, self ) . unwrap ( ) ;
@@ -101,26 +106,26 @@ impl<Upstream: Default + 'static> OutlinePen for PathBuilder<Upstream> {
101106 self . glyph_subpaths . push ( Subpath :: from_beziers ( & self . current_segments , false ) ) ;
102107 self . current_segments . clear ( ) ;
103108 }
104- self . current_point = Point :: new ( x as f64 , y as f64 ) ;
109+ self . current_point = self . point ( x , y) ;
105110 }
106111
107112 fn line_to ( & mut self , x : f32 , y : f32 ) {
108- let p = Point :: new ( x as f64 , y as f64 ) ;
113+ let p = self . point ( x , y) ;
109114 self . current_segments . push ( PathSeg :: Line ( kurbo:: Line :: new ( self . current_point , p) ) ) ;
110115 self . current_point = p;
111116 }
112117
113118 fn quad_to ( & mut self , cx0 : f32 , cy0 : f32 , x : f32 , y : f32 ) {
114- let p1 = Point :: new ( cx0 as f64 , cy0 as f64 ) ;
115- let p2 = Point :: new ( x as f64 , y as f64 ) ;
119+ let p1 = self . point ( cx0, cy0) ;
120+ let p2 = self . point ( x , y) ;
116121 self . current_segments . push ( PathSeg :: Quad ( kurbo:: QuadBez :: new ( self . current_point , p1, p2) ) ) ;
117122 self . current_point = p2;
118123 }
119124
120125 fn curve_to ( & mut self , cx0 : f32 , cy0 : f32 , cx1 : f32 , cy1 : f32 , x : f32 , y : f32 ) {
121- let p1 = Point :: new ( cx0 as f64 , cy0 as f64 ) ;
122- let p2 = Point :: new ( cx1 as f64 , cy1 as f64 ) ;
123- let p3 = Point :: new ( x as f64 , y as f64 ) ;
126+ let p1 = self . point ( cx0, cy0) ;
127+ let p2 = self . point ( cx1, cy1) ;
128+ let p3 = self . point ( x , y) ;
124129 self . current_segments . push ( PathSeg :: Cubic ( kurbo:: CubicBez :: new ( self . current_point , p1, p2, p3) ) ) ;
125130 self . current_point = p3;
126131 }
0 commit comments