ufoLib: don't crash if UFO2 has openTypeHheaCaretOffset=0.0

validators are picky so give them integers when they want integers
This commit is contained in:
Cosimo Lupo 2020-02-15 13:25:45 +00:00
parent d8d824011a
commit 8423e01a18
No known key found for this signature in database
GPG Key ID: 179A8F0895A02F4F

View File

@ -2146,18 +2146,14 @@ def convertFontInfoValueForAttributeFromVersion2ToVersion3(attr, value):
"""
if attr in _ufo2To3FloatToInt:
try:
v = int(round(value))
value = round(value)
except (ValueError, TypeError):
raise UFOLibError("Could not convert value for %s." % attr)
if v != value:
value = v
if attr in _ufo2To3NonNegativeInt:
try:
v = int(abs(value))
value = int(abs(value))
except (ValueError, TypeError):
raise UFOLibError("Could not convert value for %s." % attr)
if v != value:
value = v
elif attr in _ufo2To3NonNegativeIntOrFloat:
try:
v = float(abs(value))