JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 682375
  • Score
    100M100P100Q194769F
  • License MIT

loads a BMFont file in Node and the browser

Package Exports

  • load-bmfont
  • load-bmfont/browser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (load-bmfont) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

load-bmfont

stable

Loads an AngelCode BMFont file from XHR (in browser) and fs (in Node), returning a JSON representation.

var load = require('load-bmfont')

load('fonts/Arial-32.fnt', function(err, font) {
  if (err)
    throw err
  
  //The BMFont spec in JSON form
  console.log(font.common.lineHeight)
  console.log(font.info)
  console.log(font.chars)
  console.log(font.kernings)
})

Currently supported BMFont formats:

  • ASCII (text)
  • JSON

XML coming soon; first parse-bmfont-xml needs to use a lightweight browser version.

Related modules:

Usage

NPM

load(path, cb)

Loads a BMFont file at the given path and fires the callback with (err, font) params once finished.

In browser this uses XHR, in Node this uses fs.readFile.

License

MIT, see LICENSE.md for details.