22 October 2012
All
Studies show that five out of five web designers agree that the handful of fonts that come installed on most Windows and Mac computers offer a woefully inadequate choice for even the simplest design projects.
Stuffy old Times New Roman and straight-laced Arial have earned their place in the world of fonts, but anyone serious about design knows what it's like to spend hours searching for just the right font.
If you think font hunting a waste of time, you might consider reading Hear, All Ye People; Hearken, O Earth (Part One), a New York Times article by Errol Morris, who conducted a recent study on how typefaces impact our perception of truth. (Font fanatics, truth seekers, and anyone who loves a good research project should enjoy his article).
If you're already convinced that fonts matter and that you can never have enough options, you should be delighted that the @font-face CSS rule now makes it possible to use almost any font on your web pages.
Combine your new font options with other exciting CSS3 additions, such as text shadows and gradients, and you can create fantastic text treatments without resorting to the old workaround—using images with styled text created in Photoshop. (See Figure 1 for an example of the @font-face rule in action.)

Using text with the @font-face rule instead of text in an image offers many advantages:
Using the @font-face rule seems pretty straight forward at first. In essence, it requires just two steps. First, you use the @font-face rule to link to a font hosted on a web server. Then, you use that font in the font-family property in your CSS rule. Easy peasy.
Armed with those basic instructions, it's tempting to assume you can just upload any font on your hard drive to your web server, link to it with the @font-face rule, and you're set. Unfortunately, like so many things on the web, hosting and using fonts in web pages is way more complicated than it should be—for more reasons than you might imagine.
First, font-designers have rights—not that I think there's anything wrong with that, it just complicates things. If you want to know more about the complexities of copyrighting fonts, and how at least one web designer has been already sued for generating a web font, read "Copyright and Web Fonts" from CopyHype.com.
Complicating matters further, even if you have the rights to host a font on your server, you may not have all of the variations of that font needed for the letters to display properly on Mac and Windows computers, or to work in all web browsers.
All these factors conspire to make hosting your own web fonts far more complicated than it should be, which is why most of us use one of the popular font services, such as Typekit, Font Squirrel, or Google Web Fonts.
But not all font services work the same way. Indeed, these three popular services take very different approaches to how they make fonts available to web designers. Font Squirrel lets you download fonts that you can then upload to your own web server (they manage the rights and font options for you). Google Web Fonts makes it easy to link to fonts hosted on their server. Typekit takes a very different approach, a more complicated approach, which I'll explain at the end of this article.
In my observation, much of the confusion among web designers about using the @font-face rule stems from the fact that the most popular font services take such different approaches to how they manage web fonts, and the steps you need to take to use their fonts in your web pages, which is why I cover each of them separately.
My goal in this tutorial is to first help you understand the range of options when it comes to font services, and then give you basic instructions for how to use each of them, so that you can make a more informed decision about which one will work best for you.
There are far more font services than I can cover in one article, so I've chosen to focus on Typekit, Font Squirrel, and Google Web Fonts because they are among the most popular options, and because they represent three distinct approaches to managing fonts on the web. Once you understand how these three services work, you should have a pretty good overview and be prepared to make an informed assessment of just about any of the other font services out there as well.
I'll start with Google's web fonts service, not because it's the best of the bunch, but because it's the easiest to use—and it's free. If you have a limited budget, and you don't need a vast collection of fonts to choose from, Google Web Fonts makes it easy to add a few new font options to your website.
There are a few limitations to keep in mind. Google's Web Fonts are all free fonts and very few offer more than one font style. If you want to use a variety of font styles, you'll be better served by Typekit or Font Squirrel.
Also, note that when you use Google's hosted font service, you are linking to the font on the Google server. Although Google's servers are pretty reliable, if their server goes down, your fancy fonts won't work and your text will display in a good old-fashioned default font instead.
To add any of the fonts in from the Google Web Fonts site to your pages:



Note: Most of the fonts in the Google Font Directory only have one style, but some have two or more. Although you may be tempted to choose all of the styles, it's best to select only the ones you'll use. As Google warns, the more font styles you choose, the longer it will take to download your page.

