glifLib: raise error when text is in <glyph> and in <outline>
This commit is contained in:
parent
49c9640f73
commit
b8f4145d76
@ -808,12 +808,16 @@ def _glifTreeFromFile(aFile):
|
||||
root = ElementTree.parse(aFile).getroot()
|
||||
if root.tag != "glyph":
|
||||
raise GlifLibError("The GLIF is not properly formatted.")
|
||||
if root.text.strip() != '':
|
||||
raise GlifLibError("Invalid GLIF structure.")
|
||||
return root
|
||||
|
||||
def _glifTreeFromString(aString):
|
||||
root = ElementTree.fromstring(aString)
|
||||
if root.tag != "glyph":
|
||||
raise GlifLibError("The GLIF is not properly formatted.")
|
||||
if root.text.strip() != '':
|
||||
raise GlifLibError("Invalid GLIF structure.")
|
||||
return root
|
||||
|
||||
def _readGlyphFromTree(tree, glyphObject=None, pointPen=None, formatVersions=(1, 2)):
|
||||
@ -848,6 +852,8 @@ def _readGlyphFromTreeFormat1(tree, glyphObject=None, pointPen=None):
|
||||
raise GlifLibError("The outline element occurs more than once.")
|
||||
if element.attrib:
|
||||
raise GlifLibError("The outline element contains unknown attributes.")
|
||||
if element.text.strip() != '':
|
||||
raise GlifLibError("Invalid outline structure.")
|
||||
haveSeenOutline = True
|
||||
buildOutlineFormat1(glyphObject, pointPen, element)
|
||||
elif glyphObject is None:
|
||||
@ -896,6 +902,8 @@ def _readGlyphFromTreeFormat2(tree, glyphObject=None, pointPen=None):
|
||||
raise GlifLibError("The outline element occurs more than once.")
|
||||
if element.attrib:
|
||||
raise GlifLibError("The outline element contains unknown attributes.")
|
||||
if element.text.strip() != '':
|
||||
raise GlifLibError("Invalid outline structure.")
|
||||
haveSeenOutline = True
|
||||
if pointPen is not None:
|
||||
buildOutlineFormat2(glyphObject, pointPen, element, identifiers)
|
||||
|
Loading…
x
Reference in New Issue
Block a user