Skip to content
Download
API reference

TextShapingExtension

Inherits: TextShaping < Shared < Object

Inherited by: TextShapingDriverDummy, TextShapingDriverFallback

Base class for custom TextShaping implementations (plugins).

External TextShaping implementations should inherit from this class.

ReturnsMethod
void_cleanup()
RID_create_font()
RID_create_font_linked_variation(font_rid)
RID_create_shaped_text(direction, orientation)
void_draw_hex_code_box(canvas, size, pos, index, color)
void_font_clear_glyphs(font_rid, size)
void_font_clear_kerning_map(font_rid, size)
void_font_clear_size_cache(font_rid)
void_font_clear_system_fallback_cache()
void_font_clear_textures(font_rid, size)
void_font_draw_glyph(font_rid, canvas, size, pos, index, color, oversampling)
void_font_draw_glyph_outline(font_rid, canvas, size, outline_size, pos, index, color, oversampling)
TextShaping.FontAntialiasing_font_get_antialiasing(font_rid)
float_font_get_ascent(font_rid, size)
float_font_get_baseline_offset(font_rid)
int_font_get_char_from_glyph_index(font_rid, size, glyph_index)
float_font_get_descent(font_rid, size)
bool_font_get_disable_embedded_bitmaps(font_rid)
float_font_get_embolden(font_rid)
int_font_get_face_count(font_rid)
int_font_get_face_index(font_rid)
int_font_get_fixed_size(font_rid)
TextShaping.FixedSizeScaleMode_font_get_fixed_size_scale_mode(font_rid)
bool_font_get_generate_mipmaps(font_rid)
Vector2_font_get_glyph_advance(font_rid, size, glyph)
Dictionary_font_get_glyph_contours(font_rid, size, index)
int_font_get_glyph_index(font_rid, size, char, variation_selector)
[]i32_font_get_glyph_list(font_rid, size)
Vector2_font_get_glyph_offset(font_rid, size, glyph)
Vector2_font_get_glyph_size(font_rid, size, glyph)
int_font_get_glyph_texture_idx(font_rid, size, glyph)
RID_font_get_glyph_texture_rid(font_rid, size, glyph)
Vector2_font_get_glyph_texture_size(font_rid, size, glyph)
Rect2_font_get_glyph_uv_rect(font_rid, size, glyph)
TextShaping.Hinting_font_get_hinting(font_rid)
bool_font_get_keep_rounding_remainders(font_rid)
Vector2_font_get_kerning(font_rid, size, glyph_pair)
[]Vector2i_font_get_kerning_list(font_rid, size)
bool_font_get_language_support_override(font_rid, language)
[]String_font_get_language_support_overrides(font_rid)
int_font_get_msdf_pixel_range(font_rid)
int_font_get_msdf_size(font_rid)
String_font_get_name(font_rid)
Dictionary_font_get_opentype_feature_overrides(font_rid)
Dictionary_font_get_ot_name_strings(font_rid)
[]Color_font_get_palette_colors(font_rid, index)
int_font_get_palette_count(font_rid)
[]Color_font_get_palette_custom_colors(font_rid)
String_font_get_palette_name(font_rid, index)
float_font_get_scale(font_rid, size)
bool_font_get_script_support_override(font_rid, script)
[]String_font_get_script_support_overrides(font_rid)
[]Dictionary_font_get_size_cache_info(font_rid)
[]Vector2i_font_get_size_cache_list(font_rid)
int_font_get_spacing(font_rid, spacing)
int_font_get_stretch(font_rid)
TextShaping.FontStyle_font_get_style(font_rid)
String_font_get_style_name(font_rid)
TextShaping.SubpixelPositioning_font_get_subpixel_positioning(font_rid)
String_font_get_supported_chars(font_rid)
[]i32_font_get_supported_glyphs(font_rid)
int_font_get_texture_count(font_rid, size)
Image_font_get_texture_image(font_rid, size, texture_index)
[]i32_font_get_texture_offsets(font_rid, size, texture_index)
Transform2D_font_get_transform(font_rid)
float_font_get_underline_position(font_rid, size)
float_font_get_underline_thickness(font_rid, size)
int_font_get_used_palette(font_rid)
Dictionary_font_get_variation_coordinates(font_rid)
int_font_get_weight(font_rid)
bool_font_has_char(font_rid, char)
bool_font_is_allow_system_fallback(font_rid)
bool_font_is_force_autohinter(font_rid)
bool_font_is_language_supported(font_rid, language)
bool_font_is_modulate_color_glyphs(font_rid)
bool_font_is_multichannel_signed_distance_field(font_rid)
bool_font_is_script_supported(font_rid, script)
void_font_remove_glyph(font_rid, size, glyph)
void_font_remove_kerning(font_rid, size, glyph_pair)
void_font_remove_language_support_override(font_rid, language)
void_font_remove_script_support_override(font_rid, script)
void_font_remove_size_cache(font_rid, size)
void_font_remove_texture(font_rid, size, texture_index)
void_font_render_glyph(font_rid, size, index)
void_font_render_range(font_rid, size, start, end)
void_font_set_allow_system_fallback(font_rid, allow_system_fallback)
void_font_set_antialiasing(font_rid, antialiasing)
void_font_set_ascent(font_rid, size, ascent)
void_font_set_baseline_offset(font_rid, baseline_offset)
void_font_set_data(font_rid, data)
void_font_set_data_ptr(font_rid, data_ptr, data_size)
void_font_set_descent(font_rid, size, descent)
void_font_set_disable_embedded_bitmaps(font_rid, disable_embedded_bitmaps)
void_font_set_embolden(font_rid, strength)
void_font_set_face_index(font_rid, face_index)
void_font_set_fixed_size(font_rid, fixed_size)
void_font_set_fixed_size_scale_mode(font_rid, fixed_size_scale_mode)
void_font_set_force_autohinter(font_rid, force_autohinter)
void_font_set_generate_mipmaps(font_rid, generate_mipmaps)
void_font_set_glyph_advance(font_rid, size, glyph, advance)
void_font_set_glyph_offset(font_rid, size, glyph, offset)
void_font_set_glyph_size(font_rid, size, glyph, gl_size)
void_font_set_glyph_texture_idx(font_rid, size, glyph, texture_idx)
void_font_set_glyph_uv_rect(font_rid, size, glyph, uv_rect)
void_font_set_hinting(font_rid, hinting)
void_font_set_keep_rounding_remainders(font_rid, keep_rounding_remainders)
void_font_set_kerning(font_rid, size, glyph_pair, kerning)
void_font_set_language_support_override(font_rid, language, supported)
void_font_set_modulate_color_glyphs(font_rid, modulate)
void_font_set_msdf_pixel_range(font_rid, msdf_pixel_range)
void_font_set_msdf_size(font_rid, msdf_size)
void_font_set_multichannel_signed_distance_field(font_rid, msdf)
void_font_set_name(font_rid, name)
void_font_set_opentype_feature_overrides(font_rid, overrides)
void_font_set_palette_custom_colors(font_rid, colors)
void_font_set_scale(font_rid, size, scale)
void_font_set_script_support_override(font_rid, script, supported)
void_font_set_spacing(font_rid, spacing, value)
void_font_set_stretch(font_rid, stretch)
void_font_set_style(font_rid, style)
void_font_set_style_name(font_rid, name_style)
void_font_set_subpixel_positioning(font_rid, subpixel_positioning)
void_font_set_texture_image(font_rid, size, texture_index, image)
void_font_set_texture_offsets(font_rid, size, texture_index, offset)
void_font_set_transform(font_rid, transform)
void_font_set_underline_position(font_rid, size, underline_position)
void_font_set_underline_thickness(font_rid, size, underline_thickness)
void_font_set_used_palette(font_rid, index)
void_font_set_variation_coordinates(font_rid, variation_coordinates)
void_font_set_weight(font_rid, weight)
Dictionary_font_supported_feature_list(font_rid)
Dictionary_font_supported_variation_list(font_rid)
void_free_rid(rid)
int_get_features()
Vector2_get_hex_code_box_size(size, index)
String_get_name()
[]u8_get_support_data()
String_get_support_data_filename()
String_get_support_data_info()
bool_has(rid)
bool_has_feature(feature)
int_is_confusable(string, dict)
bool_is_locale_right_to_left(locale)
bool_is_locale_using_support_data(locale)
bool_is_valid_identifier(string)
bool_is_valid_letter(unicode)
bool_load_support_data(filename)
int_name_to_tag(name)
[]Vector3i_parse_structured_text(parser_type, args, text)
void_reference_oversampling_level(oversampling)
bool_save_support_data(filename)
int_shaped_get_run_count(shaped)
TextShaping.Direction_shaped_get_run_direction(shaped, index)
RID_shaped_get_run_font_rid(shaped, index)
int_shaped_get_run_font_size(shaped, index)
Vector2i_shaped_get_run_glyph_range(shaped, index)
String_shaped_get_run_language(shaped, index)
Variant_shaped_get_run_object(shaped, index)
Vector2i_shaped_get_run_range(shaped, index)
String_shaped_get_run_text(shaped, index)
int_shaped_get_span_count(shaped)
Variant_shaped_get_span_embedded_object(shaped, index)
Variant_shaped_get_span_meta(shaped, index)
Variant_shaped_get_span_object(shaped, index)
String_shaped_get_span_text(shaped, index)
String_shaped_get_text(shaped)
void_shaped_set_span_update_font(shaped, index, fonts, size, opentype_features)
bool_shaped_text_add_object(shaped, key, size, inline_align, length, baseline)
bool_shaped_text_add_string(shaped, text, fonts, size, opentype_features, language, meta)
void_shaped_text_clear(shaped)
int_shaped_text_closest_character_pos(shaped, pos)
void_shaped_text_draw(shaped, canvas, pos, clip_l, clip_r, color, oversampling)
void_shaped_text_draw_outline(shaped, canvas, pos, clip_l, clip_r, outline_size, color, oversampling)
RID_shaped_text_duplicate(shaped)
float_shaped_text_fit_to_width(shaped, width, justification_flags)
float_shaped_text_get_ascent(shaped)
void_shaped_text_get_carets(shaped, position, r_caret)
[]i32_shaped_text_get_character_breaks(shaped)
int_shaped_text_get_custom_ellipsis(shaped)
String_shaped_text_get_custom_punctuation(shaped)
float_shaped_text_get_descent(shaped)
TextShaping.Direction_shaped_text_get_direction(shaped)
int_shaped_text_get_dominant_direction_in_range(shaped, start, end)
int_shaped_text_get_ellipsis_glyph_count(shaped)
const Glyph*_shaped_text_get_ellipsis_glyphs(shaped)
int_shaped_text_get_ellipsis_pos(shaped)
int_shaped_text_get_glyph_count(shaped)
const Glyph*_shaped_text_get_glyphs(shaped)
Vector2_shaped_text_get_grapheme_bounds(shaped, pos)
TextShaping.Direction_shaped_text_get_inferred_direction(shaped)
[]i32_shaped_text_get_line_breaks(shaped, width, start, break_flags)
[]i32_shaped_text_get_line_breaks_adv(shaped, width, start, once, break_flags)
int_shaped_text_get_object_glyph(shaped, key)
Vector2i_shaped_text_get_object_range(shaped, key)
Rect2_shaped_text_get_object_rect(shaped, key)
Array_shaped_text_get_objects(shaped)
TextShaping.Orientation_shaped_text_get_orientation(shaped)
RID_shaped_text_get_parent(shaped)
bool_shaped_text_get_preserve_control(shaped)
bool_shaped_text_get_preserve_invalid(shaped)
Vector2i_shaped_text_get_range(shaped)
[]Vector2_shaped_text_get_selection(shaped, start, end)
Vector2_shaped_text_get_size(shaped)
int_shaped_text_get_spacing(shaped, spacing)
int_shaped_text_get_trim_pos(shaped)
float_shaped_text_get_underline_position(shaped)
float_shaped_text_get_underline_thickness(shaped)
float_shaped_text_get_width(shaped)
[]i32_shaped_text_get_word_breaks(shaped, grapheme_flags, skip_grapheme_flags)
bool_shaped_text_has_object(shaped, key)
int_shaped_text_hit_test_grapheme(shaped, coord)
int_shaped_text_hit_test_position(shaped, coord)
bool_shaped_text_is_ready(shaped)
int_shaped_text_next_character_pos(shaped, pos)
int_shaped_text_next_grapheme_pos(shaped, pos)
void_shaped_text_overrun_trim_to_width(shaped, width, trim_flags)
int_shaped_text_prev_character_pos(shaped, pos)
int_shaped_text_prev_grapheme_pos(shaped, pos)
bool_shaped_text_resize_object(shaped, key, size, inline_align, baseline)
void_shaped_text_set_bidi_override(shaped, override)
void_shaped_text_set_custom_ellipsis(shaped, char)
void_shaped_text_set_custom_punctuation(shaped, punct)
void_shaped_text_set_direction(shaped, direction)
void_shaped_text_set_orientation(shaped, orientation)
void_shaped_text_set_preserve_control(shaped, enabled)
void_shaped_text_set_preserve_invalid(shaped, enabled)
void_shaped_text_set_spacing(shaped, spacing, value)
bool_shaped_text_shape(shaped)
const Glyph*_shaped_text_sort_logical(shaped)
RID_shaped_text_substr(shaped, start, length)
float_shaped_text_tab_align(shaped, tab_stops)
bool_shaped_text_update_breaks(shaped)
bool_shaped_text_update_justification_ops(shaped)
bool_spoof_check(string)
[]i32_string_get_character_breaks(string, language)
[]i32_string_get_word_breaks(string, language, chars_per_line)
String_string_to_lower(string, language)
String_string_to_title(string, language)
String_string_to_upper(string, language)
String_strip_diacritics(string)
String_tag_to_name(tag)
void_unreference_oversampling_level(oversampling)

