You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-17Lines changed: 19 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,17 @@
5
5
Loads an [AngelCode BMFont](http://www.angelcode.com/products/bmfont/) file in browser (with XHR) and node (with fs and [phin](https://github.com/ethanent/phin)), returning a [JSON representation](json-spec.md).
6
6
7
7
```js
8
-
var load =require('load-bmfont')
8
+
var load =require("load-bmfont");
9
+
10
+
load("fonts/Arial-32.fnt", function (err, font) {
11
+
if (err) throw err;
9
12
10
-
load('fonts/Arial-32.fnt', function(err, font) {
11
-
if (err)
12
-
throw err
13
-
14
13
//The BMFont spec in JSON form
15
-
console.log(font.common.lineHeight)
16
-
console.log(font.info)
17
-
console.log(font.chars)
18
-
console.log(font.kernings)
19
-
})
14
+
console.log(font.common.lineHeight);
15
+
console.log(font.info);
16
+
console.log(font.chars);
17
+
console.log(font.kernings);
18
+
});
20
19
```
21
20
22
21
Currently supported BMFont formats:
@@ -40,18 +39,21 @@ Loads a BMFont file with the `opt` settings and fires the callback with `(err, f
40
39
41
40
-`uri` or `url` the path (in Node) or URI
42
41
-`binary` boolean, whether the data should be read as binary, default false
43
-
- (in node) options for `fs.readFile` or `phin`
42
+
- (in node) options for `fs.readFile` or [phin](https://www.npmjs.com/package/phin)
44
43
- (in browser) options for [xhr](https://github.com/Raynos/xhr)
45
44
46
45
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.
0 commit comments