convert-bmfont

1.0.2 • Public • Published

convert-bmfont

stable

A command-line tool to convert a BMFont files from one format to another. Defaults to outputting a JSON representation for composition with other modules.

Installation:

npm install convert-bmfont -g

Usage:

#convert text to binary 
convert-bmfont Arial.xml --format bin > Arial.bin
 
#convert to pretty-printed JSON 
convert-bmfont Arial.fnt --pretty > Arial.json

Currently supported BMFont inputs:

  • XML
  • ASCII (text)
  • binary
  • JSON

Currently supported outputs:

  • JSON (default)
  • binary

See Also

See text-modules for related modules.

Usage

NPM

CLI

Prints result to stdout.

Usage:
  convert-bmfont input [opt]

Options:
  -f, --format   the format (bin, json) - default json
  -p, --pretty   pretty-print if output is json

API

convert(file, opt, cb)

Converts the file with the given options, and calls the cb on completion.

Opt:

  • format can be "json", "bin" (or "binary") - default json
  • pretty whether to pretty-print the JSON output
convert(__dirname+'/Blah.fnt', {
  pretty: true,
  format: 'json'
}, function(err, data) {
  if (err) throw err
  //data may be a Buffer or string
  process.stdout.write(data)
})

License

MIT, see LICENSE.md for details.

Dependencies (4)

Dev Dependencies (3)

Package Sidebar

Install

npm i convert-bmfont

Weekly Downloads

5

Version

1.0.2

License

MIT

Last publish

Collaborators

  • mattdesl