void _cleanup() virtual

This method is called before text server is unregistered.

RID _create_font() virtual required

Creates a new, empty font cache entry resource.

RID _create_font_linked_variation(font_rid: RID) virtual

Optional, implement if font supports extra spacing or baseline offset.

Creates a new variation existing font which is reusing the same glyph cache and font data.

RID _create_shaped_text(direction: TextShaping.Direction, orientation: TextShaping.Orientation) virtual required

Creates a new buffer for complex text layout, with the given direction and orientation.

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

Draws box displaying character hexadecimal code.

void _font_clear_glyphs(font_rid: RID, size: Vector2i) virtual required

Removes all rendered glyph information from the cache entry.

void _font_clear_kerning_map(font_rid: RID, size: int) virtual

Removes all kerning overrides.

void _font_clear_size_cache(font_rid: RID) virtual required

Removes all font sizes from the cache entry.

void _font_clear_system_fallback_cache() virtual

Frees all automatically loaded system fonts.

void _font_clear_textures(font_rid: RID, size: Vector2i) virtual required

Removes all textures from font cache entry.

void _font_draw_glyph(font_rid: RID, canvas: RID, size: int, pos: Vector2, index: int, color: Color, oversampling: float) virtual required const

Draws single glyph into a canvas item at the position, using font_rid at the size size. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

