49 lines
1.3 KiB
Python
Raw Normal View History

from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools import cffLib
from . import DefaultTable
class table_C_F_F_(DefaultTable.DefaultTable):
def __init__(self, tag):
DefaultTable.DefaultTable.__init__(self, tag)
self.cff = cffLib.CFFFontSet()
2013-12-04 21:28:50 -05:00
self._gaveGlyphOrder = False
def decompile(self, data, otFont):
self.cff.decompile(StringIO(data), otFont)
assert len(self.cff) == 1, "can't deal with multi-font CFF tables."
def compile(self, otFont):
f = StringIO()
self.cff.compile(f, otFont)
return f.getvalue()
def haveGlyphNames(self):
if hasattr(self.cff[self.cff.fontNames[0]], "ROS"):
2013-12-04 21:28:50 -05:00
return False # CID-keyed font
else:
2013-12-04 21:28:50 -05:00
return True
def getGlyphOrder(self):
if self._gaveGlyphOrder:
from fontTools import ttLib
2013-11-27 02:42:28 -05:00
raise ttLib.TTLibError("illegal use of getGlyphOrder()")
2013-12-04 21:28:50 -05:00
self._gaveGlyphOrder = True
return self.cff[self.cff.fontNames[0]].getGlyphOrder()
def setGlyphOrder(self, glyphOrder):
pass
# XXX
#self.cff[self.cff.fontNames[0]].setGlyphOrder(glyphOrder)
def toXML(self, writer, otFont, progress=None):
self.cff.toXML(writer, progress)
def fromXML(self, name, attrs, content, otFont):
if not hasattr(self, "cff"):
self.cff = cffLib.CFFFontSet()
self.cff.fromXML(name, attrs, content)