diff options
Diffstat (limited to 'doc/classes')
58 files changed, 3966 insertions, 500 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index f6b8e0da19..0216d2ba35 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1236,6 +1236,9 @@ <member name="ResourceSaver" type="ResourceSaver" setter="" getter=""> The [ResourceSaver] singleton. </member> + <member name="TextServerManager" type="TextServerManager" setter="" getter=""> + The [TextServerManager] singleton. + </member> <member name="TranslationServer" type="TranslationServer" setter="" getter=""> The [TranslationServer] singleton. </member> @@ -1286,6 +1289,9 @@ <constant name="HALIGN_RIGHT" value="2" enum="HAlign"> Horizontal right alignment, usually for text-derived classes. </constant> + <constant name="HALIGN_FILL" value="3" enum="HAlign"> + Expand row to fit width, usually for text-derived classes. + </constant> <constant name="VALIGN_TOP" value="0" enum="VAlign"> Vertical top alignment, usually for text-derived classes. </constant> diff --git a/doc/classes/AspectRatioContainer.xml b/doc/classes/AspectRatioContainer.xml new file mode 100644 index 0000000000..7b41133139 --- /dev/null +++ b/doc/classes/AspectRatioContainer.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="AspectRatioContainer" inherits="Container" version="4.0"> + <brief_description> + Container that preserves its child controls' aspect ratio. + </brief_description> + <description> + Arranges child controls in a way to preserve their aspect ratio automatically whenever the container is resized. Solves the problem where the container size is dynamic and the contents' size needs to adjust accordingly without losing proportions. + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <members> + <member name="alignment_horizontal" type="int" setter="set_alignment_horizontal" getter="get_alignment_horizontal" enum="AspectRatioContainer.AlignMode" default="1"> + Specifies the horizontal relative position of child controls. + </member> + <member name="alignment_vertical" type="int" setter="set_alignment_vertical" getter="get_alignment_vertical" enum="AspectRatioContainer.AlignMode" default="1"> + Specifies the vertical relative position of child controls. + </member> + <member name="ratio" type="float" setter="set_ratio" getter="get_ratio" default="1.0"> + The aspect ratio to enforce on child controls. This is the width divided by the height. The ratio depends on the [member stretch_mode]. + </member> + <member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="AspectRatioContainer.StretchMode" default="2"> + The stretch mode used to align child controls. + </member> + </members> + <constants> + <constant name="STRETCH_WIDTH_CONTROLS_HEIGHT" value="0" enum="StretchMode"> + The height of child controls is automatically adjusted based on the width of the container. + </constant> + <constant name="STRETCH_HEIGHT_CONTROLS_WIDTH" value="1" enum="StretchMode"> + The width of child controls is automatically adjusted based on the height of the container. + </constant> + <constant name="STRETCH_FIT" value="2" enum="StretchMode"> + The bounding rectangle of child controls is automatically adjusted to fit inside the container while keeping the aspect ratio. + </constant> + <constant name="STRETCH_COVER" value="3" enum="StretchMode"> + The width and height of child controls is automatically adjusted to make their bounding rectangle cover the entire area of the container while keeping the aspect ratio. + When the bounding rectangle of child controls exceed the container's size and [member Control.rect_clip_content] is enabled, this allows to show only the container's area restricted by its own bounding rectangle. + </constant> + <constant name="ALIGN_BEGIN" value="0" enum="AlignMode"> + Aligns child controls with the beginning (left or top) of the container. + </constant> + <constant name="ALIGN_CENTER" value="1" enum="AlignMode"> + Aligns child controls with the center of the container. + </constant> + <constant name="ALIGN_END" value="2" enum="AlignMode"> + Aligns child controls with the end (right or bottom) of the container. + </constant> + </constants> +</class> diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml index aadbc865bb..7a8c4b2cc7 100644 --- a/doc/classes/AudioStreamPlayer3D.xml +++ b/doc/classes/AudioStreamPlayer3D.xml @@ -4,7 +4,7 @@ Plays 3D sound in 3D space. </brief_description> <description> - Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space. + Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space. For greater realism, a low-pass filter is automatically applied to distant sounds. This can be disabled by setting [member attenuation_filter_cutoff_hz] to [code]20500[/code]. By default, audio is heard from the camera position. This can be changed by adding a [Listener3D] node to the scene and enabling it by calling [method Listener3D.make_current] on it. </description> <tutorials> @@ -56,19 +56,19 @@ Areas in which this sound plays. </member> <member name="attenuation_filter_cutoff_hz" type="float" setter="set_attenuation_filter_cutoff_hz" getter="get_attenuation_filter_cutoff_hz" default="5000.0"> - Dampens audio above this frequency, in Hz. + Dampens audio using a low-pass filter above this frequency, in Hz. To disable the dampening effect entirely, set this to [code]20500[/code] as this frequency is above the human hearing limit. </member> <member name="attenuation_filter_db" type="float" setter="set_attenuation_filter_db" getter="get_attenuation_filter_db" default="-24.0"> - Amount how much the filter affects the loudness, in dB. + Amount how much the filter affects the loudness, in decibels. </member> <member name="attenuation_model" type="int" setter="set_attenuation_model" getter="get_attenuation_model" enum="AudioStreamPlayer3D.AttenuationModel" default="0"> Decides if audio should get quieter with distance linearly, quadratically, logarithmically, or not be affected by distance, effectively disabling attenuation. </member> <member name="autoplay" type="bool" setter="set_autoplay" getter="is_autoplay_enabled" default="false"> - If [code]true[/code], audio plays when added to scene tree. + If [code]true[/code], audio plays when the AudioStreamPlayer3D node is added to scene tree. </member> <member name="bus" type="StringName" setter="set_bus" getter="get_bus" default="@"Master""> - Bus on which this audio is playing. + The bus on which this audio is playing. </member> <member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="AudioStreamPlayer3D.DopplerTracking" default="0"> Decides in which step the Doppler effect should be calculated. @@ -80,10 +80,10 @@ If [code]true[/code], the audio should be dampened according to the direction of the sound. </member> <member name="emission_angle_filter_attenuation_db" type="float" setter="set_emission_angle_filter_attenuation_db" getter="get_emission_angle_filter_attenuation_db" default="-12.0"> - Dampens audio if camera is outside of [member emission_angle_degrees] and [member emission_angle_enabled] is set by this factor, in dB. + Dampens audio if camera is outside of [member emission_angle_degrees] and [member emission_angle_enabled] is set by this factor, in decibels. </member> <member name="max_db" type="float" setter="set_max_db" getter="get_max_db" default="3.0"> - Sets the absolute maximum of the soundlevel, in dB. + Sets the absolute maximum of the soundlevel, in decibels. </member> <member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance" default="0.0"> Sets the distance from which the [member out_of_range_mode] takes effect. Has no effect if set to 0. @@ -98,16 +98,16 @@ If [code]true[/code], audio is playing. </member> <member name="stream" type="AudioStream" setter="set_stream" getter="get_stream"> - The [AudioStream] object to be played. + The [AudioStream] resource to be played. </member> <member name="stream_paused" type="bool" setter="set_stream_paused" getter="get_stream_paused" default="false"> - If [code]true[/code], the playback is paused. You can resume it by setting [code]stream_paused[/code] to [code]false[/code]. + If [code]true[/code], the playback is paused. You can resume it by setting [member stream_paused] to [code]false[/code]. </member> <member name="unit_db" type="float" setter="set_unit_db" getter="get_unit_db" default="0.0"> - Base sound level unaffected by dampening, in dB. + The base sound level unaffected by dampening, in decibels. </member> <member name="unit_size" type="float" setter="set_unit_size" getter="get_unit_size" default="1.0"> - Factor for the attenuation effect. + The factor for the attenuation effect. Higher values make the sound audible over a larger distance. </member> </members> <signals> @@ -128,13 +128,13 @@ Logarithmic dampening of loudness according to distance. </constant> <constant name="ATTENUATION_DISABLED" value="3" enum="AttenuationModel"> - No dampening of loudness according to distance. + No dampening of loudness according to distance. The sound will still be heard positionally, unlike an [AudioStreamPlayer]. </constant> <constant name="OUT_OF_RANGE_MIX" value="0" enum="OutOfRangeMode"> - Mix this audio in, even when it's out of range. + Mix this audio in, even when it's out of range. This increases CPU usage, but keeps the sound playing at the correct position if the camera leaves and enters the [AudioStreamPlayer3D]'s [member max_distance] radius. </constant> <constant name="OUT_OF_RANGE_PAUSE" value="1" enum="OutOfRangeMode"> - Pause this audio when it gets out of range. + Pause this audio when it gets out of range. This decreases CPU usage, but will cause the sound to restart if the camera leaves and enters the [AudioStreamPlayer3D]'s [member max_distance] radius. </constant> <constant name="DOPPLER_TRACKING_DISABLED" value="0" enum="DopplerTracking"> Disables doppler tracking. diff --git a/doc/classes/BitmapFont.xml b/doc/classes/BitmapFont.xml deleted file mode 100644 index 87cffdaca0..0000000000 --- a/doc/classes/BitmapFont.xml +++ /dev/null @@ -1,112 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="BitmapFont" inherits="Font" version="4.0"> - <brief_description> - Renders text using fonts under the [url=https://www.angelcode.com/products/bmfont/]BMFont[/url] format. - Handles files with the [code].fnt[/code] extension. - </brief_description> - <description> - Renders text using [code]*.fnt[/code] fonts containing texture atlases. Supports distance fields. For using vector font files like TTF directly, see [DynamicFont]. - </description> - <tutorials> - </tutorials> - <methods> - <method name="add_char"> - <return type="void"> - </return> - <argument index="0" name="character" type="int"> - </argument> - <argument index="1" name="texture" type="int"> - </argument> - <argument index="2" name="rect" type="Rect2"> - </argument> - <argument index="3" name="align" type="Vector2" default="Vector2( 0, 0 )"> - </argument> - <argument index="4" name="advance" type="float" default="-1"> - </argument> - <description> - Adds a character to the font, where [code]character[/code] is the Unicode value, [code]texture[/code] is the texture index, [code]rect[/code] is the region in the texture (in pixels!), [code]align[/code] is the (optional) alignment for the character and [code]advance[/code] is the (optional) advance. - </description> - </method> - <method name="add_kerning_pair"> - <return type="void"> - </return> - <argument index="0" name="char_a" type="int"> - </argument> - <argument index="1" name="char_b" type="int"> - </argument> - <argument index="2" name="kerning" type="int"> - </argument> - <description> - Adds a kerning pair to the [BitmapFont] as a difference. Kerning pairs are special cases where a typeface advance is determined by the next character. - </description> - </method> - <method name="add_texture"> - <return type="void"> - </return> - <argument index="0" name="texture" type="Texture2D"> - </argument> - <description> - Adds a texture to the [BitmapFont]. - </description> - </method> - <method name="clear"> - <return type="void"> - </return> - <description> - Clears all the font data and settings. - </description> - </method> - <method name="create_from_fnt"> - <return type="int" enum="Error"> - </return> - <argument index="0" name="path" type="String"> - </argument> - <description> - Creates a BitmapFont from the [code]*.fnt[/code] file at [code]path[/code]. - </description> - </method> - <method name="get_kerning_pair" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="char_a" type="int"> - </argument> - <argument index="1" name="char_b" type="int"> - </argument> - <description> - Returns a kerning pair as a difference. - </description> - </method> - <method name="get_texture" qualifiers="const"> - <return type="Texture2D"> - </return> - <argument index="0" name="idx" type="int"> - </argument> - <description> - Returns the font atlas texture at index [code]idx[/code]. - </description> - </method> - <method name="get_texture_count" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the number of textures in the BitmapFont atlas. - </description> - </method> - </methods> - <members> - <member name="ascent" type="float" setter="set_ascent" getter="get_ascent" default="0.0"> - Ascent (number of pixels above the baseline). - </member> - <member name="distance_field" type="bool" setter="set_distance_field_hint" getter="is_distance_field_hint" default="false"> - If [code]true[/code], distance field hint is enabled. - </member> - <member name="fallback" type="BitmapFont" setter="set_fallback" getter="get_fallback"> - The fallback font. - </member> - <member name="height" type="float" setter="set_height" getter="get_height" default="1.0"> - Total font height (ascent plus descent) in pixels. - </member> - </members> - <constants> - </constants> -</class> diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml index df47fa8bec..e47198a381 100644 --- a/doc/classes/Button.xml +++ b/doc/classes/Button.xml @@ -40,6 +40,33 @@ <link title="OS Test Demo">https://godotengine.org/asset-library/asset/677</link> </tutorials> <methods> + <method name="clear_opentype_features"> + <return type="void"> + </return> + <description> + Removes all OpenType features. + </description> + </method> + <method name="get_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code]. + </description> + </method> + <method name="set_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <argument index="1" name="value" type="int"> + </argument> + <description> + Sets OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + </description> + </method> </methods> <members> <member name="align" type="int" setter="set_text_align" getter="get_text_align" enum="Button.TextAlign" default="1"> @@ -57,9 +84,15 @@ <member name="icon" type="Texture2D" setter="set_button_icon" getter="get_button_icon"> Button's icon, if text is present the icon will be placed before the text. </member> + <member name="language" type="String" setter="set_language" getter="get_language" default=""""> + Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </member> <member name="text" type="String" setter="set_text" getter="get_text" default=""""> The button's text that will be displayed inside the button's area. </member> + <member name="text_direction" type="int" setter="set_text_direction" getter="get_text_direction" enum="Control.TextDirection" default="0"> + Base text writing direction. + </member> </members> <constants> <constant name="ALIGN_LEFT" value="0" enum="TextAlign"> @@ -94,6 +127,12 @@ <theme_item name="font_color_pressed" type="Color" default="Color( 1, 1, 1, 1 )"> Text [Color] used when the [Button] is being pressed. </theme_item> + <theme_item name="font_outline_modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + Text oubline [Color] of the [Button]. + </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [Button]'s text. + </theme_item> <theme_item name="hover" type="StyleBox"> [StyleBox] used when the [Button] is being hovered. </theme_item> @@ -103,6 +142,9 @@ <theme_item name="normal" type="StyleBox"> Default [StyleBox] for the [Button]. </theme_item> + <theme_item name="outline_size" type="int" default="0"> + Size of the [Button]'s text outline. + </theme_item> <theme_item name="pressed" type="StyleBox"> [StyleBox] used when the [Button] is being pressed. </theme_item> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 8efa1adae8..bd648c6de0 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -41,22 +41,30 @@ </argument> <argument index="6" name="width" type="float" default="1.0"> </argument> + <argument index="7" name="antialiased" type="bool" default="false"> + </argument> <description> 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="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + <argument index="6" name="outline_size" type="int" default="0"> + </argument> + <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 +154,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> @@ -181,6 +218,8 @@ </argument> <argument index="2" name="width" type="float" default="1.0"> </argument> + <argument index="3" name="antialiased" type="bool" default="false"> + </argument> <description> Draws interconnected line segments with a uniform [code]color[/code] and [code]width[/code]. </description> @@ -194,6 +233,8 @@ </argument> <argument index="2" name="width" type="float" default="1.0"> </argument> + <argument index="3" name="antialiased" type="bool" default="false"> + </argument> <description> Draws interconnected line segments 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> @@ -253,18 +294,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 +326,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"> diff --git a/doc/classes/CheckBox.xml b/doc/classes/CheckBox.xml index f912bb98c9..89fb960e88 100644 --- a/doc/classes/CheckBox.xml +++ b/doc/classes/CheckBox.xml @@ -48,6 +48,9 @@ <theme_item name="font_color_pressed" type="Color" default="Color( 1, 1, 1, 1 )"> The [CheckBox] text's font color when it's pressed. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [CheckBox]'s text. + </theme_item> <theme_item name="hover" type="StyleBox"> The [StyleBox] to display as a background when the [CheckBox] is hovered. </theme_item> diff --git a/doc/classes/CheckButton.xml b/doc/classes/CheckButton.xml index b4f91cf3a8..882f1c69f3 100644 --- a/doc/classes/CheckButton.xml +++ b/doc/classes/CheckButton.xml @@ -45,6 +45,9 @@ <theme_item name="font_color_pressed" type="Color" default="Color( 1, 1, 1, 1 )"> The [CheckButton] text's font color when it's pressed. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [CheckButton]'s text. + </theme_item> <theme_item name="hover" type="StyleBox"> The [StyleBox] to display as a background when the [CheckButton] is hovered. </theme_item> @@ -58,16 +61,28 @@ The [StyleBox] to display as a background. </theme_item> <theme_item name="off" type="Texture2D"> - The icon to display when the [CheckButton] is unchecked. + The icon to display when the [CheckButton] is unchecked (for left-to-right layouts). </theme_item> <theme_item name="off_disabled" type="Texture2D"> - The icon to display when the [CheckButton] is unchecked and disabled. + The icon to display when the [CheckButton] is unchecked and disabled (for left-to-right layouts). + </theme_item> + <theme_item name="off_disabled_mirrored" type="Texture2D"> + The icon to display when the [CheckButton] is unchecked and disabled (for right-to-left layouts). + </theme_item> + <theme_item name="off_mirrored" type="Texture2D"> + The icon to display when the [CheckButton] is unchecked (for right-to-left layouts). </theme_item> <theme_item name="on" type="Texture2D"> - The icon to display when the [CheckButton] is checked. + The icon to display when the [CheckButton] is checked (for left-to-right layouts). </theme_item> <theme_item name="on_disabled" type="Texture2D"> - The icon to display when the [CheckButton] is checked and disabled. + The icon to display when the [CheckButton] is checked and disabled (for left-to-right layouts). + </theme_item> + <theme_item name="on_disabled_mirrored" type="Texture2D"> + The icon to display when the [CheckButton] is checked and disabled (for right-to-left layouts). + </theme_item> + <theme_item name="on_mirrored" type="Texture2D"> + The icon to display when the [CheckButton] is checked (for right-to-left layouts). </theme_item> <theme_item name="pressed" type="StyleBox"> The [StyleBox] to display as a background when the [CheckButton] is pressed. diff --git a/doc/classes/CodeEdit.xml b/doc/classes/CodeEdit.xml index f6bc9e2cca..8834ff82c6 100644 --- a/doc/classes/CodeEdit.xml +++ b/doc/classes/CodeEdit.xml @@ -3,6 +3,7 @@ <brief_description> </brief_description> <description> + [b]Note[/b]: By default [CodeEdit] always use left-to-right text direction to correcly display source code. </description> <tutorials> </tutorials> @@ -109,6 +110,9 @@ </member> <member name="draw_line_numbers" type="bool" setter="set_draw_line_numbers" getter="is_draw_line_numbers_enabled" default="false"> </member> + <member name="layout_direction" type="int" setter="set_layout_direction" getter="get_layout_direction" override="true" enum="Control.LayoutDirection" default="2" /> + <member name="structured_text_bidi_override_options" type="Array" setter="set_structured_text_bidi_override_options" getter="get_structured_text_bidi_override_options" override="true" default="[ ]" /> + <member name="text_direction" type="int" setter="set_text_direction" getter="get_text_direction" override="true" enum="Control.TextDirection" default="1" /> <member name="zero_pad_line_numbers" type="bool" setter="set_line_numbers_zero_padded" getter="is_line_numbers_zero_padded" default="false"> </member> </members> @@ -179,6 +183,9 @@ </theme_item> <theme_item name="font_color_selected" type="Color" default="Color( 0, 0, 0, 1 )"> </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [CodeEdit]'s text. + </theme_item> <theme_item name="line_number_color" type="Color" default="Color( 0.67, 0.67, 0.67, 0.4 )"> </theme_item> <theme_item name="line_spacing" type="int" default="4"> diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index 76cc49a043..c04e8b9ea0 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -82,6 +82,9 @@ <theme_item name="font_color_pressed" type="Color" default="Color( 0.8, 0.8, 0.8, 1 )"> Text [Color] used when the [ColorPickerButton] is being pressed. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [ColorPickerButton]'s text. + </theme_item> <theme_item name="hover" type="StyleBox"> [StyleBox] used when the [ColorPickerButton] is being hovered. </theme_item> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index eb0b941da5..ae1a8d86a7 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -121,6 +121,18 @@ [/codeblocks] </description> </method> + <method name="_structured_text_parser" qualifiers="virtual"> + <return type="void"> + </return> + <argument index="0" name="args" type="Array"> + </argument> + <argument index="1" name="text" type="String"> + </argument> + <description> + User defined BiDi algorithm override function. + Return [code]Array[/code] of [code]Vector2i[/code] text ranges, in the left-to-right order. Ranges should cover full source [code]text[/code] without overlaps. BiDi algorithm will be used on each range separately. + </description> + </method> <method name="accept_event"> <return type="void"> </return> @@ -179,6 +191,17 @@ Overrides the font with given [code]name[/code] in the [member theme] resource the control uses. If [code]font[/code] is [code]null[/code] or invalid, the override is cleared and the font from assigned [Theme] is used. </description> </method> + <method name="add_theme_font_size_override"> + <return type="void"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="font_size" type="int"> + </argument> + <description> + Overrides the font size with given [code]name[/code] in the [member theme] resource the control uses. If [code]font_size[/code] is [code]-1[/code], the override is cleared and the font size from assigned [Theme] is used. + </description> + </method> <method name="add_theme_icon_override"> <return type="void"> </return> @@ -443,7 +466,7 @@ </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns a color from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]node_type[/code]. @@ -466,7 +489,7 @@ </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns a constant from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]node_type[/code]. @@ -477,18 +500,29 @@ </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns a font from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]node_type[/code]. </description> </method> + <method name="get_theme_font_size" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="node_type" type="StringName" default=""""> + </argument> + <description> + Returns a font size from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. + </description> + </method> <method name="get_theme_icon" qualifiers="const"> <return type="Texture2D"> </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns an icon from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]node_type[/code]. @@ -499,7 +533,7 @@ </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns a [StyleBox] from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]node_type[/code]. @@ -563,7 +597,7 @@ </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns [code]true[/code] if [Color] with given [code]name[/code] and associated with [Control] of given [code]node_type[/code] exists in assigned [Theme]. @@ -583,7 +617,7 @@ </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns [code]true[/code] if constant with given [code]name[/code] and associated with [Control] of given [code]node_type[/code] exists in assigned [Theme]. @@ -603,7 +637,7 @@ </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns [code]true[/code] if font with given [code]name[/code] and associated with [Control] of given [code]node_type[/code] exists in assigned [Theme]. @@ -618,12 +652,32 @@ Returns [code]true[/code] if font with given [code]name[/code] has a valid override in this [Control] node. </description> </method> + <method name="has_theme_font_size" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="node_type" type="StringName" default=""""> + </argument> + <description> + Returns [code]true[/code] if font size with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme]. + </description> + </method> + <method name="has_theme_font_size_override" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <description> + Returns [code]true[/code] if font size with given [code]name[/code] has a valid override in this [Control] node. + </description> + </method> <method name="has_theme_icon" qualifiers="const"> <return type="bool"> </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns [code]true[/code] if icon with given [code]name[/code] and associated with [Control] of given [code]node_type[/code] exists in assigned [Theme]. @@ -652,7 +706,7 @@ </return> <argument index="0" name="name" type="StringName"> </argument> - <argument index="1" name="type" type="StringName" default=""""> + <argument index="1" name="node_type" type="StringName" default=""""> </argument> <description> Returns [code]true[/code] if [StyleBox] with given [code]name[/code] and associated with [Control] of given [code]node_type[/code] exists in assigned [Theme]. @@ -667,6 +721,13 @@ Returns [code]true[/code] if [StyleBox] with given [code]name[/code] has a valid override in this [Control] node. </description> </method> + <method name="is_layout_rtl" qualifiers="const"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if layout is right-to-left. + </description> + </method> <method name="minimum_size_changed"> <return type="void"> </return> @@ -1015,6 +1076,9 @@ [/csharp] [/codeblocks] </member> + <member name="layout_direction" type="int" setter="set_layout_direction" getter="get_layout_direction" enum="Control.LayoutDirection" default="0"> + Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew). + </member> <member name="margin_bottom" type="float" setter="set_margin" getter="get_margin" default="0.0"> Distance between the node's bottom edge and its parent control, based on [member anchor_bottom]. Margins are often controlled by one or multiple parent [Container] nodes, so you should not modify them manually if your node is a direct child of a [Container]. Margins update automatically when you move or resize the node. @@ -1159,6 +1223,9 @@ <constant name="NOTIFICATION_SCROLL_END" value="48"> Sent when this node is inside a [ScrollContainer] which has stopped being scrolled. </constant> + <constant name="NOTIFICATION_LAYOUT_DIRECTION_CHANGED" value="49"> + Sent when control layout direction is changed. + </constant> <constant name="CURSOR_ARROW" value="0" enum="CursorShape"> Show the system's arrow mouse cursor when the user hovers the node. Use with [member mouse_default_cursor_shape]. </constant> @@ -1309,5 +1376,51 @@ <constant name="ANCHOR_END" value="1" enum="Anchor"> Snaps one of the 4 anchor's sides to the end of the node's [code]Rect[/code], in the bottom right. Use it with one of the [code]anchor_*[/code] member variables, like [member anchor_left]. To change all 4 anchors at once, use [method set_anchors_preset]. </constant> + <constant name="LAYOUT_DIRECTION_INHERITED" value="0" enum="LayoutDirection"> + Automatic layout direction, determined from the parent control layout direction. + </constant> + <constant name="LAYOUT_DIRECTION_LOCALE" value="1" enum="LayoutDirection"> + Automatic layout direction, determined from the current locale. + </constant> + <constant name="LAYOUT_DIRECTION_LTR" value="2" enum="LayoutDirection"> + Left-to-right layout direction. + </constant> + <constant name="LAYOUT_DIRECTION_RTL" value="3" enum="LayoutDirection"> + Right-to-left layout direction. + </constant> + <constant name="TEXT_DIRECTION_INHERITED" value="3" enum="TextDirection"> + Text writing direction is the same as layout direction. + </constant> + <constant name="TEXT_DIRECTION_AUTO" value="0" enum="TextDirection"> + Automatic text writing direction, determined from the current locale and text content. + </constant> + <constant name="TEXT_DIRECTION_LTR" value="1" enum="TextDirection"> + Left-to-right text writing direction. + </constant> + <constant name="TEXT_DIRECTION_RTL" value="2" enum="TextDirection"> + Right-to-left text writing direction. + </constant> + <constant name="STRUCTURED_TEXT_DEFAULT" value="0" enum="StructuredTextParser"> + Use default behavior. Same as [code]STRUCTURED_TEXT_NONE[/code] unless specified otherwise in the control description. + </constant> + <constant name="STRUCTURED_TEXT_URI" value="1" enum="StructuredTextParser"> + BiDi override for URI. + </constant> + <constant name="STRUCTURED_TEXT_FILE" value="2" enum="StructuredTextParser"> + BiDi override for file path. + </constant> + <constant name="STRUCTURED_TEXT_EMAIL" value="3" enum="StructuredTextParser"> + BiDi override for email. + </constant> + <constant name="STRUCTURED_TEXT_LIST" value="4" enum="StructuredTextParser"> + BiDi override for lists. + Structured text options: list separator [code]String[/code]. + </constant> + <constant name="STRUCTURED_TEXT_NONE" value="5" enum="StructuredTextParser"> + Use default Unicode BiDi algorithm. + </constant> + <constant name="STRUCTURED_TEXT_CUSTOM" value="6" enum="StructuredTextParser"> + User defined structured text BiDi override function. + </constant> </constants> </class> diff --git a/doc/classes/DirectionalLight3D.xml b/doc/classes/DirectionalLight3D.xml index afd85a9cb7..233b1f0c16 100644 --- a/doc/classes/DirectionalLight3D.xml +++ b/doc/classes/DirectionalLight3D.xml @@ -41,6 +41,9 @@ </member> <member name="shadow_bias" type="float" setter="set_param" getter="get_param" override="true" default="0.05" /> <member name="shadow_normal_bias" type="float" setter="set_param" getter="get_param" override="true" default="1.0" /> + <member name="use_in_sky_only" type="bool" setter="set_sky_only" getter="is_sky_only" default="false"> + If [code]true[/code], this [DirectionalLight3D] will not be used for anything except sky shaders. Use this for lights that impact your sky shader that you may want to hide from affecting the rest of the scene. For example, you may want to enable this when the sun in your sky shader falls below the horizon. + </member> </members> <constants> <constant name="SHADOW_ORTHOGONAL" value="0" enum="ShadowMode"> diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml deleted file mode 100644 index d2d0c54761..0000000000 --- a/doc/classes/DynamicFont.xml +++ /dev/null @@ -1,146 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="DynamicFont" inherits="Font" version="4.0"> - <brief_description> - DynamicFont renders vector font files at runtime. - </brief_description> - <description> - DynamicFont renders vector font files (such as TTF or OTF) dynamically at runtime instead of using a prerendered texture atlas like [BitmapFont]. This trades the faster loading time of [BitmapFont]s for the ability to change font parameters like size and spacing during runtime. [DynamicFontData] is used for referencing the font file paths. DynamicFont also supports defining one or more fallback fonts, which will be used when displaying a character not supported by the main font. - DynamicFont uses the [url=https://www.freetype.org/]FreeType[/url] library for rasterization. - [codeblocks] - [gdscript] - var dynamic_font = DynamicFont.new() - dynamic_font.font_data = load("res://BarlowCondensed-Bold.ttf") - dynamic_font.size = 64 - $"Label".set("custom_fonts/font", dynamic_font) - [/gdscript] - [csharp] - var dynamicFont = new DynamicFont(); - dynamicFont.FontData = ResourceLoader.Load<DynamicFontData>("res://BarlowCondensed-Bold.ttf"); - dynamicFont.Size = 64; - GetNode("Label").Set("custom_fonts/font", dynamicFont); - [/csharp] - [/codeblocks] - [b]Note:[/b] DynamicFont doesn't support features such as kerning, right-to-left typesetting, ligatures, text shaping, variable fonts and optional font features yet. If you wish to "bake" an optional font feature into a TTF font file, you can use [url=https://fontforge.org/]FontForge[/url] to do so. In FontForge, use [b]File > Generate Fonts[/b], click [b]Options[/b], choose the desired features then generate the font. - </description> - <tutorials> - <link title="3D Voxel Demo">https://godotengine.org/asset-library/asset/676</link> - </tutorials> - <methods> - <method name="add_fallback"> - <return type="void"> - </return> - <argument index="0" name="data" type="DynamicFontData"> - </argument> - <description> - Adds a fallback font. - </description> - </method> - <method name="get_available_chars" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns a string containing all the characters available in the main and all the fallback fonts. - If a given character is included in more than one font, it appears only once in the returned string. - </description> - </method> - <method name="get_fallback" qualifiers="const"> - <return type="DynamicFontData"> - </return> - <argument index="0" name="idx" type="int"> - </argument> - <description> - Returns the fallback font at index [code]idx[/code]. - </description> - </method> - <method name="get_fallback_count" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the number of fallback fonts. - </description> - </method> - <method name="get_spacing" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="type" type="int"> - </argument> - <description> - Returns the spacing for the given [code]type[/code] (see [enum SpacingType]). - </description> - </method> - <method name="remove_fallback"> - <return type="void"> - </return> - <argument index="0" name="idx" type="int"> - </argument> - <description> - Removes the fallback font at index [code]idx[/code]. - </description> - </method> - <method name="set_fallback"> - <return type="void"> - </return> - <argument index="0" name="idx" type="int"> - </argument> - <argument index="1" name="data" type="DynamicFontData"> - </argument> - <description> - Sets the fallback font at index [code]idx[/code]. - </description> - </method> - <method name="set_spacing"> - <return type="void"> - </return> - <argument index="0" name="type" type="int"> - </argument> - <argument index="1" name="value" type="int"> - </argument> - <description> - Sets the spacing for [code]type[/code] (see [enum SpacingType]) to [code]value[/code] in pixels (not relative to the font size). - </description> - </method> - </methods> - <members> - <member name="extra_spacing_bottom" type="int" setter="set_spacing" getter="get_spacing" default="0"> - Extra spacing at the bottom in pixels. - </member> - <member name="extra_spacing_char" type="int" setter="set_spacing" getter="get_spacing" default="0"> - Extra spacing for each character in pixels. - This can be a negative number to make the distance between characters smaller. - </member> - <member name="extra_spacing_space" type="int" setter="set_spacing" getter="get_spacing" default="0"> - Extra spacing for the space character (in addition to [member extra_spacing_char]) in pixels. - This can be a negative number to make the distance between words smaller. - </member> - <member name="extra_spacing_top" type="int" setter="set_spacing" getter="get_spacing" default="0"> - Extra spacing at the top in pixels. - </member> - <member name="font_data" type="DynamicFontData" setter="set_font_data" getter="get_font_data"> - The font data. - </member> - <member name="outline_color" type="Color" setter="set_outline_color" getter="get_outline_color" default="Color( 1, 1, 1, 1 )"> - The font outline's color. - [b]Note:[/b] It's recommended to leave this at the default value so that you can adjust it in individual controls. For example, if the outline is made black here, it won't be possible to change its color using a Label's font outline modulate theme item. - </member> - <member name="outline_size" type="int" setter="set_outline_size" getter="get_outline_size" default="0"> - The font outline's thickness in pixels (not relative to the font size). - </member> - <member name="size" type="int" setter="set_size" getter="get_size" default="16"> - The font size in pixels. - </member> - </members> - <constants> - <constant name="SPACING_TOP" value="0" enum="SpacingType"> - Spacing at the top. - </constant> - <constant name="SPACING_BOTTOM" value="1" enum="SpacingType"> - Spacing at the bottom. - </constant> - <constant name="SPACING_CHAR" value="2" enum="SpacingType"> - Spacing for each character. - </constant> - <constant name="SPACING_SPACE" value="3" enum="SpacingType"> - Spacing for the space character. - </constant> - </constants> -</class> diff --git a/doc/classes/DynamicFontData.xml b/doc/classes/DynamicFontData.xml deleted file mode 100644 index 45585f17e0..0000000000 --- a/doc/classes/DynamicFontData.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="DynamicFontData" inherits="Resource" version="4.0"> - <brief_description> - Used with [DynamicFont] to describe the location of a font file. - </brief_description> - <description> - Used with [DynamicFont] to describe the location of a vector font file for dynamic rendering at runtime. - </description> - <tutorials> - <link title="3D Voxel Demo">https://godotengine.org/asset-library/asset/676</link> - </tutorials> - <methods> - </methods> - <members> - <member name="antialiased" type="bool" setter="set_antialiased" getter="is_antialiased" default="true"> - If [code]true[/code], the font is rendered with anti-aliasing. This property applies both to the main font and its outline (if it has one). - </member> - <member name="font_path" type="String" setter="set_font_path" getter="get_font_path" default=""""> - The path to the vector font file. - </member> - <member name="hinting" type="int" setter="set_hinting" getter="get_hinting" enum="DynamicFontData.Hinting" default="2"> - The font hinting mode used by FreeType. See [enum Hinting] for options. - </member> - </members> - <constants> - <constant name="HINTING_NONE" value="0" enum="Hinting"> - Disables font hinting (smoother but less crisp). - </constant> - <constant name="HINTING_LIGHT" value="1" enum="Hinting"> - Use the light font hinting mode. - </constant> - <constant name="HINTING_NORMAL" value="2" enum="Hinting"> - Use the default font hinting mode (crisper but less smooth). - </constant> - </constants> -</class> diff --git a/doc/classes/EditorNode3DGizmoPlugin.xml b/doc/classes/EditorNode3DGizmoPlugin.xml index adaaed4f1c..322cff4e43 100644 --- a/doc/classes/EditorNode3DGizmoPlugin.xml +++ b/doc/classes/EditorNode3DGizmoPlugin.xml @@ -125,7 +125,7 @@ </return> <argument index="0" name="name" type="String"> </argument> - <argument index="1" name="gizmo" type="EditorNode3DGizmo"> + <argument index="1" name="gizmo" type="EditorNode3DGizmo" default="null"> </argument> <description> Gets material from the internal list of materials. If an [EditorNode3DGizmo] is provided, it will try to get the corresponding variant (selected and/or editable). diff --git a/doc/classes/File.xml b/doc/classes/File.xml index ada57a8114..2f7ac551cf 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -6,7 +6,8 @@ <description> File type. This is used to permanently store data into the user device's file system and to read from it. This can be used to store game save data or player configuration files, for example. Here's a sample on how to write and read from a file: - [codeblock] + [codeblocks] + [gdscript] func save(content): var file = File.new() file.open("user://save_game.dat", File.WRITE) @@ -19,7 +20,26 @@ var content = file.get_as_text() file.close() return content - [/codeblock] + [/gdscript] + [csharp] + public void Save(string content) + { + var file = new File(); + file.Open("user://save_game.dat", File.ModeFlags.Write); + file.StoreString(content); + file.Close(); + } + + public string Load() + { + var file = new File(); + file.Open("user://save_game.dat", File.ModeFlags.Read); + string content = file.GetAsText(); + file.Close(); + return content; + } + [/csharp] + [/codeblocks] In the example above, the file will be saved in the user data folder as specified in the [url=https://docs.godotengine.org/en/latest/tutorials/io/data_paths.html]Data paths[/url] documentation. [b]Note:[/b] To access project resources once exported, it is recommended to use [ResourceLoader] instead of the [File] API, as some files are converted to engine-specific formats and their original source files might not be present in the exported PCK package. </description> @@ -303,7 +323,8 @@ Stores an integer as 16 bits in the file. [b]Note:[/b] The [code]value[/code] should lie in the interval [code][0, 2^16 - 1][/code]. Any other value will overflow and wrap around. To store a signed integer, use [method store_64] or store a signed integer from the interval [code][-2^15, 2^15 - 1][/code] (i.e. keeping one bit for the signedness) and compute its sign manually when reading. For example: - [codeblock] + [codeblocks] + [gdscript] const MAX_15B = 1 << 15 const MAX_16B = 1 << 16 @@ -320,7 +341,22 @@ var read2 = f.get_16() # 121 var converted1 = unsigned16_to_signed(read1) # -42 var converted2 = unsigned16_to_signed(read2) # 121 - [/codeblock] + [/gdscript] + [csharp] + public override void _Ready() + { + var f = new File(); + f.Open("user://file.dat", File.ModeFlags.WriteRead); + f.Store16(unchecked((ushort)-42)); // This wraps around and stores 65494 (2^16 - 42). + f.Store16(121); // In bounds, will store 121. + f.Seek(0); // Go back to start to read the stored value. + ushort read1 = f.Get16(); // 65494 + ushort read2 = f.Get16(); // 121 + short converted1 = BitConverter.ToInt16(BitConverter.GetBytes(read1), 0); // -42 + short converted2 = BitConverter.ToInt16(BitConverter.GetBytes(read2), 0); // 121 + } + [/csharp] + [/codeblocks] </description> </method> <method name="store_32"> diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index f49fbf0d2a..edd2bd137f 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -1,60 +1,167 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Font" inherits="Resource" version="4.0"> <brief_description> - Internationalized font and text drawing support. + Font class is set of font data sources used to draw text. </brief_description> <description> - Font contains a Unicode-compatible character set, as well as the ability to draw it with variable width, ascent, descent and kerning. For creating fonts from TTF files (or other font formats), see the editor support for fonts. - [b]Note:[/b] If a DynamicFont doesn't contain a character used in a string, the character in question will be replaced with codepoint [code]0xfffd[/code] if it's available in the DynamicFont. If this replacement character isn't available in the DynamicFont, the character will be hidden without displaying any replacement character in the string. - [b]Note:[/b] If a BitmapFont doesn't contain a character used in a string, the character in question will be hidden without displaying any replacement character in the string. + Font contains a set of glyphs to represent Unicode characters, as well as the ability to draw it with variable width, ascent, descent and kerning. + [b]Note:[/b] A character is a symbol that represents an item (letter, digit etc.) in an abstract way. + [b]Note:[/b] A glyph is a bitmap or shape used to draw a one or more characters in a context-dependent manner. Glyph indices are bound to the specific font data source. + [b]Note:[/b] If a non of the font data sources contain glyphs for a character used in a string, the character in question will be replaced with a box displaying its hexadecimal code. + [codeblocks] + [gdscript] + var font = Font.new() + font.add_data(load("res://BarlowCondensed-Bold.ttf")) + $"Label".set("custom_fonts/font", font) + $"Label".set("custom_fonts/font_size", 64) + [/gdscript] + [csharp] + var font = new Font(); + font.AddData(ResourceLoader.Load<FontData>("res://BarlowCondensed-Bold.ttf")); + GetNode("Label").Set("custom_fonts/font", font); + GetNode("Label").Set("custom_font_sizes/font_size", 64); + [/csharp] + [/codeblocks] + To control font substitution priority use [FontData] language and script support. + Use language overrides to use same [Font] stack for multiple languages: + [codeblocks] + [gdscript] + # Use Naskh font for Persian and Nastaʼlīq font for Urdu text. + var font_data_fa = load("res://NotoNaskhArabicUI_Regular.ttf"); + font_data_fa.set_language_support_override("fa", true); + font_data_fa.set_language_support_override("ur", false); + + var font_data_ur = load("res://NotoNastaliqUrdu_Regular.ttf"); + font_data_ur.set_language_support_override("fa", false); + font_data_ur.set_language_support_override("ur", true); + [/gdscript] + [csharp] + // Use Naskh font for Persian and Nastaʼlīq font for Urdu text. + var fontDataFA = ResourceLoader.Load<FontData>("res://NotoNaskhArabicUI_Regular.ttf"); + fontDataFA.SetLanguageSupportOverride("fa", true); + fontDataFA.SetLanguageSupportOverride("ur", false); + + var fontDataUR = ResourceLoader.Load<FontData>("res://NotoNastaliqUrdu_Regular.ttf"); + fontDataUR.SetLanguageSupportOverride("fa", false); + fontDataUR.SetLanguageSupportOverride("ur", true); + [/csharp] + [/codeblocks] + Use script overrides to specify supported scripts for bitmap font or for less common scripts not directly supported by TrueType format: + [codeblocks] + [gdscript] + # Use specified font for Egyptian hieroglyphs. + var font_data = load("res://unifont.ttf"); + font_data.set_script_support_override("Egyp", true); + [/gdscript] + [csharp] + // Use specified font for Egyptian hieroglyphs. + var fontData = ResourceLoader.Load<FontData>("res://unifont.ttf"); + fontData.SetScriptSupportOverride("Egyp", true); + [/csharp] + [/codeblocks] </description> <tutorials> </tutorials> <methods> - <method name="draw" qualifiers="const"> + <method name="add_data"> <return type="void"> </return> + <argument index="0" name="data" type="FontData"> + </argument> + <description> + Add font data source to the set. + </description> + </method> + <method name="draw_char" qualifiers="const"> + <return type="float"> + </return> <argument index="0" name="canvas_item" type="RID"> </argument> - <argument index="1" name="position" type="Vector2"> + <argument index="1" name="pos" type="Vector2"> + </argument> + <argument index="2" name="char" type="int"> + </argument> + <argument index="3" name="next" type="int" default="0"> </argument> - <argument index="2" name="string" type="String"> + <argument index="4" name="size" type="int" default="-1"> </argument> - <argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + <argument index="5" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> </argument> - <argument index="4" name="clip_w" type="int" default="-1"> + <argument index="6" name="outline_size" type="int" default="0"> </argument> - <argument index="5" name="outline_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> - Draw [code]string[/code] into a canvas item using the font at a given position, with [code]modulate[/code] color, and optionally clipping the width. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. - See also [method CanvasItem.draw_string]. + Draw a single Unicode character [code]char[/code] into a canvas item using the font, at a given position, with [code]modulate[/code] color, and optionally kerning if [code]next[/code] is passed. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. + [b]Note:[/b] Do not use this function to draw strings character by character, use [method draw_string] or [TextLine] instead. </description> </method> - <method name="draw_char" qualifiers="const"> - <return type="float"> + <method name="draw_multiline_string" qualifiers="const"> + <return type="void"> </return> <argument index="0" name="canvas_item" type="RID"> </argument> - <argument index="1" name="position" type="Vector2"> + <argument index="1" name="pos" type="Vector2"> </argument> - <argument index="2" name="char" type="int"> + <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 using rules specified by [code]flags[/code] and draws it into a canvas item using the font, at a given position, with [code]modulate[/code] color, optionally clipping the width and aligning horizontally. [code]position[/code] specifies the baseline of the first line, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. + See also [method CanvasItem.draw_multiline_string]. + </description> + </method> + <method name="draw_string" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="canvas_item" type="RID"> + </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="size" type="int" default="-1"> + </argument> + <argument index="6" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> </argument> - <argument index="3" name="next" type="int" default="-1"> + <argument index="7" name="outline_size" type="int" default="0"> </argument> - <argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + <argument index="8" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 0 )"> </argument> - <argument index="5" name="outline" type="bool" default="false"> + <argument index="9" name="flags" type="int" default="3"> </argument> <description> - Draw character [code]char[/code] into a canvas item using the font at a given position, with [code]modulate[/code] color, and optionally kerning if [code]next[/code] is passed. clipping the width. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character. + Draw [code]text[/code] into a canvas item using the font, at a given position, with [code]modulate[/code] color, optionally clipping the width and aligning horizontally. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. + See also [method CanvasItem.draw_string]. </description> </method> <method name="get_ascent" qualifiers="const"> <return type="float"> </return> + <argument index="0" name="size" type="int" default="-1"> + </argument> <description> - Returns the font ascent (number of pixels above the baseline). + Returns the average font ascent (number of pixels above the baseline). + [b]Note:[/b] Real ascent of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate (e.g. as the ascent of empty line). </description> </method> <method name="get_char_size" qualifiers="const"> @@ -64,65 +171,176 @@ </argument> <argument index="1" name="next" type="int" default="0"> </argument> + <argument index="2" name="size" type="int" default="-1"> + </argument> <description> Returns the size of a character, optionally taking kerning into account if the next character is provided. + [b]Note:[/b] Do not use this function to calculate width of the string character by character, use [method get_string_size] or [TextLine] instead. + </description> + </method> + <method name="get_data" qualifiers="const"> + <return type="FontData"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Returns the font data source at index [code]idx[/code]. If the index does not exist, returns [code]null[/code]. + </description> + </method> + <method name="get_data_count" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the number of font data sources. </description> </method> <method name="get_descent" qualifiers="const"> <return type="float"> </return> + <argument index="0" name="size" type="int" default="-1"> + </argument> <description> - Returns the font descent (number of pixels below the baseline). + Returns the average font descent (number of pixels below the baseline). + [b]Note:[/b] Real descent of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate (e.g. as the descent of empty line). </description> </method> <method name="get_height" qualifiers="const"> <return type="float"> </return> + <argument index="0" name="size" type="int" default="-1"> + </argument> <description> - Returns the total font height (ascent plus descent) in pixels. + Returns the total average font height (ascent plus descent) in pixels. + [b]Note:[/b] Real height of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate (e.g. as the height of empty line). </description> </method> - <method name="get_string_size" qualifiers="const"> + <method name="get_multiline_string_size" qualifiers="const"> <return type="Vector2"> </return> - <argument index="0" name="string" type="String"> + <argument index="0" name="text" type="String"> + </argument> + <argument index="1" name="width" type="float" default="-1"> + </argument> + <argument index="2" name="size" type="int" default="-1"> + </argument> + <argument index="3" name="flags" type="int" default="48"> + </argument> + <description> + Returns the size of a bounding box of a string broken into the lines, taking kerning and advance into account. + See also [method draw_multiline_string]. + </description> + </method> + <method name="get_spacing" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="type" type="int"> </argument> <description> - Returns the size of a string, taking kerning and advance into account. + Returns the spacing for the given [code]type[/code] (see [enum SpacingType]). </description> </method> - <method name="get_wordwrap_string_size" qualifiers="const"> + <method name="get_string_size" qualifiers="const"> <return type="Vector2"> </return> - <argument index="0" name="string" type="String"> + <argument index="0" name="text" type="String"> </argument> - <argument index="1" name="width" type="float"> + <argument index="1" name="size" type="int" default="-1"> </argument> <description> - Returns the size that the string would have with word wrapping enabled with a fixed [code]width[/code]. + Returns the size size of a bounding box of a string, taking kerning and advance into account. + See also [method draw_string]. </description> </method> - <method name="has_outline" qualifiers="const"> - <return type="bool"> + <method name="get_supported_chars" qualifiers="const"> + <return type="String"> + </return> + <description> + Returns a string containing all the characters available in the font. + If a given character is included in more than one font data source, it appears only once in the returned string. + </description> + </method> + <method name="get_underline_position" qualifiers="const"> + <return type="float"> </return> + <argument index="0" name="size" type="int" default="-1"> + </argument> <description> - Returns [code]true[/code] if the font has an outline. + Return average pixel offset of the underline below the baseline. + [b]Note:[/b] Real underline position of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate. </description> </method> - <method name="is_distance_field_hint" qualifiers="const"> + <method name="get_underline_thickness" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="size" type="int" default="-1"> + </argument> + <description> + Return average thickness of the underline. + [b]Note:[/b] Real underline thickness of the string is context-dependent and can be significantly different from the value returned by this function. Use it only as rough estimate. + </description> + </method> + <method name="has_char" qualifiers="const"> <return type="bool"> </return> + <argument index="0" name="char" type="int"> + </argument> + <description> + Return [code]true[/code] if a Unicode [code]char[/code] is available in the font. + </description> + </method> + <method name="remove_data"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Removes the font data source at index [code]idx[/code]. If the index does not exist, nothing happens. + </description> + </method> + <method name="set_data"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="data" type="FontData"> + </argument> + <description> + Sets the font data source at index [code]idx[/code]. If the index does not exist, nothing happens. + </description> + </method> + <method name="set_spacing"> + <return type="void"> + </return> + <argument index="0" name="type" type="int"> + </argument> + <argument index="1" name="value" type="int"> + </argument> <description> + Sets the spacing for [code]type[/code] (see [enum SpacingType]) to [code]value[/code] in pixels (not relative to the font size). </description> </method> <method name="update_changes"> <return type="void"> </return> <description> - After editing a font (changing size, ascent, char rects, etc.). Call this function to propagate changes to controls that might use it. + After editing a font (changing data sources, etc.). Call this function to propagate changes to controls that might use it. </description> </method> </methods> + <members> + <member name="extra_spacing_bottom" type="int" setter="set_spacing" getter="get_spacing" default="0"> + Extra spacing at the bottom in pixels. + </member> + <member name="extra_spacing_top" type="int" setter="set_spacing" getter="get_spacing" default="0"> + Extra character spacing in pixels. + </member> + </members> <constants> + <constant name="SPACING_TOP" value="0" enum="SpacingType"> + Spacing at the top of the line. + </constant> + <constant name="SPACING_BOTTOM" value="1" enum="SpacingType"> + Spacing at the bottom of the line. + </constant> </constants> </class> diff --git a/doc/classes/FontData.xml b/doc/classes/FontData.xml new file mode 100644 index 0000000000..cee424394a --- /dev/null +++ b/doc/classes/FontData.xml @@ -0,0 +1,302 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="FontData" inherits="Resource" version="4.0"> + <brief_description> + Font data source, file or memory buffer. + </brief_description> + <description> + Built-in text servers support font data sources of the following formats: + - Bitmap fonts in the [url=https://www.angelcode.com/products/bmfont/]BMFont[/url] format. Handles [code].fnt, *.font[/code] fonts containing texture atlases. Non-scalable. Supports distance fields. Complex text shaping support is limited. + - Dynamic fonts using the [url=https://www.freetype.org/]FreeType[/url] and [url=https://github.com/silnrsi/graphite/]Graphite[/url] library for rasterization. Handles [code]*.ttf, *.otf[/code] fonts. Scalable. Doesn't support distance fields. Supports complex text shaping and OpenType features. + </description> + <tutorials> + </tutorials> + <methods> + <method name="draw_glyph" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="canvas" type="RID"> + </argument> + <argument index="1" name="size" type="int"> + </argument> + <argument index="2" name="pos" type="Vector2"> + </argument> + <argument index="3" name="index" type="int"> + </argument> + <argument index="4" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draws single glyph into a canvas item at the position, using [code]font[/code] at the size [code]size[/code]. + Returns advance of the glyph for horizontal and vertical layouts. + Note: Glyph index is bound to the font data, use only glyphs indices returned by [method TextServer.shaped_text_get_glyphs] or [method get_glyph_index] for this font data. + </description> + </method> + <method name="draw_glyph_outline" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="canvas" type="RID"> + </argument> + <argument index="1" name="size" type="int"> + </argument> + <argument index="2" name="outline_size" type="int"> + </argument> + <argument index="3" name="pos" type="Vector2"> + </argument> + <argument index="4" name="index" type="int"> + </argument> + <argument index="5" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draws single glyph outline of size [code]outline_size[/code] into a canvas item at the position, using [code]font[/code] at the size [code]size[/code]. If outline drawing is not supported, nothing is drawn. + Returns advance of the glyph for horizontal and vertical layouts (regardless of outline drawing support). + Note: Glyph index is bound to the font data, use only glyphs indices returned by [method TextServer.shaped_text_get_glyphs] or [method get_glyph_index] for this font data. + </description> + </method> + <method name="get_ascent" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="size" type="int"> + </argument> + <description> + Returns the font ascent (number of pixels above the baseline). + </description> + </method> + <method name="get_base_size" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns the base size of the font (the only size supported for non-scalable fonts, meaningless for scalable fonts). + </description> + </method> + <method name="get_descent" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="size" type="int"> + </argument> + <description> + Returns the font descent (number of pixels below the baseline). + </description> + </method> + <method name="get_glyph_advance" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <argument index="1" name="size" type="int"> + </argument> + <description> + Returns advance of the glyph for horizontal and vertical layouts. + Note: Glyph index is bound to the font data, use only glyphs indices returned by [method TextServer.shaped_text_get_glyphs] or [method get_glyph_index] for this font data. + </description> + </method> + <method name="get_glyph_index" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="char" type="int"> + </argument> + <argument index="1" name="variation_selector" type="int" default="0"> + </argument> + <description> + Return the glyph index of a [code]char[/code], optionally modified by the [code]variation_selector[/code]. + </description> + </method> + <method name="get_glyph_kerning" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="index_a" type="int"> + </argument> + <argument index="1" name="index_b" type="int"> + </argument> + <argument index="2" name="size" type="int"> + </argument> + <description> + Returns a kerning of the pair of glyphs for horizontal and vertical layouts. + Note: Glyph index is bound to the font data, use only glyphs indices returned by [method TextServer.shaped_text_get_glyphs] or [method get_glyph_index] for this font data. + </description> + </method> + <method name="get_height" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="size" type="int"> + </argument> + <description> + Returns the total font height (ascent plus descent) in pixels. + </description> + </method> + <method name="get_language_support_override" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="language" type="String"> + </argument> + <description> + Returns [code]true[/code] if support override is enabled for the [code]language[/code]. + </description> + </method> + <method name="get_language_support_overrides" qualifiers="const"> + <return type="PackedStringArray"> + </return> + <description> + Returns list of language support overrides. + </description> + </method> + <method name="get_script_support_override" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="script" type="String"> + </argument> + <description> + Returns [code]true[/code] if support override is enabled for the [code]script[/code]. + </description> + </method> + <method name="get_script_support_overrides" qualifiers="const"> + <return type="PackedStringArray"> + </return> + <description> + Returns list of script support overrides. + </description> + </method> + <method name="get_supported_chars" qualifiers="const"> + <return type="String"> + </return> + <description> + Returns a string containing all the characters available in the font. + </description> + </method> + <method name="get_underline_position" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="size" type="int"> + </argument> + <description> + Returns underline offset (number of pixels below the baseline). + </description> + </method> + <method name="get_underline_thickness" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="size" type="int"> + </argument> + <description> + Returns underline thickness in pixels. + </description> + </method> + <method name="has_char" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="char" type="int"> + </argument> + <description> + Return [code]true[/code] if a Unicode [code]char[/code] is available in the font. + </description> + </method> + <method name="has_outline" qualifiers="const"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code], if font supports drawing glyph outlines. + </description> + </method> + <method name="is_language_supported" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="language" type="String"> + </argument> + <description> + Returns [code]true[/code], if font supports given language ([url=https://en.wikipedia.org/wiki/ISO_639-1]ISO 639[/url] code). + </description> + </method> + <method name="is_script_supported" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="script" type="String"> + </argument> + <description> + Returns [code]true[/code], if font supports given script ([url=https://en.wikipedia.org/wiki/ISO_15924]ISO 15924[/url] code). + </description> + </method> + <method name="load_memory"> + <return type="void"> + </return> + <argument index="0" name="data" type="PackedByteArray"> + </argument> + <argument index="1" name="type" type="String"> + </argument> + <argument index="2" name="base_size" type="int" default="16"> + </argument> + <description> + Creates new font from the data in memory. + Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method get_base_size] to check actual font size. + </description> + </method> + <method name="load_resource"> + <return type="void"> + </return> + <argument index="0" name="filename" type="String"> + </argument> + <argument index="1" name="base_size" type="int" default="16"> + </argument> + <description> + Creates new font from the file. + Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method get_base_size] to check actual font size. + </description> + </method> + <method name="remove_language_support_override"> + <return type="void"> + </return> + <argument index="0" name="language" type="String"> + </argument> + <description> + Remove language support override. + </description> + </method> + <method name="remove_script_support_override"> + <return type="void"> + </return> + <argument index="0" name="script" type="String"> + </argument> + <description> + Removes script support override. + </description> + </method> + <method name="set_language_support_override"> + <return type="void"> + </return> + <argument index="0" name="language" type="String"> + </argument> + <argument index="1" name="supported" type="bool"> + </argument> + <description> + Adds override for [method is_language_supported]. + </description> + </method> + <method name="set_script_support_override"> + <return type="void"> + </return> + <argument index="0" name="script" type="String"> + </argument> + <argument index="1" name="supported" type="bool"> + </argument> + <description> + Adds override for [method is_script_supported]. + </description> + </method> + </methods> + <members> + <member name="antialiased" type="bool" setter="set_antialiased" getter="get_antialiased" default="false"> + If [code]true[/code], the font is rendered with anti-aliasing. + </member> + <member name="data_path" type="String" setter="set_data_path" getter="get_data_path" default=""""> + The path to the font data file. If font data was loaded from memory location is set to [code]"(Memory)"[/code]. + </member> + <member name="distance_field_hint" type="bool" setter="set_distance_field_hint" getter="get_distance_field_hint" default="false"> + If [code]true[/code], distance field hint is enabled. + </member> + <member name="force_autohinter" type="bool" setter="set_force_autohinter" getter="get_force_autohinter" default="false"> + If [code]true[/code], default autohinter is used for font hinting. + </member> + <member name="hinting" type="int" setter="set_hinting" getter="get_hinting" enum="TextServer.Hinting" default="0"> + The font hinting mode used by FreeType. See [enum TextServer.Hinting] for options. + </member> + </members> + <constants> + </constants> +</class> diff --git a/doc/classes/Geometry2D.xml b/doc/classes/Geometry2D.xml index a6bcc1301b..4ff54d15ce 100644 --- a/doc/classes/Geometry2D.xml +++ b/doc/classes/Geometry2D.xml @@ -201,12 +201,21 @@ Each polygon's vertices will be rounded as determined by [code]join_type[/code], see [enum PolyJoinType]. The operation may result in an outer polygon (boundary) and inner polygon (hole) produced which could be distinguished by calling [method is_polygon_clockwise]. [b]Note:[/b] To translate the polygon's vertices specifically, multiply them to a [Transform2D]: - [codeblock] + [codeblocks] + [gdscript] var polygon = PackedVector2Array([Vector2(0, 0), Vector2(100, 0), Vector2(100, 100), Vector2(0, 100)]) var offset = Vector2(50, 50) polygon = Transform2D(0, offset) * polygon print(polygon) # prints [Vector2(50, 50), Vector2(150, 50), Vector2(150, 150), Vector2(50, 150)] - [/codeblock] + [/gdscript] + [csharp] + var polygon = new Vector2[] { new Vector2(0, 0), new Vector2(100, 0), new Vector2(100, 100), new Vector2(0, 100) }; + var offset = new Vector2(50, 50); + // TODO: This code is not valid right now. Ping @aaronfranke about it before Godot 4.0 is out. + //polygon = (Vector2[]) new Transform2D(0, offset).Xform(polygon); + //GD.Print(polygon); // prints [Vector2(50, 50), Vector2(150, 50), Vector2(150, 150), Vector2(50, 150)] + [/csharp] + [/codeblocks] </description> </method> <method name="offset_polyline"> diff --git a/doc/classes/GraphNode.xml b/doc/classes/GraphNode.xml index 33074536da..632d138932 100644 --- a/doc/classes/GraphNode.xml +++ b/doc/classes/GraphNode.xml @@ -18,6 +18,13 @@ Disables all input and output slots of the GraphNode. </description> </method> + <method name="clear_opentype_features"> + <return type="void"> + </return> + <description> + Removes all OpenType features. + </description> + </method> <method name="clear_slot"> <return type="void"> </return> @@ -95,6 +102,15 @@ Returns the type of the output connection [code]idx[/code]. </description> </method> + <method name="get_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code]. + </description> + </method> <method name="get_slot_color_left" qualifiers="const"> <return type="Color"> </return> @@ -149,6 +165,17 @@ Returns [code]true[/code] if right (output) slot [code]idx[/code] is enabled, [code]false[/code] otherwise. </description> </method> + <method name="set_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <argument index="1" name="value" type="int"> + </argument> + <description> + Sets OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + </description> + </method> <method name="set_slot"> <return type="void"> </return> @@ -184,6 +211,9 @@ <member name="comment" type="bool" setter="set_comment" getter="is_comment" default="false"> If [code]true[/code], the GraphNode is a comment node. </member> + <member name="language" type="String" setter="set_language" getter="get_language" default=""""> + Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </member> <member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" override="true" enum="Control.MouseFilter" default="0" /> <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2( 0, 0 )"> The offset of the GraphNode, relative to the scroll offset of the [GraphEdit]. @@ -203,6 +233,9 @@ If [code]true[/code], the close button will be visible. [b]Note:[/b] Pressing it will only emit the [signal close_request] signal, the GraphNode needs to be removed manually. </member> + <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="title" type="String" setter="set_title" getter="get_title" default=""""> The text displayed in the GraphNode's title bar. </member> diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index ec8ca7456a..b6594aac39 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -112,17 +112,31 @@ </argument> <description> Generates a GET/POST application/x-www-form-urlencoded style query string from a provided dictionary, e.g.: - [codeblock] + [codeblocks] + [gdscript] var fields = {"username": "user", "password": "pass"} var query_string = http_client.query_string_from_dict(fields) # Returns "username=user&password=pass" - [/codeblock] + [/gdscript] + [csharp] + var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } }; + string queryString = new HTTPClient().QueryStringFromDict(fields); + // Returns "username=user&password=pass" + [/csharp] + [/codeblocks] Furthermore, if a key has a [code]null[/code] value, only the key itself is added, without equal sign and value. If the value is an array, for each value in it a pair with the same key is added. - [codeblock] + [codeblocks] + [gdscript] var fields = {"single": 123, "not_valued": null, "multiple": [22, 33, 44]} var query_string = http_client.query_string_from_dict(fields) # Returns "single=123&not_valued&multiple=22&multiple=33&multiple=44" - [/codeblock] + [/gdscript] + [csharp] + var fields = new Godot.Collections.Dictionary{{"single", 123}, {"notValued", null}, {"multiple", new Godot.Collections.Array{22, 33, 44}}}; + string queryString = new HTTPClient().QueryStringFromDict(fields); + // Returns "single=123&not_valued&multiple=22&multiple=33&multiple=44" + [/csharp] + [/codeblocks] </description> </method> <method name="read_response_body_chunk"> @@ -147,12 +161,20 @@ Sends a request to the connected host. The URL parameter is just the part after the host, so for [code]http://somehost.com/index.php[/code], it is [code]index.php[/code]. Headers are HTTP request headers. For available HTTP methods, see [enum Method]. To create a POST request with query strings to push to the server, do: - [codeblock] + [codeblocks] + [gdscript] var fields = {"username" : "user", "password" : "pass"} var query_string = http_client.query_string_from_dict(fields) var headers = ["Content-Type: application/x-www-form-urlencoded", "Content-Length: " + str(query_string.length())] var result = http_client.request(http_client.METHOD_POST, "index.php", headers, query_string) - [/codeblock] + [/gdscript] + [csharp] + var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } }; + string queryString = new HTTPClient().QueryStringFromDict(fields); + string[] headers = {"Content-Type: application/x-www-form-urlencoded", "Content-Length: " + queryString.Length}; + var result = new HTTPClient().Request(HTTPClient.Method.Post, "index.php", headers, queryString); + [/csharp] + [/codeblocks] [b]Note:[/b] The [code]request_data[/code] parameter is ignored if [code]method[/code] is [constant HTTPClient.METHOD_GET]. This is because GET methods can't contain request data. As a workaround, you can pass request data as a query string in the URL. See [method String.http_escape] for an example. </description> </method> diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index 6eae881ffe..f2ab93033a 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -7,7 +7,8 @@ A node with the ability to send HTTP requests. Uses [HTTPClient] internally. Can be used to make HTTP requests, i.e. download or upload files or web content via HTTP. [b]Example of contacting a REST API and printing one of its returned fields:[/b] - [codeblock] + [codeblocks] + [gdscript] func _ready(): # Create an HTTP request node and connect its completion signal. var http_request = HTTPRequest.new() @@ -34,9 +35,48 @@ # Will print the user agent string used by the HTTPRequest node (as recognized by httpbin.org). print(response.headers["User-Agent"]) - [/codeblock] + [/gdscript] + [csharp] + public override void _Ready() + { + // Create an HTTP request node and connect its completion signal. + var httpRequest = new HTTPRequest(); + AddChild(httpRequest); + httpRequest.Connect("request_completed", this, nameof(HttpRequestCompleted)); + + // Perform a GET request. The URL below returns JSON as of writing. + Error error = httpRequest.Request("https://httpbin.org/get"); + if (error != Error.Ok) + { + GD.PushError("An error occurred in the HTTP request."); + } + + // Perform a POST request. The URL below returns JSON as of writing. + // Note: Don't make simultaneous requests using a single HTTPRequest node. + // The snippet below is provided for reference only. + string[] body = { "name", "Godette" }; + // GDScript to_json is non existent, so we use JSON.Print() here. + error = httpRequest.Request("https://httpbin.org/post", null, true, HTTPClient.Method.Post, JSON.Print(body)); + if (error != Error.Ok) + { + GD.PushError("An error occurred in the HTTP request."); + } + } + + + // Called when the HTTP request is completed. + private void HttpRequestCompleted(int result, int response_code, string[] headers, byte[] body) + { + // GDScript parse_json is non existent so we have to use JSON.parse, which has a slightly different syntax. + var response = JSON.Parse(body.GetStringFromUTF8()).Result as Godot.Collections.Dictionary; + // Will print the user agent string used by the HTTPRequest node (as recognized by httpbin.org). + GD.Print((response["headers"] as Godot.Collections.Dictionary)["User-Agent"]); + } + [/csharp] + [/codeblocks] [b]Example of loading and displaying an image using HTTPRequest:[/b] - [codeblock] + [codeblocks] + [gdscript] func _ready(): # Create an HTTP request node and connect its completion signal. var http_request = HTTPRequest.new() @@ -51,6 +91,9 @@ # Called when the HTTP request is completed. func _http_request_completed(result, response_code, headers, body): + if result != HTTPRequest.RESULT_SUCCESS: + push_error("Image couldn't be downloaded. Try a different image.") + var image = Image.new() var error = image.load_png_from_buffer(body) if error != OK: @@ -63,7 +106,48 @@ var texture_rect = TextureRect.new() add_child(texture_rect) texture_rect.texture = texture - [/codeblock] + [/gdscript] + [csharp] + public override void _Ready() + { + // Create an HTTP request node and connect its completion signal. + var httpRequest = new HTTPRequest(); + AddChild(httpRequest); + httpRequest.Connect("request_completed", this, nameof(HttpRequestCompleted)); + + // Perform the HTTP request. The URL below returns a PNG image as of writing. + Error error = httpRequest.Request("https://via.placeholder.com/512"); + if (error != Error.Ok) + { + GD.PushError("An error occurred in the HTTP request."); + } + } + + + // Called when the HTTP request is completed. + private void HttpRequestCompleted(int result, int response_code, string[] headers, byte[] body) + { + if (result != (int)HTTPRequest.Result.Success) + { + GD.PushError("Image couldn't be downloaded. Try a different image."); + } + var image = new Image(); + Error error = image.LoadPngFromBuffer(body); + if (error != Error.Ok) + { + GD.PushError("Couldn't load the image."); + } + + var texture = new ImageTexture(); + texture.CreateFromImage(image); + + // Display the image in a TextureRect node. + var textureRect = new TextureRect(); + AddChild(textureRect); + textureRect.Texture = texture; + } + [/csharp] + [/codeblocks] [b]Gzipped response bodies[/b]: HTTPRequest will automatically handle decompression of response bodies. A [code]Accept-Encoding[/code] header will be automatically added to each of your requests, unless one is already specified. Any response with a [code]Content-Encoding: gzip[/code] header will automatically be decompressed and delivered to you as uncompressed bytes. [b]Note:[/b] When performing HTTP requests from a project exported to HTML5, keep in mind the remote server may not allow requests from foreign origins due to [url=https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS]CORS[/url]. If you host the server in question, you should modify its backend to allow requests from foreign origins by adding the [code]Access-Control-Allow-Origin: *[/code] HTTP header. diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml index f8152c813e..e020293d76 100644 --- a/doc/classes/HashingContext.xml +++ b/doc/classes/HashingContext.xml @@ -6,8 +6,9 @@ <description> The HashingContext class provides an interface for computing cryptographic hashes over multiple iterations. This is useful for example when computing hashes of big files (so you don't have to load them all in memory), network streams, and data streams in general (so you don't have to hold buffers). The [enum HashType] enum shows the supported hashing algorithms. - [codeblock] - const CHUNK_SIZE = 1024 + [codeblocks] + [gdscript] + const CHUNK_SIZE = 102 func hash_file(path): var ctx = HashingContext.new() @@ -26,7 +27,36 @@ var res = ctx.finish() # Print the result as hex string and array. printt(res.hex_encode(), Array(res)) - [/codeblock] + [/gdscript] + [csharp] + public const int ChunkSize = 1024; + + public void HashFile(string path) + { + var ctx = new HashingContext(); + var file = new File(); + // Start a SHA-256 context. + ctx.Start(HashingContext.HashType.Sha256); + // Check that file exists. + if (!file.FileExists(path)) + { + return; + } + // Open the file to hash. + file.Open(path, File.ModeFlags.Read); + // Update the context after reading each chunk. + while (!file.EofReached()) + { + ctx.Update(file.GetBuffer(ChunkSize)); + } + // Get the computed hash. + byte[] res = ctx.Finish(); + // Print the result as hex string and array. + + GD.PrintT(res.HexEncode(), res); + } + [/csharp] + [/codeblocks] [b]Note:[/b] Not available in HTML5 exports. </description> <tutorials> diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index edf27b1660..b4325e822c 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -269,16 +269,18 @@ <argument index="1" name="y" type="int"> </argument> <description> - Returns the color of the pixel at [code](x, y)[/code]. This is the same as [method get_pixelv], but with two integer arguments instead of a [Vector2] argument. + Returns the color of the pixel at [code](x, y)[/code]. + This is the same as [method get_pixelv], but with two integer arguments instead of a [Vector2i] argument. </description> </method> <method name="get_pixelv" qualifiers="const"> <return type="Color"> </return> - <argument index="0" name="src" type="Vector2"> + <argument index="0" name="point" type="Vector2i"> </argument> <description> - Returns the color of the pixel at [code]src[/code]. This is the same as [method get_pixel], but with a [Vector2] argument instead of two integer arguments. + Returns the color of the pixel at [code]point[/code]. + This is the same as [method get_pixel], but with a [Vector2i] argument instead of two integer arguments. </description> </method> <method name="get_rect" qualifiers="const"> @@ -475,28 +477,56 @@ <argument index="2" name="color" type="Color"> </argument> <description> - Sets the [Color] of the pixel at [code](x, y)[/code]. Example: - [codeblock] + Sets the [Color] of the pixel at [code](x, y)[/code] to [code]color[/code]. Example: + [codeblocks] + [gdscript] + var img_width = 10 + var img_height = 5 var img = Image.new() img.create(img_width, img_height, false, Image.FORMAT_RGBA8) - img.set_pixel(x, y, color) - [/codeblock] + + img.set_pixel(1, 2, Color.red) # Sets the color at (1, 2) to red. + [/gdscript] + [csharp] + int imgWidth = 10; + int imgHeight = 5; + var img = new Image(); + img.Create(imgWidth, imgHeight, false, Image.Format.Rgba8); + + img.SetPixel(1, 2, Colors.Red); // Sets the color at (1, 2) to red. + [/csharp] + [/codeblocks] + This is the same as [method set_pixelv], but with a two integer arguments instead of a [Vector2i] argument. </description> </method> <method name="set_pixelv"> <return type="void"> </return> - <argument index="0" name="dst" type="Vector2"> + <argument index="0" name="point" type="Vector2i"> </argument> <argument index="1" name="color" type="Color"> </argument> <description> - Sets the [Color] of the pixel at [code](dst.x, dst.y)[/code]. Note that the [code]dst[/code] values must be integers. Example: - [codeblock] + Sets the [Color] of the pixel at [code]point[/code] to [code]color[/code]. Example: + [codeblocks] + [gdscript] + var img_width = 10 + var img_height = 5 var img = Image.new() img.create(img_width, img_height, false, Image.FORMAT_RGBA8) - img.set_pixelv(Vector2(x, y), color) - [/codeblock] + + img.set_pixelv(Vector2i(1, 2), Color.red) # Sets the color at (1, 2) to red. + [/gdscript] + [csharp] + int imgWidth = 10; + int imgHeight = 5; + var img = new Image(); + img.Create(imgWidth, imgHeight, false, Image.Format.Rgba8); + + img.SetPixelv(new Vector2i(1, 2), Colors.Red); // Sets the color at (1, 2) to red. + [/csharp] + [/codeblocks] + This is the same as [method set_pixel], but with a [Vector2i] argument instead of two integer arguments. </description> </method> <method name="shrink_x2"> diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index eafae7310c..cfb3e8d981 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -49,7 +49,7 @@ <return type="Vector3"> </return> <description> - Returns the acceleration of the device's accelerometer, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. + Returns the acceleration of the device's accelerometer sensor, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. Note this method returns an empty [Vector3] when running from the editor even when your device has an accelerometer. You must export your project to a supported device to read values from the accelerometer. [b]Note:[/b] This method only works on iOS, Android, and UWP. On other platforms, it always returns [constant Vector3.ZERO]. </description> @@ -102,7 +102,7 @@ <return type="Vector3"> </return> <description> - Returns the gravity of the device's accelerometer, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. + Returns the gravity of the device's accelerometer sensor, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. [b]Note:[/b] This method only works on Android and iOS. On other platforms, it always returns [constant Vector3.ZERO]. </description> </method> @@ -110,8 +110,8 @@ <return type="Vector3"> </return> <description> - Returns the rotation rate in rad/s around a device's X, Y, and Z axes of the gyroscope, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. - [b]Note:[/b] This method only works on Android. On other platforms, it always returns [constant Vector3.ZERO]. + Returns the rotation rate in rad/s around a device's X, Y, and Z axes of the gyroscope sensor, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. + [b]Note:[/b] This method only works on Android and iOS. On other platforms, it always returns [constant Vector3.ZERO]. </description> </method> <method name="get_joy_axis" qualifiers="const"> @@ -125,42 +125,6 @@ Returns the current value of the joypad axis at given index (see [enum JoyAxisList]). </description> </method> - <method name="get_joy_axis_index_from_string"> - <return type="int"> - </return> - <argument index="0" name="axis" type="String"> - </argument> - <description> - Returns the index of the provided axis name. - </description> - </method> - <method name="get_joy_axis_string"> - <return type="String"> - </return> - <argument index="0" name="axis_index" type="int"> - </argument> - <description> - Receives a [enum JoyAxisList] axis and returns its equivalent name as a string. - </description> - </method> - <method name="get_joy_button_index_from_string"> - <return type="int"> - </return> - <argument index="0" name="button" type="String"> - </argument> - <description> - Returns the index of the provided button name. - </description> - </method> - <method name="get_joy_button_string"> - <return type="String"> - </return> - <argument index="0" name="button_index" type="int"> - </argument> - <description> - Receives a gamepad button from [enum JoyButtonList] and returns its equivalent name as a string. - </description> - </method> <method name="get_joy_guid" qualifiers="const"> <return type="String"> </return> @@ -208,8 +172,8 @@ <return type="Vector3"> </return> <description> - Returns the the magnetic field strength in micro-Tesla for all axes of the device's magnetometer, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. - [b]Note:[/b] This method only works on Android and UWP. On other platforms, it always returns [constant Vector3.ZERO]. + Returns the the magnetic field strength in micro-Tesla for all axes of the device's magnetometer sensor, if the device has one. Otherwise, the method returns [constant Vector3.ZERO]. + [b]Note:[/b] This method only works on Android, iOS and UWP. On other platforms, it always returns [constant Vector3.ZERO]. </description> </method> <method name="get_mouse_button_mask" qualifiers="const"> @@ -335,12 +299,20 @@ <description> Feeds an [InputEvent] to the game. Can be used to artificially trigger input events from code. Also generates [method Node._input] calls. Example: - [codeblock] - var a = InputEventAction.new() - a.action = "ui_cancel" - a.pressed = true - Input.parse_input_event(a) - [/codeblock] + [codeblocks] + [gdscript] + var cancel_event = InputEventAction.new() + cancel_event.action = "ui_cancel" + cancel_event.pressed = true + Input.parse_input_event(cancel_event) + [/gdscript] + [csharp] + var cancelEvent = new InputEventAction(); + cancelEvent.Action = "ui_cancel"; + cancelEvent.Pressed = true; + Input.ParseInputEvent(cancelEvent); + [/csharp] + [/codeblocks] </description> </method> <method name="remove_joy_mapping"> @@ -431,7 +403,7 @@ </argument> <description> Vibrate Android and iOS devices. - [b]Note:[/b] It needs VIBRATE permission for Android at export settings. iOS does not support duration. + [b]Note:[/b] It needs [code]VIBRATE[/code] permission for Android at export settings. iOS does not support duration. </description> </method> <method name="warp_mouse_position"> diff --git a/doc/classes/InputMap.xml b/doc/classes/InputMap.xml index 062ac3869d..49d29b3a53 100644 --- a/doc/classes/InputMap.xml +++ b/doc/classes/InputMap.xml @@ -120,7 +120,7 @@ Returns [code]true[/code] if the [InputMap] has a registered action with the given name. </description> </method> - <method name="load_from_globals"> + <method name="load_from_project_settings"> <return type="void"> </return> <description> diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index 25420bd77b..0fd0fe7b3d 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -43,6 +43,15 @@ Removes all items from the list. </description> </method> + <method name="clear_item_opentype_features"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Removes all OpenType features from the item's text. + </description> + </method> <method name="ensure_current_is_visible"> <return type="void"> </return> @@ -114,6 +123,15 @@ Returns the region of item's icon used. The whole icon will be used if the region has no area. </description> </method> + <method name="get_item_language" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Returns item's text language code. + </description> + </method> <method name="get_item_metadata" qualifiers="const"> <return type="Variant"> </return> @@ -123,6 +141,17 @@ Returns the metadata value of the specified index. </description> </method> + <method name="get_item_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code] of the item's text. + </description> + </method> <method name="get_item_text" qualifiers="const"> <return type="String"> </return> @@ -132,6 +161,15 @@ Returns the text associated with the specified index. </description> </method> + <method name="get_item_text_direction" qualifiers="const"> + <return type="int" enum="Control.TextDirection"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Returns item's text base writing direction. + </description> + </method> <method name="get_item_tooltip" qualifiers="const"> <return type="String"> </return> @@ -247,11 +285,16 @@ <argument index="1" name="custom_bg_color" type="Color"> </argument> <description> - Sets the background color of the item specified by [code]idx[/code] index to the specified [Color]. - [codeblock] - var some_string = "Some text" - some_string.set_item_custom_bg_color(0,Color(1, 0, 0, 1) # This will set the background color of the first item of the control to red. - [/codeblock] + [codeblocks] + [gdscript] + var itemList = ItemList.new() + some_string.set_item_custom_bg_color(0, Color.red) # This will set the background color of the first item of the control to red. + [/gdscript] + [csharp] + var itemList = new ItemList(); + itemList.SetItemCustomBgColor(0, Colors.Red); // This will set the background color of the first item of the control to red. + [/csharp] + [/codeblocks] </description> </method> <method name="set_item_custom_fg_color"> @@ -263,10 +306,16 @@ </argument> <description> Sets the foreground color of the item specified by [code]idx[/code] index to the specified [Color]. - [codeblock] - var some_string = "Some text" - some_string.set_item_custom_fg_color(0,Color(1, 0, 0, 1) # This will set the foreground color of the first item of the control to red. - [/codeblock] + [codeblocks] + [gdscript] + var item_list = ItemList.new() + item_list.set_item_custom_fg_color(0, Color.red) # This will set the foreground color of the first item of the control to red. + [/gdscript] + [csharp] + var itemList = new ItemList(); + itemList.SetItemCustomFgColor(0, Colors.Red); // This will set the foreground color of the first item of the control to red. + [/csharp] + [/codeblocks] </description> </method> <method name="set_item_disabled"> @@ -325,6 +374,17 @@ Sets whether the item icon will be drawn transposed. </description> </method> + <method name="set_item_language"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="language" type="String"> + </argument> + <description> + Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </description> + </method> <method name="set_item_metadata"> <return type="void"> </return> @@ -336,6 +396,19 @@ Sets a value (of any type) to be stored with the item associated with the specified index. </description> </method> + <method name="set_item_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <argument index="2" name="value" type="int"> + </argument> + <description> + Sets OpenType feature [code]tag[/code] for the item's text. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + </description> + </method> <method name="set_item_selectable"> <return type="void"> </return> @@ -358,6 +431,17 @@ Sets text of the item associated with the specified index. </description> </method> + <method name="set_item_text_direction"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="direction" type="int" enum="Control.TextDirection"> + </argument> + <description> + Sets item's text base writing direction. + </description> + </method> <method name="set_item_tooltip"> <return type="void"> </return> @@ -533,6 +617,9 @@ <theme_item name="font_color_selected" type="Color" default="Color( 1, 1, 1, 1 )"> Text [Color] used when the item is selected. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the item's text. + </theme_item> <theme_item name="guide_color" type="Color" default="Color( 0, 0, 0, 0.1 )"> [Color] of the guideline. The guideline is a line drawn between each row of items. </theme_item> diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml index 4dbceb35e9..991ebcd7a0 100644 --- a/doc/classes/JSONParseResult.xml +++ b/doc/classes/JSONParseResult.xml @@ -24,13 +24,26 @@ A [Variant] containing the parsed JSON. Use [method @GDScript.typeof] or the [code]is[/code] keyword to check if it is what you expect. For example, if the JSON source starts with curly braces ([code]{}[/code]), a [Dictionary] will be returned. If the JSON source starts with brackets ([code][][/code]), an [Array] will be returned. [b]Note:[/b] The JSON specification does not define integer or float types, but only a [i]number[/i] type. Therefore, parsing a JSON text will convert all numerical values to [float] types. [b]Note:[/b] JSON objects do not preserve key order like Godot dictionaries, thus, you should not rely on keys being in a certain order if a dictionary is constructed from JSON. In contrast, JSON arrays retain the order of their elements: - [codeblock] + [codeblocks] + [gdscript] var p = JSON.parse('["hello", "world", "!"]') if typeof(p.result) == TYPE_ARRAY: print(p.result[0]) # Prints "hello" else: push_error("Unexpected results.") - [/codeblock] + [/gdscript] + [csharp] + JSONParseResult p = JSON.Parse("[\"hello\"], \"world\", \"!\"]"); + if (p.Result is Godot.Collections.Array) + { + GD.Print((p.Result as Godot.Collections.Array)[0]); // Prints "hello" + } + else + { + GD.PushError("Unexpected results."); + } + [/csharp] + [/codeblocks] </member> </members> <constants> diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml index 425df00b6f..476b64a336 100644 --- a/doc/classes/KinematicBody2D.xml +++ b/doc/classes/KinematicBody2D.xml @@ -37,11 +37,20 @@ <description> Returns a [KinematicCollision2D], which contains information about a collision that occurred during the last call to [method move_and_slide] or [method move_and_slide_with_snap]. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count] - 1). [b]Example usage:[/b] - [codeblock] + [codeblocks] + [gdscript] for i in get_slide_count(): var collision = get_slide_collision(i) print("Collided with: ", collision.collider.name) - [/codeblock] + [/gdscript] + [csharp] + for (int i = 0; i < GetSlideCount(); i++) + { + KinematicCollision2D collision = GetSlideCollision(i); + GD.Print("Collided with: ", (collision.Collider as Node).Name); + } + [/csharp] + [/codeblocks] </description> </method> <method name="get_slide_count" qualifiers="const"> diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml index 570d7f075b..1edf31de4a 100644 --- a/doc/classes/Label.xml +++ b/doc/classes/Label.xml @@ -11,6 +11,13 @@ <link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link> </tutorials> <methods> + <method name="clear_opentype_features"> + <return type="void"> + </return> + <description> + Removes all OpenType features. + </description> + </method> <method name="get_line_count" qualifiers="const"> <return type="int"> </return> @@ -21,8 +28,21 @@ <method name="get_line_height" qualifiers="const"> <return type="int"> </return> + <argument index="0" name="line" type="int" default="-1"> + </argument> + <description> + Returns the height of the line [code]line[/code]. + If [code]line[/code] is set to [code]-1[/code], returns biggest line height. + If there're no lines returns font size in pixels. + </description> + </method> + <method name="get_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="tag" type="String"> + </argument> <description> - Returns the font size in pixels. + Returns OpenType feature [code]tag[/code]. </description> </method> <method name="get_total_character_count" qualifiers="const"> @@ -39,6 +59,17 @@ Returns the number of lines shown. Useful if the [Label]'s height cannot currently display all lines. </description> </method> + <method name="set_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <argument index="1" name="value" type="int"> + </argument> + <description> + Returns OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + </description> + </method> </methods> <members> <member name="align" type="int" setter="set_align" getter="get_align" enum="Label.Align" default="0"> @@ -50,6 +81,9 @@ <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. It also lets you scale the node down freely. </member> + <member name="language" type="String" setter="set_language" getter="get_language" default=""""> + Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </member> <member name="lines_skipped" type="int" setter="set_lines_skipped" getter="get_lines_skipped" default="0"> The node ignores the first [code]lines_skipped[/code] lines before it starts to display text. </member> @@ -61,9 +95,18 @@ Limits the amount of visible characters. If you set [code]percent_visible[/code] to 0.5, only up to half of the text's characters will display on screen. Useful to animate the text in a dialog box. </member> <member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" override="true" default="4" /> + <member name="structured_text_bidi_override" type="int" setter="set_structured_text_bidi_override" getter="get_structured_text_bidi_override" enum="Control.StructuredTextParser" default="0"> + Set BiDi algorithm override for the structured text. + </member> + <member name="structured_text_bidi_override_options" type="Array" setter="set_structured_text_bidi_override_options" getter="get_structured_text_bidi_override_options" default="[ ]"> + Set additional options for BiDi override. + </member> <member name="text" type="String" setter="set_text" getter="get_text" default=""""> The text to display on screen. </member> + <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="uppercase" type="bool" setter="set_uppercase" getter="is_uppercase" default="false"> If [code]true[/code], all the text displays as UPPERCASE. </member> @@ -85,7 +128,7 @@ Align rows to the right. </constant> <constant name="ALIGN_FILL" value="3" enum="Align"> - Expand row whitespaces to fit the width. + Expand row to fit the width. </constant> <constant name="VALIGN_TOP" value="0" enum="VAlign"> Align the whole text to the top. @@ -111,7 +154,10 @@ [Color] of the text's shadow effect. </theme_item> <theme_item name="font_outline_modulate" type="Color" default="Color( 1, 1, 1, 1 )"> - The tint of [Font]'s outline. See [member DynamicFont.outline_color]. + The tint of [Font]'s outline. + </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [Label]'s text. </theme_item> <theme_item name="line_spacing" type="int" default="3"> Vertical space between lines in multiline [Label]. @@ -119,8 +165,8 @@ <theme_item name="normal" type="StyleBox"> Background [StyleBox] for the [Label]. </theme_item> - <theme_item name="shadow_as_outline" type="int" default="0"> - Boolean value. If set to 1 ([code]true[/code]), the shadow will be displayed around the whole text as an outline. + <theme_item name="outline_size" type="int" default="0"> + Text outline size. </theme_item> <theme_item name="shadow_offset_x" type="int" default="1"> The horizontal offset of the text's shadow. @@ -128,5 +174,8 @@ <theme_item name="shadow_offset_y" type="int" default="1"> The vertical offset of the text's shadow. </theme_item> + <theme_item name="shadow_outline_size" type="int" default="1"> + Shadow outline size. If set to 1 or greater, the shadow will be displayed around the whole text as an outline. + </theme_item> </theme_items> </class> diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index 5c2dffd538..f05121d48c 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -10,6 +10,7 @@ - [kbd]Ctrl + X[/kbd]: Cut - [kbd]Ctrl + V[/kbd] or [kbd]Ctrl + Y[/kbd]: Paste/"yank" - [kbd]Ctrl + Z[/kbd]: Undo + - [kbd]Ctrl + ~[/kbd]: Swap input direction. - [kbd]Ctrl + Shift + Z[/kbd]: Redo - [kbd]Ctrl + U[/kbd]: Delete text from the cursor position to the beginning of the line - [kbd]Ctrl + K[/kbd]: Delete text from the cursor position to the end of the line @@ -46,6 +47,13 @@ Erases the [LineEdit]'s [member text]. </description> </method> + <method name="clear_opentype_features"> + <return type="void"> + </return> + <description> + Removes all OpenType features. + </description> + </method> <method name="delete_char_at_cursor"> <return type="void"> </return> @@ -78,6 +86,15 @@ Returns the [PopupMenu] of this [LineEdit]. By default, this menu is displayed when right-clicking on the [LineEdit]. </description> </method> + <method name="get_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code]. + </description> + </method> <method name="get_scroll_offset" qualifiers="const"> <return type="int"> </return> @@ -103,12 +120,20 @@ </argument> <description> Selects characters inside [LineEdit] between [code]from[/code] and [code]to[/code]. By default, [code]from[/code] is at the beginning and [code]to[/code] at the end. - [codeblock] + [codeblocks] + [gdscript] text = "Welcome" select() # Will select "Welcome". select(4) # Will select "ome". select(2, 5) # Will select "lco". - [/codeblock] + [/gdscript] + [csharp] + Text = "Welcome"; + Select(); // Will select "Welcome". + Select(4); // Will select "ome". + Select(2, 5); // Will select "lco". + [/csharp] + [/codeblocks] </description> </method> <method name="select_all"> @@ -118,6 +143,17 @@ Selects the whole [String]. </description> </method> + <method name="set_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <argument index="1" name="value" type="int"> + </argument> + <description> + Returns OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + </description> + </method> </methods> <members> <member name="align" type="int" setter="set_align" getter="get_align" enum="LineEdit.Align" default="0"> @@ -131,6 +167,10 @@ </member> <member name="caret_force_displayed" type="bool" setter="cursor_set_force_displayed" getter="cursor_get_force_displayed" default="false"> </member> + <member name="caret_mid_grapheme" type="bool" setter="set_mid_grapheme_caret_enabled" getter="get_mid_grapheme_caret_enabled" default="false"> + Allow moving caret, selecting and removing the individual composite character components. + Note: [kbd]Backspace[/kbd] is always removing individual composite character components. + </member> <member name="caret_position" type="int" setter="set_cursor_position" getter="get_cursor_position" default="0"> The cursor's position inside the [LineEdit]. When set, the text may scroll to accommodate it. </member> @@ -140,6 +180,9 @@ <member name="context_menu_enabled" type="bool" setter="set_context_menu_enabled" getter="is_context_menu_enabled" default="true"> If [code]true[/code], the context menu will appear when right-clicked. </member> + <member name="draw_control_chars" type="bool" setter="set_draw_control_chars" getter="get_draw_control_chars" default="false"> + If [code]true[/code], control characters are displayed. + </member> <member name="editable" type="bool" setter="set_editable" getter="is_editable" default="true"> If [code]false[/code], existing text cannot be modified and new text cannot be added. </member> @@ -147,6 +190,9 @@ If [code]true[/code], the [LineEdit] width will increase to stay longer than the [member text]. It will [b]not[/b] compress if the [member text] is shortened. </member> <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" override="true" enum="Control.FocusMode" default="2" /> + <member name="language" type="String" setter="set_language" getter="get_language" default=""""> + Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </member> <member name="max_length" type="int" setter="set_max_length" getter="get_max_length" default="0"> Maximum amount of characters that can be entered inside the [LineEdit]. If [code]0[/code], there is no limit. </member> @@ -172,10 +218,19 @@ <member name="shortcut_keys_enabled" type="bool" setter="set_shortcut_keys_enabled" getter="is_shortcut_keys_enabled" default="true"> If [code]false[/code], using shortcuts will be disabled. </member> + <member name="structured_text_bidi_override" type="int" setter="set_structured_text_bidi_override" getter="get_structured_text_bidi_override" enum="Control.StructuredTextParser" default="0"> + Set BiDi algorithm override for the structured text. + </member> + <member name="structured_text_bidi_override_options" type="Array" setter="set_structured_text_bidi_override_options" getter="get_structured_text_bidi_override_options" default="[ ]"> + Set additional options for BiDi override. + </member> <member name="text" type="String" setter="set_text" getter="get_text" default=""""> String value of the [LineEdit]. [b]Note:[/b] Changing text using this property won't emit the [signal text_changed] signal. </member> + <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="virtual_keyboard_enabled" type="bool" setter="set_virtual_keyboard_enabled" getter="is_virtual_keyboard_enabled" default="true"> If [code]true[/code], the native virtual keyboard is shown when focused on platforms that support it. </member> @@ -212,7 +267,7 @@ Aligns the text on the right-hand side of the [LineEdit]. </constant> <constant name="ALIGN_FILL" value="3" enum="Align"> - Stretches whitespaces to fit the [LineEdit]'s width. + Expand row to fit the [LineEdit]'s width. </constant> <constant name="MENU_CUT" value="0" enum="MenuItems"> Cuts (copies and clears) the selected text. @@ -236,7 +291,70 @@ <constant name="MENU_REDO" value="6" enum="MenuItems"> Reverse the last undo action. </constant> - <constant name="MENU_MAX" value="7" enum="MenuItems"> + <constant name="MENU_DIR_INHERITED" value="7" enum="MenuItems"> + Sets text direction to inherited. + </constant> + <constant name="MENU_DIR_AUTO" value="8" enum="MenuItems"> + Sets text direction to automatic. + </constant> + <constant name="MENU_DIR_LTR" value="9" enum="MenuItems"> + Sets text direction to left-to-right. + </constant> + <constant name="MENU_DIR_RTL" value="10" enum="MenuItems"> + Sets text direction to right-to-left. + </constant> + <constant name="MENU_DISPLAY_UCC" value="11" enum="MenuItems"> + Toggles control character display. + </constant> + <constant name="MENU_INSERT_LRM" value="12" enum="MenuItems"> + Inserts left-to-right mark (LRM) character. + </constant> + <constant name="MENU_INSERT_RLM" value="13" enum="MenuItems"> + Inserts right-to-left mark (RLM) character. + </constant> + <constant name="MENU_INSERT_LRE" value="14" enum="MenuItems"> + Inserts start of left-to-right embedding (LRE) character. + </constant> + <constant name="MENU_INSERT_RLE" value="15" enum="MenuItems"> + Inserts start of right-to-left embedding (RLE) character. + </constant> + <constant name="MENU_INSERT_LRO" value="16" enum="MenuItems"> + Inserts start of left-to-right override (LRO) character. + </constant> + <constant name="MENU_INSERT_RLO" value="17" enum="MenuItems"> + Inserts start of right-to-left override (RLO) character. + </constant> + <constant name="MENU_INSERT_PDF" value="18" enum="MenuItems"> + Inserts pop direction formatting (PDF) character. + </constant> + <constant name="MENU_INSERT_ALM" value="19" enum="MenuItems"> + Inserts Arabic letter mark (ALM) character. + </constant> + <constant name="MENU_INSERT_LRI" value="20" enum="MenuItems"> + Inserts left-to-right isolate (LRI) character. + </constant> + <constant name="MENU_INSERT_RLI" value="21" enum="MenuItems"> + Inserts right-to-left isolate (RLI) character. + </constant> + <constant name="MENU_INSERT_FSI" value="22" enum="MenuItems"> + Inserts first strong isolate (FSI) character. + </constant> + <constant name="MENU_INSERT_PDI" value="23" enum="MenuItems"> + Inserts pop direction isolate (PDI) character. + </constant> + <constant name="MENU_INSERT_ZWJ" value="24" enum="MenuItems"> + Inserts zero width joiner (ZWJ) character. + </constant> + <constant name="MENU_INSERT_ZWNJ" value="25" enum="MenuItems"> + Inserts zero width non-joiner (ZWNJ) character. + </constant> + <constant name="MENU_INSERT_WJ" value="26" enum="MenuItems"> + Inserts word joiner (WJ) character. + </constant> + <constant name="MENU_INSERT_SHY" value="27" enum="MenuItems"> + Inserts soft hyphen (SHY) character. + </constant> + <constant name="MENU_MAX" value="28" enum="MenuItems"> Represents the size of the [enum MenuItems] enum. </constant> </constants> @@ -268,6 +386,9 @@ <theme_item name="font_color_uneditable" type="Color" default="Color( 0.88, 0.88, 0.88, 0.5 )"> Font color when editing is disabled. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [LineEdit]'s text. + </theme_item> <theme_item name="minimum_spaces" type="int" default="12"> Minimum horizontal space for the text (not counting the clear button and content margins). This value is measured in count of space characters (i.e. this amount of space characters can be displayed without scrolling). </theme_item> diff --git a/doc/classes/LinkButton.xml b/doc/classes/LinkButton.xml index 15307de897..4b8ab3a6cf 100644 --- a/doc/classes/LinkButton.xml +++ b/doc/classes/LinkButton.xml @@ -10,12 +10,51 @@ <tutorials> </tutorials> <methods> + <method name="clear_opentype_features"> + <return type="void"> + </return> + <description> + Removes all OpenType features. + </description> + </method> + <method name="get_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code]. + </description> + </method> + <method name="set_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <argument index="1" name="value" type="int"> + </argument> + <description> + Returns OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + </description> + </method> </methods> <members> + <member name="language" type="String" setter="set_language" getter="get_language" default=""""> + Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </member> <member name="mouse_default_cursor_shape" type="int" setter="set_default_cursor_shape" getter="get_default_cursor_shape" override="true" enum="Control.CursorShape" default="2" /> + <member name="structured_text_bidi_override" type="int" setter="set_structured_text_bidi_override" getter="get_structured_text_bidi_override" enum="Control.StructuredTextParser" default="0"> + Set BiDi algorithm override for the structured text. + </member> + <member name="structured_text_bidi_override_options" type="Array" setter="set_structured_text_bidi_override_options" getter="get_structured_text_bidi_override_options" default="[ ]"> + Set additional options for BiDi override. + </member> <member name="text" type="String" setter="set_text" getter="get_text" default=""""> The button's text that will be displayed inside the button's area. </member> + <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="underline" type="int" setter="set_underline_mode" getter="get_underline_mode" enum="LinkButton.UnderlineMode" default="0"> Determines when to show the underline. See [enum UnderlineMode] for options. </member> @@ -47,6 +86,9 @@ <theme_item name="font_color_pressed" type="Color" default="Color( 1, 1, 1, 1 )"> Text [Color] used when the [LinkButton] is being pressed. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [LinkButton]'s text. + </theme_item> <theme_item name="underline_spacing" type="int" default="2"> The vertical space between the baseline of text and the underline. </theme_item> diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml index 3c3cbbfa29..7682379b64 100644 --- a/doc/classes/MainLoop.xml +++ b/doc/classes/MainLoop.xml @@ -126,5 +126,8 @@ Notification received from the OS when the application is defocused, i.e. when changing the focus from any open window of the Godot instance to the OS desktop or a thirdparty application. Implemented on desktop platforms. </constant> + <constant name="NOTIFICATION_TEXT_SERVER_CHANGED" value="2018"> + Notification received when text server is changed. + </constant> </constants> </class> diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml index fe38c08280..ac371d1e7b 100644 --- a/doc/classes/MenuButton.xml +++ b/doc/classes/MenuButton.xml @@ -67,6 +67,9 @@ <theme_item name="font_color_pressed" type="Color" default="Color( 1, 1, 1, 1 )"> Text [Color] used when the [MenuButton] is being pressed. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [MenuButton]'s text. + </theme_item> <theme_item name="hover" type="StyleBox"> [StyleBox] used when the [MenuButton] is being hovered. </theme_item> diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml index 9c753818d9..fcc259fb44 100644 --- a/doc/classes/MultiplayerAPI.xml +++ b/doc/classes/MultiplayerAPI.xml @@ -75,16 +75,6 @@ Sends the given raw [code]bytes[/code] to a specific peer identified by [code]id[/code] (see [method NetworkedMultiplayerPeer.set_target_peer]). Default ID is [code]0[/code], i.e. broadcast to all peers. </description> </method> - <method name="set_root_node"> - <return type="void"> - </return> - <argument index="0" name="node" type="Node"> - </argument> - <description> - Sets the base root node to use for RPCs. Instead of an absolute path, a relative path will be used to find the node upon which the RPC should be executed. - This effectively allows to have different branches of the scene tree to be managed by different MultiplayerAPI, allowing for example to run both client and server in the same scene. - </description> - </method> </methods> <members> <member name="allow_object_decoding" type="bool" setter="set_allow_object_decoding" getter="is_object_decoding_allowed" default="false"> @@ -97,6 +87,10 @@ <member name="refuse_new_network_connections" type="bool" setter="set_refuse_new_network_connections" getter="is_refusing_new_network_connections" default="false"> If [code]true[/code], the MultiplayerAPI's [member network_peer] refuses new incoming connections. </member> + <member name="root_node" type="Node" setter="set_root_node" getter="get_root_node"> + The root node to use for RPCs. Instead of an absolute path, a relative path will be used to find the node upon which the RPC should be executed. + This effectively allows to have different branches of the scene tree to be managed by different MultiplayerAPI, allowing for example to run both client and server in the same scene. + </member> </members> <signals> <signal name="connected_to_server"> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index e3fc87ffb5..62d88afa51 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -1013,6 +1013,9 @@ Notification received from the OS when the application is defocused, i.e. when changing the focus from any open window of the Godot instance to the OS desktop or a thirdparty application. Implemented on desktop platforms. </constant> + <constant name="NOTIFICATION_TEXT_SERVER_CHANGED" value="2018"> + Notification received when text server is changed. + </constant> <constant name="PAUSE_MODE_INHERIT" value="0" enum="PauseMode"> Inherits pause mode from the node's parent. For the root node, it is equivalent to [constant PAUSE_MODE_STOP]. Default. </constant> diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml index 510f952fea..53309bae96 100644 --- a/doc/classes/OptionButton.xml +++ b/doc/classes/OptionButton.xml @@ -239,7 +239,10 @@ The horizontal space between the arrow icon and the right edge of the button. </theme_item> <theme_item name="disabled" type="StyleBox"> - [StyleBox] used when the [OptionButton] is disabled. + [StyleBox] used when the [OptionButton] is disabled (for left-to-right layouts). + </theme_item> + <theme_item name="disabled_mirrored" type="StyleBox"> + [StyleBox] used when the [OptionButton] is disabled (for right-to-left layouts). </theme_item> <theme_item name="focus" type="StyleBox"> [StyleBox] used when the [OptionButton] is focused. It is displayed over the current [StyleBox], so using [StyleBoxEmpty] will just disable the focus visual effect. @@ -259,17 +262,29 @@ <theme_item name="font_color_pressed" type="Color" default="Color( 1, 1, 1, 1 )"> Text [Color] used when the [OptionButton] is being pressed. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the [OptionButton]'s text. + </theme_item> <theme_item name="hover" type="StyleBox"> - [StyleBox] used when the [OptionButton] is being hovered. + [StyleBox] used when the [OptionButton] is being hovered (for left-to-right layouts). + </theme_item> + <theme_item name="hover_mirrored" type="StyleBox"> + [StyleBox] used when the [OptionButton] is being hovered (for right-to-left layouts). </theme_item> <theme_item name="hseparation" type="int" default="2"> The horizontal space between [OptionButton]'s icon and text. </theme_item> <theme_item name="normal" type="StyleBox"> - Default [StyleBox] for the [OptionButton]. + Default [StyleBox] for the [OptionButton] (for left-to-right layouts). + </theme_item> + <theme_item name="normal_mirrored" type="StyleBox"> + Default [StyleBox] for the [OptionButton] (for right-to-left layouts). </theme_item> <theme_item name="pressed" type="StyleBox"> - [StyleBox] used when the [OptionButton] is being pressed. + [StyleBox] used when the [OptionButton] is being pressed (for left-to-right layouts). + </theme_item> + <theme_item name="pressed_mirrored" type="StyleBox"> + [StyleBox] used when the [OptionButton] is being pressed (for right-to-left layouts). </theme_item> </theme_items> </class> diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml index b1ec9a222a..c663f26d84 100644 --- a/doc/classes/PopupMenu.xml +++ b/doc/classes/PopupMenu.xml @@ -244,6 +244,15 @@ Removes all items from the [PopupMenu]. </description> </method> + <method name="clear_item_opentype_features"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Removes all OpenType features form the item's text. + </description> + </method> <method name="get_current_index" qualifiers="const"> <return type="int"> </return> @@ -293,6 +302,15 @@ Returns the index of the item containing the specified [code]id[/code]. Index is automatically assigned to each item by the engine. Index can not be set manually. </description> </method> + <method name="get_item_language" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Returns item's text language code. + </description> + </method> <method name="get_item_metadata" qualifiers="const"> <return type="Variant"> </return> @@ -302,6 +320,17 @@ Returns the metadata of the specified item, which might be of any type. You can set it with [method set_item_metadata], which provides a simple way of assigning context data to items. </description> </method> + <method name="get_item_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code] of the item's text. + </description> + </method> <method name="get_item_shortcut" qualifiers="const"> <return type="Shortcut"> </return> @@ -329,6 +358,15 @@ Returns the text of the item at index [code]idx[/code]. </description> </method> + <method name="get_item_text_direction" qualifiers="const"> + <return type="int" enum="Control.TextDirection"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + Returns item's text base writing direction. + </description> + </method> <method name="get_item_tooltip" qualifiers="const"> <return type="String"> </return> @@ -494,6 +532,17 @@ Sets the [code]id[/code] of the item at index [code]idx[/code]. </description> </method> + <method name="set_item_language"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="language" type="String"> + </argument> + <description> + Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </description> + </method> <method name="set_item_metadata"> <return type="void"> </return> @@ -516,6 +565,19 @@ Sets the state of an multistate item. See [method add_multistate_item] for details. </description> </method> + <method name="set_item_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <argument index="2" name="value" type="int"> + </argument> + <description> + Sets OpenType feature [code]tag[/code] for the item's text. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + </description> + </method> <method name="set_item_shortcut"> <return type="void"> </return> @@ -562,6 +624,17 @@ Sets the text of the item at index [code]idx[/code]. </description> </method> + <method name="set_item_text_direction"> + <return type="void"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="direction" type="int" enum="Control.TextDirection"> + </argument> + <description> + Sets item's text base writing direction. + </description> + </method> <method name="set_item_tooltip"> <return type="void"> </return> @@ -653,6 +726,9 @@ <theme_item name="font_color_hover" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )"> [Color] used for the hovered text. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the menu items. + </theme_item> <theme_item name="hover" type="StyleBox"> [StyleBox] displayed when the [PopupMenu] item is hovered. </theme_item> @@ -681,7 +757,10 @@ [StyleBox] used for the separators. See [method add_separator]. </theme_item> <theme_item name="submenu" type="Texture2D"> - [Texture2D] icon for the submenu arrow. + [Texture2D] icon for the submenu arrow (for left-to-right layouts). + </theme_item> + <theme_item name="submenu_mirrored" type="Texture2D"> + [Texture2D] icon for the submenu arrow (for right-to-left layouts). </theme_item> <theme_item name="unchecked" type="Texture2D"> [Texture2D] icon for the unchecked checkbox items. diff --git a/doc/classes/ProgressBar.xml b/doc/classes/ProgressBar.xml index c957d6f182..c05cbf4413 100644 --- a/doc/classes/ProgressBar.xml +++ b/doc/classes/ProgressBar.xml @@ -35,5 +35,8 @@ <theme_item name="font_color_shadow" type="Color" default="Color( 0, 0, 0, 1 )"> The color of the text's shadow. </theme_item> + <theme_item name="font_size" type="int"> + Font size used to draw the fill percentage if [member percent_visible] is [code]true[/code]. + </theme_item> </theme_items> </class> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 96d71db383..fa4ce9bc6d 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -96,7 +96,21 @@ <argument index="0" name="path" type="String"> </argument> <description> - Converts a localized path ([code]res://[/code]) to a full native OS path. + Returns the absolute, native OS path corresponding to the localized [code]path[/code] (starting with [code]res://[/code] or [code]user://[/code]). The returned path will vary depending on the operating system and user preferences. See [url=https://docs.godotengine.org/en/latest/tutorials/io/data_paths.html]File paths in Godot projects[/url] to see what those paths convert to. See also [method localize_path]. + [b]Note:[/b] [method globalize_path] with [code]res://[/code] will not work in an exported project. Instead, prepend the executable's base directory to the path when running from an exported project: + [codeblock] + var path = "" + if OS.has_feature("editor"): + # Running from an editor binary. + # `path` will contain the absolute path to `hello.txt` located in the project root. + path = ProjectSettings.globalize_path("res://hello.txt") + else: + # Running from an exported project. + # `path` will contain the absolute path to `hello.txt` next to the executable. + # This is *not* identical to using `ProjectSettings.globalize_path()` with a `res://` path, + # but is close enough in spirit. + path = OS.get_executable_path().get_base_dir().plus_file("hello.txt") + [/codeblock] </description> </method> <method name="has_setting" qualifiers="const"> @@ -129,7 +143,7 @@ <argument index="0" name="path" type="String"> </argument> <description> - Convert a path to a localized path ([code]res://[/code] path). + Returns the localized path (starting with [code]res://[/code]) corresponding to the absolute, native OS [code]path[/code]. See also [method globalize_path]. </description> </method> <method name="property_can_revert"> @@ -453,6 +467,9 @@ <member name="display/window/energy_saving/keep_screen_on" type="bool" setter="" getter="" default="true"> If [code]true[/code], keeps the screen on (even in case of inactivity), so the screensaver does not take over. Works on desktop and mobile platforms. </member> + <member name="display/window/force_right_to_left_layout_direction" type="bool" setter="" getter="" default="false"> + Force layout direction and text writing direction to RTL for all locales. + </member> <member name="display/window/handheld/orientation" type="String" setter="" getter="" default=""landscape""> Default orientation on mobile devices. </member> @@ -491,6 +508,9 @@ <member name="display/window/tablet_driver" type="String" setter="" getter=""> Specifies the tablet driver to use. If left empty, the default driver will be used. </member> + <member name="display/window/text_name" type="String" setter="" getter="" default=""""> + Specifies the [TextServer] to use. If left empty, the default will be used. + </member> <member name="display/window/vsync/use_vsync" type="bool" setter="" getter="" default="true"> If [code]true[/code], enables vertical synchronization. This eliminates tearing that may appear in moving scenes, at the cost of higher input latency and stuttering at lower framerates. If [code]false[/code], vertical synchronization will be disabled, however, many platforms will enforce it regardless (such as mobile platforms and HTML5). </member> diff --git a/doc/classes/Reference.xml b/doc/classes/Reference.xml index 9c3d1d5d9d..44ee6fbda1 100644 --- a/doc/classes/Reference.xml +++ b/doc/classes/Reference.xml @@ -7,6 +7,7 @@ Base class for any object that keeps a reference count. [Resource] and many other helper objects inherit this class. Unlike [Object]s, References keep an internal reference counter so that they are automatically released when no longer in use, and only then. References therefore do not need to be freed manually with [method Object.free]. In the vast majority of use cases, instantiating and using [Reference]-derived types is all you need to do. The methods provided in this class are only for advanced users, and can cause issues if misused. + [b]Note:[/b] In C#, references will not be freed instantly after they are no longer in use. Instead, garbage collection will run periodically and will free references that are no longer in use. This means that unused references will linger on for a while before being removed. </description> <tutorials> <link title="When and how to avoid using nodes for everything">https://docs.godotengine.org/en/latest/getting_started/workflow/best_practices/node_alternatives.html</link> diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 841567ee9f..77a80cb8b6 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -1425,6 +1425,17 @@ Sets the shadow mode for this directional light. Equivalent to [member DirectionalLight3D.directional_shadow_mode]. See [enum LightDirectionalShadowMode] for options. </description> </method> + <method name="light_directional_set_sky_only"> + <return type="void"> + </return> + <argument index="0" name="light" type="RID"> + </argument> + <argument index="1" name="enable" type="bool"> + </argument> + <description> + If [code]true[/code], this light will not be used for anything except sky shaders. Use this for lights that impact your sky shader that you may want to hide from affecting the rest of the scene. For example, you may want to enable this when the sun in your sky shader falls below the horizon. + </description> + </method> <method name="light_omni_set_shadow_mode"> <return type="void"> </return> diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml index e79a2e0ea9..1ce2c376dd 100644 --- a/doc/classes/Resource.xml +++ b/doc/classes/Resource.xml @@ -5,6 +5,7 @@ </brief_description> <description> Resource is the base class for all Godot-specific resource types, serving primarily as data containers. Unlike [Object]s, they are reference-counted and freed when no longer in use. They are also cached once loaded from disk, so that any further attempts to load a resource from a given path will return the same reference (all this in contrast to a [Node], which is not reference-counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource. + [b]Note:[/b] In C#, resources will not be freed instantly after they are no longer in use. Instead, garbage collection will run periodically and will free resources that are no longer in use. This means that unused resources will linger on for a while before being removed. </description> <tutorials> <link title="Resources">https://docs.godotengine.org/en/latest/getting_started/step_by_step/resources.html</link> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index faf0d97766..4faff95fd3 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -329,6 +329,9 @@ The raw text of the label. When set, clears the tag stack and adds a raw text tag to the top of it. Does not parse BBCodes. Does not modify [member bbcode_text]. </member> + <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="visible_characters" type="int" setter="set_visible_characters" getter="get_visible_characters" default="-1"> The restricted number of characters to display in the label. If [code]-1[/code], all characters will be displayed. </member> diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml index 6f41d5ba27..2a0b44f3f3 100644 --- a/doc/classes/RigidBody2D.xml +++ b/doc/classes/RigidBody2D.xml @@ -174,9 +174,6 @@ <member name="sleeping" type="bool" setter="set_sleeping" getter="is_sleeping" default="false"> If [code]true[/code], the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the [method apply_impulse] or [method add_force] methods. </member> - <member name="weight" type="float" setter="set_weight" getter="get_weight" default="9.8"> - The body's weight based on its mass and the [b]Default Gravity[/b] value in [b]Project > Project Settings > Physics > 2d[/b]. - </member> </members> <signals> <signal name="body_entered"> diff --git a/doc/classes/RigidBody3D.xml b/doc/classes/RigidBody3D.xml index f8dc9887a9..21321d4de0 100644 --- a/doc/classes/RigidBody3D.xml +++ b/doc/classes/RigidBody3D.xml @@ -198,9 +198,6 @@ <member name="sleeping" type="bool" setter="set_sleeping" getter="is_sleeping" default="false"> If [code]true[/code], the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the [method apply_impulse] or [method add_force] methods. </member> - <member name="weight" type="float" setter="set_weight" getter="get_weight" default="9.8"> - The body's weight based on its mass and the global 3D gravity. Global values are set in [b]Project > Project Settings > Physics > 3d[/b]. - </member> </members> <signals> <signal name="body_entered"> diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml index d56781105b..9f45a361f3 100644 --- a/doc/classes/TabContainer.xml +++ b/doc/classes/TabContainer.xml @@ -204,6 +204,9 @@ <theme_item name="font_color_fg" type="Color" default="Color( 0.94, 0.94, 0.94, 1 )"> Font color of the currently selected tab. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the tab names. + </theme_item> <theme_item name="icon_separation" type="int" default="4"> Space between tab's name and its icon. </theme_item> diff --git a/doc/classes/Tabs.xml b/doc/classes/Tabs.xml index 15c2d3504c..5c698a4aa8 100644 --- a/doc/classes/Tabs.xml +++ b/doc/classes/Tabs.xml @@ -20,6 +20,15 @@ Adds a new tab. </description> </method> + <method name="clear_tab_opentype_features"> + <return type="void"> + </return> + <argument index="0" name="tab_idx" type="int"> + </argument> + <description> + Removes all OpenType features from the tab title. + </description> + </method> <method name="ensure_tab_visible"> <return type="void"> </return> @@ -75,6 +84,15 @@ Returns the [Texture2D] for the tab at index [code]tab_idx[/code] or [code]null[/code] if the tab has no [Texture2D]. </description> </method> + <method name="get_tab_language" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="tab_idx" type="int"> + </argument> + <description> + Returns tab title language code. + </description> + </method> <method name="get_tab_offset" qualifiers="const"> <return type="int"> </return> @@ -82,6 +100,17 @@ Returns the number of hidden tabs offsetted to the left. </description> </method> + <method name="get_tab_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="tab_idx" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code] of the tab title. + </description> + </method> <method name="get_tab_rect" qualifiers="const"> <return type="Rect2"> </return> @@ -91,6 +120,15 @@ Returns tab [Rect2] with local position and size. </description> </method> + <method name="get_tab_text_direction" qualifiers="const"> + <return type="int" enum="Control.TextDirection"> + </return> + <argument index="0" name="tab_idx" type="int"> + </argument> + <description> + Returns tab title text base writing direction. + </description> + </method> <method name="get_tab_title" qualifiers="const"> <return type="String"> </return> @@ -159,6 +197,41 @@ Sets an [code]icon[/code] for the tab at index [code]tab_idx[/code]. </description> </method> + <method name="set_tab_language"> + <return type="void"> + </return> + <argument index="0" name="tab_idx" type="int"> + </argument> + <argument index="1" name="language" type="String"> + </argument> + <description> + Sets language code of tab title used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </description> + </method> + <method name="set_tab_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="tab_idx" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <argument index="2" name="values" type="int"> + </argument> + <description> + Sets OpenType feature [code]tag[/code] for the tab title. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + </description> + </method> + <method name="set_tab_text_direction"> + <return type="void"> + </return> + <argument index="0" name="tab_idx" type="int"> + </argument> + <argument index="1" name="direction" type="int" enum="Control.TextDirection"> + </argument> + <description> + Sets tab title base writing direction. + </description> + </method> <method name="set_tab_title"> <return type="void"> </return> @@ -295,6 +368,9 @@ <theme_item name="font_color_fg" type="Color" default="Color( 0.94, 0.94, 0.94, 1 )"> Font color of the currently selected tab. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the tab names. + </theme_item> <theme_item name="hseparation" type="int" default="4"> The horizontal separation between the tabs. </theme_item> diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index 168cc8a1c3..eedf3b848f 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -33,6 +33,13 @@ Centers the viewport on the line the editing cursor is at. This also resets the [member scroll_horizontal] value to [code]0[/code]. </description> </method> + <method name="clear_opentype_features"> + <return type="void"> + </return> + <description> + Removes all OpenType features. + </description> + </method> <method name="clear_undo_history"> <return type="void"> </return> @@ -213,6 +220,15 @@ Returns the [PopupMenu] of this [TextEdit]. By default, this menu is displayed when right-clicking on the [TextEdit]. </description> </method> + <method name="get_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code]. + </description> + </method> <method name="get_selection_column" qualifiers="const"> <return type="int"> </return> @@ -573,6 +589,17 @@ <description> </description> </method> + <method name="set_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="tag" type="String"> + </argument> + <argument index="1" name="value" type="int"> + </argument> + <description> + Sets OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url]. + </description> + </method> <method name="set_selection_mode"> <return type="void"> </return> @@ -629,6 +656,10 @@ If [code]true[/code], the caret displays as a rectangle. If [code]false[/code], the caret displays as a bar. </member> + <member name="caret_mid_grapheme" type="bool" setter="set_mid_grapheme_caret_enabled" getter="get_mid_grapheme_caret_enabled" default="false"> + Allow moving caret, selecting and removing the individual composite character components. + Note: [kbd]Backspace[/kbd] is always removing individual composite character components. + </member> <member name="caret_moving_by_right_click" type="bool" setter="set_right_click_moves_caret" getter="is_right_click_moving_caret" default="true"> If [code]true[/code], a right-click moves the cursor at the mouse position before displaying the context menu. If [code]false[/code], the context menu disregards mouse location. @@ -636,6 +667,9 @@ <member name="context_menu_enabled" type="bool" setter="set_context_menu_enabled" getter="is_context_menu_enabled" default="true"> If [code]true[/code], a right-click displays the context menu. </member> + <member name="draw_control_chars" type="bool" setter="set_draw_control_chars" getter="get_draw_control_chars" default="false"> + If [code]true[/code], control characters are displayed. + </member> <member name="draw_spaces" type="bool" setter="set_draw_spaces" getter="is_drawing_spaces" default="false"> If [code]true[/code], the "space" character will have a visible representation. </member> @@ -652,6 +686,9 @@ <member name="highlight_current_line" type="bool" setter="set_highlight_current_line" getter="is_highlight_current_line_enabled" default="false"> If [code]true[/code], the line containing the cursor is highlighted. </member> + <member name="language" type="String" setter="set_language" getter="get_language" default=""""> + Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </member> <member name="minimap_draw" type="bool" setter="draw_minimap" getter="is_drawing_minimap" default="false"> If [code]true[/code], a minimap is shown, providing an outline of your source code. </member> @@ -681,11 +718,20 @@ <member name="smooth_scrolling" type="bool" setter="set_smooth_scroll_enable" getter="is_smooth_scroll_enabled" default="false"> If [code]true[/code], sets the [code]step[/code] of the scrollbars to [code]0.25[/code] which results in smoother scrolling. </member> + <member name="structured_text_bidi_override" type="int" setter="set_structured_text_bidi_override" getter="get_structured_text_bidi_override" enum="Control.StructuredTextParser" default="0"> + Set BiDi algorithm override for the structured text. + </member> + <member name="structured_text_bidi_override_options" type="Array" setter="set_structured_text_bidi_override_options" getter="get_structured_text_bidi_override_options" default="[ ]"> + Set additional options for BiDi override. + </member> <member name="syntax_highlighter" type="SyntaxHighlighter" setter="set_syntax_highlighter" getter="get_syntax_highlighter"> </member> <member name="text" type="String" setter="set_text" getter="get_text" default=""""> String value of the [TextEdit]. </member> + <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="v_scroll_speed" type="float" setter="set_v_scroll_speed" getter="get_v_scroll_speed" default="80.0"> Vertical scroll sensitivity. </member> @@ -799,7 +845,70 @@ <constant name="MENU_REDO" value="6" enum="MenuItems"> Redoes the previous action. </constant> - <constant name="MENU_MAX" value="7" enum="MenuItems"> + <constant name="MENU_DIR_INHERITED" value="7" enum="MenuItems"> + Sets text direction to inherited. + </constant> + <constant name="MENU_DIR_AUTO" value="8" enum="MenuItems"> + Sets text direction to automatic. + </constant> + <constant name="MENU_DIR_LTR" value="9" enum="MenuItems"> + Sets text direction to left-to-right. + </constant> + <constant name="MENU_DIR_RTL" value="10" enum="MenuItems"> + Sets text direction to right-to-left. + </constant> + <constant name="MENU_DISPLAY_UCC" value="11" enum="MenuItems"> + Toggles control character display. + </constant> + <constant name="MENU_INSERT_LRM" value="12" enum="MenuItems"> + Inserts left-to-right mark (LRM) character. + </constant> + <constant name="MENU_INSERT_RLM" value="13" enum="MenuItems"> + Inserts right-to-left mark (RLM) character. + </constant> + <constant name="MENU_INSERT_LRE" value="14" enum="MenuItems"> + Inserts start of left-to-right embedding (LRE) character. + </constant> + <constant name="MENU_INSERT_RLE" value="15" enum="MenuItems"> + Inserts start of right-to-left embedding (RLE) character. + </constant> + <constant name="MENU_INSERT_LRO" value="16" enum="MenuItems"> + Inserts start of left-to-right override (LRO) character. + </constant> + <constant name="MENU_INSERT_RLO" value="17" enum="MenuItems"> + Inserts start of right-to-left override (RLO) character. + </constant> + <constant name="MENU_INSERT_PDF" value="18" enum="MenuItems"> + Inserts pop direction formatting (PDF) character. + </constant> + <constant name="MENU_INSERT_ALM" value="19" enum="MenuItems"> + Inserts Arabic letter mark (ALM) character. + </constant> + <constant name="MENU_INSERT_LRI" value="20" enum="MenuItems"> + Inserts left-to-right isolate (LRI) character. + </constant> + <constant name="MENU_INSERT_RLI" value="21" enum="MenuItems"> + Inserts right-to-left isolate (RLI) character. + </constant> + <constant name="MENU_INSERT_FSI" value="22" enum="MenuItems"> + Inserts first strong isolate (FSI) character. + </constant> + <constant name="MENU_INSERT_PDI" value="23" enum="MenuItems"> + Inserts pop direction isolate (PDI) character. + </constant> + <constant name="MENU_INSERT_ZWJ" value="24" enum="MenuItems"> + Inserts zero width joiner (ZWJ) character. + </constant> + <constant name="MENU_INSERT_ZWNJ" value="25" enum="MenuItems"> + Inserts zero width non-joiner (ZWNJ) character. + </constant> + <constant name="MENU_INSERT_WJ" value="26" enum="MenuItems"> + Inserts word joiner (WJ) character. + </constant> + <constant name="MENU_INSERT_SHY" value="27" enum="MenuItems"> + Inserts soft hyphen (SHY) character. + </constant> + <constant name="MENU_MAX" value="28" enum="MenuItems"> Represents the size of the [enum MenuItems] enum. </constant> </constants> @@ -849,6 +958,9 @@ <theme_item name="font_color_selected" type="Color" default="Color( 0, 0, 0, 1 )"> Sets the [Color] of the selected text. [member override_selected_font_color] has to be enabled. </theme_item> + <theme_item name="font_size" type="int"> + Sets default font size. + </theme_item> <theme_item name="line_spacing" type="int" default="4"> Sets the spacing between the lines. </theme_item> @@ -865,6 +977,7 @@ Sets the highlight [Color] of text selections. </theme_item> <theme_item name="space" type="Texture2D"> + Sets a custom [Texture2D] for space text characters. </theme_item> <theme_item name="tab" type="Texture2D"> Sets a custom [Texture2D] for tab text characters. diff --git a/doc/classes/TextLine.xml b/doc/classes/TextLine.xml new file mode 100644 index 0000000000..c21da09edb --- /dev/null +++ b/doc/classes/TextLine.xml @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="TextLine" inherits="Reference" version="4.0"> + <brief_description> + Holds a line of text. + </brief_description> + <description> + Abstraction over [TextServer] for handling single line of text. + </description> + <tutorials> + </tutorials> + <methods> + <method name="add_object"> + <return type="bool"> + </return> + <argument index="0" name="key" type="Variant"> + </argument> + <argument index="1" name="size" type="Vector2"> + </argument> + <argument index="2" name="inline_align" type="int" enum="VAlign" default="1"> + </argument> + <argument index="3" name="length" type="int" default="1"> + </argument> + <description> + Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters. + </description> + </method> + <method name="add_string"> + <return type="bool"> + </return> + <argument index="0" name="text" type="String"> + </argument> + <argument index="1" name="fonts" type="Font"> + </argument> + <argument index="2" name="size" type="int"> + </argument> + <argument index="3" name="opentype_features" type="Dictionary" default="{ +}"> + </argument> + <argument index="4" name="language" type="String" default=""""> + </argument> + <description> + Adds text span and font to draw it. + </description> + </method> + <method name="clear"> + <return type="void"> + </return> + <description> + Clears text line (removes text and inline objects). + </description> + </method> + <method name="draw" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="canvas" type="RID"> + </argument> + <argument index="1" name="pos" type="Vector2"> + </argument> + <argument index="2" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draw text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the top left corner of the bounding box. + </description> + </method> + <method name="draw_outline" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="canvas" type="RID"> + </argument> + <argument index="1" name="pos" type="Vector2"> + </argument> + <argument index="2" name="outline_size" type="int" default="1"> + </argument> + <argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draw text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the top left corner of the bounding box. + </description> + </method> + <method name="get_line_ascent" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical). + </description> + </method> + <method name="get_line_descent" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical). + </description> + </method> + <method name="get_line_underline_position" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns pixel offset of the underline below the baseline. + </description> + </method> + <method name="get_line_underline_thickness" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns thickness of the underline. + </description> + </method> + <method name="get_line_width" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns width (for horizontal layout) or height (for vertical) of the text. + </description> + </method> + <method name="get_object_rect" qualifiers="const"> + <return type="Rect2"> + </return> + <argument index="0" name="key" type="Variant"> + </argument> + <description> + Returns bounding rectangle of the inline object. + </description> + </method> + <method name="get_objects" qualifiers="const"> + <return type="Array"> + </return> + <description> + Returns array of inline objects. + </description> + </method> + <method name="get_rid" qualifiers="const"> + <return type="RID"> + </return> + <description> + Returns TextServer buffer RID. + </description> + </method> + <method name="get_size" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + Returns size of the bounding box of the text. + </description> + </method> + <method name="hit_test" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="coords" type="float"> + </argument> + <description> + Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position. + </description> + </method> + <method name="resize_object"> + <return type="bool"> + </return> + <argument index="0" name="key" type="Variant"> + </argument> + <argument index="1" name="size" type="Vector2"> + </argument> + <argument index="2" name="inline_align" type="int" enum="VAlign" default="1"> + </argument> + <description> + Sets new size and alignment of embedded object. + </description> + </method> + <method name="set_bidi_override"> + <return type="void"> + </return> + <argument index="0" name="override" type="Array"> + </argument> + <description> + Overrides BiDi for the structured text. + Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately. + </description> + </method> + <method name="tab_align"> + <return type="void"> + </return> + <argument index="0" name="tab_stops" type="PackedFloat32Array"> + </argument> + <description> + Aligns text to the given tab-stops. + </description> + </method> + </methods> + <members> + <member name="align" type="int" setter="set_align" getter="get_align" enum="HAlign" default="0"> + Text horizontal alignment. + </member> + <member name="direction" type="int" setter="set_direction" getter="get_direction" enum="TextServer.Direction" default="0"> + Text writing direction. + </member> + <member name="flags" type="int" setter="set_flags" getter="get_flags" default="3"> + Line Alignment rules. For more info see [TextServer]. + </member> + <member name="orientation" type="int" setter="set_orientation" getter="get_orientation" enum="TextServer.Orientation" default="0"> + Text orientation. + </member> + <member name="preserve_control" type="bool" setter="set_preserve_control" getter="get_preserve_control" default="false"> + If set to [code]true[/code] text will display control characters. + </member> + <member name="preserve_invalid" type="bool" setter="set_preserve_invalid" getter="get_preserve_invalid" default="true"> + If set to [code]true[/code] text will display invalid characters. + </member> + <member name="width" type="float" setter="set_width" getter="get_width" default="-1.0"> + Text line width. + </member> + </members> + <constants> + </constants> +</class> diff --git a/doc/classes/TextParagraph.xml b/doc/classes/TextParagraph.xml new file mode 100644 index 0000000000..fabf22eef7 --- /dev/null +++ b/doc/classes/TextParagraph.xml @@ -0,0 +1,299 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="TextParagraph" inherits="Reference" version="4.0"> + <brief_description> + Holds a paragraph of text. + </brief_description> + <description> + Abstraction over [TextServer] for handling paragraph of text. + </description> + <tutorials> + </tutorials> + <methods> + <method name="add_object"> + <return type="bool"> + </return> + <argument index="0" name="key" type="Variant"> + </argument> + <argument index="1" name="size" type="Vector2"> + </argument> + <argument index="2" name="inline_align" type="int" enum="VAlign" default="1"> + </argument> + <argument index="3" name="length" type="int" default="1"> + </argument> + <description> + Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters. + </description> + </method> + <method name="add_string"> + <return type="bool"> + </return> + <argument index="0" name="text" type="String"> + </argument> + <argument index="1" name="fonts" type="Font"> + </argument> + <argument index="2" name="size" type="int"> + </argument> + <argument index="3" name="opentype_features" type="Dictionary" default="{ +}"> + </argument> + <argument index="4" name="language" type="String" default=""""> + </argument> + <description> + Adds text span and font to draw it. + </description> + </method> + <method name="clear"> + <return type="void"> + </return> + <description> + Clears text paragraph (removes text and inline objects). + </description> + </method> + <method name="draw" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="canvas" type="RID"> + </argument> + <argument index="1" name="pos" type="Vector2"> + </argument> + <argument index="2" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draw text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the top left corner of the bounding box. + </description> + </method> + <method name="draw_line" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="canvas" type="RID"> + </argument> + <argument index="1" name="pos" type="Vector2"> + </argument> + <argument index="2" name="line" type="int"> + </argument> + <argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draw single line of text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the top left corner of the bounding box. + </description> + </method> + <method name="draw_line_outline" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="canvas" type="RID"> + </argument> + <argument index="1" name="pos" type="Vector2"> + </argument> + <argument index="2" name="line" type="int"> + </argument> + <argument index="3" name="outline_size" type="int" default="1"> + </argument> + <argument index="4" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draw outline of the single line of text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the top left corner of the bounding box. + </description> + </method> + <method name="draw_outline" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="canvas" type="RID"> + </argument> + <argument index="1" name="outline_size" type="Vector2"> + </argument> + <argument index="2" name="color" type="int" default="1"> + </argument> + <argument index="3" name="arg3" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draw outline of the text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the top left corner of the bounding box. + </description> + </method> + <method name="get_line_ascent" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + Returns the text line ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical). + </description> + </method> + <method name="get_line_count" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns number of lines in the paragraph. + </description> + </method> + <method name="get_line_descent" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + Returns the text line descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical). + </description> + </method> + <method name="get_line_object_rect" qualifiers="const"> + <return type="Rect2"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="key" type="Variant"> + </argument> + <description> + Returns bounding rectangle of the inline object. + </description> + </method> + <method name="get_line_objects" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + Returns array of inline objects in the line. + </description> + </method> + <method name="get_line_range" qualifiers="const"> + <return type="Vector2i"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + Returns character range of the line. + </description> + </method> + <method name="get_line_rid" qualifiers="const"> + <return type="RID"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + Returns TextServer line buffer RID. + </description> + </method> + <method name="get_line_size" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + Returns size of the bounding box of the line of text. + </description> + </method> + <method name="get_line_underline_position" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + Returns pixel offset of the underline below the baseline. + </description> + </method> + <method name="get_line_underline_thickness" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + Returns thickness of the underline. + </description> + </method> + <method name="get_line_width" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + Returns width (for horizontal layout) or height (for vertical) of the line of text. + </description> + </method> + <method name="get_non_wraped_size" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + Returns the size of the bounding box of the paragraph, without line breaks. + </description> + </method> + <method name="get_rid" qualifiers="const"> + <return type="RID"> + </return> + <description> + Returns TextServer full string buffer RID. + </description> + </method> + <method name="get_size" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + Returns the size of the bounding box of the paragraph. + </description> + </method> + <method name="hit_test" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="coords" type="Vector2"> + </argument> + <description> + Returns caret character offset at the specified coordinates. This function always returns a valid position. + </description> + </method> + <method name="resize_object"> + <return type="bool"> + </return> + <argument index="0" name="key" type="Variant"> + </argument> + <argument index="1" name="size" type="Vector2"> + </argument> + <argument index="2" name="inline_align" type="int" enum="VAlign" default="1"> + </argument> + <description> + Sets new size and alignment of embedded object. + </description> + </method> + <method name="set_bidi_override"> + <return type="void"> + </return> + <argument index="0" name="override" type="Array"> + </argument> + <description> + Overrides BiDi for the structured text. + Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately. + </description> + </method> + <method name="tab_align"> + <return type="void"> + </return> + <argument index="0" name="tab_stops" type="PackedFloat32Array"> + </argument> + <description> + Aligns paragraph to the given tab-stops. + </description> + </method> + </methods> + <members> + <member name="align" type="int" setter="set_align" getter="get_align" enum="HAlign" default="0"> + Paragraph horizontal alignment. + </member> + <member name="direction" type="int" setter="set_direction" getter="get_direction" enum="TextServer.Direction" default="0"> + Text writing direction. + </member> + <member name="flags" type="int" setter="set_flags" getter="get_flags" default="51"> + Line breaking and alignment rules. For more info see [TextServer]. + </member> + <member name="orientation" type="int" setter="set_orientation" getter="get_orientation" enum="TextServer.Orientation" default="0"> + Text orientation. + </member> + <member name="preserve_control" type="bool" setter="set_preserve_control" getter="get_preserve_control" default="false"> + If set to [code]true[/code] text will display control characters. + </member> + <member name="preserve_invalid" type="bool" setter="set_preserve_invalid" getter="get_preserve_invalid" default="true"> + If set to [code]true[/code] text will display invalid characters. + </member> + <member name="width" type="float" setter="set_width" getter="get_width" default="-1.0"> + Paragraph width. + </member> + </members> + <constants> + </constants> +</class> diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml new file mode 100644 index 0000000000..43388bb7f1 --- /dev/null +++ b/doc/classes/TextServer.xml @@ -0,0 +1,1167 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="TextServer" inherits="Object" version="4.0"> + <brief_description> + Interface for the fonts and complex text layouts. + </brief_description> + <description> + [TextServer] is the API backend for managing fonts, and rendering complex text. + </description> + <tutorials> + </tutorials> + <methods> + <method name="create_font_memory"> + <return type="RID"> + </return> + <argument index="0" name="data" type="PackedByteArray"> + </argument> + <argument index="1" name="type" type="String"> + </argument> + <argument index="2" name="base_size" type="int" default="16"> + </argument> + <description> + Creates new font from the data in memory. To free the resulting font, use [method free_rid] method. + Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method font_get_base_size] to check actual font size. + </description> + </method> + <method name="create_font_resource"> + <return type="RID"> + </return> + <argument index="0" name="filename" type="String"> + </argument> + <argument index="1" name="base_size" type="int" default="16"> + </argument> + <description> + Creates new font from the file. To free the resulting font, use [method free_rid] method. + Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method font_get_base_size] to check actual font size. + </description> + </method> + <method name="create_font_system"> + <return type="RID"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="base_size" type="int" default="16"> + </argument> + <description> + Creates new font from the system font. To free the resulting font, use [method free_rid] method. + Note: This method is supported by servers with the [code]FEATURE_FONT_SYSTEM[/code] feature. + Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method font_get_base_size] to check actual font size. + </description> + </method> + <method name="create_shaped_text"> + <return type="RID"> + </return> + <argument index="0" name="direction" type="int" enum="TextServer.Direction" default="0"> + </argument> + <argument index="1" name="orientation" type="int" enum="TextServer.Orientation" default="0"> + </argument> + <description> + Creates new buffer for complex text layout, with the given [code]direction[/code] and [code]orientation[/code]. To free the resulting buffer, use [method free_rid] method. + Note: Direction is ignored if server does not support [code]FEATURE_BIDI_LAYOUT[/code] feature. + Note: Orientation is ignored if server does not support [code]FEATURE_VERTICAL_LAYOUT[/code] feature. + </description> + </method> + <method name="draw_hex_code_box" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="canvas" type="RID"> + </argument> + <argument index="1" name="size" type="int"> + </argument> + <argument index="2" name="pos" type="Vector2"> + </argument> + <argument index="3" name="index" type="int"> + </argument> + <argument index="4" name="color" type="Color"> + </argument> + <description> + Draws box displaying character hexadecimal code. Used for replacing missing characters. + </description> + </method> + <method name="font_draw_glyph" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="canvas" type="RID"> + </argument> + <argument index="2" name="size" type="int"> + </argument> + <argument index="3" name="pos" type="Vector2"> + </argument> + <argument index="4" name="index" type="int"> + </argument> + <argument index="5" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draws single glyph into a canvas item at the position, using [code]font[/code] at the size [code]size[/code]. + Note: Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index]. + </description> + </method> + <method name="font_draw_glyph_outline" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="canvas" type="RID"> + </argument> + <argument index="2" name="size" type="int"> + </argument> + <argument index="3" name="outline_size" type="int"> + </argument> + <argument index="4" name="pos" type="Vector2"> + </argument> + <argument index="5" name="index" type="int"> + </argument> + <argument index="6" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draws single glyph outline of size [code]outline_size[/code] into a canvas item at the position, using [code]font[/code] at the size [code]size[/code]. + Note: Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index]. + </description> + </method> + <method name="font_get_antialiased" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns [code]true[/code], if font anti-aliasing is supported and enabled. + </description> + </method> + <method name="font_get_ascent" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="size" type="int"> + </argument> + <description> + Returns the font ascent (number of pixels above the baseline). + </description> + </method> + <method name="font_get_base_size" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns the default size of the font. + </description> + </method> + <method name="font_get_descent" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="size" type="int"> + </argument> + <description> + Returns the font descent (number of pixels below the baseline). + </description> + </method> + <method name="font_get_distance_field_hint" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns [code]true[/code], if distance field hint is enabled. + </description> + </method> + <method name="font_get_feature_list" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns list of OpenType features supported by font. + </description> + </method> + <method name="font_get_force_autohinter" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns [code]true[/code], if autohinter is supported and enabled. + </description> + </method> + <method name="font_get_glyph_advance" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="index" type="int"> + </argument> + <argument index="2" name="size" type="int"> + </argument> + <description> + Returns advance of the glyph. + </description> + </method> + <method name="font_get_glyph_index" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="char" type="int"> + </argument> + <argument index="2" name="variation_selector" type="int" default="0"> + </argument> + <description> + Returns the glyph index of a [code]char[/code], optionally modified by the [code]variation_selector[/code]. + </description> + </method> + <method name="font_get_glyph_kerning" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="index_a" type="int"> + </argument> + <argument index="2" name="index_b" type="int"> + </argument> + <argument index="3" name="size" type="int"> + </argument> + <description> + Returns a kerning of the pair of glyphs. + </description> + </method> + <method name="font_get_height" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="size" type="int"> + </argument> + <description> + Returns the total font height (ascent plus descent) in pixels. + </description> + </method> + <method name="font_get_hinting" qualifiers="const"> + <return type="int" enum="TextServer.Hinting"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns the font hinting. + </description> + </method> + <method name="font_get_language_support_override"> + <return type="bool"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="language" type="String"> + </argument> + <description> + Returns [code]true[/code] if support override is enabled for the [code]language[/code]. + </description> + </method> + <method name="font_get_language_support_overrides"> + <return type="PackedStringArray"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns list of language support overrides. + </description> + </method> + <method name="font_get_oversampling" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns the font oversampling factor, shared by all fonts in the TextServer. + </description> + </method> + <method name="font_get_script_support_override"> + <return type="bool"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="script" type="String"> + </argument> + <description> + Returns [code]true[/code] if support override is enabled for the [code]script[/code]. + </description> + </method> + <method name="font_get_script_support_overrides"> + <return type="PackedStringArray"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns list of script support overrides. + </description> + </method> + <method name="font_get_supported_chars" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns a string containing all the characters available in the font. + </description> + </method> + <method name="font_get_underline_position" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="size" type="int"> + </argument> + <description> + Returns underline offset (number of pixels below the baseline). + </description> + </method> + <method name="font_get_underline_thickness" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="size" type="int"> + </argument> + <description> + Returns underline thickness in pixels. + </description> + </method> + <method name="font_has_char" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="char" type="int"> + </argument> + <description> + Returns [code]true[/code] if [code]char[/code] is available in the font. + </description> + </method> + <method name="font_has_outline" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <description> + Returns [code]true[/code], if font supports glyph outlines. + </description> + </method> + <method name="font_is_language_supported" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="language" type="String"> + </argument> + <description> + Returns [code]true[/code], if font supports given language (ISO 639 code). + </description> + </method> + <method name="font_is_script_supported" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="script" type="String"> + </argument> + <description> + Returns [code]true[/code], if font supports given script (ISO 15924 code). + </description> + </method> + <method name="font_remove_language_support_override"> + <return type="void"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="language" type="String"> + </argument> + <description> + Remove language support override. + </description> + </method> + <method name="font_remove_script_support_override"> + <return type="void"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="script" type="String"> + </argument> + <description> + Removes script support override. + </description> + </method> + <method name="font_set_antialiased"> + <return type="void"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="antialiased" type="bool"> + </argument> + <description> + Sets font anti-aliasing. + </description> + </method> + <method name="font_set_distance_field_hint"> + <return type="void"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="distance_field" type="bool"> + </argument> + <description> + Sets font distance field hint. + </description> + </method> + <method name="font_set_force_autohinter"> + <return type="void"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="enabeld" type="bool"> + </argument> + <description> + Enables/disables default autohinter. + </description> + </method> + <method name="font_set_hinting"> + <return type="void"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="hinting" type="int" enum="TextServer.Hinting"> + </argument> + <description> + Sets font hinting. + </description> + </method> + <method name="font_set_language_support_override"> + <return type="void"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="language" type="String"> + </argument> + <argument index="2" name="supported" type="bool"> + </argument> + <description> + Adds override for [method font_is_language_supported]. + </description> + </method> + <method name="font_set_oversampling"> + <return type="void"> + </return> + <argument index="0" name="oversampling" type="float"> + </argument> + <description> + Sets oversampling factor, shared by all font in the TextServer. + </description> + </method> + <method name="font_set_script_support_override"> + <return type="void"> + </return> + <argument index="0" name="font" type="RID"> + </argument> + <argument index="1" name="script" type="String"> + </argument> + <argument index="2" name="supported" type="bool"> + </argument> + <description> + Adds override for [method font_is_script_supported]. + </description> + </method> + <method name="format_number" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="number" type="String"> + </argument> + <argument index="1" name="language" type="String" default=""""> + </argument> + <description> + Converts a number from the Western Arabic (0..9) to the numeral systems used in [code]language[/code]. + </description> + </method> + <method name="free_rid"> + <return type="void"> + </return> + <argument index="0" name="rid" type="RID"> + </argument> + <description> + Frees an object created by this [TextServer]. + </description> + </method> + <method name="get_hex_code_box_size" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="size" type="int"> + </argument> + <argument index="1" name="index" type="int"> + </argument> + <description> + Returns size of the replacement character (box with character hexadecimal code that is drawn in place of invalid characters). + </description> + </method> + <method name="get_name" qualifiers="const"> + <return type="String"> + </return> + <description> + Returns the name of the server interface. + </description> + </method> + <method name="get_system_fonts" qualifiers="const"> + <return type="PackedStringArray"> + </return> + <description> + Returns list of available system fonts. + Note: This method is supported by servers with the [code]FEATURE_FONT_SYSTEM[/code] feature. + </description> + </method> + <method name="has"> + <return type="bool"> + </return> + <argument index="0" name="rid" type="RID"> + </argument> + <description> + Returns [code]true[/code] if [code]rid[/code] is valid resource owned by this text server. + </description> + </method> + <method name="has_feature"> + <return type="bool"> + </return> + <argument index="0" name="feature" type="int" enum="TextServer.Feature"> + </argument> + <description> + Returns [code]true[/code] if the server supports a feature. + </description> + </method> + <method name="is_locale_right_to_left"> + <return type="bool"> + </return> + <argument index="0" name="locale" type="String"> + </argument> + <description> + Returns [code]true[/code] if locale is right-to-left. + </description> + </method> + <method name="load_support_data"> + <return type="bool"> + </return> + <argument index="0" name="filename" type="String"> + </argument> + <description> + Loads optional TextServer database (e.g. ICU break iterators and dictionaries). + Note: This function should be called before any other TextServer functions used, otherwise it won't have any effect. + </description> + </method> + <method name="name_to_tag"> + <return type="int"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Converts readable feature, variation, script or language name to OpenType tag. + </description> + </method> + <method name="parse_number" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="number" type="String"> + </argument> + <argument index="1" name="language" type="String" default=""""> + </argument> + <description> + Converts a number from the numeral systems used in [code]language[/code] to Western Arabic (0..9). + </description> + </method> + <method name="percent_sign" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="language" type="String" default=""""> + </argument> + <description> + Returns percent sign used in the [code]language[/code]. + </description> + </method> + <method name="shaped_text_add_object"> + <return type="bool"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="key" type="Variant"> + </argument> + <argument index="2" name="size" type="Vector2"> + </argument> + <argument index="3" name="inline_align" type="int" enum="VAlign" default="1"> + </argument> + <argument index="4" name="length" type="int" default="1"> + </argument> + <description> + Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters. + </description> + </method> + <method name="shaped_text_add_string"> + <return type="bool"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="text" type="String"> + </argument> + <argument index="2" name="fonts" type="Array"> + </argument> + <argument index="3" name="size" type="int"> + </argument> + <argument index="4" name="opentype_features" type="Dictionary" default="{ +}"> + </argument> + <argument index="5" name="language" type="String" default=""""> + </argument> + <description> + Adds text span and font to draw it to the text buffer. + </description> + </method> + <method name="shaped_text_clear"> + <return type="void"> + </return> + <argument index="0" name="arg0" type="RID"> + </argument> + <description> + Clears text buffer (removes text and inline objects). + </description> + </method> + <method name="shaped_text_draw" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="canvas" type="RID"> + </argument> + <argument index="2" name="pos" type="Vector2"> + </argument> + <argument index="3" name="clip_l" type="float" default="-1"> + </argument> + <argument index="4" name="clip_r" type="float" default="-1"> + </argument> + <argument index="5" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draw shaped text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). + </description> + </method> + <method name="shaped_text_draw_outline" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="canvas" type="RID"> + </argument> + <argument index="2" name="pos" type="Vector2"> + </argument> + <argument index="3" name="clip_l" type="float" default="-1"> + </argument> + <argument index="4" name="clip_r" type="float" default="-1"> + </argument> + <argument index="5" name="outline_size" type="int" default="1"> + </argument> + <argument index="6" name="color" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> + <description> + Draw the outline of the shaped text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). + </description> + </method> + <method name="shaped_text_fit_to_width"> + <return type="float"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="width" type="float"> + </argument> + <argument index="2" name="jst_flags" type="int" default="3"> + </argument> + <description> + Adjusts text with to fit to specified width, returns new text width. + </description> + </method> + <method name="shaped_text_get_ascent" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical). + Note: overall ascent can be higher than font ascent, if some glyphs are displaced from the baseline. + </description> + </method> + <method name="shaped_text_get_carets" qualifiers="const"> + <return type="Dictionary"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="position" type="int"> + </argument> + <description> + Returns shapes of the carets corresponding to the character offset [code]position[/code] in the text. Returned caret shape is 1 pixel wide rectangle. + </description> + </method> + <method name="shaped_text_get_descent" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical). + Note: overall descent can be higher than font descent, if some glyphs are displaced from the baseline. + </description> + </method> + <method name="shaped_text_get_direction" qualifiers="const"> + <return type="int" enum="TextServer.Direction"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns direction of the text. + </description> + </method> + <method name="shaped_text_get_dominant_direciton_in_range" qualifiers="const"> + <return type="int" enum="TextServer.Direction"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="start" type="int"> + </argument> + <argument index="2" name="end" type="int"> + </argument> + <description> + Returns dominant direction of in the range of text. + </description> + </method> + <method name="shaped_text_get_glyphs" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns text glyphs. + </description> + </method> + <method name="shaped_text_get_line_breaks" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="width" type="float"> + </argument> + <argument index="2" name="start" type="int" default="0"> + </argument> + <argument index="3" name="break_flags" type="int" default="48"> + </argument> + <description> + Breaks text to the lines and returns character ranges for each line. + </description> + </method> + <method name="shaped_text_get_line_breaks_adv" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="width" type="PackedFloat32Array"> + </argument> + <argument index="2" name="start" type="int" default="0"> + </argument> + <argument index="3" name="once" type="bool" default="true"> + </argument> + <argument index="4" name="break_flags" type="int" default="48"> + </argument> + <description> + Breaks text to the lines and columns. Returns character ranges for each segment. + </description> + </method> + <method name="shaped_text_get_object_rect" qualifiers="const"> + <return type="Rect2"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="key" type="Variant"> + </argument> + <description> + Returns bounding rectangle of the inline object. + </description> + </method> + <method name="shaped_text_get_objects" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns array of inline objects. + </description> + </method> + <method name="shaped_text_get_orientation" qualifiers="const"> + <return type="int" enum="TextServer.Orientation"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns text orientation. + </description> + </method> + <method name="shaped_text_get_parent" qualifiers="const"> + <return type="RID"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Sets text orientation. + </description> + </method> + <method name="shaped_text_get_preserve_control" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns [code]true[/code] if text buffer is configured to display control characters. + </description> + </method> + <method name="shaped_text_get_preserve_invalid" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns [code]true[/code] if text buffer is configured to display hexadecimal codes in place of invalid characters. + Note: If set to [code]false[/code], nothing is displayed in place of invalid characters. + </description> + </method> + <method name="shaped_text_get_range" qualifiers="const"> + <return type="Vector2i"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns substring buffer character range in the parent buffer. + </description> + </method> + <method name="shaped_text_get_selection" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="start" type="int"> + </argument> + <argument index="2" name="end" type="int"> + </argument> + <description> + Returns selection rectangles for the specified character range. + </description> + </method> + <method name="shaped_text_get_size" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns size of the text. + </description> + </method> + <method name="shaped_text_get_underline_position" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns pixel offset of the underline below the baseline. + </description> + </method> + <method name="shaped_text_get_underline_thickness" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns thickness of the underline. + </description> + </method> + <method name="shaped_text_get_width" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns width (for horizontal layout) or height (for vertical) of the text. + </description> + </method> + <method name="shaped_text_get_word_breaks" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Breaks text into words and returns array of character ranges. + </description> + </method> + <method name="shaped_text_hit_test_grapheme" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="coords" type="float"> + </argument> + <description> + Returns grapheme index at the specified pixel offset at the baseline, or [code]-1[/code] if none is found. + </description> + </method> + <method name="shaped_text_hit_test_position" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="coords" type="float"> + </argument> + <description> + Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position. + </description> + </method> + <method name="shaped_text_is_ready" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Returns [code]true[/code] if buffer is successfully shaped. + </description> + </method> + <method name="shaped_text_next_grapheme_pos"> + <return type="int"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="pos" type="int"> + </argument> + <description> + Returns composite character end position closest to the [code]pos[/code]. + </description> + </method> + <method name="shaped_text_prev_grapheme_pos"> + <return type="int"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="pos" type="int"> + </argument> + <description> + Returns composite character start position closest to the [code]pos[/code]. + </description> + </method> + <method name="shaped_text_resize_object"> + <return type="bool"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="key" type="Variant"> + </argument> + <argument index="2" name="size" type="Vector2"> + </argument> + <argument index="3" name="inline_align" type="int" enum="VAlign" default="1"> + </argument> + <description> + Sets new size and alignment of embedded object. + </description> + </method> + <method name="shaped_text_set_bidi_override"> + <return type="void"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="override" type="Array"> + </argument> + <description> + Overrides BiDi for the structured text. + Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately. + </description> + </method> + <method name="shaped_text_set_direction"> + <return type="void"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="direction" type="int" enum="TextServer.Direction" default="0"> + </argument> + <description> + Sets desired text direction. If set to [code]TEXT_DIRECTION_AUTO[/code], direction will be detected based on the buffer contents and current locale. + Note: Direction is ignored if server does not support [code]FEATURE_BIDI_LAYOUT[/code] feature. + </description> + </method> + <method name="shaped_text_set_orientation"> + <return type="void"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="orientation" type="int" enum="TextServer.Orientation" default="0"> + </argument> + <description> + Sets desired text orientation. + Note: Orientation is ignored if server does not support [code]FEATURE_VERTICAL_LAYOUT[/code] feature. + </description> + </method> + <method name="shaped_text_set_preserve_control"> + <return type="void"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="enabled" type="bool"> + </argument> + <description> + If set to [code]true[/code] text buffer will display control characters. + </description> + </method> + <method name="shaped_text_set_preserve_invalid"> + <return type="void"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="enabled" type="bool"> + </argument> + <description> + If set to [code]true[/code] text buffer will display invalid characters as hexadecimal codes, otherwise nothing is displayed. + </description> + </method> + <method name="shaped_text_shape"> + <return type="bool"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <description> + Shapes buffer if it's not shaped. Returns [code]true[/code] if the string is shaped successfully. + Note: It is not necessary to call this function manually, buffer will be shaped automatically as soon as any of its output data is requested. + </description> + </method> + <method name="shaped_text_substr" qualifiers="const"> + <return type="RID"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="start" type="int"> + </argument> + <argument index="2" name="length" type="int"> + </argument> + <description> + Returns text buffer for the substring of the text in the [code]shaped[/code] text buffer (including inline objects). + </description> + </method> + <method name="shaped_text_tab_align"> + <return type="float"> + </return> + <argument index="0" name="shaped" type="RID"> + </argument> + <argument index="1" name="tab_stops" type="PackedFloat32Array"> + </argument> + <description> + Aligns shaped text to the given tab-stops. + </description> + </method> + <method name="tag_to_name"> + <return type="String"> + </return> + <argument index="0" name="tag" type="int"> + </argument> + <description> + Converts OpenType tag to readable feature, variation, script or language name. + </description> + </method> + </methods> + <constants> + <constant name="DIRECTION_AUTO" value="0" enum="Direction"> + Text direction is determined based on contents and current locale. + </constant> + <constant name="DIRECTION_LTR" value="1" enum="Direction"> + Text is written from left to right. + </constant> + <constant name="DIRECTION_RTL" value="2" enum="Direction"> + Text is written from right to left. + </constant> + <constant name="ORIENTATION_HORIZONTAL" value="0" enum="Orientation"> + Text is written horizontally. + </constant> + <constant name="ORIENTATION_VERTICAL" value="1" enum="Orientation"> + Left to right text is written vertically from top to bottom. + Right to left text is written vertically from bottom to top. + </constant> + <constant name="JUSTIFICATION_NONE" value="0" enum="JustificationFlag"> + Do not justify text. + </constant> + <constant name="JUSTIFICATION_KASHIDA" value="1" enum="JustificationFlag"> + Justify text by adding and removing kashidas. + </constant> + <constant name="JUSTIFICATION_WORD_BOUND" value="2" enum="JustificationFlag"> + Justify text by changing width of the spaces between the words. + </constant> + <constant name="JUSTIFICATION_TRIM_EDGE_SPACES" value="4" enum="JustificationFlag"> + Remove trailing and leading spaces from the justified text. + </constant> + <constant name="JUSTIFICATION_AFTER_LAST_TAB" value="8" enum="JustificationFlag"> + Only apply justification to the part of the text after the last tab. + </constant> + <constant name="BREAK_NONE" value="0" enum="LineBreakFlag"> + Do not break the line. + </constant> + <constant name="BREAK_MANDATORY" value="16" enum="LineBreakFlag"> + Break the line at the line mandatory break characters (e.g. [code]"\n"[/code]). + </constant> + <constant name="BREAK_WORD_BOUND" value="32" enum="LineBreakFlag"> + Break the line between the words. + </constant> + <constant name="BREAK_GRAPHEME_BOUND" value="64" enum="LineBreakFlag"> + Break the line between any unconnected graphemes. + </constant> + <constant name="GRAPHEME_IS_RTL" value="2" enum="GraphemeFlag"> + Grapheme is part of right-to-left or bottom-to-top run. + </constant> + <constant name="GRAPHEME_IS_VIRTUAL" value="4" enum="GraphemeFlag"> + Grapheme is not part of source text, it was added by justification process. + </constant> + <constant name="GRAPHEME_IS_SPACE" value="8" enum="GraphemeFlag"> + Grapheme is whitespace. + </constant> + <constant name="GRAPHEME_IS_BREAK_HARD" value="16" enum="GraphemeFlag"> + Grapheme is mandatory break point (e.g. [code]"\n"[/code]). + </constant> + <constant name="GRAPHEME_IS_BREAK_SOFT" value="32" enum="GraphemeFlag"> + Grapheme is optional break point (e.g. space). + </constant> + <constant name="GRAPHEME_IS_TAB" value="64" enum="GraphemeFlag"> + Grapheme is the tabulation character. + </constant> + <constant name="GRAPHEME_IS_ELONGATION" value="128" enum="GraphemeFlag"> + Grapheme is kashida. + </constant> + <constant name="HINTING_NONE" value="0" enum="Hinting"> + Disables font hinting (smoother but less crisp). + </constant> + <constant name="HINTING_LIGHT" value="1" enum="Hinting"> + Use the light font hinting mode. + </constant> + <constant name="HINTING_NORMAL" value="2" enum="Hinting"> + Use the default font hinting mode (crisper but less smooth). + </constant> + <constant name="FEATURE_BIDI_LAYOUT" value="1" enum="Feature"> + TextServer supports bidirectional layouts. + </constant> + <constant name="FEATURE_VERTICAL_LAYOUT" value="2" enum="Feature"> + TextServer supports vertical layouts. + </constant> + <constant name="FEATURE_SHAPING" value="4" enum="Feature"> + TextServer supports complex text shaping. + </constant> + <constant name="FEATURE_KASHIDA_JUSTIFICATION" value="8" enum="Feature"> + TextServer supports justification using kashidas. + </constant> + <constant name="FEATURE_BREAK_ITERATORS" value="16" enum="Feature"> + TextServer supports complex line/word breaking rules (e.g. dictionary based). + </constant> + <constant name="FEATURE_FONT_SYSTEM" value="32" enum="Feature"> + TextServer supports loading system fonts. + </constant> + <constant name="FEATURE_USE_SUPPORT_DATA" value="128" enum="Feature"> + TextServer require external data file for some features. + </constant> + </constants> +</class> diff --git a/doc/classes/TextServerManager.xml b/doc/classes/TextServerManager.xml new file mode 100644 index 0000000000..29586f30b4 --- /dev/null +++ b/doc/classes/TextServerManager.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="TextServerManager" inherits="Object" version="4.0"> + <brief_description> + Manager for the font and complex text layout servers. + </brief_description> + <description> + [TextServerManager] is the API backend for loading, enumeration and switching [TextServer]s. + Note: Switching text server at runtime is possible, but will invalidate all fonts and text buffers. Make sure to unload all controls, fonts, and themes before doing so. + </description> + <tutorials> + </tutorials> + <methods> + <method name="find_interface" qualifiers="const"> + <return type="TextServer"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + Finds an interface by its name. + </description> + </method> + <method name="get_interface" qualifiers="const"> + <return type="TextServer"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + Returns the interface registered at a given index. + </description> + </method> + <method name="get_interface_count" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the number of interfaces currently registered. + </description> + </method> + <method name="get_interface_features" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + Returns text server supported features (binary OR). + </description> + </method> + <method name="get_interface_name" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + Returns the interface name registered at a given index. + </description> + </method> + <method name="get_interfaces" qualifiers="const"> + <return type="Array"> + </return> + <description> + Returns a list of available interfaces the index and name of each interface. + </description> + </method> + <method name="get_primary_interface" qualifiers="const"> + <return type="TextServer"> + </return> + <description> + Returns the primary [TextServer] interface. + </description> + </method> + <method name="set_primary_interface"> + <return type="bool"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + Sets (and initializes it if required) interface registered at a given index as the primary. Invalidates all references to the fonts and text buffers. + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/Theme.xml b/doc/classes/Theme.xml index 783614c4af..1af6610f6f 100644 --- a/doc/classes/Theme.xml +++ b/doc/classes/Theme.xml @@ -51,6 +51,17 @@ Clears the [Font] at [code]name[/code] if the theme has [code]node_type[/code]. </description> </method> + <method name="clear_font_size"> + <return type="void"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="node_type" type="StringName"> + </argument> + <description> + Clears the font size [code]name[/code] if the theme has [code]node_type[/code]. + </description> + </method> <method name="clear_icon"> <return type="void"> </return> @@ -149,6 +160,26 @@ Returns all the [Font]s as a [PackedStringArray] filled with each [Font]'s name, for use in [method get_font], if the theme has [code]node_type[/code]. </description> </method> + <method name="get_font_size" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="node_type" type="StringName"> + </argument> + <description> + Returns the font size at [code]name[/code] if the theme has [code]node_type[/code]. + </description> + </method> + <method name="get_font_size_list" qualifiers="const"> + <return type="PackedStringArray"> + </return> + <argument index="0" name="node_type" type="String"> + </argument> + <description> + Returns all the font sizes as a [PackedStringArray] filled with each font size name, for use in [method get_font_size], if the theme has [code]node_type[/code]. + </description> + </method> <method name="get_icon" qualifiers="const"> <return type="Texture2D"> </return> @@ -241,6 +272,18 @@ Returns [code]false[/code] if the theme does not have [code]node_type[/code]. </description> </method> + <method name="has_font_size" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="node_type" type="StringName"> + </argument> + <description> + Returns [code]true[/code] if font size with [code]name[/code] is in [code]node_type[/code]. + Returns [code]false[/code] if the theme does not have [code]node_type[/code]. + </description> + </method> <method name="has_icon" qualifiers="const"> <return type="bool"> </return> @@ -307,6 +350,20 @@ Does nothing if the theme does not have [code]node_type[/code]. </description> </method> + <method name="set_font_size"> + <return type="void"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="node_type" type="StringName"> + </argument> + <argument index="2" name="font_size" type="int"> + </argument> + <description> + Sets the theme's font size to [code]font_size[/code] at [code]name[/code] in [code]node_type[/code]. + Does nothing if the theme does not have [code]node_type[/code]. + </description> + </method> <method name="set_icon"> <return type="void"> </return> @@ -340,6 +397,9 @@ <member name="default_font" type="Font" setter="set_default_font" getter="get_default_font"> The theme's default font. </member> + <member name="default_font_size" type="int" setter="set_default_font_size" getter="get_default_font_size" default="-1"> + The theme's default font size. Set to [code]-1[/code] to ignore and use global default. + </member> </members> <constants> </constants> diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index 73575b4309..01818e2993 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -35,6 +35,15 @@ Clears the tree. This removes all items. </description> </method> + <method name="clear_column_title_opentype_features"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <description> + Removes all OpenType features from the item's text. + </description> + </method> <method name="create_item"> <return type="TreeItem"> </return> @@ -75,6 +84,35 @@ Returns the column's title. </description> </method> + <method name="get_column_title_direction" qualifiers="const"> + <return type="int" enum="Control.TextDirection"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <description> + Returns column title base writing direction. + </description> + </method> + <method name="get_column_title_language" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <description> + Returns column title language code. + </description> + </method> + <method name="get_column_title_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code] of the column title. + </description> + </method> <method name="get_column_width" qualifiers="const"> <return type="int"> </return> @@ -225,6 +263,41 @@ Sets the title of a column. </description> </method> + <method name="set_column_title_direction"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="direction" type="int" enum="Control.TextDirection"> + </argument> + <description> + Sets column title base writing direction. + </description> + </method> + <method name="set_column_title_language"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="language" type="String"> + </argument> + <description> + Sets language code of column title used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </description> + </method> + <method name="set_column_title_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <argument index="2" name="value" type="int"> + </argument> + <description> + Sets OpenType feature [code]tag[/code] for the column title. + </description> + </method> <method name="set_column_titles_visible"> <return type="void"> </return> @@ -398,7 +471,10 @@ The arrow icon used when a foldable item is not collapsed. </theme_item> <theme_item name="arrow_collapsed" type="Texture2D"> - The arrow icon used when a foldable item is collapsed. + The arrow icon used when a foldable item is collapsed (for left-to-right layouts). + </theme_item> + <theme_item name="arrow_collapsed_mirrored" type="Texture2D"> + The arrow icon used when a foldable item is collapsed (for right-to-left layouts). </theme_item> <theme_item name="bg" type="StyleBox"> Default [StyleBox] for the [Tree], i.e. used when the control is not being focused. @@ -451,6 +527,9 @@ <theme_item name="font_color_selected" type="Color" default="Color( 1, 1, 1, 1 )"> Text [Color] used when the item is selected. </theme_item> + <theme_item name="font_size" type="int"> + Font size of the item's text. + </theme_item> <theme_item name="guide_color" type="Color" default="Color( 0, 0, 0, 0.1 )"> [Color] of the guideline. </theme_item> diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml index 22e643a51d..e97c1e580c 100644 --- a/doc/classes/TreeItem.xml +++ b/doc/classes/TreeItem.xml @@ -54,6 +54,15 @@ Resets the color for the given column to default. </description> </method> + <method name="clear_opentype_features"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <description> + Removes all OpenType features. + </description> + </method> <method name="deselect"> <return type="void"> </return> @@ -184,6 +193,15 @@ Returns the icon [Texture2D] region as [Rect2]. </description> </method> + <method name="get_language" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <description> + Returns item's text language code. + </description> + </method> <method name="get_metadata" qualifiers="const"> <return type="Variant"> </return> @@ -209,6 +227,17 @@ If [code]wrap[/code] is enabled, the method will wrap around to the first visible element in the tree when called on the last visible element, otherwise it returns [code]null[/code]. </description> </method> + <method name="get_opentype_feature" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <description> + Returns OpenType feature [code]tag[/code] of the item's text. + </description> + </method> <method name="get_parent"> <return type="TreeItem"> </return> @@ -249,6 +278,22 @@ <description> </description> </method> + <method name="get_structured_text_bidi_override" qualifiers="const"> + <return type="int" enum="Control.StructuredTextParser"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_structured_text_bidi_override_options" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <description> + </description> + </method> <method name="get_suffix" qualifiers="const"> <return type="String"> </return> @@ -275,6 +320,15 @@ Returns the given column's text alignment. </description> </method> + <method name="get_text_direction" qualifiers="const"> + <return type="int" enum="Control.TextDirection"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <description> + Returns item's text base writing direction. + </description> + </method> <method name="get_tooltip" qualifiers="const"> <return type="String"> </return> @@ -533,6 +587,17 @@ Sets the given column's icon's texture region. </description> </method> + <method name="set_language"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="language" type="String"> + </argument> + <description> + Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead. + </description> + </method> <method name="set_metadata"> <return type="void"> </return> @@ -543,6 +608,19 @@ <description> </description> </method> + <method name="set_opentype_feature"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="tag" type="String"> + </argument> + <argument index="2" name="value" type="int"> + </argument> + <description> + Sets OpenType feature [code]tag[/code] for the item's text. + </description> + </method> <method name="set_range"> <return type="void"> </return> @@ -580,6 +658,26 @@ If [code]true[/code], the given column is selectable. </description> </method> + <method name="set_structured_text_bidi_override"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="parser" type="int" enum="Control.StructuredTextParser"> + </argument> + <description> + </description> + </method> + <method name="set_structured_text_bidi_override_options"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="args" type="Array"> + </argument> + <description> + </description> + </method> <method name="set_suffix"> <return type="void"> </return> @@ -611,6 +709,17 @@ Sets the given column's text alignment. See [enum TextAlign] for possible values. </description> </method> + <method name="set_text_direction"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="direction" type="int" enum="Control.TextDirection"> + </argument> + <description> + Sets item's text base writing direction. + </description> + </method> <method name="set_tooltip"> <return type="void"> </return> diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index a0711b4214..0f887c7705 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -27,6 +27,13 @@ <description> </description> </method> + <method name="get_layout_direction" qualifiers="const"> + <return type="int" enum="Window.LayoutDirection"> + </return> + <description> + Returns layout direction and text writing direction. + </description> + </method> <method name="get_real_size" qualifiers="const"> <return type="Vector2i"> </return> @@ -61,6 +68,18 @@ <argument index="1" name="type" type="StringName" default=""""> </argument> <description> + Returns the [Font] at [code]name[/code] if the theme has [code]type[/code]. + </description> + </method> + <method name="get_theme_font_size" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + Returns the font size at [code]name[/code] if the theme has [code]type[/code]. </description> </method> <method name="get_theme_icon" qualifiers="const"> @@ -123,6 +142,20 @@ <argument index="1" name="type" type="StringName" default=""""> </argument> <description> + Returns [code]true[/code] if [Font] with [code]name[/code] is in [code]type[/code]. + Returns [code]false[/code] if the theme does not have [code]type[/code]. + </description> + </method> + <method name="has_theme_font_size" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="StringName"> + </argument> + <argument index="1" name="type" type="StringName" default=""""> + </argument> + <description> + Returns [code]true[/code] if font size with [code]name[/code] is in [code]type[/code]. + Returns [code]false[/code] if the theme does not have [code]type[/code]. </description> </method> <method name="has_theme_icon" qualifiers="const"> @@ -157,6 +190,13 @@ <description> </description> </method> + <method name="is_layout_rtl" qualifiers="const"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if layout is right-to-left. + </description> + </method> <method name="is_maximize_allowed" qualifiers="const"> <return type="bool"> </return> @@ -249,6 +289,15 @@ <description> </description> </method> + <method name="set_layout_direction"> + <return type="void"> + </return> + <argument index="0" name="direction" type="int" enum="Window.LayoutDirection"> + </argument> + <description> + Sets layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew). + </description> + </method> <method name="set_use_font_oversampling"> <return type="void"> </return> @@ -393,6 +442,18 @@ </constant> <constant name="CONTENT_SCALE_ASPECT_EXPAND" value="4" enum="ContentScaleAspect"> </constant> + <constant name="LAYOUT_DIRECTION_INHERITED" value="0" enum="LayoutDirection"> + Automatic layout direction, determined from the parent control layout direction. + </constant> + <constant name="LAYOUT_DIRECTION_LOCALE" value="1" enum="LayoutDirection"> + Automatic layout direction, determined from the current locale. + </constant> + <constant name="LAYOUT_DIRECTION_LTR" value="2" enum="LayoutDirection"> + Left-to-right layout direction. + </constant> + <constant name="LAYOUT_DIRECTION_RTL" value="3" enum="LayoutDirection"> + Right-to-left layout direction. + </constant> </constants> <theme_items> <theme_item name="close" type="Texture2D"> diff --git a/doc/classes/int.xml b/doc/classes/int.xml index 5ac9f8405a..b0d0a4bd7b 100644 --- a/doc/classes/int.xml +++ b/doc/classes/int.xml @@ -7,18 +7,34 @@ Signed 64-bit integer type. It can take values in the interval [code][-2^63, 2^63 - 1][/code], i.e. [code][-9223372036854775808, 9223372036854775807][/code]. Exceeding those bounds will wrap around. [int] is a [Variant] type, and will thus be used when assigning an integer value to a [Variant]. It can also be enforced with the [code]: int[/code] type hint. - [codeblock] + [codeblocks] + [gdscript] var my_variant = 0 # int, value 0. my_variant += 4.2 # float, value 4.2. var my_int: int = 1 # int, value 1. my_int = 4.2 # int, value 4, the right value is implicitly cast to int. my_int = int("6.7") # int, value 6, the String is explicitly cast with int. - var max_int = 9223372036854775807 print(max_int) # 9223372036854775807, OK. max_int += 1 print(max_int) # -9223372036854775808, we overflowed and wrapped around. - [/codeblock] + [/gdscript] + [csharp] + int myInt = (int)"6.7".ToFloat(); // int, value 6, the String is explicitly cast with int. + // We have to use `long` here, because GDSript's `int` + // is 64 bits long while C#'s `int` is only 32 bits. + long maxInt = 9223372036854775807; + GD.Print(maxInt); // 9223372036854775807, OK. + maxInt++; + GD.Print(maxInt); // -9223372036854775808, we overflowed and wrapped around. + + // Alternatively, if we used C#'s 32-bit `int` type, the maximum value is much smaller: + int halfInt = 2147483647; + GD.Print(halfInt); // 2147483647, OK. + halfInt++; + GD.Print(halfInt); // -2147483648, we overflowed and wrapped around. + [/csharp] + [/codeblocks] </description> <tutorials> </tutorials> |