Inheritance #

RefCounted

- AESContext
- AStar2D
- AStar3D
- AStarGrid2D
- AudioEffectInstance (1)
- AudioSample
- AudioSamplePlayback
- AudioStreamPlayback (5)
- CameraFeed
- CharFXTransform
- ConfigFile
- Crypto
- DTLSServer
- DirAccess
- ENetConnection
- EditorContextMenuPlugin
- EditorDebuggerPlugin
- EditorDebuggerSession
- EditorExportPlatform (6)
- EditorExportPlugin
- EditorExportPreset
- EditorFeatureProfile
- EditorFileSystemImportFormatSupportQuery
- EditorInspectorPlugin
- EditorResourceConversionPlugin
- EditorResourcePreviewGenerator
- EditorResourceTooltipPlugin
- EditorSceneFormatImporter (4)
- EditorScenePostImport
- EditorScenePostImportPlugin
- EditorScript
- EditorTranslationParserPlugin
- EncodedObjectAsID
- EngineProfiler
- Expression
- FileAccess
- GLTFObjectModelProperty
- HMACContext
- HTTPClient
- HashingContext
- ImageFormatLoader (1)
- JavaClass
- JavaObject
- JavaScriptObject
- KinematicCollision2D
- KinematicCollision3D
- Lightmapper (1)
- MeshConvexDecompositionSettings
- MeshDataTool
- MultiplayerAPI (2)
- Mutex
- NavigationPathQueryParameters2D
- NavigationPathQueryParameters3D
- NavigationPathQueryResult2D
- NavigationPathQueryResult3D
- Node3DGizmo (1)
- OggPacketSequencePlayback
- OpenXRAPIExtension
- PCKPacker
- PackedDataContainerRef
- PacketPeer (8)
- PhysicsPointQueryParameters2D
- PhysicsPointQueryParameters3D
- PhysicsRayQueryParameters2D
- PhysicsRayQueryParameters3D
- PhysicsShapeQueryParameters2D
- PhysicsShapeQueryParameters3D
- PhysicsTestMotionParameters2D
- PhysicsTestMotionParameters3D
- PhysicsTestMotionResult2D
- PhysicsTestMotionResult3D
- RDAttachmentFormat
- RDFramebufferPass
- RDPipelineColorBlendState
- RDPipelineColorBlendStateAttachment
- RDPipelineDepthStencilState
- RDPipelineMultisampleState
- RDPipelineRasterizationState
- RDPipelineSpecializationConstant
- RDSamplerState
- RDShaderSource
- RDTextureFormat
- RDTextureView
- RDUniform
- RDVertexAttribute
- RandomNumberGenerator
- RegEx
- RegExMatch
- RenderSceneBuffers (2)
- RenderSceneBuffersConfiguration
- Resource (103)
- ResourceFormatLoader
- ResourceFormatSaver
- ResourceImporter (16)
- SceneState
- SceneTreeTimer
- Semaphore
- SkinReference
- StreamPeer (5)
- SurfaceTool
- TCPServer
- TLSOptions
- TextLine
- TextParagraph
- TextServer (1)
- Thread
- TranslationDomain
- TriangleMesh
- Tween
- Tweener (5)
- UDPServer
- UPNP
- UPNPDevice
- WeakRef
- WebRTCPeerConnection (1)
- XMLParser
- XRInterface (4)
- XRPose
- XRTracker (2)
- ZIPPacker
- ZIPReader
TextServer

- TextServerExtension (2)

Table of contents

TextServer #

is_refcounted, core, not_builtin_classes

A server interface for font management and text rendering.

TextServer is the API backend for managing fonts and rendering text.

Note: This is a low-level API, consider using TextLine, TextParagraph, and Font classes instead.

This is an abstract class, so to get the currently active TextServer instance, use the following code:

GDScript

var ts = TextServerManager.get_primary_interface()

C#

var ts = TextServerManager.GetPrimaryInterface();

Members #

Methods #

func create_font() -> RID#

Creates a new, empty font cache entry resource. To free the resulting resource, use the free_rid method.

func create_font_linked_variation(font_rid: RID) -> RID#

Creates a new variation existing font which is reusing the same glyph cache and font data. To free the resulting resource, use the free_rid method.

func create_shaped_text(orientation: int = 0 enumTextServer.Orientation) -> RID#

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

Note: Direction is ignored if server does not support FEATURE_BIDI_LAYOUT feature (supported by TextServerAdvanced).

Note: Orientation is ignored if server does not support FEATURE_VERTICAL_LAYOUT feature (supported by TextServerAdvanced).

const func draw_hex_code_box(color: Color) -> void#

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

func font_clear_glyphs(size: Vector2i) -> void#

Removes all 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.

func font_clear_kerning_map(size: int) -> void#

Removes all kerning overrides.

func font_clear_size_cache(font_rid: RID) -> void#

Removes all font sizes from the cache entry.

func font_clear_textures(size: Vector2i) -> void#

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.

const func font_draw_glyph(color: Color = Color(1, 1, 1, 1)) -> void#

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.

Note: If there are pending glyphs to render, calling this function might trigger the texture cache update.

const func font_draw_glyph_outline(color: Color = Color(1, 1, 1, 1)) -> void#

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.

Note: If there are pending glyphs to render, calling this function might trigger the texture cache update.

const func font_get_antialiasing(font_rid: RID) -> intTextServer.FontAntialiasing#

Returns font anti-aliasing mode.

const func font_get_ascent(size: int) -> float#

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

const func font_get_baseline_offset(font_rid: RID) -> float#

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

const func font_get_char_from_glyph_index(glyph_index: int) -> int#

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

const func font_get_descent(size: int) -> float#

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

const func font_get_disable_embedded_bitmaps(font_rid: RID) -> bool#

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

const func font_get_embolden(font_rid: RID) -> float#

Returns font embolden strength.

const func font_get_face_count(font_rid: RID) -> int#

Returns number of faces in the TrueType / OpenType collection.

const func font_get_face_index(font_rid: RID) -> int#

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

const func font_get_fixed_size(font_rid: RID) -> int#

Returns bitmap font fixed size.

const func font_get_fixed_size_scale_mode(font_rid: RID) -> intTextServer.FixedSizeScaleMode#

Returns bitmap font scaling mode.

const func font_get_generate_mipmaps(font_rid: RID) -> bool#

Returns true if font texture mipmap generation is enabled.

const func font_get_global_oversampling() -> float#

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

const func font_get_glyph_advance(glyph: int) -> Vector2#

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.

const func font_get_glyph_contours(index: int) -> Dictionary#

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.

- Two successive CONTOUR_CURVE_TAG_ON points indicate a line segment.

