Socket
Socket
Sign inDemoInstall

parse-bmfont-ascii

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    parse-bmfont-ascii

parses ASCII BMFont files to a JavaScript object


Version published
Weekly downloads
1.1M
increased by3.46%
Maintainers
1
Install size
5.85 kB
Created
Weekly downloads
 

Readme

Source

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](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.

Keywords

FAQs

Last updated on 14 Mar 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc