mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +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,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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue