Skip to content

Commit

Permalink
must rename charstrings dict if CFF2 table has been loaded
Browse files Browse the repository at this point in the history
integration tests where failing with cffsubr==0.2.7 because with the latter the subroutinized CFF2 table was partly decompiled, thus was still using the old names. See

https://travis-ci.org/github/googlefonts/ufo2ft/builds/727087926?utm_source=github_status&utm_medium=notification
  • Loading branch information
anthrotype committed Sep 21, 2020
1 parent c601810 commit 563108c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Lib/ufo2ft/postProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,15 @@ def _rename_glyphs_from_ufo(self):
otf["post"].extraNames = []
otf["post"].compile(otf)

if "CFF " in otf:
cff = otf["CFF "].cff.topDictIndex[0]
cff_tag = "CFF " if "CFF " in otf else "CFF2" if "CFF2" in otf else None
if cff_tag == "CFF " or (cff_tag == "CFF2" and otf.isLoaded(cff_tag)):
cff = otf[cff_tag].cff.topDictIndex[0]
char_strings = cff.CharStrings.charStrings
cff.CharStrings.charStrings = {
rename_map.get(n, n): v for n, v in char_strings.items()
}
cff.charset = [rename_map.get(n, n) for n in cff.charset]
if cff_tag == "CFF ":
cff.charset = [rename_map.get(n, n) for n in cff.charset]

def _build_production_names(self):
seen = {}
Expand Down

0 comments on commit 563108c

Please sign in to comment.