From fc8c0979d131de34bc63d655ee02d9c6435fdf9c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 31 Oct 2022 06:15:35 +0530 Subject: [PATCH] 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) --- src/calibre/ebooks/mobi/reader/mobi8.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/mobi/reader/mobi8.py b/src/calibre/ebooks/mobi/reader/mobi8.py index ce64bb8e0c..c1aa6acb0b 100644 --- a/src/calibre/ebooks/mobi/reader/mobi8.py +++ b/src/calibre/ebooks/mobi/reader/mobi8.py @@ -506,9 +506,16 @@ class Mobi8Reader: pass 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: - if entry.mime_type == 'text/html': - entry.mime_type = 'application/xhtml+xml' + n = mime_map.get(entry.mime_type) + if n is not None: + entry.mime_type = n opf.create_spine(spine) opf.set_toc(toc) ppd = getattr(self.header.exth, 'page_progression_direction', None)