Kimler Sidebar Menu

Kimler Adventure Pages: Journal Entries

random top 40

Weather Forecast for Yellow Point, B.C.

Today

Showers

Showers

7° C

POP - 60%

Tonight

Rain / Snow Showers

Rain / Snow Showers

0° C

POP - 40%

Sat 21-Nov

Showers

Showers

3° C 1° C

POP - 70%

Sun 22-Nov

Rain

Rain

5° C 1° C

POP - 70%

Mon 23-Nov

Showers

Showers

5° C 2° C

POP - 60%

Tue 24-Nov

Rain / Snow Showers

Rain / Snow Showers

6° C 4° C

POP - 40%

Weather data provided by weather.com®

xBrowser Fonts

xBrowser Fonts

July 4th, 2009  · stk

For years, web designers and bloggers have been limited to a select number of "web-safe" fonts. With the Jun 30th release of FireFox 3.5, it's now possible for cross-browser font embedding using the CSS3 @font-face selector. Here's a tutorial to show you how

Expand Your Font Palette Using CSS3

In a tale involving proprietary font formats and a week-old release of FireFox, I'm here to say that using the CSS @font-face selector to spice up your website typography is an easy, light-weight, valid and cross-browser solution. Finally, fancy fonts for the masses!

Can this be true? You bet your sweet bippy! Read on.

 

History: The Web as a Typographic Wasteland

from da'Hood?

Skip all da teknical shite dawg, an' head heer to pimp dem fonts - fas-like!

For the past decade, web designers have been limited to a selection of about 13 or so "web-safe" fonts. Out of hundreds of thousands of available fonts, this is a tad limiting.

While it's theoretically possible to utilize any font you want for a web site, in order for it to display properly, each visitor must have that particular font loaded on their computer. Because of this requirement, web typography has been a wasteland, limited to only a short list of commonly available (web-safe) fonts.

There have been several attempts to circumvent this problem and below, is a list of some of the most common. All have their short-comings and for me - no disrespect to very creative, determined and knowledgeable people - they all fall into the category: "life shouldn't be so hard"!

  • Image Replacement (typography as a graphic is seen by everyone - except search engines - and one has to play CSS games, to attempt to achieve both objectives).
  • sIFR (sIFR means "Scalable Inman Flash Replacement", based on work done by Shaun Inman, et. al. A convoluted solution that relies on JavaScript and Flash technologies to replace web-safe text with a Flash image of the text, in your chosen typeface.)
  • Cufón - a JavaScript image replacement technique that's a worthy alternative to sIFR. The name is derived from "CUstom FONts".
  • FLIR - A server-side PHP script that dynamically generates images of text in the font-face of your choosing. PHP5 is recommended and requires GD library (with FreeType and PNG support enabled).

 

CSS3 @Font-Face Embedding to the Rescue

Even though the ink is still drying on the official June 30th release of FireFox 3.5, which supports the @font-face CSS3 selector, there has been much buzz about how this will herald a new, creative web-font landscape. Truth is that Safari has supported @font-face for a while now and Opera 10+ is reportedly going to be supporting supports it as well.

In the Inspect Element Web Design & Development Blog, Tom Kenny writes, "Currently only Firefox 3.5 and Webkit browsers such as Safari and Google Chrome will render [the @font-face selector]. Of course, older browsers such as IE6 and IE7 will not support it and with IE8's distinct lack of CSS3 feature [sic], that doesn't support it either." (Source: "Go Beyond Web Safe Fonts with CSS3")

I know it's popular to bash Internet Explorer, but Tom (and others) need to check their facts before they publish false information!

Firstly, Microsoft has been supporting font-embedding for over a decade (since IE4 in 1997) and also the font-face tag and @font-face CSS selector. Secondly, the @font-face selector was a 1998 CSS2 recommendation (dropped in CSS2.1). It's made a comeback in CSS3 and hopefully will become a web standard.

Secondly, Chrome doesn't support @font-face by default. (Apparently, Google supported it in an early beta release and then disabled it for subsequent releases, for "security reasons". To activate it, users must add a command-line switch --enable-remote-fonts .) (source)

