TextServerExtension

Inherits: TextServer < RefCounted < Object

Base class for TextServer custom implementations (plugins).

Description

External TextServer implementations should inherit from this class.

Methods

RID

_create_font ( ) virtual

RID

_create_shaped_text ( Direction direction, Orientation orientation ) virtual

void

_draw_hex_code_box ( RID canvas, int size, Vector2 pos, int index, Color color ) virtual const

void

_font_clear_glyphs ( RID font_rid, Vector2i size ) virtual

void

_font_clear_kerning_map ( RID font_rid, int size ) virtual

void

_font_clear_size_cache ( RID font_rid ) virtual

void

_font_clear_textures ( RID font_rid, Vector2i size ) virtual

void

_font_draw_glyph ( RID font_rid, RID canvas, int size, Vector2 pos, int index, Color color ) virtual const

void

_font_draw_glyph_outline ( RID font_rid, RID canvas, int size, int outline_size, Vector2 pos, int index, Color color ) virtual const

float

_font_get_ascent ( RID font_rid, int size ) virtual const

float

_font_get_descent ( RID font_rid, int size ) virtual const

int

_font_get_fixed_size ( RID font_rid ) virtual const

float

_font_get_global_oversampling ( ) virtual const

Vector2

_font_get_glyph_advance ( RID font_rid, int size, int glyph ) virtual const

Dictionary

_font_get_glyph_contours ( RID font_rid, int size, int index ) virtual const

int

_font_get_glyph_index ( RID font_rid, int size, int char, int variation_selector ) virtual const

Array

_font_get_glyph_list ( RID font_rid, Vector2i size ) virtual const

Vector2

_font_get_glyph_offset ( RID font_rid, Vector2i size, int glyph ) virtual const

Vector2

_font_get_glyph_size ( RID font_rid, Vector2i size, int glyph ) virtual const

int

_font_get_glyph_texture_idx ( RID font_rid, Vector2i size, int glyph ) virtual const

Rect2

_font_get_glyph_uv_rect ( RID font_rid, Vector2i size, int glyph ) virtual const

int

_font_get_hinting ( RID font_rid ) virtual const

Vector2

_font_get_kerning ( RID font_rid, int size, Vector2i glyph_pair ) virtual const

Array

_font_get_kerning_list ( RID font_rid, int size ) virtual const

bool

_font_get_language_support_override ( RID font_rid, String language ) virtual

PackedStringArray

_font_get_language_support_overrides ( RID font_rid ) virtual

int

_font_get_msdf_pixel_range ( RID font_rid ) virtual const

int

_font_get_msdf_size ( RID font_rid ) virtual const

String

_font_get_name ( RID font_rid ) virtual const

float

_font_get_oversampling ( RID font_rid ) virtual const

float

_font_get_scale ( RID font_rid, int size ) virtual const

bool

_font_get_script_support_override ( RID font_rid, String script ) virtual

PackedStringArray

_font_get_script_support_overrides ( RID font_rid ) virtual

Array

_font_get_size_cache_list ( RID font_rid ) virtual const

int

_font_get_spacing ( RID font_rid, int size, SpacingType spacing ) virtual const

int

_font_get_style ( RID font_rid ) virtual const

String

_font_get_style_name ( RID font_rid ) virtual const

String

_font_get_supported_chars ( RID font_rid ) virtual const

int

_font_get_texture_count ( RID font_rid, Vector2i size ) virtual const

Image

_font_get_texture_image ( RID font_rid, Vector2i size, int texture_index ) virtual const

PackedInt32Array

_font_get_texture_offsets ( RID font_rid, Vector2i size, int texture_index ) virtual const

float

_font_get_underline_position ( RID font_rid, int size ) virtual const

float

_font_get_underline_thickness ( RID font_rid, int size ) virtual const

Dictionary

_font_get_variation_coordinates ( RID font_rid ) virtual const

bool

_font_has_char ( RID font_rid, int char ) virtual const

bool

