• user warning: Duplicate entry '105211' for key 'PRIMARY' query: INSERT into captcha_sessions (uid, sid, ip_address, timestamp, form_id, solution, status, attempts) VALUES (0, 'c9788a259a70e6446d4694e52b18852a', '38.107.191.95', 1280603188, 'webform_client_form_528', 'undefined', 0, 0) in /var/www/clients/client1/web3/web/sites/all/modules/captcha/captcha.inc on line 92.
  • user warning: Got error 134 from storage engine query: SELECT status FROM captcha_sessions WHERE csid = 0 in /var/www/clients/client1/web3/web/sites/all/modules/captcha/captcha.inc on line 112.
  • user warning: Got error 134 from storage engine query: SELECT status FROM captcha_sessions WHERE csid = 0 in /var/www/clients/client1/web3/web/sites/all/modules/captcha/captcha.inc on line 112.
Aug 28

@font-face and 15 Free Fonts You Can Use Today

Fri, 08/28/2009 - 19:47 — julie

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"> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/droidexample.png" alt="Droid Font Family Example"/>

@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"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/weft.png" alt="Microsoft WEFT"/>

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/"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/ttf2eot.png" alt="ttf2eot Command Line Utility"/>

A few people have setup an online version of ttf2eot as well.

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"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/museosans.png" alt="Museo Sans"/>

2. Quicksand

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Quicksand"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/quicksand.png" alt="Quicksand"/>

3. Delicious

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Delicious"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/delicious.png" alt="Delicious"/>

4. Vollkorn

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Vollkorn"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/vollkorn.png" alt="Vollkorn"/>

5. Andika Basic

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Andika-Basic"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/andikabasic.png" alt="Andika Basic"/>

6. TitilliumText14L

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/TitilliumText14L"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/titillium.png" alt="TitilliumText14L"/>

7. Zag Regular

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Zag-Regular"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/zagregular.png" alt="Zag Regular"/>

8. ChunkFive

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/ChunkFive"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/chunkfive.png" alt="ChunkFive"/>

9. TypoSlabserif

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/TypoSlabserif-Light"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/typoslabserif.png" alt="TypoSlabserif"/>

10. Whitehall

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Whitehall"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/whitehall.png" alt="Whitehall"/>

11. Xenophone

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Xenophone"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/xenophone.png" alt="Xenophone"/>

12. Daniel

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Daniel"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/daniel.png" alt="Daniel"/>

13. Sansumi

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Sansumi"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/sansumi.png" alt="Sansumi"/>

14. Journal

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Journal"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/journal.png" alt="Journal"/>

15. Miama

class="tutorial_image"> target="_blank" href="http://www.fontsquirrel.com/fonts/Miama"> /> src="http://themeforest.s3.amazonaws.com/113_fontFace/images/miama.png" alt="Miama"/>

Additional Resources

If you’re looking for more information and/or fonts, here are a couple places to look.

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'/>

class="webroundup">
  • Please subscribe to the target="_blank" href="http://feedproxy.google.com/themeforest" title="ThemeForest RSS Feed">Theme Forest RSS Feed, and follow us on target="_blank" href="http://twitter.com/themeforest">Twitter.



  • Copyright 2009. E-mail Me
    Auto Spare Parts
    Rail Fare