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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Text wrapping works wierd with right-aligned text

What I did

Used Text widget in UMG with right-aligned Justification and "Auto Wrap Text" set to true (see screenshot2 below). Then put a text with spaces that should be automatically wrapped.

What I got

On the lines that are wrapped automatically spaces are saved at the end of the line, so the final text is looking aligned wrong (see screenshot1 below).

What I expected to get

Text wrapped aligned to right side without different indent from the right border (without unexpected spaces at the end).

Reproduction frequency

Reproduced every time with different texts and widget sizes and fonts if text is automatically wrapped (see "What I did" above).


screenshot1 (Look at the right indent of the first line) bad wrapped text

screenshot2 bad wrapped text

Product Version: UE 4.16
more ▼

asked Sep 25 '17 at 08:15 AM in Bug Reports

avatar image

57 5 10 18

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

1 answer: sort voted first

Spaces aren't automatically removed. For something like this, you do not even need autowrapping, just hit shift+enter in the text box:

alt text

capture.png (38.9 kB)
more ▼

answered Sep 25 '17 at 08:47 AM

avatar image

14.7k 76 25 61

avatar image RuWhyNot Sep 25 '17 at 09:29 AM

It's not possible when Text widget width is variable (e.g. from screen size).

Even if that was possible, we get some of that texts from server, so gamedesigners needed to do additional work to make sure that every text have right manual wraps.

Also we have different localizations that would make it even more painful.

And also we reuse that texts in different screens (e.g. reward names) so we would need to create, store and receive from the server the same texts multiple times because of different manual wraps.

avatar image Everynone Sep 25 '17 at 09:40 AM

You can format the text with format text node, add linebreak tags and so on. That's pretty standard when working with a loc database. You then create a base widget with formatting routines, extend from it and place it in named slot. You go through all that trouble proving you have a text heavy game, that is. Not sure what is the scope you're working with. If you need something even more advanced, you will very quickly find out that blueprints do have limitations.

Not sure if I follow the rest; could you provide an example of a scenario that's awkward/impossible to work with?

I admit the system could be more flexible and if I understood you're right, you're requesting a tick box for automatic white space removal?

avatar image RuWhyNot Sep 25 '17 at 10:17 AM

"Format text" does not know anything about layouts where the text will be placed. So I'm not sure how I can use it for fix this problem.

Possible scenario:

For example, we have to design a screen with fluid width layout for mobile phones. E.g. inventory screen. One of the texts that represent the name of an inventory item should be aligned to the right side and can have multiple lines.

And then have a situation described in the topic. If then we try to use your solution we would have these problems:

  • If the text change width from screen size, this approach can't be used or we need to make a text for every screen width variant.

  • We could have plenty of different inventory items (their names also can be generated) so even we had a Text widget with a fixed width we got big problems here.

  • As I said if we have different localizations we would need to review every text variant in every language to make sure everything is alright (sure it can be thousands of texts that are edited from time to time).

  • If we use item names not only in this screen (of course we do) then we need to have two variants of the name of each inventory item (one for this screen and one for other screens).

Every point above makes the solution that you proposed not suitable for this case.

you're requesting a tick box for automatic white space removal?

I don't know why Text needs to store additional whitespace after each auto-wrapped line. If there is some reason then yes, the checkbox will be a good solution. If there is no reason then I'd prefer removing that spaces by default as a more general solution.

avatar image Jamie Dale STAFF Sep 25 '17 at 02:28 PM

I don't know why Text needs to store additional whitespace after each auto-wrapped line

This is a bug. We try and mimic what word processors do when wrapping text and generally avoid trailing whitespace when measuring for wrapping. I've raised UE-50266 (not currently public, should be soon) to track this.

avatar image Everynone Sep 25 '17 at 11:43 AM

I was half expecting you to say you need a perfectly right-aligned paragraph. No dice, then. This feature is currently unsupported by the blueprint system.

A couple of extra options in the wrapping policy would not hurt.

Good luck.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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