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');
  src: local('Graublau Web Regular'), local('Graublau Web'), 
         url('GraublauWeb.otf') format('opentype');
}

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. Okay, let's see what we got here…

Conditional comments (via)

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

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.

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
  • 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.

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('Graublau Web Regular'), local('Graublau Web'),
    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.

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.

Paul Irish front-end development, typography

  1. | #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. | #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. | #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. | #4

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

  5. | #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. | #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. | #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. | #8

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

  9. | #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. | #10

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

  11. Jono
    | #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. | #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
    | #13

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

  14. | #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. | #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. | #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. | #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. | #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. | #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. | #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. | #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. | #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. | #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. | #24

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

  25. | #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
    | #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. | #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
    | #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. | #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
    | #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. | #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. | #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
    | #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. | #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. | #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. | #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. | #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. | #38

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

  39. chro
    | #39

    just wanna say that chrome 0.3 support svg font

  40. chro
    | #40

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

  41. | #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. | #42

    Here's to confused and lazy!

  43. | #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. | #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
    | #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
    | #46

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

  47. murraybiscuit
    | #47

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

  48. Jason Pantsoff
    | #48

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

  49. | #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. | #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. | #51

    Very useful….nice & clear thanks

  52. | #52

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

  53. | #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. | #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. | #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. | #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. | #57

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

  58. | #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
    | #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. | #60

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

  61. Lampica
    | #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
    | #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
    | #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
    | #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
    | #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
    | #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
    | #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
    | #68

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

  69. stacey
    | #69

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

  70. stacey
    | #70

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

  71. stacey
    | #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
    | #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
    | #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. | #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. | #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. | #76

    hi!
    i have a new windows 7 64bit computer and i cant see the @font-face fonts neither on my webpage, nor on fontsquirrel (in the fontdemo).
    in no browser, for none of the 3 different fonts i tried.
    apparently there is a problem with that, do you know anything about it?

  77. | #77

    sorry! im taking it back! its not in all browsers, just chrome. (the font on my website is wrong in all browsers, but i guess thats me ;-). still: anything known about this?

  78. | #78

    sorry! i take it back!
    its only in chrome that fontsquirrel demo doesnt work.
    while my webpage doesnt in any browser… ;-)
    still, do you know anything about that?

  79. | #79

    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?

  80. | #80

    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.

  1. | #1
  2. | #2
  3. | #3
  4. | #4
  5. | #5
  6. | #6
  7. | #7
  8. | #8
  9. | #9
  10. | #10
  11. | #11
  12. | #12
  13. | #13
  14. | #14
  15. | #15
  16. | #16
  17. | #17
  18. | #18
  19. | #19
  20. | #20
  21. | #21
  22. | #22
  23. | #23
  24. | #24
  25. | #25
  26. | #26
  27. | #27
  28. | #28
  29. | #29
  30. | #30
  31. | #31
  32. | #32
  33. | #33
  34. | #34
  35. | #35
  36. | #36
  37. | #37
  38. | #38
  39. | #39
  40. | #40
  41. | #41
  42. | #42
  43. | #43
  44. | #44
  45. | #45
  46. | #46
  47. | #47
  48. | #48
  49. | #49
  50. | #50
  51. | #51
  52. | #52
  53. | #53
  54. | #54
  55. | #55
  56. | #56
  57. | #57
  58. | #58
  59. | #59
  60. | #60
  61. | #61
  62. | #62
  63. | #63
  64. | #64
  65. | #65
  66. | #66
  67. | #67
  68. | #68
  69. | #69
  70. | #70
  71. | #71
  72. | #72
  73. | #73
  74. | #74
  75. | #75
  76. | #76
  77. | #77
  78. | #78
  79. | #79
  80. | #80
  81. | #81
  82. | #82
  83. | #83
  84. | #84
  85. | #85

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

Comments for this post will be closed on 30 August 2010.