PDF Output: Do not fail if one of th efonts from the source document has no name metadata

This commit is contained in:
Kovid Goyal 2018-12-13 18:12:54 +05:30
parent 934cb684c1
commit f18fdce33b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -181,8 +181,12 @@ class Font(object):
self.metrics.sfnt(self.font_stream)
def write_to_unicode(self, objects):
cmap = CMap(self.metrics.postscript_name, self.metrics.glyph_map,
compress=self.compress)
try:
name = self.metrics.postscript_name
except KeyError:
from calibre.utils.short_uuid import uuid4
name = uuid4()
cmap = CMap(name, self.metrics.glyph_map, compress=self.compress)
self.font_dict['ToUnicode'] = objects.add(cmap)
def write_widths(self, objects):