- One CONTOUR_CURVE_TAG_OFF_CONIC point between two CONTOUR_CURVE_TAG_ON points indicates a single conic (quadratic) Bézier arc.

- Two CONTOUR_CURVE_TAG_OFF_CUBIC points between two CONTOUR_CURVE_TAG_ON points indicate a single cubic Bézier arc.

- Two successive CONTOUR_CURVE_TAG_OFF_CONIC points indicate two successive conic (quadratic) Bézier arcs with a virtual CONTOUR_CURVE_TAG_ON point at their middle.

- Each contour is closed. The last point of a contour uses the first point of a contour as its next point, and vice versa. The first point can be CONTOUR_CURVE_TAG_OFF_CONIC point.

const func font_get_glyph_index(variation_selector: int) -> int#

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

const func font_get_glyph_list(size: Vector2i) -> PackedInt32Array#

Returns list of rendered glyphs in the cache entry.

const func font_get_glyph_offset(glyph: int) -> Vector2#

Returns glyph offset from the baseline.

const func font_get_glyph_size(glyph: int) -> Vector2#

Returns size of the glyph.

const func font_get_glyph_texture_idx(glyph: int) -> int#

Returns index of the cache texture containing the glyph.

const func font_get_glyph_texture_rid(glyph: int) -> RID#

Returns resource ID of the cache texture containing the glyph.

Note: If there are pending glyphs to render, calling this function might trigger the texture cache update.

const func font_get_glyph_texture_size(glyph: int) -> Vector2#

Returns size of the cache texture containing the glyph.

Note: If there are pending glyphs to render, calling this function might trigger the texture cache update.

const func font_get_glyph_uv_rect(glyph: int) -> Rect2#

Returns rectangle in the cache texture containing the glyph.

const func font_get_hinting(font_rid: RID) -> intTextServer.Hinting#

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

const func font_get_keep_rounding_remainders(font_rid: RID) -> bool#

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.

const func font_get_kerning(glyph_pair: Vector2i) -> Vector2#

Returns kerning for the pair of glyphs.

const func font_get_kerning_list(size: int) -> Vector2i[]#

Returns list of the kerning overrides.

func font_get_language_support_override(language: String) -> bool#

Returns true if support override is enabled for the language.

func font_get_language_support_overrides(font_rid: RID) -> PackedStringArray#

Returns list of language support overrides.

const func font_get_msdf_pixel_range(font_rid: RID) -> int#

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

const func font_get_msdf_size(font_rid: RID) -> int#

Returns source font size used to generate MSDF textures.

const func font_get_name(font_rid: RID) -> String#

Returns font family name.

const func font_get_opentype_feature_overrides(font_rid: RID) -> Dictionary#

Returns font OpenType feature set override.

const func font_get_ot_name_strings(font_rid: RID) -> Dictionary#

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

const func font_get_oversampling(font_rid: RID) -> float#

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

const func font_get_scale(size: int) -> float#

Returns scaling factor of the color bitmap font.

func font_get_script_support_override(script: String) -> bool#

Returns true if support override is enabled for the script.

func font_get_script_support_overrides(font_rid: RID) -> PackedStringArray#

Returns list of script support overrides.

const func font_get_size_cache_list(font_rid: RID) -> Vector2i[]#

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

const func font_get_spacing(spacing: int enumTextServer.SpacingType) -> int#

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

const func font_get_stretch(font_rid: RID) -> int#

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

const func font_get_style(font_rid: RID) -> intTextServer.FontStyle#

Returns font style flags, see FontStyle.

const func font_get_style_name(font_rid: RID) -> String#

Returns font style name.

const func font_get_subpixel_positioning(font_rid: RID) -> intTextServer.SubpixelPositioning#

Returns font subpixel glyph positioning mode.

const func font_get_supported_chars(font_rid: RID) -> String#

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

const func font_get_supported_glyphs(font_rid: RID) -> PackedInt32Array#

Returns an array containing all glyph indices in the font.

const func font_get_texture_count(size: Vector2i) -> int#

Returns number of textures used by font cache entry.

const func font_get_texture_image(texture_index: int) -> Image#

Returns font cache texture image data.

const func font_get_texture_offsets(texture_index: int) -> PackedInt32Array#

Returns array containing glyph packing data.

const func font_get_transform(font_rid: RID) -> Transform2D#

Returns 2D transform applied to the font outlines.

const func font_get_underline_position(size: int) -> float#

Returns pixel offset of the underline below the baseline.

const func font_get_underline_thickness(size: int) -> float#

Returns thickness of the underline in pixels.

const func font_get_variation_coordinates(font_rid: RID) -> Dictionary#

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

const func font_get_weight(font_rid: RID) -> int#

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

const func font_has_char(char: int) -> bool#

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

const func font_is_allow_system_fallback(font_rid: RID) -> bool#

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

const func font_is_force_autohinter(font_rid: RID) -> bool#

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

const func font_is_language_supported(language: String) -> bool#

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

const func font_is_multichannel_signed_distance_field(font_rid: RID) -> bool#

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

const func font_is_script_supported(script: String) -> bool#

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

func font_remove_glyph(glyph: int) -> void#

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.

func font_remove_kerning(glyph_pair: Vector2i) -> void#

Removes kerning override for the pair of glyphs.

func font_remove_language_support_override(language: String) -> void#

Remove language support override.

func font_remove_script_support_override(script: String) -> void#

Removes script support override.

func font_remove_size_cache(size: Vector2i) -> void#

Removes specified font size from the cache entry.

func font_remove_texture(texture_index: int) -> void#

Removes specified texture from the cache entry.

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

func font_render_glyph(index: int) -> void#

Renders specified glyph to the font cache texture.

func font_render_range(end: int) -> void#

Renders the range of characters to the font cache texture.

func font_set_allow_system_fallback(allow_system_fallback: bool) -> void#

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

func font_set_antialiasing(antialiasing: int enumTextServer.FontAntialiasing) -> void#

Sets font anti-aliasing mode.

func font_set_ascent(ascent: float) -> void#

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

func font_set_baseline_offset(baseline_offset: float) -> void#

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

func font_set_data(data: PackedByteArray) -> void#

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

func font_set_descent(descent: float) -> void#

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

func font_set_disable_embedded_bitmaps(disable_embedded_bitmaps: bool) -> void#

If set to true, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).

func font_set_embolden(strength: float) -> void#

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

func font_set_face_index(face_index: int) -> void#

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

func font_set_fixed_size(fixed_size: int) -> void#

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

func font_set_fixed_size_scale_mode(fixed_size_scale_mode: int enumTextServer.FixedSizeScaleMode) -> void#

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

