convert-bmfont
v1.0.2
Published
converts a BMFont from one format to another
Downloads
11
Maintainers
Readme
convert-bmfont
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
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 jsonpretty
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.