load-bmfont

WebJar for load-bmfont

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

load-bmfont
Last Version

Last Version

1.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

load-bmfont
WebJar for load-bmfont
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/Jam3/load-bmfont

Download load-bmfont

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/load-bmfont/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>load-bmfont</artifactId>
    <version>1.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/load-bmfont/
implementation 'org.webjars.npm:load-bmfont:1.4.0'
// https://jarcasting.com/artifacts/org.webjars.npm/load-bmfont/
implementation ("org.webjars.npm:load-bmfont:1.4.0")
'org.webjars.npm:load-bmfont:jar:1.4.0'
<dependency org="org.webjars.npm" name="load-bmfont" rev="1.4.0">
  <artifact name="load-bmfont" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='load-bmfont', version='1.4.0')
)
libraryDependencies += "org.webjars.npm" % "load-bmfont" % "1.4.0"
[org.webjars.npm/load-bmfont "1.4.0"]

Dependencies

compile (8)

Group / Artifact Type Version
org.webjars.npm : parse-bmfont-binary jar [1.0.5,2)
org.webjars.npm : phin jar [2.9.1,3)
org.webjars.npm : buffer-equal jar [0.0.1]
org.webjars.npm : parse-bmfont-xml jar [1.1.4,2)
org.webjars.npm : xtend jar [4.0.0,5)
org.webjars.npm : parse-bmfont-ascii jar [1.0.3,2)
org.webjars.npm : xhr jar [2.0.1,3)
org.webjars.npm : mime jar [1.3.4,2)

Project Modules

There are no modules declared in this project.

load-bmfont

stable

Loads an AngelCode BMFont file in browser (with XHR) and node (with fs and phin), returning a JSON representation.

var load = require('load-bmfont')

load('fonts/Arial-32.fnt', function(err, font) {
  if (err)
    throw err
  
  //The BMFont spec in JSON form
  console.log(font.common.lineHeight)
  console.log(font.info)
  console.log(font.chars)
  console.log(font.kernings)
})

Currently supported BMFont formats:

  • ASCII (text)
  • JSON
  • XML
  • binary

See Also

See text-modules for related modules.

Usage

NPM

load(opt, cb)

Loads a BMFont file with the opt settings and fires the callback with (err, font) params once finished. If opt is a string, it is used as the URI. Otherwise the options can be:

  • uri or url the path (in Node) or URI
  • binary boolean, whether the data should be read as binary, default false
  • (in node) options for fs.readFile or phin
  • (in browser) options for xhr

To support binary files in the browser and Node, you should use binary: true. Otherwise the XHR request might come in the form of a UTF8 string, which will not work with binary files. This also sets up the XHR object to override mime type in older browsers.

load({ 
  uri: 'fonts/Arial.bin', 
  binary: true
}, function(err, font) {
  console.log(font)
})

License

MIT, see LICENSE.md for details.

org.webjars.npm

Jam3

We create modern experiences for tomorrow’s brands

Versions

Version
1.4.0
1.3.0
1.2.5
1.2.3