From 309712551c97225272599c8f5f8ee84b72b5ef30 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:41:03 +0300 Subject: [TextParagraph/Button] Add support for line spacing. --- scene/gui/button.cpp | 2 ++ scene/gui/button.h | 1 + 2 files changed, 3 insertions(+) (limited to 'scene/gui') diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 0a5f2ec6c7..507e1f5068 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -568,6 +568,7 @@ void Button::_shape(Ref<TextParagraph> p_paragraph, String p_text) { } autowrap_flags = autowrap_flags | TextServer::BREAK_TRIM_EDGE_SPACES; p_paragraph->set_break_flags(autowrap_flags); + p_paragraph->set_line_spacing(theme_cache.line_spacing); if (text_direction == Control::TEXT_DIRECTION_INHERITED) { p_paragraph->set_direction(is_layout_rtl() ? TextServer::DIRECTION_RTL : TextServer::DIRECTION_LTR); @@ -840,6 +841,7 @@ void Button::_bind_methods() { BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Button, icon_max_width); BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Button, align_to_largest_stylebox); + BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Button, line_spacing); } Button::Button(const String &p_text) { diff --git a/scene/gui/button.h b/scene/gui/button.h index 5f4429bc1d..e8e68f49bb 100644 --- a/scene/gui/button.h +++ b/scene/gui/button.h @@ -100,6 +100,7 @@ private: int h_separation = 0; int icon_max_width = 0; + int line_spacing = 0; } theme_cache; void _shape(Ref<TextParagraph> p_paragraph = Ref<TextParagraph>(), String p_text = ""); -- cgit v1.2.3