summaryrefslogtreecommitdiff
path: root/doc/classes/Font.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Font.xml')
-rw-r--r--doc/classes/Font.xml202
1 files changed, 104 insertions, 98 deletions
diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml
index b19386b398..ad3a16afbb 100644
--- a/doc/classes/Font.xml
+++ b/doc/classes/Font.xml
@@ -11,114 +11,116 @@
<methods>
<method name="draw_char" qualifiers="const">
<return type="float" />
- <argument index="0" name="canvas_item" type="RID" />
- <argument index="1" name="pos" type="Vector2" />
- <argument index="2" name="char" type="int" />
- <argument index="3" name="modulate" type="int" />
- <argument index="4" name="arg4" type="Color" default="Color(1, 1, 1, 1)" />
+ <param index="0" name="canvas_item" type="RID" />
+ <param index="1" name="pos" type="Vector2" />
+ <param index="2" name="char" type="int" />
+ <param index="3" name="font_size" type="int" />
+ <param index="4" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
<description>
- Draw a single Unicode character [code]char[/code] into a canvas item using the font, at a given position, with [code]modulate[/code] color. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
+ Draw a single Unicode character [param char] into a canvas item using the font, at a given position, with [param modulate] color. [param pos] 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_outline" qualifiers="const">
<return type="float" />
- <argument index="0" name="canvas_item" type="RID" />
- <argument index="1" name="pos" type="Vector2" />
- <argument index="2" name="char" type="int" />
- <argument index="3" name="size" type="int" />
- <argument index="4" name="modulate" type="int" default="-1" />
- <argument index="5" name="arg5" type="Color" default="Color(1, 1, 1, 1)" />
+ <param index="0" name="canvas_item" type="RID" />
+ <param index="1" name="pos" type="Vector2" />
+ <param index="2" name="char" type="int" />
+ <param index="3" name="font_size" type="int" />
+ <param index="4" name="size" type="int" default="-1" />
+ <param index="5" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
<description>
- Draw a single Unicode character [code]char[/code] outline into a canvas item using the font, at a given position, with [code]modulate[/code] color and [code]size[/code] outline size. [code]position[/code] specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis.
+ Draw a single Unicode character [param char] outline into a canvas item using the font, at a given position, with [param modulate] color and [param size] outline size. [param pos] 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_multiline_string" qualifiers="const">
<return type="void" />
- <argument index="0" name="canvas_item" type="RID" />
- <argument index="1" name="pos" type="Vector2" />
- <argument index="2" name="text" type="String" />
- <argument index="3" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
- <argument index="4" name="width" type="float" default="-1" />
- <argument index="5" name="font_size" type="int" default="16" />
- <argument index="6" name="max_lines" type="int" default="-1" />
- <argument index="7" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
- <argument index="8" name="flags" type="int" default="99" />
- <argument index="9" name="direction" type="int" enum="TextServer.Direction" default="0" />
- <argument index="10" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
+ <param index="0" name="canvas_item" type="RID" />
+ <param index="1" name="pos" type="Vector2" />
+ <param index="2" name="text" type="String" />
+ <param index="3" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
+ <param index="4" name="width" type="float" default="-1" />
+ <param index="5" name="font_size" type="int" default="16" />
+ <param index="6" name="max_lines" type="int" default="-1" />
+ <param index="7" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <param index="8" name="brk_flags" type="int" enum="TextServer.LineBreakFlag" default="3" />
+ <param index="9" name="jst_flags" type="int" enum="TextServer.JustificationFlag" default="3" />
+ <param index="10" name="direction" type="int" enum="TextServer.Direction" default="0" />
+ <param index="11" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
<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.
+ Breaks [param text] into lines using rules specified by [param brk_flags] and draws it into a canvas item using the font, at a given position, with [param modulate] color, optionally clipping the width and aligning horizontally. [param pos] 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_multiline_string_outline" qualifiers="const">
<return type="void" />
- <argument index="0" name="canvas_item" type="RID" />
- <argument index="1" name="pos" type="Vector2" />
- <argument index="2" name="text" type="String" />
- <argument index="3" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
- <argument index="4" name="width" type="float" default="-1" />
- <argument index="5" name="font_size" type="int" default="16" />
- <argument index="6" name="max_lines" type="int" default="-1" />
- <argument index="7" name="size" type="int" default="1" />
- <argument index="8" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
- <argument index="9" name="flags" type="int" default="99" />
- <argument index="10" name="direction" type="int" enum="TextServer.Direction" default="0" />
- <argument index="11" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
+ <param index="0" name="canvas_item" type="RID" />
+ <param index="1" name="pos" type="Vector2" />
+ <param index="2" name="text" type="String" />
+ <param index="3" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
+ <param index="4" name="width" type="float" default="-1" />
+ <param index="5" name="font_size" type="int" default="16" />
+ <param index="6" name="max_lines" type="int" default="-1" />
+ <param index="7" name="size" type="int" default="1" />
+ <param index="8" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <param index="9" name="brk_flags" type="int" enum="TextServer.LineBreakFlag" default="3" />
+ <param index="10" name="jst_flags" type="int" enum="TextServer.JustificationFlag" default="3" />
+ <param index="11" name="direction" type="int" enum="TextServer.Direction" default="0" />
+ <param index="12" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
<description>
- Breaks [code]text[/code] to the lines using rules specified by [code]flags[/code] and draws text outline into a canvas item using the font, at a given position, with [code]modulate[/code] color and [code]size[/code] outline size, 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.
+ Breaks [param text] to the lines using rules specified by [param brk_flags] and draws text outline into a canvas item using the font, at a given position, with [param modulate] color and [param size] outline size, optionally clipping the width and aligning horizontally. [param pos] 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_outline].
</description>
</method>
<method name="draw_string" qualifiers="const">
<return type="void" />
- <argument index="0" name="canvas_item" type="RID" />
- <argument index="1" name="pos" type="Vector2" />
- <argument index="2" name="text" type="String" />
- <argument index="3" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
- <argument index="4" name="width" type="float" default="-1" />
- <argument index="5" name="font_size" type="int" default="16" />
- <argument index="6" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
- <argument index="7" name="flags" type="int" default="3" />
- <argument index="8" name="direction" type="int" enum="TextServer.Direction" default="0" />
- <argument index="9" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
+ <param index="0" name="canvas_item" type="RID" />
+ <param index="1" name="pos" type="Vector2" />
+ <param index="2" name="text" type="String" />
+ <param index="3" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
+ <param index="4" name="width" type="float" default="-1" />
+ <param index="5" name="font_size" type="int" default="16" />
+ <param index="6" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <param index="7" name="jst_flags" type="int" enum="TextServer.JustificationFlag" default="3" />
+ <param index="8" name="direction" type="int" enum="TextServer.Direction" default="0" />
+ <param index="9" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
<description>
- 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.
+ Draw [param text] into a canvas item using the font, at a given position, with [param modulate] color, optionally clipping the width and aligning horizontally. [param pos] 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="draw_string_outline" qualifiers="const">
<return type="void" />
- <argument index="0" name="canvas_item" type="RID" />
- <argument index="1" name="pos" type="Vector2" />
- <argument index="2" name="text" type="String" />
- <argument index="3" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
- <argument index="4" name="width" type="float" default="-1" />
- <argument index="5" name="font_size" type="int" default="16" />
- <argument index="6" name="size" type="int" default="1" />
- <argument index="7" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
- <argument index="8" name="flags" type="int" default="3" />
- <argument index="9" name="direction" type="int" enum="TextServer.Direction" default="0" />
- <argument index="10" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
+ <param index="0" name="canvas_item" type="RID" />
+ <param index="1" name="pos" type="Vector2" />
+ <param index="2" name="text" type="String" />
+ <param index="3" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
+ <param index="4" name="width" type="float" default="-1" />
+ <param index="5" name="font_size" type="int" default="16" />
+ <param index="6" name="size" type="int" default="1" />
+ <param index="7" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
+ <param index="8" name="jst_flags" type="int" enum="TextServer.JustificationFlag" default="3" />
+ <param index="9" name="direction" type="int" enum="TextServer.Direction" default="0" />
+ <param index="10" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
<description>
- Draw [code]text[/code] outline into a canvas item using the font, at a given position, with [code]modulate[/code] color and [code]size[/code] outline size, 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.
+ Draw [param text] outline into a canvas item using the font, at a given position, with [param modulate] color and [param size] outline size, optionally clipping the width and aligning horizontally. [param pos] 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_outline].
</description>
</method>
<method name="find_variation" qualifiers="const">
<return type="RID" />
- <argument index="0" name="variation_coordinates" type="Dictionary" />
- <argument index="1" name="face_index" type="int" default="0" />
- <argument index="2" name="strength" type="float" default="0.0" />
- <argument index="3" name="transform" type="Transform2D" default="Transform2D(1, 0, 0, 1, 0, 0)" />
+ <param index="0" name="variation_coordinates" type="Dictionary" />
+ <param index="1" name="face_index" type="int" default="0" />
+ <param index="2" name="strength" type="float" default="0.0" />
+ <param index="3" name="transform" type="Transform2D" default="Transform2D(1, 0, 0, 1, 0, 0)" />
<description>
Returns [TextServer] RID of the font cache for specific variation.
</description>
</method>
<method name="get_ascent" qualifiers="const">
<return type="float" />
- <argument index="0" name="font_size" type="int" default="16" />
+ <param index="0" name="font_size" type="int" default="16" />
<description>
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).
@@ -126,8 +128,8 @@
</method>
<method name="get_char_size" qualifiers="const">
<return type="Vector2" />
- <argument index="0" name="char" type="int" />
- <argument index="1" name="arg1" type="int" />
+ <param index="0" name="char" type="int" />
+ <param index="1" name="font_size" type="int" />
<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. The height returned is the font height (see also [method get_height]) and has no relation to the glyph height.
@@ -135,7 +137,7 @@
</method>
<method name="get_descent" qualifiers="const">
<return type="float" />
- <argument index="0" name="font_size" type="int" default="16" />
+ <param index="0" name="font_size" type="int" default="16" />
<description>
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).
@@ -160,7 +162,7 @@
</description>
</method>
<method name="get_font_style" qualifiers="const">
- <return type="int" />
+ <return type="int" enum="TextServer.FontStyle" />
<description>
Returns font style flags, see [enum TextServer.FontStyle].
</description>
@@ -173,7 +175,7 @@
</method>
<method name="get_height" qualifiers="const">
<return type="float" />
- <argument index="0" name="font_size" type="int" default="16" />
+ <param index="0" name="font_size" type="int" default="16" />
<description>
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).
@@ -181,14 +183,15 @@
</method>
<method name="get_multiline_string_size" qualifiers="const">
<return type="Vector2" />
- <argument index="0" name="text" type="String" />
- <argument index="1" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
- <argument index="2" name="width" type="float" default="-1" />
- <argument index="3" name="font_size" type="int" default="16" />
- <argument index="4" name="max_lines" type="int" default="-1" />
- <argument index="5" name="flags" type="int" default="96" />
- <argument index="6" name="direction" type="int" enum="TextServer.Direction" default="0" />
- <argument index="7" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
+ <param index="0" name="text" type="String" />
+ <param index="1" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
+ <param index="2" name="width" type="float" default="-1" />
+ <param index="3" name="font_size" type="int" default="16" />
+ <param index="4" name="max_lines" type="int" default="-1" />
+ <param index="5" name="brk_flags" type="int" enum="TextServer.LineBreakFlag" default="3" />
+ <param index="6" name="jst_flags" type="int" enum="TextServer.JustificationFlag" default="3" />
+ <param index="7" name="direction" type="int" enum="TextServer.Direction" default="0" />
+ <param index="8" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
<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].
@@ -208,24 +211,27 @@
</method>
<method name="get_spacing" qualifiers="const">
<return type="int" />
- <argument index="0" name="spacing" type="int" enum="TextServer.SpacingType" />
+ <param index="0" name="spacing" type="int" enum="TextServer.SpacingType" />
<description>
Returns the spacing for the given [code]type[/code] (see [enum TextServer.SpacingType]).
</description>
</method>
<method name="get_string_size" qualifiers="const">
<return type="Vector2" />
- <argument index="0" name="text" type="String" />
- <argument index="1" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
- <argument index="2" name="width" type="float" default="-1" />
- <argument index="3" name="font_size" type="int" default="16" />
- <argument index="4" name="flags" type="int" default="3" />
- <argument index="5" name="direction" type="int" enum="TextServer.Direction" default="0" />
- <argument index="6" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
+ <param index="0" name="text" type="String" />
+ <param index="1" name="alignment" type="int" enum="HorizontalAlignment" default="0" />
+ <param index="2" name="width" type="float" default="-1" />
+ <param index="3" name="font_size" type="int" default="16" />
+ <param index="4" name="jst_flags" type="int" enum="TextServer.JustificationFlag" default="3" />
+ <param index="5" name="direction" type="int" enum="TextServer.Direction" default="0" />
+ <param index="6" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
<description>
- Returns the size of a bounding box of a string, taking kerning and advance into account.
+ Returns the size of a bounding box of a single-line string, taking kerning and advance into account. See also [method get_multiline_string_size] and [method draw_string].
+ For example, to get the string size as displayed by a single-line Label, use:
+ [codeblock]
+ var string_size = $Label.get_theme_font("font").get_string_size($Label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, $Label.get_theme_font_size("font_size"))
+ [/codeblock]
[b]Note:[/b] Real height of the string is context-dependent and can be significantly different from the value returned by [method get_height].
- See also [method draw_string].
</description>
</method>
<method name="get_supported_chars" qualifiers="const">
@@ -250,7 +256,7 @@
</method>
<method name="get_underline_position" qualifiers="const">
<return type="float" />
- <argument index="0" name="font_size" type="int" default="16" />
+ <param index="0" name="font_size" type="int" default="16" />
<description>
Returns 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.
@@ -258,7 +264,7 @@
</method>
<method name="get_underline_thickness" qualifiers="const">
<return type="float" />
- <argument index="0" name="font_size" type="int" default="16" />
+ <param index="0" name="font_size" type="int" default="16" />
<description>
Returns 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.
@@ -266,36 +272,36 @@
</method>
<method name="has_char" qualifiers="const">
<return type="bool" />
- <argument index="0" name="char" type="int" />
+ <param index="0" name="char" type="int" />
<description>
- Returns [code]true[/code] if a Unicode [code]char[/code] is available in the font.
+ Returns [code]true[/code] if a Unicode [param char] is available in the font.
</description>
</method>
<method name="is_language_supported" qualifiers="const">
<return type="bool" />
- <argument index="0" name="language" type="String" />
+ <param index="0" name="language" type="String" />
<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" />
- <argument index="0" name="script" type="String" />
+ <param index="0" name="script" type="String" />
<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="set_cache_capacity">
<return type="void" />
- <argument index="0" name="single_line" type="int" />
- <argument index="1" name="multi_line" type="int" />
+ <param index="0" name="single_line" type="int" />
+ <param index="1" name="multi_line" type="int" />
<description>
Sets LRU cache capacity for [code]draw_*[/code] methods.
</description>
</method>
<method name="set_fallbacks">
<return type="void" />
- <argument index="0" name="fallbacks" type="Font[]" />
+ <param index="0" name="fallbacks" type="Font[]" />
<description>
Sets array of fallback [Font]s.
</description>