I really need to think of a clever name for my blog

Code samples, geeky links and other musings. Note this blog has recently moved from Posterous, so isn't fully back up to speed yet!

@font-face pitfalls and answers

Some useful tips to avoid certain @font-face pitfalls:

@font-face gotchas – Paul Irish [new window]

 

I have copied Paul’s post over here wholesale just in case his site ever goes down – Do check out his site though – there are always interesting posts to be found and I highly recommend it.

See also: Disasterman’s <pre>posterous – @font-face – The Complete Solution?

All content below here sould be considered © Paul Irish and his relevant sources, not me!

 

 

Over the past few months, I’ve collected a few worthwhile notes on @font-face that are worth reading over if you geek out about this stuff…

font-weight:normal;      font-style:normal;      font-variant:normal;      /* these values are defaults in FF/Opera/IE but not webkit */

@font-face links that might have sneaked past you

And.. regarding @font-face syntax

I now recommend the bulletproof smiley variation over the original bulletproof syntax.

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

From the bulletproof post:

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.

There are a few reasons why smiley is a better solution:

These are all pretty edge case issues, but it’s worth considering. FontSquirrel has already made the smiley syntax the new default in the Generator, and you should use it going forward as well.

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

 

 

 

@font-face – The Complete Solution?

Embedding fonts for use in websites with cross-browser compatibility is now very much possible – but it’s still a bit complicated.

These two resources greatly help to make the solution bulletproof and painless:

Bulletproof @font-face syntax « Paul Irish

The best syntax solution explained
http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/ [new window]

Paul is also a founder of the very interesting “HTML5 Boilerplate – A rock-solid default for HTML5 awesome.[new window] – a startup kit for developing HTML5 and cross-browser compatible websites.

Font Squirrel | Create Your Own @font-face Kits

An @font-face generator that converts your fonts and gives you the CSS ready to go!
http://www.fontsquirrel.com/fontface/generator [new window]

Font squirrel also provide hundreds of fonts free for commercial use, and @font-face kits ready to go for any website. 

[update201101070244]

Here’s a handy little presentation on the subject, and includes some tips on minimising the dreaded fout. It’s actually quite old, but from what I know it’s all still very relevant.

[/update]

[update201104051316]

Hmm. Not sure where that presentation has gone. Oh well. Some more useful tips can be found in this blog post: Disasterman’s <pre>posterous – @font-face pitfalls and answers