diff --git a/src/calibre/ebooks/conversion/plugins/epub_input.py b/src/calibre/ebooks/conversion/plugins/epub_input.py index c5742f2c7d..b6f857ef1f 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_input.py +++ b/src/calibre/ebooks/conversion/plugins/epub_input.py @@ -294,11 +294,22 @@ class EPUBInput(InputFormatPlugin): not_for_spine = set() for y in opf.itermanifest(): id_ = y.get('id', None) - if id_ and y.get('media-type', None) in { - 'application/vnd.adobe-page-template+xml', 'application/vnd.adobe.page-template+xml', - 'application/adobe-page-template+xml', 'application/adobe.page-template+xml', - 'application/text'}: - not_for_spine.add(id_) + if id_: + mt = y.get('media-type', None) + if mt in { + 'application/vnd.adobe-page-template+xml', + 'application/vnd.adobe.page-template+xml', + 'application/adobe-page-template+xml', + 'application/adobe.page-template+xml', + 'application/text' + }: + not_for_spine.add(id_) + ext = y.get('href', '').rpartition('.')[-1].lower() + if mt == 'text/plain' and ext in {'otf', 'ttf'}: + # some epub authoring software sets font mime types to + # text/plain + not_for_spine.add(id_) + y.set('media-type', 'application/font') seen = set() for x in list(opf.iterspine()):