Text AutomaticSizing/TextBounds Issue

Hello there!

The Context
So I’ve been trying to make a Changelogs UI as seen in the picture shown below


Which Consists of:
image
Major is the one with an image, Minor is the one without. The Changes TextLabel uses AutomaticSize for Y axis

The UI takes its text from a module that contains a table of each version’s details, here is an example of one of the version’s contents for the Changes TextLabel text that uses multiline strings for the table:

The Problem
So I’ve been experiencing where the automatic sizing misses a couple of lines/paragraphs on the Changes TextLabel leading to an overlap with the next changelog as seen below:
image

This happens in all really tall texts, which mostly include Major changelogs.

Tried Solutions

1. GetTextSize

S.Changes.Text = L[i].Content
local ActualTextBound = TextService:GetTextSize(L[i].Content,16,"SourceSans", Vector2.new(S.Changes.AbsoluteSize.X, 1000000000000))
S.Changes.Size = UDim2.new(1,0,0,ActualTextBound.Y)

produces pretty much the same result as AutomaticSize.

2. Manually increment the Y Textlabel offset size for each newline.

S.Changes.Text = L[i].Content
local ActualTextBound = 0, Spacing = 20
for rep in str:gmatch("\n") do
	ActualTextBound += Spacing
end
S.Changes.Size = UDim2.new(1,0,0,ActualTextBound.Y)

Can work at times with higher Spacing, but leads to shorter changelogs being much taller than the TextBound itself.

3. Make the Textbox really large and input the content to get the ‘actual TextBound’ and using that as the textlabel size.

-- the Changes TextLabel Y offset is already set by 10000000 by default.
S.Changes.Text = L[i].Content
local ActualTextBound =  S.Changes.TextBounds.Y
S.Changes.Size = UDim2.new(1,0,0,ActualTextBound)

I got a bit desperate, so this was a bit hacky, didn’t work either way as it still overlaps. Deeper look I think it’s because the textbounds it’s getting is NaN for some reason.
image

The only thing that worked was setting the TextLabel with RichText enabled, but due to the number of logs and paragraphs it takes a severe toll on performance, so skipped that.

Hope to see any solution or reasonings why this might happen, thanks!

3 Likes

Ok, so I think I might have found the reason behind this, which is basically how TextWrap reacts with automatic sizing.

But still haven’t found any true workaround yet.

1 Like

True workaround could be to wait for a fix. While I hear people say some of the UI issues work as intended, but like we want to do something specific which doesn’t exist yet and we tried to do it with TextWrapped and MultiLine but it doesn’t work.

So one workaround is either making a long long long automatic script that handles UI text, which probably is gonna be not worth it.

The other one is to just wait for a fix or something.

1 Like

1674065598095

Yeah i ended up redesigning the changelog to use pages instead of purely ScrollingGrame, thanks for the reply :smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.