diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-06-15 11:01:45 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-06-16 16:49:37 +0300 |
commit | b5c96df2771113cd9c5cb24b07b199a08a8ad917 (patch) | |
tree | 7dc5b5f47f3cefde77306c48619919060f576ea8 /servers | |
parent | ef6511fbb4b280ca81f18f89d89be7a7b6c706ec (diff) |
Move duplicate AutoWrap, Overrun and VisibleChar behavior enums to the TextServer.
Diffstat (limited to 'servers')
-rw-r--r-- | servers/text_server.cpp | 24 | ||||
-rw-r--r-- | servers/text_server.h | 28 |
2 files changed, 49 insertions, 3 deletions
diff --git a/servers/text_server.cpp b/servers/text_server.cpp index 41d9c74d82..fe5ade88a1 100644 --- a/servers/text_server.cpp +++ b/servers/text_server.cpp @@ -413,7 +413,7 @@ void TextServer::_bind_methods() { ClassDB::bind_method(D_METHOD("shaped_text_get_ellipsis_glyphs", "shaped"), &TextServer::_shaped_text_get_ellipsis_glyphs_wrapper); ClassDB::bind_method(D_METHOD("shaped_text_get_ellipsis_glyph_count", "shaped"), &TextServer::shaped_text_get_ellipsis_glyph_count); - ClassDB::bind_method(D_METHOD("shaped_text_overrun_trim_to_width", "shaped", "width", "overrun_trim_flags"), &TextServer::shaped_text_overrun_trim_to_width, DEFVAL(0), DEFVAL(OVERRUN_NO_TRIMMING)); + ClassDB::bind_method(D_METHOD("shaped_text_overrun_trim_to_width", "shaped", "width", "overrun_trim_flags"), &TextServer::shaped_text_overrun_trim_to_width, DEFVAL(0), DEFVAL(OVERRUN_NO_TRIM)); ClassDB::bind_method(D_METHOD("shaped_text_get_objects", "shaped"), &TextServer::shaped_text_get_objects); ClassDB::bind_method(D_METHOD("shaped_text_get_object_rect", "shaped", "key"), &TextServer::shaped_text_get_object_rect); @@ -470,6 +470,12 @@ void TextServer::_bind_methods() { BIND_ENUM_CONSTANT(JUSTIFICATION_AFTER_LAST_TAB); BIND_ENUM_CONSTANT(JUSTIFICATION_CONSTRAIN_ELLIPSIS); + /* AutowrapMode */ + BIND_ENUM_CONSTANT(AUTOWRAP_OFF); + BIND_ENUM_CONSTANT(AUTOWRAP_ARBITRARY); + BIND_ENUM_CONSTANT(AUTOWRAP_WORD); + BIND_ENUM_CONSTANT(AUTOWRAP_WORD_SMART); + /* LineBreakFlag */ BIND_ENUM_CONSTANT(BREAK_NONE); BIND_ENUM_CONSTANT(BREAK_MANDATORY); @@ -477,8 +483,22 @@ void TextServer::_bind_methods() { BIND_ENUM_CONSTANT(BREAK_GRAPHEME_BOUND); BIND_ENUM_CONSTANT(BREAK_WORD_BOUND_ADAPTIVE); - /* TextOverrunFlag */ + /* VisibleCharactersBehavior */ + BIND_ENUM_CONSTANT(VC_CHARS_BEFORE_SHAPING); + BIND_ENUM_CONSTANT(VC_CHARS_AFTER_SHAPING); + BIND_ENUM_CONSTANT(VC_GLYPHS_AUTO); + BIND_ENUM_CONSTANT(VC_GLYPHS_LTR); + BIND_ENUM_CONSTANT(VC_GLYPHS_RTL); + + /* OverrunBehavior */ BIND_ENUM_CONSTANT(OVERRUN_NO_TRIMMING); + BIND_ENUM_CONSTANT(OVERRUN_TRIM_CHAR); + BIND_ENUM_CONSTANT(OVERRUN_TRIM_WORD); + BIND_ENUM_CONSTANT(OVERRUN_TRIM_ELLIPSIS); + BIND_ENUM_CONSTANT(OVERRUN_TRIM_WORD_ELLIPSIS); + + /* TextOverrunFlag */ + BIND_ENUM_CONSTANT(OVERRUN_NO_TRIM); BIND_ENUM_CONSTANT(OVERRUN_TRIM); BIND_ENUM_CONSTANT(OVERRUN_TRIM_WORD_ONLY); BIND_ENUM_CONSTANT(OVERRUN_ADD_ELLIPSIS); diff --git a/servers/text_server.h b/servers/text_server.h index a67ad8fc9e..6339dde0ea 100644 --- a/servers/text_server.h +++ b/servers/text_server.h @@ -64,6 +64,21 @@ public: JUSTIFICATION_CONSTRAIN_ELLIPSIS = 1 << 4, }; + enum VisibleCharactersBehavior { + VC_CHARS_BEFORE_SHAPING, + VC_CHARS_AFTER_SHAPING, + VC_GLYPHS_AUTO, + VC_GLYPHS_LTR, + VC_GLYPHS_RTL, + }; + + enum AutowrapMode { + AUTOWRAP_OFF, + AUTOWRAP_ARBITRARY, + AUTOWRAP_WORD, + AUTOWRAP_WORD_SMART + }; + enum LineBreakFlag { // LineBreakFlag can be passed in the same value as the JustificationFlag, do not use the same values. BREAK_NONE = 0, BREAK_MANDATORY = 1 << 5, @@ -72,8 +87,16 @@ public: BREAK_WORD_BOUND_ADAPTIVE = 1 << 6 | 1 << 8, }; + enum OverrunBehavior { + OVERRUN_NO_TRIMMING, + OVERRUN_TRIM_CHAR, + OVERRUN_TRIM_WORD, + OVERRUN_TRIM_ELLIPSIS, + OVERRUN_TRIM_WORD_ELLIPSIS, + }; + enum TextOverrunFlag { - OVERRUN_NO_TRIMMING = 0, + OVERRUN_NO_TRIM = 0, OVERRUN_TRIM = 1 << 0, OVERRUN_TRIM_WORD_ONLY = 1 << 1, OVERRUN_ADD_ELLIPSIS = 1 << 2, @@ -522,6 +545,9 @@ public: #define TS TextServerManager::get_singleton()->get_primary_interface() +VARIANT_ENUM_CAST(TextServer::VisibleCharactersBehavior); +VARIANT_ENUM_CAST(TextServer::AutowrapMode); +VARIANT_ENUM_CAST(TextServer::OverrunBehavior); VARIANT_ENUM_CAST(TextServer::Direction); VARIANT_ENUM_CAST(TextServer::Orientation); VARIANT_ENUM_CAST(TextServer::JustificationFlag); |