void _font_draw_glyph_outline(font_rid: RID, canvas: RID, size: int, outline_size: int, pos: Vector2, index: int, color: Color, oversampling: float) virtual required const

Draws single glyph outline of size outline_size into a canvas item at the position, using font_rid at the size size. If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

TextShaping.FontAntialiasing _font_get_antialiasing(font_rid: RID) virtual const

Returns font anti-aliasing mode.

float _font_get_ascent(font_rid: RID, size: int) virtual required const

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

float _font_get_baseline_offset(font_rid: RID) virtual const

Returns extra baseline offset (as a fraction of font height).

int _font_get_char_from_glyph_index(font_rid: RID, size: int, glyph_index: int) virtual required const

Returns character code associated with glyph_index, or 0 if glyph_index is invalid.

float _font_get_descent(font_rid: RID, size: int) virtual required const

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

bool _font_get_disable_embedded_bitmaps(font_rid: RID) virtual const

Returns whether the font’s embedded bitmap loading is disabled.

float _font_get_embolden(font_rid: RID) virtual const

Returns font embolden strength.

int _font_get_face_count(font_rid: RID) virtual const

Returns number of faces in the TrueType / OpenType collection.

int _font_get_face_index(font_rid: RID) virtual const

Returns an active face index in the TrueType / OpenType collection.

