From 366c08a9d6c7b8546849bd24a1c8e3d7e7cb3440 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Fri, 31 Jan 2020 04:16:54 +0200 Subject: [PATCH] [varLib, fontBuilder] Set Private.vstore as well Otherwise T2OutlineExtractor.op_blend() would raise and exception unless the font is saved and loaded again. --- Lib/fontTools/fontBuilder.py | 5 ++++- Lib/fontTools/varLib/cff.py | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Lib/fontTools/fontBuilder.py b/Lib/fontTools/fontBuilder.py index 29d58fb6f..6e72dd520 100644 --- a/Lib/fontTools/fontBuilder.py +++ b/Lib/fontTools/fontBuilder.py @@ -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 diff --git a/Lib/fontTools/varLib/cff.py b/Lib/fontTools/varLib/cff.py index 7915272d6..7895d274f 100644 --- a/Lib/fontTools/varLib/cff.py +++ b/Lib/fontTools/varLib/cff.py @@ -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):