_font_is_antialiased ( RID font_rid ) virtual const

bool

_font_is_force_autohinter ( RID font_rid ) virtual const

bool

_font_is_language_supported ( RID font_rid, String language ) virtual const

bool

_font_is_multichannel_signed_distance_field ( RID font_rid ) virtual const

bool

_font_is_script_supported ( RID font_rid, String script ) virtual const

void

_font_remove_glyph ( RID font_rid, Vector2i size, int glyph ) virtual

void

_font_remove_kerning ( RID font_rid, int size, Vector2i glyph_pair ) virtual

void

_font_remove_language_support_override ( RID font_rid, String language ) virtual

void

_font_remove_script_support_override ( RID font_rid, String script ) virtual

void

_font_remove_size_cache ( RID font_rid, Vector2i size ) virtual

void

_font_remove_texture ( RID font_rid, Vector2i size, int texture_index ) virtual

void

_font_render_glyph ( RID font_rid, Vector2i size, int index ) virtual

void

_font_render_range ( RID font_rid, Vector2i size, int start, int end ) virtual

void

_font_set_antialiased ( RID font_rid, bool antialiased ) virtual

void

_font_set_ascent ( RID font_rid, int size, float ascent ) virtual

void

_font_set_data ( RID font_rid, PackedByteArray data ) virtual

void

_font_set_data_ptr ( RID font_rid, const uint8_t* data_ptr, int data_size ) virtual

void

_font_set_descent ( RID font_rid, int size, float descent ) virtual

void

_font_set_fixed_size ( RID font_rid, int fixed_size ) virtual

void

_font_set_force_autohinter ( RID font_rid, bool force_autohinter ) virtual

void

_font_set_global_oversampling ( float oversampling ) virtual

void

_font_set_glyph_advance ( RID font_rid, int size, int glyph, Vector2 advance ) virtual

void

_font_set_glyph_offset ( RID font_rid, Vector2i size, int glyph, Vector2 offset ) virtual

void

_font_set_glyph_size ( RID font_rid, Vector2i size, int glyph, Vector2 gl_size ) virtual

void

_font_set_glyph_texture_idx ( RID font_rid, Vector2i size, int glyph, int texture_idx ) virtual

void

_font_set_glyph_uv_rect ( RID font_rid, Vector2i size, int glyph, Rect2 uv_rect ) virtual

void

_font_set_hinting ( RID font_rid, Hinting hinting ) virtual

void

_font_set_kerning ( RID font_rid, int size, Vector2i glyph_pair, Vector2 kerning ) virtual

void

_font_set_language_support_override ( RID font_rid, String language, bool supported ) virtual

void

_font_set_msdf_pixel_range ( RID font_rid, int msdf_pixel_range ) virtual

void

_font_set_msdf_size ( RID font_rid, int msdf_size ) virtual

void

_font_set_multichannel_signed_distance_field ( RID font_rid, bool msdf ) virtual

void

_font_set_name ( RID font_rid, String name ) virtual

void

_font_set_oversampling ( RID font_rid, float oversampling ) virtual

void

_font_set_scale ( RID font_rid, int size, float scale ) virtual

void

_font_set_script_support_override ( RID font_rid, String script, bool supported ) virtual

void

_font_set_spacing ( RID font_rid, int size, SpacingType spacing, int value ) virtual

void

_font_set_style ( RID font_rid, int style ) virtual

void

_font_set_style_name ( RID font_rid, String name_style ) virtual

void

_font_set_texture_image ( RID font_rid, Vector2i size, int texture_index, Image image ) virtual

void

_font_set_texture_offsets ( RID font_rid, Vector2i size, int texture_index, PackedInt32Array offset ) virtual

void

_font_set_underline_position ( RID font_rid, int size, float underline_position ) virtual

void

_font_set_underline_thickness ( RID font_rid, int size, float underline_thickness ) virtual

void

_font_set_variation_coordinates ( RID font_rid, Dictionary variation_coordinates ) virtual

Dictionary

