Use the endchar operator for glyphs that have been subsetted out instead of the empty string as some cff font renderers (adobe) have problems with empty strings

This commit is contained in:
Kovid Goyal 2012-11-09 13:32:41 +05:30
parent 5729fdb0e5
commit 1873e95b38
2 changed files with 3 additions and 7 deletions

View File

@ -124,10 +124,11 @@ class Subset(object):
charsets = Charsets(strings)
charsets.extend(cff.charset[1:]) # .notdef is not included
endchar_operator = bytes(bytearray([14]))
for i in xrange(self.cff.num_glyphs):
cname = self.cff.charset.safe_lookup(i)
ok = cname in keep_charnames
cs = self.cff.char_strings[i] if ok else b''
cs = self.cff.char_strings[i] if ok else endchar_operator
char_strings.append(cs)
if ok:
self.charname_map[cname] = i

View File

@ -96,12 +96,7 @@ def subset(raw, individual_chars, ranges=()):
subset_truetype(sfnt, character_map)
elif b'CFF ' in sfnt:
# PostScript Outlines
from calibre.utils.config_base import tweaks
if tweaks['subset_cff_table']:
subset_postscript(sfnt, character_map)
else:
raise UnsupportedFont('This font contains PostScript outlines, '
'subsetting not supported')
subset_postscript(sfnt, character_map)
else:
raise UnsupportedFont('This font does not contain TrueType '
'or PostScript outlines')