GetTextBoundsAsync TextWrapped mobile device inconsistencies

The problem:
I have recently discovered an extremely annoying bug with TextService:GetTextBoundsAsync() that appears to only occur on mobile devices (or at least on my Samsung A34 mobile phone!)

Where it occurs:
I have not been able to successfully recreate this bug on my PC at all, not in-game or in studio. I can’t even recreate it using the emulator tool and emulating my phone’s exact screen resolution and DPI (2340x1080, 393 DPI - I even tried downscaling the resolution by 4x just in case that was the issue, but I still couldn’t recreate it.)

What I believe is going wrong here:
It seems to be caused by using a confined width in the GetTextBoundsParams, as TextWrapped just causes the text to be completely cut off and half of it to be unviewable.

Current behaviours:
Here’s what I expect it to behave like (captured on my PC):
image

And here’s what it behaves like on my phone:

How I narrowed it down:
I discovered it while working on my newest project’s UI, and I first assumed it was a problem with using a UIScale, but then I quickly came to realise it happened in an empty place.

Repro steps:
Here’s a public Roblox place so others can also compare both platforms: GetTextBoundsAsync mobile inconsistencies - Roblox
Try joining on your PC, inputting some text into the TextBox, and then try doing the same on your mobile phone (I’m not sure if tablets are also affected or not since I don’t have one to test on at the moment)

Here’s the RBXL file for those only testing in Studio:
GetTextBoundsAsync Mobile Inconsistencies.rbxl (50.1 KB)

2 Likes

Thanks for the report! We’ll follow up when we have an update for you!

1 Like

Hi @Glitchifyed , thanks for reporting this issue! Quick workaround if the issue is blocking you - turn on the multiline property for the textboxes which should wrap correctly. Meanwhile we are working on fixing the issue while multiline==false prevents from it being correctly wrapped!

Is there a workaround for TextLabels too? It’s not just TextBoxes I was having issues with.
Upon further testing, it even TextLabels that aren’t even wrapping seem to also have inconsistent sizes on mobile.

Are you able to share a repro file with us? Thank you.

Nevermind, it looks like the TextLabel issue is probably something on my end as I’m not able to reproduce that issue in a separate place, unlike the TextBox issue that this report initially addressed.

1 Like

Hi @Glitchifyed , just following-up does the multiline workaround fix the issue temporarily? We may not have any quick fix for this special use case in the near future, it’d be great if the workaround can solve it for the time being!

Unfortunately it still appears to cut off prematurely even with MultiLine enabled on the TextBox, as well as TextBox scale just not working at all how it does on PC when actively focused and typing into it. It looks like on mobile text bounds just don’t work at all for whatever reason, because even when the text objects do scale correctly to the text given, the text will simply just cut off unexpectedly.