Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct MIME type for a font file?

I have not been able to find a canonical source that indicates the correct MIME type for any and/or each type of file format. All the sources that I have found appear to contradict each other and/or the IANA MIME type RFCs and their associated list.

While I am particularly interested in .otf (OpenType) and .ttf (TrueType) file types, an ideal answer would provide a canonical resource for determining the MIME types for a broad spectrum of font file formats, such as those listed on the Font file section of the Wikipedia page: List of file formats. However, given that I can't find such a resource, it seems entirely possible that no such canonical reference exists.

I would like to further clarify that I am not looking for the working MIME type, but for the canonical MIME type. The selected answer to Proper MIME type for fonts states that font/opentype can be used for .otf file. However, as the highest voted answer (by @djsadinoff) explains, font is not a valid IANA content type and this cannot be the correct MIME type.

like image 517
smartcaveman Avatar asked Sep 30 '12 10:09

smartcaveman


1 Answers

For your question you may not know the fact about the font type. Use this link Font MIME Types.

roc reports on the Web Fonts battle of which the short version is whether the non-IE browsers should support a DRM format for fonts. (And maybe also whether they can support TrueType and OpenType out of the box.) I don’t really think we should support a DRM format for fonts. It seems like it would set a bad precedent on the Web, might make vendors liable if they don’t enforce things right, and complicates matters for authors.

The W3C has created a draft charter for an EOT Working Group; EOT (Embedded OpenType) being the DRM format Microsoft is advocating. I have no idea how EOT is leading the Web to its full potential, but we’ll see what comes of it.

Aside from the format issue it might be worth considering to introduce a MIME type for fonts. (If this is too late for implementations at this point it might be too late.) The upside is that arbitrary files (say, a text/html file) will not be interpreted as fonts. The downside is that it makes things slightly harder for authors as they have to make sure they label it correctly. (On the Web images (except SVG) and JavaScript are not checked as to whether the resource has the correct MIME type. For images the browser sniffs the image signature and something loaded from a script element is simply executed (not so good, indeed).)

Given that support @font-face will be shipping soonish in Opera, Safari, and Firefox this would need to be decided soon. Probably before the relevant MIME type is standardized through the IETF. Another complication is that OpenType and TrueType can carry either otf and ttf as extension and the operating system deals with it fine. Having a single MIME type for both could probably work though, just like XHTML and SVG can both use text/xml.

like image 150
Vivek Dragon Avatar answered Oct 17 '22 09:10

Vivek Dragon