svgicon2webfont
v1.0.1
Published
Convert svg icons to webfont.
Downloads
2
Readme
svgicon2webfont
Convert svg icons to webfont.
Install
npm install svgicon2webfont --save
Usage
const svgicon2webfont = require('svgicon2webfont');
svgicon2webfont({
fontName: 'iconfont',
glyphs: [{
name: 'xx',
codepoint: 0xF101,
svg: fs.readFileSync('xx.svg')).toString()
}],
dest: 'dest'
}).then((result) => {
// handle result
}).catch((error) => {
// handle error
})
Options
fontName
required
Type: string
Name of font and base name of font files.
dest
required
Type: string
Directory for generated font files.
glyphs
required
Type: Array<Glyph>
Specific name
, codepoint
, svg
for icons.
interface Glyph {
name: string;
codepoint: number;
svg: string;
}
fontName, normalize, fontHeight, round, descent
Options that are passed directly to svgicons2svgfont.
formatOptions
Type: object
Specific per format arbitrary options to pass to the generator
format and matching generator:
svg
- svgicons2svgfont.ttf
- svg2ttf.woff2
- ttf2woff2.woff
- ttf2woff.eot
- ttf2eot.
svgicon2webfont({
// options
formatOptions: {
// options to pass specifically to the ttf generator
ttf: {
ts: 1451512800000
}
}
})