@@ -50,16 +50,14 @@ impl PathBuilder {
50
50
}
51
51
52
52
if per_glyph_instances {
53
- if !self . glyph_subpaths . is_empty ( ) {
54
- self . vector_table . push ( Instance {
55
- instance : VectorData :: from_subpaths ( core:: mem:: take ( & mut self . glyph_subpaths ) , false ) ,
56
- transform : DAffine2 :: from_translation ( glyph_offset) ,
57
- ..Default :: default ( )
58
- } )
59
- }
60
- } else if !self . glyph_subpaths . is_empty ( ) {
61
- for subpath in self . glyph_subpaths . iter ( ) {
62
- // Unwrapping here is ok, since the check above guarantees there is at least one `VectorData`
53
+ self . vector_table . push ( Instance {
54
+ instance : VectorData :: from_subpaths ( core:: mem:: take ( & mut self . glyph_subpaths ) , false ) ,
55
+ transform : DAffine2 :: from_translation ( glyph_offset) ,
56
+ ..Default :: default ( )
57
+ } ) ;
58
+ } else {
59
+ for subpath in self . glyph_subpaths . drain ( ..) {
60
+ // Unwrapping here is ok because `self.vector_table` is initialized with a single `VectorData`
63
61
self . vector_table . get_mut ( 0 ) . unwrap ( ) . instance . append_subpath ( subpath, false ) ;
64
62
}
65
63
}
@@ -128,18 +126,26 @@ fn render_glyph_run(glyph_run: &GlyphRun<'_, ()>, path_builder: &mut PathBuilder
128
126
129
127
// User-requested tilt applied around baseline to avoid vertical displacement
130
128
// Translation ensures rotation point is at the baseline, not origin
131
- let skew = DAffine2 :: from_translation ( DVec2 :: new ( 0. , run_y as f64 ) )
132
- * DAffine2 :: from_cols_array ( & [ 1. , 0. , -tilt. to_radians ( ) . tan ( ) , 1. , 0. , 0. ] )
133
- * DAffine2 :: from_translation ( DVec2 :: new ( 0. , -run_y as f64 ) ) ;
129
+ let skew = if per_glyph_instances {
130
+ DAffine2 :: from_cols_array ( & [ 1. , 0. , -tilt. to_radians ( ) . tan ( ) , 1. , 0. , 0. ] )
131
+ } else {
132
+ DAffine2 :: from_translation ( DVec2 :: new ( 0. , run_y as f64 ) )
133
+ * DAffine2 :: from_cols_array ( & [ 1. , 0. , -tilt. to_radians ( ) . tan ( ) , 1. , 0. , 0. ] )
134
+ * DAffine2 :: from_translation ( DVec2 :: new ( 0. , -run_y as f64 ) )
135
+ } ;
134
136
135
137
let synthesis = run. synthesis ( ) ;
136
138
137
139
// Font synthesis (e.g., synthetic italic) applied separately from user transforms
138
140
// This preserves the distinction between font styling and user transformations
139
141
let style_skew = synthesis. skew ( ) . map ( |angle| {
140
- DAffine2 :: from_translation ( DVec2 :: new ( 0. , run_y as f64 ) )
141
- * DAffine2 :: from_cols_array ( & [ 1. , 0. , -angle. to_radians ( ) . tan ( ) as f64 , 1. , 0. , 0. ] )
142
- * DAffine2 :: from_translation ( DVec2 :: new ( 0. , -run_y as f64 ) )
142
+ if per_glyph_instances {
143
+ DAffine2 :: from_cols_array ( & [ 1. , 0. , -angle. to_radians ( ) . tan ( ) as f64 , 1. , 0. , 0. ] )
144
+ } else {
145
+ DAffine2 :: from_translation ( DVec2 :: new ( 0. , run_y as f64 ) )
146
+ * DAffine2 :: from_cols_array ( & [ 1. , 0. , -angle. to_radians ( ) . tan ( ) as f64 , 1. , 0. , 0. ] )
147
+ * DAffine2 :: from_translation ( DVec2 :: new ( 0. , -run_y as f64 ) )
148
+ }
143
149
} ) ;
144
150
145
151
let font = run. font ( ) ;
0 commit comments