TTFAutohint wrapper for Node JS.
- Standalone (no global dependency)
- Stream API
- Compilation process (if no precompiled online)
- Type strict as possible (ESLint)
- ES7
- Functional
The class implements stream.Transformer.
$ npm i ttfautohintimport TTFAutohint from 'ttfautohint';
const i = fs.createReadStream('/source/font.ttf');
const o = fs.createWriteStream('/target/font-compiled.ttf');
// TTFAutohintOptions can be passed
const t = new TTFAutohint();
i.pipe(t).pipe(o);import TTFAutohint from 'ttfautohint';
const i = fs.readFileSync('/source/font.ttf');
// TTFAutohintOptions can be passed as the second argument
const o = TTFAutohint.transform(i);import TTFAutohint from 'ttfautohint';
const i = '/source/font.ttf';
const o = '/target/font.compiled.ttf';
// TTFAutohintOptions can be passed as the third argument
// If there is no output path provided, then compiles to the source folder
// with suffix
// Creates non-existing target directories
TTFAutohint.compile(i, o);You can configure compilation by an optionally passed Object argument.
Add subglyph adjustment for exotic fonts.
The default font-size (x-height) to optimize for.
For icon-fonts we apply a special font-size metrics and configuration, thus
if set to true, the following options will be ignored:
extendedminmaxsize
Add TTFAutohint version string to the name table of the font.
Maximum PPEM value.
The minimum font-size to optimize for.
The maximum font-size to optimize for.
Absolute path to an optional reference TTF/TTC font where missing blue-zones can be derived from.
$ npm i -g ttfautohintIf you install the package globally, NPM will hook it to the ttfautohint
command and you can use it just like the original.
$ ttfautohint [OPTION]... [IN-FILE [OUT-FILE]]Configuration can be easily changed from your project root, like this:
$ npm config set ttfautohint:[option] [value]The remote repository where precompiled binaries are come from. Every binary must
support both x86 and x64 architectures and follow this URL pattern:
process.platformnpm-config: versionttfautohint
Windows binaries must be suffixed by .exe.
Version of the precompiled TTFAutohint.
If set to true, the install process skips looking for precompiled binaries.
MIT © 2018, Székely Ádám