Improving JSON BitmapText implementation

This commit is contained in:
Charlo 2015-07-16 13:30:55 +02:00
parent f552615982
commit 795a7c80a8
2 changed files with 12 additions and 7 deletions

View file

@ -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

View file

@ -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,6 +120,8 @@ Phaser.LoaderParser = {
);
if (json.font.kernings && json.font.kernings.kerning) {
json.font.kernings.kerning.forEach(
function parseKerning(kerning) {
@ -130,6 +132,8 @@ Phaser.LoaderParser = {
);
}
return this.finalizeBitmapFont(baseTexture, data);
},