Search code examples
cssfont-faceblueprint-css

Why doesn't this @font-face style apply to my HTML?


I am hoping someone can please point out what's not working about this font-face implementation. I've testing this using the body tag so there's no question as to whether the issue is with the HTML (yes, I do have a body tag.)

I have obtained the fonts and the implementation CSS from FontSquirrel. Thanks for looking at this!

CSS:

@font-face {
    font-family: 'DymaxionScriptRegular';
    src: url('DymaxionScript-webfont.eot');
    src: url('DymaxionScript-webfont.eot?#iefix') format('embedded-opentype'),
         url('DymaxionScript-webfont.woff') format('woff'),
         url('DymaxionScript-webfont.ttf') format('truetype'),
         url('DymaxionScript-webfont.svg#DymaxionScriptRegular') format('svg');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: DymaxionScriptRegular, courier;
}

File tree structure:

Screenshot of my development folder showing location of CSS, index.html and font files.

Screenshot of Courier fallback font:

Courier fallback font

Answer: Apparently if one leaves "Regular" off of the font-family declaration, everything works fine. Answered my own question by playing with it.

Real Answer: My first "answer" only worked in Safari. What worked in all of them was changing "'DymaxionScript-webfont..." to '../DymaxionScript-webfont... After I did that, everything worked. It was bad pathing.


Solution

  • Here is a more concise @font-face implementation, that I know works across the board:

    @font-face {
        font-family: 'DymaxionScriptRegular';
        src: url('/path/to/font/webfont.eot?') format('eot'),
             url('/path/to/font/webfont.woff') format('woff'), 
             url('/path/to/font/webfont.ttf') format('truetype'),
             url('/path/to/font/webfont.svg#webfont') format('svg');
        font-weight:normal;
        font-style:normal;
    }