Godot - Setting Text Wrapping in a RichTextLabel
This code example shows how to set text wrapping in a RichTextLabel using GDScript.
You can set text wrapping for a RichTextLabel's text by specifying the `autowrap_mode` property.
* `0` disables automatic wrapping.
* `1` wraps text at any position.
* `2` wraps text at word boundaries.
* `3` wraps text by splitting words at character boundaries.
The default value of the `autowrap_mode` property for a RichTextLabel node is `3`.
var label = RichTextLabel.new()
add_child(label)
label.global_position = Vector2(0, 0)
label.size = Vector2(200,200)
label.text = "Autowrap Mode"
# Disable automatic wrapping
label.autowrap_mode = 0
# Wrap text at any position
label.autowrap_mode = 1
# Wrap text at word boundaries
label.autowrap_mode = 2
# Wrap text by splitting words at character boundaries
label.autowrap_mode = 3