Page 1 of 1

Correct MIME types for webfonts?

Posted: Sat Mar 03, 2018 7:12 pm
by TomHTML
I had been receiving an error from the validator on the correct mime type to receive for WOFF2 fonts. My server was sending out mime types following this prescription in my .htaccess file:

Code: Select all

AddType application/x-font-ttf           ttc ttf
AddType application/x-font-otf           otf
AddType application/font-woff            woff
AddType application/font-woff2           woff2
AddType application/vnd.ms-fontobject    eot
It follows the prescription I had adopted from a boilerplate .htaccess file several years ago. But researching the matter a bit, it seems the validator is right, as the proposed change to woff and woff2 in their mime types are found here:

https://dev.w3.org/webfonts/WOFF2/spec/#IMT

https://dev.w3.org/webfonts/WOFF/spec/#appendix-b

But this is still a bit vague to me. Could you provide a link to (or simple listing of) the precise mime types that should be reported for the standard collection of webfonts? (woff, woff2, eot, ttf, svg, otf). (Perhaps that's already been listed in another posting on the forum...my apologies if it has.)

Many thanks!

Re: Correct MIME types for webfonts?

Posted: Mon Mar 05, 2018 8:45 am
by Albert Wiersch
Hello,

Here is a good list of all MIME types:
https://www.iana.org/assignments/media- ... ypes.xhtml

And the font types are here:
https://www.iana.org/assignments/media- ... xhtml#font

Code: Select all

Name 	Template 	Reference
----    -----------     ---------
otf	font/otf	[RFC8081]
sfnt	font/sfnt	[RFC8081]
ttf	font/ttf	[RFC8081]
woff	font/woff	[RFC8081]
woff2	font/woff2	[RFC8081]
The "application/vnd.ms-fontobject" type is on the list but the other fonts are "font/*" types.

The above is what CSS HTML Validator goes by.

Re: Correct MIME types for webfonts?

Posted: Mon Mar 05, 2018 3:55 pm
by TomHTML
Thank you! That is very helpful!