The beauty, of course, is that it's now possible to embed fonts for IE6, IE7, IE8, FireFox 3.5+ (PC & Mac), Safari (PC & Mac) and (soon) Opera 10. According to our June 2009 web stats, that's over 97.5 percent of our visitors - about as "cross-browser" as you're going to get in today's online world! (Dunno about macIE or other browsers ... I'll have to rely on reader feedback.)

 

How @font-face Works: Easy Peasy

The great news about CSS3 support of the @font-face selector, is that - unlike work-a-round techniques - it's easy to use. Yay! Fonts without hoops!

Just upload the font file you want to use to your server - making sure that you're not violating any copyright rules - then embed it, using the following CSS:

Code:

 
@font-face {  
  font-family: yourFontName ;  
  src: url( /location/of/font/FontFileName.ttf ) format("truetype");  
}  
 
/* Then use it like you would any other font */  
.yourFontName { font-family: yourFontName , verdana, helvetica, sans-serif;  
}  
 
 

 

The CSS code above defines a font called "yourFontName". You may use the actual font name - or - for testing purposes a unique, made-up name. Whichever you use, all you need to do is reference it again in the CSS, wherever you want to use it.

That's it! Note: the CSS3 specification provides for several font formats: "truetype" (ttf), "opentype" (ttf,otf), "truetype-aat (ttf), "embedded-opentype" (eot) and "scalable-vector-graphic" (svg,svgz).

 

C'mon, is it Really that Simple?

LOL ... of course not!

If there's one thing we've all learned about the Internet, nothing is really that simple and embedding fonts using the "new" CSS3 @font-face selector isn't any different.

"So, what's the issue?" you might ask.

Though Microsoft has been supporting font embedding since IE4 (1997), it's current support for @font-face is done a tad differently. Different enough, that it'll ignore a pure, valid CSS3 version. Internet Explorer supports only their proprietary "Embedded OpenType" font (eot) file format and it will incorrectly parses CSS that includes "format" values.

To achieve cross-browser compatibility, one must create some redundant CSS. The overhead isn't much and the gains, of course, are great. Using Microsoft's free WEFT tool (or this easy Online TTF->EOT Converter), one can create a Microsoft proprietary OpenType font file (having an EOT extension). Upload both the EOT and TTF files to your server. Using a single @font-face selector, load the Embedded OpenType font (EOT) for IE6, IE7 and IE8 first then the TrueType Font (TTF) for FireFox 3.5+, Safari (Win & Mac versions) & Opera v10+. BOOM ... you've just served the vast majority of your website visitors. In addition, the process degrades nicely. Browsers that can't load your special fonts won't miss a thing, as they'll be using the secondary, tertiary or generic fonts you specify. Additionally, the process is relatively future-proof. If Internet Explorer ever does support the CSS3 @font-face rules, then it'll simply utilize that bit of code already there. If not, you're covered there too.

An example of some final, CSS3-valid code might look like this, for a cross-browser compliant embedded font:

Code:

 
@font-face {  
  font-family: " your FontName ";  
  src: url( /location/of/font/FontFileName.eot ); /* IE */  
  src: local(" real FontName "), url( /location/of/font/FontFileName.ttf ) format("truetype"); /* non-IE */  
}  
 
/* THEN use like you would any other font */  
.yourFontName { font-family:" your FontName ", verdana, helvetica, sans-serif;  
}  
 

 

Though you can name use any font name, use the real one (capitalization matters) for the "local" declaration. This will give non-IE browsers an opportunity to look for the font on your visitor's computer. If it's loaded, it'll saves a TTF download. (Note: The local declaration is required, because it confuses Internet Explorer, which will fall back to the EOT file without trying to download the TTF).

Hints, Tips & Observations

I'm no font expert, just a web developer that's eager to utilize more than a limited number of fonts. When I realized that it would be possible to utilize embedded fonts for over 95% of our visitors, I spent a fair bit of time, playing around. Some of what I discovered along the way, contradicted what I've read elsewhere. Below is a brief list of this empirical knowledge, which I hope will help more people to use and understand this technique of font embedding.

  1. Use TrueType Fonts - Even though the CSS3 @font-face selector provides for several font formats, WEFT will only convert TrueType fonts (Supposedly, WEFT will convert OpenType fonts as well, but the few that I tried didn't work, as they didn't show up in the selection list of "embeddable fonts").
  2. Some TrueType fonts won't convert - Some fonts are designated as "non-convertible" by the designer, or there are other problems. WEFT shows a list of available fonts.
  3. Converting OTF to EOT is More Work - Presently, it's a two-bank shot. First, convert the OTF file to TTF using FontForge or this free online font converter . Then you can use WEFT, FontForge, ttf2eot or TTF->EOT to convert the resulting TTF to an EOT.
  4. Put IE First - In the CSS, it's important to put the IE EOT "src" first. It's also important that "src" is the only declaration. If you add "local" or "format", IE won't understand it and it will fail.
  5. CSS3 doesn't do EOT - Despite reading that the "embedded-opentype" (EOT) is one of the formats allowed in the CSS3 @font-face selector, it either doesn't work, won't read the MicroSoft proprietary EOT flavor, or something else as I couldn't get FireFox to utilize the same EOT font file as Internet Explorer. (Pity, as it means loading the TrueType version, as well as the proprietary EOT version).
  6. Understanding "Allowed Roots" - There are a few tricks to understanding WEFT. A big one: the EOT font file you create will only work for URL's you designate (i.e., "allowed roots"). If you own your own domain and want to be able to use the font file on any page, you'll need to specify both the "www" and "non-www" roots. (e.g., http://www.randsco.com and http://randsco.com).
  7. Using WEFT Dont' use the WEFT wizard. WEFT wants to create a "font object" and subset it for any and all fonts it finds in webpages you specify. All you really need is the conversion part of WEFT. Here's an easy WEFT workflow:
    1. Load your TrueType font (i.e., drag it into the Windows font folder);
    2. Start WEFT (it'll create a database of "loaded fonts" on opening, so you'll need to rebuild the database if you load your font while WEFT is running);
    3. Pick the font(s) you want to convert (Tools > Fonts to Embed > Add... > Select a font on the list > repeat if you want to convert more);
    4. Close the window and then do the conversion (Tools > Create Font Objects > Set location of the font object and "allowed roots" > Finish);
    5. Upload your newly-created EOT font file to your server (I generally rename mine and make all the characters lowercase).
  8. Testing can be tricky - In the @font-face CSS, if you use the actual font name for either the "font-family" declaration or the "local" declaration and that font is loaded on your computer, non-IE browsers IE Browsers IE browsers will never grab a local font. Once a "src" is specified, it'll download the EOT, every time. It doesn't matter if you specify the real name in the @font-face selector, or any other selector, for that matter. Click for the source of this information (based on IE4 behavior). It's the last question on the MSDN Frequently Asked Questions (at the bottom of the page).  will grab your locally-loaded font (i.e., doesn't test the font download). To make sure that the browser is downloading the font from your server correctly, you'll need to either (a) unload the font from your local computer or (b) rename the font in the CSS to something you know doesn't match any of your loaded fonts.
  9.  src: local("font name"),
          local('fontName'),
          local("otherFontName"),
          local('some other font name'),
          url(../font/font.ttf) format('truetype');
    Load Local - Once you determine your font download is working, rename the font in your CSS to its true name. Your visitor might have that font installed. You can use multiple local() declarations. If you know the font might have several names, use this to your advantage, like the example here (note syntax options). Non-IE browsers will look for the font in each location, stopping when it finds one or at the TTF download. (IE doesn't look locally in @font-face, so don't even try adding local() for the EOT line).

 

Conclusions

Because FireFox 3.5+ supports the CSS3 @font-face selector, cross-browser font embedding is now both possible and practical. The effect this will have on the web should be dramatic, replacing a decade-old typographic wasteland with a tastier and richer diversity of fonts.

While cross-browser deployment isn't ideal, the benefits of utilizing CSS to embed fonts is obvious: It's lightweight; it's valid CSS (CSS3); it's easy to do; it's search engine friendly; it's cross-browser compatible; and (yay) it relies neither on either JavaScript or Flash. The only downside is the slight overhead in downloading font file(s) and - depending on browser settings Defeating Font Embedding Internet Explorer In Internet Explorer 8, users may elect to disable font downloading or they may ask to be prompted, resulting in a message similar to the one below. (I believe, by default, this is set to "enable", so visitors would have to explicitly re-set the value and the majority won't). ie font embedding message To reset in IE8: Tools > Internet Options > Security Tab > Custom Level > Downloads Section > Font Download (last one in the section). FireFox In FireFox, users can elect to replace all web fonts with fonts of their choosing. (This is defeated, by default and again, it would be up to users to explicitly re-set this value and the majority won't). To reset in FFx: Tools > Options > Content Tab > Fonts & Colors (Advanced Tab) > un-tick "Allow pages to choose their own fonts, instead of my selections above").   - may not render even for those browsers that support it. No worries! The technique degrades nicely to the normal "web-safe" or generic fonts you specify.

