Code Monkey home page Code Monkey logo

webfonts-generator's Introduction

@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, 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 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, :
    • normalize: boolean
    • fontHeight: number

Usage

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

webfonts-generator's People

Contributors

dependabot[bot] avatar jlowery457 avatar pauljeter avatar tbassetto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.