All Hallows’ Eve seems the perfect time for something a little spooky. Getting @font-face
working in IE may just be spooky enough. As you probably know @font-face
already works in Safari 3 via WebKit and is supported in the latest Firefox 3.1 beta. With IE, that means around 75% of the world audience could see custom typefaces today if their EULAs allowed it. Fortunately, there are good free faces available to us already, as well as some commercial faces that permit embedding. Fontin is one of them and I’ve built it into this example page:
@font-face test with Fontin by Jos Buivenga
See the full size Safari 3 screenshot, IE7 with ClearType, and IE6 without ClearType screenshot on Flickr.
Before we get into the nitty-gritty of making this work, which you can skip to if you wish, I thought a little history and a brief summary of the current status of the web fonts debate might be useful.
Web Fonts: Then & Now
Web fonts have been with us for a decade. They were an original part of the CSS2 recommendation in 1998. Recently, the godfather of CSS, Håkon Wium Lie, brought them sharply into focus with articles in CNet and A List Apart. The ironic thing is, IE has supported web fonts using the Embedded Open Type (EOT) format since 1997. The problem was that EOT was a proprietary format, belonging to Microsoft. Not for much longer: it’s been submitted to the W3C and is going through the process towards becoming a web standard.
Since the debate opened up, the web and type communities have both been busy discussing how the future will unfold. More collaboration between the disciplines would be beneficial to both, and I’d encourage any interested designers or developers to get involved with organisations like the Association Typographique International (ATypI).
Recently, Bert Bos of the W3C paid a visit to the ATypI Conference in St Petersburg to meet with type designers face to face. His summary of the current situation is essential reading. The debate has continued apace on the ATypI mailing list, which unfortunately has no public archives. However, if you are member of the ATypI, you can see this summary about the conference panel on web fonts by Nadine Chahine that started the debate in earnest. Simply put, type designers seem anxious about @font-face
linking making it too easy to steal a font. Both Microsoft’s EOT format and direct font linking are under consideration with EOT a favourite with many. However, rather than paraphrase a wide-ranging set of opinions, I’d encourage you to join the ATypI yourselves as designers and developers to participate or observe.
If you have other favourite comments or posts about the future of web fonts, please add them to the comments.
As a designer, I want a straightforward way of licensing and including fonts for my work. I will pay, respect the rights of type designers as I expect mine to be respected, then get on with the glorious business of merging content with type. It’s not as simple as it sounds, though. The licensing of fonts, and the protection of the rights of smaller designers in particular, is a sticky issue. DRM does not work, so what then? Richard Rutter has shared thoughtful insights which are very much worth a read. My view is that I would be perfectly prepared to pay a separate or extra licence fee to use quality fonts on the Web. I would have no problem selling this to my clients. Embedding or linking to fonts has to be straightforward though. I get paid to think about, plan and implement design, not grapple with obstructive software (more on that later). If fonts were delivered through a third-party web service as Richard suggests, the one proviso must be that it would have to be done by someone who knows exactly what it means to scale a service for millions of users. Like most designers though, I have very little knowledge of the real security and scalability issues, but hope to see a comment from a real security expert, shortly.
User agents are currently taking divergent routes. Bert Bos’ summary reports:
Mozilla has stated that they don’t want EOT. But they are not opposed to letting the browser check the license, as evidenced by the proposal to let HTTP headers carry license data.
Microsoft has said that it is impossible for them to support linking to native OpenType as long as font vendors oppose it.
Apple’s Safari has implemented font download with no checking of licenses. They said they are against EOT, but would not be against browsers checking licenses, e.g., using Mozilla’s proposal.
Opera remarked that there are more existing and announced implementations for downloading native OpenType than for EOT. They conclude that the market apparently doesn’t need EOT and thus they see no need to support it themselves either. W3C’s limited resources should be spend on more important standards.
That means that designers and developers have the same perennial problem: Two different implementations to achieve the same result. Safari 3 and Firefox 3.1 beta both support direct linking to OpenType (.otf
) font files. Presumably Opera will soon. Only IE 4 to IE 7 support Embedded Open Type (.eot
) files. IE8 does not, but will at some point. So, to see Fontin display in standards complaint browsers like Safari 3 and IE, we need to provide two separate fonts.
@font-face Example
The @font-face
example uses Fontin Regular by Jos Buivenga — a free face kindly provided by Jos with a licensing permitting embedding with attribution. Jos also has many other fine faces available via his foundry site, Exljbris. The example is a quick one using a traditional scale, with all of the CSS available in the <head>
of the file.
-
Set the basic
font-family
:h1, h2, h3, p, td{ font-family:'Fontin-Regular', georgia, serif; }
Notice the
'Fontin-Regular'
name — this is an arbitrary name that can be whatever you like. All it does is tell the browser when to apply the font file referenced in the@font-face
rule. -
@font-face
and.otf
for standards compliant browsers:Ed: White space inserted for clarity.
@font-face{ font-family:'Fontin-Regular'; src: url('Fontin-Regular.otf') format('opentype'); }
Note the
'Fontin-Regular'
name, again. This rules basically tells the browser, when the@font-face
is set to'Fontin-Regular'
, use the font found at this URL.Screen sample of Fontin Regular in Safari 3 set at 16px with 24px line height from the example:
When Safari renders the page, it will look for the font file, then render the text accordingly. There’s a slight delay as WebKit works. In the example you might notice that the text not requiring the loading of a font file renders quickly, but the rest is blank until the browser catches up. For reference, the Fontin-Regular.otf file is 32KB in size. Some font files can be much larger.
-
Create the
.eot
file with WEFT:To do this you will need to download and install WEFT3, a Microsoft application for creating EOT files from TT fonts. WEFT is not able to create EOT files from an OTF. It must be converted to a TrueType file, first. WEFT is the only tool for this as far as I’m aware, although I believe there is an open source one in development. If it wasn’t for WEFT, embedding EOT files would be easy. What I want WEFT to do is convert the font to EOT, and allow me to create a subset if required. It does that, but in a nightmarish, frighteningly over-complicated way. Perfect for an All Hallows’ Eve entry. Here are a few tips I learnt the hard way:
- WEFT requires the URL of the page or site where the EOT font will be used. It will then ‘scan’ the pages by crawling the site to see what glyphs are used and try and create a subset of the EOT file accordingly. If it refuses to analyse a valid URL as it did for me, get granular and specify pages or sub-directories in your information architecture.
- If you’re using WEFT via Parallels and XP Pro, it may refuse to add some fonts in your windows/fonts directory to its database of available fonts. Try using a standalone PC if you can. I haven’t tested in any other virtual machine.
- Use the wizard to set up your project, but after that try it manually using the View menu item to see what fonts are available to convert, and the Tools menu item to convert them.
- WEFT will try to save the EOT file to a remote location. You can over-ride this manually to save the file wherever you please for you to upload yourself.
- Disable your original OTF fonts on your system before testing (obvious but worth a prompt).
Be warned, WEFT is awful to use, in every way.
It did not work for me running Parallels with XP Pro on a Mac.7th Nov: After more experiments, Weft will accept TrueType (.ttf
) files in Parallels. It also worked with the gracious help of Jon Gibbins and his standalone PC running XP Pro. Because it is so painful, I cannot give support for WEFT. You can try the Microsoft WEFT user community, but I can’t comment as to its usefulness, and I could not find any other support avenues.Hopefully, you now have an
.eot
file to use. -
@font-face
and.eot
for IE using conditional comments:Ed: White space inserted for clarity.
<!--[if IE]> <style type="text/css” media="screen"> @font-face{ font-family:'Fontin-Regular'; src: url('Fontin-Regular.eot'); } </style> <![endif]-->
These are screen samples from IE:
Screen sample of Fontin Regular in IE6 set at 16px with 24px line height from the example:
Notice the bar missing from the capital ‘A’ towards the end of the second line. The tyepface designer, Jos Buivenga is currently looking into the font hinting, with input from John Boardley.
IE7 sample:
See a full size Safari 3 screenshot, and IE6 screenshot on Flickr.
That’s all! Try the example in different browsers to see how it works for yourself (but please don’t blame me for ClearType’s poor anti-alias at larger font sizes).
Summary
We have only a few web fonts with a EULA that permits embedding right now, unless they are free. Please respect the EULAs of any typefaces you try out until the type community resolves the issue for all commercial fonts.
My feeling after doing this is that EOT has potential advantages in file size over OTF, but OTF files could always be edited (as far as I’m aware) to create subsets just like EOT. Although EOT is not a DRM solution per se, it feels like one. If it achieves widespread acceptance, no doubt some clever soul will be reverse-engineering an OTF file from EOT before too long.
What we need to encourage designers and developers to use EOT today is a good tool to create EOT files in the first place. Perhaps even one hosted remotely, where we can buy a licence, convert the font to EOT, grab the same OTF subset for complaint browsers, and get the work using the typefaces we’ve always dreamed of. WEFT is not the tool right now to enable EOT usage. In fact it discourages it.
Regardless of what security is implemented, the font file will have to be on the audience’s machine somewhere, even temporarily. ‘Defense in depth’ is a term used by web app security experts. It would seem that the question is how much depth will satisfy foundries and type designers, and what form that depth will take.
As a designer, I can only speak for myself to say that if OTF and TTF were supported, regardless of how easy it was to steal the file, I would still pay as required by the EULA. I have a strong feeling the vast majority of my colleagues feel exactly the same.
64 Comments
1. By johno on 31st Oct ’08 at 10:58am
2. By Peter Gasston on 31st Oct ’08 at 10:58am
3. By Leon Paternoster on 1st Nov ’08 at 01:32am
4. By Ray on 1st Nov ’08 at 02:29am
5. By Jon B on 1st Nov ’08 at 04:16am
7. By westworld on 3rd Nov ’08 at 05:02am
8. By Jens Meiert on 4th Nov ’08 at 03:43am
9. By ST on 4th Nov ’08 at 10:10am
11. By ST on 4th Nov ’08 at 17:55pm
12. By Robbie on 9th Nov ’08 at 21:06pm
14. By Jon Gibbins on 10th Nov ’08 at 02:36am
15. By Robbie on 10th Nov ’08 at 10:38am
16. By Ralf Herrmann on 11th Nov ’08 at 13:51pm
17. By Charles Cooper on 13th Nov ’08 at 07:17am
19. By Ralf Herrmann on 14th Nov ’08 at 03:26am
20. By John on 14th Nov ’08 at 11:56am
21. By Charles Cooper on 14th Nov ’08 at 12:53pm
22. By Ralf Herrmann on 15th Nov ’08 at 00:08am
23. By Charles Cooper on 15th Nov ’08 at 19:12pm
24. By Patrick Algrim on 18th Nov ’08 at 12:44pm
25. By Ben Clarke on 27th Nov ’08 at 08:11am
26. By Jon Gibbins on 4th Dec ’08 at 05:52am
27. By Alex on 21st Dec ’08 at 21:34pm
29. By Christopher Olberding` on 22nd Dec ’08 at 14:22pm
30. By Alex on 23rd Dec ’08 at 14:42pm
31. By justpassingby on 9th Jan ’09 at 23:57pm
32. By sbs on 3rd Feb ’09 at 13:22pm
33. By Joe Pea on 7th Feb ’09 at 22:53pm
34. By josh on 24th Feb ’09 at 07:29am
35. By Alex on 25th Feb ’09 at 18:57pm
36. By Joe Pea on 26th Feb ’09 at 09:57am
37. By Webtiful on 1st Mar ’09 at 17:53pm
38. By sivas on 9th Mar ’09 at 13:41pm
39. By killsifr on 19th Apr ’09 at 04:58am
40. By yucc on 20th Apr ’09 at 00:05am
41. By paul on 23rd Apr ’09 at 12:54pm
42. By paul on 23rd Apr ’09 at 12:55pm
43. By Ralf Herrmann on 23rd Apr ’09 at 13:11pm
44. By Florent V. on 26th Apr ’09 at 17:39pm
45. By John Durdin on 30th Apr ’09 at 15:21pm
46. By Oli on 1st May ’09 at 00:22am
47. By yann on 9th May ’09 at 09:30am
48. By Florent V. on 9th May ’09 at 10:43am
49. By Yann on 9th May ’09 at 10:55am
50. By burs on 10th May ’09 at 14:10pm
51. By meenah on 16th May ’09 at 06:28am
52. By meenah on 16th May ’09 at 06:55am
53. By Ralf Herrmann on 16th May ’09 at 07:41am
54. By Ben on 7th Jul ’09 at 00:54am
55. By karel zeman on 28th Aug ’09 at 22:01pm
56. By randsco on 31st Aug ’09 at 09:19am
57. By Paul Irish on 3rd Sep ’09 at 23:19pm
58. By stk on 4th Sep ’09 at 19:49pm
59. By Lys Konuları on 5th Sep ’09 at 16:24pm
60. By Radyo on 13th Sep ’09 at 08:52am
61. By DR on 16th Sep ’09 at 10:51am
62. By GZ on 17th Sep ’09 at 08:46am
63. By Sebastian Green on 12th Oct ’09 at 13:54pm