https://github.com/momentum-design/webfonts-generator
Modern webfonts generator from SVG icons
https://github.com/momentum-design/webfonts-generator
svg ttf ttf2woff wawoff2 webfonts webfonts-generator woff woff2
Last synced: 6 months ago
JSON representation
Modern webfonts generator from SVG icons
- Host: GitHub
- URL: https://github.com/momentum-design/webfonts-generator
- Owner: momentum-design
- License: mit
- Created: 2019-03-18T17:18:40.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T18:02:51.000Z (almost 3 years ago)
- Last Synced: 2024-05-14T13:02:13.807Z (over 1 year ago)
- Topics: svg, ttf, ttf2woff, wawoff2, webfonts, webfonts-generator, woff, woff2
- Language: JavaScript
- Size: 1.01 MB
- Stars: 4
- Watchers: 5
- Forks: 5
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @momentum-ui/webfonts-generator
This webfonts generator takes SVG icons and transform them to WOFF and WOFF 2 fonts.
Developed specifically for the needs of [Cisco's Momentum design system](http://www.momentum-ui.com), this project is quite opinionated but open to features request and PRs nonetheless.
Despite being written from scratch, this project was inspired by the (now archived) project [webfonts-generator](https://github.com/sunflowerdeath/webfonts-generator) project.
## Caveats
- Technically generates SVG and TTF fonts too, because they are necessary steps to get WOFF fonts from SVG files with today's tools.
- Only runs on Node.JS 10 or better (because the source code relies heavily on `async`/`await`).
- Never tested on Windows (but should work).
- Does not generate EOT font (unecessary, woff and woff2 cover all modern browsers as well as IE9 and IE10).
- There is no CLI, only a Node.JS API (PR welcome).
- There is no way to pass down options to some of the tools used under the hood (`svg2ttf`, `ttf2woff` and `wawoff2`).
- You can pass down the following options for [svgicons2svgfont](https://github.com/nfroidure/svgicons2svgfont#svgicons2svgfontoptions), :
- normalize: `boolean`
- fontHeight: `number`## Usage
```js
const { generateFonts } = require("@momentum-ui/webfonts-generator");
const options = {};generateFonts("My Awesome Font", "icons/*.svg", "fonts", options).then(
result => {
console.log(`Webfont ${result.fontName} created!`);
console.log(`WOFF file: ${result.fontFiles.woff}`);
console.log(`WOFF2 file: ${result.fontFiles.woff2}`);
console.log(`Glyphs information:`, result.glyphsData);
}
);
```## Development
TBD