mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-27 16:02:58 +02:00
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:
parent
5729fdb0e5
commit
1873e95b38
2 changed files with 3 additions and 7 deletions
|
|
@ -124,10 +124,11 @@ def __init__(self, cff, keep_charnames):
|
|||
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
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Reference in a new issue