Php在线字体woff转svg,svgtofont

软件简介

读取一组SVG图标并从SVG图标输出 TTF/EOT/WOFF/WOFF2/SVG 字体,字体生成器。

特征:

支持的字体格式:WOFF2,WOFF,EOT,TTF和SVG。

允许使用自定义模板(例如css,less等)。

自动生成预览网站。

由 svgtofont 创建的图标字体

安装

npm i svgtofont

使用

const svgtofont = require("svgtofont");

svgtofont({

src: path.resolve(process.cwd(), "icon"), // svg path

dist: path.resolve(process.cwd(), "fonts"), // output path

fontName: "svgtofont", // font name

css: true, // Create CSS files.

}).then(() => {

console.log('done!');

});

更多参数设置

const svgtofont = require("svgtofont");

const path = require("path");

svgtofont({

src: path.resolve(process.cwd(), "icon"), // svg path

dist: path.resolve(process.cwd(), "fonts"), // output path

fontName: "svgtofont", // font name

css: true, // Create CSS files.

startNumber: 20000, // unicode start number

svgicons2svgfont: {

fontHeight: 1000,

normalize: true

},

// website = null, no demo html files

website: {

title: "svgtofont",

// Must be a .svg format image.

logo: path.resolve(process.cwd(), "svg", "git.svg"),

version: pkg.version,

meta: {

description: "Converts SVG fonts to TTF/EOT/WOFF/WOFF2/SVG format.",

keywords: "svgtofont,TTF,EOT,WOFF,WOFF2,SVG"

},

description: ``,

links: [

{

title: "GitHub",

url: "https://github.com/jaywcjlove/svgtofont"

},

{

title: "Feedback",

url: "https://github.com/jaywcjlove/svgtofont/issues"

},

{

title: "Font Class",

url: "index.html"

},

{

title: "Unicode",

url: "unicode.html"

}

],

footerInfo: `Licensed under MIT. (Yes it's free and open-sourced`

}

}).then(() => {

console.log('done!');

});;

API

const { createSVG, createTTF, createEOT, createWOFF, createWOFF2 } = require("svgtofont/src/utils");

const options = { ... };

createSVG(options) // SVG => SVG Font

.then(UnicodeObjChar => createTTF(options)) // SVG Font => TTF

.then(() => createEOT(options)) // TTF => EOT

.then(() => createWOFF(options)) // TTF => WOFF

.then(() => createWOFF2(options)) // TTF => WOFF2

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值