Home > front-end development, typography > Bulletproof @font-face syntax

Bulletproof @font-face syntax

September 4th, 2009

Let me introduce you to the best way to do your @font-face definitions:

@font-face {
  font-family: 'Graublau Web';
  src: url('GraublauWeb.eot?') format('eot'), url('GraublauWeb.woff') format('woff'), url('GraublauWeb.ttf') format('truetype');
}

This is the Fontspring @font-face syntax. I'll circle back to why this is the best possible solution but let's first review the other techniques' weaknesses. Of course, the problem at the center of this is that IE needs an .eot font, and the other browsers must take a .ttf or .otf.

May 12th, 2010. If you're looking to just put @font-face to use today, just head to FontSquirrel's generator. It is an indispensible tool when implementing @font-face. If you want to know more about some of the why's, carry on…

Okay, let's see what we got here…

Conditional comments (via)

<!--
@font-face{
  font-family:'Graublau Web';
  src: url('GraublauWeb.otf') format('opentype');
}
-->
 
<!--[if IE]>
<mce:style type="text/css" media="screen"><!
@font-face{
  font-family:'Graublau Web';
  src: url('GraublauWeb.eot');
}
-->

Ugh. Seriously? We'd have to drop that in every html file or have unique iefonts.css files. No fun. Also, ugly.

Double declarations (via)

@font-face{
  font-family:'Graublau Web';
  src: url('GraublauWeb.eot'); /* here you go, IE */
}
@font-face{
  font-family:'Graublau Web';
  src: url('GraublauWeb.otf'); /* everyone else take this */
}

The problem here is that, as Andrea points out, IE will actually download the .otf file. We can't have extra HTTP connections, so this is typically the solution:

@font-face {
  font-family: 'Graublau Web';
  src url('GraublauWeb.otf') format('opentype'); /* IE no comprende format()! */
}

Because after all, IE doesn't understand the format hint, right? It's true. But what really happens is that IE does a request for this filename:
GraublauWeb.otf')%20format('opentype

Oops, looks like someone forgot a ? in their regular expression! But hey, a 404 is a lot better than grabbing a file that's 20-100k. Let's kill that 404:

Mo’ Bulletproofer (via)

