# Textbox selection highlight doesn't respect margins/line height

**URL:** <https://forums.unrealengine.com/t/textbox-selection-highlight-doesnt-respect-margins-line-height/382011>\
**Category:** UI\
**Tags:** textbox, text, unreal-engine, selection, Widget, question, UMG\
**Created:** [January 16, 2017, 10:36am UTC](https://forums.unrealengine.com/t/textbox-selection-highlight-doesnt-respect-margins-line-height/382011 "2017-01-16T10:36:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob3DGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bob3DGames](https://forums.unrealengine.com/u/Bob3DGames)\
**Post date:** [January 16, 2017, 10:36am UTC](https://forums.unrealengine.com/t/textbox-selection-highlight-doesnt-respect-margins-line-height/382011/1 "2017-01-16T10:36:20Z")

</div>

I have an ‘Editable Text (Multi-line)’ box in a UMB widget for the player to enter notes.

When the margins are set to 0,0,0,0 with a line height percentage of 1, the text selection highlight appears correctly (see first image below).

![122198-texthighlight1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/e/5/8e5fda3d54a4131560c1d952270ab5e4fef0bd35.png)

However, if I change these values, the selection highlight doesn’t adjust to accommodate the new values. The next image shows the situation with margins at 0,-20,0,18 with a line height percentage of 0.7.

![122199-texthighlight2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/8/f/98f94117e8f6522ec0e6a5200313a9c2947fb11b.png)

The font size is 18 in both cases.

I have to use these strange values (and I’m glad these settings are here in the first place) as I’m using a font that behaves a little oddly - note how in the first picture (with default line values), the ‘y’ is cut off at the bottom. The choice of font is an artistic one that I don’t really want to change just because of this bug, although it’s not a huge deal. The font is ‘Kozuka Gothic Pro’ (which downloadable anywhere on an open license if you need to test it).

Thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [January 16, 2017, 4:18pm UTC](https://forums.unrealengine.com/t/textbox-selection-highlight-doesnt-respect-margins-line-height/382011/2 "2017-01-16T16:18:08Z")

</div>

Hello Bob3DGames,

I was able to reproduce this issue on our end. I have written up a report and I have submitted it to the developers for further consideration. I have provided a link to the public tracker. Please feel free to use the link provided for future updates.

Link: [Unreal Engine Issues and Bug Tracker (UE-40673)](https://issues.unrealengine.com/issue/UE-40673)

Make it a great day

---

<div class="post-metadata">

**Author:** ![Bob3DGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bob3DGames](https://forums.unrealengine.com/u/Bob3DGames)\
**Post date:** [January 16, 2017, 6:49pm UTC](https://forums.unrealengine.com/t/textbox-selection-highlight-doesnt-respect-margins-line-height/382011/3 "2017-01-16T18:49:29Z")

</div>

Great, thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_48f2118e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_48f2118e](https://forums.unrealengine.com/u/anonymous_user_48f2118e)\
**Post date:** [January 16, 2017, 7:11pm UTC](https://forums.unrealengine.com/t/textbox-selection-highlight-doesnt-respect-margins-line-height/382011/4 "2017-01-16T19:11:51Z")

</div>

I betcha the code assumes positive margins! 😛

---

<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:** [March 7, 2017, 9:50pm UTC](https://forums.unrealengine.com/t/textbox-selection-highlight-doesnt-respect-margins-line-height/382011/5 "2017-03-07T21:50:35Z")

</div>

Just to let you know that this highlight issue has been fixed for 4.16, and I’ve also added an option that lets you control whether the font layout uses the metrics or the bounding box to calculate the height, ascender, and descender.

In the case of the font you’re using here, the “bounding box” mode produces a more accurate line height, so you won’t need to work around it with margins.

---

<div class="post-metadata">

**Author:** ![Bob3DGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bob3DGames](https://forums.unrealengine.com/u/Bob3DGames)\
**Post date:** [March 8, 2017, 9:46am UTC](https://forums.unrealengine.com/t/textbox-selection-highlight-doesnt-respect-margins-line-height/382011/6 "2017-03-08T09:46:24Z")

</div>

Excellent, thanks!
