From 0a9800b1092d4b08ae51040dccf6ac343adc78a7 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Fri, 13 Jan 2017 09:25:49 +0000 Subject: [PATCH] [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 --- Lib/fontTools/pens/t2CharStringPen.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/fontTools/pens/t2CharStringPen.py b/Lib/fontTools/pens/t2CharStringPen.py index a56f7b827..2bd405b03 100644 --- a/Lib/fontTools/pens/t2CharStringPen.py +++ b/Lib/fontTools/pens/t2CharStringPen.py @@ -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