diff --git a/src/gameobjects/BitmapText.js b/src/gameobjects/BitmapText.js index 24cdfd5c3..84e67419d 100644 --- a/src/gameobjects/BitmapText.js +++ b/src/gameobjects/BitmapText.js @@ -24,7 +24,8 @@ * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner * Littera (Web-based, free): http://kvazars.com/littera/ * -* For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of running a valid XML file through the popular X2JS library. +* For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of +* converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson * * @class Phaser.BitmapText * @constructor diff --git a/src/loader/LoaderParser.js b/src/loader/LoaderParser.js index c5b9f0406..afae965c4 100644 --- a/src/loader/LoaderParser.js +++ b/src/loader/LoaderParser.js @@ -94,7 +94,7 @@ Phaser.LoaderParser = { jsonBitmapFont: function (json, baseTexture, xSpacing, ySpacing) { var data = { - font: json.font.info._font, + font: json.font.info._face, size: parseInt(json.font.info._size, 10), lineHeight: parseInt(json.font.common._lineHeight, 10) + ySpacing, chars: {} @@ -120,15 +120,19 @@ Phaser.LoaderParser = { ); - json.font.kernings.kerning.forEach( + if (json.font.kernings && json.font.kernings.kerning) { - function parseKerning(kerning) { + json.font.kernings.kerning.forEach( - data.chars[kerning._second].kerning[kerning._first] = parseInt(kerning._amount, 10); + function parseKerning(kerning) { - } + data.chars[kerning._second].kerning[kerning._first] = parseInt(kerning._amount, 10); - ); + } + + ); + + } return this.finalizeBitmapFont(baseTexture, data);