aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/ttLib/tables/_g_l_y_f.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/fontTools/ttLib/tables/_g_l_y_f.py')
-rw-r--r--Lib/fontTools/ttLib/tables/_g_l_y_f.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/Lib/fontTools/ttLib/tables/_g_l_y_f.py b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
index e12969e4..4680ddbf 100644
--- a/Lib/fontTools/ttLib/tables/_g_l_y_f.py
+++ b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
@@ -1,7 +1,7 @@
"""_g_l_y_f.py -- Converter classes for the 'glyf' table."""
from collections import namedtuple
-from fontTools.misc.py23 import *
+from fontTools.misc.py23 import bytechr, byteord, bytesjoin, tostr
from fontTools.misc import sstruct
from fontTools import ttLib
from fontTools import version
@@ -152,7 +152,7 @@ class table__g_l_y_f(DefaultTable.DefaultTable):
if glyph.numberOfContours:
if splitGlyphs:
glyphPath = userNameToFileName(
- tounicode(glyphName, 'utf-8'),
+ tostr(glyphName, 'utf-8'),
existingGlyphFiles,
prefix=path + ".",
suffix=ext)
@@ -1506,12 +1506,12 @@ class GlyphCoordinates(object):
p = self._checkFloat(p)
self._a.extend(p)
- def toInt(self):
+ def toInt(self, *, round=otRound):
if not self.isFloat():
return
a = array.array("h")
for n in self._a:
- a.append(otRound(n))
+ a.append(round(n))
self._a = a
def relativeToAbsolute(self):
@@ -1626,13 +1626,9 @@ class GlyphCoordinates(object):
for i in range(len(a)):
a[i] = -a[i]
return r
- def __round__(self):
- """
- Note: This is Python 3 only. Python 2 does not call __round__.
- As such, we cannot test this method either. :(
- """
+ def __round__(self, *, round=otRound):
r = self.copy()
- r.toInt()
+ r.toInt(round=round)
return r
def __add__(self, other): return self.copy().__iadd__(other)