Now Go have some fun!

UPDATE 25-Aug-2009: I've recently found two online TTF->EOT converters:

Hint: Both conversion tools are based on an Open-Source utility called "ttf2eot". The utility is written for a UNIX O/S, but the download ships with a windows-based, command-line binary. (See the ttf2eot demo page for more information).

UPDATE 30-Aug-2009: Found an easy online converter that converts OTF to TTF (it also converts .dfont files to .ttf). Works a treat!

UPDATE 1-Sep-2009 Opera 10 released It supports @font-face, but is picky about the syntax in the "local" declaration. Needs local('font') or local("font"), but won't interpret local(font).

UPDATE 4-Sep-2009: Based on work by Paul Irish and Andrea Giammarchi, the cross-browser @font-face CSS has been improved. (Learn How)

UPDATE 8-Sep-2009: Had a devil of a time getting the Chrome command-line switch to work, until I discovered that it's --enable-remote-font (not --enable-remote-fonts - plural). (EDIT: The problem was likely some internal developer confusion over the spelling, but issue appears to be limited to version 2.0.172.43 (and earlier?). I'm now on v3.0.195.21 (winXP sp3) and it's definitely plural.)

UPDATE 19-Oct-2009: Looks like the next release of Chrome will have font-embedding turned "on", by default.

 

(Permalink)
Views: 23019 views
66 Comments · EmailThis · GuestBook
Updated: 26-Oct-2009
Web View Count: 23019 viewsLast Web Update: 26-Oct-2009

Your Two Sense:

XHTML tags allowed. URLs & such will be converted to links.


Subscribe to Comments

Auto convert line breaks to <br />

1.flag John Comment
07/13/09
Good write up Scott. Thanks for getting all the detail into one post :)
There is still a slight "flash of unstyled fonts" on first visit however it's minor.
2.flag stk Comment
07/13/09
John - Yes, I noticed that. It's also visible on "The Potential of Web Typography" page, which was put together to demonstrate the CSS font-embedding capabilities of FireFox 3.5

