-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added letterSpacing
variable to FlxText
.
#3027
Conversation
spacing
variable to FlxText
.letterSpacing
variable to FlxText
.
nice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below for requested changes and provide a small use case
flixel/text/FlxText.hx
Outdated
* | ||
* The default value is `null`, which means that 0 pixels of letter spacing is used. | ||
*/ | ||
public var letterSpacing(default, set):Null<Float> = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- (default, set) will cause issues, since set_ letterSpacing only sets _defaultFormat.letterSpacing. meaning the following will happen:
text.letterSpacing = 1;
trace(text.letterSpacing); // null
We should add a getter that returns _defaultFormat.letterSpacing
- looks like the other fields avoid using Null and just use primitive types, I think Null should be avoided if possible. let's use
Float
and set the default value to 0, and also set the _defaultFormats initial letterSpacing to 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The letterSpace is null by default in openfl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That value cannot be getted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That value cannot be getted
Sure it can
The letterSpace is null by default in openfl
I understand, that's why i said "set the _defaultFormats initial letterSpacing to 0", specifically, here
also this is gonna wait until after the 5.6.1 release, which should happen soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reiterate:
set the _defaultFormats initial letterSpacing to 0
specifically here
Also:
provide a small use case
Usage example: import flixel.text.FlxText;
var text:FlxText = new FlxText(0, 0, 0, "Hello World", 64);
text.letterSpacing = 2.5;
text.screenCenter();
add(text); |
All good, I'll merge this after I get 5.6.1 released |
* Added `letterSpacing` variable to `FlxText`. (#3027) * Update FlxText.hx * `spacing` -> `letterSpacing`. * Oops * Update FlxText.hx * Update FlxText.hx * Fix negative animation frame number (#3028) * fix negative anim frame number sorting * use int abs * warn when sorting frames with invalid names * remove typo --------- Co-authored-by: George FunBook <gkurelic@gmail.com> * downgrade warnings and prevent more crashes * fix error in xml attribute check * pretty up unit test --------- Co-authored-by: Mihai Alexandru <77043862+MAJigsaw77@users.noreply.github.com> Co-authored-by: Timur <T1mL3arn@users.noreply.github.com>
Adds access to openfl's letterSpacing in FlxText instances.
related issue, letterSpacing doesn't work on html5 - openfl/openfl#1700