File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -2323,13 +2323,11 @@ impl<'a> Face<'a> {
2323
2323
for ( i, var_axis) in self . variation_axes ( ) . into_iter ( ) . enumerate ( ) {
2324
2324
if var_axis. tag == axis {
2325
2325
self . coordinates . data [ i] = var_axis. normalized_value ( value) ;
2326
- }
2327
- }
2328
2326
2329
- // TODO: optimize
2330
- if let Some ( avar ) = self . tables . avar {
2331
- // Ignore error.
2332
- let _ = avar . map_coordinates ( self . coordinates . as_mut_slice ( ) ) ;
2327
+ if let Some ( avar ) = self . tables . avar {
2328
+ let _ = avar . map_coordinate ( self . coordinates . as_mut_slice ( ) , i ) ;
2329
+ }
2330
+ }
2333
2331
}
2334
2332
2335
2333
Some ( ( ) )
Original file line number Diff line number Diff line change @@ -114,13 +114,22 @@ impl<'a> Table<'a> {
114
114
} )
115
115
}
116
116
117
- /// Maps coordinates.
118
- pub fn map_coordinates ( & self , coordinates : & mut [ NormalizedCoordinate ] ) -> Option < ( ) > {
117
+ /// Maps a single coordinate
118
+ pub fn map_coordinate (
119
+ & self ,
120
+ coordinates : & mut [ NormalizedCoordinate ] ,
121
+ coordinate_index : usize ,
122
+ ) -> Option < ( ) > {
119
123
if usize:: from ( self . segment_maps . count ) != coordinates. len ( ) {
120
124
return None ;
121
125
}
122
126
123
- for ( map, coord) in self . segment_maps . into_iter ( ) . zip ( coordinates) {
127
+ if let Some ( ( map, coord) ) = self
128
+ . segment_maps
129
+ . into_iter ( )
130
+ . zip ( coordinates)
131
+ . nth ( coordinate_index)
132
+ {
124
133
* coord = NormalizedCoordinate :: from ( map_value ( & map, coord. 0 ) ?) ;
125
134
}
126
135
You can’t perform that action at this time.
0 commit comments