diff --git a/write-fonts/src/tables/gvar/iup.rs b/write-fonts/src/tables/gvar/iup.rs index 14fd8466e..72a69860a 100644 --- a/write-fonts/src/tables/gvar/iup.rs +++ b/write-fonts/src/tables/gvar/iup.rs @@ -302,10 +302,12 @@ fn can_iup_in_between( let real_values = &deltas[(from + 1) as usize..to]; + // compute this once here instead of in the loop + let tolerance_sq = tolerance.powi(2); Ok(real_values .iter() .zip(iup_values) - .all(|(d, i)| (d.x - i.x).abs() <= tolerance && (d.y - i.y).abs() <= tolerance)) + .all(|(d, i)| (*d - i).hypot2() <= tolerance_sq)) } ///