@font-face and 15 Free Fonts You Can Use Today
Fonts are a huge part of design (as we all know). Text on the web needs to be much more dynamic than in any other media. We have solutions like Cufón, sIFR, etc. but perhaps one of the better options is using @font-face in CSS.
We’ll take a quick look at using @font-face in CSS and 15 great free fonts you can start using today.
What is @font-face?
@font-face is a CSS rule that lets web designers link to a font that visitors may not have installed. Using this, we can get around the problem of web-safe fonts as well as prevent creating additional dependencies in other methods such as Cufón, sIFR, etc.
Once the font is linked, it is used just like you would use any other font in your CSS. Imagine the possibilities! Unfortunately, there are concerns from many font foundries and others that is currently limiting the use of this rule.
You MUST be sure the font you intend on using is appropriately licensed for @font-face linking/embedding.
Why Use @font-face?
@font-face doesn’t rely on any technologies other than good’ol CSS, the font file you want to use and a capable browser. Other technologies such as Cufón and sIFR rely on JavaScript and Flash.
Browser compatibility is getting much better too. Currently it is supported in Firefox 3.5+ (I’ve heard 3.1+), Safari 3.1+, Opera 10 and Internet Explorer 4+. Yes, it’s been supported since IE4!
While that still leaves a lot of web users without @font-face support, it’s okay because they will just get another font in your font stack. Plus, Firefox, Safari and Opera users tend to upgrade their browsers much faster than Internet Explorer users so at least we won’t have to wait on IE with this.
src='http://blog.themeforest.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley'/>
Using @font-face (Firefox, Safari, Opera, Chrome)
Before I get started, bookmark this resource. target="_blank" href="http://www.w3.org/TR/css3-fonts/#the-font-face-rule">CSS Fonts Module Level 3 via w3.org
Using the @font-face rule is pretty simple. We’ll link the font(s) and specify format and style. Then apply the newly linked font family to the elements you want. I’ve done the h3 tag as an example using a class of “droid”. In the example, I also specified a normal font weight so the heading doesn’t default to bold.
class="wp_syntax">class="code">
@font-face { font-family: "Droid Serif"; src: url(DroidSerif-Regular.ttf) format("truetype"); } @font-face { font-family: "Droid Serif"; src: url(DroidSerif-Italic.ttf) format("truetype"); font-style: italic; } @font-face { font-family: "Droid Serif"; src: url(DroidSerif-Bold.ttf) format("truetype"); font-weight: bold; } @font-face { font-family: "Droid Serif"; src: url(DroidSerif-BoldItalic.ttf) format("truetype"); font-weight: bold; font-style: italic; } h3 { font-weight: normal; } h3.droid { font-family: "Droid Serif", serif; }
Here’s what we get. The first 4 examples are just default as shown in Safari. The last 4 examples are the Droid Serif font family.
class="tutorial_image">@font-face Font Formats
You can use OpenType (”opentype”, .otf) and TrueType (”truetype”, .ttf) in Firefox, Safari, Opera and Chrome but not in Internet Explorer. We’ll need to specify separate rules for IE.
Using @font-face in Internet Explorer
While Internet Explorer was an early adopter of @font-face, they decided to go with a more proprietary format (Embedded OpenType, .eot). So, we’ll need to specify the @font-face rule before the rules for the other major browsers. We also don’t need to set the format because IE will only use .eot fonts.
class="wp_syntax">class="code">
@font-face { font-family: "Droid Serif"; src: url(DroidSerif-Regular.eot); } @font-face { font-family: "Droid Serif"; src: url(DroidSerif-Italic.eot); font-style: italic; } @font-face { font-family: "Droid Serif"; src: url(DroidSerif-Bold.eot); font-weight: bold; } @font-face { font-family: "Droid Serif"; src: url(DroidSerif-BoldItalic.eot); font-weight: bold; font-style: italic; } /* Other major browser rules come after IE rules */
And there you have it! Custom fonts for your websites, designs, etc. without all the hassle of JavaScript and Flash dependent solutions.
Converting to EOT Fonts
If you found a font that is licensed to be used with @font-face linking but is only provided in TrueType (.ttf) or OpentType (.otf) formats, fear not. They can be converted (but make sure the license permits it).
Microsoft WEFT
Microsoft provides a tool which will convert fonts to .eot. However, I haven’t used it and I’ve read that it’s a little tricky to use.
class="tutorial_image"> target="_blank" href="http://www.microsoft.com/typography/WEFT.mspx">/>
ttf2eot
There is a small command line utility called ttf2eot that is quite easy to use, hosted via Google Code.
class="tutorial_image"> target="_blank" href="http://code.google.com/p/ttf2eot/">/>
A few people have setup an online version of ttf2eot as well.
- target="_blank" href="http://ttf2eot.sebastiankippe.com">http://ttf2eot.sebastiankippe.com
- target="_blank" href="http://www.cuvou.com/wizards/ttf2eot.cgi">http://www.cuvou.com/wizards/ttf2eot.cgi
If you need to convert from OTF, you’ll need to use
target="_blank" href="http://fontforge.sourceforge.net">FontForge to convert to TTF then use ttf2eot to convert to EOT. I know, it’s a bit of a pain but it’s better than nothing!
src='http://blog.themeforest.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley'/>
Update: You can also use http://onlinefontconverter.com to convert TTF, OTF or DFONT font files.
15 Great Free Fonts for @font-face Linking
Please remember to always check the license before using any fonts.
1. Museo Sans
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Museo-Sans">/>
2. Quicksand
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Quicksand">/>
3. Delicious
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Delicious">/>
4. Vollkorn
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Vollkorn">/>
5. Andika Basic
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Andika-Basic">/>
6. TitilliumText14L
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/TitilliumText14L">/>
7. Zag Regular
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Zag-Regular">/>
8. ChunkFive
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/ChunkFive">/>
9. TypoSlabserif
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/TypoSlabserif-Light">/>
10. Whitehall
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Whitehall">/>
11. Xenophone
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Xenophone">/>
12. Daniel
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Daniel">/>
13. Sansumi
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Sansumi">/>
14. Journal
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Journal">/>
15. Miama
class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Miama">/>
Additional Resources
If you’re looking for more information and/or fonts, here are a couple places to look.
- target="_blank" href="http://www.fontsquirrel.com/fontface">Font Squirrel @font-face Kits
- target="_blank" href="http://www.webfonts.info/wiki/index.php?title=Fonts_available_for_%40font-face_embedding">Webfonts.info @font-face embedding
- target="_blank" href="http://www.dafont.com/top.php?nb_ppp_old=10&page=1&top=1&text=Type+your+text+here&nb_ppp=10&psize=m&classt=alpha&l%5B%5D=10">dafont.com
- target="_blank" href="http://www.w3.org/TR/css3-fonts/#the-font-face-rule">w3.org CSS Fonts Module Level 3 (info on @font-face usage, etc.)
As I’ve already said, please check licenses before using fonts.
If you know of any great font resources, please share them with us in the comments below. Thanks for reading!
src='http://blog.themeforest.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley'/>
