Fonts in Web Design
Deciding which fonts to use for your web project has always been a big headache. Some designers simply cannot understand that some fonts will not be found on all operating systems and if they use that font the web site will look different under that OS. So how do we handle this problem? Well there are four methods each with their pros and cons.
Image Replacement
The first method is by use of images. To use your desired font and make sure that everyone will see it the same you replace your header text with images. The advantage of such a system is that it si very easy to implement (using CSS background images), it can be viewed the same by everyone, and does not require additional installations to your browser to view.
The main disadvantages of such a method is that you may have accessibility problems. For example screen readers cannot read images and if you use CSS background image you need to to think of another method to introduce alt tags. It is a big headache to produce new images each time a header changes. If you have dynamic content your only solution is server generated images, which are not easy to implement and may affect the performance of your web site. With this method you have limited caching and no reusability.
Scalable Inman Flash Replacement
In 2004 Mike Davidson, Shaun Inman, and Mark Wubben came with a very genious idea. To resolve the problem that a client may not have the required font installed on his/her machine, this method securely embeds the required fonts to view the web site in a flash movie. With Javascript one can then substitute the HTML text for the SWF movie.
This technique is very intelligent and gives the designer an unlimited choice of fonts that he/she may use. Apart from this there are less licensing issues for fonts since the fonts are securely embedded.
The drawbacks of this techniques is that it still relies on Flash and Javascript. Although Javascript may not be an issue, the use of Flash means that some clients still need to download extra software for their browser to be able to view your website as you intended.
Use @font-face
CSS gives us the possibility to include an @font-face declaration that specifies the font to be used and from where it can be downloaded if the user does not have this font installed on his/her machine. Here is an example:
@font-face {
font-family: Calibri;
src: url('calibri.otf');
}
It looks easy! The problem is that the act of making your font available on your server violates most of the end-user license agreements of the fonts. Another problem is that it currently only works on Safari 3 although in the future Opera and Firefox will support it. Another issue is that @font-face could expose clients to viruses attached to downloaded fonts.
Vector Text
Vector text is a technique that copies the idea from Scalable Inman Flash Replacement however the nice thing about it is that it does not rely on Flash. The idea is to use Javascript to replace HTML with a Canvas element that renders the text in vector format.
But how are we going to convert the text in vector format. There are two methods: Typeface JS and cufón. Each method requires you to convert your font into a vectorized JavaScript file using their free online tools. These vectorized fonts are then linked to your page, rendered to a canvas area, and swapped into your page on-the-fly when JavaScript is available.
Of course many will argue that if your browser supports canvas then it is likely to support Flash. It is true except for one browser. Apple iPhone’s browser supports canvas rendering but does not support Flash.
So currently Vector text is the most reliable solution for non-traditional fonts in your website. I will experiment with this and in the future hope to write a tutorial on how to implement vector text in your web site.