Skip to content

Commit 669b71c

Browse files
committed
Allow to read new format="4.0" as a float
1 parent 6aa2924 commit 669b71c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Lib/mutatorMath/ufo/document.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def __init__(self, documentPath,
402402
tree = ET.parse(self.path)
403403
self.root = tree.getroot()
404404
self.readVersion()
405-
assert self.documentFormatVersion == 3
405+
assert self.documentFormatVersion >= 3
406406

407407
self.readAxes()
408408
self.readWarp()
@@ -447,7 +447,12 @@ def readVersion(self):
447447
<designspace format="3">
448448
"""
449449
ds = self.root.findall("[@format]")[0]
450-
self.documentFormatVersion = int(ds.attrib['format'])
450+
raw_format = ds.attrib['format']
451+
try:
452+
self.documentFormatVersion = int(raw_format)
453+
except ValueError:
454+
# as of fontTools >= 3.27 'format' is formatted as a float "4.0"
455+
self.documentFormatVersion = float(raw_format)
451456

452457
def readWarp(self):
453458
""" Read the warp element

0 commit comments

Comments
 (0)