用 字蛛 取出需要的字符应用字体 @font-face

一、安装font-spider

  npm install font-spider -g

二、目录结构

  font-spider

    font

      FZZZHONGHJW.ttf

    font.html

三、font.html内容

<!DOCTYPE html>
<html>
<head>
<title>方正正中黑简体</title>
<meta charset="utf-8">
<style type="text/css">
@font-face {
font-family: 'FZZZHONGHJW';
src:
url('font/FZZZHONGHJW.eot?#font-spider') format('embedded-opentype'),
url('font/FZZZHONGHJW.woff') format('woff'),
url('font/FZZZHONGHJW.ttf') format('truetype'),
url('font/FZZZHONGHJW.svg') format('svg');
  }
p{
font-family: "FZZZHONGHJW";
}
</style>
</head>
<body>

<!-- 全局 -->
<p>班级情况 布置作业 教学资源</p>

</body>
</html>

四、从字体文件中把页面字体抓取,生成字体文件,执行命令:

  font-spider font.html

五、生成后的目录结构  

  font-spider

    font

      .font-spider

        FZZZHONGHJW.ttf      

      FZZZHONGHJW.eot

      FZZZHONGHJW.svg

      FZZZHONGHJW.ttf

      FZZZHONGHJW.woff

    font.html

原文地址:https://www.cnblogs.com/iloveyou-sky/p/5692379.html