Parses BMFont files (XML/TXT) to JSON objects, with a command-line tool for easy conversion.
example
var fs = ;var bmfont2json = ; //grab the Buffer or a string of our datavar data = fs; //the bitmap font data as an objectvar obj = ; //we can stringify it if we want...var json = JSON;
The function parses a string (or Node Buffer) that is either XML data (with a root element), or TXT data (following Bitmap Font spec).
The output looks something like the following JSON. It tries to stay true to the BMFont spec.
pages: "sheet_0.png" "sheet_1.png" chars: chnl height id page width x y xoffset yoffset xadvance ... info: ... common: ... kernings: first second amount
Related modules:
spec
See here for a more complete JSON output.
command-line tool
Converts a single file. If no output is provided, it prints to stdout.
Install
npm install bmfont2json -g
Usage:
bmfont2json file [options]
Options:
-o, --ouput the output path
-p, --pretty pretty print the JSON output