The problem seems to be limited to FireFox, as all the IE's and Safari render fancy fonts without that "flash".
07/25/09
I can confirm that @font-face works on a Mac in FF 3.5, but not in 3.0 (But that's expected).
4.flag stk Comment
07/25/09
Michael - Thanks for the confirmation, I've ammended the copy to reflect your information. ;)
5.flag Damian Comment
07/29/09
Very nice. works on IE 7, FF 3.5 but not Google chrome.
6.flag Hummer Comment
08/11/09
Thanks dude. This helps me to solve problem.
7.flag stk Comment
08/13/09
Hummer dude - So glad. :D
8.flag Shaunak De Comment
08/18/09
Great write up. Too bad neither this nor the shadow property work on Chrome.

A good font really makes a page. Doesn't it?
9.flag stk Comment
08/22/09
Shaunak - Thanks! :D Yeah, not sure what's up with Chrome (especially since web-kit based browsers are supposed to "see" this selector).

Fonts can enhance a page, but - like any design element - they can be abused, make a page look horrid, as well. ;)
10.flag Peter Comment
09/03/09
I'm having trouble with embedding in firefox. Should this work?

@font-face {
  font-family: Kunstler Script;
  font-style: normal;
  font-weight: normal;
  src: url(styleKUNSTLE0.eot);
  src: url(stylekunstler.ttf) format("truetype");
}

Its fine in IE, but just can't get it to display in FF 3.5.2.
11.flag stk Comment
09/03/09
Peter - In a word, no.

First, I see no benefit in setting font-style and font-weight to "normal", as both are defaulted to "normal" anyway. For the sake of brevity, omit them.

Second, your results are odd, because testing shows that FFx would be the browser that understands this code, not IE. (IE doesn't understand "format()" and skips over tries to download a very strange font file, which results in a 404 "File Not Found" from the CSS contained in this @font-face selector).

Bottom Line: You'll need to use two @font-face selectors Use one @font-face selector, as described in the examples above.

Hope this helps.

12.flag Paul Irish Comment
09/04/09
Scott-- This summary is totally kickass. You've given it a lot of thought and attention and it's a great resource.

I've actually just written up a summary of all the @font-face implementation syntax techniques, along with the best one I think there is... which hasn't been covered yet!

Bulletproof @Font-Face implementation syntax

I'd invite you and everyone to give it a peek.
13.flag stk Comment
09/04/09
Paul - You've sparked my interest! Thanks for the comment. (Oh sure, yeah thanks, now my morning will be totally shot, whilst I run some tests!) Fun!

*runs off to look at server logs*
14.flag Foppe Hemminga Comment
09/04/09
In the past I've used the Font Replacement from the article in A List Apart http://www.alistapart.com/articles/dynatext/
This technique replaces text by cached images that are created server side. One of the advantages is that the XHTML source contains the 'normal' text so it's read by bots.

However the latest HTML5 techniques (not only the fonts) are awesome. It won't be long before I completely ignore backward compatibility. I've waited too long for this.
Maybe degrade gracefully like we did with jS: "You have a shitty browser, contact the vendor." ;)
15.flag stk Comment
09/04/09
@Paul - I've run some tests and have modified the text in this article to reflect the superior CSS code. Thanks ... you're an ace!

@Foppe - In the past, I've done zero font replacement because all the techniques were just too much work. I'm thrilled that now over 97% of our visitors get fancy fonts with @font-face!
16.flag Peter Comment
09/05/09
Hi STK. I'm only an amateur geek (one day i hope to upgrade!) so could you have a look at the website link attached and see if you can tell me whats wrong? It's still not working in my firefox.

Thanks.
17.flag Richard Fink Comment
09/06/09
Chrome (2.0.172.43+) supports @font-face (just noticed today).

This is incorrect. There was one version of Chrome - which is the one you might have tested on - that has @font-face linking enabled. In the very next release they turned it off.

My understanding from Ralph Herrmann's webfonts blog is that it can be enabled by launching Chrome with a particular command-line switch.
Nice write up.

Cheers,
Richard Fink
18.flag stk Comment
09/06/09
Richard - LOL ... no-one likes to be told they're wrong, me included! :p Did I jumped to conclusions?

LOL ... turns out - I did. I spent so much time the other day, testing and retesting Paul's "bulletproof" CSS, that I left that fancy font loaded on my computer. (Bit by #8 in my own "hints" section!!). Oops. My bad! :oops:

Hopefully, Chrome will support @font-face 'out of the box' at some point in the future. *goes to fix the text copy* (In addition to embarrassing myself of Ralf's blog, I've included his information on Chrome support).

Thanks, Richard, for pointing this out, making me look twice and for the informational link!
19.flag Richard Fink Comment
09/07/09
@stk - Writing as somebody who's played around with font-linking a lot, the same thing has happened to me many times.

Once font-linking really gets rolling - and if FF supports the new iteration of EOT it will happen really fast - investing in a font-management program that can dynamically load/unload or install/uninstall fonts quickly and easily becomes a must-have in any web designers toolkit.
Don't feel bad. I reported that Chrome had font-linking, too.

I wasn't wrong, and neither were you, technically.

