Name Last Update
..
README.md Loading commit data...
index.js Loading commit data...
package.json Loading commit data...

parse-bmfont-ascii

stable

Parses ASCII (text) BMFont files.

Takes a string or Buffer:

var fs = require('fs')
var parse = require('parse-bmfont-xml')

fs.readFileSync(__dirname+'/Arial.fnt', function(err, data) {
  var result = parse(data)
  console.log(result.info.face)   // "Arial"
  console.log(result.pages)       // [ 'sheet0.png' ]
  console.log(result.chars)       // [ ... char data ... ]
  console.log(result.kernings)    // [ ... kernings data ... ]
})

The spec for the returned JSON object is here. The input data should match the spec, see test/Nexa Light-32.fnt for an example.

See Also

See text-modules for related modules.

Usage

NPM

result = parse(data)

Parses data, a string or Buffer that represents ASCII (text) data of an AngelCode BMFont file. The returned result object looks like this:

{
     pages: [
         "sheet_0.png", 
         "sheet_1.png"
     ],
     chars: [
         { chnl, height, id, page, width, x, y, xoffset, yoffset, xadvance },
         ...
     ],
     info: { ... },
     common: { ... },
     kernings: [
         { first, second, amount }
     ]
}

License

MIT, see LICENSE.md for details.