即使不使用@font-face字体,浏览器也会加载它吗?
所以我有这个堆栈:
@font-face {
font-family: 'MyCustomFont';
src: url('MyCustomFont.ttf') format('truetype');
}
body { font-family: Helvetica, MyCustomFont, Arial, sans-serif; }
即使机器中存在 Helvetica(即:Mac 用户),浏览器也会加载 MyCustomFont.tff
吗?
So I have this stack:
@font-face {
font-family: 'MyCustomFont';
src: url('MyCustomFont.ttf') format('truetype');
}
body { font-family: Helvetica, MyCustomFont, Arial, sans-serif; }
Is MyCustomFont.tff
loaded by browser even if Helvetica is present in the machine (ie: Mac Users)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用
local
指令来测试本地安装的字体版本。如果未找到,将测试列表中的下一个字体,并加载(如果可用)。例如:上面的例子取自这里:
https://developer.mozilla.org/en/css/@font-face< /a>
这里有更多信息:
http ://www.broken-links.com/2009/06/30/checking-for-installed-fonts-with-font-face-and-local/
下载字体后,它将被缓存通过浏览器。一旦进入缓存,浏览器就不需要再次下载字体,从而加快速度。请参阅此处了解更多信息:
http://code.google.com/apis/webfonts/faq.html#性能
You need to use the
local
directive to test for the locally installed version of the font. If it is not found, the next font in the list will be tested for, and loaded if available. For example:The above example was taken from here:
https://developer.mozilla.org/en/css/@font-face
There's some more information here:
http://www.broken-links.com/2009/06/30/checking-for-installed-fonts-with-font-face-and-local/
Once a font has been downloaded, it will be cached by the browser. Once in the cache, it will not be necessary for the browser to download the font again, thereby speeding things up. See here for more information:
http://code.google.com/apis/webfonts/faq.html#Performance
Jake Archibald 在 Dibi 2011 中对此做了很好的演讲。
您可以在此处查看:http://vimeo.com/27771157< /a> 分钟。 11:59
这里:http://speakerdeck.com /u/jaffathecake/p/in-your-font-face?slide=39
Jake Archibald gave a very good talk about this in the Dibi 2011.
You can see here: http://vimeo.com/27771157 min. 11:59
And here: http://speakerdeck.com/u/jaffathecake/p/in-your-font-face?slide=39