x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.14
Tags:
more ▼

asked Dec 19 '16 at 06:50 PM in Using UE4

avatar image

kgamble
924 42 61 209

avatar image Corncutter Feb 22 '17 at 12:29 PM

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...

avatar image kgamble Feb 22 '17 at 04:02 PM

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

avatar image Corncutter Feb 22 '17 at 04:19 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question