npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fontconvert-tool

v1.1.2

Published

WebFonts generation tool

Downloads

14

Readme

fontconvert-tool

Helps to convert normal font into WebFont.

Features

  • Subset support
  • Vertical align/line height normalization
  • Hinting support

Installation

This plugin requires FontForge. ttfautohint is optional(turn it off in config, see below). Tested on ttfautohint version 1.5.

OS X

brew install ttfautohint fontforge --with-python
npm install fontconvert-tool --save-dev

Linux

sudo apt-get install fontforge ttfautohint
npm install fontconvert-tool --save-dev

Windows

npm install fontconvert-tool --save-dev

Then install ttfautohint (optional).

Then install fontforge.

Example

var fontconvert = require('fontconvert-tool')

fontconvert.convertFonts('./fonts-source', './fonts-out')

Selective subset example

var fontconvert = require('fontconvert-tool')

fontconvert.convertFonts('./fonts-source', './fonts-out', {
    subset: [
        'Basic Latin', 'Latin-1 Supplement', // Latin
        'Cyrillic Russian', // Cyrillic
        'General Punctuation', 'Currency Symbols' // Punctuation
    ]
})

API

fontconvert.convertFonts(fontsInputDir, fontsOutDir, [config, callback])

Returns a promise.

Config

subset

Type: array Default: []

Array list of out font subsets. See supported unicode ranges patterns.

Example:
[
    'Basic Latin', 'Latin-1 Supplement', // Latin
    'Cyrillic Russian', // Cyrillic
    'General Punctuation', 'Currency Symbols' // Punctuation
]

outTypes

Type: array Default: ['ttf', 'eot', 'woff', 'woff2'].

svg-fonts not supported.

autoHint

Type: boolean Default: true

Use ttfautohint util to hint fonts.

ttfautoHintFallbackScript

Type: string Default: latn

ttfautoHintArgs:

Type: array Default: []

You can specify ttfautohint arguments

woff2NativeConverter

Type: boolean Default: true

Use ttf2woff2 native addon. Set it false for using pure js converter in trouble case.

fontFileNameFilter

Type: function(fontFileName, fontFamily, config)

You can specify name of out file name by passing filter function

Example:
function (fileName) {
    return 'prefix-' + fileName
}

fontDestinationDirFilter

Type: function(fontDestDir, fontDestBaseDir, fontDestName, fontFamily, config)

You can specify name of fonts out dir by passing filter function.

Example:
function (dirName) {
    return path.join('subdir', dirName)
}

Specifying executables

If you are using OS X or Linux usually you don't need to specify any paths if FontForge and ttfautohint installed normally. On Windows you probably have to set paths manually(at least for FontForge).

var fontconvert = require('fontconvert-tool')

fontconvert.fontForgeBin = 'fontforge'
fontconvert.ttfautohintBin = 'ttfautohint' // example: 'C:\Program Files (x86)\FontForgeBuilds\bin\fontforge.exe' 

Logging

If you are using task manager like gulp you can specify logging function for pretty out log:

var fontconvert = require('fontconvert-tool'),
    gutil = require('gutil')

fontconvert.log = gutil.log.bind(gutil)

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Alex Batalov

License

Copyright © 2015 Alex Batalov Licensed under the MIT license.