[t2CharStringPen] use abs() instead of math.fabs()

abs ends up calling fabs for floats anyway, and is a bit faster if 'number' is an int
This commit is contained in:
Cosimo Lupo 2017-01-13 09:25:49 +00:00
parent 3165fa9703
commit 0a9800b109
No known key found for this signature in database
GPG Key ID: B61AAAD0B53A6419

View File

@ -7,7 +7,6 @@ from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc.psCharStrings import T2CharString
from fontTools.pens.basePen import BasePen
from math import fabs
class RelativeCoordinatePen(BasePen):
@ -77,7 +76,7 @@ def makeRoundFunc(tolerance):
# return rounded integer if the tolerance is 0.5, or if the absolute
# difference between the original float and the rounded integer is
# within the tolerance
if tolerance == .5 or fabs(rounded - number) <= tolerance:
if tolerance == .5 or abs(rounded - number) <= tolerance:
return rounded
else:
# else return the value un-rounded