Font Face isn't working in IIS 8.0

joetinger picture joetinger · Sep 11, 2014 · Viewed 65.1k times · Source

I have a font-face in my program generated from Font Squirrel I just can't get it to work in IIS, it works in localhost. I added application/font-woff article to my MIME Types but it still doesn't want to work.

Context
--Fonts
----font location
--css files

CSS

@font-face {
    font-family: 'wallStreetFont';
    src: url('Fonts/subway-webfont.eot');
    src: url('Fonts/subway-webfont.eot?#iefix') format('embedded-opentype'),
         url('Fonts/subway-webfont.woff2') format('woff2'),
         url('Fonts/subway-webfont.woff') format('woff'),
         url('Fonts/subway-webfont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

EDIT CURRENT MIME

I am using the default IIS 8 MIME font/x-woff

Answer

Colin Bacon picture Colin Bacon · Sep 11, 2014

Great to see WOFF2 being included in Font Squirrel fonts! Whilst IIS 8 does not need a mime type added for WOFF it will need one for WOFF2. The W3C recommends:

application/font-woff2

For more info on WOFF2 see here.

To add the mime type in IIS, modify your Web.Config as follows:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <!-- ... -->
  <system.webServer>
    <!-- ... -->
    <staticContent>
      <!-- ... -->
      <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
    </staticContent>
    <!-- ... -->
  </system.webServer>