Giter Club home page Giter Club logo

svgicons2svgfont's Introduction

svgicons2svgfont

svgicons2svgfont is a simple tool to merge multiple icons to an SVG font.

NPM version Build status Dependency Status devDependency Status Coverage Status Code Climate

'rect', 'line', 'circle', 'ellipsis', 'polyline' and 'polygon' shapes will be converted to pathes. Multiple pathes will be merged.

Transform attributes support is currenly experimental, report issues if any.

You can test this library with the frontend generator.

You may want to convert fonts to icons, if so use svgfont2svgicons.

## Usage NodeJS module:

var svgicons2svgfont = require('svgicons2svgfont')
  , fs = require('fs');
  , fontStream = svgicons2svgfont([
    'icons/directory/icon1.svg',
    'icons/directory/icon2.svg'
  ], options);

// Saving in a file
fontStream.pipe(fs.createWriteStream('font/destination/file.svg'))
  .on('finish',function() {
    console.log('Font written !')
  });

CLI (install the module globally):

svgicons2svgfont icons/directory font/destination/file.svg

API

svgicons2svgfont(options)

options.fontName

Type: String Default value: 'iconfont'

The font family name you want.

options.fixedWidth

Type: Boolean Default value: false

Creates a monospace font of the width of the largest input icon.

options.centerHorizontally

Type: Boolean Default value: false

Calculate the bounds of a glyph and center it horizontally.

Warning: The bounds calculation is currently a naive implementation that may not work for some icons. We need to create a svg-pathdata-draw module on top of svg-pathdata to get the real bounds of the icon. It's in on the bottom of my to do, but feel free to work on it. Discuss it in the related issue.

options.normalize

Type: Boolean Default value: false

Normalize icons by scaling them to the height of the highest icon.

options.fontHeight

Type: Number Default value: MAX(icons.height) The outputted font height (defaults to the height of the highest input icon).

options.round

Type: Number Default value: 10e12 Setup SVG path rounding.

options.descent

Type: Number Default value: 0

The font descent. It is usefull to fix the font baseline yourself.

Warning: The descent is a positive value!

The ascent formula is: ascent = fontHeight - descent.

options.log

Type: Function Default value: false

Allows you to provide your own logging function. Set to function(){} to impeach logging.

Build systems

Grunt plugins

grunt-svgicons2svgfont and grunt-webfont.

Gulp plugins

Try gulp-iconfont and gulp-svgicons2svgfont.

### Mimosa plugin

https://www.npmjs.org/package/mimosa-svgs-to-iconfonts

Stats

NPM NPM

Contributing

Feel free to push your code if you agree with publishing under the MIT license.

svgicons2svgfont's People

Contributors

eduardolundgren avatar morlay avatar nfroidure avatar sapegin avatar

Watchers

 avatar  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.