PDF Output: Handle input documents with fonts that do not have either postscript or full name information. Fixes #1518678 [ebook-convert failing on file with embedded font](https://bugs.launchpad.net/calibre/+bug/1518678)

This commit is contained in:
Kovid Goyal 2015-11-22 17:21:16 +05:30
parent 385fcfbba6
commit 7489f1a793

View File

@ -61,7 +61,10 @@ class FontMetrics(object):
def postscript_name(self): def postscript_name(self):
if 'postscript_name' in self.names: if 'postscript_name' in self.names:
return self.names['postscript_name'].replace(' ', '-') return self.names['postscript_name'].replace(' ', '-')
return self.names['full_name'].replace(' ', '-') try:
return self.names['full_name'].replace(' ', '-')
except KeyError:
return self.names['family_name'].replace(' ', '-')
def underline_thickness(self, pixel_size=12.0): def underline_thickness(self, pixel_size=12.0):
'Thickness for lines (in pixels) at the specified size' 'Thickness for lines (in pixels) at the specified size'