1.0.1 • Published 6 years ago

svgicon2webfont v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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:

svgicon2webfont({
  // options
  formatOptions: {
  	// options to pass specifically to the ttf generator
  	ttf: {
  		ts: 1451512800000
  	}
  }
})