美文网首页
中文字体压缩工具-字蛛 使用总结

中文字体压缩工具-字蛛 使用总结

作者: null_su | 来源:发表于2017-04-27 16:31 被阅读0次

    原理是将需要的文字提取出来,重新压缩。

    1. 1.下载node.js //这个没有任何难度,直接下载windows版本,安装即可

    2. 安装命令:npm install font-spider -g

    3. 新建一个font.css,复制下面代码(注意路径):

       /*声明 WebFont*/
       @font-face {
         font-family: 'pinghei';
         src: url('../font/pinghei.eot');
         src:
           url('../font/pinghei.eot?#font-spider') format('embedded-opentype'),
           url('../font/pinghei.woff') format('woff'),
           url('../font/pinghei.ttf') format('truetype'),
           url('../font/pinghei.svg') format('svg');
         font-weight: normal;
         font-style: normal;
       }
       
       /*使用选择器指定字体*/
       .home h1, .demo > .test {
           font-family: 'pinghei';
       }
      

    4.在命令行中执行命令:font-spider *.html 生成对应的字体

    相关文章

      网友评论

          本文标题:中文字体压缩工具-字蛛 使用总结

          本文链接:https://www.haomeiwen.com/subject/vgcnzttx.html