mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Preserve glyph ids when subsetting CFF tables
This commit is contained in:
parent
a509176037
commit
5729fdb0e5
@ -122,14 +122,15 @@ class Subset(object):
|
|||||||
char_strings = Index()
|
char_strings = Index()
|
||||||
self.charname_map = OrderedDict()
|
self.charname_map = OrderedDict()
|
||||||
charsets = Charsets(strings)
|
charsets = Charsets(strings)
|
||||||
|
charsets.extend(cff.charset[1:]) # .notdef is not included
|
||||||
|
|
||||||
for i in xrange(self.cff.num_glyphs):
|
for i in xrange(self.cff.num_glyphs):
|
||||||
cname = self.cff.charset.safe_lookup(i)
|
cname = self.cff.charset.safe_lookup(i)
|
||||||
if cname in keep_charnames:
|
ok = cname in keep_charnames
|
||||||
char_strings.append(self.cff.char_strings[i])
|
cs = self.cff.char_strings[i] if ok else b''
|
||||||
self.charname_map[cname] = len(self.charname_map)
|
char_strings.append(cs)
|
||||||
if i > 0: # .notdef is not included
|
if ok:
|
||||||
charsets.append(cname)
|
self.charname_map[cname] = i
|
||||||
|
|
||||||
# Add the strings
|
# Add the strings
|
||||||
char_strings.compile()
|
char_strings.compile()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user