It did support it, but then, in the next upgrade, they turned it off!

Cheers, rich
20.flag Leon Comment
09/07/09
Great work. however i just cant get it to work.
My code looks like this

<style type="text/css">
@font-face {
  font-family: kingthings;
  src: url(/kingthings.eot);
  src: local(kingthings), url(/kingthings.ttf) format("truetype");
}
.kingthings {
  font:kingthings;
}
</style>
<p class="kingthings">test123</p>



The ttf and eot files are placed in the root. I've tested on IE8
st here

To be able to post the code here, I have replaced the < and > than sign with &lt; and &gt;
21.flag stk Comment
09/07/09
Leon - No worries. I've formatted your code so it looks better. ;)

Two quick comments:

1) I hit the www.gaz.gk link and didn't see a test page. I also tried hitting www.gaz.dk/kingthings.ttf and got a 404. (i.e., a link to your test page would help and are you sure the font is where you think it is?)

2) AFAIK, the font directive in the "kingthings" class won't work. If you use "font" shorthand, you need to include (at least) the font size and family, in that order. Try:

 a) {font: 100% kingthings,sans-serif; }

or (non-shorthand)

 b) { font-family:kingthings, sans-serif; }
22.flag stk Comment
09/08/09
FYI

Discovered that the Chrome command-line switch to enable @font-face is --enable-remote-font (singular) ... as opposed to --enable-remote-fonts (plural).

It's being reported around the web incorrectly, no doubt because developers are mixing it up.

Tested. Article updated.
23.flag stk Comment
09/09/09
@Peter - Sorry, your 2nd comment fell thru the cracks (it came in Friday night & Saturday was when our host server failed for 5 hours ... first time we've had down-time in over 2 years).

The fancy fonts in your "Empress Design & Print" site looks fine in my FireFox3.5 (and IE8)?

(Assume you got it sorted & sorry for the response delay)
24.flag peter Comment
09/09/09
stk - Thats ok, everyone needs downtime! The font still doesn't come out right in my firefox 3.5.2 on two different pc's. I downloaded specially for this site and haven't changed any settings.....not sure how to get it working, especially now you say it works fine for you!!

But I guess the code is ok then so I'm just doing something else wrong! :(
26.flag Lariza Comment
09/12/09
Thanks for great article! Though I'm pulling my hair out because I have spent hours with this and I can't get the eot versions of my fonts to work. I have tried both Quicksand (which is said to be "@font-face compatible" at fontsquirrel.com) and Little Days. I followed your instructions "Using WEFT" and it actually said that there was something wrong with Quicksand so I wasn't that surprised - I guess it's not that compatible after all? :/ Little Days on the other hand seemed to be ok, but I cannot see it in Explorer. My code is as follows:

@font-face {
font-family: "Little Days";
src: url(../fonts/Little-days.eot ); /* IE */
src: url(../fonts/Little-days.ttf) format('truetype');
}

h1 {
font-size: 40px;
font-family: "Little Days","Trebuchet MS", Arial, Helvetica, sans-serif;
font-weight: normal;
line-height: 30px;
}

Is there something wrong with the code? Any suggestions?
27.flag Richard Fink Comment
09/12/09
@stk

>Discovered that the Chrome command-line switch to enable @font-face is --enable-remote-font (singular) ... as opposed to --enable-remote-fonts (plural).

--enable-remote-fonts is working for me. ??

Also, with regards to using local('fontname') as a way of preventing IE from attempting to download the TTF font file, Opera does not seem to support local() in my testing.
Can anyone confirm?
28.flag stk Comment
09/12/09
@Everyone -

1) Keep in mind that testing your @font-face cross-browser can be difficult (see #8 in Hints above). Browser version, cleared cache, code syntax, locally loaded fonts, file type, conversion success and file location all affect results.

2) I don't mind helping you sort your @font-face issues, but posting a link to your test page helps me far more than pasting code (saves you work too!)

29.flag stk Comment
09/12/09
@Lariza -

What you say about "Quicksand" confirms my findings that not all TTF fonts can be successfully converted to EOT using WEFT. Did you try one of the online converters? (This one or This one)

RE: Your code is missing the necessary local() bit, which is what makes IE lose it's head and focus on the EOT line, instead of the TTF line.

[i.e., src: local("Little Days"), url(../fonts/Little-days.ttf) format("truetype");]
30.flag Lariza Comment
09/12/09
Hi stk,
and thanks a lot for your help! :) local() did the trick, of course. I had it there originally but I took it off at some phase when I was trying practically everything with Quicksand. :roll: About Quicksand: I tried ttf2eot but it didn't work for me. And Quicksand is OpenType font so I had to convert it to ttf first.

