如何gzip @ font-face示例? [英] How to gzip @font-face example?

查看:202
本文介绍了如何gzip @ font-face示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以提供一个如何gzip webfont工具包的示例吗?生成器提供给我这个代码...需要改变什么?

Can someone provide an example of how to gzip a webfont kit? The generator provided me with this code...what needs changed around?

@font-face {
    font-family: 'DesigersBold';
    src: url('desib__-webfont.eot');
    src: url('desib__-webfont.eot?#iefix') format('embedded-opentype'),
         url('desib__-webfont.woff') format('woff'),
         url('desib__-webfont.ttf') format('truetype'),
         url('desib__-webfont.svg#DesigersBold') format('svg');
    font-weight: normal;
    font-style: normal;
}


推荐答案

访问httpd.conf?如果是,是否已启用gzip压缩?

Are you using Apache and have access to httpd.conf? If so, is gzip compression already enabled?

您可以查找此行:

AddOutputFilterByType DEFLATE

SetOutputFilter DEFLATE

如果是前者,您应该能够添加以下MIME类型指令和参数看起来像下面的。此处声明的MIME类型适用于 .EOT .TTF .SVG 。我将它们从我的Apache conf文件夹中的 mime.types 文件中拉出来。我相信.WOFF已经压缩,所以你不需要gzip压缩。

If it's the former, you should be able to add the following MIME types so the directive and parameters look like the one below. The MIME types declared here are for .EOT, .TTF, and .SVG. I pulled them from the mime.types file in my Apache conf folder. I believe .WOFF is already compressed so you do not need to have it gzipped.

AddOutputFilterByType DEFLATE application/vnd.ms-fontobject application/x-font-ttf image/svg+xml

后一个指令SetOutputFilter gzips如果此位置包含您的字体文件,则在传送到客户端时,它们应已经gzip压缩。

The latter directive SetOutputFilter gzips all files within the container it is stated in. If this location includes your font files, they should already be gzipped when delivered to the client.

这篇关于如何gzip @ font-face示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