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).
Screenshots
screenshot1 (Look at the right indent of the first line)
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.
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?
“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.
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.
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.