So, Little Days works now - almost! My next "challenge" concerns scandinavian characters (ä, ö) which eot didn't preserve for some reason. :(
31.flag Satoshi Comment
09/13/09
Thanks ! I really love your method !! I will try it now.
32.flag stk Comment
09/13/09
@Richard - What version of Chrome are you using and on what platform? (I'm running the current production version on windows 2.0.172.43)

It's --enable-remote-font for me, as plural doesn't work (and why I was frustrated, when I first tried to use it).

I'm still digging into this. I've been rooting around in the Chromium/Webkit code and realize there's a way to enable remote fonts via the preferences file (just not sure the syntax). While I've seen the command-line switch as --enable-remote-fonts (plural) in the code, I can't explain why it doesn't work for me (it's singular in a couple of the bug / review responses).

What version of Opera are you using (and platform)? Do you have a link to the test page that's not working for you with local()? (I'll come round and have a peek with my version - 10.00/b1750/Win32/XP).
33.flag Richard Fink Comment
09/14/09
@stk

I was wrong about Opera and local(). That's not why Paul Irish's syntax isn't working.
Will explain, along with presenting an alternate syntax, shortly.
As far as Chrome - using ver 3.0.195.20 on win xp SP3.
It's definitely "fonts" plural, for this version but I admit, I haven't tried the singular. Maybe both work!
Regards, Rich
34.flag stk Comment
09/14/09
@richard - Hmmm. Are you running a beta version of Chrome? (2.0.172.43 -vs- 3.0.195.20) What *I think* happened is a typo. Most of the doc/discussion is plural, but the code (for this version, at least) is singular. They prolly fixed it, by your version.

Eager to see your Opera stuff + alt syntax.
35.flag Richard Fink Comment
09/15/09
@stk
Alternate CSS syntax with notes is now online.
Syntax that makes Opera happy, keeps the backward compatible @font-face declarations separate from the forward compatible ones without relying on IE Conditional Comments, avoids any additional HTTP request(s) by IE, and leaves local() as an option, not a requirement.
Mo' Bulletproofer @Font-Face CSS Syntax
36.flag Brian Jambor Comment
09/15/09
I've tried everything I can think of, but I still can't get it to render properly in Firefox 3.5. Any help would be appreciated: http://www.customagentwebsites.com/agentsuccess/

CSS: http://customagentwebsites.com/agentsuccess/wp-content/themes/FlexxCanvas-Arial/style.css

@font-face {
font-family: 'PortagoITC_TT';
src: url(http://www.customagentwebsites.com/agentsuccess/wp-content/themes/FlexxCanvas-Arial/images/PortagoITC_TT.eot);
src: local('PortagoITC_TT'), local('PortagoITC_TT'),
url(http://www.customagentwebsites.com/agentsuccess/wp-content/themes/FlexxCanvas-Arial/images/PortagoITC_TT.ttf) format('truetype');
}


[Ignore the lack of styling and margin issues as this is a work in progress]
37.flag Brian Jambor Comment
09/15/09
Figured it out. Have to use relative links in FF 3.5 - http://www.webfonts.info/wiki/index.php?title=%40font-face_support_in_Firefox
38.flag stk Comment
09/15/09
@Richard You've never answered my question: "Which version of Opera are you using?" (Mine - 10.00, b1750, Win32, XP sp3 - works fine.)

@Brian - LOL ... just replying with your solution, as you wrote. To avoid similar problems, I created a /fonts folder off of the webroot, which has the side benefit of shortening the CSS [i.e., src: url(/fonts/font.ttf);]

Glad you got it sorted.
39.flag George Comment
10/05/09
I am having a problem to display ML-TTKarthika font on my website. can anyone help me for this. even if user don't have the font on their machine, I don't want user to download fonts for reading the web site.

So please help me to fix this problem i am using ML-TTKarthika.ttf font (Indian language) is using this website
40.flag stk Comment
10/06/09
George - (1) There are 46 XHTML errors on this page. I'd suggest cleaning those up first, as they may (or may not) be the cause of your problem (W3C Validator Link) (2) I saw the embedded @font-face CSS, but couldn't find either the EOT or TTF files, at the URLs & filenames specified. (I would assume this is the main issue). See comments 36, 37 & 38 for more information.
41.flag George Comment
10/06/09
STK - I cleaned the XHTML errors. I also linked the font file [ src: url(fonts/MLTTKAR0.eot) ]. It's still not working.
42.flag stk Comment
10/06/09
George - (1) There remain 37 XHTML errors; (2) while I can now find the EOT file, the TTF file is still *missing*; (3) The @font-face CSS has has two problems that I see: (a) it's missing the local() designation, which keeps IE from working and (b) it's missing the TTF file extension & location, which keeps all the other browsers from working.

Current CSS
@font face{
font-family: ML-TTKarthika;
src: url(fonts/MLTTKAR0.eot);
src: url(../Fonts/ML-TTKarthika);
}


Recommended CSS
@font-face{
font-family: "ML-TTKarthika";
src: url(/fonts/MLTTKAR0.eot);
src: local("ML-TTKarthika"), url(/fonts/ML-TTKarthika.ttf) format("truetype");
}


1) It's a good habit to put quotes around your font-family & local() ... covers the case where a font name has a space in it and Opera requires it for local().
2) Putting a slash (/) in front of the fonts directory tells the server that fonts is off webroot and changes it from a relative to an absolute path (it's also domain-independent, so if you move to a different domain, your links won't break).
3) Local() is required for this syntax to work (it confuses IE, which will then fall back and pick up the EOT file, while other browsers will pick up the TTF. Besides ... some users might actually have the font loaded, which will save server load if they do.
4) You'll need to include the ttf file extension and I'd put the file in the same /fonts directory as the eot file (keeps things simple).
5) *EDIT* forgot to tell the browser to expect "truetype" - added. ;)
6) *EDIT* forgot the dash in @font-face too! (Sometimes it's the simple things!) :p

Hope this helps.
43.flag Richard Fink Comment
10/06/09
If I can add my advice at this point, also:
Make a simple sample page with the font in the same directory as the sample page and test to make sure the correct font is showing up without the complications of a lot of CSS on a complex page.
How was the EOT created?
There's always the possibility it's corrupted or has root strings enabled and IE is simply refusing to display it.
A simple sample page will reveal that.
Always a good idea to take variables out of the mix and test for basic functionality first.
Cheers, Rich
44.flag stk Comment
10/06/09
Good call, Richard. I'll echo that.

While I tend to "cowboy" things, a simple test page is a good place to fall back, before you start banging your head against a much more complicated wall. ;)
45.flag George Comment
10/06/09
Dear STK

