Does the text show up in a normal or default font until the download is complete and then reformat itself? Or would the user have to reload once the font files are in their cache? I ask because I have seen strange behaviour, specifically in Safari, where the first time I hit reload on my test page after making a change the text is normal, but then if I hit reload again it shows the font.
Thanks in advance for any insight on this topic. Randy - I'm no browser guru, but it's my understanding that most of the major browsers - except FireFox - don't render the page until after the font is downloaded. As noted in this, that can cause problems on a slow connection. FireFox typically renders un-styled text first, then (once the font is downloaded) it will re-render the page, using the spiffy font-face font.
(Called FOUT, there are one can employ to get around it). Not heard of the what you're reporting, but I have a couple quick thoughts: (a) What O/S-browser combo are you on? (i.e., XP/winSafari or OSX/Safari?) and (b) Are you seeing a similar behavior with this article (or another page using @font-face)? I am making a rendition of Monopoly, and I wanted to use an appropriate font. I came across this article and used the procedures found in it. It took forever for me to get it to work, but I found that the problem was that in IE, you can't do something like this: src: url(data/KABOBE.eot); I had to put it in the same folder as the page and do this: src: url(KABOBE.eot); As I said, this is in IE.
I'm using IE because I'm making the game as a.HTA (more info at ). Whether the problem is in IE as a whole, or just the fact that I'm using a.HTA, I don't know. Great article!
I am wondering if the default behaviour is for the font to be loaded from the server when it is actually called (or used on the page) rather than on page load? Reason is that i am building a page where the text is created and formatted dynamically, and i intend to have quite a large library of fonts, and i want to avoid a massive download initially, so i started to think about dynamically loading the @font-face using javascript for each font when it is required, but then i noticed that it seems to do this by default? (in FF anyway) If this is the case (that the fonts are loaded only when used) then is this the default behaviour of all browsers? Nathan - Good question! Different browsers load fonts differently.
For example, IE downloads the font as soon as it sees @font-face in the CSS (i.e., loads the font whether it's used on the page or not). Because I only load fonts if I use them on a particular page, I've not concerned myself much about fonts that I don't want to load. However, you might find the article ', by Steve Souders, useful. Also, the TypeKit blog discusses ', which may provide the kind of control you might need for your font library? So I have read through this post several times and have tried several options but I am unable to get my font - Beatty to show up on Firefox on my PC, nor on Google Chrome.
It shows up fine on Firefox Mac, Safari, IE. I have explained it in detail on Stack Overflow. I have tested it by changing the font names. So what I've discovered is the.eot file is working and the.ttf file is not working. I have tried several different.ttf files, I have tried using Fontsquirrel generator for each to no avail. I am at my wits end on this having spent days on it.
Do you have any ideas. Thanks so much. Roxanna, I had a closer look at and note that the @font-face statement loads the Beatty font as: @font-face { font-family: 'BeattyRegular'; But that the font-family statement that calls it is: #navbar a { font-family: Beatty Regular, Beatty, Trebuchet MS, Verdana; Firstly, any font families with a space should be wrapped in quotes (i.e., 'Beatty Regular'). More importantly, the font loaded doesn't have a space. (i.e., remove the space in the font-family declaration - 'Beatty Regular' to 'BeattyRegular' - and this should fix your problem). Also, whenever you define a font stack, it's always good practice to end with a generic font family (either 'serif', 'sans-serif', 'cursive', 'fantasy' or 'monospace').
[] Hope this helps. I understand that; I may not have expressed myself clearly enough.
Also I see I messed up the syntax in the examples, so it looks like I don't know how it works. But I still have the question. What is the difference between using local(real font name) in the @font-face clause and using the real font name in the font-family property? I know you can use local to confuse IE into thinking the src is not valid and to prevent it from loading a file it can't use, but I'm pretty sure that was not the original intention!
Thanks so much for this great tutorial article. Very very useful I have a question though.
I have embedded a fancy font following this tutorial and I have added also verdana, or helvetica as second font. Now, my fancy font has smaller size to begin with, so I had to increase the font-size. But the second font gets way bigger than my fancy font, if the fancy font doesn't work. Is there a way to declare two different font sizes for these, one large size for the fancy font and one smaller if the fancy font doesn't work? Helen - Thanks for asking this valuable question.
Yes, font sizes are a problem. There is a CSS3 solution ', but this is hardly x-browser. Firstly, your @font-face font really doesn't require a back-up font (it either downloads, or it doesn't).
For me, I just use ONE generic font after my downloaded font, to keep things simple. Secondly, because the 'font-height-adjust' doesn't work, it MAY be worthwhile to adjust the x-height of the 'fancy font' using a program like Fontforge. I'm really sorry there isn't an easier solution, but you've definitely hit on a a (growing) problem!
Scare Bear - Not a WOFF expert. It's the 'way of the future' for online fonts.
Not sure what browsers support it ATM. I would include it for 'future-proofness', but I encourage you to yourself.).