As a Roblox developer, it is impossible to rely on MaxVisibleGraphemes
to utilize AutomaticSize
for gradually increasing text container sizes.
My use-case:
When utilizing a for loop to update text, it becomes impossible to use richtext without custom implementations. The first gif below shows how a textlabel will visibly scale when relying on
local text = "Hello, I am your host crash, welcome!"
textlabel.Size = Udim2.new(0, 0, 0.06, 0)
textlabel.AutomaticSize = Enum.AutomaticSize.X
textlabel.Text = ""
for start,bound in utf8.graphemes(text) do
textlabel.Text = string.sub(text,1,bound)
-- add 0.021 seconds worth of yielding
end
Because of this approach, Richtext needs to remain unnused.
This resizing style is the desired effect of my usecase
However, when implementing Roblox’ native Richtext feature, we cannot rely on string.sub because that will remove the Richtext rendering.
Instead, we need to rely on MaxVisibleGraphemes
in order to keep the richtext in tact.
textlabel.Size = Udim2.new(0, 0, 0.06, 0)
textlabel.AutomaticSize = Enum.AutomaticSize.X
textlabel.MaxVisibleGraphemes = 0
--use a for loop to do textlabel.MaxVisibleGraphemes += 1
-- add 0.021 seconds worth of yielding
When approaching the issue with MaxVisibleGraphemes, the textlabel will scale like this, skipping the gradual UI size increase :
This effect is not desired
It has been pointed out on a thread previously:
If Roblox is able to address this issue, by adding a new property which makes AutomaticSize take MaxVisibleGraphemes into account by setting it to true for backwards compatibility, it would improve my development experience because: native UI behavior would be more consistent and I would not require workarounds for implementing richtext on dynamically scaling UI by using tons of custom code.