AZW3 Input: Generate mimetypes for fonts that match what the editor expects. Fixes #1993496 [problem converting EPUB to AZW3](https://bugs.launchpad.net/calibre/+bug/1993496)

This commit is contained in:
Kovid Goyal 2022-10-31 06:15:35 +05:30
parent 9aea6019e1
commit fc8c0979d1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -506,9 +506,16 @@ class Mobi8Reader:
pass pass
opf.create_manifest_from_files_in([os.getcwd()], exclude=exclude) opf.create_manifest_from_files_in([os.getcwd()], exclude=exclude)
mime_map = {
'text/html': 'application/xhtml+xml',
'font/ttf': 'application/x-font-truetype',
'font/otf': 'application/vnd.ms-opentype',
'font/woff': 'application/font-woff',
}
for entry in opf.manifest: for entry in opf.manifest:
if entry.mime_type == 'text/html': n = mime_map.get(entry.mime_type)
entry.mime_type = 'application/xhtml+xml' if n is not None:
entry.mime_type = n
opf.create_spine(spine) opf.create_spine(spine)
opf.set_toc(toc) opf.set_toc(toc)
ppd = getattr(self.header.exth, 'page_progression_direction', None) ppd = getattr(self.header.exth, 'page_progression_direction', None)