Correct MIME types for webfonts?

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
TomHTML
Rank II - Novice
Rank II - Novice
Posts: 28
Joined: Sun Feb 04, 2018 10:19 am

Correct MIME types for webfonts?

Post by TomHTML » Sat Mar 03, 2018 7:12 pm

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!

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3359
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Correct MIME types for webfonts?

Post by Albert Wiersch » Mon Mar 05, 2018 8:45 am

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.
Image
Albert Wiersch

TomHTML
Rank II - Novice
Rank II - Novice
Posts: 28
Joined: Sun Feb 04, 2018 10:19 am

Re: Correct MIME types for webfonts?

Post by TomHTML » Mon Mar 05, 2018 3:55 pm

Thank you! That is very helpful!

Post Reply