int _font_get_fixed_size(font_rid: RID) virtual required const

Returns bitmap font fixed size.

TextShaping.FixedSizeScaleMode _font_get_fixed_size_scale_mode(font_rid: RID) virtual required const

Returns bitmap font scaling mode.

bool _font_get_generate_mipmaps(font_rid: RID) virtual const

Returns true if font texture mipmap generation is enabled.

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

Returns glyph advance (offset of the next glyph).

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

Returns outline contours of the glyph.

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

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

[]i32 _font_get_glyph_list(font_rid: RID, size: Vector2i) virtual required const

Returns list of rendered glyphs in the cache entry.

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

Returns glyph offset from the baseline.

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

Returns size of the glyph.

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

Returns index of the cache texture containing the glyph.

RID _font_get_glyph_texture_rid(font_rid: RID, size: Vector2i, glyph: int) virtual required const

Returns resource ID of the cache texture containing the glyph.

Vector2 _font_get_glyph_texture_size(font_rid: RID, size: Vector2i, glyph: int) virtual required const

Returns size of the cache texture containing the glyph.

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

Returns rectangle in the cache texture containing the glyph.

TextShaping.Hinting _font_get_hinting(font_rid: RID) virtual const

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

bool _font_get_keep_rounding_remainders(font_rid: RID) virtual const

Returns glyph position rounding behavior. If set to true, when aligning glyphs to the pixel boundaries rounding remainders are accumulated to ensure more uniform glyph distribution. This setting has no effect if subpixel positioning is enabled.

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

Returns kerning for the pair of glyphs.

[]Vector2i _font_get_kerning_list(font_rid: RID, size: int) virtual const

Returns list of the kerning overrides.

bool _font_get_language_support_override(font_rid: RID, language: String) virtual

Returns true if support override is enabled for the language.

[]String _font_get_language_support_overrides(font_rid: RID) virtual

Returns list of language support overrides.

int _font_get_msdf_pixel_range(font_rid: RID) virtual const

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

int _font_get_msdf_size(font_rid: RID) virtual const

Returns source font size used to generate MSDF textures.

String _font_get_name(font_rid: RID) virtual const

Returns font family name.

Dictionary _font_get_opentype_feature_overrides(font_rid: RID) virtual const

Returns font OpenType feature set override.

Dictionary _font_get_ot_name_strings(font_rid: RID) virtual const

Returns Dictionary with OpenType font name strings (localized font names, version, description, license information, sample text, etc.).

[]Color _font_get_palette_colors(font_rid: RID, index: int) virtual const

Returns the array in the predefined color palette at index. Palette contains all colors used to render font glyphs. Each palette has the same number of colors. Colors can be overridden using _font_set_palette_custom_colors().

int _font_get_palette_count(font_rid: RID) virtual const

Returns the number of predefined color palettes. Palette contains all colors used to render font glyphs. Each palette has the same number of colors.

[]Color _font_get_palette_custom_colors(font_rid: RID) virtual const

Returns array of custom colors to override predefined palette.

String _font_get_palette_name(font_rid: RID, index: int) virtual const

Returns the name of the predefined color palette at index. Palette contains all colors used to render font glyphs. Each palette has the same number of colors.

float _font_get_scale(font_rid: RID, size: int) virtual required const

Returns scaling factor of the color bitmap font.

bool _font_get_script_support_override(font_rid: RID, script: String) virtual

Returns true if support override is enabled for the script.

[]String _font_get_script_support_overrides(font_rid: RID) virtual

Returns list of script support overrides.

[]Dictionary _font_get_size_cache_info(font_rid: RID) virtual const

Returns font cache information, each entry contains the following fields: Vector2i size_px - font size in pixels, float viewport_oversampling - viewport oversampling factor, int glyphs - number of rendered glyphs, int textures - number of used textures, int textures_size - size of texture data in bytes.

[]Vector2i _font_get_size_cache_list(font_rid: RID) virtual required const

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

int _font_get_spacing(font_rid: RID, spacing: TextShaping.SpacingType) virtual const

Returns the spacing for spacing in pixels (not relative to the font size).

int _font_get_stretch(font_rid: RID) virtual const

Returns font stretch amount, compared to a normal width. A percentage value between 50% and 200%.

TextShaping.FontStyle _font_get_style(font_rid: RID) virtual const

Returns font style flags.

String _font_get_style_name(font_rid: RID) virtual const

Returns font style name.

TextShaping.SubpixelPositioning _font_get_subpixel_positioning(font_rid: RID) virtual const

Returns font subpixel glyph positioning mode.

String _font_get_supported_chars(font_rid: RID) virtual required const

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

[]i32 _font_get_supported_glyphs(font_rid: RID) virtual required const

Returns an array containing all glyph indices in the font.

int _font_get_texture_count(font_rid: RID, size: Vector2i) virtual required const

Returns number of textures used by font cache entry.

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

Returns font cache texture image data.

[]i32 _font_get_texture_offsets(font_rid: RID, size: Vector2i, texture_index: int) virtual const

Returns array containing glyph packing data.

Transform2D _font_get_transform(font_rid: RID) virtual const

Returns 2D transform applied to the font outlines.

float _font_get_underline_position(font_rid: RID, size: int) virtual required const

Returns pixel offset of the underline below the baseline.

float _font_get_underline_thickness(font_rid: RID, size: int) virtual required const

