Skip to content

Commit 96507be

Browse files
committed
Added setLetterSpacing method and exported value in toJSON (phaserjs#3480)
1 parent 00929a0 commit 96507be

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

src/gameobjects/bitmaptext/static/BitmapText.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,27 @@ var BitmapText = new Class({
173173
return this;
174174
},
175175

176+
/**
177+
* Sets the letter spacing between each character of this Bitmap Text.
178+
* Can be a positive value to increase the space, or negative to reduce it.
179+
* Spacing is applied after the kerning values have been set.
180+
*
181+
* @method Phaser.GameObjects.BitmapText#setLetterSpacing
182+
* @since 3.4.0
183+
*
184+
* @param {number} [spacing=0] - The amount of horizontal space to add between each character.
185+
*
186+
* @return {Phaser.GameObjects.BitmapText} This Game Object.
187+
*/
188+
setLetterSpacing: function (spacing)
189+
{
190+
if (spacing === undefined) { spacing = 0; }
191+
192+
this.letterSpacing = spacing;
193+
194+
return this;
195+
},
196+
176197
/**
177198
* [description]
178199
*
@@ -278,7 +299,8 @@ var BitmapText = new Class({
278299
var data = {
279300
font: this.font,
280301
text: this.text,
281-
fontSize: this.fontSize
302+
fontSize: this.fontSize,
303+
letterSpacing: this.letterSpacing
282304
};
283305

284306
out.data = data;

0 commit comments

Comments
 (0)