-
-
Save jakearchibald/478344 to your computer and use it in GitHub Desktop.
<style> | |
@font-face { | |
font-family: 'foo'; | |
/* this font only contains the glyphs 'f' & 'o' */ | |
} | |
@font-face { | |
font-family: 'bar'; | |
/* this font only contains the glyphs 'b', 'a' & 'r' */ | |
} | |
.test { | |
font-family: 'foo', 'bar', sans-serif; | |
} | |
</style> | |
<p class="test">foo</p> | |
<!-- | |
Firefox (3.6) and Opera (10.6) will load fonts 'foo' and 'bar', it sees that an element matches a style | |
with those fonts & loads them. | |
Webkit (chrome 5) is clevererer and only loads 'foo', it won't try and load 'bar' unless | |
chars are used that don't exist in the 'foo' font. | |
IE will load fonts 'foo' and 'bar' regardless of any usage on the page | |
--> |
I'm not convinced the invisible text thing is the right way, I mean, I'd rather the user got the content as quickly as possible.
Maybe it should work in a similar way to CSS in Opera. As in, keep text invisible for 1-2 seconds (or until the font loads) then fall back to Firefox behaviour. That caters for people who are on a rubbish connection, or the server holding the font is a bit broken.
Definitely agree with you wrt to text visibility.
Most webfonts people I talk to share the same POV too. It's just a matter of seeing the change land in browsers..
I've proposed some changes over at https://bugzilla.mozilla.org/show_bug.cgi?id=579916 - I've made a similar report in the trackers for Webkit, IE & Opera.
I looked at IE9 by the way, it behaves the same as Firefox & Opera in the case above. However, it also blocks page rendering worse than IE6-8. Hopefully they'll fix that along with the downloading-too-much issue you filed a report on.
Very interesting -- I didn't know Firefox/Opera were so greedy with the network requests.
At the same time, Webkit has the benefit of keeping all this text invisible until the fonts are ready, so it can take its time to peek into each font to see what characters are available.
Great to have this documented. I wonder what IE9's behavior is.