Base class for TextServer custom implementations (plugins).
External TextServer implementations should inherit from this class.
Creates new, empty font cache entry resource. To free the resulting resourec, use [method free_rid] method.
Creates new buffer for complex text layout, with the given [code]direction[/code] and [code]orientation[/code]. To free the resulting buffer, use [method free_rid] method.
Draws box displaying character hexadecimal code. Used for replacing missing characters.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Removes all rendered glyphs information from the cache entry.
Removes all kerning overrides.
Removes all font sizes from the cache entry.
Removes all textures from font cache entry.
Draws single glyph into a canvas item at the position, using [code]font_rid[/code] at the size [code]size[/code].
Draws single glyph outline of size [code]outline_size[/code] into a canvas item at the position, using [code]font_rid[/code] at the size [code]size[/code].
Returns the font ascent (number of pixels above the baseline).
Returns the font descent (number of pixels below the baseline).
Returns font embolden strength.
Returns number of faces in the TrueType / OpenType collection.
Returns an active face index in the TrueType / OpenType collection.
Returns bitmap font fixed size.
Returns [code]true[/code] if font texture mipmap generation is enabled.
Returns the font oversampling factor, shared by all fonts in the TextServer.
Returns glyph advance (offset of the next glyph).
Returns outline contours of the glyph as a [code]Dictionary[/code] with the following contents:
[code]points[/code] - [PackedVector3Array], containing outline points. [code]x[/code] and [code]y[/code] are point coordinates. [code]z[/code] is the type of the point, using the [enum TextServer.ContourPointTag] values.
[code]contours[/code] - [PackedInt32Array], containing indices the end points of each contour.
[code]orientation[/code] - [bool], contour orientation. If [code]true[/code], clockwise contours must be filled.
Returns the glyph index of a [code]char[/code], optionally modified by the [code]variation_selector[/code].
Returns list of rendered glyphs in the cache entry.
Returns glyph offset from the baseline.
Returns size of the glyph.
Returns index of the cache texture containing the glyph.
Returns resource id of the cache texture containing the glyph.
Returns size of the cache texture containing the glyph.
Returns rectangle in the cache texture containing the glyph.
Returns the font hinting mode. Used by dynamic fonts only.
Returns kerning for the pair of glyphs.
Returns list of the kerning overrides.
Returns [code]true[/code] if support override is enabled for the [code]language[/code].
Returns list of language support overrides.
Returns the width of the range around the shape between the minimum and maximum representable signed distance.
Returns source font size used to generate MSDF textures.
Returns font family name.
Returns font OpenType feature set override.
Returns font oversampling factor, if set to [code]0.0[/code] global oversampling factor is used instead. Used by dynamic fonts only.
Returns scaling factor of the color bitmap font.
Returns [code]true[/code] if support override is enabled for the [code]script[/code].
Returns list of script support overrides.
Returns list of the font sizes in the cache. Each size is [code]Vector2i[/code] with font size and outline size.
Returns extra spacing added between glyphs in pixels.
Returns font style flags, see [enum TextServer.FontStyle].
Returns font style name.
Returns font sub-pixel glyph positioning mode.
Returns a string containing all the characters available in the font.
Returns number of textures used by font cache entry.
Returns font cache texture image data.
Returns array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty.
Returns 2D transform applied to the font outlines.
Returns pixel offset of the underline below the baseline.
Returns thickness of the underline in pixels.
Returns variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info.
Returns [code]true[/code] if a Unicode [code]char[/code] is available in the font.
Returns [code]true[/code] if font 8-bit anitialiased glyph rendering is supported and enabled.
Returns [code]true[/code] if auto-hinting is supported and preferred over font built-in hinting. Used by dynamic fonts only.
Returns [code]true[/code], if font supports given language ([url=https://en.wikipedia.org/wiki/ISO_639-1]ISO 639[/url] code).
Returns [code]true[/code] if glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
Returns [code]true[/code], if font supports given script (ISO 15924 code).
Removes specified rendered glyph information from the cache entry.
Removes kerning override for the pair of glyphs.
Remove language support override.
Removes script support override.
Removes specified font size from the cache entry.
Removes specified texture from font cache entry.
Renders specified glyph to the font cache texture.
Renders the range of characters to the font cache texture.
If set to [code]true[/code], 8-bit antialiased glyph rendering is used, otherwise 1-bit rendering is used. Used by dynamic fonts only.
Sets the font ascent (number of pixels above the baseline).
Sets font source data, e.g contents of the dynamic font source file.
Sets font source data, e.g contents of the dynamic font source file. [code]data_ptr[/code] memory buffer must remain accessible during font lifetime.
Sets the font descent (number of pixels below the baseline).
Sets font embolden strength. If [code]strength[/code] is not equal to zero, emboldens the font outlines. Negative values reduce the outline thickness.
Sets an active face index in the TrueType / OpenType collection.
Sets bitmap font fixed size. If set to value greater than zero, same cache entry will be used for all font sizes.
If set to [code]true[/code] auto-hinting is preferred over font built-in hinting.
If set to [code]true[/code] font texture mipmap generation is enabled.
Sets oversampling factor, shared by all font in the TextServer.
[b]Note:[/b] This value can be automatically changed by display server.
Sets glyph advance (offset of the next glyph).
Sets glyph offset from the baseline.
Sets size of the glyph.
Sets index of the cache texture containing the glyph.
Sets rectangle in the cache texture containing the glyph.
Sets font hinting mode. Used by dynamic fonts only.
Sets kerning for the pair of glyphs.
Adds override for [method font_is_language_supported].
Sets the width of the range around the shape between the minimum and maximum representable signed distance.
Sets source font size used to generate MSDF textures.
If set to [code]true[/code], glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. 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.
[b]Note:[/b] 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.
Sets the font family name.
Sets font OpenType feature set override.
Sets font oversampling factor, if set to [code]0.0[/code] global oversampling factor is used instead. Used by dynamic fonts only.
Sets scaling factor of the color bitmap font.
Adds override for [method font_is_script_supported].
Sets extra spacing added between glyphs in pixels.
Sets the font style flags, see [enum TextServer.FontStyle].
Sets the font style name.
Sets font sub-pixel glyph positioning mode.
Sets font cache texture image data.
Sets array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty.
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 [code]Transform2D(1.0, slant, 0.0, 1.0, 0.0, 0.0)[/code].
Sets pixel offset of the underline below the baseline.
Sets thickness of the underline in pixels.
Sets variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info.
Returns the dictionary of the supported OpenType features.
Returns the dictionary of the supported OpenType variation coordinates.
Converts a number from the Western Arabic (0..9) to the numeral systems used in [code]language[/code].
Frees an object created by this [TextServer].
Returns text server features, see [enum TextServer.Feature].
Returns size of the replacement character (box with character hexadecimal code that is drawn in place of invalid characters).
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Returns the name of the server interface.
Returns default TextServer database (e.g. ICU break iterators and dictionaries) filename.
Returns TextServer database (e.g. ICU break iterators and dictionaries) description.
Returns [code]true[/code] if [code]rid[/code] is valid resource owned by this text server.
Returns [code]true[/code] if the server supports a feature.
Returns [code]true[/code] if locale is right-to-left.
Loads optional TextServer database (e.g. ICU break iterators and dictionaries).
Converts readable feature, variation, script or language name to OpenType tag.
Converts a number from the numeral systems used in [code]language[/code] to Western Arabic (0..9).
Returns percent sign used in the [code]language[/code].
Saves optional TextServer database (e.g. ICU break iterators and dictionaries) to the file.
[b]Note:[/b] This function is used by during project export, to include TextServer database.
Returns number of text spans added using [method shaped_text_add_string] or [method shaped_text_add_object].
Returns text span metadata.
Changes text span font, font size and OpenType features, without changing the text.
Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters.
Adds text span and font to draw it to the text buffer.
Clears text buffer (removes text and inline objects).
Draw shaped text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout).
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Draw the outline of the shaped text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout).
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Adjusts text with to fit to specified width, returns new text width.
Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
Returns shapes of the carets corresponding to the character offset [code]position[/code] in the text. Returned caret shape is 1 pixel wide rectangle.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Returns custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.
Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
Returns direction of the text.
Returns dominant direction of in the range of text.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Returns number of glyphs in the ellipsis.
Returns array of the glyphs in the ellipsis.
Returns position of the ellipsis.
Returns number of glyphs in the buffer.
Returns an array of glyphs in the visual order.
Returns composite character's bounds as offsets from the start of the line.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Returns direction of the text, inferred by the BiDi algorithm.
Breaks text to the lines and returns character ranges for each line.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Breaks text to the lines and columns. Returns character ranges for each segment.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Returns bounding rectangle of the inline object.
Returns array of inline objects.
eturns text orientation.
Returns the parent buffer from which the substring originates.
Returns [code]true[/code] if text buffer is configured to display control characters.
Returns [code]true[/code] if text buffer is configured to display hexadecimal codes in place of invalid characters.
[b]Note:[/b] If set to [code]false[/code], nothing is displayed in place of invalid characters.
Returns substring buffer character range in the parent buffer.
Returns selection rectangles for the specified character range.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Returns size of the text.
Returns the position of the overrun trim.
Returns pixel offset of the underline below the baseline.
Returns thickness of the underline.
Returns width (for horizontal layout) or height (for vertical) of the text.
Breaks text into words and returns array of character ranges.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Returns grapheme index at the specified pixel offset at the baseline, or [code]-1[/code] if none is found.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Returns [code]true[/code] if buffer is successfully shaped.
Returns composite character end position closest to the [code]pos[/code].
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Trims text if it exceeds the given width.
Returns composite character start position closest to the [code]pos[/code].
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Sets new size and alignment of embedded object.
Overrides BiDi for the structured text.
Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.
Sets custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.
Sets desired text direction. If set to [code]TEXT_DIRECTION_AUTO[/code], direction will be detected based on the buffer contents and current locale.
Sets desired text orientation.
If set to [code]true[/code] text buffer will display control characters.
If set to [code]true[/code] text buffer will display invalid characters as hexadecimal codes, otherwise nothing is displayed.
Shapes buffer if it's not shaped. Returns [code]true[/code] if the string is shaped successfully.
Returns text glyphs in the logical order.
Returns text buffer for the substring of the text in the [code]shaped[/code] text buffer (including inline objects).
Aligns shaped text to the given tab-stops.
Updates line breaking positions in the text buffer.
[b]Note:[/b] This method is used by default line/word breaking methods, and its implementation might be omitted if custom line breaking in implemented.
Updates line justification positions (word breaks and elongations) in the text buffer.
[b]Note:[/b] This method is used by default line/word breaking methods, and its implementation might be omitted if custom line breaking in implemented.
Returns array of the word break character offsets.
Returns the string converted to lowercase.
Returns the string converted to uppercase.
Strips diacritics from the string.
[b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used.
Converts OpenType tag to readable feature, variation, script or language name.