From 33beeaa1a2c3170328beb5c808408d1be503b379 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 23 May 2024 12:17:46 -0600 Subject: [PATCH] [CFFToCFF2] Keep charset during initial round See comments. --- Lib/fontTools/cffLib/CFFToCFF2.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Lib/fontTools/cffLib/CFFToCFF2.py b/Lib/fontTools/cffLib/CFFToCFF2.py index 804af8477..21ac36671 100644 --- a/Lib/fontTools/cffLib/CFFToCFF2.py +++ b/Lib/fontTools/cffLib/CFFToCFF2.py @@ -172,6 +172,15 @@ def _convertCFFToCFF2(cff, otFont): # Now delete up the deprecated topDict operators from CFF 1.0 for entry in topDictOperators: key = entry[1] + # We seem to need to keep the charset operator for now, + # or we fail to compile with some fonts, like AdditionFont.otf. + # I don't know which kind of CFF font those are. But keeping + # charset seems to work. It will be removed when we save and + # read the font again. + # + # AdditionFont.otf has . + if key == "charset": + continue if key not in opOrder: if key in topDict.rawDict: del topDict.rawDict[key] @@ -183,6 +192,8 @@ def _convertCFFToCFF2(cff, otFont): # were loaded for CFF1, and we need to reload them for CFF2 to set varstore, etc # on them. At least that's what I understand. It's probably safe to remove this # and just set vstore where needed. + # + # See comment above about charset as well. # At this point, the Subrs and Charstrings are all still T2Charstring class # easiest to fix this by compiling, then decompiling again