I’m a big fan of Woothemes. It seems that each time they come out with a theme – they push the boundaries of web design. Take a look at their latest creation: Therapy – I can’t help but fall in love with the fine background gradients, smooth and seamless transparencies and nice rounded edges. But what I really like about Therapy is it’s amazing typography. I said to myself: “that’s excellent utilization of sIFR”. So I right clicked on a post title, expecting to see the “About Macromedia Flash” entry – but didn’t see it. So I asked my confused self: “if it’s not sIFR, then what is converting all this dynamic text?”

seethedemo Cufonize Your Pages   How to add Cufon to your Web Design

I inspect element in Firebug – then I see span class “cufon” everywhere.

cufon 1 Cufonize Your Pages   How to add Cufon to your Web Design

So What in the world is Cufon?

Cufon is defined as “fast text replacement with canvas and VML”. It also claims to be a worthy alternative to sIFR – which is, to those who are not familiar – stands for Scalable Inman Flash Replacement. sIFR is the technology used by web designers to replace dynamic text with non-web safe fonts. Although sIFR has done an okay job with text replacement – it has proven to be quite tricky to set up. I’ve used sIFR in a few projects in the past and do admit that it is not the easiest thing to get going. On top of that – sIFR seems a bit buggy, as well as slows down page loads. These are serious consequences to consider for the price of using a unique font for your pages.

So I went ahead and tried Cufon. To my amazement, the following steps is all that it takes to fully “Cufonize” your web pages. *Forgive the use of the term “cufonize” – it may sound funny, but after you try these steps, you too will “cufonize” your pages.

Step 1: Get Cufon

The first thing you need is to download the core javascript file which is responsible for the rendering of your custom font inside your HTML. Head on to http://cufon./generate/ and right click the “Download” tab – choose “Save Link As…” Save cufon-yui.js into a local directory in your machine.

cufon 2 Cufonize Your Pages   How to add Cufon to your Web Design

Step 2: Generate your Font

On the same page at http://cufon./generate/ – click on the “Regular typeface” field – and browse to your desired font in your local machine.

cufon 3 Cufonize Your Pages   How to add Cufon to your Web Design

The rest of the upload fields are optional. I left all of them default for the sake of making this tutorial short. Just make sure – you are using a font that is legit to use, check off the EULAs and the Terms of Agreement. Click on the “Let’s Do This” Button at the very end of that page.

This should generate a custom font javascript code for you – depending on your font choice. In my case, I picked something very un-extraordinary: Gigi.TTF – which produced a file named Gigi_400.font.js.

Go ahead and save this file in the same directory where you saved the core Cufon-yui.js file and we’re ready to build your page:

cufon 4 Cufonize Your Pages   How to add Cufon to your Web Design

Step 3: Cufonize your Page

All you really need to do from this point is to link to these javascript files in the head section of your HTML. Also make sure that cufon-yui.js is called before the font.js file:

<script type="text/javascript" src="cufon-yui.js"></script>
<script type="text/javascript"  src="Gigi_400.font.js"></script>

To begin the replacement process – create a custom script like below:

<script type="text/javascript">  
    Cufon.replace('h3, p');
</script>

The above script is telling the cufon to replace all H3 and P tags to our custom font.

cufon 5 Cufonize Your Pages   How to add Cufon to your Web Design

Note that if you want to target specific elements in your page the same way you assign CSS classes and Ids, you have to use a framework such as jQuery that’ll let you do such a thing. To download jQuery, go to http://docs./Downloading_jQuery. Make sure you link to this file BEFORE the core cufon-yui.js in your header.

With the jQuery library in place, now you can select more specific elements in your page (hashtags for IDs and periods for classes). See example code below:

<script type="text/javascript">  
    Cufon.replace('h3#convert-me, p#convert-me-too');
</script>

The above code will Cufonize only the h3 tags with the id of “convert-me”, and p tags with the id of “convert-me-too”.

cufon 6 Cufonize Your Pages   How to add Cufon to your Web Design

Conclusion:

That’s basically it! That’s all it takes for you to use any font you like in your web pages. What I like best about Cufon is that it’s quick and it works. You will also find that general CSS properties such as color, size and positioning still applies on the transformed font. To find out more about the specifics of Cufon styling – see http://wiki.github.com/sorccu/cufon/styling.

Much respect to the people who created Cufon. I’m sure this marks a new trend in web typography. To the folks at Woothemes: keep pushing the boundaries – your work is pure inspiration to web artists everywhere.

seethedemo Cufonize Your Pages   How to add Cufon to your Web Design

Who’s Using Cufon?

The following list of websites are already using Cufon text replacement in their pages:

Healthy Valdosta

healthyvaldosta Cufonize Your Pages   How to add Cufon to your Web Design

Press75

press75 Cufonize Your Pages   How to add Cufon to your Web Design

International Rugby Academy

intlrugby Cufonize Your Pages   How to add Cufon to your Web Design

Zen Desk

zenddesk Cufonize Your Pages   How to add Cufon to your Web Design

Rock Beats Paper

rockbeatspaper Cufonize Your Pages   How to add Cufon to your Web Design

Shopify

shopify Cufonize Your Pages   How to add Cufon to your Web Design

You should also check out these posts:

Get Yourself a Treat!

Head on over to my Freebies section for awesome Worpdress themes and Photoshop files. Even better, browse through a complete list of my stuff in my Downloads section.