即使不使用@font-face字体,浏览器也会加载它吗?

发布于 2024-09-07 01:54:43 字数 290 浏览 1 评论 0原文

所以我有这个堆栈:

 @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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

染柒℉ 2024-09-14 01:54:43

您需要使用 local 指令来测试本地安装的字体版本。如果未找到,将测试列表中的下一个字体,并加载(如果可用)。例如:

@font-face {
    font-family: MyHelvetica;
    src: local("Helvetica Neue Bold"),
    local("HelveticaNeue-Bold"),
    url(MgOpenModernaBold.ttf);
    font-weight: bold;
}

上面的例子取自这里:
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:

@font-face {
    font-family: MyHelvetica;
    src: local("Helvetica Neue Bold"),
    local("HelveticaNeue-Bold"),
    url(MgOpenModernaBold.ttf);
    font-weight: bold;
}

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

一人独醉 2024-09-14 01:54:43

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文