_font_supported_feature_list ( RID font_rid ) virtual const

Dictionary

_font_supported_variation_list ( RID font_rid ) virtual const

String

_format_number ( String string, String language ) virtual const

void

_free ( RID rid ) virtual

int

_get_features ( ) virtual const

Vector2

_get_hex_code_box_size ( int size, int index ) virtual const

String

_get_name ( ) virtual const

String

_get_support_data_filename ( ) virtual const

String

_get_support_data_info ( ) virtual const

bool

_has ( RID rid ) virtual

bool

_has_feature ( Feature feature ) virtual const

bool

_is_locale_right_to_left ( String locale ) virtual const

bool

_load_support_data ( String filename ) virtual

int

_name_to_tag ( String name ) virtual const

String

_parse_number ( String string, String language ) virtual const

String

_percent_sign ( String language ) virtual const

bool

_save_support_data ( String filename ) virtual const

bool

_shaped_text_add_object ( RID shaped, Variant key, Vector2 size, InlineAlign inline_align, int length ) virtual

bool

_shaped_text_add_string ( RID shaped, String text, Array fonts, int size, Dictionary opentype_features, String language ) virtual

void

_shaped_text_clear ( RID shaped ) virtual

void

_shaped_text_draw ( RID shaped, RID canvas, Vector2 pos, float clip_l, float clip_r, Color color ) virtual const

void

_shaped_text_draw_outline ( RID shaped, RID canvas, Vector2 pos, float clip_l, float clip_r, int outline_size, Color color ) virtual const

float

_shaped_text_fit_to_width ( RID shaped, float width, int jst_flags ) virtual

float

_shaped_text_get_ascent ( RID shaped ) virtual const

void

_shaped_text_get_carets ( RID shaped, int position, CaretInfo* caret ) virtual const

String

_shaped_text_get_custom_punctuation ( RID shaped ) virtual const

float

_shaped_text_get_descent ( RID shaped ) virtual const

int

_shaped_text_get_direction ( RID shaped ) virtual const

int

_shaped_text_get_dominant_direction_in_range ( RID shaped, int start, int end ) virtual const

int

_shaped_text_get_ellipsis_glyph_count ( RID shaped ) virtual const

void

_shaped_text_get_ellipsis_glyphs ( RID shaped, void* r_glyphs ) virtual const

int

_shaped_text_get_ellipsis_pos ( RID shaped ) virtual const

int

_shaped_text_get_glyph_count ( RID shaped ) virtual const

void

_shaped_text_get_glyphs ( RID shaped, void* r_glyphs ) virtual const

PackedInt32Array

_shaped_text_get_line_breaks ( RID shaped, float width, int start, int break_flags ) virtual const

PackedInt32Array

_shaped_text_get_line_breaks_adv ( RID shaped, PackedFloat32Array width, int start, bool once, int break_flags ) virtual const

Rect2

_shaped_text_get_object_rect ( RID shaped, Variant key ) virtual const

Array

_shaped_text_get_objects ( RID shaped ) virtual const

int

_shaped_text_get_orientation ( RID shaped ) virtual const

RID

_shaped_text_get_parent ( RID shaped ) virtual const

bool

_shaped_text_get_preserve_control ( RID shaped ) virtual const

bool

_shaped_text_get_preserve_invalid ( RID shaped ) virtual const

Vector2i

_shaped_text_get_range ( RID shaped ) virtual const

PackedVector2Array

_shaped_text_get_selection ( RID shaped, int start, int end ) virtual const

Vector2

_shaped_text_get_size ( RID shaped ) virtual const

int

_shaped_text_get_trim_pos ( RID shaped ) virtual const

float

_shaped_text_get_underline_position ( RID shaped ) virtual const

float

_shaped_text_get_underline_thickness ( RID shaped ) virtual const

float

_shaped_text_get_width ( RID shaped ) virtual const

PackedInt32Array

_shaped_text_get_word_breaks ( RID shaped, int grapheme_flags ) virtual const

