In the last post I talked about the design aspect of using CSS3 @font-face, today I would like to extend this topic to the technical side on implementing custom web fonts. So what are the options for implementing web fonts? I'm going to review the three main methods of incorporating @font-face and explain the pros and cons of each method.
1) CSS3 @font-face
Standard @font-face
First, let's talk about the native way of implementing custom web fonts — @font-face. The CSS syntax for declaring a custom @font-face is very simple. Basically you just need to specify the font name and font file source. Once the font is specified, you can apply it to any element.
@font-face {
font-family: "Custom Font Name";
src: url('font.ttf');
}
body {
font-family: "Custom Font Name";
}
Bulletproof @font-face Syntax
Because every browser supports different font formats (IE supports EOT only, Firefox supports EOT & TTF, and Safari supports OTF, TTF, and SVG), additional font formats are required to be cross-browse. Below is the bulletproof way of implementing @font-face from Font Spring.
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff') format('woff'), /* Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
@font-Face Generator
If you need to export the fonts in different formats, there is a generator which allows you to generate various font formats from an existing font. Note: most fonts are not allowed to embed or distribute on the web. Check the licensing information before implementing any fonts.

Premium @font-Faces
Because most fonts do not allow publishing on the internet, Font Spring offers professional fonts with @font-face support. You can buy licensed fonts individually and use freely on your sites.
Pros & Cons
- PROS: Full control because the fonts are hosted on your server.
- CONS: The process is a bit complicated because it requires various font formats.
2) Font Service Providers
Another way of using fonts without worrying about licensing issues is by using the fonts from service providers such as Typekit and Fontdeck. With font service providers, the fonts are hosted on their servers and you have to pay a subscription/licensing fee to use the fonts. The process of implementing host fonts is a lot simpler compared to the native way of implementing web fonts because they handle all the font formats and browser compatibility.
Installing Typekit
To install Typekit, it requires two lines of Javascript.
<script type="text/javascript" src="http://use.typekit.com/are7wnq.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
Pros & Cons
- PROS: Easier to implement because you don't have to generate the different font formats.
- CONS: It requires subscriptions. Since the fonts are hosted on the service providers, if their servers go down, the fonts will not be available.
3) Google Web Fonts
Google Web Fonts is also consider host font providers, but Google Web Fonts are free. Google fonts are light weight (they load very fast) and they are easy to use.
Implementing Google Web Fonts
To implement Google Web Fonts, just add the line of code below.
<link href='http://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'>
Pros & Cons
- PROS: Free, lightweight, and loads fast.
- CONS: Not enough selections and most fonts don't come with different weights and styles.
Conclusion
@font-face is good if you need to use your own custom fonts. Typekit & Fontdeck offer professional fonts in complete sets (styles & weights), but require subscriptions. Personally, I like Google Web Fonts because it is simple to implement and it loads very fast.
Have been using fontsquirrel for ages with little to no awareness for the license implications, but was not aware of the alternatives such as fontspring.com. Great article!
Thank you very much for that article! You braught me light in the dark :)
I was using @font-face, but I switched to Google Fonts. Since version 2 it has much more fonts to choose from and the performance is much better.
Also with @font-face, I had some browser issues that were not solved at the moment I needed to use the font. I think Google Fonts is safer regarding browser compatibility, am I right?
I also think Google fonts is the way to go, they do have a nice selection of typefaces right now. Very few fonts have more than 2-3 weights but that’s basically the norm with free fonts. It’s also a nice ice-breaker for type designers that want to submit their first fonts somewhere.
As long as you don’t necessarily need some very specific commercial typefaces, Google fonts kicks ass.
I’m also Google Web font user. But as poster said it has limited offer of fonts library. Especially my country uses Russian like Cyrillic. I found only one font named “PT Sans Narrow”, that has all our language characters.
Don’t forget Cufon!
A great alternative.
Cufon used to be great, but let’s face it, it’s not a match for real browser-rendered fonts with @fontface. Besides, the loading time of a page containing Cufon is dramatically slower than it is with @fontface. Time to step forward and be grateful for what delight it used to be, but fall in love with new and better technology :)
Until we have better anti-aliasing on Windows, Cufon is the only way for me. It’s hard to justify using a non-standard font because it looks better when in fact it looks terrible.
Cufon actually looks good regardless of your browser and OS, because it doesn’t rely on browser anti-aliasing to smooth out the pixels.
Spot on Chris. Exactly what I have found. I will give up a little performance for something that looks fantastic in all browsers. The goal is to have a happy medium, but the designer in me cannot let the windows fonts pass.
I would agree with your statemen however you can use the text-shadow property to good effect. By utilising this proerty as the same coour code as your font it can smooth it out providing its 1px.
Thats the method i have adopted and used for quiet some time. The only downside was the lack of support it once had which now is pretty much widely supported.
Another interesting read. Keep up the good work.
I agree with what several people have already said, Google Web Fonts seems to be the way to go for free, reliable font service. Their selection has been growing and while you only get a few weights for each font, it is free.
Give Fonts.com Web Fonts ( webfonts.fonts.com ) a look for more than 12,000 Web fonts including the big name typefaces such as Helvetica, Frutiger, Univers and many others. @Gerelt there are 410 Cyrillic fonts currently available in the service. Free option as well.
Cheers for the article. We use Google Web Fonts as well.
I thought you should be aware that there are a few other web font services out there, including Webtype, WebInk and our service Fonts.com.
We are proud of the fact that we now have over 12,000 commercial fonts available for use on the web. These include name-brand fonts such as Helvetica®, Frutiger®, Gill Sans®, Univers® and many more. One benefit of the service not mentioned is that when we enhance a font and make improvements to how it displays on-screen, it is then automatically made available to subscribers. Additionally, something not mentioned is that there is a self-host option available for those larger sites who prefer to control all their site assets.
I use google web fonts for all of my custom blog themes and I love it. I’m also excited to see them adding new fonts pretty regularly, and I’m very impressed with the revamped website.
I think it’s important to point out that @font-face was in the CSS2 spec also, but was removed from CSS2.1. It’s also supported by IE6, although you need another font format, but at least it’s supported.
Fully support @font-face
If you work on a site that has 10′s of thousands of page views a day Typekit is NOT the way to go. For them to track font usage they don’t cache the font so it has to pull the font on every page load.
TypeKit is great for smaller sites that don’t generate tons of traffic.
Thanks a ton! I was just wandering around for the very information. Your article just fed me with the sufficient knowledge about custom @font-face fonts. Thanks again :)
In fact, you can choose different font weights and styles in Google web fonts.
Like this: http://bit.ly/qoJxgs
Doesn’t anyone else get horrible aliasing under Windows based browsers (yes, even on Chrome and Firefox)? Even more-so when using Google’s hosted fonts?
Does @font-face works on IE7 and IE8??
we miss your judgement on Cufon – - -
Cufon is font/image replacement. It doesn’t consider @font-face solution.
I use Typekit, they provide a great service however, i think that @font-face would be the better choice if you do not want to subscribe.
really nice article and brilliant work and this will help us .
Heard of the other methods except for google fonts, this method sounds good as its light weight, im going to try this to test.
Another great post thanks!