This package has been deprecated

Author message:

fontmachine is deprecated, which means it is no longer maintained and will not receive updates. Instead of this library, we recommend using node-fontnik directly

@mapbox/fontmachine

0.3.0 • Public • Published

@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

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

Callback 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>')

Installation

Requires nodejs.

$ npm install @mapbox/fontmachine

Tests

$ npm test

Readme

Keywords

none

Package Sidebar

Install

npm i @mapbox/fontmachine

Weekly Downloads

6

Version

0.3.0

License

ISC

Unpacked Size

10.2 kB

Total Files

5

Last publish

Collaborators

  • mbx-npm-ci-production
  • mbx-npm-ci-staging
  • mbx-npm-advanced-actions-production
  • mbx-npm-advanced-actions-staging
  • mbx-npm-09-production
  • mbx-npm-08-production
  • mbx-npm-07-production
  • mbx-npm-06-production
  • mbx-npm-05-production
  • mbx-npm-04-production
  • mbx-npm-03-production
  • mbx-npm-02-production
  • mbx-npm-01-production
  • mbx-npm-02-staging
  • mapbox-npm-01
  • mapbox-npm-02
  • mapbox-npm-07
  • mapbox-npm-03
  • mapbox-npm-04
  • mapbox-npm-09
  • mapbox-npm-05
  • mapbox-npm-06
  • mapbox-npm-08
  • mapbox-npm-advanced-actions
  • mapbox-npm-ci
  • mapbox-npm
  • mapbox-admin
  • mapbox-machine-user