Compressing fonts for using in web

2019-02-07 04:21发布

Can fonts be compressed someway before using as webfonts? I have a font file which is 150kB. Is it possible to compress it down.

And also if i call for both font .eot and .ttf will both be downloaded by browsers?

3条回答
Rolldiameter
2楼-- · 2019-02-07 04:45

My fav resource for font stuff is http://www.fontspring.com/blog - the guy who writes this (Ethan) set up fontsquirrel which is an excellent generator. I recommend reading his posts on the issues and using his finalized syntax.

Normally I won't have a compressed font file of over 60kbs (woff and EOT compressed sometimes go down to around 20!). The way the browsers work is that they load from the last @font-face src upwards but will ignore certain types. Once they find a font file they understand it will load - so using fontspring/fontsquirrel default syntax is a really good option!

Additionally if you have any issues with his syntax Ethan is very good at responding with advice!

Ref for downloads: http://www.fontspring.com/blog/further-hardening-of-the-bulletproof-syntax#comment_333

查看更多
相关推荐>>
3楼-- · 2019-02-07 04:46

If you use the FontSquirrel @font-face kit generator - http://www.fontsquirrel.com/fontface/generator - and choose the expert setting, you can manipulate the settings to achieve a little better compression.

查看更多
smile是对你的礼貌
4楼-- · 2019-02-07 04:46

You can compress .woff font files with https://github.com/hn/woff-compress. It uses zlib's Z_BEST_COMPRESSION flag or Zopfli to losslessly shrink files down to a minimum.

If you want to lossy reduce files even more, you can remove unneeded glyphs from the font as discussed in Way to reduce size of .ttf fonts?.

查看更多
登录 后发表回答