Base class for custom TextServer implementations (plugins).
External TextServer implementations should inherit from this class.
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.
Creates a new buffer for complex text layout, with the given direction and orientation.
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.
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.
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.
Returns the width of the range around the shape between the minimum and maximum representable signed distance.
Returns Dictionary with OpenType font name strings (localized font names, version, description, license information, sample text, etc.).
Returns oversampling factor override. If set to a positive value, overrides the oversampling factor of the viewport this font is used in. See Viewport.oversampling. This value doesn't override the [code skip-lint]oversampling[/code] parameter of [code skip-lint]draw_*[/code] methods. Used by dynamic fonts only.
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().
Returns the number of predefined color palettes. Palette contains all colors used to render font glyphs. Each palette has the same number of colors.
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.
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.
Returns list of the font sizes in the cache. Each size is Vector2i with font size and outline size.
Returns array containing glyph packing data.
Returns weight (boldness) of the font. A value in the 100...999 range, normal font weight is 400, bold font weight is 700.
Returns true if the font supports the given language (as a ISO 639 code).
Returns true if glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data.
Returns true if the font supports the given script (as a ISO 15924 code).
Sets font embolden strength. If strength is not equal to zero, emboldens the font outlines. Negative values reduce the outline thickness.
Sets bitmap font fixed size. If set to value greater than zero, same cache entry will be used for all font sizes.
Sets bitmap font scaling mode. This property is used only if fixed_size is greater than zero.
Sets index of the cache texture containing the glyph.
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.
Adds override for _font_is_language_supported().
If set to true, color modulation is applied when drawing colored glyphs, otherwise it's applied to the monochrome glyphs only.
Sets the width of the range around the shape between the minimum and maximum representable signed distance.
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.
If set to a positive value, overrides the oversampling factor of the viewport this font is used in. See Viewport.oversampling. This value doesn't override the [code skip-lint]oversampling[/code] parameter of [code skip-lint]draw_*[/code] methods. Used by dynamic fonts only.
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.
Adds override for _font_is_script_supported().
Sets font subpixel glyph positioning mode.
Sets font cache texture image data.
Sets array containing glyph packing data.
Sets 2D transform, applied to the font outlines, can be used for slanting, flipping, and rotating glyphs.
Sets weight (boldness) of the font. A value in the 100...999 range, normal font weight is 400, bold font weight is 700.
Converts a number from Western Arabic (0..9) to the numeral system used in the given language.
If language is an empty string, the active locale will be used.
Returns size of the replacement character (box with character hexadecimal code that is drawn in place of invalid characters).
Returns index of the first string in dict which is visually confusable with the string, or -1 if none is found.
Converts number from the numeral system used in the given language to Western Arabic (0..9).
If language is an empty string, the active locale will be used.
Default implementation of the BiDi algorithm override function.
Increases the reference count of the specified oversampling level. This method is called by Viewport, and should not be used directly.
Returns number of text spans added using _shaped_text_add_string() or _shaped_text_add_object().
Changes text span font, font size, and OpenType features, without changing the text.
Adds inline object to the text buffer, key must be unique. In the text, object is represented as length object replacement characters.
Adds text span and font to draw it to the text buffer.
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.
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.
Adjusts text width 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 position in the text. Returned caret shape is 1 pixel wide rectangle.
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).
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 true if text buffer is configured to display hexadecimal codes in place of invalid characters.
Breaks text into words and returns array of character ranges. Use grapheme_flags to set what characters are used for breaking.
Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
Trims text if it exceeds the given width.
Sets new size and alignment of embedded object.
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 TextServer.DIRECTION_AUTO, direction will be detected based on the buffer contents and current locale.
If set to true text buffer will display invalid characters as hexadecimal codes, otherwise nothing is displayed.
Returns text buffer for the substring of the text in the shaped text buffer (including inline objects).
Updates break points in the shaped text. This method is called by default implementation of text breaking functions.
Updates justification points in the shaped text. This method is called by default implementation of text justification functions.
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.
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.