Make GL-ready pbfs and metadata for usage in fontstack API.
Make all metadata (codepoints) and SDF PBFs necessary for Mapbox GL fontstacks.
parameter | type | description |
---|---|---|
opts |
Object |
Options object with required font and filetype properties, and any optional parameters. |
opts.font |
Buffer |
The font file as a Buffer . |
opts.filetype |
string |
Type of font (e.g. '.ttf' or '.otf' ). |
[opts.concurrency] |
number |
optional: Concurrency to use when processing font into PBFs. If undefined , concurrency is unbounded. |
callback |
function(err, result) |
Callback takes arguments (error , result ). |
property | type | description |
---|---|---|
name |
string |
The name of this font (concatenated family_name + style_name). |
stack |
Array<{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. |
codepoints |
Array<int> |
Array of codepoints covered by the font. |
original |
{name: string, data: Buffer} |
An object containing the original font file (named 'original<filetype>' ) |
Requires nodejs.
$ npm install @mapbox/fontmachine
$ npm test