Lines Matching refs:element
585 root = etree.Element("glyph", OrderedDict([("name", glyphName), ("format", repr(formatVersion))]))
664 def _writeAdvance(glyphObject, element, validate):
678 etree.SubElement(element, "advance", OrderedDict([("height", repr(height)), ("width", repr(width))]))
680 etree.SubElement(element, "advance", dict(width=repr(width)))
682 etree.SubElement(element, "advance", dict(height=repr(height)))
684 def _writeUnicodes(glyphObject, element, validate):
696 etree.SubElement(element, "unicode", dict(hex=hexCode))
698 def _writeNote(glyphObject, element, validate):
705 etree.SubElement(element, "note").text = tounicode(note)
707 def _writeImage(glyphObject, element, validate):
719 etree.SubElement(element, "image", attrs)
721 def _writeGuidelines(glyphObject, element, identifiers, validate):
748 etree.SubElement(element, "guideline", attrs)
766 def _writeAnchors(glyphObject, element, identifiers, validate):
788 etree.SubElement(element, "anchor", attrs)
790 def _writeLib(glyphObject, element, validate):
803 etree.SubElement(element, "lib").append(e)
907 for element in tree:
908 if element.tag == "outline":
911 raise GlifLibError("The outline element occurs more than once.")
912 if element.attrib:
913 raise GlifLibError("The outline element contains unknown attributes.")
914 if element.text and element.text.strip() != '':
917 buildOutlineFormat1(glyphObject, pointPen, element, validate)
920 elif element.tag == "advance":
922 raise GlifLibError("The advance element occurs more than once.")
924 _readAdvance(glyphObject, element)
925 elif element.tag == "unicode":
927 v = element.get("hex")
932 raise GlifLibError("Illegal value for hex attribute of unicode element.")
933 elif element.tag == "note":
935 raise GlifLibError("The note element occurs more than once.")
937 _readNote(glyphObject, element)
938 elif element.tag == "lib":
940 raise GlifLibError("The lib element occurs more than once.")
942 _readLib(glyphObject, element, validate)
944 element in GLIF: %s" % element)
958 for element in tree:
959 if element.tag == "outline":
962 raise GlifLibError("The outline element occurs more than once.")
963 if element.attrib:
964 raise GlifLibError("The outline element contains unknown attributes.")
965 if element.text and element.text.strip() != '':
969 buildOutlineFormat2(glyphObject, pointPen, element, identifiers, validate)
972 elif element.tag == "advance":
974 raise GlifLibError("The advance element occurs more than once.")
976 _readAdvance(glyphObject, element)
977 elif element.tag == "unicode":
979 v = element.get("hex")
984 raise GlifLibError("Illegal value for hex attribute of unicode element.")
985 elif element.tag == "guideline":
986 if validate and len(element):
987 raise GlifLibError("Unknown children in guideline element.")
988 attrib = dict(element.attrib)
993 elif element.tag == "anchor":
994 if validate and len(element):
995 raise GlifLibError("Unknown children in anchor element.")
996 attrib = dict(element.attrib)
998 if attr in element.attrib:
1001 elif element.tag == "image":
1004 raise GlifLibError("The image element occurs more than once.")
1005 if len(element):
1006 raise GlifLibError("Unknown children in image element.")
1008 _readImage(glyphObject, element, validate)
1009 elif element.tag == "note":
1011 raise GlifLibError("The note element occurs more than once.")
1013 _readNote(glyphObject, element)
1014 elif element.tag == "lib":
1016 raise GlifLibError("The lib element occurs more than once.")
1018 _readLib(glyphObject, element, validate)
1020 raise GlifLibError("Unknown element in GLIF: %s" % element)
1069 raise GlifLibError("The image element is not properly formatted.")
1088 for element in outline:
1089 if element.tag == "contour":
1090 if len(element) == 1:
1091 point = element[0]
1098 _buildOutlineContourFormat1(pen, element, validate)
1099 elif element.tag == "component":
1101 _buildOutlineComponentFormat1(pen, element, validate)
1103 raise GlifLibError("Unknown element in outline element: %s" % element)
1118 raise GlifLibError("Required x attribute is missing in point element.")
1120 raise GlifLibError("Required y attribute is missing in point element.")
1128 raise GlifLibError("Unknown attributes in contour element.")
1147 raise GlifLibError("Unknown child elements of component element.")
1150 raise GlifLibError("Unknown attribute in component element: %s" % attr)
1167 for element in outline:
1168 if element.tag == "contour":
1169 _buildOutlineContourFormat2(pen, element, identifiers, validate)
1170 elif element.tag == "component":
1171 _buildOutlineComponentFormat2(pen, element, identifiers, validate)
1173 raise GlifLibError("Unknown element in outline element: %s" % element.tag)
1179 raise GlifLibError("Unknown attribute in contour element: %s" % attr)
1222 raise GlifLibError("Unknown child elements of component element.")
1225 raise GlifLibError("Unknown attribute in component element: %s" % attr)
1261 for index, element in enumerate(contour):
1263 if element.tag != "point":
1264 raise GlifLibError("Unknown child element (%s) of contour element." % element.tag)
1265 point = dict(element.attrib)
1271 raise GlifLibError("Unknown attribute in point element: %s" % attr)
1273 if len(element):
1274 raise GlifLibError("Unknown child elements in point element.")
1277 value = element.get(attr)
1279 raise GlifLibError("Required %s attribute is missing in point element." % attr)
1306 if "name" not in element.attrib:
1517 def __init__(self, element, formatVersion=2, identifiers=None, validate=True):
1522 self.outline = element