Returns thickness of the underline in pixels.

int _font_get_used_palette(font_rid: RID) virtual const

Returns used palette index.

Dictionary _font_get_variation_coordinates(font_rid: RID) virtual const

Returns variation coordinates for the specified font cache entry.

int _font_get_weight(font_rid: RID) virtual const

Returns weight (boldness) of the font. A value in the 100...999 range, normal font weight is 400, bold font weight is 700.

bool _font_has_char(font_rid: RID, char: int) virtual required const

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

bool _font_is_allow_system_fallback(font_rid: RID) virtual const

Returns true if system fonts can be automatically used as fallbacks.

bool _font_is_force_autohinter(font_rid: RID) virtual const

Returns true if auto-hinting is supported and preferred over font built-in hinting.

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

Returns true if the font supports the given language (as a ISO 639 code).

bool _font_is_modulate_color_glyphs(font_rid: RID) virtual const

Returns true if color modulation is applied when drawing the font’s colored glyphs.

_font_is_multichannel_signed_distance_field

Section titled “_font_is_multichannel_signed_distance_field”

bool _font_is_multichannel_signed_distance_field(font_rid: 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(font_rid: RID, script: String) virtual const

Returns true if the font supports the given script (as a ISO 15924 code).

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

Removes specified rendered glyph information from the cache entry.

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

Removes kerning override for the pair of glyphs.

void _font_remove_language_support_override(font_rid: RID, language: String) virtual

Remove language support override.

void _font_remove_script_support_override(font_rid: RID, script: String) virtual

Removes script support override.

void _font_remove_size_cache(font_rid: RID, size: Vector2i) virtual required

Removes specified font size from the cache entry.

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

Removes specified texture from the cache entry.

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

Renders specified glyph to the font cache texture.

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

Renders the range of characters to the font cache texture.

void _font_set_allow_system_fallback(font_rid: RID, allow_system_fallback: bool) virtual

If set to true, system fonts can be automatically used as fallbacks.

void _font_set_antialiasing(font_rid: RID, antialiasing: TextShaping.FontAntialiasing) virtual

Sets font anti-aliasing mode.

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

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

void _font_set_baseline_offset(font_rid: RID, baseline_offset: float) virtual

Sets extra baseline offset (as a fraction of font height).

void _font_set_data(font_rid: RID, data: []u8) virtual

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

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

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

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

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

void _font_set_disable_embedded_bitmaps(font_rid: RID, disable_embedded_bitmaps: bool) virtual

If set to true, embedded font bitmap loading is disabled.

void _font_set_embolden(font_rid: RID, strength: float) virtual

Sets font embolden strength. If strength is not equal to zero, emboldens the font outlines. Negative values reduce the outline thickness.

void _font_set_face_index(font_rid: RID, face_index: int) virtual

Sets an active face index in the TrueType / OpenType collection.

void _font_set_fixed_size(font_rid: RID, fixed_size: int) virtual required

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_scale_mode(font_rid: RID, fixed_size_scale_mode: TextShaping.FixedSizeScaleMode) virtual required

Sets bitmap font scaling mode. This property is used only if fixed_size is greater than zero.

void _font_set_force_autohinter(font_rid: RID, force_autohinter: bool) virtual

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

void _font_set_generate_mipmaps(font_rid: RID, generate_mipmaps: bool) virtual

If set to true font texture mipmap generation is enabled.

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

Sets glyph advance (offset of the next glyph).

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

Sets glyph offset from the baseline.

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

Sets size of the glyph.

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

Sets index of the cache texture containing the glyph.

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

Sets rectangle in the cache texture containing the glyph.

void _font_set_hinting(font_rid: RID, hinting: TextShaping.Hinting) virtual

Sets font hinting mode. Used by dynamic fonts only.

void _font_set_keep_rounding_remainders(font_rid: RID, keep_rounding_remainders: bool) virtual

Sets glyph position rounding behavior. If set to true, when aligning glyphs to the pixel boundaries rounding remainders are accumulated to ensure more uniform glyph distribution. This setting has no effect if subpixel positioning is enabled.

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

Sets kerning for the pair of glyphs.

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

Adds override for _font_is_language_supported().

void _font_set_modulate_color_glyphs(font_rid: RID, modulate: bool) virtual

If set to true, color modulation is applied when drawing colored glyphs, otherwise it’s applied to the monochrome glyphs only.

void _font_set_msdf_pixel_range(font_rid: RID, msdf_pixel_range: int) virtual

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

void _font_set_msdf_size(font_rid: RID, msdf_size: int) virtual

Sets source font size used to generate MSDF textures.

_font_set_multichannel_signed_distance_field

Section titled “_font_set_multichannel_signed_distance_field”

void _font_set_multichannel_signed_distance_field(font_rid: RID, msdf: bool) virtual

If set to true, glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. MSDF rendering allows displaying the font at any scaling factor without blurriness, and without incurring a CPU cost when the font size changes (since the font no longer needs to be rasterized on the CPU). As a downside, font hinting is not available with MSDF. The lack of font hinting may result in less crisp and less readable fonts at small sizes.

void _font_set_name(font_rid: RID, name: String) virtual

Sets the font family name.

void _font_set_opentype_feature_overrides(font_rid: RID, overrides: Dictionary) virtual

Sets font OpenType feature set override.

void _font_set_palette_custom_colors(font_rid: RID, colors: []Color) virtual

Sets array of custom colors to override predefined palette. Set to empty array to reset overrides. Use Color(0, 0, 0, 0), to keep predefined palette color at specific position.

void _font_set_scale(font_rid: RID, size: int, scale: float) virtual required

Sets scaling factor of the color bitmap font.

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

Adds override for _font_is_script_supported().

void _font_set_spacing(font_rid: RID, spacing: TextShaping.SpacingType, value: int) virtual

Sets the spacing for spacing to value in pixels (not relative to the font size).

void _font_set_stretch(font_rid: RID, stretch: int) virtual

Sets font stretch amount, compared to a normal width. A percentage value between 50% and 200%.

void _font_set_style(font_rid: RID, style: TextShaping.FontStyle) virtual

Sets the font style flags.

void _font_set_style_name(font_rid: RID, name_style: String) virtual

Sets the font style name.

void _font_set_subpixel_positioning(font_rid: RID, subpixel_positioning: TextShaping.SubpixelPositioning) virtual

Sets font subpixel glyph positioning mode.

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

Sets font cache texture image data.

void _font_set_texture_offsets(font_rid: RID, size: Vector2i, texture_index: int, offset: []i32) virtual

Sets array containing glyph packing data.

void _font_set_transform(font_rid: RID, transform: Transform2D) virtual

Sets 2D transform, applied to the font outlines, can be used for slanting, flipping, and rotating glyphs.

void _font_set_underline_position(font_rid: RID, size: int, underline_position: float) virtual required

Sets pixel offset of the underline below the baseline.

void _font_set_underline_thickness(font_rid: RID, size: int, underline_thickness: float) virtual required

Sets thickness of the underline in pixels.

void _font_set_used_palette(font_rid: RID, index: int) virtual

Sets used palette index.

void _font_set_variation_coordinates(font_rid: RID, variation_coordinates: Dictionary) virtual

Sets variation coordinates for the specified font cache entry.

void _font_set_weight(font_rid: RID, weight: int) virtual

Sets weight (boldness) of the font. A value in the 100...999 range, normal font weight is 400, bold font weight is 700.

Dictionary _font_supported_feature_list(font_rid: RID) virtual const

Returns the dictionary of the supported OpenType features.

Dictionary _font_supported_variation_list(font_rid: RID) virtual const

Returns the dictionary of the supported OpenType variation coordinates.

void _free_rid(rid: RID) virtual required

Frees an object created by this TextShaping.

int _get_features() virtual required const

Returns text server features, see TextShaping.Feature.

Vector2 _get_hex_code_box_size(size: int, index: int) virtual const

Returns size of the replacement character (box with character hexadecimal code that is drawn in place of invalid characters).

String _get_name() virtual required const

Returns the name of the server interface.

[]u8 _get_support_data() virtual const

Returns default TextShaping database (e.g. ICU break iterators and dictionaries).

String _get_support_data_filename() virtual const

Returns default TextShaping database (e.g. ICU break iterators and dictionaries) filename.

String _get_support_data_info() virtual const

Returns TextShaping database (e.g. ICU break iterators and dictionaries) description.

bool _has(rid: RID) virtual required

Returns true if rid is valid resource owned by this text server.

bool _has_feature(feature: TextShaping.Feature) virtual required const

Returns true if the server supports a feature.

int _is_confusable(string: String, dict: []String) virtual const

Returns index of the first string in dict which is visually confusable with the string, or -1 if none is found.

bool _is_locale_right_to_left(locale: String) virtual const

Returns true if locale is right-to-left.

bool _is_locale_using_support_data(locale: String) virtual const

Returns true if the locale requires text server support data for line/word breaking.

bool _is_valid_identifier(string: String) virtual const

Returns true if string is a valid identifier.

bool _is_valid_letter(unicode: int) virtual const

No description yet.

bool _load_support_data(filename: String) virtual

Loads optional TextShaping database (e.g. ICU break iterators and dictionaries).

int _name_to_tag(name: String) virtual const

Converts the given readable name of a feature, variation, script, or language to an OpenType tag.

[]Vector3i _parse_structured_text(parser_type: TextShaping.StructuredTextParser, args: Array, text: String) virtual const

Default implementation of the BiDi algorithm override function.

void _reference_oversampling_level(oversampling: float) virtual

Increases the reference count of the specified oversampling level. This method is called by Viewport, and should not be used directly.

bool _save_support_data(filename: String) virtual const

Saves optional TextShaping database (e.g. ICU break iterators and dictionaries) to the file.

int _shaped_get_run_count(shaped: RID) virtual const

Returns the number of uniform text runs in the buffer.

TextShaping.Direction _shaped_get_run_direction(shaped: RID, index: int) virtual const

Returns the direction of the index text run (in visual order).

RID _shaped_get_run_font_rid(shaped: RID, index: int) virtual const

Returns the font RID of the index text run (in visual order).

int _shaped_get_run_font_size(shaped: RID, index: int) virtual const

Returns the font size of the index text run (in visual order).

Vector2i _shaped_get_run_glyph_range(shaped: RID, index: int) virtual const

Returns the glyph range of the index text run (in visual order).

String _shaped_get_run_language(shaped: RID, index: int) virtual const

Returns the language of the index text run (in visual order).

Variant _shaped_get_run_object(shaped: RID, index: int) virtual const

Returns the embedded object of the index text run (in visual order).

Vector2i _shaped_get_run_range(shaped: RID, index: int) virtual const

Returns the source text range of the index text run (in visual order).

String _shaped_get_run_text(shaped: RID, index: int) virtual const

Returns the source text of the index text run (in visual order).

int _shaped_get_span_count(shaped: RID) virtual required const

Returns number of text spans added using _shaped_text_add_string() or _shaped_text_add_object().

Variant _shaped_get_span_embedded_object(shaped: RID, index: int) virtual required const

Returns text embedded object key.

Variant _shaped_get_span_meta(shaped: RID, index: int) virtual required const

Returns text span metadata.

Variant _shaped_get_span_object(shaped: RID, index: int) virtual required const

Returns the text span embedded object key.

String _shaped_get_span_text(shaped: RID, index: int) virtual required const

Returns the text span source text.

String _shaped_get_text(shaped: RID) virtual required const

Returns the text buffer source text, including object replacement characters.

void _shaped_set_span_update_font(shaped: RID, index: int, fonts: []RID, size: int, opentype_features: Dictionary) virtual required

Changes text span font, font size, and OpenType features, without changing the text.

bool _shaped_text_add_object(shaped: RID, key: Variant, size: Vector2, inline_align: InlineAlignment, length: int, baseline: float) virtual required

Adds inline object to the text buffer, key must be unique. In the text, object is represented as length object replacement characters.

bool _shaped_text_add_string(shaped: RID, text: String, fonts: []RID, size: int, opentype_features: Dictionary, language: String, meta: Variant) virtual required

Adds text span and font to draw it to the text buffer.

void _shaped_text_clear(shaped: RID) virtual required

Clears text buffer (removes text and inline objects).

int _shaped_text_closest_character_pos(shaped: RID, pos: int) virtual const

Returns composite character position closest to the pos.

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

Draw shaped text into a canvas item at a given position, with color. pos specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

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

Draw the outline of the shaped text into a canvas item at a given position, with color. pos specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). If oversampling is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.

