Skip to content

Commit 037b619

Browse files
authored
Use RFC 8081 font file MIME types in the EPUB builder (#11486)
The "font" top-level media type was formalised via :rfc:`8081` in 2017. Standard MIME types for OTF and TTF fonts have been `registered with IANA`_ as ``font/otf`` and ``font/ttf``. These are also listed in the EPUB 3 `core media types`_ specification. Sphinx-generated EPUB documents including custom OTF or TTF fonts specify a MIME type for those fonts in ``content.opf`` of ``application/x-font-otf`` or ``application/x-font-ttf`` respectively. The ``epubcheck`` application presents informational warnings that these MIME types are non-standard when checking such a generated EPUB document. Adding the correct MIME type will prevent those messages and will also result in a valid EPUB. .. _core media types: https://www.w3.org/TR/epub/#sec-core-media-types .. _registered with IANA: https://www.iana.org/assignments/media-types/media-types.xhtml#font
1 parent 571becb commit 037b619

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sphinx/builders/_epub_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
'.svg': 'image/svg+xml',
6666
'.jpg': 'image/jpeg',
6767
'.jpeg': 'image/jpeg',
68-
'.otf': 'application/x-font-otf',
69-
'.ttf': 'application/x-font-ttf',
70-
'.woff': 'application/font-woff',
68+
'.otf': 'font/otf',
69+
'.ttf': 'font/ttf',
70+
'.woff': 'font/woff',
7171
}
7272

7373
VECTOR_GRAPHICS_EXTENSIONS = ('.svg',)

0 commit comments

Comments
 (0)