PDF Output: Fix conversion failing when fonts with non-English names are used. Fixes #1812218 [convert to pdf failed](https://bugs.launchpad.net/calibre/+bug/1812218)

This commit is contained in:
Kovid Goyal 2019-01-17 20:11:21 +05:30
parent 13c4366e51
commit 49ee941c6d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -108,6 +108,10 @@ class CMap(Stream):
for m in maps:
meat = '\n'.join('%s %s'%(k, v) for k, v in m.iteritems())
mapping.append('%d beginbfchar\n%s\nendbfchar'%(len(m), meat))
try:
name = name.encode('ascii').decode('ascii')
except Exception:
name = uuid4()
self.write(self.skeleton.format(name=name, mapping='\n'.join(mapping)))