When do
GetTextBoundsAsync.Text = "<font color='rgb(0,127,255)'>Hello World</font>
It’s getting the size of this FULL text. GetTextBoundsAsync should ONLY get ContentText. There is 0 reason for it to include rich text mark-ups
When do
GetTextBoundsAsync.Text = "<font color='rgb(0,127,255)'>Hello World</font>
It’s getting the size of this FULL text. GetTextBoundsAsync should ONLY get ContentText. There is 0 reason for it to include rich text mark-ups
I’m assuming you have GetTextBoundsParams.RichText
set to true in your repro?
If that property is set to true, it should certainly be returning only the bounds of the ContentText, and if it isn’t doing so, it is either a bug or just not enabled (but the FFlags say it should be enabled).
However, if the property is false; the API shouldn’t assume your TextLabel has RichText enabled as there are still use-cases where you may disable RichText on a TextLabel and getting inaccurate results over that would be just as problematic.
local TextBoundsParam = Instance.new("GetTextBoundsParams")
TextBoundsParam.Font = Font.new("rbxasset://fonts/families/Montserrat.json", Enum.FontWeight.Bold)
TextBoundsParam.Width = math.huge
TextBoundsParam.Text = HUD.Top.Info.Guess.Word.ContentText
TextBoundsParam.Size = HUD.Top.Info.Guess.Word.AbsoluteSize.Y
Is my full params. I’d assume RichText should be true by default?!
According to the API reference, the RichText property defaults to false; you may need to manually set it to true in this case. As for why it may default to false, there are several possible reasons for that, mainly what comes to mind:
RichText = false
may have been seen as the more common use-case. This is just an assumption from my development experience and not based on any actual statistics, though. Perhaps it is the other way around?GetTextBoundsParams
, so defaulting it to true would be breaking behaviour.I’m currently on mobile, so I can’t test this out myself to confirm, I’ll update this reply as I get to try this out later.