int

_shaped_text_hit_test_grapheme ( RID shaped, float coord ) virtual const

int

_shaped_text_hit_test_position ( RID shaped, float coord ) virtual const

bool

_shaped_text_is_ready ( RID shaped ) virtual const

int

_shaped_text_next_grapheme_pos ( RID shaped, int pos ) virtual const

void

_shaped_text_overrun_trim_to_width ( RID shaped, float width, int trim_flags ) virtual

int

_shaped_text_prev_grapheme_pos ( RID shaped, int pos ) virtual const

bool

_shaped_text_resize_object ( RID shaped, Variant key, Vector2 size, InlineAlign inline_align ) virtual

void

_shaped_text_set_bidi_override ( RID shaped, Array override ) virtual

void

_shaped_text_set_custom_punctuation ( RID shaped, String punct ) virtual

void

_shaped_text_set_direction ( RID shaped, Direction direction ) virtual

void

_shaped_text_set_orientation ( RID shaped, Orientation orientation ) virtual

void

_shaped_text_set_preserve_control ( RID shaped, bool enabled ) virtual

void

_shaped_text_set_preserve_invalid ( RID shaped, bool enabled ) virtual

bool

_shaped_text_shape ( RID shaped ) virtual

void

_shaped_text_sort_logical ( RID shaped, void* r_glyphs ) virtual

RID

_shaped_text_substr ( RID shaped, int start, int length ) virtual const

float

_shaped_text_tab_align ( RID shaped, PackedFloat32Array tab_stops ) virtual

bool

_shaped_text_update_breaks ( RID shaped ) virtual

bool

_shaped_text_update_justification_ops ( RID shaped ) virtual

String

_tag_to_name ( int tag ) virtual const

Method Descriptions

  • RID _create_font ( ) virtual

Creates new, empty font cache entry resource. To free the resulting resourec, use _free method.


Creates new buffer for complex text layout, with the given direction and orientation. To free the resulting buffer, use _free method.

Note: Direction is ignored if server does not support FEATURE_BIDI_LAYOUT feature.

Note: Orientation is ignored if server does not support FEATURE_VERTICAL_LAYOUT feature.


Draws box displaying character hexadecimal code. Used for replacing missing characters.


  • void _font_clear_glyphs ( RID font_rid, Vector2i size ) virtual

Removes all rendered glyphs information from the cache entry.

Note: This function will not remove textures associated with the glyphs, use _font_remove_texture to remove them manually.


  • void _font_clear_kerning_map ( RID font_rid, int size ) virtual

Removes all kerning overrides.


  • void _font_clear_size_cache ( RID font_rid ) virtual

Removes all font sizes from the cache entry


  • void _font_clear_textures ( RID font_rid, Vector2i size ) virtual

Removes all textures from font cache entry.

Note: This function will not remove glyphs associated with the texture, use _font_remove_glyph to remove them manually.


Draws single glyph into a canvas item at the position, using font_rid at the size size.

Note: Glyph index is specific to the font, use glyphs indices returned by _shaped_text_get_glyphs or _font_get_glyph_index.


  • void _font_draw_glyph_outline ( RID font_rid, RID canvas, int size, int outline_size, Vector2 pos, int index, Color color ) virtual const

Draws single glyph outline of size outline_size into a canvas item at the position, using font_rid at the size size.

Note: Glyph index is specific to the font, use glyphs indices returned by _shaped_text_get_glyphs or _font_get_glyph_index.


  • float _font_get_ascent ( RID font_rid, int size ) virtual const

Returns the font ascent (number of pixels above the baseline).


  • float _font_get_descent ( RID font_rid, int size ) virtual const

Returns the font descent (number of pixels below the baseline).


  • int _font_get_fixed_size ( RID font_rid ) virtual const

Returns bitmap font fixed size.


  • float _font_get_global_oversampling ( ) virtual const

Returns the font oversampling factor, shared by all fonts in the TextServer.


  • Vector2 _font_get_glyph_advance ( RID font_rid, int size, int glyph ) virtual const

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.


