3 ms·
tl;dr: It is a fall-back font of which every glyph is zero width. It can be, for example, used as a substitute font while the actual web font loads; the text wi
by lifthrasiir 14y ago
tl;dr: It is a fall-back font of which every glyph is zero width. It can be, for example, used as a substitute font while the actual web font loads; the text width of zero indicates that the web font is yet to be loaded.
- chongli 14y agoThis seems like a whole lot of effort for nothing. Why not just use the onerror callback of an image to check if it's loaded?
- PavlovsCat 14y agoBecause "an image" is not the webfont you're actually interested in maybe?
- chongli 14y agoYou're not using an actual image, just an image object. Set the src attribute of the image object to the URL of the webfont and the browser will call the onerror callback when it finishes loading. See here: http://stackoverflow.com/a/5371426 http://stackoverflow.com/a/5371426
- Sephr 14y agoJust because a font has "loaded" does not mean it's ready to be used. This very problem makes it hard to load @font-face fonts on demand in <canvas> apps as there is a certain amount of time you must wait for the font to actually load that is not exposed or accounted for in any browser APIs. Even if you include a font in @font-face with a data: URI, you cannot immediately start using it.