Skip to content

Commit

Permalink
Merge pull request #117 from anthrotype/format-float
Browse files Browse the repository at this point in the history
Allow to read new format="4.0" as a float
  • Loading branch information
anthrotype authored Jun 7, 2018
2 parents 6aa2924 + 669b71c commit 9c2ec50
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Lib/mutatorMath/ufo/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def __init__(self, documentPath,
tree = ET.parse(self.path)
self.root = tree.getroot()
self.readVersion()
assert self.documentFormatVersion == 3
assert self.documentFormatVersion >= 3

self.readAxes()
self.readWarp()
Expand Down Expand Up @@ -447,7 +447,12 @@ def readVersion(self):
<designspace format="3">
"""
ds = self.root.findall("[@format]")[0]
self.documentFormatVersion = int(ds.attrib['format'])
raw_format = ds.attrib['format']
try:
self.documentFormatVersion = int(raw_format)
except ValueError:
# as of fontTools >= 3.27 'format' is formatted as a float "4.0"
self.documentFormatVersion = float(raw_format)

def readWarp(self):
""" Read the warp element
Expand Down

0 comments on commit 9c2ec50

Please sign in to comment.