func font_set_force_autohinter(force_autohinter: bool) -> void#

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

func font_set_generate_mipmaps(generate_mipmaps: bool) -> void#

If set to true font texture mipmap generation is enabled.

func font_set_global_oversampling(oversampling: float) -> void#

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

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

func font_set_glyph_advance(advance: Vector2) -> void#

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.

func font_set_glyph_offset(offset: Vector2) -> void#

Sets glyph offset from the baseline.

func font_set_glyph_size(gl_size: Vector2) -> void#

Sets size of the glyph.

func font_set_glyph_texture_idx(texture_idx: int) -> void#

Sets index of the cache texture containing the glyph.

func font_set_glyph_uv_rect(uv_rect: Rect2) -> void#

Sets rectangle in the cache texture containing the glyph.

func font_set_hinting(hinting: int enumTextServer.Hinting) -> void#

Sets font hinting mode. Used by dynamic fonts only.

func font_set_keep_rounding_remainders(keep_rounding_remainders: bool) -> void#

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.

func font_set_kerning(kerning: Vector2) -> void#

Sets kerning for the pair of glyphs.

func font_set_language_support_override(supported: bool) -> void#

Adds override for font_is_language_supported.

func font_set_msdf_pixel_range(msdf_pixel_range: int) -> void#

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

func font_set_msdf_size(msdf_size: int) -> void#

Sets source font size used to generate MSDF textures.

func font_set_multichannel_signed_distance_field(msdf: bool) -> void#

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.

Note: MSDF font rendering does not render glyphs with overlapping shapes correctly. Overlapping shapes are not valid per the OpenType standard, but are still commonly found in many font files, especially those converted by Google Fonts. To avoid issues with overlapping glyphs, consider downloading the font file directly from the type foundry instead of relying on Google Fonts.

func font_set_name(name: String) -> void#

Sets the font family name.

func font_set_opentype_feature_overrides(overrides: Dictionary) -> void#

Sets font OpenType feature set override.

func font_set_oversampling(oversampling: float) -> void#

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

func font_set_scale(scale: float) -> void#

Sets scaling factor of the color bitmap font.

func font_set_script_support_override(supported: bool) -> void#

Adds override for font_is_script_supported.

func font_set_spacing(value: int) -> void#

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

func font_set_stretch(weight: int) -> void#

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

Note: This value is used for font matching only and will not affect font rendering. Use font_set_face_index, font_set_variation_coordinates, or font_set_transform instead.

func font_set_style(style: int enumTextServer.FontStyle) -> void#

Sets the font style flags, see FontStyle.

Note: This value is used for font matching only and will not affect font rendering. Use font_set_face_index, font_set_variation_coordinates, font_set_embolden, or font_set_transform instead.

func font_set_style_name(name: String) -> void#

Sets the font style name.

func font_set_subpixel_positioning(subpixel_positioning: int enumTextServer.SubpixelPositioning) -> void#

Sets font subpixel glyph positioning mode.

func font_set_texture_image(image: Image) -> void#

Sets font cache texture image data.

func font_set_texture_offsets(offset: PackedInt32Array) -> void#

Sets array containing glyph packing data.

func font_set_transform(transform: Transform2D) -> void#

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

For example, to simulate italic typeface by slanting, apply the following transform Transform2D(1.0, slant, 0.0, 1.0, 0.0, 0.0).

func font_set_underline_position(underline_position: float) -> void#

Sets pixel offset of the underline below the baseline.

func font_set_underline_thickness(underline_thickness: float) -> void#

Sets thickness of the underline in pixels.

func font_set_variation_coordinates(variation_coordinates: Dictionary) -> void#

Sets variation coordinates for the specified font cache entry. See font_supported_variation_list for more info.

func font_set_weight(weight: int) -> void#

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

Note: This value is used for font matching only and will not affect font rendering. Use font_set_face_index, font_set_variation_coordinates, or font_set_embolden instead.

const func font_supported_feature_list(font_rid: RID) -> Dictionary#

Returns the dictionary of the supported OpenType features.

const func font_supported_variation_list(font_rid: RID) -> Dictionary#

Returns the dictionary of the supported OpenType variation coordinates.

const func format_number(language: String = "") -> String#

Converts a number from the Western Arabic (0..9) to the numeral systems used in language.

If language is omitted, the active locale will be used.

func free_rid(rid: RID) -> void#

Frees an object created by this TextServer.

const func get_features() -> int#

Returns text server features, see Feature.

const func get_hex_code_box_size(index: int) -> Vector2#

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

const func get_name() -> String#

Returns the name of the server interface.

const func get_support_data() -> PackedByteArray#

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

const func get_support_data_filename() -> String#

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

const func get_support_data_info() -> String#

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

func has(rid: RID) -> bool#

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

const func has_feature(feature: int enumTextServer.Feature) -> bool#

Returns true if the server supports a feature.

const func is_confusable(dict: PackedStringArray) -> int#

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

Note: This method doesn't detect invisible characters, for spoof detection use it in combination with spoof_check.

Note: Always returns -1 if the server does not support the FEATURE_UNICODE_SECURITY feature.

const func is_locale_right_to_left(locale: String) -> bool#

Returns true if locale is right-to-left.

const func is_valid_identifier(string: String) -> bool#

Returns true if string is a valid identifier.

If the text server supports the FEATURE_UNICODE_IDENTIFIERS feature, a valid identifier must:

- Conform to normalization form C.

- Begin with a Unicode character of class XID_Start or "_".

- May contain Unicode characters of class XID_Continue in the other positions.

- Use UAX #31 recommended scripts only (mixed scripts are allowed).

If the FEATURE_UNICODE_IDENTIFIERS feature is not supported, a valid identifier must:

- Begin with a Unicode character of class XID_Start or "_".

- May contain Unicode characters of class XID_Continue in the other positions.

const func is_valid_letter(unicode: int) -> bool#

Returns true if the given code point is a valid letter, i.e. it belongs to the Unicode category "L".

func load_support_data(filename: String) -> bool#

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.

const func name_to_tag(name: String) -> int#

Converts readable feature, variation, script, or language name to OpenType tag.

const func parse_number(language: String = "") -> String#

Converts number from the numeral systems used in language to Western Arabic (0..9).

const func parse_structured_text(text: String) -> Vector3i[]#

Default implementation of the BiDi algorithm override function. See StructuredTextParser for more info.

const func percent_sign(language: String = "") -> String#

Returns percent sign used in the language.

const func save_support_data(filename: String) -> bool#

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

Note: This function is used by during project export, to include TextServer database.

