Interface for the fonts and complex text layouts.
[TextServer] is the API backend for managing fonts, and rendering complex text.
Creates new font from the data in memory. To free the resulting font, use [method free_rid] method.
Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method font_get_base_size] to check actual font size.
Creates new font from the file. To free the resulting font, use [method free_rid] method.
Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method font_get_base_size] to check actual font size.
Creates new font from the system font. To free the resulting font, use [method free_rid] method.
Note: This method is supported by servers with the [code]FEATURE_FONT_SYSTEM[/code] feature.
Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method font_get_base_size] to check actual font size.
Creates new buffer for complex text layout, with the given [code]direction[/code] and [code]orientation[/code]. To free the resulting buffer, use [method free_rid] method.
Note: Direction is ignored if server does not support [code]FEATURE_BIDI_LAYOUT[/code] feature.
Note: Orientation is ignored if server does not support [code]FEATURE_VERTICAL_LAYOUT[/code] feature.
Draws box displaying character hexadecimal code. Used for replacing missing characters.
Draws single glyph into a canvas item at the position, using [code]font[/code] at the size [code]size[/code].
Note: Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index].
Draws single glyph outline of size [code]outline_size[/code] into a canvas item at the position, using [code]font[/code] at the size [code]size[/code].
Note: Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index].
Returns [code]true[/code], if font anti-aliasing is supported and enabled.
Returns the font ascent (number of pixels above the baseline).
Returns the default size of the font.
Returns the font descent (number of pixels below the baseline).
Returns [code]true[/code], if distance field hint is enabled.
Returns list of OpenType features supported by font.
Returns [code]true[/code], if autohinter is supported and enabled.
Returns advance of the glyph.
Returns the glyph index of a [code]char[/code], optionally modified by the [code]variation_selector[/code].
Returns a kerning of the pair of glyphs.
Returns the total font height (ascent plus descent) in pixels.
Returns the font hinting.
Returns [code]true[/code] if support override is enabled for the [code]language[/code].
Returns list of language support overrides.
Returns the font oversampling factor, shared by all fonts in the TextServer.
Returns [code]true[/code] if support override is enabled for the [code]script[/code].
Returns list of script support overrides.
Returns a string containing all the characters available in the font.
Returns underline offset (number of pixels below the baseline).
Returns underline thickness in pixels.
Returns variation coordinate [code]tag[/code].
Returns list of supported [url=https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg]variation coordinates[/url], each coordinate is returned as [code]tag: Vector3i(min_value,max_value,default_value)[/code].
Font variations allow for continuous change of glyph characteristics along some given design axis, such as weight, width or slant.
Returns [code]true[/code] if [code]char[/code] is available in the font.
Returns [code]true[/code], if font supports glyph outlines.
Returns [code]true[/code], if font supports given language (ISO 639 code).
Returns [code]true[/code], if font supports given script (ISO 15924 code).
Remove language support override.
Removes script support override.
Sets font anti-aliasing.
Sets font distance field hint.
Enables/disables default autohinter.
Sets font hinting.
Adds override for [method font_is_language_supported].
Sets oversampling factor, shared by all font in the TextServer.
Adds override for [method font_is_script_supported].
Sets variation coordinate [code]name[/code]. Unsupported coordinates will be silently ignored.
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 size of the replacement character (box with character hexadecimal code that is drawn in place of invalid characters).
Returns the name of the server interface.
Returns list of available system fonts.
Note: This method is supported by servers with the [code]FEATURE_FONT_SYSTEM[/code] feature.
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).
Note: This function should be called before any other TextServer functions used, otherwise it won't have any effect.
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].
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).
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).
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).
Note: overall ascent can be higher than font ascent, if some glyphs are displaced from the baseline.
Returns shapes of the carets corresponding to the character offset [code]position[/code] in the text. Returned caret shape is 1 pixel wide rectangle.
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.
Returns direction of the text.
Returns dominant direction of in the range of text.
Returns text glyphs.
Breaks text to the lines and returns character ranges for each line.
Breaks text to the lines and columns. Returns character ranges for each segment.
Returns bounding rectangle of the inline object.
Returns array of inline objects.
Returns text orientation.
Sets text orientation.
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.
Note: 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.
Returns size of the text.
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.
Returns grapheme index at the specified pixel offset at the baseline, or [code]-1[/code] if none is found.
Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
Returns [code]true[/code] if buffer is successfully shaped.
Returns composite character end position closest to the [code]pos[/code].
Returns composite character start position closest to the [code]pos[/code].
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 desired text direction. If set to [code]TEXT_DIRECTION_AUTO[/code], direction will be detected based on the buffer contents and current locale.
Note: Direction is ignored if server does not support [code]FEATURE_BIDI_LAYOUT[/code] feature.
Sets desired text orientation.
Note: Orientation is ignored if server does not support [code]FEATURE_VERTICAL_LAYOUT[/code] feature.
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.
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.
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.
Converts OpenType tag to readable feature, variation, script or language name.
Text direction is determined based on contents and current locale.
Text is written from left to right.
Text is written from right to left.
Text is written horizontally.
Left to right text is written vertically from top to bottom.
Right to left text is written vertically from bottom to top.
Do not justify text.
Justify text by adding and removing kashidas.
Justify text by changing width of the spaces between the words.
Remove trailing and leading spaces from the justified text.
Only apply justification to the part of the text after the last tab.
Do not break the line.
Break the line at the line mandatory break characters (e.g. [code]"\n"[/code]).
Break the line between the words.
Break the line between any unconnected graphemes.
Grapheme is part of right-to-left or bottom-to-top run.
Grapheme is not part of source text, it was added by justification process.
Grapheme is whitespace.
Grapheme is mandatory break point (e.g. [code]"\n"[/code]).
Grapheme is optional break point (e.g. space).
Grapheme is the tabulation character.
Grapheme is kashida.
Disables font hinting (smoother but less crisp).
Use the light font hinting mode.
Use the default font hinting mode (crisper but less smooth).
TextServer supports bidirectional layouts.
TextServer supports vertical layouts.
TextServer supports complex text shaping.
TextServer supports justification using kashidas.
TextServer supports complex line/word breaking rules (e.g. dictionary based).
TextServer supports loading system fonts.
TextServer supports variable fonts.
TextServer require external data file for some features.