[varLib, fontBuilder] Set Private.vstore as well

Otherwise T2OutlineExtractor.op_blend() would raise and exception unless
the font is saved and loaded again.
This commit is contained in:
Khaled Hosny 2020-01-31 04:16:54 +02:00
parent 38981b6dae
commit 366c08a9d6
2 changed files with 9 additions and 1 deletions

View File

@ -602,7 +602,10 @@ class FontBuilder(object):
varData = buildVarData(list(range(len(regions))), None, optimize=False)
varStore = buildVarStore(varRegionList, [varData])
vstore = VarStoreData(otVarStore=varStore)
self.font["CFF2"].cff.topDictIndex[0].VarStore = vstore
topDict = self.font["CFF2"].cff.topDictIndex[0]
topDict.VarStore = vstore
for fontDict in topDict.FDArray:
fontDict.Private.vstore = vstore
def setupGlyf(self, glyphs, calcGlyphBounds=True):
"""Create the `glyf` table from a dict, that maps glyph names

View File

@ -30,6 +30,11 @@ def addCFFVarStore(varFont, varModel, varDataList, masterSupports):
topDict = varFont['CFF2'].cff.topDictIndex[0]
topDict.VarStore = VarStoreData(otVarStore=varStoreCFFV)
if topDict.FDArray[0].vstore is None:
fdArray = topDict.FDArray
for fontDict in fdArray:
if hasattr(fontDict, "Private"):
fontDict.Private.vstore = topDict.VarStore
def lib_convertCFFToCFF2(cff, otFont):