const func shaped_get_span_count(shaped: RID) -> int#

Returns number of text spans added using shaped_text_add_string or shaped_text_add_object.

const func shaped_get_span_embedded_object(index: int) -> Variant#

Returns text embedded object key.

const func shaped_get_span_meta(index: int) -> Variant#

Returns text span metadata.

func shaped_set_span_update_font(opentype_features: Dictionary = {}) -> void#

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

func shaped_text_add_object(baseline: float = 0.0) -> bool#

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

func shaped_text_add_string(meta: Variant = null) -> bool#

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

func shaped_text_clear(rid: RID) -> void#

Clears text buffer (removes text and inline objects).

const func shaped_text_closest_character_pos(pos: int) -> int#

Returns composite character position closest to the pos.

const func shaped_text_draw(color: Color = Color(1, 1, 1, 1)) -> void#

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).

const func shaped_text_draw_outline(color: Color = Color(1, 1, 1, 1)) -> void#

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).

func shaped_text_fit_to_width(justification_flags: int = 3 enumTextServer.JustificationFlag) -> float#

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

const func shaped_text_get_ascent(shaped: RID) -> float#

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.

const func shaped_text_get_carets(position: int) -> Dictionary#

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

const func shaped_text_get_character_breaks(shaped: RID) -> PackedInt32Array#

Returns array of the composite character boundaries.

const func shaped_text_get_custom_ellipsis(shaped: RID) -> int#

Returns ellipsis character used for text clipping.

const func shaped_text_get_custom_punctuation(shaped: RID) -> String#

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

const func shaped_text_get_descent(shaped: RID) -> float#

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.

const func shaped_text_get_direction(shaped: RID) -> intTextServer.Direction#

Returns direction of the text.

const func shaped_text_get_dominant_direction_in_range(end: int) -> intTextServer.Direction#

Returns dominant direction of in the range of text.

const func shaped_text_get_ellipsis_glyph_count(shaped: RID) -> int#

Returns number of glyphs in the ellipsis.

const func shaped_text_get_ellipsis_glyphs(shaped: RID) -> Dictionary[]#

Returns array of the glyphs in the ellipsis.

const func shaped_text_get_ellipsis_pos(shaped: RID) -> int#

Returns position of the ellipsis.

const func shaped_text_get_glyph_count(shaped: RID) -> int#

Returns number of glyphs in the buffer.

const func shaped_text_get_glyphs(shaped: RID) -> Dictionary[]#

Returns an array of glyphs in the visual order.

const func shaped_text_get_grapheme_bounds(pos: int) -> Vector2#

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

const func shaped_text_get_inferred_direction(shaped: RID) -> intTextServer.Direction#

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

const func shaped_text_get_line_breaks(break_flags: int = 3 enumTextServer.LineBreakFlag) -> PackedInt32Array#

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

const func shaped_text_get_line_breaks_adv(break_flags: int = 3 enumTextServer.LineBreakFlag) -> PackedInt32Array#

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

const func shaped_text_get_object_glyph(key: Variant) -> int#

Returns the glyph index of the inline object.

const func shaped_text_get_object_range(key: Variant) -> Vector2i#

Returns the character range of the inline object.

const func shaped_text_get_object_rect(key: Variant) -> Rect2#

Returns bounding rectangle of the inline object.

const func shaped_text_get_objects(shaped: RID) -> Array#

Returns array of inline objects.

const func shaped_text_get_orientation(shaped: RID) -> intTextServer.Orientation#

Returns text orientation.

const func shaped_text_get_parent(shaped: RID) -> RID#

Returns the parent buffer from which the substring originates.

const func shaped_text_get_preserve_control(shaped: RID) -> bool#

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

const func shaped_text_get_preserve_invalid(shaped: RID) -> bool#

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

Note: If set to false, nothing is displayed in place of invalid characters.

const func shaped_text_get_range(shaped: RID) -> Vector2i#

Returns substring buffer character range in the parent buffer.

const func shaped_text_get_selection(end: int) -> PackedVector2Array#

Returns selection rectangles for the specified character range.

const func shaped_text_get_size(shaped: RID) -> Vector2#

Returns size of the text.

const func shaped_text_get_spacing(spacing: int enumTextServer.SpacingType) -> int#

Returns extra spacing added between glyphs or lines in pixels.

const func shaped_text_get_trim_pos(shaped: RID) -> int#

Returns the position of the overrun trim.

const func shaped_text_get_underline_position(shaped: RID) -> float#

Returns pixel offset of the underline below the baseline.

const func shaped_text_get_underline_thickness(shaped: RID) -> float#

Returns thickness of the underline.

const func shaped_text_get_width(shaped: RID) -> float#

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

const func shaped_text_get_word_breaks(skip_grapheme_flags: int = 4 enumTextServer.GraphemeFlag) -> PackedInt32Array#

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

const func shaped_text_has_visible_chars(shaped: RID) -> bool#

Returns true if text buffer contains any visible characters.

const func shaped_text_hit_test_grapheme(coords: float) -> int#

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

const func shaped_text_hit_test_position(coords: float) -> int#

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

const func shaped_text_is_ready(shaped: RID) -> bool#

Returns true if buffer is successfully shaped.

const func shaped_text_next_character_pos(pos: int) -> int#

Returns composite character end position closest to the pos.

const func shaped_text_next_grapheme_pos(pos: int) -> int#

Returns grapheme end position closest to the pos.

func shaped_text_overrun_trim_to_width(overrun_trim_flags: int = 0 enumTextServer.TextOverrunFlag) -> void#

Trims text if it exceeds the given width.

const func shaped_text_prev_character_pos(pos: int) -> int#

Returns composite character start position closest to the pos.

const func shaped_text_prev_grapheme_pos(pos: int) -> int#

Returns grapheme start position closest to the pos.

func shaped_text_resize_object(baseline: float = 0.0) -> bool#

Sets new size and alignment of embedded object.

func shaped_text_set_bidi_override(override: Array) -> void#

Overrides BiDi for the structured text.

Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.

func shaped_text_set_custom_ellipsis(char: int) -> void#

Sets ellipsis character used for text clipping.

func shaped_text_set_custom_punctuation(punct: String) -> void#

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

func shaped_text_set_direction(direction: int = 0 enumTextServer.Direction) -> void#

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

Note: Direction is ignored if server does not support FEATURE_BIDI_LAYOUT feature (supported by TextServerAdvanced).

func shaped_text_set_orientation(orientation: int = 0 enumTextServer.Orientation) -> void#

Sets desired text orientation.

Note: Orientation is ignored if server does not support FEATURE_VERTICAL_LAYOUT feature (supported by TextServerAdvanced).

