glyphOrder.py 610 B

1234567891011121314151617181920212223242526
  1. from lxml.etree import Element
  2. class GlyphOrder:
  3. """
  4. Class representing a GlyphOrder table.
  5. GlyphOrder is not a table (I think???), but sort of a helper for TTX.
  6. This does not appear in the tables of a finished font.
  7. """
  8. def __init__(self, glyphs):
  9. self.glyphs = {}
  10. for id, g in enumerate(glyphs["img_empty"]):
  11. self.glyphs[id] = g
  12. def toTTX(self):
  13. glyphOrder = Element("GlyphOrder")
  14. for id, g in self.glyphs.items():
  15. glyphOrder.append(Element("GlyphID", {"id": str(id), "name": g.name() }))
  16. return glyphOrder