mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
Improving JSON BitmapText implementation
This commit is contained in:
parent
f552615982
commit
795a7c80a8
2 changed files with 12 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue