font-spider字蛛压缩中文字体包
中文字体引用(如思源雅黑)
第一步: 网站下载字体: http://www.downcc.com/font/326030.html
第二步:百度 @font-face生成器 (字客网 https://www.fontke.com/tool/fontface/ 生成不同格式和字体和样式,页面引用即可)(需要vip了)
202107719更新网站 https://convertio.co/zh/
解决chrome浏览器下@font-face字体图标出现锯齿:
要注意不同格式字体引用顺序问题 》 eot>svg>ttf>woff2>woff
复制代码
@font-face {
font-family: ‘SourceHanSansCN-Regular’;
src: url(‘font/SourceHanSansCN-Regular.eot’) format(‘embedded-opentype’), url(‘font/SourceHanSansCN-Regular.svg’) format(‘svg’), url(‘font/SourceHanSansCN-Regular.ttf’) format(‘truetype’), url(‘font/SourceHanSansCN-Regular.woff2’) format(‘woff2’), url(‘font/SourceHanSansCN-Regular.woff’) format(‘woff’);
font-weight: normal;
font-style: normal;
}
*{font-family:‘SourceHanSansCN-Regular’,Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;-webkit-text-size-adjust:none; }
字蛛是一个中文字体压缩器
http://font-spider.org/#use
然后再运行: npm install font-spider -g
node.js出错原因:
-
字体引用时必须用英文单引号
{
@font-face {
font-family:‘SourceHanSansCN-Medium’;
src:url(‘…/font/SourceHanSansCN-Medium.eot’);
src: url(‘…/font/SourceHanSansCN-Medium.eot?#font-spider’) format(‘embedded-opentype’),
url(‘…/font/SourceHanSansCN-Medium.svg’) format(‘svg’),
url(‘…/font/SourceHanSansCN-Medium.ttf’) format(‘truetype’),
url(‘…/font/SourceHanSansCN-Medium.woff2’) format(‘woff2’),
url(‘font/SourceHanSansCN-Medium.woff’) format(‘woff’);
font-weight: normal;
font-style: normal;
}
} -
不用引用图标字体;
-
再运行 font-spider *.html
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