RID _shaped_text_duplicate(shaped: RID) virtual required

Duplicates shaped text buffer.

float _shaped_text_fit_to_width(shaped: RID, width: float, justification_flags: TextShaping.JustificationFlag) virtual

Adjusts text width to fit to specified width, returns new text width.

float _shaped_text_get_ascent(shaped: RID) virtual required const

Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).

void _shaped_text_get_carets(shaped: RID, position: int, r_caret: CaretInfo*) virtual const

Returns shapes of the carets corresponding to the character offset position in the text. Returned caret shape is 1 pixel wide rectangle.

[]i32 _shaped_text_get_character_breaks(shaped: RID) virtual const

Returns array of the composite character boundaries.

int _shaped_text_get_custom_ellipsis(shaped: RID) virtual const

Returns ellipsis character used for text clipping.

String _shaped_text_get_custom_punctuation(shaped: RID) virtual const

Returns custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.

float _shaped_text_get_descent(shaped: RID) virtual required const

Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).

TextShaping.Direction _shaped_text_get_direction(shaped: RID) virtual const

Returns direction of the text.

_shaped_text_get_dominant_direction_in_range

Section titled “_shaped_text_get_dominant_direction_in_range”

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

Returns dominant direction of in the range of text.

int _shaped_text_get_ellipsis_glyph_count(shaped: RID) virtual required const

