Use of Webfonts

Topics: Customizing Orchard, Writing themes
Sep 19, 2012 at 6:56 PM

Hello.

 

I am new to orchard and would like to use webfonts.
The gallery of google and the offered quality of the fonts is poor.

So, I would like to use fonts I have generated with fontsquirrel.
I do the reference inside CSS, such as I do it on any regular page.

It seems that orchard is parsing the reference out - so my fonts are not used.

I wonder if someone here has a solution - otherwise this would be the killer argument to nor use orchard - but I am sure I am struggeling because of the knot in my head ;-)

Thank you in advance for the solution.
Cheers,
Stefan 

Developer
Sep 19, 2012 at 10:15 PM

Orchard parsing your references out? I can't understand this, Orchrad doesn't touch the content of your stylesheets.

Although I've never tried, this should work just with any stylesheet, as the default TheThemeMachine also includes an external font.

Coordinator
Sep 19, 2012 at 10:47 PM

There is nothing Orchard does, *nothing*, to your css files: they are being served directly by IIS. Orchard does not even glance. I use Google fonts on most of my themes without a problem. Something else is going on. Open your browser's dev tools and look at the network trace.

Sep 20, 2012 at 12:07 AM

I don't think Orchard is the problem here. If your file is a .woff or .svg, your problem more likely lies with IIS. Basically, it doesn't like unknown shizzle. So if your font file is say a .woff , you will need to explicitly tell IIS that it is a-okay. 

Open the web.config file in the Orchard.Web, and insert the code into the relevant section:

<configuration>

    <system.webServer>

        <staticContent>

     <mimeMap fileExtension=".woff" mimeType="application/x-woff" />

     </staticContent>

    </system.webServer>

</configuration> 
I think this would be the solution. I don't really know much about what I am talking about here. Hope it helps anyway.