[cffLib] Fix bugs in converting CFF to CFF2 when the font has an FDArray.
The FontDict as well as the PrivateDict needs to have fields removed when these are deprecated in CFF2.
This commit is contained in:
parent
21bbb15cd0
commit
942a7610fd
@ -256,7 +256,7 @@ class CFFFontSet(object):
|
|||||||
charStrings.charStringsIndex.fdArray = fdArray
|
charStrings.charStringsIndex.fdArray = fdArray
|
||||||
else:
|
else:
|
||||||
charStrings.fdArray = fdArray
|
charStrings.fdArray = fdArray
|
||||||
fontDict = FontDict()
|
fontDict = FontDict(isCFF2=True)
|
||||||
fdArray.append(fontDict)
|
fdArray.append(fontDict)
|
||||||
fontDict.Private = privateDict
|
fontDict.Private = privateDict
|
||||||
privateOpOrder = buildOrder(privateDictOperators2)
|
privateOpOrder = buildOrder(privateDictOperators2)
|
||||||
@ -271,8 +271,17 @@ class CFFFontSet(object):
|
|||||||
# print "Removing privateDict attr", key
|
# print "Removing privateDict attr", key
|
||||||
else:
|
else:
|
||||||
# clean up the PrivateDicts in the fdArray
|
# clean up the PrivateDicts in the fdArray
|
||||||
|
fdArray = topDict.FDArray
|
||||||
privateOpOrder = buildOrder(privateDictOperators2)
|
privateOpOrder = buildOrder(privateDictOperators2)
|
||||||
for fontDict in fdArray:
|
for fontDict in fdArray:
|
||||||
|
fontDict.order = fontDict.orderCFF2
|
||||||
|
fontDict._isCFF2 = True
|
||||||
|
for key in fontDict.rawDict.keys():
|
||||||
|
if key not in fontDict.order:
|
||||||
|
del fontDict.rawDict[key]
|
||||||
|
if hasattr(fontDict, key):
|
||||||
|
exec("del fontDict.%s" % (key))
|
||||||
|
|
||||||
privateDict = fontDict.Private
|
privateDict = fontDict.Private
|
||||||
for entry in privateDictOperators:
|
for entry in privateDictOperators:
|
||||||
key = entry[1]
|
key = entry[1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user