Material Box

Material Box

WEBデザイン & フリー素材

Godot - RichTextLabelのテキストの行間を変更する

Godot

RichTextLabelでデフォルトのテキストの行間を変更するGDScriptのコード例です。


add_theme_constant_override()で「line_separation」プロパティを指定する事でRichTextLabelでのデフォルトのテキストの行間を変更する事が可能です。
Labelノードの場合は「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"

# RichTextLabelでデフォルトのテキストの色を変更する
label.add_theme_constant_override("line_separation", 50)

Godot

TitleGodot - RichTextLabelのテキストの行間を変更する

CategoryGodot

Created

Update

AuthorYousuke.U