diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-11-28 09:03:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-28 09:03:15 +0100 |
commit | a6751e6c58e73d6b8d04e98bba5fb6e380fdf34f (patch) | |
tree | bf22de8b8d89dee6a3b59c22adacff8f62a8d5eb /doc/classes/CanvasItem.xml | |
parent | bd846001327dacd35a84b0759f8b7ca8b892e841 (diff) | |
parent | 7e2c0ffd1a19d5806a7fcf57e25d2465f7a8f8b6 (diff) |
Merge pull request #41100 from bruvzg/ctl_text_server_interface
[Complex Text Layouts] Implement TextServer interface.
Diffstat (limited to 'doc/classes/CanvasItem.xml')
-rw-r--r-- | doc/classes/CanvasItem.xml | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 8efa1adae8..d715cf5e49 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -45,18 +45,24 @@ Draws an arc between the given angles. The larger the value of [code]point_count[/code], the smoother the curve. </description> </method> - <method name="draw_char"> + <method name="draw_char" qualifiers="const"> <return type="float"> </return> <argument index="0" name="font" type="Font"> </argument> - <argument index="1" name="position" type="Vector2"> + <argument index="1" name="pos" type="Vector2"> </argument> <argument index="2" name="char" type="String"> </argument> - <argument index="3" name="next" type="String"> + <argument index="3" name="next" type="String" default=""""> + </argument> + <argument index="4" name="size" type="int" default="-1"> + </argument> + <argument index="5" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <argument index="6" name="outline_size" type="int" default="0"> </argument> - <argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + <argument index="7" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 0 )"> </argument> <description> Draws a string character using a custom font. Returns the advance, depending on the character width and kerning with an optional next character. @@ -146,6 +152,35 @@ Draws multiple, parallel lines with a uniform [code]width[/code] and segment-by-segment coloring. Colors assigned to line segments match by index between [code]points[/code] and [code]colors[/code]. </description> </method> + <method name="draw_multiline_string" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="font" type="Font"> + </argument> + <argument index="1" name="pos" type="Vector2"> + </argument> + <argument index="2" name="text" type="String"> + </argument> + <argument index="3" name="align" type="int" enum="HAlign" default="0"> + </argument> + <argument index="4" name="width" type="float" default="-1"> + </argument> + <argument index="5" name="max_lines" type="int" default="-1"> + </argument> + <argument index="6" name="size" type="int" default="-1"> + </argument> + <argument index="7" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <argument index="8" name="outline_size" type="int" default="0"> + </argument> + <argument index="9" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 0 )"> + </argument> + <argument index="10" name="flags" type="int" default="51"> + </argument> + <description> + Breaks [code]text[/code] to the lines and draws it using the specified [code]font[/code] at the [code]position[/code] (top-left corner). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width. + </description> + </method> <method name="draw_multimesh"> <return type="void"> </return> @@ -253,18 +288,28 @@ Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed by this. </description> </method> - <method name="draw_string"> + <method name="draw_string" qualifiers="const"> <return type="void"> </return> <argument index="0" name="font" type="Font"> </argument> - <argument index="1" name="position" type="Vector2"> + <argument index="1" name="pos" type="Vector2"> </argument> <argument index="2" name="text" type="String"> </argument> - <argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + <argument index="3" name="align" type="int" enum="HAlign" default="0"> + </argument> + <argument index="4" name="width" type="float" default="-1"> + </argument> + <argument index="5" name="size" type="int" default="-1"> + </argument> + <argument index="6" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <argument index="7" name="outline_size" type="int" default="0"> + </argument> + <argument index="8" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 0 )"> </argument> - <argument index="4" name="clip_w" type="int" default="-1"> + <argument index="9" name="flags" type="int" default="3"> </argument> <description> Draws [code]text[/code] using the specified [code]font[/code] at the [code]position[/code] (top-left corner). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width. @@ -275,17 +320,19 @@ # `default_font` declaration to a member variable assigned in `_ready()` # so the Control is only created once. var default_font = Control.new().get_font("font") - draw_string(default_font, Vector2(64, 64), "Hello world") + var default_font_size = Control.new().get_font_size("font_size") + draw_string(default_font, Vector2(64, 64), "Hello world", HALIGN_LEFT, -1, font_size) [/gdscript] [csharp] // If using this method in a script that redraws constantly, move the // `default_font` declaration to a member variable assigned in `_ready()` // so the Control is only created once. Font defaultFont = new Control().GetFont("font"); - DrawString(defaultFont, new Vector2(64, 64), "Hello world"); + int defaultFontSize = new Control().GetFontSize("font_size"); + DrawString(defaultFont, new Vector2(64, 64), "Hello world", HALIGN_LEFT, -1, defaultFontSize); [/csharp] [/codeblocks] - See also [method Font.draw]. + See also [method Font.draw_string]. </description> </method> <method name="draw_style_box"> |