UITextSizeConstraint

Show Deprecated

A UITextSizeConstraint ensures that the size of text rendered by certain GuiObject classes (TextLabel, TextButton, or TextBox) lies within the range described by MaxTextSize and MinTextSize. It is meant to be used alongside TextLabel.TextScaled, which automatically scales text to fill its containing object. Like other UI constraints, it is applied when parented to the object to be constrained.

Constraints visual

It's recommended that no values lower than 9 be used for MinTextSize property, otherwise text may not be readable to most users.

Summary

Properties

The largest size in pixels the font is allowed to be.

The smallest size in pixels the font is allowed to be.

Events

Methods

Properties

MaxTextSize

this property indicates the largest size in pixels the font is allowed to be. It defaults to 1000 pixels and much be set larger than or equal to the UITextSizeConstraint's MinTextSize property.

Constraints visual

If the affected GuiObject has its TextScaled property set to true the text size constrained by this property will scale dynamically with the container's size. It will scale upwards with the GuiObject's size until the max size is reached, at which point it will stay constant if the UI element continues to grow.

MinTextSize

This property indicated the smallest size in pixels the font is allowed to be. This value defaults to 1 pixel and must be set less than or equal to UITextSizeConstraint.MaxTextSize.

Max and min constraints demo

If the affected GuiObject has its TextScaled property set to true the text size constrained by this property will scale dynamically with the container's size. It will scale downwards with the GuiObject's size until the min size is reached, at which point it will stay constant if the UI element continues to shrink.

Events

Methods