Find number of lines in wrapped text block

Is there any way of figuring out how many lines a UMG TextBlock was wrapped to? Or at least whether or not it was wrapped?

I’m using the AutoWrapText property and want to change the justification if it has more than one line. I could check the DesiredSize of the text and check if the height is more than the size of one line but that doesn’t work generically if I change the font or text size so I’d like a better solution if at all possible. Thanks.

Would be interested in this as well. Did you find any solution?

I want to set a smaller font size when the text gets wrapped to the fourth line so that I’ll always end up having a max height of 3 lines. A scale box isn’t working because it scales down the complete text block including the line breaks so the width scales down as well…

I didn’t, sorry. The DesiredSize thing I mentioned is probably your best bet for now.

Yeah, I’m checking the height of getDesiredSize now and run it through a loop, changing the font size -1 each time until I’m below the max height or until I reach a minimum font size. That works for up to 248 characters max in my case. Guess that’s ok for now and if I really need longer reply texts I’ll just split them in two.

Thanks for the reply and the DesiredSize hint.

Maybe in your case you could put a temporary word (including capital letter and/or letters with ascender and descender - so for example Xfg) in an invisible textbox with your chosen font style and size to get the max line height before checking the DesiredSize of your real text to see if it’s higher than that.
That might help even when changing font style and size during runtime.