* Removed `CFFContext` * Added `isCFF2` argument to CFFFontSet.decompile/compile, used from respective ttLib classes * Index classes get a `isCFF2` argument in constructor (used for decompiling); must be True/False if `file` argument is not None; it is stored as self._isCFF2 to support lazy loading * Removed `TopDictData` class; reuse same `TopDictIndexCompiler` for both CFF and CFF2 * `CFFWriter` and all `*Compiler` classes get an `isCFF2` argument; defaults to the parent compiler's `isCFF2` attribute * Removed `size` argument from `produceItem` method as unused and useless (`len(data)` is the same) * psCharStrings: removed useless ByteCodeBase class * A reference to the TopDict's VarStoreData is passed down to all the FontDicts' PrivateDict, so it can be used to get the number of regions while decompiling blend and vsindex operators See dicussion: https://github.com/fonttools/fonttools/pull/968#issuecomment-309920007
17 lines
531 B
Python
17 lines
531 B
Python
from __future__ import print_function, division, absolute_import
|
|
from fontTools.misc.py23 import *
|
|
from fontTools import cffLib
|
|
from fontTools.ttLib.tables.C_F_F_ import table_C_F_F_
|
|
|
|
|
|
class table_C_F_F__2(table_C_F_F_):
|
|
|
|
def decompile(self, data, otFont):
|
|
self.cff.decompile(BytesIO(data), otFont, isCFF2=True)
|
|
assert len(self.cff) == 1, "can't deal with multi-font CFF tables."
|
|
|
|
def compile(self, otFont):
|
|
f = BytesIO()
|
|
self.cff.compile(f, otFont, isCFF2=True)
|
|
return f.getvalue()
|