Skip to content

Commit

Permalink
[Complex Text Layouts] Add TextServer documentation. Update Font, Can…
Browse files Browse the repository at this point in the history
…vasItem, Theme and modified controls documentation.
  • Loading branch information
bruvzg committed Nov 26, 2020
1 parent 3be31c4 commit 7e2c0ff
Show file tree
Hide file tree
Showing 35 changed files with 3,610 additions and 184 deletions.
6 changes: 6 additions & 0 deletions doc/classes/@GlobalScope.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
42 changes: 42 additions & 0 deletions doc/classes/Button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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="&quot;&quot;">
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="&quot;&quot;">
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">
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down
69 changes: 58 additions & 11 deletions doc/classes/CanvasItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,24 @@
Draws an arc between the given angles. The larger the value of [code]point_count[/code], the smoother the curve.
</description>
</method>
<method name="draw_char">
<method name="draw_char" qualifiers="const">
<return type="float">
</return>
<argument index="0" name="font" type="Font">
</argument>
<argument index="1" name="position" type="Vector2">
<argument index="1" name="pos" type="Vector2">
</argument>
<argument index="2" name="char" type="String">
</argument>
<argument index="3" name="next" type="String">
<argument index="3" name="next" type="String" default="&quot;&quot;">
</argument>
<argument index="4" name="size" type="int" default="-1">
</argument>
<argument index="5" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<argument index="6" name="outline_size" type="int" default="0">
</argument>
<argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
<argument index="7" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 0 )">
</argument>
<description>
Draws a string character using a custom font. Returns the advance, depending on the character width and kerning with an optional next character.
Expand Down Expand Up @@ -146,6 +152,35 @@
Draws multiple, parallel lines with a uniform [code]width[/code] and segment-by-segment coloring. Colors assigned to line segments match by index between [code]points[/code] and [code]colors[/code].
</description>
</method>
<method name="draw_multiline_string" qualifiers="const">
<return type="void">
</return>
<argument index="0" name="font" type="Font">
</argument>
<argument index="1" name="pos" type="Vector2">
</argument>
<argument index="2" name="text" type="String">
</argument>
<argument index="3" name="align" type="int" enum="HAlign" default="0">
</argument>
<argument index="4" name="width" type="float" default="-1">
</argument>
<argument index="5" name="max_lines" type="int" default="-1">
</argument>
<argument index="6" name="size" type="int" default="-1">
</argument>
<argument index="7" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<argument index="8" name="outline_size" type="int" default="0">
</argument>
<argument index="9" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 0 )">
</argument>
<argument index="10" name="flags" type="int" default="51">
</argument>
<description>
Breaks [code]text[/code] to the lines and draws it using the specified [code]font[/code] at the [code]position[/code] (top-left corner). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
</description>
</method>
<method name="draw_multimesh">
<return type="void">
</return>
Expand Down Expand Up @@ -253,18 +288,28 @@
Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed by this.
</description>
</method>
<method name="draw_string">
<method name="draw_string" qualifiers="const">
<return type="void">
</return>
<argument index="0" name="font" type="Font">
</argument>
<argument index="1" name="position" type="Vector2">
<argument index="1" name="pos" type="Vector2">
</argument>
<argument index="2" name="text" type="String">
</argument>
<argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
<argument index="3" name="align" type="int" enum="HAlign" default="0">
</argument>
<argument index="4" name="width" type="float" default="-1">
</argument>
<argument index="5" name="size" type="int" default="-1">
</argument>
<argument index="6" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<argument index="7" name="outline_size" type="int" default="0">
</argument>
<argument index="8" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 0 )">
</argument>
<argument index="4" name="clip_w" type="int" default="-1">
<argument index="9" name="flags" type="int" default="3">
</argument>
<description>
Draws [code]text[/code] using the specified [code]font[/code] at the [code]position[/code] (top-left corner). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
Expand All @@ -275,17 +320,19 @@
# `default_font` declaration to a member variable assigned in `_ready()`
# so the Control is only created once.
var default_font = Control.new().get_font("font")
draw_string(default_font, Vector2(64, 64), "Hello world")
var default_font_size = Control.new().get_font_size("font_size")
draw_string(default_font, Vector2(64, 64), "Hello world", HALIGN_LEFT, -1, font_size)
[/gdscript]
[csharp]
// If using this method in a script that redraws constantly, move the
// `default_font` declaration to a member variable assigned in `_ready()`
// so the Control is only created once.
Font defaultFont = new Control().GetFont("font");
DrawString(defaultFont, new Vector2(64, 64), "Hello world");
int defaultFontSize = new Control().GetFontSize("font_size");
DrawString(defaultFont, new Vector2(64, 64), "Hello world", HALIGN_LEFT, -1, defaultFontSize);
[/csharp]
[/codeblocks]
See also [method Font.draw].
See also [method Font.draw_string].
</description>
</method>
<method name="draw_style_box">
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/CheckBox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
23 changes: 19 additions & 4 deletions doc/classes/CheckButton.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions doc/classes/CodeEdit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,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>
Expand Down Expand Up @@ -180,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">
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/ColorPickerButton.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading

0 comments on commit 7e2c0ff

Please sign in to comment.