Material Box

Material Box

WEB Design & Material Images

Godot - Changing the Line Spacing of a RichTextLabel

Godot

This code example shows how to change the default line spacing of text in a RichTextLabel using GDScript.


You can change the default line spacing in RichTextLabel by specifying the `line_separation` property with `add_theme_constant_override()`.
For the Label node, use `line_spacing` to set the line spacing.

var label = RichTextLabel.new()
add_child(label)
label.global_position = Vector2(0, 0)
label.size = Vector2(200,200)
label.text = "Line\r\nSeparation"

# Change the default line spacing in RichTextLabel
label.add_theme_constant_override("line_separation", 50)

Godot

TitleGodot - Changing the Line Spacing of a RichTextLabel

CategoryGodot

Created

Update

AuthorYousuke.U