func shaped_text_set_preserve_control(enabled: bool) -> void#

If set to true text buffer will display control characters.

func shaped_text_set_preserve_invalid(enabled: bool) -> void#

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

func shaped_text_set_spacing(value: int) -> void#

Sets extra spacing added between glyphs or lines in pixels.

func shaped_text_shape(shaped: RID) -> bool#

Shapes buffer if it's not shaped. Returns true 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.

func shaped_text_sort_logical(shaped: RID) -> Dictionary[]#

Returns text glyphs in the logical order.

const func shaped_text_substr(length: int) -> RID#

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

func shaped_text_tab_align(tab_stops: PackedFloat32Array) -> float#

Aligns shaped text to the given tab-stops.

const func spoof_check(string: String) -> bool#

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

Note: Always returns false if the server does not support the FEATURE_UNICODE_SECURITY feature.

const func string_get_character_breaks(language: String = "") -> PackedInt32Array#

Returns array of the composite character boundaries.

var ts = TextServerManager.get_primary_interface()
print(ts.string_get_character_breaks("Test ❤️‍🔥 Test")) # Prints [1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14]

const func string_get_word_breaks(chars_per_line: int = 0) -> PackedInt32Array#

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.

When chars_per_line is greater than zero, line break boundaries are returned instead.

var ts = TextServerManager.get_primary_interface()
# Corresponds to the substrings "The", "Godot", "Engine", and "4".
print(ts.string_get_word_breaks("The Godot Engine, 4")) # Prints [0, 3, 4, 9, 10, 16, 18, 19]
# Corresponds to the substrings "The", "Godot", "Engin", and "e, 4".
print(ts.string_get_word_breaks("The Godot Engine, 4", "en", 5)) # Prints [0, 3, 4, 9, 10, 15, 15, 19]
# Corresponds to the substrings "The Godot" and "Engine, 4".
print(ts.string_get_word_breaks("The Godot Engine, 4", "en", 10)) # Prints [0, 9, 10, 19]

const func string_to_lower(language: String = "") -> String#

Returns the string converted to lowercase.

Note: Casing is locale dependent and context sensitive if server support FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION feature (supported by TextServerAdvanced).

Note: The result may be longer or shorter than the original.

const func string_to_title(language: String = "") -> String#

Returns the string converted to title case.

Note: Casing is locale dependent and context sensitive if server support FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION feature (supported by TextServerAdvanced).

Note: The result may be longer or shorter than the original.

const func string_to_upper(language: String = "") -> String#

Returns the string converted to uppercase.

Note: Casing is locale dependent and context sensitive if server support FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION feature (supported by TextServerAdvanced).

Note: The result may be longer or shorter than the original.

const func strip_diacritics(string: String) -> String#

Strips diacritics from the string.

Note: The result may be longer or shorter than the original.

const func tag_to_name(tag: int) -> String#

Converts OpenType tag to readable feature, variation, script, or language name.

Annotations #

Constants #

const FONT_ANTIALIASING_NONE = 0 enum FontAntialiasing#

Font glyphs are rasterized as 1-bit bitmaps.

const FONT_ANTIALIASING_GRAY = 1 enum FontAntialiasing#

Font glyphs are rasterized as 8-bit grayscale anti-aliased bitmaps.

const FONT_ANTIALIASING_LCD = 2 enum FontAntialiasing#

Font glyphs are rasterized for LCD screens.

LCD subpixel layout is determined by the value of gui/theme/lcd_subpixel_layout project settings.

LCD subpixel anti-aliasing mode is suitable only for rendering horizontal, unscaled text in 2D.

const FONT_LCD_SUBPIXEL_LAYOUT_NONE = 0 enum FontLCDSubpixelLayout#

Unknown or unsupported subpixel layout, LCD subpixel antialiasing is disabled.

const FONT_LCD_SUBPIXEL_LAYOUT_HRGB = 1 enum FontLCDSubpixelLayout#

Horizontal RGB subpixel layout.

const FONT_LCD_SUBPIXEL_LAYOUT_HBGR = 2 enum FontLCDSubpixelLayout#

Horizontal BGR subpixel layout.

const FONT_LCD_SUBPIXEL_LAYOUT_VRGB = 3 enum FontLCDSubpixelLayout#

Vertical RGB subpixel layout.

const FONT_LCD_SUBPIXEL_LAYOUT_VBGR = 4 enum FontLCDSubpixelLayout#

Vertical BGR subpixel layout.

const FONT_LCD_SUBPIXEL_LAYOUT_MAX = 5 enum FontLCDSubpixelLayout#

Represents the size of the FontLCDSubpixelLayout enum.

const DIRECTION_AUTO = 0 enum Direction#

Text direction is determined based on contents and current locale.

const DIRECTION_LTR = 1 enum Direction#

Text is written from left to right.

const DIRECTION_RTL = 2 enum Direction#

Text is written from right to left.

const DIRECTION_INHERITED = 3 enum Direction#

Text writing direction is the same as base string writing direction. Used for BiDi override only.

const ORIENTATION_HORIZONTAL = 0 enum Orientation#

Text is written horizontally.

const ORIENTATION_VERTICAL = 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.

const JUSTIFICATION_NONE = 0 enum JustificationFlag
Bitfield
#

Do not justify text.

const JUSTIFICATION_KASHIDA = 1 enum JustificationFlag
Bitfield
#

Justify text by adding and removing kashidas.

const JUSTIFICATION_WORD_BOUND = 2 enum JustificationFlag
Bitfield
#

Justify text by changing width of the spaces between the words.

const JUSTIFICATION_TRIM_EDGE_SPACES = 4 enum JustificationFlag
Bitfield
#

Remove trailing and leading spaces from the justified text.

const JUSTIFICATION_AFTER_LAST_TAB = 8 enum JustificationFlag
Bitfield
#

Only apply justification to the part of the text after the last tab.

const JUSTIFICATION_CONSTRAIN_ELLIPSIS = 16 enum JustificationFlag
Bitfield
#

Apply justification to the trimmed line with ellipsis.

const JUSTIFICATION_SKIP_LAST_LINE = 32 enum JustificationFlag
Bitfield
#

Do not apply justification to the last line of the paragraph.

const JUSTIFICATION_SKIP_LAST_LINE_WITH_VISIBLE_CHARS = 64 enum JustificationFlag
Bitfield
#

Do not apply justification to the last line of the paragraph with visible characters (takes precedence over JUSTIFICATION_SKIP_LAST_LINE).

const JUSTIFICATION_DO_NOT_SKIP_SINGLE_LINE = 128 enum JustificationFlag
Bitfield
#

