diff --git a/flixel/text/FlxText.hx b/flixel/text/FlxText.hx index 69a632b397..e010d537b3 100644 --- a/flixel/text/FlxText.hx +++ b/flixel/text/FlxText.hx @@ -59,6 +59,13 @@ class FlxText extends FlxSprite */ public var size(get, set):Int; + /** + * A number representing the amount of space that is uniformly distributed + * between all characters. The value specifies the number of pixels that are + * added to the advance after each character. + */ + public var letterSpacing(get, set):Float; + /** * The font used for this text (assuming that it's using embedded font). */ @@ -219,6 +226,7 @@ class FlxText extends FlxSprite textField.multiline = true; textField.wordWrap = true; _defaultFormat = new TextFormat(null, Size, 0xffffff); + letterSpacing = 0; font = FlxAssets.FONT_DEFAULT; _formatAdjusted = new TextFormat(); textField.defaultTextFormat = _defaultFormat; @@ -640,6 +648,18 @@ class FlxText extends FlxSprite return Size; } + inline function get_letterSpacing():Float + { + return _defaultFormat.letterSpacing; + } + + function set_letterSpacing(LetterSpacing:Float):Float + { + _defaultFormat.letterSpacing = LetterSpacing; + updateDefaultFormat(); + return LetterSpacing; + } + override function set_color(Color:FlxColor):Int { if (_defaultFormat.color == Color.to24Bit())