Returns outline contours of the glyph as a Dictionary with the following contents:

points - PackedVector3Array, containing outline points. x and y are point coordinates. z is the type of the point, using the ContourPointTag values.

contours - PackedInt32Array, containing indices the end points of each contour.

orientation - bool, contour orientation. If true, clockwise contours must be filled.


  • int _font_get_glyph_index ( RID font_rid, int size, int char, int variation_selector ) virtual const

Returns the glyph index of a char, optionally modified by the variation_selector.


Returns list of rendered glyphs in the cache entry.


Returns glyph offset from the baseline.


Returns size of the glyph.


  • int _font_get_glyph_texture_idx ( RID font_rid, Vector2i size, int glyph ) virtual const

Returns index of the cache texture containing the glyph.


Returns rectangle in the cache texture containing the glyph.


  • int _font_get_hinting ( RID font_rid ) virtual const

Returns the font hinting mode. Used by dynamic fonts only.


Returns kerning for the pair of glyphs.


  • Array _font_get_kerning_list ( RID font_rid, int size ) virtual const

Returns list of the kerning overrides.


  • bool _font_get_language_support_override ( RID font_rid, String language ) virtual

Returns true if support override is enabled for the language.


Returns list of language support overrides.


  • int _font_get_msdf_pixel_range ( RID font_rid ) virtual const

Return the width of the range around the shape between the minimum and maximum representable signed distance.


  • int _font_get_msdf_size ( RID font_rid ) virtual const

Returns source font size used to generate MSDF textures.


  • String _font_get_name ( RID font_rid ) virtual const

Returns font family name.


  • float _font_get_oversampling ( RID font_rid ) virtual const

Returns font oversampling factor, if set to 0.0 global oversampling factor is used instead. Used by dynamic fonts only.


  • float _font_get_scale ( RID font_rid, int size ) virtual const

Returns scaling factor of the color bitmap font.


  • bool _font_get_script_support_override ( RID font_rid, String script ) virtual

Returns true if support override is enabled for the script.


Returns list of script support overrides.


  • Array _font_get_size_cache_list ( RID font_rid ) virtual const

Return list of the font sizes in the cache. Each size is Vector2i with font size and outline size.


Returns extra spacing added between glyphs in pixels.


  • int _font_get_style ( RID font_rid ) virtual const

Returns font style flags, see FontStyle.


  • String _font_get_style_name ( RID font_rid ) virtual const

Returns font style name.


  • String _font_get_supported_chars ( RID font_rid ) virtual const

Returns a string containing all the characters available in the font.


  • int _font_get_texture_count ( RID font_rid, Vector2i size ) virtual const

Returns number of textures used by font cache entry.


  • Image _font_get_texture_image ( RID font_rid, Vector2i size, int texture_index ) virtual const

Returns font cache texture image data.


Returns array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty.


  • float _font_get_underline_position ( RID font_rid, int size ) virtual const

Returns pixel offset of the underline below the baseline.


  • float _font_get_underline_thickness ( RID font_rid, int size ) virtual const

Returns thickness of the underline in pixels.


  • Dictionary _font_get_variation_coordinates ( RID font_rid ) virtual const

Returns variation coordinates for the specified font cache entry. See _font_supported_variation_list for more info.


  • bool _font_has_char ( RID font_rid, int char ) virtual const

Return true if a Unicode char is available in the font.


  • bool _font_is_antialiased ( RID font_rid ) virtual const

Returns true if font 8-bit anitialiased glyph rendering is supported and enabled.


  • bool _font_is_force_autohinter ( RID font_rid ) virtual const

Returns true if auto-hinting is supported and preffered over font built-in hinting. Used by dynamic fonts only.


  • bool _font_is_language_supported ( RID font_rid, String language ) virtual const

Returns true, if font supports given language (ISO 639 code).


  • bool _font_is_multichannel_signed_distance_field ( RID font_rid ) virtual const

