diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-08-11 07:51:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-11 07:51:57 +0200 |
commit | 2c88e1c15df283be9b67affa24b533f5858bc913 (patch) | |
tree | 9d254e070a7cae360c86d0f51be81eb568685f72 /scene/resources/text_line.h | |
parent | 588883eb4a34af10f06d2375ff1fac564058bfb4 (diff) | |
parent | 403f4902d02e70eebb684a199a8e2f14d4534ac0 (diff) | |
download | redot-engine-2c88e1c15df283be9b67affa24b533f5858bc913.tar.gz |
Merge pull request #51178 from Geometror/layout-options-textline-textparagraph
Various text layout improvements (TextLine, TextParagraph, Label, TextServer)
Diffstat (limited to 'scene/resources/text_line.h')
-rw-r--r-- | scene/resources/text_line.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scene/resources/text_line.h b/scene/resources/text_line.h index b773bd05be..9ed9c2f177 100644 --- a/scene/resources/text_line.h +++ b/scene/resources/text_line.h @@ -39,6 +39,16 @@ class TextLine : public RefCounted { GDCLASS(TextLine, RefCounted); +public: + enum OverrunBehavior { + OVERRUN_NO_TRIMMING, + OVERRUN_TRIM_CHAR, + OVERRUN_TRIM_WORD, + OVERRUN_TRIM_ELLIPSIS, + OVERRUN_TRIM_WORD_ELLIPSIS, + }; + +private: RID rid; int spacing_top = 0; int spacing_bottom = 0; @@ -48,6 +58,7 @@ class TextLine : public RefCounted { float width = -1.0; uint8_t flags = TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA; HAlign align = HALIGN_LEFT; + OverrunBehavior overrun_behavior = OVERRUN_TRIM_ELLIPSIS; Vector<float> tab_stops; @@ -87,6 +98,9 @@ public: void set_flags(uint8_t p_flags); uint8_t get_flags() const; + void set_text_overrun_behavior(OverrunBehavior p_behavior); + OverrunBehavior get_text_overrun_behavior() const; + void set_width(float p_width); float get_width() const; @@ -113,4 +127,6 @@ public: ~TextLine(); }; +VARIANT_ENUM_CAST(TextLine::OverrunBehavior); + #endif // TEXT_LINE_H |