Always apply justification to the paragraphs with a single line (JUSTIFICATION_SKIP_LAST_LINE and JUSTIFICATION_SKIP_LAST_LINE_WITH_VISIBLE_CHARS are ignored).

const AUTOWRAP_OFF = 0 enum AutowrapMode#

Autowrap is disabled.

const AUTOWRAP_ARBITRARY = 1 enum AutowrapMode#

Wraps the text inside the node's bounding rectangle by allowing to break lines at arbitrary positions, which is useful when very limited space is available.

const AUTOWRAP_WORD = 2 enum AutowrapMode#

Wraps the text inside the node's bounding rectangle by soft-breaking between words.

const AUTOWRAP_WORD_SMART = 3 enum AutowrapMode#

Behaves similarly to AUTOWRAP_WORD, but force-breaks a word if that single word does not fit in one line.

const BREAK_NONE = 0 enum LineBreakFlag
Bitfield
#

Do not break the line.

const BREAK_MANDATORY = 1 enum LineBreakFlag
Bitfield
#

Break the line at the line mandatory break characters (e.g. "\n").

const BREAK_WORD_BOUND = 2 enum LineBreakFlag
Bitfield
#

Break the line between the words.

const BREAK_GRAPHEME_BOUND = 4 enum LineBreakFlag
Bitfield
#

Break the line between any unconnected graphemes.

const BREAK_ADAPTIVE = 8 enum LineBreakFlag
Bitfield
#

Should be used only in conjunction with BREAK_WORD_BOUND, break the line between any unconnected graphemes, if it's impossible to break it between the words.

const BREAK_TRIM_EDGE_SPACES = 16 enum LineBreakFlag
Bitfield
#

Remove edge spaces from the broken line segments.

const BREAK_TRIM_INDENT = 32 enum LineBreakFlag
Bitfield
#

Subtract first line indentation width from all lines after the first one.

const VC_CHARS_BEFORE_SHAPING = 0 enum VisibleCharactersBehavior#

Trims text before the shaping. e.g, increasing Label.visible_characters or RichTextLabel.visible_characters value is visually identical to typing the text.

Note: In this mode, trimmed text is not processed at all. It is not accounted for in line breaking and size calculations.

const VC_CHARS_AFTER_SHAPING = 1 enum VisibleCharactersBehavior#

Displays glyphs that are mapped to the first Label.visible_characters or RichTextLabel.visible_characters characters from the beginning of the text.

const VC_GLYPHS_AUTO = 2 enum VisibleCharactersBehavior#

Displays Label.visible_ratio or RichTextLabel.visible_ratio glyphs, starting from the left or from the right, depending on Control.layout_direction value.

const VC_GLYPHS_LTR = 3 enum VisibleCharactersBehavior#

Displays Label.visible_ratio or RichTextLabel.visible_ratio glyphs, starting from the left.

const VC_GLYPHS_RTL = 4 enum VisibleCharactersBehavior#

Displays Label.visible_ratio or RichTextLabel.visible_ratio glyphs, starting from the right.

const OVERRUN_NO_TRIMMING = 0 enum OverrunBehavior#

No text trimming is performed.

const OVERRUN_TRIM_CHAR = 1 enum OverrunBehavior#

Trims the text per character.

const OVERRUN_TRIM_WORD = 2 enum OverrunBehavior#

Trims the text per word.

const OVERRUN_TRIM_ELLIPSIS = 3 enum OverrunBehavior#

Trims the text per character and adds an ellipsis to indicate that parts are hidden.

const OVERRUN_TRIM_WORD_ELLIPSIS = 4 enum OverrunBehavior#

Trims the text per word and adds an ellipsis to indicate that parts are hidden.

const OVERRUN_NO_TRIM = 0 enum TextOverrunFlag
Bitfield
#

No trimming is performed.

const OVERRUN_TRIM = 1 enum TextOverrunFlag
Bitfield
#

Trims the text when it exceeds the given width.

const OVERRUN_TRIM_WORD_ONLY = 2 enum TextOverrunFlag
Bitfield
#

Trims the text per word instead of per grapheme.

const OVERRUN_ADD_ELLIPSIS = 4 enum TextOverrunFlag
Bitfield
#

Determines whether an ellipsis should be added at the end of the text.

const OVERRUN_ENFORCE_ELLIPSIS = 8 enum TextOverrunFlag
Bitfield
#

Determines whether the ellipsis at the end of the text is enforced and may not be hidden.

const OVERRUN_JUSTIFICATION_AWARE = 16 enum TextOverrunFlag
Bitfield
#

Accounts for the text being justified before attempting to trim it (see JustificationFlag).

const GRAPHEME_IS_VALID = 1 enum GraphemeFlag
Bitfield
#

Grapheme is supported by the font, and can be drawn.

const GRAPHEME_IS_RTL = 2 enum GraphemeFlag
Bitfield
#

Grapheme is part of right-to-left or bottom-to-top run.

const GRAPHEME_IS_VIRTUAL = 4 enum GraphemeFlag
Bitfield
#

Grapheme is not part of source text, it was added by justification process.

const GRAPHEME_IS_SPACE = 8 enum GraphemeFlag
Bitfield
#

Grapheme is whitespace.

const GRAPHEME_IS_BREAK_HARD = 16 enum GraphemeFlag
Bitfield
#

Grapheme is mandatory break point (e.g. "\n").

const GRAPHEME_IS_BREAK_SOFT = 32 enum GraphemeFlag
Bitfield
#

Grapheme is optional break point (e.g. space).

const GRAPHEME_IS_TAB = 64 enum GraphemeFlag
Bitfield
#

Grapheme is the tabulation character.

const GRAPHEME_IS_ELONGATION = 128 enum GraphemeFlag
Bitfield
#

Grapheme is kashida.

const GRAPHEME_IS_PUNCTUATION = 256 enum GraphemeFlag
Bitfield
#

Grapheme is punctuation character.

const GRAPHEME_IS_UNDERSCORE = 512 enum GraphemeFlag
Bitfield
#

Grapheme is underscore character.

const GRAPHEME_IS_CONNECTED = 1024 enum GraphemeFlag
Bitfield
#

Grapheme is connected to the previous grapheme. Breaking line before this grapheme is not safe.

const GRAPHEME_IS_SAFE_TO_INSERT_TATWEEL = 2048 enum GraphemeFlag
Bitfield
#

It is safe to insert a U+0640 before this grapheme for elongation.

const GRAPHEME_IS_EMBEDDED_OBJECT = 4096 enum GraphemeFlag
Bitfield
#

Grapheme is an object replacement character for the embedded object.