Returns true if glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.


  • bool _font_is_script_supported ( RID font_rid, String script ) virtual const

Returns true, if font supports given script (ISO 15924 code).


  • void _font_remove_glyph ( RID font_rid, Vector2i size, int glyph ) virtual

Removes specified rendered glyph information from the cache entry.

Note: This function will not remove textures associated with the glyphs, use _font_remove_texture to remove them manually.


  • void _font_remove_kerning ( RID font_rid, int size, Vector2i glyph_pair ) virtual

Removes kerning override for the pair of glyphs.


  • void _font_remove_language_support_override ( RID font_rid, String language ) virtual

Remove language support override.


  • void _font_remove_script_support_override ( RID font_rid, String script ) virtual

Removes script support override.


  • void _font_remove_size_cache ( RID font_rid, Vector2i size ) virtual

Removes specified font size from the cache entry.


  • void _font_remove_texture ( RID font_rid, Vector2i size, int texture_index ) virtual

Removes specified texture from font cache entry.

Note: This function will not remove glyphs associated with the texture, remove them manually, using _font_remove_glyph.


  • void _font_render_glyph ( RID font_rid, Vector2i size, int index ) virtual

Renders specified glyph the the font cache texture.


  • void _font_render_range ( RID font_rid, Vector2i size, int start, int end ) virtual

Renders the range of characters to the font cache texture.


  • void _font_set_antialiased ( RID font_rid, bool antialiased ) virtual

If set to true, 8-bit antialiased glyph rendering is used, otherwise 1-bit rendering is used. Used by dynamic fonts only.


  • void _font_set_ascent ( RID font_rid, int size, float ascent ) virtual

Sets the font ascent (number of pixels above the baseline).


Sets font source data, e.g contents of the dynamic font source file.


  • void _font_set_data_ptr ( RID font_rid, const uint8_t* data_ptr, int data_size ) virtual

Sets the font descent (number of pixels below the baseline).


  • void _font_set_descent ( RID font_rid, int size, float descent ) virtual

Sets bitmap font fixed size. If set to value greater than zero, same cache entry will be used for all font sizes.


  • void _font_set_fixed_size ( RID font_rid, int fixed_size ) virtual

If set to true auto-hinting is preffered over font built-in hinting.


  • void _font_set_force_autohinter ( RID font_rid, bool force_autohinter ) virtual


  • void _font_set_global_oversampling ( float oversampling ) virtual

Sets oversampling factor, shared by all font in the TextServer.

Note: This value can be automaticaly changed by display server.


  • void _font_set_glyph_advance ( RID font_rid, int size, int glyph, Vector2 advance ) virtual

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.


Sets glyph offset from the baseline.


Sets size of the glyph.


  • void _font_set_glyph_texture_idx ( RID font_rid, Vector2i size, int glyph, int texture_idx ) virtual

Sets index of the cache texture containing the glyph.


  • void _font_set_glyph_uv_rect ( RID font_rid, Vector2i size, int glyph, Rect2 uv_rect ) virtual

Sets rectangle in the cache texture containing the glyph.


  • void _font_set_hinting ( RID font_rid, Hinting hinting ) virtual

Sets font hinting mode. Used by dynamic fonts only.


Sets kerning for the pair of glyphs.


  • void _font_set_language_support_override ( RID font_rid, String language, bool supported ) virtual

Adds override for _font_is_language_supported.


  • void _font_set_msdf_pixel_range ( RID font_rid, int msdf_pixel_range ) virtual

Sets the width of the range around the shape between the minimum and maximum representable signed distance.


  • void _font_set_msdf_size ( RID font_rid, int msdf_size ) virtual

Sets source font size used to generate MSDF textures.


  • void _font_set_multichannel_signed_distance_field ( RID font_rid, bool msdf ) virtual

If set to true, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.


  • void _font_set_name ( RID font_rid, String name ) virtual

Sets the font family name.


  • void _font_set_oversampling ( RID font_rid,