GetTextBoundsParams

Show Deprecated
Not Replicated

Pass this instance to TextService:GetTextBoundsAsync() to measure the size of text.

Code Samples

TextService: Measuring text size

1local TextService = game:GetService("TextService")
2
3local params = Instance.new("GetTextBoundsParams")
4params.Text = "hello world!"
5params.Font = Font.new("rbxasset://fonts/families/GrenzeGotisch.json", Enum.FontWeight.Thin)
6params.Size = 20
7params.Width = 200
8local size = TextService:GetTextBoundsAsync(params)
9
10print("The size of the text is:", size)

Summary

Properties

The Font of the text being measured.

The size of the text being measured.

The text being measured.

The width of the container for line breaking.

Events

Methods

Properties

Font

The Font of the text being measured. Corresponds to the TextLabel.FontFace property on text objects.

Not to be confused with Font. This is an object that you can create using Font.new().

Size

The size of the text that is being measured. Corresponds to the TextLabel.TextSize property.

Text

The text being measured.

Width

The width of the container for line breaking. By default, the value is 0, which means no line breaking will be performed. You can set it to the width of the container that you'll be putting the text into.

Events

Methods