8

如果我可以嵌入我可能使用的每种字体,那么开发会更容易,但我绝对不希望额外的 HTTP 请求不会出现在页面中的任何位置。任何人都可以启发我吗?

4

4 回答 4

18

IE 遇到@font-face 声明时会立即下载.eot 文件。

Gecko、Webkit 和 Opera 都等到遇到与 CSS 规则匹配的 HTML,其字体堆栈包括 @font-face 字体。

-- http://paulirish.com/2009/fighting-the-font-face-fout/

所以如果不是 IE,嵌入大量字体实际上是安全的,只要你小心不要在 CSS 样式中引用未使用的字体,因为那时它们将被浏览器下载。

于 2010-04-28T05:15:05.250 回答
0

Unfortunately, most browsers won't second guess you to avoid downloading fonts that aren't actually used (actually I don't know of any browser who is smart enough for such avoidance, which of course doesn't mean some such browsers might not exist). Couldn't you post-process the pages during deployment to remove the unused ones?

于 2010-04-28T05:03:44.767 回答
0

此外,您也可以这样做:清除浏览器缓存,然后运行浏览器检查器(右键单击> Inpsect)和调试器(资源)选项卡。然后输入网址并查看正在下载的内容。

于 2013-07-31T09:06:46.980 回答
0

Paul Irish 有一个非常好的使用 @font-face 的教程

http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/

您还可以在 fontsquirrel.com 上使用语法生成器

于 2010-04-28T08:42:53.900 回答