mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-22 10:53:45 +02:00
EPUB Output: Do not raise an error for invalid embedded fonts in the input document. Fixes #7567 (operation failed)
This commit is contained in:
parent
1a3f4fd5d8
commit
9b7f64d3c8
1 changed files with 6 additions and 3 deletions
|
|
@ -241,9 +241,12 @@ def encrypt_fonts(self, uris, tdir, uuid): # {{{
|
|||
self.log.debug('Encrypting font:', uri)
|
||||
with open(path, 'r+b') as f:
|
||||
data = f.read(1024)
|
||||
f.seek(0)
|
||||
for i in range(1024):
|
||||
f.write(chr(ord(data[i]) ^ key[i%16]))
|
||||
if len(data) >= 1024:
|
||||
f.seek(0)
|
||||
for i in range(1024):
|
||||
f.write(chr(ord(data[i]) ^ key[i%16]))
|
||||
else:
|
||||
self.log.warn('Font', path, 'is invalid, ignoring')
|
||||
if not isinstance(uri, unicode):
|
||||
uri = uri.decode('utf-8')
|
||||
fonts.append(u'''
|
||||
|
|
|
|||
Loading…
Reference in a new issue