Description
The WrapAnywhere
field is a member of the TextFlag
enumeration in the Sandbox namespace. It specifies that text can be wrapped at any character, allowing for more flexible text layout when space is constrained. This flag is particularly useful when dealing with narrow containers where word wrapping might not be sufficient.
Usage
Use the WrapAnywhere
flag when you need to ensure that text can be broken at any character to fit within a given space. This can be combined with other TextFlag
values to achieve the desired text alignment and wrapping behavior.
Example
// Example of using WrapAnywhere with Graphics.DrawText
Graphics.DrawText("This is a long text that needs to wrap anywhere.", new Vector2(10, 10), Color.White, TextFlag.WrapAnywhere);