diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-07-13 13:10:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 13:10:42 +0200 |
commit | aab6dc301cc2da010ad44da5c08ba3686ef9238a (patch) | |
tree | 269b0c913e3e5145f5ed9c449df8a22992adbef2 /doc | |
parent | dd274139073da7119dfe8801c8dd29275c5fd830 (diff) | |
parent | 56a8d3f30c09fdc03b19ef48a97d344ffe2df974 (diff) |
Merge pull request #50086 from Geometror/label-improve-layout-options
Improvements to Label's layout options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/Label.xml | 34 | ||||
-rw-r--r-- | doc/classes/TextServer.xml | 28 |
2 files changed, 60 insertions, 2 deletions
diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml index 0789ac9010..ca22567ad5 100644 --- a/doc/classes/Label.xml +++ b/doc/classes/Label.xml @@ -75,8 +75,8 @@ <member name="align" type="int" setter="set_align" getter="get_align" enum="Label.Align" default="0"> Controls the text's horizontal align. Supports left, center, right, and fill, or justify. Set it to one of the [enum Align] constants. </member> - <member name="autowrap" type="bool" setter="set_autowrap" getter="has_autowrap" default="false"> - If [code]true[/code], wraps the text inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. + <member name="autowrap_mode" type="int" setter="set_autowrap_mode" getter="get_autowrap_mode" enum="Label.AutowrapMode" default="0"> + If set to something other than [constant AUTOWRAP_OFF], the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. To see how each mode behaves, see [enum AutowrapMode]. </member> <member name="clip_text" type="bool" setter="set_clip_text" getter="is_clipping_text" default="false"> If [code]true[/code], the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally. @@ -107,6 +107,9 @@ <member name="text_direction" type="int" setter="set_text_direction" getter="get_text_direction" enum="Control.TextDirection" default="0"> Base text writing direction. </member> + <member name="text_overrun_behavior" type="int" setter="set_text_overrun_behavior" getter="get_text_overrun_behavior" enum="Label.OverrunBehavior" default="0"> + Sets the clipping behavior when the text exceeds the node's bounding rectangle. See [enum OverrunBehavior] for a description of all modes. + </member> <member name="uppercase" type="bool" setter="set_uppercase" getter="is_uppercase" default="false"> If [code]true[/code], all the text displays as UPPERCASE. </member> @@ -142,6 +145,33 @@ <constant name="VALIGN_FILL" value="3" enum="VAlign"> Align the whole text by spreading the rows. </constant> + <constant name="AUTOWRAP_OFF" value="0" enum="AutowrapMode"> + Autowrap is disabled. + </constant> + <constant name="AUTOWRAP_ARBITRARY" value="1" enum="AutowrapMode"> + Wraps the text inside the node's bounding rectangle by allowing to break lines at arbitrary positions, which is useful when very limited space is available. + </constant> + <constant name="AUTOWRAP_WORD" value="2" enum="AutowrapMode"> + Wraps the text inside the node's bounding rectangle by soft-breaking between words. + </constant> + <constant name="AUTOWRAP_WORD_SMART" value="3" enum="AutowrapMode"> + Behaves similarly to [constant AUTOWRAP_WORD], but force-breaks a word if that single word does not fit in one line. + </constant> + <constant name="OVERRUN_NO_TRIMMING" value="0" enum="OverrunBehavior"> + No text trimming is performed. + </constant> + <constant name="OVERRUN_TRIM_CHAR" value="1" enum="OverrunBehavior"> + Trims the text per character. + </constant> + <constant name="OVERRUN_TRIM_WORD" value="2" enum="OverrunBehavior"> + Trims the text per word. + </constant> + <constant name="OVERRUN_TRIM_ELLIPSIS" value="3" enum="OverrunBehavior"> + Trims the text per character and adds an ellipsis to indicate that parts are hidden. + </constant> + <constant name="OVERRUN_TRIM_WORD_ELLIPSIS" value="4" enum="OverrunBehavior"> + Trims the text per word and adds an ellipsis to indicate that parts are hidden. + </constant> </constants> <theme_items> <theme_item name="font" type="Font"> diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml index c943946ab3..0f9318fda1 100644 --- a/doc/classes/TextServer.xml +++ b/doc/classes/TextServer.xml @@ -1088,6 +1088,19 @@ Returns composite character end position closest to the [code]pos[/code]. </description> </method> + <method name="shaped_text_overrun_trim_to_width"> + <return type="void"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="width" type="float" default="0"> + </argument> + <argument index="2" name="overrun_trim_flags" type="int" default="0"> + </argument> + <description> + Trims text if it exceeds the given width. + </description> + </method> <method name="shaped_text_prev_grapheme_pos"> <return type="int"> </return> @@ -1260,6 +1273,21 @@ <constant name="BREAK_GRAPHEME_BOUND" value="64" enum="LineBreakFlag"> Break the line between any unconnected graphemes. </constant> + <constant name="OVERRUN_NO_TRIMMING" value="0" enum="TextOverrunFlag"> + No trimming is performed. + </constant> + <constant name="OVERRUN_TRIM" value="1" enum="TextOverrunFlag"> + Trims the text when it exceeds the given width. + </constant> + <constant name="OVERRUN_TRIM_WORD_ONLY" value="2" enum="TextOverrunFlag"> + Trims the text per word instead of per grapheme. + </constant> + <constant name="OVERRUN_ADD_ELLIPSIS" value="4" enum="TextOverrunFlag"> + Determines whether an ellipsis should be added at the end of the text. + </constant> + <constant name="OVERRUN_ENFORCE_ELLIPSIS" value="8" enum="TextOverrunFlag"> + Determines whether the ellipsis at the end of the text is enforced and may not be hidden. + </constant> <constant name="GRAPHEME_IS_RTL" value="2" enum="GraphemeFlag"> Grapheme is part of right-to-left or bottom-to-top run. </constant> |