Text Spacing

Are there any parameters for letter, word, and line spacing for a TextNode?

Or are those settings apart of the font itself? Possibly stored in the .ttf file?

These settings are part of the font and are specified within the ttf file, but you can override two of them at load time with loader.loadFont(spaceAdvance = xx, lineHeight = xx).


Thanks for the reply, David. I’m using a DynamicTextFont, though. Any luck that I can do a similar type thing with it? I don’t see anything mentioned in the documentation.


That’s what I mean. You use loader.loadFont() to get a DynamicTextFont. Pass two additional parameters for spaceAdvance and lineHeight to this function.


Ahhh, I didn’t realize loader.loadFont was creating a DyamicTextFont. I was creating the font by:

font = DynamicTextFont("my_font.ttf")

to get a higher quality font at large text sizes. Thanks for your help.

You can do it that way too, but that doesn’t share the font data between multiple references. You might want that, of course, if you are fiddling with low-level parameters like this.

In this case you can adjust these two parameters via font.setSpaceAdvance() and font.setLineHeight(). These methods are inherited from the base class TextFont.