bmfont-lato

the Lato font as a bitmap sprite sheet

MIT License

Downloads
119
Stars
4

bmfont-lato

Lato packed as a BMFont JSON object, so it can be required for testing.

This also exports an images field, which is an array of ndpack-images parallel to the pages array.

var Lato = require('bmfont-lato')

//do something with the ndarrray image
var shape = Lato.images[0].shape.slice(0, 3))

//e.g. image shape is 512x512x4
console.log(shape)

//BMFont fields..
console.log(Lato.info)
console.log(Lato.chars)
console.log(Lato.kernings)

Since all glyphs have been packed into a single image, the paths and images array will have a length of 1.

The ndarray image contains 4 Lato Regular fonts packed with gdx-fontpack, each of which can be required separately:

  • require('bmfont-lato/16')
  • require('bmfont-lato/24')
  • require('bmfont-lato/32')
  • require('bmfont-lato/64')

The default exported font is 32 (the size is in px).

URI

You can also just grab the data URI like so:

  • require('bmfont-lato/image-uri')

Usage

Build

See package.json scripts on how to build. You need these tools:

npm install ndpack-image bmfont2json module-exports -g

Then:

#first you need to build an atlas with your tool of choice
# ...

#then pack it with ndpack-image
npm run pack

#then export all fonts as CommonJS
npm run fonts

License

MIT, see LICENSE.md for details.