Times New Roman - web safe font
With a huge wealth of fonts (both paid and free) now readily available online to designers, rendering fonts online has become more of an issue. Sure, your website may look great in Photoshop, but how are you going to emulate that intricate font across multiple browsers?
There are a variety of font services out there: fonts.com and Google fonts are the big players; however we decided to go down the route of @font-face, as we have a large collection of bought fonts already that we could utilise through @font-face.
@font-face is a CSS rule which allows you to download a particular font from your server to render on a webpage if the user hasn’t got that specific font installed. This means that web designers no longer have to adhere to a particular set of ‘web safe’ fonts that the user has pre-installed on their computer, or rely on users having JavaScript enabled. This works by turning the font file into a @font-face kit using an online generator like Font Squirrel.
We have been using @font-face at Adtrak for a while now, and have found only a few issues with it – the main one being rendering in Chrome. The first time I used @font-face; I loaded my website in Google’s browser and was greeted by a jagged, harsh looking font render – nowhere near as nice as Firefox. After a quick search, it became apparent that I wasn’t alone in the experience. I struggled to find a decent fix for this; one method I did use for a while added a CSS text shadow to overcome the jagged edges, but this wasn’t a great, full fix.
After experimenting myself, I stumbled across what appears to be a decent, very easy fix for this issue. It appears that Chrome utilises the .svg file in the @font-face kit, and doesn’t like being called last. Below is the standard call for @font-face using CSS:
@font-face {font-family: 'chunk-webfont';
src: url('../../includes/fonts/chunk-webfont.eot');
src: url('../../includes/fonts/chunk-webfont.eot?#iefix') format('eot'),
url('../../includes/fonts/chunk-webfont.woff') format('woff'),
url('../../includes/fonts/chunk-webfont.ttf') format('truetype'),
url('../../includes/fonts/chunk-webfont.svg') format('svg');
font-weight: normal;
font-style: normal;}
As can be seen in the example, the .svg file comes last in the list of called URLs. If we amend the code to target webkit browsers, then tell them to solely utilize the .svg file.
@font-face {font-family: 'chunk-webfont';
src: url('../../includes/fonts/chunk-webfont.eot');
src: url('../../includes/fonts/chunk-webfont.eot?#iefix') format('eot'),
url('../../includes/fonts/chunk-webfont.woff') format('woff'),
url('../../includes/fonts/chunk-webfont.ttf') format('truetype'),
url('../../includes/fonts/chunk-webfont.svg') format('svg');
font-weight: normal;
font-style: normal;}
@media screen and (-webkit-min-device-pixel-ratio:0) {@font-face {font-family: ‘chunk-webfont’;
src: url(‘../../includes/fonts/chunk-webfont.svg’) format(‘svg’);
}}
If you want to try this out, set up two identical websites, and change the .svg to come first in one, and last in another, then flick between the two – you will be able to see the huge difference this makes to the render quality of the font. Your graphic designer will love you for it. For an example of this, check out the demo below:
Posted 04/09/2012
157 Comments
Previous Article
Want to work with us?
Contact Us