Returns number of glyphs in the ellipsis.

const Glyph* _shaped_text_get_ellipsis_glyphs(shaped: RID) virtual required const

Returns array of the glyphs in the ellipsis.

int _shaped_text_get_ellipsis_pos(shaped: RID) virtual required const

Returns position of the ellipsis.

int _shaped_text_get_glyph_count(shaped: RID) virtual required const

Returns number of glyphs in the buffer.

const Glyph* _shaped_text_get_glyphs(shaped: RID) virtual required const

Returns an array of glyphs in the visual order.

Vector2 _shaped_text_get_grapheme_bounds(shaped: RID, pos: int) virtual const

Returns composite character’s bounds as offsets from the start of the line.

TextShaping.Direction _shaped_text_get_inferred_direction(shaped: RID) virtual const

Returns direction of the text, inferred by the BiDi algorithm.

[]i32 _shaped_text_get_line_breaks(shaped: RID, width: float, start: int, break_flags: TextShaping.LineBreakFlag) virtual const

Breaks text to the lines and returns character ranges for each line.

[]i32 _shaped_text_get_line_breaks_adv(shaped: RID, width: []f32, start: int, once: bool, break_flags: TextShaping.LineBreakFlag) virtual const

Breaks text to the lines and columns. Returns character ranges for each segment.

int _shaped_text_get_object_glyph(shaped: RID, key: Variant) virtual required const

Returns the glyph index of the inline object.

Vector2i _shaped_text_get_object_range(shaped: RID, key: Variant) virtual required const

Returns the character range of the inline object.

Rect2 _shaped_text_get_object_rect(shaped: RID, key: Variant) virtual required const

Returns bounding rectangle of the inline object.

Array _shaped_text_get_objects(shaped: RID) virtual required const

Returns array of inline objects.

TextShaping.Orientation _shaped_text_get_orientation(shaped: RID) virtual const

Returns text orientation.

RID _shaped_text_get_parent(shaped: RID) virtual required const

Returns the parent buffer from which the substring originates.

bool _shaped_text_get_preserve_control(shaped: RID) virtual const

Returns true if text buffer is configured to display control characters.

bool _shaped_text_get_preserve_invalid(shaped: RID) virtual const

Returns true if text buffer is configured to display hexadecimal codes in place of invalid characters.

Vector2i _shaped_text_get_range(shaped: RID) virtual required const

Returns substring buffer character range in the parent buffer.

[]Vector2 _shaped_text_get_selection(shaped: RID, start: int, end: int) virtual const

