0.3.0 • Published 4 years ago

@mapbox/fontmachine v0.3.0

Weekly downloads
27
License
ISC
Repository
github
Last release
4 years ago

@mapbox/fontmachine

Build Status codecov

Make GL-ready pbfs and metadata for usage in fontstack API.

makeGlyphs(opts, opts.font, opts.filetype, [opts.concurrency], callback)

Make all metadata (codepoints) and SDF PBFs necessary for Mapbox GL fontstacks.

Parameters

parametertypedescription
optsObjectOptions object with required font and filetype properties, and any optional parameters.
opts.fontBufferThe font file as a Buffer.
opts.filetypestringType of font (e.g. '.ttf' or '.otf').
[opts.concurrency]numberoptional: Concurrency to use when processing font into PBFs. If undefined, concurrency is unbounded.
callbackfunction(err, result)Callback takes arguments (error, result).

Callback result

propertytypedescription
namestringThe name of this font (concatenated family_name + style_name).
stackArray<{name: string, data: Buffer}>An array of 256 {name: filename, data: buffer} objects with SDF PBFs covering points 0-65535.
metadata{family_name: string, style_name: string}Metadata about the font.
codepointsArray<int>Array of codepoints covered by the font.
original{name: string, data: Buffer}An object containing the original font file (named 'original<filetype>')

Installation

Requires nodejs.

$ npm install @mapbox/fontmachine

Tests

$ npm test
0.3.0

4 years ago

0.3.0-dev.1

4 years ago

0.2.2

5 years ago

0.2.2-1

5 years ago

0.2.1

7 years ago