Lines Matching refs:tag

210 		for tag in tags:
211 self._writeTable(tag, writer, done)
244 for tag in skipTables:
245 if tag in tables:
246 tables.remove(tag)
269 tag = tables[i]
271 tablePath = fileNameTemplate % tagToIdentifier(tag)
276 writer.simpletag(tagToXML(tag), src=os.path.basename(tablePath))
280 self._tableToXML(tableWriter, tag, progress, quiet)
293 def _tableToXML(self, writer, tag, progress, quiet):
294 if tag in self:
295 table = self[tag]
296 report = "Dumping '%s' table..." % tag
298 report = "No '%s' table found." % tag
306 if tag not in self:
308 xmlTag = tagToXML(tag)
314 if tag in ("glyf", "CFF "):
338 def isLoaded(self, tag):
339 """Return true if the table identified by 'tag' has been
341 return tag in self.tables
343 def has_key(self, tag):
344 if self.isLoaded(tag):
346 elif self.reader and tag in self.reader:
348 elif tag == "GlyphOrder":
370 def __getitem__(self, tag):
371 tag = Tag(tag)
373 return self.tables[tag]
375 if tag == "GlyphOrder":
376 table = GlyphOrder(tag)
377 self.tables[tag] = table
382 debugmsg("Reading '%s' table from disk" % tag)
383 data = self.reader[tag]
384 tableClass = getTableClass(tag)
385 table = tableClass(tag)
386 self.tables[tag] = table
388 debugmsg("Decompiling '%s' table" % tag)
395 print("An exception occurred during the decompilation of the '%s' table" % tag)
399 table = DefaultTable(tag)
401 self.tables[tag] = table
405 raise KeyError("'%s' table not found" % tag)
407 def __setitem__(self, tag, table):
408 self.tables[Tag(tag)] = table
410 def __delitem__(self, tag):
411 if tag not in self:
412 raise KeyError("'%s' table not found" % tag)
413 if tag in self.tables:
414 del self.tables[tag]
415 if self.reader and tag in self.reader:
416 del self.reader[tag]
418 def get(self, tag, default=None):
420 return self[tag]
611 def _writeTable(self, tag, writer, done):
615 if tag in done:
617 tableClass = getTableClass(tag)
624 tabledata = self.getTableData(tag)
626 debugmsg("writing '%s' table to disk" % tag)
627 writer[tag] = tabledata
628 done.append(tag)
630 def getTableData(self, tag):
633 tag = Tag(tag)
634 if self.isLoaded(tag):
636 debugmsg("compiling '%s' table" % tag)
637 return self.tables[tag].compile(self)
638 elif self.reader and tag in self.reader:
640 debugmsg("Reading '%s' table from disk" % tag)
641 return self.reader[tag]
643 raise KeyError(tag)
764 def __init__(self, tag=None):
785 def getTableModule(tag):
790 pyTag = tagToIdentifier(tag)
806 def getTableClass(tag):
810 module = getTableModule(tag)
814 pyTag = tagToIdentifier(tag)
820 """Fetch the table tag for a class object."""
828 def newTable(tag):
830 tableClass = getTableClass(tag)
831 return tableClass(tag)
845 def tagToIdentifier(tag):
846 """Convert a table tag to a valid (but UGLY) python identifier,
859 tag = Tag(tag)
860 if tag == "GlyphOrder":
861 return tag
862 assert len(tag) == 4, "tag should be 4 characters long"
863 while len(tag) > 1 and tag[-1] == ' ':
864 tag = tag[:-1]
866 for c in tag:
880 tag = ""
883 tag = tag + ident[i+1]
885 tag = tag + ident[i]
888 tag = tag + chr(int(ident[i:i+2], 16))
890 tag = tag + (4 - len(tag)) * ' '
891 return Tag(tag)
894 def tagToXML(tag):
895 """Similarly to tagToIdentifier(), this converts a TT tag
900 tag = Tag(tag)
901 if tag == "OS/2":
903 elif tag == "GlyphOrder":
904 return tag
905 if re.match("[A-Za-z_][A-Za-z_0-9]* *$", tag):
906 return tag.strip()
908 return tagToIdentifier(tag)
911 def xmlToTag(tag):
913 if tag == "OS_2":
915 if len(tag) == 8:
916 return identifierToTag(tag)
918 return Tag(tag + " " * (4 - len(tag)))
937 None, tableOrder needs to be a list of tag names.
950 for tag in tableOrder:
951 if tag in tagList:
952 orderedTables.append(tag)
953 tagList.remove(tag)
966 for tag in sortedTagList(tables, tableOrder):
967 writer[tag] = reader[tag]