const GRAPHEME_IS_SOFT_HYPHEN = 8192 enum GraphemeFlag
Bitfield
#

Grapheme is a soft hyphen.

const HINTING_NONE = 0 enum Hinting#

Disables font hinting (smoother but less crisp).

const HINTING_LIGHT = 1 enum Hinting#

Use the light font hinting mode.

const HINTING_NORMAL = 2 enum Hinting#

Use the default font hinting mode (crisper but less smooth).

Note: This hinting mode changes both horizontal and vertical glyph metrics. If applied to monospace font, some glyphs might have different width.

const SUBPIXEL_POSITIONING_DISABLED = 0 enum SubpixelPositioning#

Glyph horizontal position is rounded to the whole pixel size, each glyph is rasterized once.

const SUBPIXEL_POSITIONING_AUTO = 1 enum SubpixelPositioning#

Glyph horizontal position is rounded based on font size.

- To one quarter of the pixel size if font size is smaller or equal to SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE.

- To one half of the pixel size if font size is smaller or equal to SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE.

- To the whole pixel size for larger fonts.

const SUBPIXEL_POSITIONING_ONE_HALF = 2 enum SubpixelPositioning#

Glyph horizontal position is rounded to one half of the pixel size, each glyph is rasterized up to two times.

const SUBPIXEL_POSITIONING_ONE_QUARTER = 3 enum SubpixelPositioning#

Glyph horizontal position is rounded to one quarter of the pixel size, each glyph is rasterized up to four times.

const SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE = 20 enum SubpixelPositioning#

Maximum font size which will use one half of the pixel subpixel positioning in SUBPIXEL_POSITIONING_AUTO mode.

const SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE = 16 enum SubpixelPositioning#

Maximum font size which will use one quarter of the pixel subpixel positioning in SUBPIXEL_POSITIONING_AUTO mode.

const FEATURE_SIMPLE_LAYOUT = 1 enum Feature#

TextServer supports simple text layouts.

const FEATURE_BIDI_LAYOUT = 2 enum Feature#

TextServer supports bidirectional text layouts.

const FEATURE_VERTICAL_LAYOUT = 4 enum Feature#

TextServer supports vertical layouts.

const FEATURE_SHAPING = 8 enum Feature#

TextServer supports complex text shaping.

const FEATURE_KASHIDA_JUSTIFICATION = 16 enum Feature#

TextServer supports justification using kashidas.

const FEATURE_BREAK_ITERATORS = 32 enum Feature#

TextServer supports complex line/word breaking rules (e.g. dictionary based).

const FEATURE_FONT_BITMAP = 64 enum Feature#

TextServer supports loading bitmap fonts.

const FEATURE_FONT_DYNAMIC = 128 enum Feature#

TextServer supports loading dynamic (TrueType, OpeType, etc.) fonts.

const FEATURE_FONT_MSDF = 256 enum Feature#

TextServer supports multichannel signed distance field dynamic font rendering.

const FEATURE_FONT_SYSTEM = 512 enum Feature#

TextServer supports loading system fonts.

const FEATURE_FONT_VARIABLE = 1024 enum Feature#

TextServer supports variable fonts.

const FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION = 2048 enum Feature#

TextServer supports locale dependent and context sensitive case conversion.

const FEATURE_USE_SUPPORT_DATA = 4096 enum Feature#

TextServer require external data file for some features, see load_support_data.

const FEATURE_UNICODE_IDENTIFIERS = 8192 enum Feature#

TextServer supports UAX #31 identifier validation, see is_valid_identifier.

const FEATURE_UNICODE_SECURITY = 16384 enum Feature#

TextServer supports Unicode Technical Report #36 and Unicode Technical Standard #39 based spoof detection features.

const CONTOUR_CURVE_TAG_ON = 1 enum ContourPointTag#

Contour point is on the curve.

const CONTOUR_CURVE_TAG_OFF_CONIC = 0 enum ContourPointTag#

Contour point isn't on the curve, but serves as a control point for a conic (quadratic) Bézier arc.

const CONTOUR_CURVE_TAG_OFF_CUBIC = 2 enum ContourPointTag#

Contour point isn't on the curve, but serves as a control point for a cubic Bézier arc.

const SPACING_GLYPH = 0 enum SpacingType#

Spacing for each glyph.

const SPACING_SPACE = 1 enum SpacingType#

Spacing for the space character.

const SPACING_TOP = 2 enum SpacingType#

Spacing at the top of the line.

const SPACING_BOTTOM = 3 enum SpacingType#

Spacing at the bottom of the line.

const SPACING_MAX = 4 enum SpacingType#

Represents the size of the SpacingType enum.

const FONT_BOLD = 1 enum FontStyle
Bitfield
#

Font is bold.

const FONT_ITALIC = 2 enum FontStyle
Bitfield
#

Font is italic or oblique.

const FONT_FIXED_WIDTH = 4 enum FontStyle
Bitfield
#

Font have fixed-width characters.

const STRUCTURED_TEXT_DEFAULT = 0 enum StructuredTextParser#

Use default Unicode BiDi algorithm.

const STRUCTURED_TEXT_URI = 1 enum StructuredTextParser#

BiDi override for URI.

const STRUCTURED_TEXT_FILE = 2 enum StructuredTextParser#

BiDi override for file path.

const STRUCTURED_TEXT_EMAIL = 3 enum StructuredTextParser#

BiDi override for email.

const STRUCTURED_TEXT_LIST = 4 enum StructuredTextParser#

BiDi override for lists. Structured text options: list separator String.

const STRUCTURED_TEXT_GDSCRIPT = 5 enum StructuredTextParser#

BiDi override for GDScript.

const STRUCTURED_TEXT_CUSTOM = 6 enum StructuredTextParser#

User defined structured text BiDi override function.

const FIXED_SIZE_SCALE_DISABLE = 0 enum FixedSizeScaleMode#

Bitmap font is not scaled.

const FIXED_SIZE_SCALE_INTEGER_ONLY = 1 enum FixedSizeScaleMode#

Bitmap font is scaled to the closest integer multiple of the font's fixed size. This is the recommended option for pixel art fonts.

const FIXED_SIZE_SCALE_ENABLED = 2 enum FixedSizeScaleMode#

Bitmap font is scaled to an arbitrary (fractional) size. This is the recommended option for non-pixel art fonts.

Constructors #

Enums #

FontAntialiasing#

enum FontAntialiasing { FONT_ANTIALIASING_NONE = 0, FONT_ANTIALIASING_GRAY = 1, FONT_ANTIALIASING_LCD = 2, }

FontLCDSubpixelLayout#

