ifont
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

iFont

An isomorphic icon font generator with support for ligatures.

It generates a single TTF file from a list of SVG icons and their names, mapping each name to a ligature.

It works in the browser too.

Install

npm install --save ifont

Usage

You would use the CLI commands like this:

# Build an icon font from some SVG icons
ifont build -i resources/icons/*.svg -o dist/IconFont.ttf

# Preview an icon font from some SVG icons
ifont preview -i resources/icons/*.svg

# List icons by bytes needed once added to the TTF font
ifont stats -i resources/icons/*.svg

You would use the programmatic API like this:

import ifont from 'ifont';
import fs from 'node:fs';

// Generate a TTF font, as a Uint8Array, from some SVG icons

const ttf = ifont ({
  icons: [
    { name: 'circle', content: '<svg>...</svg>' }
    { name: 'square', content: '<svg>...</svg>' },
    { name: 'triangle', content: '<svg>...</svg>' }
  ]
});

fs.writeFileSync ( 'IconFont.ttf', ttf );

License

  • svg2ttf: MIT © Vitaly Puzrin
  • Rest: MIT © Fabio Spampinato

Package Sidebar

Install

npm i ifont

Weekly Downloads

7

Version

1.0.3

License

none

Unpacked Size

193 kB

Total Files

97

Last publish

Collaborators

  • fabiospampinato