<head> and close </head> tags.<h1> heading tag and then used the <h1> tag to format the text.
Note: To view the font in Dreamweaver CS5 or CS6, you'll need to click the Live view button at the top of the workspace. Live view provides a preview display that uses the same WebKit engine used in Apple Safari and Google Chrome.
To confirm that the font works on your web page, it's always best to preview the page after it's published online. And don't forget, when you use Google's hosted font service, you are linking to the font on the Google server. If their server goes down, or anything else breaks the connection between your site and theirs, your text will not display in the Google font.
The newest member of the online font family is the Adobe Edge Web Fonts site. To create Edge Web Fonts, Adobe partnered with Google. As a result, Google Web Fonts and Edge Web Fonts are so similar, I won't cover the steps in detail here.
Like Google Web Fonts, Edge Web Fonts are both free and easy to use, and, in addition, the service is integrated into some Adobe tools. You can learn more about the service and Adobe's partnership with Google in the blog post Introducing Adobe Edge Web Fonts. While the service is powered by Typekit, meaning it uses the same standards-based method of serving fonts and the same global font serving network, it is completely free and requires no account or kit configuration (more on that in the Typekit section at the end of this article).
Although Google Web Fonts and Edge Web Fonts are similar, there are some reasons why you might choose one over the other. For example, they don't have all the same fonts, so if you don't find the font you want on Google Web Fonts, you may have better luck on Edge Web Fonts (and vice versa). Also, the two services offer different font loading options (see the Edge Web Fonts URL Specifications for how it works).
As with any new service (Adobe Edge Web Fonts was launched just weeks before I wrote this article), expect changes and improvements in the weeks and months to come. As part of their partnership, team members from Typekit, Adobe Type, and Google Web Fonts are all working together to improve rendering and performance across all of their font services.
Unlike the other two options covered in this article, FontSquirrel is not a hosted service. At Font Squirrel, you choose from a limited collection of free fonts, or you purchase one of their premium fonts. You then download the fonts from their site to your computer, and finally, you need to upload those fonts to a web server when you publish your website.
What Font Squirrel does is provide font kits, which are prepackaged font collections that include all of the font formats you need to use a font in a website, as well as the CSS and HTML code.
Font Squirrel also provides an @Font-Face Generator, which you can use to create all of the font formats needed on the web. Note: as I mentioned earlier, you must have the rights to use a font on a web server, and FontSquirrel reminds you of this requirement when you use the @Font-Face Generator.
Whether you download the prepackaged @font-face kits or use the generator to create your own, the steps you follow to use the fonts from Font Squirrel (and any other website from which you can download web fonts) are the same.
To use the @Font-Face kits from FontSquirrel in your website:
@font-face Kits link in the navigation bar at the top of the site (see Figure 7).

You can also search for the name of any font to open the Font Squirrel page for that font and download the @font-face kit from there. If you choose this option, make sure you click the button for the @font-face Kit and not just the TTF version (see Figure 9).

If you're using an earlier version of Dreamweaver, or any other text or HTML editor, copy the contents of the @font-face kit zip folder into your main website folder and use the following code examples as a guide to using the fonts in your pages.
First, you need to link to the font. The @font-face kits from Font Squirrel include a collection of font types, so when you link to one of these fonts, the code in your header should include all of the font types, which means it should look like the following sample. (Of course, you should replace the name "Chantelli Antiqua" with the name of the font you downloaded. Make sure you copy the name exactly as it appears on Font Squirrel and in the filenames in the font folder.)
}
With the font linked in the header of the page, or in a style sheet liked to the header, you can then use the font in a style, such as this class style:
.sectionName {Finally, format text in your page with the style:
font-family: 'Chantelli Antiqua', Georgia, Times, serif;
font-weight: 400;
font-size: 150%;
color: #603;
}
<p class="sectionName">Section 1</p>


Remember: To view a web font in the design area in Dreamweaver, you have to click the Live view button at the top of the workspace (see Figure 12).

The new Web Font Manager in Dreamweaver is a handy feature that makes it easier to use Web fonts in styles in Dreamweaver; but keep in mind, you can only use the new Web Fonts Manager if you have the font on your local computer. If you use a font service, such as Google Web Fonts, covered earlier in this tutorial, or Typekit, covered in the next section, you can't use the Web Font Manager.
I've saved Typekit for the end of this article, not only because Adobe now owns it, but because I sincerely consider it the best of the bunch, and you're supposed to save the best for last. At the top of the heap, Typekit offers a wide range of professional-quality fonts, and now that Adobe has acquired Typekit, you can probably expect that it will become increasingly well integrated into the Adobe Creative Suite.
Indeed, Typekit is already included in all subscriptions to the Adobe Creative Cloud. If you're not a Creative Cloud subscriber, you can try Typekit for free, but if you get much traffic, or want to use fonts on more than one website, you'll have to pay a monthly subscription fee.
Before I get into how Typekit works, here's a quick recap of what I've covered in this tutorial so far: Google and Font Squirrel represent two very different ways to work with web fonts using the @font-face rule:
Now I'm going to show you a third approach as I explain how to use the fonts at Typekit.
Here's a step-by-step look at how Typekit works:



Remember: The more font style options you choose, the more font styles have to be accessed on the Typekit server and the slower your web page will download in a web browser.

<head> and close </head> tags. Typekit recommends you insert this code toward the top of the head area for best results.Note: Because the Typekit model is so different from the other two, here's a quick summary to help you compare how these three sites work. With Font Squirrel, you download the fonts to your computer and then publish them to your server. With Google Web Fonts, you link to the fonts hosted on a Google Server. With Typekit, you essentially use a little JavaScript to create a connection between your site and theirs and then the fonts that are in your collection on Typekit become available for use on the pages on your website.

A few of last tips for making the most of Typekit:

To learn more about how the @font-face rule works, the evolution of fonts on the web, and how fonts display, read Introduction to web typography and @font-face by Typekit Founder Greg Veen.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License