# Text wrapping works wierd with right-aligned text

**URL:** <https://forums.unrealengine.com/t/text-wrapping-works-wierd-with-right-aligned-text/405392>\
**Category:** UI\
**Tags:** align, text, unreal-engine, question, UMG\
**Created:** [September 25, 2017, 8:15am UTC](https://forums.unrealengine.com/t/text-wrapping-works-wierd-with-right-aligned-text/405392 "2017-09-25T08:15:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![GameRaccoon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gameraccoon/32/642426_2.png) [@GameRaccoon](https://forums.unrealengine.com/u/GameRaccoon)\
**Post date:** [September 25, 2017, 8:15am UTC](https://forums.unrealengine.com/t/text-wrapping-works-wierd-with-right-aligned-text/405392/1 "2017-09-25T08:15:09Z")

</div>

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

**Screenshots**

screenshot1 (Look at the right indent of the first line)  
 ![bad wrapped text](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/8/6d8aff901a6bbb713ad9e821d2e66b2a22b91b7f.png "bad wrapped text")

screenshot2

 ![bad wrapped text](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/9/a/a9aee377b0939957284c6ccd9b3954499c171d3e.png "bad wrapped text")

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 25, 2017, 8:47am UTC](https://forums.unrealengine.com/t/text-wrapping-works-wierd-with-right-aligned-text/405392/2 "2017-09-25T08:47:33Z")

</div>

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

 ![214567-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/c/a7cd8cee6cba51beb87ca1bf0feb44b68afe449f.png)

---

<div class="post-metadata">

**Author:** ![GameRaccoon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gameraccoon/32/642426_2.png) [@GameRaccoon](https://forums.unrealengine.com/u/GameRaccoon)\
**Post date:** [September 25, 2017, 9:29am UTC](https://forums.unrealengine.com/t/text-wrapping-works-wierd-with-right-aligned-text/405392/3 "2017-09-25T09:29:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 25, 2017, 9:40am UTC](https://forums.unrealengine.com/t/text-wrapping-works-wierd-with-right-aligned-text/405392/4 "2017-09-25T09:40:32Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![GameRaccoon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gameraccoon/32/642426_2.png) [@GameRaccoon](https://forums.unrealengine.com/u/GameRaccoon)\
**Post date:** [September 25, 2017, 10:17am UTC](https://forums.unrealengine.com/t/text-wrapping-works-wierd-with-right-aligned-text/405392/5 "2017-09-25T10:17:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 25, 2017, 11:43am UTC](https://forums.unrealengine.com/t/text-wrapping-works-wierd-with-right-aligned-text/405392/6 "2017-09-25T11:43:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jamie\_Dale](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jamie_dale/32/1165413_2.png) [@Jamie\_Dale](https://forums.unrealengine.com/u/Jamie_Dale)\
**Post date:** [September 25, 2017, 2:28pm UTC](https://forums.unrealengine.com/t/text-wrapping-works-wierd-with-right-aligned-text/405392/7 "2017-09-25T14:28:03Z")

</div>

> 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](https://issues.unrealengine.com/issue/UE-50266) (not currently public, should be soon) to track this.