enum FontLCDSubpixelLayout { FONT_LCD_SUBPIXEL_LAYOUT_NONE = 0, FONT_LCD_SUBPIXEL_LAYOUT_HRGB = 1, FONT_LCD_SUBPIXEL_LAYOUT_HBGR = 2, FONT_LCD_SUBPIXEL_LAYOUT_VRGB = 3, FONT_LCD_SUBPIXEL_LAYOUT_VBGR = 4, FONT_LCD_SUBPIXEL_LAYOUT_MAX = 5, }

Direction#

enum Direction { DIRECTION_AUTO = 0, DIRECTION_LTR = 1, DIRECTION_RTL = 2, DIRECTION_INHERITED = 3, }

Orientation#

enum Orientation { ORIENTATION_HORIZONTAL = 0, ORIENTATION_VERTICAL = 1, }

JustificationFlag#

enum JustificationFlag { JUSTIFICATION_NONE = 0, JUSTIFICATION_KASHIDA = 1, JUSTIFICATION_WORD_BOUND = 2, JUSTIFICATION_TRIM_EDGE_SPACES = 4, JUSTIFICATION_AFTER_LAST_TAB = 8, JUSTIFICATION_CONSTRAIN_ELLIPSIS = 16, JUSTIFICATION_SKIP_LAST_LINE = 32, JUSTIFICATION_SKIP_LAST_LINE_WITH_VISIBLE_CHARS = 64, JUSTIFICATION_DO_NOT_SKIP_SINGLE_LINE = 128, }

AutowrapMode#

enum AutowrapMode { AUTOWRAP_OFF = 0, AUTOWRAP_ARBITRARY = 1, AUTOWRAP_WORD = 2, AUTOWRAP_WORD_SMART = 3, }

LineBreakFlag#

enum LineBreakFlag { BREAK_NONE = 0, BREAK_MANDATORY = 1, BREAK_WORD_BOUND = 2, BREAK_GRAPHEME_BOUND = 4, BREAK_ADAPTIVE = 8, BREAK_TRIM_EDGE_SPACES = 16, BREAK_TRIM_INDENT = 32, }

VisibleCharactersBehavior#

enum VisibleCharactersBehavior { VC_CHARS_BEFORE_SHAPING = 0, VC_CHARS_AFTER_SHAPING = 1, VC_GLYPHS_AUTO = 2, VC_GLYPHS_LTR = 3, VC_GLYPHS_RTL = 4, }

OverrunBehavior#

enum OverrunBehavior { OVERRUN_NO_TRIMMING = 0, OVERRUN_TRIM_CHAR = 1, OVERRUN_TRIM_WORD = 2, OVERRUN_TRIM_ELLIPSIS = 3, OVERRUN_TRIM_WORD_ELLIPSIS = 4, }

TextOverrunFlag#

enum TextOverrunFlag { OVERRUN_NO_TRIM = 0, OVERRUN_TRIM = 1, OVERRUN_TRIM_WORD_ONLY = 2, OVERRUN_ADD_ELLIPSIS = 4, OVERRUN_ENFORCE_ELLIPSIS = 8, OVERRUN_JUSTIFICATION_AWARE = 16, }

GraphemeFlag#

enum GraphemeFlag { GRAPHEME_IS_VALID = 1, GRAPHEME_IS_RTL = 2, GRAPHEME_IS_VIRTUAL = 4, GRAPHEME_IS_SPACE = 8, GRAPHEME_IS_BREAK_HARD = 16, GRAPHEME_IS_BREAK_SOFT = 32, GRAPHEME_IS_TAB = 64, GRAPHEME_IS_ELONGATION = 128, GRAPHEME_IS_PUNCTUATION = 256, GRAPHEME_IS_UNDERSCORE = 512, GRAPHEME_IS_CONNECTED = 1024, GRAPHEME_IS_SAFE_TO_INSERT_TATWEEL = 2048, GRAPHEME_IS_EMBEDDED_OBJECT = 4096, GRAPHEME_IS_SOFT_HYPHEN = 8192, }

Hinting#

enum Hinting { HINTING_NONE = 0, HINTING_LIGHT = 1, HINTING_NORMAL = 2, }

SubpixelPositioning#

enum SubpixelPositioning { SUBPIXEL_POSITIONING_DISABLED = 0, SUBPIXEL_POSITIONING_AUTO = 1, SUBPIXEL_POSITIONING_ONE_HALF = 2, SUBPIXEL_POSITIONING_ONE_QUARTER = 3, SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE = 20, SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE = 16, }

Feature#

enum Feature { FEATURE_SIMPLE_LAYOUT = 1, FEATURE_BIDI_LAYOUT = 2, FEATURE_VERTICAL_LAYOUT = 4, FEATURE_SHAPING = 8, FEATURE_KASHIDA_JUSTIFICATION = 16, FEATURE_BREAK_ITERATORS = 32, FEATURE_FONT_BITMAP = 64, FEATURE_FONT_DYNAMIC = 128, FEATURE_FONT_MSDF = 256, FEATURE_FONT_SYSTEM = 512, FEATURE_FONT_VARIABLE = 1024, FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION = 2048, FEATURE_USE_SUPPORT_DATA = 4096, FEATURE_UNICODE_IDENTIFIERS = 8192, FEATURE_UNICODE_SECURITY = 16384, }

ContourPointTag#

enum ContourPointTag { CONTOUR_CURVE_TAG_ON = 1, CONTOUR_CURVE_TAG_OFF_CONIC = 0, CONTOUR_CURVE_TAG_OFF_CUBIC = 2, }

SpacingType#

enum SpacingType { SPACING_GLYPH = 0, SPACING_SPACE = 1, SPACING_TOP = 2, SPACING_BOTTOM = 3, SPACING_MAX = 4, }

FontStyle#

enum FontStyle { FONT_BOLD = 1, FONT_ITALIC = 2, FONT_FIXED_WIDTH = 4, }

StructuredTextParser#

enum StructuredTextParser { STRUCTURED_TEXT_DEFAULT = 0, STRUCTURED_TEXT_URI = 1, STRUCTURED_TEXT_FILE = 2, STRUCTURED_TEXT_EMAIL = 3, STRUCTURED_TEXT_LIST = 4, STRUCTURED_TEXT_GDSCRIPT = 5, STRUCTURED_TEXT_CUSTOM = 6, }

FixedSizeScaleMode#

enum FixedSizeScaleMode { FIXED_SIZE_SCALE_DISABLE = 0, FIXED_SIZE_SCALE_INTEGER_ONLY = 1, FIXED_SIZE_SCALE_ENABLED = 2, }

Operators #

Signals #

Theme Items #

Tutorials #