Thank you, Thank you, Thank you, Thank you, Thank you,
Thank you so much. Finally it is working in IE and fire fox. Not in working in Google chrome. I was looking to resolve this issue almost 1 month; finally you fix it for me (STK). I don’t know how to express my sincere thanks to you. Again thank you so much for helping me. One more question this code work for Google chrome?
46.flag Richard Fink Comment
10/06/09
stk: The EOT Miracle Man!
47.flag stk Comment
10/07/09
George - You're welcome. Donations are always appreciated, as are link-backs. ;)

Yes, the code works in Google Chrome. Unfortunately, Google has disabled remote font embedding, because of "security problems". To enable it, one must start Chrome with an "--enable-remote-fonts" flag.

Chrome developers are hoping to get the security issue resolved and enable font embedding (soon).

Richard - Funny!
48.flag George Comment
10/07/09
STK - I will
49.flag Skandragon Comment
10/13/09
I tried for about an hour to get IE to load a converted font without luck. FF and Safari (both on my Mac and this PC thing) work, but IE refuses to play nice. As usual.

The site I'm hacking on is http://art.waywardgypsy.com/ which is a work in progress.

Any hints?
50.flag Richard Fink Comment
10/13/09
@skandragon
If you are following the tips for cross browser @font-face syntax as has been discussed here (follow links, too!), the culprit is probably a bad EOT file.
In any event, that should be what you test for first with a bare-bones page, just for IE.
Do the fonts show up then?

Cheers, Rich
51.flag Martin Stabenfeldt Comment
10/23/09
I'm cross-testing http://titti.bull.owre.no with browserlab.adobe.com.

Either I've done something wrong, or browserlab.adobe.com doesn´t fetch the @font-face fonts for IE.

Would anyone be so kind and confirm, or even better give me a hint om what's wrong?

@font-face
  font-family: "Zapfino";
  src: url( /fonts/Zapfino.eot ); /* IE */
  src: local("Zapfino"), url( /fonts/Zapfino.ttf ) format("truetype"); /* non-IE */
}


52.flag Richard Fink Comment
10/23/09
@martin stabenfeldt
zapfino is a script font, no?
I'm not seeing it in any browser.
Are you?
First thing I would do is move the @font-face declaration up to the top of the style sheet. And then move the part of it that's for EOT, into its own @font-face declaration right above it. In other words, two @font-face declarations, the first one specifically for IE.
See what happens.
rich
53.flag stk Comment
10/23/09
Martin - First the good news. Your CSS @font-face declaration appears fine. The TTF and EOT fonts are found, where the CSS says they are, as I was able to download both.

The bad news is that the TTF file is corrupt (assume the EOT too). It downloaded on my XP machine as a 517KB file, which seemed a tad large and wouldn't open - "not a valid font file".

More good news. I was able to snag a free copy of the (comes-with-a-Mac) Zapfino font following the links on this page. It's only 77KB and you can download it here.

I'll leave it to you to make the EOT, though I do recommend you follow Richard's suggestion and put any/all @font-face selectors first in your CSS.

Hope this helps.
54.flag Richard Fink Comment
10/23/09
@stk
Once again, the magic man. From here on in, when I run into trouble with @font-face, I'm asking you!
I think a diagnostic "best practice" is beginning to emerge here.
#1 Check that the fonts show up in a simple demo page, free of anything that might mask a basic problem with the font itself.
55.flag Martin Stabenfeldt Comment
10/26/09
@stk, thanks for the tips! I´ve moved the @font-face to the top, re-exported the font, but still no luck.

The TTF is from my Mac, and the EOT was created from console using ttf2eot.

517K Zapfino.eot
516K Zapfino.ttf

FireFox (3.5.3 Mac) recognize correct filetype for both.

I noticed that it´s not only IE that don´t use the provided fonts. Non of the browsers on Windows displays it. Mac works as it´s embedded there.

I tried the fonts you found online too, without luck I´m afraid.


