Skip to content

Commit

Permalink
[write-fonts] iup: fixup vector distance calculation
Browse files Browse the repository at this point in the history
We were checking the axes independently, instead of checking the overall
length of the vector.
  • Loading branch information
cmyr committed Sep 27, 2023
1 parent c922bae commit d7387bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion write-fonts/src/tables/gvar/iup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ fn can_iup_in_between(
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.powi(2)))
}

/// <https://github.com/fonttools/fonttools/blob/6a13bdc2e668334b04466b288d31179df1cff7be/Lib/fontTools/varLib/iup.py#L327>
Expand Down

0 comments on commit d7387bc

Please sign in to comment.