Edit book: Check book: Follow recent releases of epubcheck in expecting .ttf files to have the mime-type application/vnd.ms-opentype in EPUB 3 books

This commit is contained in:
Kovid Goyal 2019-01-30 15:26:25 +05:30
parent 8fac38cf4d
commit 4590d36660
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -149,8 +149,14 @@ class ContainerBase(object): # {{{
ans = guess_type(name) ans = guess_type(name)
if ans == 'text/html': if ans == 'text/html':
ans = 'application/xhtml+xml' ans = 'application/xhtml+xml'
if ans in {'application/x-font-truetype', 'application/vnd.ms-opentype'} and self.opf_version_parsed[:2] > (3, 0): if ans in {'application/x-font-truetype', 'application/vnd.ms-opentype'}:
opfversion = self.opf_version_parsed[:2]
if opfversion > (3, 0):
return 'application/font-sfnt' return 'application/font-sfnt'
if opfversion >= (3, 0):
# bloody epubcheck has recently decided it likes this mimetype
# for ttf files
return 'application/vnd.ms-opentype'
return ans return ans
def decode(self, data, normalize_to_nfc=True): def decode(self, data, normalize_to_nfc=True):