2
from fontTools import cffLib
5
class table_C_F_F_(DefaultTable.DefaultTable):
7
def __init__(self, tag):
8
DefaultTable.DefaultTable.__init__(self, tag)
9
self.cff = cffLib.CFFFontSet()
10
self._gaveGlyphOrder = 0
12
def decompile(self, data, otFont):
13
from cStringIO import StringIO
14
self.cff.decompile(StringIO(data), otFont)
15
assert len(self.cff) == 1, "can't deal with multi-font CFF tables."
17
def compile(self, otFont):
18
from cStringIO import StringIO
20
self.cff.compile(f, otFont)
23
def haveGlyphNames(self):
24
if hasattr(self.cff[self.cff.fontNames[0]], "ROS"):
25
return 0 # CID-keyed font
29
def getGlyphOrder(self):
30
if self._gaveGlyphOrder:
31
from fontTools import ttLib
32
raise ttLib.TTLibError, "illegal use of getGlyphOrder()"
33
self._gaveGlyphOrder = 1
34
return self.cff[self.cff.fontNames[0]].getGlyphOrder()
36
def setGlyphOrder(self, glyphOrder):
39
#self.cff[self.cff.fontNames[0]].setGlyphOrder(glyphOrder)
41
def toXML(self, writer, otFont, progress=None):
42
self.cff.toXML(writer, progress)
44
def fromXML(self, (name, attrs, content), otFont):
45
if not hasattr(self, "cff"):
46
self.cff = cffLib.CFFFontSet()
47
self.cff.fromXML((name, attrs, content))