This project is read-only.

Creating a Route for woff fonts?

Jan 26, 2011 at 2:23 AM


I'm trying to add some .woff fonts to the theme I'm creating, but I can't figure out how to set a route to allow any .woff files in either the Styles folder, or subfolder.  I have found two workarounds that are fine temporarily, but I'm hoping there's a quicker way to setup a custom Route.

Workaround include:

1) Encoding the font files using Base64, directly into a separate Fonts.css file, and then including that file through the Layout.

2) Adding the fonts to the Media folder, and using the URL that's provided via that process.

I would love to be able to work with different font files more quickly than either of the two previous methods, if anyone has any suggestions.


Jan 26, 2011 at 3:25 AM

You do not need to set a route. what happens when you put those in the styles folder? (it should just work)

Jan 26, 2011 at 4:29 AM

I can access images and CSS files in the Styles folder (and subfolders), but when I try to access any .woff files, IIS returns with a 404.

Jan 26, 2011 at 5:24 AM

Just to verify that it was either a routing or filtering issue, I published with the .woff file renamed as a .jpg. Since I'm specifying format('woff'), it's actually taking the .jpg file and working.

Jan 26, 2011 at 5:30 AM

That is extremely hacky :)

Seriously, IIS has a finite list of file extensions that it knows how to map to mime types and anything that's not there won't be served. I think you need to go into the IIS configuration and add a mime type for .woff.

Jan 26, 2011 at 5:44 AM

You have to be kidding me!  The hours...!

You're right.  Although there seems to be some confusion in typography forums as to what the mime type is supposed to be (I guess it hasn't been defined yet).  I've added it as an "application/x-woff", and it works perfectly.

Thanks for your help on this.  I feel silly for not checking there.