Changing FlxText Line Spacing

117 views
Skip to first unread message

Pizzamakesgames

unread,
Oct 8, 2015, 3:26:58 PM10/8/15
to HaxeFlixel
Hey there, HaxeFlixel community. I'm looking for a way to adjust the line spacing of a multiline text.

I'd just do it on the .ttf itself, though I've made the Font with BitFontMaker and there doesn't seem to be any option for that, it just calculates the spacing by the height of your biggest letter, which always ends up being too big for my taste.

I'm using the flixel-powertools' FlxTypeText and I've been looking through that as well as the FlxText.hx but havn't found any value regarding the line spacing, so I'm assuming Flixel doesn't really deal with that and just grabs the value from the .ttf, which would be bad for me.

Any help? Thank you.

SruloArt

unread,
Oct 8, 2015, 4:02:27 PM10/8/15
to HaxeFlixel
Do you mean "leading"? that's available with your regular TextFormat.

Pizzamakesgames

unread,
Oct 9, 2015, 8:29:53 AM10/9/15
to haxef...@googlegroups.com
leading might be what I'm looking for! I'm having trouble figuring out how to use TextFormat, though. That's a class of flash or openfl, right? I'm using FlxText.

NewFormat = new TextFormat("assets/fonts/SkullzFontv1.ttf", 16, 0xF074d8f, false, false, false, null, null, "left", 0, 0, 0, 1);
Text1.textField.setTextFormat(NewFormat);
Text1.textField.defaultTextFormat = NewFormat;
trace(Text1.textField.getTextFormat());

the trace:
Snow01.hx:81: { bold => false, font => SkullzFontv1, color => 252136847, size => 16, bullet => false, leftMargin => 0, tabStops => null, letterSpacing => 0, url => , italic => false, target => , underline => false, leading => 1, indent => 0, align => left, rightMargin => 0, kerning => false, blockIndent => 0 }

I seem to be doing something wrong.

edit: Wait. Actually, that trace is right. It is not changing anything about the text displayed in game though, so I've been assuming it was wrong as well.

Pizzamakesgames

unread,
Oct 10, 2015, 5:59:54 AM10/10/15
to HaxeFlixel
If I'm using FlxText instead of FlxTypeText it's working!

I'd like to have the functionalities of FlxTypeText, though. Maybe there could be a way to figure out what about FlxTypeText is causing the TextFormat to be overwritten?

SruloArt

unread,
Oct 10, 2015, 12:45:56 PM10/10/15
to HaxeFlixel
* Good idea, just open an issue in the flixel-addons repo :)
Reply all
Reply to author
Forward
0 new messages