summaryrefslogtreecommitdiff
path: root/scene/resources/text_paragraph.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/text_paragraph.h')
-rw-r--r--scene/resources/text_paragraph.h30
1 files changed, 26 insertions, 4 deletions
diff --git a/scene/resources/text_paragraph.h b/scene/resources/text_paragraph.h
index a34e745090..ee7bbab9c5 100644
--- a/scene/resources/text_paragraph.h
+++ b/scene/resources/text_paragraph.h
@@ -39,19 +39,33 @@
class TextParagraph : public RefCounted {
GDCLASS(TextParagraph, RefCounted);
+public:
+ enum OverrunBehavior {
+ OVERRUN_NO_TRIMMING,
+ OVERRUN_TRIM_CHAR,
+ OVERRUN_TRIM_WORD,
+ OVERRUN_TRIM_ELLIPSIS,
+ OVERRUN_TRIM_WORD_ELLIPSIS,
+ };
+
+private:
RID dropcap_rid;
int dropcap_lines = 0;
Rect2 dropcap_margins;
RID rid;
- Vector<RID> lines;
+ Vector<RID> lines_rid;
int spacing_top = 0;
int spacing_bottom = 0;
- bool dirty_lines = true;
+ bool lines_dirty = true;
float width = -1.0;
+ int max_lines_visible = -1;
+
uint8_t flags = TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA;
+ OverrunBehavior overrun_behavior = OVERRUN_NO_TRIMMING;
+
HAlign align = HALIGN_LEFT;
Vector<float> tab_stops;
@@ -86,8 +100,8 @@ public:
void clear_dropcap();
bool add_string(const String &p_text, const Ref<Font> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "");
- bool add_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align = VALIGN_CENTER, int p_length = 1);
- bool resize_object(Variant p_key, const Size2 &p_size, VAlign p_inline_align = VALIGN_CENTER);
+ bool add_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1);
+ bool resize_object(Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER);
void set_align(HAlign p_align);
HAlign get_align() const;
@@ -97,9 +111,15 @@ 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;
+ void set_max_lines_visible(int p_lines);
+ int get_max_lines_visible() const;
+
Size2 get_non_wraped_size() const;
Size2 get_size() const;
@@ -140,4 +160,6 @@ public:
~TextParagraph();
};
+VARIANT_ENUM_CAST(TextParagraph::OverrunBehavior);
+
#endif // TEXT_PARAGRAPH_H