robotools/fontMath

Rounding is done using fontTools.misc.py23.round3 instead of fontTools.misc.fixedTools.otRound

Closed this issue · 1 comments

madig commented

This is problematic, as varLib uses otRound, so static instances do not exactly match their cousins inside a variable font made with varLib. In testing this with Cantarell, I found a large number of off-by-ones between the two rounding methods.

Simply swapping the methods out doesn't work, as round3() takes an ndigits argument, while otRound doesn't. Maybe as a compromise, round3() can be used when there is an ndigits argument, otherwise otRound? Can provide PR.

Edit: although, varLib is not the only possible user. I haven't looked at mutatorMath.

i think it should be ok using the round3 when ndigits is not None, else doins the same as fontTools otRound (i.e. int(math.floor(value + 0.5))) when rounding to full integers.