mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Change font files media type to application/font-sfnt
This commit is contained in:
parent
b604aa7acc
commit
d00ccaafba
@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|||||||
|
|
||||||
from calibre.ebooks.metadata.opf_2_to_3 import upgrade_metadata
|
from calibre.ebooks.metadata.opf_2_to_3 import upgrade_metadata
|
||||||
from calibre.ebooks.oeb.base import OEB_DOCS, xpath
|
from calibre.ebooks.oeb.base import OEB_DOCS, xpath
|
||||||
|
from calibre.ebooks.oeb.polish.container import OEB_FONTS
|
||||||
|
|
||||||
|
|
||||||
def add_properties(item, *props):
|
def add_properties(item, *props):
|
||||||
@ -18,6 +19,8 @@ def collect_properties(container):
|
|||||||
for item in container.opf_xpath('//opf:manifest/opf:item[@href and @media-type]'):
|
for item in container.opf_xpath('//opf:manifest/opf:item[@href and @media-type]'):
|
||||||
mt = item.get('media-type') or ''
|
mt = item.get('media-type') or ''
|
||||||
if mt.lower() not in OEB_DOCS:
|
if mt.lower() not in OEB_DOCS:
|
||||||
|
if mt.lower() in OEB_FONTS and 'woff' not in mt.lower():
|
||||||
|
item.set('media-type', 'application/font-sfnt')
|
||||||
continue
|
continue
|
||||||
name = container.href_to_name(item.get('href'), container.opf_name)
|
name = container.href_to_name(item.get('href'), container.opf_name)
|
||||||
root = container.parsed(name)
|
root = container.parsed(name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user