Want your website to have nice Photoshop looking headings and subtitles without having to Photoshop your text? If so, you need website text rendering. Cufon has become a worthy alternative to sIFR (a js flash dynamic web fonts based website text renderer), which despite its merits still remains painfully tricky to set up and use. To achieve this ambitious goal the following requirements were set:
- No plug-ins required – it can only use features natively supported by the client
- Compatibility – it has to work on every major browser on the market
- Ease of use – no or near-zero configuration needed for standard use cases
- Speed – it has to be fast, even for sufficiently large amounts of text
- There is no need to manually parse the file on client-side again
- It compresses extremely well. While often somewhat large in terms of file size without any compression, a compressed font usually weighs in 60-80% less than the original.
How to use:
- Download cufon-yui.js from the Cufon website and upload it to your own server.
– If you’re upgrading, just replace your old cufon-yui.js and you’re good to go. No need to convert your fonts again.
- Use the font converter (generator) on the website:
- Choose the font file you want to convert. Try not to enter the same file multiple times.
- In case of multiple font files, you may want to enter the font name to the font-family text box. This helps avoid naming troubles.
- Check the EULA checkbox right below the file upload fields (but only if you agree, of course).
- The default settings are good for most people. You don’t have to modify them.
- At the bottom, accept the generator terms. This is different from the EULA checkbox. Both must be checked.
- Submit the form and you’re done! If you get an error message, read it and act accordingly.
- Upload the generated .font.js file to your server. You may rename the file.
Your HTML should look like this:
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Playing with Cufón</title>
<!– Stylesheets here, before all scripts. Helps avoid styling issues. –>
<link rel=”stylesheet” type=”text/css” href=”style.css” />
We support jQuery, Sizzle, MooTools, Dojo, Prototype and other popular frameworks.
Cufon.replace(‘h1’); // Works without a selector engine
Cufon.replace(‘#sub1’); // Requires a selector engine for IE 6-7, see above
<h1>Your custom font here</h1>
<h2 id=”sub1″>Your custom font here too</h2>
<!– To avoid delays, initialize Cufón before other scripts at the bottom –>
<!– Google Analytics and other scripts here –>
- And you’re set! To avoid hard-to-spot issues, here are a few things to look out for in your HTML:
– A transitional doctype will break line-height, use a strict or HTML5 doctype.
– Avoid whitespace (or anything else for that matter) before the doctype. This has been known to affect printing in IE.
– UTF-8 is the only supported character set. Use others at your own risk. Characters may go missing
For help, visit: https://groups.google.com/forum/?fromgroups#!forum/cufon
Thank you for reading IT Blog