From 96507beda1b88890c70ca28be0dc0f9099e0a418 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 4 Apr 2018 11:34:39 +0100 Subject: [PATCH] Added `setLetterSpacing` method and exported value in `toJSON` (#3480) --- .../bitmaptext/static/BitmapText.js | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/gameobjects/bitmaptext/static/BitmapText.js b/src/gameobjects/bitmaptext/static/BitmapText.js index f9525c571..9f5a31a8d 100644 --- a/src/gameobjects/bitmaptext/static/BitmapText.js +++ b/src/gameobjects/bitmaptext/static/BitmapText.js @@ -173,6 +173,27 @@ var BitmapText = new Class({ return this; }, + /** + * Sets the letter spacing between each character of this Bitmap Text. + * Can be a positive value to increase the space, or negative to reduce it. + * Spacing is applied after the kerning values have been set. + * + * @method Phaser.GameObjects.BitmapText#setLetterSpacing + * @since 3.4.0 + * + * @param {number} [spacing=0] - The amount of horizontal space to add between each character. + * + * @return {Phaser.GameObjects.BitmapText} This Game Object. + */ + setLetterSpacing: function (spacing) + { + if (spacing === undefined) { spacing = 0; } + + this.letterSpacing = spacing; + + return this; + }, + /** * [description] * @@ -278,7 +299,8 @@ var BitmapText = new Class({ var data = { font: this.font, text: this.text, - fontSize: this.fontSize + fontSize: this.fontSize, + letterSpacing: this.letterSpacing }; out.data = data;