@font-face{
  font-family:'Graublau Web';
  src: url('GraublauWeb.eot'); /* here you go, IE */
}
@font-face{
  font-family:'Graublau Web';
  src: url(//:) format ('no404'), url('GraublauWeb.otf') format('opentype'); /* tricky! */
}

Richard Fink proposed this alternate syntax actually as a response to this post, but I've included it back here. The trick is to use url(//:), to prevent IE from 404'ing on the ttf/otf file. In his article he lists a few reasons why he prefers the semantics of this alternative. I understand the argument, but I don't like repeating myself, so I'm gonna keep trucking:

The local reference

@font-face {
  font-family: 'Graublau Web';
  src: url(GraublauWeb.eot);
  src: local('Graublau Web Regular'), url(GraublauWeb.otf) format('opentype');
}

Much more concise and clean. Here, non-IE browsers skip any .eot file and move on. IE will try to parse the second src value, but it can't understand the local() location nor the multiple locations, so it resorts to the EOT instead. Worth noting that IE will always dive to the last src:url() value to start, so this won't work.

src: url(GraublauWeb.eot);
src: url(GraublauWeb.otf); /* Yeah IE will only try this one. :( */

The other benefit.. if it just so happens that a user actually has your custom font installed, this'll save them the download. The one catch is that Safari on OS X will use only the Postscript name instead of the full font name; so when they differ, include both names:

Bulletproof @font-face

@font-face {
  font-family: 'Graublau Web';
  src: url('GraublauWeb.eot');
  src: local('Graublau Web Regular'), local('Graublau Web'),
         url('GraublauWeb.otf') format('opentype');
}

Bulletproof @font-face: Smiley variation

@font-face {
  font-family: 'Graublau Web';
  src: url('GraublauWeb.eot');
  src: local('?'),
         url('GraublauWeb.otf') format('opentype');
}

Added 2010.02.04: There has been concern over specifying local font names. The primary reason is that you cede control to the user's machine, potentially showing a locally installed font instead of the one you want to serve. While that will load faster, there's a very small chance the file could be wrong.

To account for this gotcha, I've specified a local font name of ?. Yes, it's a smiley face. The OpenType spec indicates any two-byte unicode characters won't work in a font name on Mac at all, so that lessens the likelihood that someone actually released a font with such a name. This technique is recommended if you think a locally installed version of this font is not in your best interest.
Added 2010.05.05: The smiley variation is my new recommendation. ← Click through to read why.

The Fontspring @font-face syntax

Ethan (the same guy behind Font Squirrel), figured out a trick to make it work everywhere (including IE6, Android, iOS) including all the bugs the above tricks work around.. It's called the Fontspring @font-face syntax. It goes a little something like this:

@font-face {
  font-family: 'Graublau Web';
  src: url('GraublauWeb.eot?') format('eot'), url('GraublauWeb.woff') format('woff'), url('GraublauWeb.ttf') format('truetype');
}

Remember that 404 problem from above? The question mark solves that. That's about it.

Also worth noting, the correct format type for an .eot is 'embedded-opentype'. But if you change it to anything invalid, IE9 will prioritize the WOFF file above the EOT, which is good! So we use 'eot'.. but this could just as easily be 'ie9-give-me-the-woff-instead'.

Demo

I've added a test page with a few syntax variants here for crossbrowser testing

Additional notes and gotchas:

  • Including a font-variant property inside the definition will cause it to not work in Safari (4.0.3 tested) as well as IE 6-8. (Thanks Sid)
  • Including a font-style property the definition is safe and the definition will still succeed with all browsers, however IE ignore what you define it as.But if you want a bold or italic style of a font to display, you'll need to make two definitions. Read the It Takes Two, Baby section on Nice Web Type's how to use css font face article
  • Opera will fail if you do not use quotes (single or double) in your local() font name. So: local('Use Quotes'). I've filed this bug with Opera as it's a spec violation. Thank you to Scott Kimler and Richard Fink for helping with the tireless research on Opera's quirks.
  • Safari permission error? Some people experience a dialog asking for permission to use a local font. This only happens in webkit. [screenshot]
    • Thibault Bardat-Bujoli indicated that this behavior is due to Linotype FontExplorer X. For any font added but not 'activated', it will intercept requests to use it. You can disable this behavior within the FontExplorer UI [jpg]. I have heard no reports of this behavior on machines lacking FontExplorer
    • More on my @font-face gotchas post
  • Chrome? A few rumors are going around that a Chrome beta or dev build has @font-face support. There is no install of Chrome that has @font-face enabled by default [actually, it's in dev builds now!], however you can enable it in Chrome 3 with an executable switch. I'm keeping this page on @font-face and Google CHrome up to date with all the details.
  • You can feed FF, Opera and Safari a truetype but specify it as format('opentype') and it's just fine. So for all intents and purposes, if your font is opentype or truetype, the format hint is optional.
  • The font name that specified in your @font-face declaration cannot exceed 31 characters in length. IE will fail on anything larger.
  • I first found this bulletproof technique in use by Mark Pilgrim at http://diveintohtml5.org. My hat is off to you, good sir.

SVG? WOFF?

Since Google Chrome won't have typical @font-face support until version 4, we can snag it early by serving it SVG fonts. WOFF is a new format that is officially supported in Firefox 3.6 Can we integrate those into this syntax? Definitely.

@font-face {
  font-family: 'Graublau Web';
  src: url('GraublauWeb.eot');
  src: local('?'),
    url("GraublauWeb.woff") format("woff"),
    url("GraublauWeb.otf") format("opentype"),
    url("GraublauWeb.svg#grablau") format("svg");
}

The order of those is deliberate and discussed in the comments here. Hat tip to Snook for being the first to drag SVG into the party. Font Squirrel and Nice Web Type have also been very thoughtful in their work.

Android :/

Bulletproof smiley doesn't work in Android 2.2-2.3 (which supports @font-face, but not the local() definition). Personally, I'm okay with that because I don't want to wait another 5 seconds for 100kb of fonts to load before I actually see text (thanks webkit FOUT bug).

But hey, some people might prefer webfonts over quick loads.. and for you, there is a pretty okay fix to that:

@font-face {
  font-family: 'Graublau Web';
  src: url('GraublauWeb.eot');
  src: local('?'),
    url("GraublauWeb.woff") format("woff"),
    url("GraublauWeb.otf") format("opentype"),
    url("GraublauWeb.svg#grablau") format("svg");
  }  
@media screen and (max-device-width: 480px) {
  @font-face {
    font-family: "Graublau Web";
    src: url("GraublauWeb.woff") format("woff"),
    url("GraublauWeb.otf") format("opentype"),
    url("GraublauWeb.svg#grablau") format("svg"); 
}}

For mobile we redeclare the @font-face declaration without the local() guy. We'll also give it the woff, opentype and svg, even though no mobile devices support WOFF so far. Also for this media query to succeed in Android Webkit, you're gonna want a viewport meta tag.

 <meta name="viewport" content="width=device-width, initial-scale=1.0">

That'll do. :)

I'm confused and lazy. Help?

Want to absorb the benefits of this article instantly? Use Font Squirrel's awesome @font-face generator. It does all of this for you, and more. If you're less lazy, read through Nice Web Type's How To for all the deets.

2009.09.10: Esta entrada del blog en español: Sintaxis de @font-face | CSSBlog ES

2009.09.11: Una buona panoramica e questa tecnica in italiano: font-face e Webfonts: come usarli

2009.09.16: I've updated the article with the Mo' Bulletproofer syntax as well as some more detailed gotcha's and notes.

2009.09.18: This blog article has been translated to Japanese

2009.09.22: Added details around the Safari permission error, which Thibault Bardat-Bujoli tracked down to the Linotype FontExplorer X app.

2009.11.08: New sections for SVG/WOFF and the Font Squirrel generator. Link to Nice Web Type's How To article for doing italic along with normal.

2009.11.17: Note on font name length from FontSquirrel.

2009.12.02: Update on Chrome support with link to Chrome and @font-face: it's here!

2010.02.04: Added the smiley variation.

2010.05.05: Changed default recommendation to the smiley variation. A while bunch of new things to consider: @font-face gotchas.

2011.02.01: Added the android bit.

2011.02.03: Updated with fontspring syntax! Go Ethan!

Take a look at some of my other (recently updated) webfont stuff:

front-end development, typography

  1. September 4th, 2009 at 02:04 #1

    I like the solution and thanks for test cases.
    The only problem I can spot is that IE will never use the local font even if it is present, will it?
    Being fonts something totally re-usable I'd love to find a perfect way to split the specific file inclusion for IE and not IE browsers, without usage of ugly un-masked conditional comments.

  2. September 4th, 2009 at 02:51 #2

    @Andrea Giammarchi,

    Here's what I think would work:

    /* let's say a an IE user has Futura installed locally */
    @font-face {
      font-family: 'FuturaEmbed'; /* we can name this whatever we want */
      src: url(Futura.eot);       /* IE will download this anyway */ 
      src: local('Futura'),       /* It'll ignore this.. */
             url(Futura.otf) format('opentype');
    }
    h1 { font: 16px 'Futura',     /* default to an installed futura first */
                    'FuturaEmbed',/* failing that, use the eot */
                    'Trebuchet MS', Tahoma, sans-serif; }

    So in this case we'd be using the local font, but couldn't prevent the .eot download, so it may be all for naught. :/

  3. September 4th, 2009 at 14:29 #3

    Paul (and Andrea) … Thanks! I've tested your assertions, the code and even played a tad with IE grabbing a local copy.

    Paul set me to tinkering

  4. September 4th, 2009 at 15:13 #4

    This is great. @font-face never made so much sense until now :)

  5. September 4th, 2009 at 17:07 #5

    Wow, I haven't even thought that IE could download both font files.
    This is great solution and now we really have to let people know about it.
    Thanks Paul.

  6. September 4th, 2009 at 17:18 #6

    So STK went ahead and validated everything presented here, as well as verifying that in my comment above, IE will download the EOT even if the font is locally installed.
    Great thorough research: Better @font-face syntax @ randsco

  7. September 4th, 2009 at 18:22 #7

    LOL @ thorough, 'twas more a "stream of consciousness" thing, but thanks!

    I've updated the cross-browser font embedding tutorial, crediting you and Andrea for your contributions.

    Thanks for sharing Hopefully, we'll get the word out, before everyone is running around posting two @font-face selectors!

  8. September 7th, 2009 at 20:31 #8

    Great work, good to see smarter solutions popup now that a large majority of the browsers support @font-face.

  9. September 11th, 2009 at 15:44 #9

    Paul,
    In my tests, Opera isn't accepting your syntax.
    So far, OK with Safari, FF3.5. But Opera is bombing out.
    Have you tested with it, as yet? Maybe I'm missing something.

  10. September 11th, 2009 at 16:11 #10

    Seems that Opera doesn't support "local". Once again, unless I'm missing something.

  11. Jono
    September 12th, 2009 at 22:56 #11

    Could we simply use filters?

    @font-face{
    *font-family:'Graublau Web'; /* here you go, IE 6 and 7 */
    *src: url('GraublauWeb.eot'); /* here you go, IE 6 and 7 */
    font-family:'Graublau Web'; /* everyone else take this */
    src: url('GraublauWeb.otf'); /* everyone else take this */
    }
    Sorta' di(e)rty, but it ought to work.

  12. September 13th, 2009 at 11:56 #12

    So far this is the most "Bulletproof" for me.

    @font-face {
    	font-family: 'Graublau Web';
    	src: url(GraublauWeb.eot);
    	src: url(GraublauWeb.otf) format("opentype");
    	font-style: normal;
    	font-weight: normal;
    	@-moz-document url-prefix()
    	{
    		src: local('Graublau Web Regular'), url(GraublauWeb.otf) format("opentype");
    		font-variant: normal;		
    	}
    }

    This way at least FF can enjoy the benefits of "local" without breaking Opera and Safari doesn't break when using "font-variant". But I'm looking forward to seeing better solutions.

  13. Eduardo
    September 14th, 2009 at 07:30 #13

    The shame is that, even with this is a new keyword, we are already making hacks

  14. September 14th, 2009 at 12:28 #14

    @Eduardo, the web is a hack. :) At least this technique validates (for those that care). But as browser implementations will *always* differ, we can always expect this sort of deal with new technologies.

  15. September 14th, 2009 at 19:50 #15

    @eduardo
    Hacks are price we pay for freedom from reliance on a single vendor.

    @paul
    Re: Opera. Yes, I WAS missing something. local() works OK in Opera. But Opera will not accept a call to an EOT file. Opera's Dragonfly debugger explains it as an "invalid src property". Further, unlike the other browsers, Opera doesn't just ignore the rule and move on to the next. It throws out the whole @font-face rule that contains the call to the EOT.
    This is quite deliberate. I believe the standards compliant thing to do would be to ignore the rule and attempt to parse the next.
    Seems like somebody just doesn't like Microsoft. ;)
    Regards, Rich

  16. September 15th, 2009 at 09:06 #16

    Did anyone figure out a way yet to use eot files with font-style? As far as I know it shouldn't work in IE by just including the property. But maybe there is a hack to get around this.

  17. September 15th, 2009 at 12:15 #17

    Btw ya'll, Richard Fink proposes some new syntax with the double declaration technique due to Opera ruining the party for everyone.
    http://readableweb.com/mo-bulletproofer-font-face-css-syntax/

    I haven't yet dug into Opera's problems but will update this article with what I find.

  18. September 16th, 2009 at 13:49 #18

    After your email, I created some testcases at
    http://dl.getdropbox.com/u/2042542/font-face.html using your original bulletproof syntax and adding font declarations. It seems as if IE and Safari can't deal with font-variant.

  19. September 16th, 2009 at 14:59 #19

    I've updated this post with Richard Fink's syntax as well as a large section of detailed notes after much research.

    I should note that, at this point, the syntax still hasn't shown any reproducible irregularities. (aka. it's bug-free!) But there are certainly some catches with font-style/variant/weight that change things. So expect a secondary post on that. :)

  20. September 19th, 2009 at 21:40 #20

    Maybe it's just me, but Firefox 3.5.3 won't render the correct font if a) the custom font is not installed on the local computer and b) the format is defined like so:

    …url('/media/font.ttf') format('opentype');

    Only this will work:

    …url('/media/font.ttf');

  21. September 20th, 2009 at 15:45 #21

    About your Safari permission error, it deoesn’t seems to be a Safari issue but instead a Linotype Font Explorer one.
    There is a preference controlling the font requests.
    At least that’s what I’ve experienced and solved (You just need to set up Safari to ignore the font requests :-)

    I’ve got a test page at http://www.thyb.net/cosmos/index-fonts.html and I’m still fighting between postscript names from Safari and full font names in Firefox, the font-variant and the slow loading time.

    So I hope I’ll be able to use corectly @font-face now with your great article.

    Thanks again.

  22. September 22nd, 2009 at 10:52 #22

    @Nick Sergeant

    Can you take a look at this page and indicate which examples are in the webfont?
    http://dl.getdropbox.com/u/39519/webfontsdemo/index.html

    I would expect all but the 'locally installed with local font name' to work, but your bug report would indicate none but the 'no format property' one should work.

    It'd be unexpected but interesting if the latest FF3.5 on Snow Leopard showed unique behavior. Thanks.

  23. September 22nd, 2009 at 10:56 #23

    @Thibault
    I emailed you privately, but thanks for the report. It's great to track down this permissions issue. So if we can blame it on Linotype Font Explorer, I think we're in the clear. :)

  24. September 22nd, 2009 at 12:38 #24

    I've updated the article with Thibault's new research around the permissions dialog and FontExplorer X.

  25. September 25th, 2009 at 05:01 #25

    First a disclaimer: I haven't tried @font-face yet. My immediate reaction after reading this article is that a conditional IE-only stylesheet is actually the "best" way to handle this – it's widely recognised that all other solutions to make IE use different CSS to the other browsers are essentially hacks, which could possibly break in a year or two when new browsers are launched, or existing browsers are updated, wheras making use conditional comments are supported. Personally I prefer to have all my IE workarounds hidden away in a seperate stylesheet rather than polluting the global styles :)

  26. D Ross
    September 25th, 2009 at 08:00 #26

    Now to fix the caching issue.

    It takes about 2-4 seconds to see the @fontface font replace the standard html font.

    Ideas?

  27. September 25th, 2009 at 08:07 #27

    @Rick Hurst,
    I hear ya. I don't think this technique puts us at much risk (though a little, certainly, I concede). I mainly just don't enjoy the overhead of conditional comments. I also prefer conditionally classing my body rather than separate ie.css files, and you can't combine the two. But going the conditional comments route is safe, as long as we don't see other browsers adopting EOT-Lite.

    @D Ross
    I'll likely have a follow post about this (so grab the rss feed!), but can subset the font-file to make it much smaller (like 20k instead of ~50k), definitely cache it heavily. It looks like TypeKit is also introducing a feature where you can choose to have your text visibility:hidden until the font is ready. I haven't experiemented with this but I'm thinking of a few ways we could do something similar.

  28. D Ross
    September 25th, 2009 at 08:08 #28

    Also, what if you're using a font that's probably not licensed for web use? Not sure if it really protects me but I change the name of the font file so it's not so apparent. Kind of hard then to declare the local version right?

  29. September 25th, 2009 at 08:41 #29

    @D Ross
    If the license of the font you acquired or purchased does not allow you to use it with @font-face, then you're breaking the law. That's bad.

    There are lots of typefaces that allow this use and they're on fontsquirrel.com, and the league of moveable type, and the webfont.info wiki.

    There are an increasing amount of foundries that allow some sort of web embedding. Monotype/Linotype, for example, allow EOT @font-face as well as siFR and Cufòn. So it's worth looking into.

    I have a lot more about this sort of thing in my Employing Custom Fonts presentation.

  30. D Ross
    September 25th, 2009 at 14:03 #30

    @Paul Irish
    Hmm. I was just looking into it. I may be able to set the mod_expires or set caching in the htaccess. I'm not really a "server" guy but it looks easy enough. I'll probably give it a try soon.

  31. October 1st, 2009 at 03:13 #31

    hi great post but i could use a little more information. does this functionality only work in IE 8 or latest fire fox? what about previous versions? sorry i havent done my research and just came across this! nice one for the info.

  32. October 1st, 2009 at 14:26 #32

    Hi Paul,

    I have a site that originally used Cufon for font replacement: http://blog.franklyrealty.com/

    All was well and good until the WP 2.8 upgrade. Then Cufon worked on main post page, but not others. I've decided to simply use @font-face b/c ultimately, it's faster and cleaner. BUT…I cannot get it to work in IE or Chrome…and I've followed all the .eot info, etc.

    What am I doing wrong?

    Thanks for your help!

  33. thomas
    October 6th, 2009 at 00:00 #33

    Hi,

    Many thanks for your article, when i tired the sample code of yours with the corresponding font files its worked well in local system. when tried to use my fonts ( i used the thesansplain-black etc… ) its not even working in firefox. what will be the problem here ?

  34. October 7th, 2009 at 19:21 #34

    Hi Paul,

    Thanks for share all this precious information with the rest of us. It has been most helpful.
    Unfortunately, I have been incapable of debugging a weird problem on Safari. On my web site http://www.workingbruno.com, if the page isn´t on cache, you will *not* see the declared font-face, but an alternate rule provided by Modernizr a small javascript library that you surely know… I´m quite lost on this one… don´t know if it´s a browser bug, a Modernizr problem or simply my mistake.

    Have you any insight on this?
    Thanks for your time.

    Best,
    B.

  35. October 7th, 2009 at 19:42 #35

    @Bruno
    I believe the .ttf file may be corrupt. Using webkit inspector I'm seeing the .ttf download, and your h2 is indeed changing, but I think it's falling back to arial, as Nevis fails. I would explore using some other files for the time being.

  36. October 8th, 2009 at 07:51 #36

    There is one thing I am not clear about. I have a font in four different variations, say
    - font-regular.otf
    - font-italic.otf
    - font-italic.otf
    - font-bolditalic.otf
    plus their .eot equivalents.
    The style sheet would then look about like this

    @font-face {
      font-family: 'The Font';
      src: url(font-regular.eot);
      src: local('font-regular.otf'), local('The Font'),
      url(font-regular.otf) format('opentype');
    }
    
    @font-face {
      font-family: 'The Font';
      src: url(font-bold.eot);
      src: local('font-bold.otf'), local('The Font'),
      url(font-bold.otf) format('opentype');
      font-weight: bold
    }
    

    and so on.
    When I do this, only the last rule is taken in account. What would be the right way to do this?

    Thank you for your time

    Dieter

  37. October 8th, 2009 at 09:49 #37

    @Dieter Raber
    I haven't yet experimented heavily with font weight/style/variant along with @font-face, but I've seen plenty of reports of inconsistencies.
    My recommendation right now is to name your variations different things and use the names instead of font-style and font-weight to change.
    Less than great, but it'll certainly work.

  38. October 21st, 2009 at 11:10 #38

    Is there any way to use @font-face in a Blogger blog?

  39. chro
    October 22nd, 2009 at 06:54 #39

    just wanna say that chrome 0.3 support svg font

  40. chro
    October 22nd, 2009 at 08:29 #40

    it seems otf are not working on opera 10
    only ttf – am i right?

  41. October 29th, 2009 at 22:50 #41

    I created a web page, and I want to use the French Script MT font. Can you help me to use the @ font-face (how to write the code)for the French Script MT font?

  42. November 8th, 2009 at 21:35 #42

    Here's to confused and lazy!

  43. November 19th, 2009 at 10:15 #43

    I think I've found a way round the problem of IE downloading the font, even when it's already present on the system.

    I'm working on a site for a client right now and am using a fairly widely available font (Arial Narrow). However, some older systems don't have it – my Win2K test system, for example. I therefore didn't want every Internet Explorer user to have to download the font just on the offchance they didn't have it already.

    The solution I ended up using was a mix of Javascript and the CSS rules already described. First, I made a regular CSS file, with the following:

    font-family: "Arial Narrow", "ArialWeb", Arial, Helvetica, sans-serif;

    Next up, I made an additional file called webfont.css, and put in it:

    @font-face {
      font-family: 'ArialWeb';
      src: url('arialnarrow.eot');
      src: local('Arial Narrow'), local('Arial Narrow Regular'), url('arialnarrow.ttf') format('opentype');
    }

    Step three: I grabbed the fantastic JavaScript font detector, available here:
    http://www.lalit.org/lab/javascript-css-font-detect

    Step four, I wrote a little JS to get called when the page is ready:

    var font = new Detector();
    if(font.test('Arial Narrow') == false) {
    	var cssload = document.createElement("link")
    	cssload.href = "http://mysite.com/webfont.css"; // This may not need to be absolute path, I just made it one 'cos it was easier
    	cssload.rel = "stylesheet";
    	cssload.type = "text/css";
    	document.body.appendChild(cssload);
    }

    …and that's it! If the font is already on the user's machine, it'll display because it's been declared in the regular CSS file. If it's not, then the JavaScript will include the web font (for IE or other browsers), and the second font declared in the regular CSS file – our web one – will then get used.

    The only problem is that there's a brief flicker of the old font before the new one appears, as it's being loaded at the end of the document. Any suggestions much appreciated!

  44. November 26th, 2009 at 23:13 #44

    I do not seem to get it working with the latest build of chrome. Site works fine with IE and Firefox on several test machines. Anybody has the same problem?

  45. murraybiscuit
    November 27th, 2009 at 03:54 #45

    thanks for the code guys. please can the various vendors now play nicely on some kind of a standard, or at least support multiple formats. i use sifr quite often and it just feels like a slow hack to me. i'd like to see embedded fonts getting traction.

    my main issue aside from the code is the legality around font licensing. let's face it, no open source fonts really compete with the diversity of the established foundries.

    found a helpful online facility to generate woff, eot and svg versions if anybody needs a pretty frontend that does it all.

    btw, paul, checked out aurgasm. what a rad site – keep up the passionate work.
    http://www.fontsquirrel.com/fontface/generator

  46. murraybiscuit
    November 27th, 2009 at 03:57 #46

    @Diederik
    chrome & iphone = svg
    ie = eot
    ff = woff

  47. murraybiscuit
    November 27th, 2009 at 03:59 #47

    @murraybiscuit
    sorry, just saw the font-squirrel link. scratch that.

  48. Jason Pantsoff
    December 2nd, 2009 at 03:52 #48

    font-family: helvetica,arial; /* ftw */

  49. December 2nd, 2009 at 12:25 #49

    @Paul Irish

    When using multiple styles and weights, it's worth including font-style:italic; and/or font-weight:bold; in the @font-face declarations for bold and/or italic fonts, even when assigning each file to its own font-family. Without this, using CSS to assign italics or bold will result in Firefox 3.5 to make an italic face oblique (yay, slanty italics) and to make a bold face extra bold.

    (Of course, if you don't want to bother providing bold and/or italicized text to browsers that don't support @font-face, then resetting everything to normal weight and style will have the same effect.)

  50. December 2nd, 2009 at 22:11 #50

    The permissions error will also show up in Firefox for Mac if you've got a font on a separate partition, in my case, for Boot Camp.

  51. December 3rd, 2009 at 05:11 #51

    Very useful….nice & clear thanks

  52. December 3rd, 2009 at 05:36 #52

    Nice article. Shame there's no decent support for converting fonts for IE on Mac yet. Not that I can find anyway.

  53. December 3rd, 2009 at 09:59 #53

    Fontforge http://fontforge.sourceforge.net/ is available for Mac as well as for Windows and Linux. The interface is pants and it requires X11 but it has a lot of functionality.

  54. December 3rd, 2009 at 10:04 #54

    @David Bennett
    I wrote a similar script, basically attempting to detect if @font-face was supported.. Using the same basic technique, but a little bit more robust. It's a hard problem to solve..
    http://paulirish.com/2009/font-face-feature-detection/
    As for defeating the FOUT, you can run my test there in the <head> so that's gonna be your fastest way to get things moving.

    @Erik Vorhes
    Thanks for the comment on font-style and such. I haven't yet done much research in this area but hope to see something soon. I know Opera has had some troubles integrating font-style into the @font-face declarations.

    @Nathan Hammond , Oh nice. thanks for the heads up on that. Just yesterday I found yet another reason you may get that permissions error, too.

    @Andy, I'd really suggest using the Font Squirrel generator for all your conversion needs: http://www.fontsquirrel.com/fontface/generator

  55. December 3rd, 2009 at 17:53 #55

    @Paul Irish
    For what it's worth, it appears that Opera 10.10 doesn't have problems with font-style or font-weight.

  56. December 8th, 2009 at 06:20 #56

    @Paul Irish
    That's a good shout. I didn't want it slow the page loading, but then I guess it makes more sense for it to take a second longer to load the page in the first place than to do the nasty flash! Liking the approach to calling the font-face file as well; anything that cuts down on server requests is always to be supported!

  57. December 10th, 2009 at 16:03 #57

    Thanks! I was looking to for a tutorial for embedding fonts!

  58. December 16th, 2009 at 12:33 #58

    i am using the same technique for “myriad pro” but not coming in any browser. I have already uploaded eot & ttf files on the server and calling them…..please help

  59. Lampica
    December 25th, 2009 at 02:21 #59

    Am I just imagining this somehow? All of my tests have confirmed it but none of you bloggers have mentioned it..

    If the name specified in font-family:'name'; is not the real name of the font then IE won't use the font when you assign that font in a style rule. At the very least, this makes the character limit a potential problem. It also means that FF will use their local font if it exists, even if you don't specify any local sources, because if the font-family: = "the real name of the font", and that font is installed on the system, then FF will use the local font.

    Am I missing something here? Can anyone else either confirm this (so I know I am not just losing my mind) or prove it wrong (and wake me up from this strange dream).

    I also can not understand why any of you would want to use local fonts at all. Haven't you ever encountered messed up fonts installed on people's computers? They are not actually all that uncommon. And with @font-face inspiring many inexperienced people to start doing their own font conversions, the number of messed up fonts in the wild is only going to increase.

    I checked on some of the browser screen capture services and found a good number of their systems to have faulty fonts installed. Most of the screens looked perfect but in some cases my font was clearly being used but it had a different Q and K. On a different test with a different font a few of the test systems showed bold instead of regular (not a browser rendering difference, clearly the bold version of the font), and I had only defined one font and not defined any styles. The only place the bold version could have come from is their systems.

    I have seen such messed up fonts many times while working on other people's computers and always wondered where they came from. Using the Font-Squirrel converter to convert fonts, often produces such fonts where the italic version is named "regular" and the bold version is named "italic" or other such funky naming issues. A good number of their pre-packaged @Font-face kits also have such issues. I have also run into similar naming issues using other font conversion utilities.

    This is not so much an issue for me at the moment because right now I am not using @font-face in any professional work (I would like to, but there are still to many wrinkles), and the personal project I am putting together only uses fonts that I personally created and I know for a fact that no local sources will exist.

    Don't get me wrong here, I don't mean to cast a bad light on Font-Squirrel or anything. I love what they are doing and in time I am sure all of these issues will be ironed out.

  60. January 1st, 2010 at 20:09 #60

    @Lampica Are there any specific examples you can cite? I did not know that there were problems like this. Thanks!

  61. Lampica
    January 4th, 2010 at 20:41 #61

    Hi Font Squirrel,
    I've been out of town for the past few days. I should be home tomorrow or the next day, at which point I think I can give you a couple specific examples.

  62. Stacey
    January 5th, 2010 at 01:30 #62

    I'm very new to web design. Still attending CC for my certificate. I have an html doc that dreamweaver was used to create & has some inline css for the fonts chosen. Font in a red suit for 1st choice in size 36 no headings, 2nd choice is papyrus bold no headings for the title. I have a small amount of text that I only want to be in papyrus bold. I can't seem to figure out where to place the @font-face code etc. or what exactly it should be, even after reading & re-reading every single piece of info on the web. I think I might need someone if at all possible to look at my code. I used the drag & drop features of dreamweaver to create it, because I am just not good enough at writing the html yet. I can't use external style sheets because this is for en ebay template. eBays system is copy & paste for html. So once again my css is inline. I've tried dropping the font files into the font generator from fontsquirrel , but just keep getting an error with a red X in a box. Some of my text was done in photoshop because that text wont ever change so I made it part of the images. But some text will need to change on a regular basis, & also needs to be searchable through tags in eBays system so it can't be an image. How can I find out what the exact code should be & where to place it in the html doc? Thank you for any assistance! Stacey

  63. stacey
    January 5th, 2010 at 06:58 #63

    Update, finally got the font squirrel to generate the zip files, but when I open the demo.html the font doesn't display correctly. When I try to open the .eot file it wont open in IE, neither will the .svg or the .woff, only the tff opens in firefox & displays correctly. Not sure what to do with the css files, except maybe copy the code into my html file, but where to place it exactly, since I'm using inline I'm not sure? Thank you for any assistance, Stacey

  64. Lampica
    January 5th, 2010 at 22:54 #64

    @stacey
    I would be willing to help you out for free, but I suggest you go post your question at http://www.codingforums.com/forumdisplay.php?f=13 as it will be much more convenient and appropriate for me to help you there. Just create an account there and then post your trouble in the html/css section and I will see it and help.

  65. stacey
    January 6th, 2010 at 23:46 #65

    @Lampica
    Thank you for your response. I will go to the link you provided within the next couple of hours. I found out a little while ago, that I need to use embedded CSS. Still not sure how it should look code wise. But will fallow your request shortly. Thank you!

  66. Lampica
    January 7th, 2010 at 08:42 #66

    @Font Squirrel
    Finally made it Home (a week later than planned). I guess I'll drop you a line through the contact form on the Font Squirrel website and give you some examples among your @font-face kits.

  67. stacey
    January 7th, 2010 at 21:32 #67

    @Lampica
    Just wanted to let you know that I did as you said, but was asked to post my question in the private message utility per Apostropartheid, who said she deleted my original post to you. I will repost in the private utility.
    Stacey

  68. stacey
    January 7th, 2010 at 21:38 #68

    @Lampica
    unable to send you private message @ codingForums.com because they can't find you as a user.
    Stacey

  69. stacey
    January 7th, 2010 at 22:01 #69

    @Lampica
    Cant post in private utility as system doesn't recognizance user.

  70. stacey
    January 7th, 2010 at 22:04 #70

    @Lampica
    cant send you private message cause system doesn't recognize user

  71. stacey
    January 7th, 2010 at 22:18 #71

    @Lampica
    just wanted to let you know that I did as you said, but was asked to post my question to you somewhere else, Apostropartheid emailed me back & said there is no user named Lampica & removed my post. Not sure what I should do? I didn't see the reply button until now.
    Stacey

  72. Lampica
    January 7th, 2010 at 22:42 #72

    Ok, just post it as a general question on the forum. Forget about Lampica. I am not always Lampica. Rest assured, I will see your question, it does not need to be addressed to me specifically. And please relax and give people some time to reply before posting multiple times. It may take me a couple hours – or it may take me a day or two, as I'm very busy. Just be patient though and I will do my best to help if I can.

  73. stacey
    January 8th, 2010 at 05:43 #73

    @Lampica
    sorry, there was some sort of system error, none of the posts were showing up, after several hrs. so I didn't think any of went through

  74. January 19th, 2010 at 11:19 #74

    U have a REALLY weird thing, maybe someone can help me?
    I have a website which is divided into and hosted on two domains: http://www.qqleq.nl and http://www.filmmaken.nl. Hosted with the same provider and as far as I know, on the same apache system. Now I made this simple test.html file (see below). It uses the font files on http://www.filmmaken.nl. The test file works on (the latest) FF, but in (the latest) IE it works only on http://www.qqleq.nl, but NOT on http://www.filmmaken.nl. Also not if I make the font files local. Also not if I add an .htaccess file as suggested on some websites. How can the SAME script work on one domain and not on the other? I emptied the browser cache, no result. You can see the two identical files on http://www.filmmaken.nl/test.html en http://www.qqleq.nl/test.html . Does anyone have an idea?

    <html>
    <head>
    <TITLE>This is a test</TITLE>
    	<style type="text/css">
    @font-face {
      font-family: 'Adler';
      src: url('http://www.filmmaken.nl/fonts/adler0.eot');
      src: local('Adler Regular'), local('Adler'), url('/fonts/adler.ttf') format('truetype');
    }
     
    H1  {
    	background-color: black;
    	font-size : 16pt;
    	font-family : Adler, sans-serif;
    	color : #ffffe0;
    	border-style : solid;
    	border-color : Green;
    	border-width : thin;
    	line-height : 1.5;
    	margin-bottom : 0;
    	margin-top : 0 ;
    	padding-left:20 ;
    	padding-top: 3;
    }
    </style>
    </head>
    <body BGCOLOR=black TEXT=WHITE LINK=YELLOW VLINK="#FF8000" ALINK="RED" >
    <h1>Hallo</h1>
    </BODY>
    </HTML>
  75. January 24th, 2010 at 15:31 #75

    @Roemer Lievaart
    You're likely using an .eot file that is bound to a specific domain. Use the fontsquirrel generator to make a new eot.

  76. February 4th, 2010 at 15:42 #76

    Hy Guys, Hy Paul,
    I really like the attempts made here.
    Just one thing that bites me.
    Firefox < 3.1 supports SVG. Isn't there any way to enable the SVG-Text rendering for Firefox < 3.1?

  77. February 8th, 2010 at 13:33 #77

    Hey Paul.

    The 'smilie' trick quite clever. Never would have thought of that. I don't know whether the case of having several fonts with the name is common or not, but I'm sure it happens every now and then. This seems like a great way to prevent this special case – I wonder how often it happens.

    Z.

  78. February 9th, 2010 at 12:56 #78

    Paul,

    Thanks for the great work. Please take a look at this issue with Chrome, first reported on doctype.com. In some cases, it will be worth adding a few extra lines to enable synthetic bold/italic transformations to Chrome.

  79. Mike G
    February 9th, 2010 at 22:24 #79

    Hi Paul:
    I'm trying to learn this and came up with the following:

    @font-face {
    font-family: 'myfontname';
    src: url('http://www.mywebsite.com/font/GOODTIME.eot');
    src: local('GOOD TIMES')
    url('http://www.mywebsite.com/font/GOODTIME.ttf') format('opentype');
    }

    I have the eot file and ttf located as above. The problem is that it works in IE8, but not Firefox 3.6. I tried to find out where IE is getting the font, but it disappears if I simulate a typo error both in the first URL *or* the local font name. Can you help?

  80. February 10th, 2010 at 05:10 #80

    I'm confused by the references to the "font-variant" descriptor. According to the current CSS3 font spec for the "@font-face" rule (http://www.w3.org/TR/css3-fonts/#font-resources), the only valid descriptors in a "@font-face" rule are:

    font-family
    src
    font-stretch
    font-style
    font-weight

    "font-variant" is not listed.

    Undoubtedly, "font-variant" would be extremely useful. Are some browsers simply supporting this as an extension to the "@font-face" rule, or is there something I'm missing in the spec?

  81. February 10th, 2010 at 16:55 #81

    @Doug
    Good tip. It's going in my upcoming @font-face gotchas roundup.

    @Dean Hall
    AFAIK the font-variant doesn't belong inside of the @font-face declaration, but rather in your regular element styles.

    @Velten
    I don't see the support for SVG @font-face in Firefox as you claim:
    http://en.wikipedia.org/wiki/Web_typography#Browser_support

  82. February 11th, 2010 at 10:32 #82

    "font-variant" definitely does belong in element styles; I was assuming all the talk here was about using it in @font-face rules, which would be very useful for small-caps font files. I'm not sure why it's not in the CSS3 spec, considering the browser can choose a small-caps variant from system fonts; we should be able to provide a small-caps variant in @font-face rules.

  83. February 11th, 2010 at 10:55 #83

    @Dean Hall
    Gotcha. Yah I agree it makes sense to be able to declare it at that point. I suppose text-transform is another one that was left-out.

    I think it has to do with the spec authors being very anti- css macros. :)

  84. February 11th, 2010 at 11:22 #84

    @Mike G
    You are missing a comma after local(). That should fix it for FF as long as there's no problem with the TTF file – but if you created an EOT from it, it should be fine.

    @dean hall
    Font variant doesn't belong in the @font-face declaration. And stay away from font-stretch. No meaningful support as yet.

    rich

  85. vinod
    February 19th, 2010 at 04:00 #85

    Hi Paul,
    first & foremost I thank you for sharing this valuable property with us. I do however have one concern about it.

    I still see web designers/developers using sIFR/cufon rather than embedding fonts straightaway.

    Do you mind sharing demerits of 'font-face' with us?

  86. February 25th, 2010 at 09:47 #86

    Paul, I'd like to make a correction. You state: "The one catch is that Safari on OS X will use only the Postscript name instead of the full font name; so when they differ, include both names"

    This is not really true. Safari only supports specifying the font-FAMILY name in a font-family declaration (and as a fall-back, the PostScript name for cases where the other CSS font-* properties cannot select the face you want, such as an ornaments face).

    Your code as follows specifically says "Graublau Web Regular" which is a face name and not a family name, and should in fact not work in any browser unless you have a "Graublau Web Regular Regular" face installed! The actual family name is "Graublau Web", which is why the second match succeeds.

    src: local('Graublau Web Regular'), local('Graublau Web'),

    The font family name in Safari is exclusively determined from the NameID code 1 (family) as listed here:
    http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html
    NameID code 2 (face) is not used for matching CSS font-family properties.

    E.g. for PlatformID=1:
    1="Graublau Web" 2="Normal" -> font-family: "Graublau Web"; (the base face for a family)
    or 1="Arial" 2="Narrow" -> font-family: "Arial"; font-stretch: condensed; (an alternate face)
    or 1="Arial" 2="Rounded Bold" -> font-family: "ArialMTRounded-Bold" (PostScript name to select an otherwise unselectable face)

    Note that IDs 1 & 2 are the 'ordinary' family/face names, and on the Mac (PlatformID=1), a family can have unlimited numbers of faces. On Windows, historically a family can only have Bold and/or Italic faces, so some of what is really the face name has been pushed into the family name, e.g.
    PlatformID=3
    1="Arial Rounded"
    2="Bold"
    To compensate for this, name tables can now contain PlatformID=3, NameID=16 & 17 names which should contain the same values as the PlatformID=1, NameID=1 & 2 values (but obviously with different encodings).

  87. February 25th, 2010 at 09:51 #87

    Also, to follow up on a comment just above: font-variant does belong in @font-face delcarations, and its omission is an error. There needs to be a way of saying "this is the small-caps face for family WhateverFont".

  88. FontNotVisible
    February 26th, 2010 at 10:29 #88

    this simply isn't working for me. here is what i have in the stylesheet.

    @font-face {   
       font-family:'fatboyslim';   
       src: url('/fonts/fbsbltc.eot');  /*IE*/
       src: local('Fatboy Slim BLTC BRK'), url('/fonts/fbsbltc.ttf') format('truetype'); /* non-IE */  
    }   
    .fatboy {
    	font-family: fatboyslim , verdana, helvetica, sans-serif;
    	color: #0033CC;
    }

    and in the html i have an unordered list with list items that have the fatboy class. any help would be appreciated. I am testing in IE8 and FF3.5 on my local machine.

  89. dubbs
    March 8th, 2010 at 10:20 #89

    Has anyone got @font-face working on iPhone Safari? People claim to have made this work, but when viewed on device no custom fonts are used… Can anyone point me to a working example??? Love to find one as I am beginning to believe this is not actually possible!

  90. March 8th, 2010 at 12:17 #90

    iPhone Safari works with SVG fonts and @font-face. You can make these with the font squirrel generator. Snook also wrote up some words about this. :)

  91. March 8th, 2010 at 16:04 #91
     
    @font-face {
    	font-family: "MistralRegular";
        src: url("../type/Mistral.ttf");
        src: url("../type/Mistral.eot");
        src: local("MistralRegular"), 
        	 local("Mistral"),
             url("../type/Mistral.svg#Mistral") format("svg"),
    		 url("../type/Mistral.woff") format("woff");
    	}

    My approach has been to load the "ttf" directly for Firefox, as IE will skip over "ttf" and use "eot" and the rest using local lookup for mobiles using "svg" and modern browsers using "woff".

  92. March 16th, 2010 at 10:49 #92

    note there is a Safari bug with @font-face and having the following line in your css:

    @CHARSET "UTF-8";

    (fonts generated with font squirrel)
    only 1 font is loaded (if using several fonts) and is inconsistently displayed

  93. March 17th, 2010 at 09:41 #93

    @dubbs
    I'm struggling to get an SVG forn working on the iphone using font-face. I have seen an example that works but try as I might mine doesn't. I can only assume it's to do with the font?

  94. March 17th, 2010 at 11:25 #94

    @Tallchap
    Hmm.. I haven't had a tough time but I'd definitely recommend the FontSquirrel generator for hooking this all up.

  95. Daniel
    March 19th, 2010 at 10:07 #95

    Hi i have tryed out your cool font-face but i cant get to work in IE it workes fine i Firefox but not in IE i hade some trouble that the mime type wasent declared in IIS but i solved that..

    Please help …

    here is my CSS

    /* IE */
    @font-face{font-family:BellyBold; src:url(/_css/fonts/BellyBold.eot);}
    @font-face{font-family:BellyBlack; src:url(/_css/fonts/BellyBlack.eot);}
    
    /* non-IE */
    @font-face {
    font-family:BellyBold;
    src:url(//:) format("No-IE-404"),
    url(/_css/fonts/BellyBold.otf) format("opentype");
    }
    @font-face {
    font-family:BellyBlack;
    src:url(//:) format("No-IE-404"),
    url(/_css/fonts/BellyBlack.otf) format("opentype");
    }
    
    h1
    {
        font-family: 'BellyBlack', Tahoma;
        font-size: 30px;
        line-height: 21px;
        color:#333333;
    }
    
  96. Daniel
    March 22nd, 2010 at 06:20 #96

    Hello ill get to work when i check the html file localy on my coputer but when i set it up on the server it wont work..

    Any ideas??

  97. March 24th, 2010 at 10:05 #97

    So an issue I ran into, is that I had (apparently) two different copies of a font on two machines and when I loaded up firefox one machine would load the Local font and the other would load the remote font. The one that rendered the Local font was rendering the font different. So my question is, instead of having firefox immediately render the Local font if it is install, can you have it render the remove one, and if that fails to default to the local font?

  98. March 24th, 2010 at 10:08 #98

    Bryant, use the smiley variation but put a local declaration behind the rest of the locations.

  99. March 26th, 2010 at 09:39 #99

    I managed to get the @font-face working on iPhone Safari taking Paul's advice and it looks great.

  100. March 31st, 2010 at 16:07 #100

    Hi Paul,

    this article is amazing, thank you so much.. can't wait to play with this soon. And by the way, can I use this excellent script in in the background that is adictive for drawing.. on my site ?

    .k

  101. komsas
    April 5th, 2010 at 16:00 #101

    it is not a perfect css code, try on the epiphany browser (gnome). He dont eat it.

  102. rapunzel
    April 7th, 2010 at 15:12 #102
     
    /*IE*/
    @font-face {
     font-family:myindiunicode;
     src: url("fontface/myindiunicode.eot");
     src: local('myindiunicode Regular'),local('myindiunicode');
    }
    /*NON IE*/
    @font-face {
     font-family:myindiunicode;
     src:url(//:) format('No-IE-404'),
            url(fontface/myindiunicode.svg#myindiunicode) format("svg"),
            url(fontface/myindiunicode.TTF) format("truetype");
    }

    after lots of trial those combination works for me in ie, ff . In chrome combination characters ( I am trying indian unicode font having support of combination characters) are broken.
    while it is quite fine in IE and FF. I want to make the code such a way that if the browser dont find that perticular font in visitor machine it will load those font face file and if the font is available in visitor's machine . it will laod the font from the visitor's machine.
    1. plz guide me which will be the best code for it ?
    2.how to rectify the problem with chrome ?
    3. I have make files from frontsquirrel, my all files are too big this is also one of my concern.
    thanking you

  103. April 8th, 2010 at 13:04 #103

    @rapunzel
    I would recommend removing the SVG reference. SVG can't do combination characters. It's a real poor font format.

    Can't help with size. Your best bet is to aggressively subset the font..

    G'luck.

  104. rapunzel
    April 9th, 2010 at 12:59 #104

    I managed to minimized those file size by subset the font character codes. I want to make browser to check for the font available in the visitor machine, if font available in visitor's machine .. then it will not load the eot/svg/woff file and will use the visitor's machine font in stead of it ( I will put a link for the fonts in the site) so which will be the best suitable option for me ? plz also mension abt the svg file do I have to put is for rendering it in chrome ?
    thanking you ..

  105. sovanndy
    April 9th, 2010 at 23:01 #105

    Why Google Chrome can't render my font?

  106. jules
    April 13th, 2010 at 08:08 #106

    @FontNotVisible
    you have an extra space behind "fatboyslim" in the class .fatboy properties.

  107. Tom
    April 15th, 2010 at 11:39 #107

    Having attempetd to run the code output by FontSquirrel I noticed that if you're on a Windows server then IIS doesn't have the mime types for SVG and OTF set by default, resulting in those files not being found – even when they're there. If you add the mime types via the MMC and either restart IIS or wait for the App Pools to recycle that seems to resolve it.

  108. Wieland
    May 10th, 2010 at 10:53 #108

    Hi,

    I used FontSquirrel, and it doesn't seem to work on Safari on a Windows platform. I'm using Windows XP SP2, so haven't tested nor on Vista nor on Windows7 though.

    Not much of a issue for myself, but thought i mentioned it.

  109. Wieland
    May 12th, 2010 at 03:32 #109

    @Wieland

    After testing on Vista and W7, it works on Safari on these platforms. So really not a issue. Thanks for the article btw!

  110. Kevin
    May 14th, 2010 at 15:53 #110

    Hello!

    Please, I need your help! It's urgent!

    In my blog, I changed the blog title font "Verdana" to "Titillium". I'm spekaing of the code "font-face". Many fonts as those, in the Fonts folder in my own computer. Did you understand? I also changed the text font and text title to the fonts that don't exist: Titillium, Calibri, Segoe Print, Segoe Script, Lucida Sans Unicode, etc.. On my computer, the fonts exist. But when I went to cyber café or "LAN house", to see my blog, the fonts of the blog title, text and title text, etc. did not work, because the other computers those fonts din't exist or appear exactly, or those fonts were not installed in the Fonts folder of the other computers. At the blog, accept, recognise and there are only six fonts, including Comic Sans MS, which already existed and was installed on all computers. So how do I install the fonts in my own blog for that the fonts work on all computers that do not have those fonts? Then @font-face doesn't work!

    I know you counsel me not to use those fonts, but only the standardised fonts by the Blogger. But see the text at the site of FontsQuirrel, the fonts there work perfectly althought I don't have these fonts, but I know what the font are these!

    How do I put the CSS @font-face? Where do I find it in my blog's HTML?

    Kevin

  111. June 4th, 2010 at 07:26 #111

    Chrome in Windows appears to stop rendering my font whenever it sees an 'e' character for some reason. Works fine in Chrome for OS X and every other browser on both OSes. Any ideas? The font is 'Birth Of A Hero'.

  112. John Saturday
    July 11th, 2010 at 02:28 #112

    TWO SMILEY VARIATION. Avoid problem with Gnome browser Epiphany:

    @font-face {
      font-family: 'Graublau Web';
      src: url('GraublauWeb.eot');
      src: local('?') format('?'),
        url("GraublauWeb.woff") format("woff"),
        url("GraublauWeb.otf") format("opentype"),
        url("GraublauWeb.svg#grablau") format("svg");
    }
  113. July 13th, 2010 at 18:16 #113

    When I use the smiley method in my .css, I get this message in dreamweaver:

    "The document's current encoding can not correctly save all of the characters within the document. You may want to change to UTF-8 or an encoding that supports the special characters in this document"

    Then when I reopen the file my smiley face is now a question mark.

    Even when I declare this at the beginning of the css:

    @charset "utf-8";

    it still won't save with the smiley. Any ideas?

  114. July 13th, 2010 at 18:24 #114

    @Morgan
    I think somewhere else in Dreamweaver you can set which encoding you want to use…

    To be honest, your file will be fine if it goes out the door with a ? mark..

    Shrug.. dreamweaver is weird.

  115. July 21st, 2010 at 10:25 #115

    Hi,

    On IE7 users always get a security warning. Any way around that? Can we target IE7 out and use sifr for them?

    -Chris

  116. July 21st, 2010 at 10:33 #116

    @Chris Lambacher
    I mentioned this guy in my Gotchas roundup post
    http://paulirish.com/2010/font-face-gotchas/

    It's due to IE security settings set to High. Only users (or companies) that have set their IE security settings to the High preset will experience this permission warning. There is nothing you can do about it other than not use @font-face. There is no way to detect it.

  117. July 25th, 2010 at 14:46 #117

    Thx a lot !!

    It has been hard but it's done !! I'm on walkway bold thanks to you !

    aby

  118. August 10th, 2010 at 09:05 #118

    Really great article,
    but the smiley way doesn't work when you use iso-8859-1.

  119. jamal
    August 13th, 2010 at 10:52 #119

    Got one for you all.
    In Opera 10.60 build 3445 the @font-face works fine…
    until I refresh the page and the text goes back to system fonts.
    if I press enter on the address bar it comes back, but any amount of refreshes always gives system fonts and the address bar gives @font-face fonts. weird huh.

  120. jamal
    August 13th, 2010 at 10:57 #120

    forgot to say in I.E. it works fine on refresh and with @font-face.
    in firefox it works fine on refresh and with @font-face.

  121. jamal
    August 13th, 2010 at 10:59 #121

    In IE and firefox it works fine.

  122. jamal
    August 13th, 2010 at 11:32 #122

    10.61 the same

  123. jho
    August 20th, 2010 at 01:53 #123

    hello,

    I want You all to know that the @font face generator have and error.

    A PHP Error was encountered

    Severity: Notice

    Message: Undefined variable: demo_data

    Filename: views/downloadable_demo.php

    Line Number: 58

    I cant generate a @font face.

    Thanks the generator is so helpful.

  124. August 23rd, 2010 at 01:25 #124

    Hi Sir, I just want to ask for any help or advice with regards on how to make my fonts appear.

    I followed every step in the above mentioned post. But it doesn't seem that I am getting it all right.

    I don't know much of HTML and CSS so i tried to copy formats from several websites including yours that uses embedded fonts.

    I would really appreciate your help. Thanks.

  125. September 3rd, 2010 at 14:38 #125

    Awesome backgound Man!
    Great post…

  126. Marijn
    September 5th, 2010 at 16:07 #126

    @Paul Irish
    I'm always very keen on following these kind of clever advises, as I am not really an expert in CSS matters. But I did notice this: after cutting/pasting the smiley into my stylesheet, I had to save it in Unicode instead of ANSI, and it now takes twice as much space on the server – and therefore I assume twice the time loading? So for performance maybe it is better to have the question mark in ANSI, instead of the smiley? Or is this a really stupid and unnessacery remark?

  127. September 6th, 2010 at 14:53 #127

    @Marijn

    Well firstly I have never heard of people saving in ANSI instead of Unicode for performance reasons… I'd love to see more details to verify it is legit..

    But you can do a ANSI question mark and the smiley has the same effect, basically. Not a huge deal.

  128. September 11th, 2010 at 08:15 #128

    Hoping someone can help me out..
    I have used the double declaration method
    my combined (eot + ttf) font size is 23k total..
    1. Should I be using the bullet proof method ?? (compatibility)
    Opera, Chrome and FF even IE all looks fine !
    (so I am not real worried about double downloading files if that's all it is.)
    2. Only problem I have is the 'font flash' before the fonts download..

    my font is set 51pt to display as I want 'once' loaded..
    the problem is my custom font face is small compared to default fonts..
    so yhis results in a BIG flash..
    so without resizing the glyphs in the font itself.. is there anyway to use CSS to set this not to happen.. ?

    I don't mind the flash initial showing a smaller size lettering then once files download showing.. increasing in size ..
    As is said if the font is slow loading it's a big flash..
    easiest to look I guess..
    http://www.absoluteclassdiscos.com
    I think I may be stuck resizing the whole font to prevent this.. but worth an ask..
    Thanks
    Andy

  129. Jones Lee
    October 5th, 2010 at 06:42 #129

    @komsas

    Yeah, epiphany doesn't take it.

  130. Nate
    October 8th, 2010 at 22:45 #130

    no dates on comments? last is latest?

  131. Nate
    October 8th, 2010 at 22:46 #131

    yup. but would be nice to know when the conversations happened ;)

  132. Chris
    October 15th, 2010 at 04:59 #132

    Great Article. Maybe FF needs conditional comments :p

    Is there a way to have FireFox NOT load the CSS3 web fonts since it can't load them right to begin with? I would rather have my users see the fallback font over seeing a page the flickers on load!

  133. October 20th, 2010 at 06:01 #133

    Excellent post, really useful.

  134. October 20th, 2010 at 06:05 #134

    Excellent post guys, really useful.

  135. October 20th, 2010 at 19:09 #135

    My tests continue to show that this, so far, is the only syntax that doesn’t leave Opera choking. And, in keeping with Jon Tan’s oft-linked-to code that recommends dividing the declarations between IE and “other browsers” using conditional comments (which I think is a good idea – almost inevitable), something needs to be done to prevent IE from making unnecessary HTTP requests resulting in a 404 as it attempts to parse the rules for the “other browsers”. I also continue to not like being forced to use local() because it serves a hidden purpose other than it’s intended one.

    It’s very helpful for those trying to use @font-face to know at least a little bit about what’s going on under the hood with different browsers a

  136. Borriej
    November 11th, 2010 at 06:39 #136

    It doesn't work in IE. Rest of the browsers do work

    added CSS:

    @font-face {
    font-family: 'Name_Font';
    src: url('themes/Theme/fonts/Name_Font.eot');
    src: local('?'),
    url('/themes/Theme/fonts/Name_Font.ttf') format('truetype');
    }

    HELP would be great!

  137. November 14th, 2010 at 13:53 #137

    Wonderful post. This information very useful to me for web design. Thanx

  138. November 14th, 2010 at 13:58 #138

    Its very perfect code. Keep going on nice job

  139. November 19th, 2010 at 09:36 #139

    It's not as bulletproof as it seems. Doesn't work in wkhtmltopdf (that's a Webkit PDF renderer). It's either the local or some other non ttf declarations that break it.

  140. buroonthewire
    December 9th, 2010 at 12:59 #140

    Are these fonts used in all browsers if the page is printed?

  141. Alan
    December 10th, 2010 at 12:57 #141

    The animated background? Really? Accounts for 94% of the resource usage of my seven firefox tabs currently open. Merry crashmas is more like it.

  142. December 10th, 2010 at 13:58 #142

    Nice article. front-end developer, this background sux at all.

  143. December 14th, 2010 at 07:09 #143

    Wonderful background. its very beautiful. I like this article.

  144. Scarlett
    December 17th, 2010 at 14:11 #144

    Paul ~ just wanted to mention that we've had an instance of the Safari permission error on a machine without a font manager, such as FontExplorer. I wonder if you have a theory on that? Hope SF is treating you well!

  145. December 21st, 2010 at 12:45 #145

    Thanks,It has been hard but it's done. I am fresher in web design field. This article really help me.

  146. December 22nd, 2010 at 03:51 #146

    Thx Paul! Your @font-face syntax is the best and I'm using almost daily. at the beginning of 2011 I will publish an CSS book and it will include font implementation of course, based on your @font-face syntax. And of course, you will mentioned! Greetings and have a nice X-Mas!

  147. Bibhuti
    January 20th, 2011 at 05:02 #147

    How to use in css font-weight: crisp, sharp, strong, smooth? In photoshop this style are available, how can i use?

  148. January 31st, 2011 at 20:46 #148

    Bibhuti, those aren't things you can declare using font-weight. They're anti-aliasing methods.

  149. February 13th, 2011 at 08:06 #149

    @Andrea Giammarchi

    Great article! I'd just like to add my code which covers all of the main browsers and devices. Hope this helps.

    @font-face {
    font-family:'FuturaEmbed'; /* we can name this whatever we want */
    src:url(Futura.eot); /* IE will download this anyway */
    src:local('Futura'), /* It'll ignore this.. */
    url(Futura.woff) format('woff'),
    url(Futura.ttf) format('truetype'),
    url(Futura-book-webfont.svg#webfontFGT2JwHV) format('svg');
    font-weight:normal;
    font-style:normal;
    }

  150. February 15th, 2011 at 03:00 #150

    Thanks a lot for sharing your methods of using @fontface with the popular browsers. It's quite funny how much difficult it all used to be.

  151. alhamd
    February 16th, 2011 at 15:47 #151

    This doesn't work with arabic fonts that use extended character base. the font squirrel website also doesn't embed arabic language characters. is there any way to get the arabic unicode fonts work?

  152. February 19th, 2011 at 04:16 #152

    @alhamd

    For use with Arabic fonts then you should also include AAT format (truetype-aat) and OT format(opentype) for both Mac and PC.

    src: url(LateefRegAAT.ttf) format("truetype-aat"),
    url(LateefRegOT.ttf) format("opentype");

  153. slobodan
    February 21st, 2011 at 03:03 #153

    .eot# not working for me in IE9 (everithing else works fine)..

  154. Paolo
    February 22nd, 2011 at 03:28 #154

    Good overview.

    One question: I have a javascript toolkit that include 5 custom fonts defined according to your reccomendations using a set of definitions in custom-fonts.css like:

    @font-face {
    font-family: 'pgn4web Liberation Sans';
    src: url('LiberationSans-Regular.eot');
    src: local('Liberation Sans Regular'), local('Liberation Sans'), local('LiberationSans'), url('LiberationSans-Regular.woff') format('woff'), url('LiberationSans-Regular.ttf') format('truetype'), url('LiberationSans-Regular.svg#LiberationSans') format('svg');
    font-weight: normal;
    }

    Then the user of the toolkit imports custom-fonts.css in his css and has all new fonts available.

    Those fonts are *available* to the user of this toolkit, they are not necessarily all used.

    This works fine with all browsers, as usual, except IE.

    I have the *impression* (could not confirm though) that IE is downloading all the eot files when they are defined in the css while other browsers only download the font files when they are used. So, if a given site uses only one of the several fonts defined, then IE will load all font files anyway while the other browsers load only what they actually need for each page.

    Is this the expected behaviour?
    If yes, is there a way to make IE download the fonts only when actually used?

  155. February 22nd, 2011 at 08:25 #155

    maybe you can help me with this, it seems like no matter what syntax I use my fonts get bolder in the browser than they appear in illustrator. I’ve looked everywhere for people having this issue and haven’t found anyone writing about it. Have you seen this? here’s a screenshot showing the same font in illustrator and on FireFox: http://files.mimoymima.com/drop/font-weight.png

  156. February 22nd, 2011 at 09:22 #156

    @Paolo
    IE6,7,8 will download the fonts as soon as it sees the @font-face declaration. :( It's fixed for IE9

    You could lazyload the stylesheets somehow to avoid that, but that wouldn't be fun.

  157. February 22nd, 2011 at 09:23 #157

    @Brent Lagerman
    illustrator and photoshop have a few settings for font anti-aliasing.. but in general fonts in the browsers will look different/worse than in your image editing software. Just kinda a fact of lilfe.

  158. February 22nd, 2011 at 14:53 #158

    @Paul Irish
    I spent most of today figuring this out, and posted similar posts on other blogs trying to see if anyone had a solution. The reason I didn't give up after your comment is that the font squirrel 'test' page looks correct, whereas mine had extra weight. I stripped down my site to the bare bones but still was getting the same issue, the only difference was the background and font color, so I changed it the problem was gone! It's hard to believe, but the same exact code will render different antialiasing with different foreground and background colors. In the attached screenshot notice how black on white looks like a light typeface, whereas white on black gets extra weight to like 'book' even though it's actually 'light'… I even overlaid the two so you can see the extra weight, it's pretty substantial! I'd consider this as a bug, but it does this in firefox, chrome and safari on my mac…

    http://files.mimoymima.com/drop/font-weight2.png

    so is this a bug? if the browser can render the font correctly with a white background why can't it do the same with black!?

  159. February 22nd, 2011 at 19:27 #159

    @Brent Lagerman

    nevermind, I just double checked my screenshots and although it definitely appears to be bolder with white on black it's just an optical illusion, it does use the same antialiasing, just appears bolder, the overlapping screenshot I made shows white outside of the black but that's just because of the brighter color, not different anti-aliasing, false alarm…

  160. February 23rd, 2011 at 07:40 #160

    Using the Fontspring @font-face syntax, pre-generated from Font-squirrel and it is trying to load the TTF in the latest IE9 (RC). Obviously, TTF font files do not work on IE, and so it fails to work. So far, the only fix I have found was to change the format('eof') in the src to format('truetype') and then IE9 downloads the correct EOF file. It also seems to work in the other browsers, downloading the appropriate file despite the format being wrong on the EOF file.

    I don't like the fix though, afraid it could cause issues I haven't found in other browsers, any other suggestions?

    (I do need to double-check my mime-type settings on the server yet, hoping I will find that to be the answer.)

    This is what I am currently using – note the iefix line has an incorrect format:

    @font-face { 
        font-family: 'BebasNeueRegular';
        src: url('fonts/BebasNeue-webfont.eot');
        src: url('fonts/BebasNeue-webfont.eot?iefix') format('truetype'),
             url('fonts/BebasNeue-webfont.woff') format('woff'),
             url('fonts/BebasNeue-webfont.ttf') format('truetype'),
             url('fonts/BebasNeue-webfont.svg#webfontfvFLBU0N') format('svg');
        font-weight: normal;
        font-style: normal;
    }
  161. February 24th, 2011 at 06:17 #161

    Strange thing happened with Opera 10.53 as i tested font-face declarations.

    @font-face {
    font-family: 'QlassikBoldRegular';
    src: url('fonts/qlassikbold_tb-webfont.eot'); 
    src: local('?'), 
    url('fonts/qlassikbold_tb-webfont.woff') format('woff'), 
    url('fonts/qlassikbold_tb-webfont.ttf') format('truetype'),
    url('fonts/qlassikbold_tb-webfont.svg#webfontD6qDCYGS') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
    }

    This didn't seem to load the font files and opera rather used it's own default font. I don't know if this is a known bug but if i change the first letter from "QlassikBoldRegular" to another Opera loads the font and works like a charm.

  162. February 24th, 2011 at 08:34 #162

    Thanks you SO MUCH!!! This has been incredibly helpful,

  163. March 15th, 2011 at 02:17 #163

    I found that in FF 3.6.15 on Mac OSX my CSS @font-face declaration needed to use double quotes throughout instead of single.

    Ref: http://stackoverflow.com/questions/1279735/font-face-isnt-working-in-firefox-3-5

    Cheers,
    Mark

  164. March 16th, 2011 at 09:37 #164

    Okay, so I'm using the bulletproof smiley syntax and while I understand how it works I can get it to work in EVERY browser except IE browsers.

    Can someone check my style sheet here and tell me if I'm doing something wrong?

    http://www.1stchoicerecyclinghvac.com/css/style.css

    Oh, and here is the website in question… http://www.1stchoicerecyclinghvac.com

    The site is by no means done but if you're using IE you will see the fonts don't show up at all and I can't figure out for the life of me why.

  165. danish
    March 19th, 2011 at 03:58 #165

    it not work all bro.
    only working in Mozilla fire fox 3.6+
    my css is :

    @font-face
    {
    font-family: myFont;
    src: url('AlQalamQuran2.ttf'),
    url('my site/AlQalamQuran2.ttf') format("truetype"); /* MF */
    }

    @font-face
    {
    font-family: myFont1;
    src: url('AlQalamQuran2.eot'),
    url('my site/AlQalamQuran2.eot') format("opentype"); /* IE */
    }

    @font-face
    {
    font-family: myFont2;
    src: url('AlQalamQuran2.otf'),
    url('my site/AlQalamQuran2.otf') format("opentype"); /* chrom */
    }

    place help me .thanx

  166. March 20th, 2011 at 04:19 #166

    Have you noticed that if you do the shorttag and link to fonts.google.com it is litterally just an @font-face you are importing? Just follow the url and copy/paste the css into your own stylesheet like here is the best way.

  167. March 31st, 2011 at 01:45 #167

    Thank Average Gamer.
    It works well on Firefox

    Jimmy

  168. April 5th, 2011 at 05:07 #168

    I read you blog regarding the @font-face, that was so nice….

    I tried to use the "HeliosCond Bold" font family….
    But It does not work in Safari and other browser are working well…

    so Kindly suggest me….

    Thanks,
    Aravind.

  169. April 20th, 2011 at 01:20 #169

    In FF<4 font looks bad because they not have antaliasing – right?
    You can fix this with text-shadow:

    text-shadow:0 0 1px XXX,0 0 1px XXX – where XXX is font color :)

  170. April 29th, 2011 at 07:09 #170

    I read you blog regarding the @font-face, that was so nice

  171. May 11th, 2011 at 04:32 #171

    Hey Paul…
    Could really use your help here – I cant get the custom fonts to work in IE7 and IE8, and cant quite seem to figure out why…

    Would really appreciate if yolu could take a look at it: http://i-creative.dk/iJob/

  172. May 13th, 2011 at 20:46 #172

    i read your article about @font-face, i try it but i could not gain result for safari browser..

  173. May 18th, 2011 at 11:19 #173

    Your example
    http://dl.getdropbox.com/u/39519/webfontsdemo/index.html
    does not work in Opera 11.11 at all!

    And FontSpring's "New Bulletproof @Font-Face Syntax" behaves in Opera 11.11 very strange – some final letters and all digits disappear.

  174. June 3rd, 2011 at 21:02 #174

    Very Informative article about @font-face but
    http://dl.getdropbox.com/u/39519/webfontsdemo/index.html
    does not work in opera. some letters and digits disappear.

  175. June 3rd, 2011 at 21:04 #175

    @Karis
    i agree but waht to think about dissertation help

  176. June 13th, 2011 at 08:50 #176

    Wonderful background. its very beautiful

  177. Tom
    June 21st, 2011 at 21:57 #177

    Still can't get @font-face to load in IE9 or FF 3.0. Is there any chance there's an incompatibility with HTML5 Boilerplate?

    I'm using HTML5 Boilerplate, and the following code is in the "primary styles" section.

    @font-face {
    font-family: "ChunkFiveRegular";
    src: url("Chunkfive-webfont.eot");
    src: local("☺"),
    url("Chunkfive-webfont.woff") format("woff"),
    url("Chunkfive-webfont.svg#webfont90E2uSjN") format("svg");
    }

    Any help would be greatly appreciated.

    Thanks!

  178. JiB
    June 24th, 2011 at 05:59 #178

    Hi!

    Everybody its a great blog on @font-face .. but can some one tell me how to add this beautiful background .. i want to use this background in my work.. any help ..

    I apologize cause im talking something not related to topic, but i cant resist the beauty of this background

  179. June 29th, 2011 at 07:22 #179

    Hey Paul, i've tried different solutions such as "Bulletproof @font-face: Smiley variation", "The Fontspring @font-face syntax", "The local reference" but i can't get ie9 to load the font while it works all fine with ie8. The only solution i came up to is to load the eot font for ie within the special stylesheets with another @font-face. Works but loads the font twice for ie, the ttf and the eot.

    Any clue to get it all fine? Or am i doing something wrong with the Fontspring syntax?

  180. June 30th, 2011 at 12:50 #180

    Pb fixed, i used the declaration fom fontsquirrel.com and it's all fine.

  181. Darren
    July 5th, 2011 at 08:07 #181

    Old Internet Explorers – not working – NOTE: Modern/Advanced CSS selectors can 'trip' old IEs (8/7/6 etc). E.g:

    h1, li:nth-child(2), p {font-family: myNewFont; } will also fail the H1 and P elements in IE8.

    You might try the following instead:
    H1, p {font-family: myNewFont; }
    /*:root *> everything but IE6-8. (Not tested in IE5/4!)*/
    :root *> li:nth-child(2) {font-family: myNewFont; }

  182. vinod
    July 19th, 2011 at 08:19 #182

    I am not sure if it's just me but @Font-Face doesn't work in FF 2.0(Win). I am using Font-Squirrels fonts & code too. I know FF 2.0 is way too old now but I was just wondering. Does it not work in FF 2.0?

  183. July 19th, 2011 at 08:20 #183

    no support on ff2.0 or ff3.0

  184. July 23rd, 2011 at 07:05 #184

    Thanks for this, useful stuff..having problems with IE9 though too

  185. August 10th, 2011 at 13:47 #185

    i want to use this background in my work.. any help!!

  186. August 14th, 2011 at 18:09 #186

    Thanks Paul.

  187. Coca Akat
    August 16th, 2011 at 20:55 #187

    Thank for this, it works for Khmer Font.

  188. August 18th, 2011 at 02:51 #188

    Very useful. I often have issues with w3 CSS validator, but your code works well !

  189. August 22nd, 2011 at 21:35 #189

    good point ^^

  190. September 24th, 2011 at 02:58 #190

    Hi Paul

    I bought a font from fontspring.com (Avalon) to use on http://www.dealscout.co.za/

    I'm using the @fontface declarations they provide in the sample file with the font, but the font itself is appearing very "jaggedy" in Chrome and on some older browsers.

    The declaration is as follows:

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

    Do you have any suggestions on what we may be doing wrong that is causing this, or should we be looking for a new font?
    If so do you have any reccomendations for fonts in Avalon / Century Gothic style that will have better cross browser support?

  191. October 6th, 2011 at 11:30 #191

    Thanks for posting Paul, have been looking for a decent guide taking @font-face back to the basics.

    Cheers :-)

  192. October 11th, 2011 at 02:22 #192

    advertising and *********** with Adwords. Well I am adding this RSS to my e-mail and could glance out for a lot extra of your respective fascinating content. Make sure you replace this again very soon..

  193. A.Hayes-Perez
    October 18th, 2011 at 08:39 #193

    Help! Is it possible to use @font-face in HTML email if I self-host the font? It would have to be an inline style since email ignores info in the tag.

  194. November 6th, 2011 at 06:06 #194

    @John
    John- try adding the following to your css:
    html{-webkit-font-smoothing: antialiased}

  195. syd
    November 21st, 2011 at 13:48 #195

    still no way of using DATA:uri for .eot? how can this be embedded oo i can have no extra http request. it can be used for the rest of the formats…

  196. syd
    November 22nd, 2011 at 01:54 #197

    @Paul Irishthank you, but how data:;base64, encoding declaration will look like for eot. as there`s the ie fix ?'. do you have any example of eot encoded page? i have tried to convert an eot file, placed the characters but ie doesn`t parse it. For .otf in the rest of the browsers i can embed with dataLuri, but for ie still remains a request i want to eliminate.

  197. November 23rd, 2011 at 05:26 #198

    Thank you for this great post on font-face! I think font-face is better than cufon

  198. December 3rd, 2011 at 21:03 #199

    @font-face {
    font-family: 'Meera';
    src: url("fonts/Meera_04-1.eot");
    src: local('Meera'), url('fonts/Meera_04-1.ttf');
    format("truetype");
    font-weight: 400;
    }

    is there any pbm with this css? its working on localhost if i give full url. but seems to be not working with nd without full url. me using wordpress

  199. December 9th, 2011 at 09:45 #200

    Font face looks really terrible!

    Just checked FontSquirrel on Vista and trust me it working like magic!

  200. December 25th, 2011 at 12:42 #201

    I had strange effects on Chrome and Firefox!
    So I used this because your solution only works with IE (for me)!
    @font-face {
    font-family: 'Candara';
    src: local('Candara'), url('fonts/Candara.ttf') format('truetype'), url('fonts/Candara.svg') format('svg');
    src: url('fonts/Candara.eot?') format('embedded-opentype'),
    /*url('fonts/Candara.woff') format('woff'),*/
    url('fonts/Candara.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    }

  201. January 6th, 2012 at 08:26 #202

    Had a weirdness in IE9 while using four Lato fonts arranged as a family (ie: all with font-family: 'Lato', and font-weight, font-style set appropriately).

    For some reason IE9 was using italic everywhere.

    My colleague Richard managed to fix this by rearranging the order in which the @font-face declarations were listed:

    Regular
    Italic
    Bold
    BoldItalic

    Hope this helps someone.

  202. Alex
    January 11th, 2012 at 12:30 #203

    Awesome explanations and great discussion in the comments here. This has helped me a lot as I've been trying to figure out how to get cross browser compatibility for custom fonts on my site. Thanks!

  203. Riet de Wit
    January 18th, 2012 at 04:28 #204

    Thanks for your clear explanation Paul!
    Haven't read all comments, maybe this is already mentioned: I copy-pasted your code into a site I was working on. Fonts did show up in FF and IE but not in Chrome + Safari on Mac. I found out that this was because ; was placed after the first declaration. I replaced it with a , and now fonts show up in every browser.
    So an ; only before the closing }.

  204. March 3rd, 2012 at 23:26 #205

    Hi Paul,

    How to make font stack like Crisp in Photoshop?

    I make a font-stack:

    @font-face {
    font-family: 'GothamXNarrow-Medium';
    src: url('fonts/gothamxnarrow-medium3.eot');
    src: url('fonts/gothamxnarrow-medium3.eot?#iefix') format('embedded-opentype'),
    url('fonts/gothamxnarrow-medium3.woff') format('woff'),
    url('fonts/gothamxnarrow-medium3.ttf') format('truetype'),
    url('fonts/gothamxnarrow-medium3.svg#gothamxnarrow-medium3') format('svg');
    font-weight: normal;
    font-style: normal;
    }

    But the result displayed on browser(FF) is not same to Photoshop.

    Thanks

  205. joseph
    March 6th, 2012 at 09:50 #206

    thanks for this comprehensive article
    will try em out soon!

  206. nico
    March 9th, 2012 at 07:05 #207

    hello, thanks for the thorough explanation.
    I am not sure of the reason but… has anybody had issues with the rendering using @font-face?
    if I use the google api webfont loader, the typeface is rendered properly.
    when the fonts are defined in a separate stylesheet via @font-face (but… that's what the webfont loader does too, doesn't it..?) the rendering is very poor (irregular strokes, different spacing, etc).

    thanks

  207. March 12th, 2012 at 10:59 #208

    Hi Paul, great tutorial, you should check out Font Squirrel, they have a fortress of ready to use @Font-Face kits.

  208. don
    March 16th, 2012 at 10:56 #209

    THANK YOU !!!
    You guys simply Rock, I got so exited to see this work I had to go for a run around the block…no…seriously.
    THANK YOU!

  209. Joel S
    March 20th, 2012 at 09:40 #210

    Also be sure to check out http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax for the update:
    "We've reverted back to the correct format hint for eot, format('embedded-opentype') due to issues with serving on IIS."

    The links doesn't work, but I assume it's about missing MIME-types for the font formats in the default server configuration.

    I also like the ?#ie-fix – thing, since it wouldn't produce anything the server could interpret as a query string, resulting in another response than predicted.

  210. Deepesh Nayak
    April 18th, 2012 at 02:02 #211

    your css seems to be working fine in all browse but while printing in Firefox the @font-face is not supported below is css

    @font-face {
    font-family: 'C39P24DmTtNormal';
    src: url('WebFonts/v100025_-webfont.eot');
    src: local('☺'),
    url('WebFonts/v100025_-webfont.eot?#iefix') format('embedded-opentype'),
    url('WebFonts/v100025_-webfont.woff') format('woff'),
    url('WebFonts/v100025_-webfont.ttf') format('truetype'),
    url('WebFonts/v100025_-webfont.svg#C39P24DmTtNormal') format('svg');

    font-weight: normal;
    font-style: normal;
    }

  211. April 18th, 2012 at 23:16 #212

    FYI:
    Issue: @font-face wasn't rendering in IE7 on windows vista but fine in IE7 on windows xp and windows 7.
    Solution: Use double quotes instead of single.

    Who are still using windows vista and IE7? OMG

  1. September 4th, 2009 at 10:50 | #1
  2. September 5th, 2009 at 06:54 | #2
  3. September 5th, 2009 at 11:49 | #3
  4. September 7th, 2009 at 10:04 | #4
  5. September 7th, 2009 at 10:45 | #5
  6. September 7th, 2009 at 23:58 | #6
  7. September 8th, 2009 at 15:00 | #7
  8. September 10th, 2009 at 07:27 | #8
  9. September 11th, 2009 at 15:55 | #9
  10. September 11th, 2009 at 16:01 | #10
  11. September 12th, 2009 at 18:34 | #11
  12. September 13th, 2009 at 18:06 | #12
  13. September 14th, 2009 at 10:15 | #13
  14. September 15th, 2009 at 06:08 | #14
  15. September 15th, 2009 at 10:30 | #15
  16. September 15th, 2009 at 15:02 | #16
  17. September 17th, 2009 at 14:23 | #17
  18. September 17th, 2009 at 19:36 | #18
  19. September 17th, 2009 at 20:07 | #19
  20. September 17th, 2009 at 21:02 | #20
  21. September 17th, 2009 at 21:02 | #21
  22. September 18th, 2009 at 06:48 | #22
  23. September 18th, 2009 at 14:03 | #23
  24. September 20th, 2009 at 13:38 | #24
  25. September 21st, 2009 at 19:16 | #25
  26. September 22nd, 2009 at 02:58 | #26
  27. September 22nd, 2009 at 19:18 | #27
  28. September 30th, 2009 at 07:52 | #28
  29. October 1st, 2009 at 12:24 | #29
  30. October 1st, 2009 at 13:41 | #30
  31. October 6th, 2009 at 01:54 | #31
  32. October 6th, 2009 at 14:13 | #32
  33. October 8th, 2009 at 00:19 | #33
  34. October 10th, 2009 at 19:23 | #34
  35. October 16th, 2009 at 07:23 | #35
  36. October 20th, 2009 at 11:01 | #36
  37. October 20th, 2009 at 21:08 | #37
  38. October 21st, 2009 at 10:44 | #38
  39. October 21st, 2009 at 18:34 | #39
  40. October 22nd, 2009 at 13:24 | #40
  41. October 22nd, 2009 at 22:21 | #41
  42. October 24th, 2009 at 05:52 | #42
  43. October 24th, 2009 at 10:46 | #43
  44. October 26th, 2009 at 20:03 | #44
  45. October 29th, 2009 at 02:19 | #45
  46. November 2nd, 2009 at 17:48 | #46
  47. November 4th, 2009 at 05:34 | #47
  48. November 7th, 2009 at 13:42 | #48
  49. November 14th, 2009 at 00:49 | #49
  50. November 15th, 2009 at 15:40 | #50
  51. November 17th, 2009 at 11:20 | #51
  52. November 22nd, 2009 at 12:13 | #52
  53. December 2nd, 2009 at 03:21 | #53
  54. December 2nd, 2009 at 07:07 | #54
  55. December 2nd, 2009 at 07:59 | #55
  56. December 2nd, 2009 at 11:09 | #56
  57. December 2nd, 2009 at 13:15 | #57
  58. December 2nd, 2009 at 16:07 | #58
  59. December 2nd, 2009 at 20:59 | #59
  60. December 3rd, 2009 at 14:55 | #60
  61. December 3rd, 2009 at 18:08 | #61
  62. December 4th, 2009 at 11:46 | #62
  63. December 5th, 2009 at 20:45 | #63
  64. December 5th, 2009 at 20:52 | #64
  65. December 6th, 2009 at 15:55 | #65
  66. December 8th, 2009 at 13:47 | #66
  67. December 10th, 2009 at 11:14 | #67
  68. December 10th, 2009 at 23:15 | #68
  69. December 11th, 2009 at 16:54 | #69
  70. December 12th, 2009 at 06:26 | #70
  71. December 17th, 2009 at 07:17 | #71
  72. December 19th, 2009 at 04:47 | #72
  73. December 28th, 2009 at 14:38 | #73
  74. January 4th, 2010 at 23:26 | #74
  75. January 5th, 2010 at 09:40 | #75
  76. January 6th, 2010 at 14:51 | #76
  77. January 11th, 2010 at 10:11 | #77
  78. January 12th, 2010 at 13:37 | #78
  79. January 13th, 2010 at 09:34 | #79
  80. January 19th, 2010 at 17:30 | #80
  81. January 21st, 2010 at 10:54 | #81
  82. January 25th, 2010 at 12:19 | #82
  83. January 26th, 2010 at 07:11 | #83
  84. February 3rd, 2010 at 11:45 | #84
  85. February 4th, 2010 at 12:40 | #85
  86. February 10th, 2010 at 23:44 | #86
  87. February 17th, 2010 at 21:17 | #87
  88. February 19th, 2010 at 07:25 | #88
  89. February 27th, 2010 at 15:02 | #89
  90. March 1st, 2010 at 08:58 | #90
  91. March 2nd, 2010 at 03:03 | #91
  92. March 2nd, 2010 at 09:43 | #92
  93. March 2nd, 2010 at 23:01 | #93
  94. March 17th, 2010 at 22:51 | #94
  95. March 17th, 2010 at 22:52 | #95
  96. March 21st, 2010 at 21:41 | #96
  97. March 22nd, 2010 at 10:07 | #97
  98. March 22nd, 2010 at 10:58 | #98
  99. March 23rd, 2010 at 10:38 | #99
  100. March 23rd, 2010 at 14:02 | #100
  101. April 7th, 2010 at 23:48 | #101
  102. April 11th, 2010 at 03:50 | #102
  103. April 11th, 2010 at 09:30 | #103
  104. May 4th, 2010 at 08:27 | #104
  105. May 5th, 2010 at 13:56 | #105
  106. May 7th, 2010 at 09:02 | #106
  107. May 8th, 2010 at 14:27 | #107
  108. May 13th, 2010 at 05:01 | #108
  109. May 15th, 2010 at 17:17 | #109
  110. May 16th, 2010 at 15:34 | #110
  111. May 17th, 2010 at 01:07 | #111
  112. May 17th, 2010 at 16:56 | #112
  113. May 18th, 2010 at 08:20 | #113
  114. May 20th, 2010 at 06:40 | #114
  115. May 20th, 2010 at 07:55 | #115
  116. May 25th, 2010 at 04:03 | #116
  117. May 25th, 2010 at 04:03 | #117
  118. May 26th, 2010 at 01:31 | #118
  119. May 26th, 2010 at 14:06 | #119
  120. May 29th, 2010 at 13:11 | #120
  121. May 29th, 2010 at 13:12 | #121
  122. June 1st, 2010 at 09:38 | #122
  123. June 3rd, 2010 at 05:47 | #123
  124. June 4th, 2010 at 03:12 | #124
  125. June 4th, 2010 at 13:12 | #125
  126. June 6th, 2010 at 11:56 | #126
  127. June 7th, 2010 at 19:43 | #127
  128. June 8th, 2010 at 05:01 | #128
  129. June 8th, 2010 at 07:30 | #129
  130. June 8th, 2010 at 15:05 | #130
  131. June 8th, 2010 at 15:05 | #131
  132. June 8th, 2010 at 21:47 | #132
  133. June 8th, 2010 at 22:11 | #133
  134. June 9th, 2010 at 18:59 | #134
  135. June 12th, 2010 at 08:49 | #135
  136. June 13th, 2010 at 16:23 | #136
  137. June 15th, 2010 at 08:33 | #137
  138. June 16th, 2010 at 16:08 | #138
  139. June 18th, 2010 at 14:06 | #139
  140. June 19th, 2010 at 09:10 | #140
  141. June 21st, 2010 at 08:52 | #141
  142. June 25th, 2010 at 12:24 | #142
  143. July 2nd, 2010 at 22:14 | #143
  144. July 7th, 2010 at 05:23 | #144
  145. July 12th, 2010 at 22:50 | #145
  146. July 13th, 2010 at 22:07 | #146
  147. July 15th, 2010 at 20:10 | #147
  148. July 18th, 2010 at 08:04 | #148
  149. July 19th, 2010 at 08:00 | #149
  150. July 26th, 2010 at 21:44 | #150
  151. July 29th, 2010 at 04:30 | #151
  152. July 31st, 2010 at 09:24 | #152
  153. August 4th, 2010 at 00:21 | #153
  154. August 9th, 2010 at 10:33 | #154
  155. August 9th, 2010 at 10:47 | #155
  156. August 20th, 2010 at 12:50 | #156
  157. August 20th, 2010 at 14:08 | #157
  158. August 26th, 2010 at 09:01 | #158
  159. August 26th, 2010 at 17:18 | #159
  160. August 31st, 2010 at 00:04 | #160
  161. September 3rd, 2010 at 06:44 | #161
  162. September 9th, 2010 at 22:58 | #162
  163. September 30th, 2010 at 16:21 | #163
  164. October 5th, 2010 at 23:03 | #164
  165. October 11th, 2010 at 06:52 | #165
  166. October 11th, 2010 at 10:44 | #166
  167. October 17th, 2010 at 08:08 | #167
  168. October 20th, 2010 at 22:48 | #168
  169. October 21st, 2010 at 13:15 | #169
  170. October 22nd, 2010 at 13:01 | #170
  171. October 25th, 2010 at 00:55 | #171
  172. October 31st, 2010 at 05:47 | #172
  173. November 2nd, 2010 at 13:04 | #173
  174. November 7th, 2010 at 20:02 | #174
  175. November 9th, 2010 at 13:37 | #175
  176. November 12th, 2010 at 11:08 | #176
  177. November 14th, 2010 at 03:11 | #177
  178. November 19th, 2010 at 00:45 | #178
  179. November 22nd, 2010 at 06:26 | #179
  180. November 23rd, 2010 at 15:46 | #180
  181. November 26th, 2010 at 11:06 | #181
  182. November 29th, 2010 at 19:48 | #182
  183. December 1st, 2010 at 10:03 | #183
  184. December 1st, 2010 at 13:08 | #184
  185. December 8th, 2010 at 11:30 | #185
  186. December 12th, 2010 at 14:26 | #186
  187. December 16th, 2010 at 08:07 | #187
  188. December 19th, 2010 at 03:19 | #188
  189. December 31st, 2010 at 13:03 | #189
  190. January 3rd, 2011 at 14:22 | #190
  191. January 4th, 2011 at 05:36 | #191
  192. January 10th, 2011 at 07:39 | #192
  193. January 13th, 2011 at 16:56 | #193
  194. January 14th, 2011 at 10:15 | #194
  195. January 16th, 2011 at 08:02 | #195
  196. January 17th, 2011 at 20:29 | #196
  197. January 20th, 2011 at 11:08 | #197
  198. January 31st, 2011 at 05:32 | #198
  199. January 31st, 2011 at 20:46 | #199
  200. February 1st, 2011 at 20:27 | #200
  201. February 3rd, 2011 at 13:24 | #201
  202. February 11th, 2011 at 12:55 | #202
  203. February 15th, 2011 at 15:04 | #203
  204. February 19th, 2011 at 05:04 | #204
  205. February 19th, 2011 at 21:19 | #205
  206. February 20th, 2011 at 11:02 | #206
  207. February 22nd, 2011 at 13:33 | #207
  208. February 25th, 2011 at 18:31 | #208
  209. March 4th, 2011 at 10:23 | #209
  210. March 9th, 2011 at 02:40 | #210
  211. March 12th, 2011 at 10:37 | #211
  212. March 16th, 2011 at 08:02 | #212
  213. March 16th, 2011 at 13:54 | #213
  214. March 16th, 2011 at 14:11 | #214
  215. March 17th, 2011 at 01:55 | #215
  216. March 18th, 2011 at 16:09 | #216
  217. March 23rd, 2011 at 10:32 | #217
  218. March 28th, 2011 at 07:53 | #218
  219. April 2nd, 2011 at 06:42 | #219
  220. April 5th, 2011 at 18:00 | #220
  221. April 25th, 2011 at 20:07 | #221
  222. April 27th, 2011 at 11:41 | #222
  223. May 2nd, 2011 at 09:54 | #223
  224. May 3rd, 2011 at 15:30 | #224
  225. May 16th, 2011 at 14:37 | #225
  226. May 23rd, 2011 at 14:00 | #226
  227. May 23rd, 2011 at 21:47 | #227
  228. May 26th, 2011 at 18:49 | #228
  229. May 27th, 2011 at 09:55 | #229
  230. May 31st, 2011 at 11:31 | #230
  231. June 1st, 2011 at 05:07 | #231
  232. June 3rd, 2011 at 15:53 | #232
  233. June 5th, 2011 at 13:17 | #233
  234. June 7th, 2011 at 12:13 | #234
  235. June 9th, 2011 at 02:53 | #235
  236. June 16th, 2011 at 03:38 | #236
  237. June 18th, 2011 at 10:26 | #237
  238. June 19th, 2011 at 08:57 | #238
  239. June 27th, 2011 at 14:55 | #239
  240. July 5th, 2011 at 19:37 | #240
  241. July 6th, 2011 at 05:17 | #241
  242. July 10th, 2011 at 10:41 | #242
  243. July 11th, 2011 at 21:52 | #243
  244. August 6th, 2011 at 13:55 | #244
  245. August 6th, 2011 at 13:55 | #245
  246. August 11th, 2011 at 09:39 | #246
  247. August 18th, 2011 at 06:28 | #247
  248. August 20th, 2011 at 07:44 | #248
  249. August 20th, 2011 at 19:16 | #249
  250. August 22nd, 2011 at 09:13 | #250
  251. September 1st, 2011 at 23:25 | #251
  252. September 2nd, 2011 at 14:47 | #252
  253. September 12th, 2011 at 02:21 | #253
  254. September 13th, 2011 at 07:36 | #254
  255. September 13th, 2011 at 10:43 | #255
  256. October 10th, 2011 at 02:58 | #256
  257. October 10th, 2011 at 19:59 | #257
  258. October 12th, 2011 at 03:16 | #258
  259. October 17th, 2011 at 02:06 | #259
  260. October 18th, 2011 at 09:39 | #260
  261. October 18th, 2011 at 09:39 | #261
  262. October 18th, 2011 at 10:58 | #262
  263. October 19th, 2011 at 08:30 | #263
  264. October 25th, 2011 at 12:06 | #264
  265. November 1st, 2011 at 20:35 | #265
  266. November 9th, 2011 at 00:25 | #266
  267. November 15th, 2011 at 01:47 | #267
  268. November 18th, 2011 at 09:20 | #268
  269. November 21st, 2011 at 19:08 | #269
  270. December 18th, 2011 at 23:34 | #270
  271. December 29th, 2011 at 13:47 | #271
  272. January 12th, 2012 at 06:20 | #272
  273. January 12th, 2012 at 18:01 | #273
  274. January 17th, 2012 at 00:04 | #274
  275. January 29th, 2012 at 14:45 | #275
  276. February 2nd, 2012 at 02:42 | #276
  277. February 8th, 2012 at 11:48 | #277
  278. February 10th, 2012 at 08:25 | #278
  279. February 18th, 2012 at 00:11 | #279
  280. February 23rd, 2012 at 01:39 | #280
  281. March 19th, 2012 at 02:46 | #281
  282. March 28th, 2012 at 02:14 | #282
  283. April 1st, 2012 at 09:09 | #283
  284. April 4th, 2012 at 08:51 | #284
  285. April 5th, 2012 at 06:04 | #285
  286. April 9th, 2012 at 17:01 | #286
  287. April 15th, 2012 at 10:28 | #287
  288. April 30th, 2012 at 20:34 | #288
  289. May 5th, 2012 at 02:34 | #289

For code blocks, use <pre lang="javascript">. css and html4strict are also accepted.