Returns selection rectangles for the specified character range.

Vector2 _shaped_text_get_size(shaped: RID) virtual required const

Returns size of the text.

int _shaped_text_get_spacing(shaped: RID, spacing: TextShaping.SpacingType) virtual const

Returns extra spacing added between glyphs or lines in pixels.

int _shaped_text_get_trim_pos(shaped: RID) virtual required const

Returns the position of the overrun trim.

float _shaped_text_get_underline_position(shaped: RID) virtual required const

Returns pixel offset of the underline below the baseline.

float _shaped_text_get_underline_thickness(shaped: RID) virtual required const

Returns thickness of the underline.

float _shaped_text_get_width(shaped: RID) virtual required const

Returns width (for horizontal layout) or height (for vertical) of the text.

[]i32 _shaped_text_get_word_breaks(shaped: RID, grapheme_flags: TextShaping.GraphemeFlag, skip_grapheme_flags: TextShaping.GraphemeFlag) virtual const

Breaks text into words and returns array of character ranges. Use grapheme_flags to set what characters are used for breaking.

bool _shaped_text_has_object(shaped: RID, key: Variant) virtual required const

Returns true if an object with key is embedded in this shaped text buffer.

int _shaped_text_hit_test_grapheme(shaped: RID, coord: float) virtual const

Returns grapheme index at the specified pixel offset at the baseline, or -1 if none is found.

int _shaped_text_hit_test_position(shaped: RID, coord: float) virtual const

Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.

bool _shaped_text_is_ready(shaped: RID) virtual required const

Returns true if buffer is successfully shaped.

int _shaped_text_next_character_pos(shaped: RID, pos: int) virtual const

Returns composite character end position closest to the pos.

int _shaped_text_next_grapheme_pos(shaped: RID, pos: int) virtual const

Returns grapheme end position closest to the pos.

void _shaped_text_overrun_trim_to_width(shaped: RID, width: float, trim_flags: TextShaping.TextOverrunFlag) virtual

Trims text if it exceeds the given width.

int _shaped_text_prev_character_pos(shaped: RID, pos: int) virtual const

Returns composite character start position closest to the pos.

int _shaped_text_prev_grapheme_pos(shaped: RID, pos: int) virtual const

Returns grapheme start position closest to the pos.

bool _shaped_text_resize_object(shaped: RID, key: Variant, size: Vector2, inline_align: InlineAlignment, baseline: float) virtual required

Sets new size and alignment of embedded object.

void _shaped_text_set_bidi_override(shaped: RID, override: Array) virtual

Overrides BiDi for the structured text.

void _shaped_text_set_custom_ellipsis(shaped: RID, char: int) virtual

Sets ellipsis character used for text clipping.

void _shaped_text_set_custom_punctuation(shaped: RID, punct: String) virtual

Sets custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.

void _shaped_text_set_direction(shaped: RID, direction: TextShaping.Direction) virtual

Sets desired text direction. If set to TextShaping.DIRECTION_AUTO, direction will be detected based on the buffer contents and current locale.

void _shaped_text_set_orientation(shaped: RID, orientation: TextShaping.Orientation) virtual

Sets desired text orientation.

void _shaped_text_set_preserve_control(shaped: RID, enabled: bool) virtual

If set to true text buffer will display control characters.

void _shaped_text_set_preserve_invalid(shaped: RID, enabled: bool) virtual

If set to true text buffer will display invalid characters as hexadecimal codes, otherwise nothing is displayed.

void _shaped_text_set_spacing(shaped: RID, spacing: TextShaping.SpacingType, value: int) virtual

Sets extra spacing added between glyphs or lines in pixels.

bool _shaped_text_shape(shaped: RID) virtual required

Shapes buffer if it’s not shaped. Returns true if the string is shaped successfully.

const Glyph* _shaped_text_sort_logical(shaped: RID) virtual required

Returns text glyphs in the logical order.

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

Returns text buffer for the substring of the text in the shaped text buffer (including inline objects).

float _shaped_text_tab_align(shaped: RID, tab_stops: []f32) virtual

Aligns shaped text to the given tab-stops.

bool _shaped_text_update_breaks(shaped: RID) virtual

Updates break points in the shaped text. This method is called by default implementation of text breaking functions.

bool _shaped_text_update_justification_ops(shaped: RID) virtual

Updates justification points in the shaped text. This method is called by default implementation of text justification functions.

bool _spoof_check(string: String) virtual const

Returns true if string is likely to be an attempt at confusing the reader.

[]i32 _string_get_character_breaks(string: String, language: String) virtual const

Returns array of the composite character boundaries.

[]i32 _string_get_word_breaks(string: String, language: String, chars_per_line: int) virtual const

Returns an array of the word break boundaries. Elements in the returned array are the offsets of the start and end of words. Therefore the length of the array is always even.

String _string_to_lower(string: String, language: String) virtual const

Returns the string converted to lowercase.

String _string_to_title(string: String, language: String) virtual const

Returns the string converted to Title Case.

String _string_to_upper(string: String, language: String) virtual const

Returns the string converted to UPPERCASE.

String _strip_diacritics(string: String) virtual const

Strips diacritics from the string.

String _tag_to_name(tag: int) virtual const

Converts the given OpenType tag to the readable name of a feature, variation, script, or language.

void _unreference_oversampling_level(oversampling: float) virtual

Decreases the reference count of the specified oversampling level, and frees the font cache for oversampling level when the reference count reaches zero. This method is called by Viewport, and should not be used directly.