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:
var ts = TextServerManager.get_primary_interface()Creates a new, empty font cache entry resource. To free the resulting resource, use the free_rid() method.
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.
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).
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.
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.
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.
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.
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.
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.
Returns character code associated with glyph_index, or 0 if glyph_index is invalid. See font_get_glyph_index().
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.
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.
Returns the glyph index of a char, optionally modified by the variation_selector. See font_get_char_from_glyph_index().
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.
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.
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 variation coordinates for the specified font cache entry. See font_supported_variation_list() for more info.
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 auto-hinting is supported and preferred over font built-in hinting. Used by dynamic fonts only.
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).
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.
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().
If set to true, embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).
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 glyph advance (offset of the next glyph).
Note: Advance for glyphs outlines is the same as the base glyph advance and is not saved.
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.
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.
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 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.
Sets the font style flags.
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.
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.
For example, to simulate italic typeface by slanting, apply the following transform Transform2D(1.0, slant, 0.0, 1.0, 0.0, 0.0).
Sets variation coordinates for the specified font cache entry. See font_supported_variation_list() for more info.
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.
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.
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.
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.
Returns true if the given code point is a valid letter, i.e. it belongs to the Unicode category "L".
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 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.
Returns the percent sign used in the given language.
If language is an empty string, the active locale will be used.
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.
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.
clip_l and clip_r are offsets relative to pos, going to the right in horizontal layout and downward in vertical layout. If clip_l is not negative, glyphs starting before the offset are clipped. If clip_r is not negative, glyphs ending after the offset are clipped.
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.
clip_l and clip_r are offsets relative to pos, going to the right in horizontal layout and downward in vertical layout. If clip_l is not negative, glyphs starting before the offset are clipped. If clip_r is not negative, glyphs ending after the offset are clipped.
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).
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 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).
Note: Overall descent can be higher than font descent, if some glyphs are displaced from the baseline.
Returns dominant direction of in the range of text.
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.
Note: If set to false, nothing is displayed 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.
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 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).
Sets desired text orientation.
Note: Orientation is ignored if server does not support FEATURE_VERTICAL_LAYOUT feature (supported by TextServerAdvanced).
If set to true text buffer will display invalid characters as hexadecimal codes, otherwise nothing is displayed.
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.
Returns text buffer for the substring of the text in the shaped text buffer (including inline objects).
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.
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]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]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.
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.
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.
FONT_ANTIALIASING_NONE = 0Font glyphs are rasterized as 1-bit bitmaps.
FONT_ANTIALIASING_GRAY = 1Font glyphs are rasterized as 8-bit grayscale anti-aliased bitmaps.
FONT_ANTIALIASING_LCD = 2Font glyphs are rasterized for LCD screens.
LCD subpixel layout is determined by the value of the ProjectSettings.gui/theme/lcd_subpixel_layout setting.
LCD subpixel anti-aliasing mode is suitable only for rendering horizontal, unscaled text in 2D.
FONT_LCD_SUBPIXEL_LAYOUT_NONE = 0Unknown or unsupported subpixel layout, LCD subpixel antialiasing is disabled.
FONT_LCD_SUBPIXEL_LAYOUT_HRGB = 1Horizontal RGB subpixel layout.
FONT_LCD_SUBPIXEL_LAYOUT_HBGR = 2Horizontal BGR subpixel layout.
FONT_LCD_SUBPIXEL_LAYOUT_VRGB = 3Vertical RGB subpixel layout.
FONT_LCD_SUBPIXEL_LAYOUT_VBGR = 4Vertical BGR subpixel layout.
FONT_LCD_SUBPIXEL_LAYOUT_MAX = 5Represents the size of the FontLCDSubpixelLayout enum.
DIRECTION_AUTO = 0Text direction is determined based on contents and current locale.
DIRECTION_LTR = 1Text is written from left to right.
DIRECTION_RTL = 2Text is written from right to left.
DIRECTION_INHERITED = 3Text writing direction is the same as base string writing direction. Used for BiDi override only.
ORIENTATION_HORIZONTAL = 0Text is written horizontally.
ORIENTATION_VERTICAL = 1Left to right text is written vertically from top to bottom.
Right to left text is written vertically from bottom to top.
JUSTIFICATION_NONE = 0Do not justify text.
JUSTIFICATION_KASHIDA = 1Justify text by adding and removing kashidas.
JUSTIFICATION_WORD_BOUND = 2Justify text by changing width of the spaces between the words.
JUSTIFICATION_TRIM_EDGE_SPACES = 4Remove trailing and leading spaces from the justified text.
JUSTIFICATION_AFTER_LAST_TAB = 8Only apply justification to the part of the text after the last tab.
JUSTIFICATION_CONSTRAIN_ELLIPSIS = 16Apply justification to the trimmed line with ellipsis.
JUSTIFICATION_SKIP_LAST_LINE = 32Do not apply justification to the last line of the paragraph.
JUSTIFICATION_SKIP_LAST_LINE_WITH_VISIBLE_CHARS = 64Do not apply justification to the last line of the paragraph with visible characters (takes precedence over JUSTIFICATION_SKIP_LAST_LINE).
JUSTIFICATION_DO_NOT_SKIP_SINGLE_LINE = 128Always apply justification to the paragraphs with a single line (JUSTIFICATION_SKIP_LAST_LINE and JUSTIFICATION_SKIP_LAST_LINE_WITH_VISIBLE_CHARS are ignored).
AUTOWRAP_OFF = 0Autowrap is disabled.
AUTOWRAP_ARBITRARY = 1Wraps 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.
AUTOWRAP_WORD = 2Wraps the text inside the node's bounding rectangle by soft-breaking between words.
AUTOWRAP_WORD_SMART = 3Behaves similarly to AUTOWRAP_WORD, but force-breaks a word if that single word does not fit in one line.
BREAK_NONE = 0Do not break the line.
BREAK_MANDATORY = 1Break the line at the line mandatory break characters (e.g. "\n").
BREAK_WORD_BOUND = 2Break the line between the words.
BREAK_GRAPHEME_BOUND = 4Break the line between any unconnected graphemes.
BREAK_ADAPTIVE = 8Should 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.
BREAK_TRIM_EDGE_SPACES = 16Remove edge spaces from the broken line segments.
BREAK_TRIM_INDENT = 32Subtract first line indentation width from all lines after the first one.
BREAK_TRIM_START_EDGE_SPACES = 64Remove spaces and line break characters from the start of broken line segments.
E.g, after line breaking, the second segment of the following text test \n next, is next if the flag is set, and next if it is not.
BREAK_TRIM_END_EDGE_SPACES = 128Remove spaces and line break characters from the end of broken line segments.
E.g, after line breaking, the first segment of the following text test \n next, is test if the flag is set, and test \n if it is not.
VC_CHARS_BEFORE_SHAPING = 0Trims 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.
VC_CHARS_AFTER_SHAPING = 1Displays glyphs that are mapped to the first Label.visible_characters or RichTextLabel.visible_characters characters from the beginning of the text.
VC_GLYPHS_AUTO = 2Displays Label.visible_ratio or RichTextLabel.visible_ratio glyphs, starting from the left or from the right, depending on Control.layout_direction value.
VC_GLYPHS_LTR = 3Displays Label.visible_ratio or RichTextLabel.visible_ratio glyphs, starting from the left.
VC_GLYPHS_RTL = 4Displays Label.visible_ratio or RichTextLabel.visible_ratio glyphs, starting from the right.
OVERRUN_NO_TRIMMING = 0No text trimming is performed.
OVERRUN_TRIM_CHAR = 1Trims the text per character.
OVERRUN_TRIM_WORD = 2Trims the text per word.
OVERRUN_TRIM_ELLIPSIS = 3Trims the text per character and adds an ellipsis to indicate that parts are hidden if trimmed text is 6 characters or longer.
OVERRUN_TRIM_WORD_ELLIPSIS = 4Trims the text per word and adds an ellipsis to indicate that parts are hidden if trimmed text is 6 characters or longer.
OVERRUN_TRIM_ELLIPSIS_FORCE = 5Trims the text per character and adds an ellipsis to indicate that parts are hidden regardless of trimmed text length.
OVERRUN_TRIM_WORD_ELLIPSIS_FORCE = 6Trims the text per word and adds an ellipsis to indicate that parts are hidden regardless of trimmed text length.
OVERRUN_NO_TRIM = 0No trimming is performed.
OVERRUN_TRIM = 1Trims the text when it exceeds the given width.
OVERRUN_TRIM_WORD_ONLY = 2Trims the text per word instead of per grapheme.
OVERRUN_ADD_ELLIPSIS = 4Determines whether an ellipsis should be added at the end of the text.
OVERRUN_ENFORCE_ELLIPSIS = 8Determines whether the ellipsis at the end of the text is enforced and may not be hidden.
OVERRUN_JUSTIFICATION_AWARE = 16Accounts for the text being justified before attempting to trim it (see JustificationFlag).
OVERRUN_SHORT_STRING_ELLIPSIS = 32Determines whether the ellipsis should be added regardless of the string length, otherwise it is added only if the string is 6 characters or longer.
GRAPHEME_IS_VALID = 1Grapheme is supported by the font, and can be drawn.
GRAPHEME_IS_RTL = 2Grapheme is part of right-to-left or bottom-to-top run.
GRAPHEME_IS_VIRTUAL = 4Grapheme is not part of source text, it was added by justification process.
GRAPHEME_IS_SPACE = 8Grapheme is whitespace.
GRAPHEME_IS_BREAK_HARD = 16Grapheme is mandatory break point (e.g. "\n").
GRAPHEME_IS_BREAK_SOFT = 32Grapheme is optional break point (e.g. space).
GRAPHEME_IS_TAB = 64Grapheme is the tabulation character.
GRAPHEME_IS_ELONGATION = 128Grapheme is kashida.
GRAPHEME_IS_PUNCTUATION = 256Grapheme is punctuation character.
GRAPHEME_IS_UNDERSCORE = 512Grapheme is underscore character.
GRAPHEME_IS_CONNECTED = 1024Grapheme is connected to the previous grapheme. Breaking line before this grapheme is not safe.
GRAPHEME_IS_SAFE_TO_INSERT_TATWEEL = 2048It is safe to insert a U+0640 before this grapheme for elongation.
GRAPHEME_IS_EMBEDDED_OBJECT = 4096Grapheme is an object replacement character for the embedded object.
GRAPHEME_IS_SOFT_HYPHEN = 8192Grapheme is a soft hyphen.
HINTING_NONE = 0Disables font hinting (smoother but less crisp).
HINTING_LIGHT = 1Use the light font hinting mode.
HINTING_NORMAL = 2Use 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.
SUBPIXEL_POSITIONING_DISABLED = 0Glyph horizontal position is rounded to the whole pixel size, each glyph is rasterized once.
SUBPIXEL_POSITIONING_AUTO = 1Glyph 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.
SUBPIXEL_POSITIONING_ONE_HALF = 2Glyph horizontal position is rounded to one half of the pixel size, each glyph is rasterized up to two times.
SUBPIXEL_POSITIONING_ONE_QUARTER = 3Glyph horizontal position is rounded to one quarter of the pixel size, each glyph is rasterized up to four times.
SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE = 20Maximum font size which will use "one half of the pixel" subpixel positioning in SUBPIXEL_POSITIONING_AUTO mode.
SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE = 16Maximum font size which will use "one quarter of the pixel" subpixel positioning in SUBPIXEL_POSITIONING_AUTO mode.
FEATURE_SIMPLE_LAYOUT = 1TextServer supports simple text layouts.
FEATURE_BIDI_LAYOUT = 2TextServer supports bidirectional text layouts.
FEATURE_VERTICAL_LAYOUT = 4TextServer supports vertical layouts.
FEATURE_SHAPING = 8TextServer supports complex text shaping.
FEATURE_KASHIDA_JUSTIFICATION = 16TextServer supports justification using kashidas.
FEATURE_BREAK_ITERATORS = 32TextServer supports complex line/word breaking rules (e.g. dictionary based).
FEATURE_FONT_BITMAP = 64TextServer supports loading bitmap fonts.
FEATURE_FONT_DYNAMIC = 128TextServer supports loading dynamic (TrueType, OpeType, etc.) fonts.
FEATURE_FONT_MSDF = 256TextServer supports multichannel signed distance field dynamic font rendering.
FEATURE_FONT_SYSTEM = 512TextServer supports loading system fonts.
FEATURE_FONT_VARIABLE = 1024TextServer supports variable fonts.
FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION = 2048TextServer supports locale dependent and context sensitive case conversion.
FEATURE_USE_SUPPORT_DATA = 4096TextServer require external data file for some features, see load_support_data().
FEATURE_UNICODE_IDENTIFIERS = 8192TextServer supports UAX #31 identifier validation, see is_valid_identifier().
FEATURE_UNICODE_SECURITY = 16384TextServer supports Unicode Technical Report #36 and Unicode Technical Standard #39 based spoof detection features.
CONTOUR_CURVE_TAG_ON = 1Contour point is on the curve.
CONTOUR_CURVE_TAG_OFF_CONIC = 0Contour point isn't on the curve, but serves as a control point for a conic (quadratic) Bézier arc.
CONTOUR_CURVE_TAG_OFF_CUBIC = 2Contour point isn't on the curve, but serves as a control point for a cubic Bézier arc.
SPACING_GLYPH = 0Spacing for each glyph.
SPACING_SPACE = 1Spacing for the space character.
SPACING_TOP = 2Spacing at the top of the line.
SPACING_BOTTOM = 3Spacing at the bottom of the line.
SPACING_MAX = 4Represents the size of the SpacingType enum.
FONT_BOLD = 1Font is bold.
FONT_ITALIC = 2Font is italic or oblique.
FONT_FIXED_WIDTH = 4Font has fixed-width characters (also known as monospace).
STRUCTURED_TEXT_DEFAULT = 0Use default Unicode BiDi algorithm.
STRUCTURED_TEXT_URI = 1BiDi override for URI.
STRUCTURED_TEXT_FILE = 2BiDi override for file path.
STRUCTURED_TEXT_EMAIL = 3BiDi override for email.
STRUCTURED_TEXT_LIST = 4BiDi override for lists. Structured text options: list separator String.
STRUCTURED_TEXT_GDSCRIPT = 5BiDi override for GDScript.
STRUCTURED_TEXT_CUSTOM = 6User defined structured text BiDi override function.
FIXED_SIZE_SCALE_DISABLE = 0Bitmap font is not scaled.
FIXED_SIZE_SCALE_INTEGER_ONLY = 1Bitmap font is scaled to the closest integer multiple of the font's fixed size. This is the recommended option for pixel art fonts.
FIXED_SIZE_SCALE_ENABLED = 2Bitmap font is scaled to an arbitrary (fractional) size. This is the recommended option for non-pixel art fonts.