安装使用font-spider

五一期间将围棋古谱网站上线,比较一下字体,选择的是文泉驿的等宽正黑字体作为棋子的数字显示,但字体文件就8M多,只是显示数字有些太过臃肿庞大了。

后来准备使用font-spider优化字体,在ubuntu 14.04上通过apt安装并不成功,问题在node.js环境安装有问题。于是到node.js官网上安装教程安装:

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash – 安装Node.js v7

然后apt-get install -y nodejs

安装 font-spider:npm install font-spider -g

新建一个文件test.html,css部分包含:

<style type=”text/css”>

@font-face {
font-family: ‘wqs’;
src: url(‘./fonts/wqs.ttf’);
src:
url(‘./fonts/wqs.eot?#font-spider’) format(’embedded-opentype’),
url(‘./fonts/wqs.woff’) format(‘woff’),
url(‘./fonts/wqs.ttf’) format(‘truetype’),
url(‘./fonts/wqs.svg’) format(‘svg’);
font-weight: normal;
font-style: normal;
}
body{
font-family:”wqs”;
}
</style>

body中将棋谱显示数字放进去

在上传文件到linux下,font-spider test.html

生成了新的字体文件,但没有备份原字体文件,所以还是事先备份好。

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用 * 标注

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>