Text: Mutli line spacing

I’m trying to figure out how to reliably calculate the height a line of text based on the font size (variable) - I’m creating a “view area” for the text, and scrolling exactly one line at a time by pressing up or down keys. Finding out what the step value is less obvious than it seems.

lineSpacing, strokeThickness and padding.y are all 0. Basing it only on fontSize doesn’t appear to work because of the spacing added in between lines, but what that spacing is exactly is what I need to calculate based on the fontSize.

Anyone know what the deal is here?

Figure it out, nevermind :blush: haha so here it is:

There’s a function that belongs to Phaser.Text that isn’t documented, determineFontProperties (had to dig through updateText to find it. This apparently reveals the “true” font size based on the what has been rendered. So in my case to get the step size for scrolling one line at a time, it looks like this:

const textArea = game.add.text(0, 0, text, textStyle);
const textStep = textArea.determineFontProperties(textArea.style.font).fontSize;

In case anyone in the world might be using Phaser 2 and looking for this solution :wink:

If it’s fixed just add [Solved] :wink:

This could be useful. Thank you.