Web Font MIME Types Config for web.xml

I recently came across a Java web app container with decrepite defaults. The SAP owned Web Application server did not have any MIME types for serving web fonts!! Such disappoint in the web.xml!

You'll note that web fonts (@font-face) have been around for quite a while, see the can i use page.

The CSS from an agency used custom fonts, and they included all the mappings to try and cover all historic variations of fonts that different browsers eat. This is probably good.

However the short answer for web fonts in 2014 is that you probably want to provide TTF for every browser except IE to use, and for IE you probably want to provide EOT for the IE versions to use, or perhaps just WOFF if you only need IE9+ support.

Here is a snippet in the hope it helps you out.

Set up MIME type mappings so that we can serve modern web fonts.  For reference see:

eot   =>  "application/vnd.ms-fontobject"
woff  =>  "application/font-woff" (per my last paragraph)
ttf   =>  "application/x-font-ttf" or "application/x-font-truetype"
svg   =>  "image/svg+xml"
otf   =>  "application/x-font-opentype"






Copyright © 2013 by Damon van Opdorp.