DOCX Input: When converting embedded fonts, replace spaces in the filename with underscores to keep the execrable epubcheck happy. Fixes #1921793 [Conversion Problem: Embedded OpenType TT fonts in DOCX files](https://bugs.launchpad.net/calibre/+bug/1921793)

This commit is contained in:
Kovid Goyal 2021-04-02 13:55:48 +05:30
parent d8649c6fed
commit d1c22611b3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -189,7 +189,7 @@ class Fonts(object):
if not is_truetype_font(prefix): if not is_truetype_font(prefix):
return None return None
ext = 'otf' if prefix.startswith(b'OTTO') else 'ttf' ext = 'otf' if prefix.startswith(b'OTTO') else 'ttf'
fname = ascii_filename('%s - %s.%s' % (name, variant, ext)) fname = ascii_filename('%s - %s.%s' % (name, variant, ext)).replace(' ', '_')
with open(os.path.join(dest_dir, fname), 'wb') as dest: with open(os.path.join(dest_dir, fname), 'wb') as dest:
dest.write(prefix) dest.write(prefix)
dest.write(raw[32:]) dest.write(raw[32:])