godot/doc/classes/TextServer.xml

1305 lines
53 KiB
XML
Raw Normal View History

<?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">
<return type="RID" />
<description>
Creates new, empty font cache entry resource. To free the resulting resourec, use [method free_rid] method.
</description>
</method>
<method name="create_shaped_text">
<return type="RID" />
<argument index="0" name="direction" type="int" enum="TextServer.Direction" default="0" />
<argument index="1" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
<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" />
<argument index="0" name="canvas" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="pos" type="Vector2" />
<argument index="3" name="index" type="int" />
<argument index="4" name="color" type="Color" />
<description>
Draws box displaying character hexadecimal code. Used for replacing missing characters.
</description>
</method>
<method name="font_clear_glyphs">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<description>
Removes all rendered glyphs information from the cache entry. Note: This function will not remove textures associated with the glyphs, use [method font_remove_texture] to remove them manually.
</description>
</method>
<method name="font_clear_kerning_map">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<description>
Removes all kerning overrides.
</description>
</method>
<method name="font_clear_size_cache">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<description>
Removes all font sizes from the cache entry
</description>
</method>
<method name="font_clear_textures">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<description>
Removes all textures from font cache entry. Note: This function will not remove glyphs associated with the texture, use [method font_remove_glyph] to remove them manually.
</description>
</method>
<method name="font_draw_glyph" qualifiers="const">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="canvas" type="RID" />
<argument index="2" name="size" type="int" />
<argument index="3" name="pos" type="Vector2" />
<argument index="4" name="index" type="int" />
<argument index="5" name="color" type="Color" default="Color(1, 1, 1, 1)" />
<description>
Draws single glyph into a canvas item at the position, using [code]font_rid[/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="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="canvas" type="RID" />
<argument index="2" name="size" type="int" />
<argument index="3" name="outline_size" type="int" />
<argument index="4" name="pos" type="Vector2" />
<argument index="5" name="index" type="int" />
<argument index="6" name="color" type="Color" default="Color(1, 1, 1, 1)" />
<description>
Draws single glyph outline of size [code]outline_size[/code] into a canvas item at the position, using [code]font_rid[/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_ascent" qualifiers="const">
<return type="float" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<description>
Returns the font ascent (number of pixels above the baseline).
</description>
</method>
<method name="font_get_descent" qualifiers="const">
<return type="float" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<description>
Returns the font descent (number of pixels below the baseline).
</description>
</method>
<method name="font_get_fixed_size" qualifiers="const">
<return type="int" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns bitmap font fixed size.
</description>
</method>
<method name="font_get_global_oversampling" qualifiers="const">
<return type="float" />
<description>
Returns the font oversampling factor, shared by all fonts in the TextServer.
</description>
</method>
<method name="font_get_glyph_advance" qualifiers="const">
<return type="Vector2" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="glyph" type="int" />
<description>
Returns glyph advance (offset of the next glyph). Note: advance for glyphs outlines is the same as the base glyph advance and is not saved.
</description>
</method>
<method name="font_get_glyph_contours" qualifiers="const">
<return type="Dictionary" />
<argument index="0" name="font" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="index" type="int" />
<description>
Returns outline contours of the glyph as a [code]Dictionary[/code] with the following contents:
[code]points[/code] - [PackedVector3Array], containing outline points. [code]x[/code] and [code]y[/code] are point coordinates. [code]z[/code] is the type of the point, using the [enum ContourPointTag] values.
[code]contours[/code] - [PackedInt32Array], containing indices the end points of each contour.
[code]orientation[/code] - [bool], contour orientation. If [code]true[/code], clockwise contours must be filled.
</description>
</method>
<method name="font_get_glyph_index" qualifiers="const">
<return type="int" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="char" type="int" />
<argument index="3" name="variation_selector" type="int" />
<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_list" qualifiers="const">
<return type="Array" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<description>
Returns list of rendered glyphs in the cache entry.
</description>
</method>
<method name="font_get_glyph_offset" qualifiers="const">
<return type="Vector2" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="glyph" type="int" />
<description>
Returns glyph offset from the baseline.
</description>
</method>
<method name="font_get_glyph_size" qualifiers="const">
<return type="Vector2" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="glyph" type="int" />
<description>
Returns size of the glyph.
</description>
</method>
<method name="font_get_glyph_texture_idx" qualifiers="const">
<return type="int" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="glyph" type="int" />
<description>
Returns index of the cache texture containing the glyph.
</description>
</method>
<method name="font_get_glyph_uv_rect" qualifiers="const">
<return type="Rect2" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="glyph" type="int" />
<description>
Returns rectangle in the cache texture containing the glyph.
</description>
</method>
<method name="font_get_hinting" qualifiers="const">
<return type="int" enum="TextServer.Hinting" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns the font hinting mode. Used by dynamic fonts only.
</description>
</method>
<method name="font_get_kerning" qualifiers="const">
<return type="Vector2" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="glyph_pair" type="Vector2i" />
<description>
Returns kerning for the pair of glyphs.
</description>
</method>
<method name="font_get_kerning_list" qualifiers="const">
<return type="Array" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<description>
Returns list of the kerning overrides.
</description>
</method>
<method name="font_get_language_support_override">
<return type="bool" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="language" type="String" />
<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" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns list of language support overrides.
</description>
</method>
<method name="font_get_msdf_pixel_range" qualifiers="const">
<return type="int" />
<argument index="0" name="font_rid" type="RID" />
<description>
Return the width of the range around the shape between the minimum and maximum representable signed distance.
</description>
</method>
<method name="font_get_msdf_size" qualifiers="const">
<return type="int" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns source font size used to generate MSDF textures.
</description>
</method>
<method name="font_get_oversampling" qualifiers="const">
<return type="float" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns font oversampling factor, if set to [code]0.0[/code] global oversampling factor is used instead. Used by dynamic fonts only.
</description>
</method>
<method name="font_get_scale" qualifiers="const">
<return type="float" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<description>
Returns scaling factor of the color bitmap font.
</description>
</method>
<method name="font_get_script_support_override">
<return type="bool" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="script" type="String" />
<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" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns list of script support overrides.
</description>
</method>
<method name="font_get_size_cache_list" qualifiers="const">
<return type="Array" />
<argument index="0" name="font_rid" type="RID" />
<description>
Return list of the font sizes in the cache. Each size is [code]Vector2i[/code] with font size and outline size.
</description>
</method>
<method name="font_get_spacing" qualifiers="const">
<return type="int" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="spacing" type="int" enum="TextServer.SpacingType" />
<description>
Returns extra spacing added between glyphs in pixels.
</description>
</method>
<method name="font_get_supported_chars" qualifiers="const">
<return type="String" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns a string containing all the characters available in the font.
</description>
</method>
<method name="font_get_texture_count" qualifiers="const">
<return type="int" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<description>
Returns number of textures used by font cache entry.
</description>
</method>
<method name="font_get_texture_image" qualifiers="const">
<return type="Image" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="texture_index" type="int" />
<description>
Returns font cache texture image data.
</description>
</method>
<method name="font_get_texture_offsets" qualifiers="const">
<return type="PackedInt32Array" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="texture_index" type="int" />
<description>
Returns array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty.
</description>
</method>
<method name="font_get_underline_position" qualifiers="const">
<return type="float" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<description>
Returns pixel offset of the underline below the baseline.
</description>
</method>
<method name="font_get_underline_thickness" qualifiers="const">
<return type="float" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<description>
Returns thickness of the underline in pixels.
</description>
</method>
<method name="font_get_variation_coordinates" qualifiers="const">
<return type="Dictionary" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info.
</description>
</method>
<method name="font_has_char" qualifiers="const">
<return type="bool" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="char" type="int" />
<description>
Return [code]true[/code] if a Unicode [code]char[/code] is available in the font.
</description>
</method>
<method name="font_is_antialiased" qualifiers="const">
<return type="bool" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns [code]true[/code] if font 8-bit anitialiased glyph rendering is supported and enabled.
</description>
</method>
<method name="font_is_force_autohinter" qualifiers="const">
<return type="bool" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns [code]true[/code] if auto-hinting is supported and preffered over font built-in hinting. Used by dynamic fonts only.
</description>
</method>
<method name="font_is_language_supported" qualifiers="const">
<return type="bool" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" 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="font_is_multichannel_signed_distance_field" qualifiers="const">
<return type="bool" />
<argument index="0" name="font_rid" type="RID" />
<description>
Returns [code]true[/code] if glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
</description>
</method>
<method name="font_is_script_supported" qualifiers="const">
<return type="bool" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="script" type="String" />
<description>
Returns [code]true[/code], if font supports given script (ISO 15924 code).
</description>
</method>
<method name="font_remove_glyph">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="glyph" type="int" />
<description>
Removes specified rendered glyph information from the cache entry. Note: This function will not remove textures associated with the glyphs, use [method font_remove_texture] to remove them manually.
</description>
</method>
<method name="font_remove_kerning">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="glyph_pair" type="Vector2i" />
<description>
Removes kerning override for the pair of glyphs.
</description>
</method>
<method name="font_remove_language_support_override">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="language" type="String" />
<description>
Remove language support override.
</description>
</method>
<method name="font_remove_script_support_override">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="script" type="String" />
<description>
Removes script support override.
</description>
</method>
<method name="font_remove_size_cache">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<description>
Removes specified font size from the cache entry.
</description>
</method>
<method name="font_remove_texture">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="texture_index" type="int" />
<description>
Removes specified texture from font cache entry. Note: This function will not remove glyphs associated with the texture, remove them manually, using [method font_remove_glyph].
</description>
</method>
<method name="font_render_glyph">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="index" type="int" />
<description>
Renders specified glyph the the font cache texture.
</description>
</method>
<method name="font_render_range">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="start" type="int" />
<argument index="3" name="end" type="int" />
<description>
Renders the range of characters to the font cache texture.
</description>
</method>
<method name="font_set_antialiased">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="antialiased" type="bool" />
<description>
If set to [code]true[/code], 8-bit antialiased glyph rendering is used, otherwise 1-bit rendering is used. Used by dynamic fonts only.
</description>
</method>
<method name="font_set_ascent">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="ascent" type="float" />
<description>
Sets the font ascent (number of pixels above the baseline).
</description>
</method>
<method name="font_set_data">
<return type="void" />
<argument index="0" name="data" type="RID" />
<argument index="1" name="arg1" type="PackedByteArray" />
<description>
Sets font source data, e.g contents of the dynamic font source file.
</description>
</method>
<method name="font_set_descent">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="descent" type="float" />
<description>
Sets the font descent (number of pixels below the baseline).
</description>
</method>
<method name="font_set_fixed_size">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="fixed_size" type="int" />
<description>
Sets bitmap font fixed size. If set to value greater than zero, same cache entry will be used for all font sizes.
</description>
</method>
<method name="font_set_force_autohinter">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="force_autohinter" type="bool" />
<description>
If set to [code]true[/code] auto-hinting is preffered over font built-in hinting.
</description>
</method>
<method name="font_set_global_oversampling">
<return type="void" />
<argument index="0" name="oversampling" type="float" />
<description>
Sets oversampling factor, shared by all font in the TextServer.
Note: This value can be automaticaly changed by display server.
</description>
</method>
<method name="font_set_glyph_advance">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="glyph" type="int" />
<argument index="3" name="advance" type="Vector2" />
<description>
Sets glyph advance (offset of the next glyph). Note: advance for glyphs outlines is the same as the base glyph advance and is not saved.
</description>
</method>
<method name="font_set_glyph_offset">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="glyph" type="int" />
<argument index="3" name="offset" type="Vector2" />
<description>
Sets glyph offset from the baseline.
</description>
</method>
<method name="font_set_glyph_size">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="glyph" type="int" />
2021-08-28 03:30:32 +00:00
<argument index="3" name="gl_size" type="Vector2" />
<description>
Sets size of the glyph.
</description>
</method>
<method name="font_set_glyph_texture_idx">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="glyph" type="int" />
<argument index="3" name="texture_idx" type="int" />
<description>
Sets index of the cache texture containing the glyph.
</description>
</method>
<method name="font_set_glyph_uv_rect">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="glyph" type="int" />
<argument index="3" name="uv_rect" type="Rect2" />
<description>
Sets rectangle in the cache texture containing the glyph.
</description>
</method>
<method name="font_set_hinting">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="_hinting" type="int" enum="TextServer.Hinting" />
<description>
Sets font hinting mode. Used by dynamic fonts only.
</description>
</method>
<method name="font_set_kerning">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="glyph_pair" type="Vector2i" />
<argument index="3" name="kerning" type="Vector2" />
<description>
Sets kerning for the pair of glyphs.
</description>
</method>
<method name="font_set_language_support_override">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="language" type="String" />
<argument index="2" name="supported" type="bool" />
<description>
Adds override for [method font_is_language_supported].
</description>
</method>
<method name="font_set_msdf_pixel_range">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="msdf_pixel_range" type="int" />
<description>
Sets the width of the range around the shape between the minimum and maximum representable signed distance.
</description>
</method>
<method name="font_set_msdf_size">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="msdf_size" type="int" />
<description>
Sets source font size used to generate MSDF textures.
</description>
</method>
<method name="font_set_multichannel_signed_distance_field">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="msdf" type="bool" />
<description>
If set to [code]true[/code], glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
</description>
</method>
<method name="font_set_oversampling">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="oversampling" type="float" />
<description>
Sets font oversampling factor, if set to [code]0.0[/code] global oversampling factor is used instead. Used by dynamic fonts only.
</description>
</method>
<method name="font_set_scale">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="scale" type="float" />
<description>
Sets scaling factor of the color bitmap font.
</description>
</method>
<method name="font_set_script_support_override">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="script" type="String" />
<argument index="2" name="supported" type="bool" />
<description>
Adds override for [method font_is_script_supported].
</description>
</method>
<method name="font_set_spacing">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="spacing" type="int" enum="TextServer.SpacingType" />
<argument index="3" name="value" type="int" />
<description>
Sets extra spacing added between glyphs in pixels.
</description>
</method>
<method name="font_set_texture_image">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="texture_index" type="int" />
<argument index="3" name="image" type="Image" />
<description>
Sets font cache texture image data.
</description>
</method>
<method name="font_set_texture_offsets">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="Vector2i" />
<argument index="2" name="texture_index" type="int" />
<argument index="3" name="offset" type="PackedInt32Array" />
<description>
Sets array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty.
</description>
</method>
<method name="font_set_underline_position">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="underline_position" type="float" />
<description>
Sets pixel offset of the underline below the baseline.
</description>
</method>
<method name="font_set_underline_thickness">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="size" type="int" />
<argument index="2" name="underline_thickness" type="float" />
<description>
Sets thickness of the underline in pixels.
</description>
</method>
<method name="font_set_variation_coordinates">
<return type="void" />
<argument index="0" name="font_rid" type="RID" />
<argument index="1" name="variation_coordinates" type="Dictionary" />
<description>
Sets variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info.
</description>
</method>
<method name="font_supported_feature_list" qualifiers="const">
<return type="Dictionary" />
<argument index="0" name="font_rid" type="RID" />
<description>
</description>
</method>
<method name="font_supported_variation_list" qualifiers="const">
<return type="Dictionary" />
<argument index="0" name="font_rid" type="RID" />
<description>
</description>
</method>
<method name="format_number" qualifiers="const">
<return type="String" />
<argument index="0" name="number" type="String" />
<argument index="1" name="language" type="String" default="&quot;&quot;" />
<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" />
<argument index="0" name="rid" type="RID" />
<description>
Frees an object created by this [TextServer].
</description>
</method>
<method name="get_hex_code_box_size" qualifiers="const">
<return type="Vector2" />
<argument index="0" name="size" type="int" />
<argument index="1" name="index" type="int" />
<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" />
<description>
Returns the name of the server interface.
</description>
</method>
<method name="has">
<return type="bool" />
<argument index="0" name="rid" type="RID" />
<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" />
<argument index="0" name="feature" type="int" enum="TextServer.Feature" />
<description>
Returns [code]true[/code] if the server supports a feature.
</description>
</method>
<method name="is_locale_right_to_left">
<return type="bool" />
<argument index="0" name="locale" type="String" />
<description>
Returns [code]true[/code] if locale is right-to-left.
</description>
</method>
<method name="load_support_data">
<return type="bool" />
<argument index="0" name="filename" type="String" />
<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" qualifiers="const">
<return type="int" />
<argument index="0" name="name" type="String" />
<description>
Converts readable feature, variation, script or language name to OpenType tag.
</description>
</method>
<method name="parse_number" qualifiers="const">
<return type="String" />
<argument index="0" name="number" type="String" />
<argument index="1" name="language" type="String" default="&quot;&quot;" />
<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" />
<argument index="0" name="language" type="String" default="&quot;&quot;" />
<description>
Returns percent sign used in the [code]language[/code].
</description>
</method>
<method name="shaped_text_add_object">
<return type="bool" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="key" type="Variant" />
<argument index="2" name="size" type="Vector2" />
<argument index="3" name="inline_align" type="int" enum="InlineAlign" default="5" />
<argument index="4" name="length" type="int" default="1" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="text" type="String" />
<argument index="2" name="fonts" type="Array" />
<argument index="3" name="size" type="int" />
<argument index="4" name="opentype_features" type="Dictionary" default="{
}" />
<argument index="5" name="language" type="String" default="&quot;&quot;" />
<description>
Adds text span and font to draw it to the text buffer.
</description>
</method>
<method name="shaped_text_clear">
<return type="void" />
<argument index="0" name="rid" type="RID" />
<description>
Clears text buffer (removes text and inline objects).
</description>
</method>
<method name="shaped_text_draw" qualifiers="const">
<return type="void" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="canvas" type="RID" />
<argument index="2" name="pos" type="Vector2" />
<argument index="3" name="clip_l" type="float" default="-1" />
<argument index="4" name="clip_r" type="float" default="-1" />
<argument index="5" name="color" type="Color" default="Color(1, 1, 1, 1)" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="canvas" type="RID" />
<argument index="2" name="pos" type="Vector2" />
<argument index="3" name="clip_l" type="float" default="-1" />
<argument index="4" name="clip_r" type="float" default="-1" />
<argument index="5" name="outline_size" type="int" default="1" />
<argument index="6" name="color" type="Color" default="Color(1, 1, 1, 1)" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="width" type="float" />
<argument index="2" name="jst_flags" type="int" default="3" />
<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" />
<argument index="0" name="shaped" type="RID" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="position" type="int" />
<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" />
<argument index="0" name="shaped" type="RID" />
<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" />
<argument index="0" name="shaped" type="RID" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="start" type="int" />
<argument index="2" name="end" type="int" />
<description>
Returns dominant direction of in the range of text.
</description>
</method>
<method name="shaped_text_get_glyphs" qualifiers="const">
<return type="Array" />
<argument index="0" name="shaped" type="RID" />
<description>
Returns text glyphs.
</description>
</method>
<method name="shaped_text_get_line_breaks" qualifiers="const">
<return type="Array" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="width" type="float" />
<argument index="2" name="start" type="int" default="0" />
<argument index="3" name="break_flags" type="int" default="48" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="width" type="PackedFloat32Array" />
<argument index="2" name="start" type="int" default="0" />
<argument index="3" name="once" type="bool" default="true" />
<argument index="4" name="break_flags" type="int" default="48" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="key" type="Variant" />
<description>
Returns bounding rectangle of the inline object.
</description>
</method>
<method name="shaped_text_get_objects" qualifiers="const">
<return type="Array" />
<argument index="0" name="shaped" type="RID" />
<description>
Returns array of inline objects.
</description>
</method>
<method name="shaped_text_get_orientation" qualifiers="const">
<return type="int" enum="TextServer.Orientation" />
<argument index="0" name="shaped" type="RID" />
<description>
Returns text orientation.
</description>
</method>
<method name="shaped_text_get_parent" qualifiers="const">
<return type="RID" />
<argument index="0" name="shaped" type="RID" />
<description>
Sets text orientation.
</description>
</method>
<method name="shaped_text_get_preserve_control" qualifiers="const">
<return type="bool" />
<argument index="0" name="shaped" type="RID" />
<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" />
<argument index="0" name="shaped" type="RID" />
<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" />
<argument index="0" name="shaped" type="RID" />
<description>
Returns substring buffer character range in the parent buffer.
</description>
</method>
<method name="shaped_text_get_selection" qualifiers="const">
<return type="Array" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="start" type="int" />
<argument index="2" name="end" type="int" />
<description>
Returns selection rectangles for the specified character range.
</description>
</method>
<method name="shaped_text_get_size" qualifiers="const">
<return type="Vector2" />
<argument index="0" name="shaped" type="RID" />
<description>
Returns size of the text.
</description>
</method>
<method name="shaped_text_get_underline_position" qualifiers="const">
<return type="float" />
<argument index="0" name="shaped" type="RID" />
<description>
Returns pixel offset of the underline below the baseline.
</description>
</method>
<method name="shaped_text_get_underline_thickness" qualifiers="const">
<return type="float" />
<argument index="0" name="shaped" type="RID" />
<description>
Returns thickness of the underline.
</description>
</method>
<method name="shaped_text_get_width" qualifiers="const">
<return type="float" />
<argument index="0" name="shaped" type="RID" />
<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" />
<argument index="0" name="shaped" type="RID" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="coords" type="float" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="coords" type="float" />
<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" />
<argument index="0" name="shaped" type="RID" />
<description>
Returns [code]true[/code] if buffer is successfully shaped.
</description>
</method>
<method name="shaped_text_next_grapheme_pos">
<return type="int" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="pos" type="int" />
<description>
Returns composite character end position closest to the [code]pos[/code].
</description>
</method>
<method name="shaped_text_overrun_trim_to_width">
<return type="void" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="width" type="float" default="0" />
<argument index="2" name="overrun_trim_flags" type="int" default="0" />
<description>
Trims text if it exceeds the given width.
</description>
</method>
<method name="shaped_text_prev_grapheme_pos">
<return type="int" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="pos" type="int" />
<description>
Returns composite character start position closest to the [code]pos[/code].
</description>
</method>
<method name="shaped_text_resize_object">
<return type="bool" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="key" type="Variant" />
<argument index="2" name="size" type="Vector2" />
<argument index="3" name="inline_align" type="int" enum="InlineAlign" default="5" />
<description>
Sets new size and alignment of embedded object.
</description>
</method>
<method name="shaped_text_set_bidi_override">
<return type="void" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="override" type="Array" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="direction" type="int" enum="TextServer.Direction" default="0" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="orientation" type="int" enum="TextServer.Orientation" default="0" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="enabled" type="bool" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="enabled" type="bool" />
<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" />
<argument index="0" name="shaped" type="RID" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="start" type="int" />
<argument index="2" name="length" type="int" />
<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" />
<argument index="0" name="shaped" type="RID" />
<argument index="1" name="tab_stops" type="PackedFloat32Array" />
<description>
Aligns shaped text to the given tab-stops.
</description>
</method>
<method name="tag_to_name" qualifiers="const">
<return type="String" />
<argument index="0" name="tag" type="int" />
<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="OVERRUN_NO_TRIMMING" value="0" enum="TextOverrunFlag">
No trimming is performed.
</constant>
<constant name="OVERRUN_TRIM" value="1" enum="TextOverrunFlag">
Trims the text when it exceeds the given width.
</constant>
<constant name="OVERRUN_TRIM_WORD_ONLY" value="2" enum="TextOverrunFlag">
Trims the text per word instead of per grapheme.
</constant>
<constant name="OVERRUN_ADD_ELLIPSIS" value="4" enum="TextOverrunFlag">
Determines whether an ellipsis should be added at the end of the text.
</constant>
<constant name="OVERRUN_ENFORCE_ELLIPSIS" value="8" enum="TextOverrunFlag">
Determines whether the ellipsis at the end of the text is enforced and may not be hidden.
</constant>
<constant name="GRAPHEME_IS_RTL" value="2" enum="GraphemeFlag">
Grapheme is part of right-to-left or bottom-to-top run.
</constant>
<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="GRAPHEME_IS_PUNCTUATION" value="256" enum="GraphemeFlag">
Grapheme is punctuation character.
</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_FONT_VARIABLE" value="64" enum="Feature">
TextServer supports variable fonts.
</constant>
<constant name="FEATURE_USE_SUPPORT_DATA" value="128" enum="Feature">
TextServer require external data file for some features.
</constant>
<constant name="CONTOUR_CURVE_TAG_ON" value="1" enum="ContourPointTag">
Contour point is on the curve.
</constant>
<constant name="CONTOUR_CURVE_TAG_OFF_CONIC" value="0" enum="ContourPointTag">
Contour point isn't on the curve, but serves as a control point for a conic (quadratic) Bézier arc.
</constant>
<constant name="CONTOUR_CURVE_TAG_OFF_CUBIC" value="2" enum="ContourPointTag">
Contour point isn't on the curve, but serves as a control point for a cubic Bézier arc.
</constant>
<constant name="SPACING_GLYPH" value="0" enum="SpacingType">
Spacing for each glyph.
</constant>
<constant name="SPACING_SPACE" value="1" enum="SpacingType">
Spacing for the space character.
</constant>
<constant name="SPACING_TOP" value="2" enum="SpacingType">
Spacing at the top of the line.
</constant>
<constant name="SPACING_BOTTOM" value="3" enum="SpacingType">
Spacing at the bottom of the line.
</constant>
</constants>
</class>