(http://titti.bull.owren.no)
56.flag Martin Stabenfeldt Comment
10/26/09
I did a test with the browser cross-checker to Adobe: browserlab.adobe.com.

Tested http://www.alistapart.com/d/cssatten/poen.html, and it seams like non of the Windows browser it provides supports @font-face.
57.flag Richard Fink Comment
10/26/09
@Martin Stabenfeldt:
Try browsershots.org.
Web fonts show up on their screen shots. Works fine.

rich
58.flag stk Comment
10/26/09
Martin - First, I have to say that despite the nifty graphics, http://browserlab.adobe.com sucks! (Only one of the 9 browser versions they offer actually renders @font-face properly - Safari OSX. Not much help to you, since you probably already have that.) All supported FireFox versions are less than 3.5 (which is when FireFox begins @font-face support). I tried IE6/7/8 against this Randsco article and they all failed to correctly render @font-face. (I'd use the service Richard suggested, though I haven't tested it myself).

Secondly, I don't have a Mac (Help change that! Download my FireFox design entry, vote for it and leave a comment at the WebMynd design contest! 0:-) ) All I can say is that when I download the Zapfino font [517KB] it won't open in my XP folder and I get a message "not a valid font file".

Have a look at this test page, where I've used your CSS and point to the EOT and TTF file I suggested you download earlier. It *should* look fine in your Mac (Safari or FireFox3.5+). It also looks fine in IE6,7,8; winSafari; FireFox3.5 and Opera10 on a PC. (Try that service Richard mentioned).

I did have to fiddle with the font sizing, as your font stack sizes were a tad small for the Zapfino font (which is one of my gripes about CSS: You can't easily assign font sizes for each font in a font stack - independently).

EDIT: Though the fonts show fine, you've got some CSS breaks in the menu area between IE8, IE7 and IE6 ... plus the Tittinn graphic appears to be a PNG with transparency, which doesn't render in IE6 (change to a GIF and you'll be fine).
59.flag stk Comment
10/26/09
Richard - I gave browsershots a try.

I was initially impressed at the selection of platforms and options, but (a) why are so many selected by default?; (b) why are there only 'ads' under Mac OS? (no browsers to select) and (c) a lag time of 19 minutes for my 2 shots is too long between iterations and I couldn't use this for site development. Bummer.
60.flag Richard Fink Comment
10/26/09
Re- browsershots.org
Far from perfect but better than nothing. Now you'll know to initiate the preview right before lunch.
I uncheck nearly all the browsers except the important ones. Much faster and manageable.
61.flag Martin Stabenfeldt Comment
10/28/09
Stk and Richard Fink, thanks a lot for all help and tips!

Stk, I switched to the font you found and it now works in IE8. :)

I installed Windows 7 through Parallels and tested Opera 10.
Nope, no Zapfino fonts seen there.


BTW: http://www.webmynd.com/look/designs/by_id/68 gives a 500 internal error page.
62.flag Richard Fink Comment
11/18/09
@stk and all:

Found out about another couple of browsershots.org type sites.
Tried one and it works great so far. Speedy too.
http://ipinfo.info/netrenderer/
for testing your site in earlier version of IE.
Rendered really fast. Picked up the webfonts, everything.
http://litmusapp.com/browser-testing
This one I haven't tested yet but if it works anything like the first, far better than b-shots.
There's a link to this from the first one so go there first.

cheers, rich
63.flag Richard Fink Comment
11/18/09
BTW- Your stats aren't broken. The country flag is correct. I'm in Aruba, Netherlands Antilles.
64.flag Lost Souls Comment
11/18/09
Great info. I can't wait to get some rock'n roll fonts uploaded on our music site and have some of our old images turned into real text. :) Awesome tutorial, explanation and directions on how to get the @font-face embedding going!
65.flag stk Comment
11/18/09
Richard - Aruba? Sounds fun! Thanks for the links, I'll have to test them out. For the PC, I test against installed browsers and use IETester. I must rely on sites like those you linked to test MAC browsers, since I don't own a MAC.

BTW, a reader (via email) came across a TTF font that wouldn't load in FireFox. In an effort to determine why, I installed FontForge and made some interesting discoveries. I'll be sharing them in an upcoming post. (You work w/FontForge much?)

Lost Souls - Glad you like the tutorial. Thanks for saying so and good luck getting those Rock'n-Roll fonts going (and with the band)!
66.flag Richard Fink Comment
11/19/09
Don't work with fontforge at all, as yet.
big YET. I'm a windows guy who's going to have to invest in a Mac. don't want to go to the installation troubles of installing fontforge on windows.
love to hear what you've discovered.
Major rumblings in the web fonts department over the past few days. Two web fonts related articles in AlistApart:
Alistapart
And my own chirpings from the trees:
An Open Letter To Retail Font Vendors
IMHO - web designers will, and should, become active in screen font design - especially in the tweaking and repairing of existing fonts with open licenses. Unfortunately, I don't believe the "pros", that is, the retail font design community is going to be of much help.
And we'll soon see where Microsoft stands in all this, too.
Let's proceed. (As if we weren't going to!)
rich