Table of Contents

Class TextServer

Namespace
Godot
Assembly
GodotSharp.dll

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

public class TextServer : RefCounted, IDisposable
Inheritance
TextServer
Implements
Derived
Inherited Members

Methods

CreateFont()

Creates a new, empty font cache entry resource. To free the resulting resource, use the FreeRid(Rid) method.

public Rid CreateFont()

Returns

Rid

CreateFontLinkedVariation(Rid)

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

public Rid CreateFontLinkedVariation(Rid fontRid)

Parameters

fontRid Rid

Returns

Rid

CreateShapedText(Direction, Orientation)

Creates new buffer for complex text layout, with the given direction and orientation. To free the resulting buffer, use FreeRid(Rid) method.

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

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

public Rid CreateShapedText(TextServer.Direction direction = Direction.Auto, TextServer.Orientation orientation = Orientation.Horizontal)

Parameters

direction TextServer.Direction
orientation TextServer.Orientation

Returns

Rid

DrawHexCodeBox(Rid, long, Vector2, long, Color)

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

public void DrawHexCodeBox(Rid canvas, long size, Vector2 pos, long index, Color color)

Parameters

canvas Rid
size long
pos Vector2
index long
color Color

FontClearGlyphs(Rid, Vector2I)

Removes all rendered glyphs information from the cache entry.

Note: This function will not remove textures associated with the glyphs, use FontRemoveTexture(Rid, Vector2I, long) to remove them manually.

public void FontClearGlyphs(Rid fontRid, Vector2I size)

Parameters

fontRid Rid
size Vector2I

FontClearKerningMap(Rid, long)

Removes all kerning overrides.

public void FontClearKerningMap(Rid fontRid, long size)

Parameters

fontRid Rid
size long

FontClearSizeCache(Rid)

Removes all font sizes from the cache entry.

public void FontClearSizeCache(Rid fontRid)

Parameters

fontRid Rid

FontClearTextures(Rid, Vector2I)

Removes all textures from font cache entry.

Note: This function will not remove glyphs associated with the texture, use FontRemoveGlyph(Rid, Vector2I, long) to remove them manually.

public void FontClearTextures(Rid fontRid, Vector2I size)

Parameters

fontRid Rid
size Vector2I

FontDrawGlyph(Rid, Rid, long, Vector2, long, Color?)

Draws single glyph into a canvas item at the position, using fontRid at the size size.

Note: Glyph index is specific to the font, use glyphs indices returned by ShapedTextGetGlyphs(Rid) or FontGetGlyphIndex(Rid, long, long, long).

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

public void FontDrawGlyph(Rid fontRid, Rid canvas, long size, Vector2 pos, long index, Color? color = null)

Parameters

fontRid Rid
canvas Rid
size long
pos Vector2
index long
color Color?

If the parameter is null, then the default value is new Color(1, 1, 1, 1).

FontDrawGlyphOutline(Rid, Rid, long, long, Vector2, long, Color?)

Draws single glyph outline of size outlineSize into a canvas item at the position, using fontRid at the size size.

Note: Glyph index is specific to the font, use glyphs indices returned by ShapedTextGetGlyphs(Rid) or FontGetGlyphIndex(Rid, long, long, long).

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

public void FontDrawGlyphOutline(Rid fontRid, Rid canvas, long size, long outlineSize, Vector2 pos, long index, Color? color = null)

Parameters

fontRid Rid
canvas Rid
size long
outlineSize long
pos Vector2
index long
color Color?

If the parameter is null, then the default value is new Color(1, 1, 1, 1).

FontGetAntialiasing(Rid)

Returns font anti-aliasing mode.

public TextServer.FontAntialiasing FontGetAntialiasing(Rid fontRid)

Parameters

fontRid Rid

Returns

TextServer.FontAntialiasing

FontGetAscent(Rid, long)

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

public double FontGetAscent(Rid fontRid, long size)

Parameters

fontRid Rid
size long

Returns

double

FontGetCharFromGlyphIndex(Rid, long, long)

Returns character code associated with glyphIndex, or 0 if glyphIndex is invalid. See FontGetGlyphIndex(Rid, long, long, long).

public long FontGetCharFromGlyphIndex(Rid fontRid, long size, long glyphIndex)

Parameters

fontRid Rid
size long
glyphIndex long

Returns

long

FontGetDescent(Rid, long)

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

public double FontGetDescent(Rid fontRid, long size)

Parameters

fontRid Rid
size long

Returns

double

FontGetEmbolden(Rid)

Returns font embolden strength.

public double FontGetEmbolden(Rid fontRid)

Parameters

fontRid Rid

Returns

double

FontGetFaceCount(Rid)

Returns number of faces in the TrueType / OpenType collection.

public long FontGetFaceCount(Rid fontRid)

Parameters

fontRid Rid

Returns

long

FontGetFaceIndex(Rid)

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

public long FontGetFaceIndex(Rid fontRid)

Parameters

fontRid Rid

Returns

long

FontGetFixedSize(Rid)

Returns bitmap font fixed size.

public long FontGetFixedSize(Rid fontRid)

Parameters

fontRid Rid

Returns

long

FontGetFixedSizeScaleMode(Rid)

Returns bitmap font scaling mode.

public TextServer.FixedSizeScaleMode FontGetFixedSizeScaleMode(Rid fontRid)

Parameters

fontRid Rid

Returns

TextServer.FixedSizeScaleMode

FontGetGenerateMipmaps(Rid)

Returns true if font texture mipmap generation is enabled.

public bool FontGetGenerateMipmaps(Rid fontRid)

Parameters

fontRid Rid

Returns

bool

FontGetGlobalOversampling()

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

public double FontGetGlobalOversampling()

Returns

double

FontGetGlyphAdvance(Rid, long, long)

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.

public Vector2 FontGetGlyphAdvance(Rid fontRid, long size, long glyph)

Parameters

fontRid Rid
size long
glyph long

Returns

Vector2

FontGetGlyphContours(Rid, long, long)

Returns outline contours of the glyph as a Dictionary with the following contents:

points - Vector3[], containing outline points. x and y are point coordinates. z is the type of the point, using the TextServer.ContourPointTag values.

contours - int[], containing indices the end points of each contour.

orientation - bool, contour orientation. If true, clockwise contours must be filled.

public Dictionary FontGetGlyphContours(Rid font, long size, long index)

Parameters

font Rid
size long
index long

Returns

Dictionary

FontGetGlyphIndex(Rid, long, long, long)

Returns the glyph index of a char, optionally modified by the variationSelector. See FontGetCharFromGlyphIndex(Rid, long, long).

public long FontGetGlyphIndex(Rid fontRid, long size, long @char, long variationSelector)

Parameters

fontRid Rid
size long
char long
variationSelector long

Returns

long

FontGetGlyphList(Rid, Vector2I)

Returns list of rendered glyphs in the cache entry.

public int[] FontGetGlyphList(Rid fontRid, Vector2I size)

Parameters

fontRid Rid
size Vector2I

Returns

int[]

FontGetGlyphOffset(Rid, Vector2I, long)

Returns glyph offset from the baseline.

public Vector2 FontGetGlyphOffset(Rid fontRid, Vector2I size, long glyph)

Parameters

fontRid Rid
size Vector2I
glyph long

Returns

Vector2

FontGetGlyphSize(Rid, Vector2I, long)

Returns size of the glyph.

public Vector2 FontGetGlyphSize(Rid fontRid, Vector2I size, long glyph)

Parameters

fontRid Rid
size Vector2I
glyph long

Returns

Vector2

FontGetGlyphTextureIdx(Rid, Vector2I, long)

Returns index of the cache texture containing the glyph.

public long FontGetGlyphTextureIdx(Rid fontRid, Vector2I size, long glyph)

Parameters

fontRid Rid
size Vector2I
glyph long

Returns

long

FontGetGlyphTextureRid(Rid, Vector2I, long)

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.

public Rid FontGetGlyphTextureRid(Rid fontRid, Vector2I size, long glyph)

Parameters

fontRid Rid
size Vector2I
glyph long

Returns

Rid

FontGetGlyphTextureSize(Rid, Vector2I, long)

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.

public Vector2 FontGetGlyphTextureSize(Rid fontRid, Vector2I size, long glyph)

Parameters

fontRid Rid
size Vector2I
glyph long

Returns

Vector2

FontGetGlyphUVRect(Rid, Vector2I, long)

Returns rectangle in the cache texture containing the glyph.

public Rect2 FontGetGlyphUVRect(Rid fontRid, Vector2I size, long glyph)

Parameters

fontRid Rid
size Vector2I
glyph long

Returns

Rect2

FontGetHinting(Rid)

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

public TextServer.Hinting FontGetHinting(Rid fontRid)

Parameters

fontRid Rid

Returns

TextServer.Hinting

FontGetKerning(Rid, long, Vector2I)

Returns kerning for the pair of glyphs.

public Vector2 FontGetKerning(Rid fontRid, long size, Vector2I glyphPair)

Parameters

fontRid Rid
size long
glyphPair Vector2I

Returns

Vector2

FontGetKerningList(Rid, long)

Returns list of the kerning overrides.

public Array<Vector2I> FontGetKerningList(Rid fontRid, long size)

Parameters

fontRid Rid
size long

Returns

Array<Vector2I>

FontGetLanguageSupportOverride(Rid, string)

Returns true if support override is enabled for the language.

public bool FontGetLanguageSupportOverride(Rid fontRid, string language)

Parameters

fontRid Rid
language string

Returns

bool

FontGetLanguageSupportOverrides(Rid)

Returns list of language support overrides.

public string[] FontGetLanguageSupportOverrides(Rid fontRid)

Parameters

fontRid Rid

Returns

string[]

FontGetMsdfPixelRange(Rid)

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

public long FontGetMsdfPixelRange(Rid fontRid)

Parameters

fontRid Rid

Returns

long

FontGetMsdfSize(Rid)

Returns source font size used to generate MSDF textures.

public long FontGetMsdfSize(Rid fontRid)

Parameters

fontRid Rid

Returns

long

FontGetName(Rid)

Returns font family name.

public string FontGetName(Rid fontRid)

Parameters

fontRid Rid

Returns

string

FontGetOpentypeFeatureOverrides(Rid)

Returns font OpenType feature set override.

public Dictionary FontGetOpentypeFeatureOverrides(Rid fontRid)

Parameters

fontRid Rid

Returns

Dictionary

FontGetOtNameStrings(Rid)

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

public Dictionary FontGetOtNameStrings(Rid fontRid)

Parameters

fontRid Rid

Returns

Dictionary

FontGetOversampling(Rid)

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

public double FontGetOversampling(Rid fontRid)

Parameters

fontRid Rid

Returns

double

FontGetScale(Rid, long)

Returns scaling factor of the color bitmap font.

public double FontGetScale(Rid fontRid, long size)

Parameters

fontRid Rid
size long

Returns

double

FontGetScriptSupportOverride(Rid, string)

Returns true if support override is enabled for the script.

public bool FontGetScriptSupportOverride(Rid fontRid, string script)

Parameters

fontRid Rid
script string

Returns

bool

FontGetScriptSupportOverrides(Rid)

Returns list of script support overrides.

public string[] FontGetScriptSupportOverrides(Rid fontRid)

Parameters

fontRid Rid

Returns

string[]

FontGetSizeCacheList(Rid)

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

public Array<Vector2I> FontGetSizeCacheList(Rid fontRid)

Parameters

fontRid Rid

Returns

Array<Vector2I>

FontGetSpacing(Rid, SpacingType)

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

public long FontGetSpacing(Rid fontRid, TextServer.SpacingType spacing)

Parameters

fontRid Rid
spacing TextServer.SpacingType

Returns

long

FontGetStretch(Rid)

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

public long FontGetStretch(Rid fontRid)

Parameters

fontRid Rid

Returns

long

FontGetStyle(Rid)

Returns font style flags, see TextServer.FontStyle.

public TextServer.FontStyle FontGetStyle(Rid fontRid)

Parameters

fontRid Rid

Returns

TextServer.FontStyle

FontGetStyleName(Rid)

Returns font style name.

public string FontGetStyleName(Rid fontRid)

Parameters

fontRid Rid

Returns

string

FontGetSubpixelPositioning(Rid)

Returns font subpixel glyph positioning mode.

public TextServer.SubpixelPositioning FontGetSubpixelPositioning(Rid fontRid)

Parameters

fontRid Rid

Returns

TextServer.SubpixelPositioning

FontGetSupportedChars(Rid)

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

public string FontGetSupportedChars(Rid fontRid)

Parameters

fontRid Rid

Returns

string

FontGetTextureCount(Rid, Vector2I)

Returns number of textures used by font cache entry.

public long FontGetTextureCount(Rid fontRid, Vector2I size)

Parameters

fontRid Rid
size Vector2I

Returns

long

FontGetTextureImage(Rid, Vector2I, long)

Returns font cache texture image data.

public Image FontGetTextureImage(Rid fontRid, Vector2I size, long textureIndex)

Parameters

fontRid Rid
size Vector2I
textureIndex long

Returns

Image

FontGetTextureOffsets(Rid, Vector2I, long)

Returns array containing glyph packing data.

public int[] FontGetTextureOffsets(Rid fontRid, Vector2I size, long textureIndex)

Parameters

fontRid Rid
size Vector2I
textureIndex long

Returns

int[]

FontGetTransform(Rid)

Returns 2D transform applied to the font outlines.

public Transform2D FontGetTransform(Rid fontRid)

Parameters

fontRid Rid

Returns

Transform2D

FontGetUnderlinePosition(Rid, long)

Returns pixel offset of the underline below the baseline.

public double FontGetUnderlinePosition(Rid fontRid, long size)

Parameters

fontRid Rid
size long

Returns

double

FontGetUnderlineThickness(Rid, long)

Returns thickness of the underline in pixels.

public double FontGetUnderlineThickness(Rid fontRid, long size)

Parameters

fontRid Rid
size long

Returns

double

FontGetVariationCoordinates(Rid)

Returns variation coordinates for the specified font cache entry. See FontSupportedVariationList(Rid) for more info.

public Dictionary FontGetVariationCoordinates(Rid fontRid)

Parameters

fontRid Rid

Returns

Dictionary

FontGetWeight(Rid)

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

public long FontGetWeight(Rid fontRid)

Parameters

fontRid Rid

Returns

long

FontHasChar(Rid, long)

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

public bool FontHasChar(Rid fontRid, long @char)

Parameters

fontRid Rid
char long

Returns

bool

FontIsAllowSystemFallback(Rid)

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

public bool FontIsAllowSystemFallback(Rid fontRid)

Parameters

fontRid Rid

Returns

bool

FontIsForceAutohinter(Rid)

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

public bool FontIsForceAutohinter(Rid fontRid)

Parameters

fontRid Rid

Returns

bool

FontIsLanguageSupported(Rid, string)

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

public bool FontIsLanguageSupported(Rid fontRid, string language)

Parameters

fontRid Rid
language string

Returns

bool

FontIsMultichannelSignedDistanceField(Rid)

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

public bool FontIsMultichannelSignedDistanceField(Rid fontRid)

Parameters

fontRid Rid

Returns

bool

FontIsScriptSupported(Rid, string)

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

public bool FontIsScriptSupported(Rid fontRid, string script)

Parameters

fontRid Rid
script string

Returns

bool

FontRemoveGlyph(Rid, Vector2I, long)

Removes specified rendered glyph information from the cache entry.

Note: This function will not remove textures associated with the glyphs, use FontRemoveTexture(Rid, Vector2I, long) to remove them manually.

public void FontRemoveGlyph(Rid fontRid, Vector2I size, long glyph)

Parameters

fontRid Rid
size Vector2I
glyph long

FontRemoveKerning(Rid, long, Vector2I)

Removes kerning override for the pair of glyphs.

public void FontRemoveKerning(Rid fontRid, long size, Vector2I glyphPair)

Parameters

fontRid Rid
size long
glyphPair Vector2I

FontRemoveLanguageSupportOverride(Rid, string)

Remove language support override.

public void FontRemoveLanguageSupportOverride(Rid fontRid, string language)

Parameters

fontRid Rid
language string

FontRemoveScriptSupportOverride(Rid, string)

Removes script support override.

public void FontRemoveScriptSupportOverride(Rid fontRid, string script)

Parameters

fontRid Rid
script string

FontRemoveSizeCache(Rid, Vector2I)

Removes specified font size from the cache entry.

public void FontRemoveSizeCache(Rid fontRid, Vector2I size)

Parameters

fontRid Rid
size Vector2I

FontRemoveTexture(Rid, Vector2I, long)

Removes specified texture from the cache entry.

Note: This function will not remove glyphs associated with the texture, remove them manually, using FontRemoveGlyph(Rid, Vector2I, long).

public void FontRemoveTexture(Rid fontRid, Vector2I size, long textureIndex)

Parameters

fontRid Rid
size Vector2I
textureIndex long

FontRenderGlyph(Rid, Vector2I, long)

Renders specified glyph to the font cache texture.

public void FontRenderGlyph(Rid fontRid, Vector2I size, long index)

Parameters

fontRid Rid
size Vector2I
index long

FontRenderRange(Rid, Vector2I, long, long)

Renders the range of characters to the font cache texture.

public void FontRenderRange(Rid fontRid, Vector2I size, long start, long end)

Parameters

fontRid Rid
size Vector2I
start long
end long

FontSetAllowSystemFallback(Rid, bool)

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

public void FontSetAllowSystemFallback(Rid fontRid, bool allowSystemFallback)

Parameters

fontRid Rid
allowSystemFallback bool

FontSetAntialiasing(Rid, FontAntialiasing)

Sets font anti-aliasing mode.

public void FontSetAntialiasing(Rid fontRid, TextServer.FontAntialiasing antialiasing)

Parameters

fontRid Rid
antialiasing TextServer.FontAntialiasing

FontSetAscent(Rid, long, double)

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

public void FontSetAscent(Rid fontRid, long size, double ascent)

Parameters

fontRid Rid
size long
ascent double

FontSetData(Rid, byte[])

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

public void FontSetData(Rid fontRid, byte[] data)

Parameters

fontRid Rid
data byte[]

FontSetDescent(Rid, long, double)

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

public void FontSetDescent(Rid fontRid, long size, double descent)

Parameters

fontRid Rid
size long
descent double

FontSetEmbolden(Rid, double)

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

public void FontSetEmbolden(Rid fontRid, double strength)

Parameters

fontRid Rid
strength double

FontSetFaceIndex(Rid, long)

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

public void FontSetFaceIndex(Rid fontRid, long faceIndex)

Parameters

fontRid Rid
faceIndex long

FontSetFixedSize(Rid, long)

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

public void FontSetFixedSize(Rid fontRid, long fixedSize)

Parameters

fontRid Rid
fixedSize long

FontSetFixedSizeScaleMode(Rid, FixedSizeScaleMode)

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

public void FontSetFixedSizeScaleMode(Rid fontRid, TextServer.FixedSizeScaleMode fixedSizeScaleMode)

Parameters

fontRid Rid
fixedSizeScaleMode TextServer.FixedSizeScaleMode

FontSetForceAutohinter(Rid, bool)

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

public void FontSetForceAutohinter(Rid fontRid, bool forceAutohinter)

Parameters

fontRid Rid
forceAutohinter bool

FontSetGenerateMipmaps(Rid, bool)

If set to true font texture mipmap generation is enabled.

public void FontSetGenerateMipmaps(Rid fontRid, bool generateMipmaps)

Parameters

fontRid Rid
generateMipmaps bool

FontSetGlobalOversampling(double)

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

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

public void FontSetGlobalOversampling(double oversampling)

Parameters

oversampling double

FontSetGlyphAdvance(Rid, long, long, Vector2)

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.

public void FontSetGlyphAdvance(Rid fontRid, long size, long glyph, Vector2 advance)

Parameters

fontRid Rid
size long
glyph long
advance Vector2

FontSetGlyphOffset(Rid, Vector2I, long, Vector2)

Sets glyph offset from the baseline.

public void FontSetGlyphOffset(Rid fontRid, Vector2I size, long glyph, Vector2 offset)

Parameters

fontRid Rid
size Vector2I
glyph long
offset Vector2

FontSetGlyphSize(Rid, Vector2I, long, Vector2)

Sets size of the glyph.

public void FontSetGlyphSize(Rid fontRid, Vector2I size, long glyph, Vector2 glSize)

Parameters

fontRid Rid
size Vector2I
glyph long
glSize Vector2

FontSetGlyphTextureIdx(Rid, Vector2I, long, long)

Sets index of the cache texture containing the glyph.

public void FontSetGlyphTextureIdx(Rid fontRid, Vector2I size, long glyph, long textureIdx)

Parameters

fontRid Rid
size Vector2I
glyph long
textureIdx long

FontSetGlyphUVRect(Rid, Vector2I, long, Rect2)

Sets rectangle in the cache texture containing the glyph.

public void FontSetGlyphUVRect(Rid fontRid, Vector2I size, long glyph, Rect2 uVRect)

Parameters

fontRid Rid
size Vector2I
glyph long
uVRect Rect2

FontSetHinting(Rid, Hinting)

Sets font hinting mode. Used by dynamic fonts only.

public void FontSetHinting(Rid fontRid, TextServer.Hinting hinting)

Parameters

fontRid Rid
hinting TextServer.Hinting

FontSetKerning(Rid, long, Vector2I, Vector2)

Sets kerning for the pair of glyphs.

public void FontSetKerning(Rid fontRid, long size, Vector2I glyphPair, Vector2 kerning)

Parameters

fontRid Rid
size long
glyphPair Vector2I
kerning Vector2

FontSetLanguageSupportOverride(Rid, string, bool)

public void FontSetLanguageSupportOverride(Rid fontRid, string language, bool supported)

Parameters

fontRid Rid
language string
supported bool

FontSetMsdfPixelRange(Rid, long)

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

public void FontSetMsdfPixelRange(Rid fontRid, long msdfPixelRange)

Parameters

fontRid Rid
msdfPixelRange long

FontSetMsdfSize(Rid, long)

Sets source font size used to generate MSDF textures.

public void FontSetMsdfSize(Rid fontRid, long msdfSize)

Parameters

fontRid Rid
msdfSize long

FontSetMultichannelSignedDistanceField(Rid, bool)

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.

public void FontSetMultichannelSignedDistanceField(Rid fontRid, bool msdf)

Parameters

fontRid Rid
msdf bool

FontSetName(Rid, string)

Sets the font family name.

public void FontSetName(Rid fontRid, string name)

Parameters

fontRid Rid
name string

FontSetOpentypeFeatureOverrides(Rid, Dictionary)

Sets font OpenType feature set override.

public void FontSetOpentypeFeatureOverrides(Rid fontRid, Dictionary overrides)

Parameters

fontRid Rid
overrides Dictionary

FontSetOversampling(Rid, double)

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

public void FontSetOversampling(Rid fontRid, double oversampling)

Parameters

fontRid Rid
oversampling double

FontSetScale(Rid, long, double)

Sets scaling factor of the color bitmap font.

public void FontSetScale(Rid fontRid, long size, double scale)

Parameters

fontRid Rid
size long
scale double

FontSetScriptSupportOverride(Rid, string, bool)

public void FontSetScriptSupportOverride(Rid fontRid, string script, bool supported)

Parameters

fontRid Rid
script string
supported bool

FontSetSpacing(Rid, SpacingType, long)

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

public void FontSetSpacing(Rid fontRid, TextServer.SpacingType spacing, long value)

Parameters

fontRid Rid
spacing TextServer.SpacingType
value long

FontSetStretch(Rid, long)

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 FontSetFaceIndex(Rid, long), FontSetVariationCoordinates(Rid, Dictionary), or FontSetTransform(Rid, Transform2D) instead.

public void FontSetStretch(Rid fontRid, long weight)

Parameters

fontRid Rid
weight long

FontSetStyle(Rid, FontStyle)

Sets the font style flags, see TextServer.FontStyle.

Note: This value is used for font matching only and will not affect font rendering. Use FontSetFaceIndex(Rid, long), FontSetVariationCoordinates(Rid, Dictionary), FontSetEmbolden(Rid, double), or FontSetTransform(Rid, Transform2D) instead.

public void FontSetStyle(Rid fontRid, TextServer.FontStyle style)

Parameters

fontRid Rid
style TextServer.FontStyle

FontSetStyleName(Rid, string)

Sets the font style name.

public void FontSetStyleName(Rid fontRid, string name)

Parameters

fontRid Rid
name string

FontSetSubpixelPositioning(Rid, SubpixelPositioning)

Sets font subpixel glyph positioning mode.

public void FontSetSubpixelPositioning(Rid fontRid, TextServer.SubpixelPositioning subpixelPositioning)

Parameters

fontRid Rid
subpixelPositioning TextServer.SubpixelPositioning

FontSetTextureImage(Rid, Vector2I, long, Image)

Sets font cache texture image data.

public void FontSetTextureImage(Rid fontRid, Vector2I size, long textureIndex, Image image)

Parameters

fontRid Rid
size Vector2I
textureIndex long
image Image

FontSetTextureOffsets(Rid, Vector2I, long, int[])

Sets array containing glyph packing data.

public void FontSetTextureOffsets(Rid fontRid, Vector2I size, long textureIndex, int[] offset)

Parameters

fontRid Rid
size Vector2I
textureIndex long
offset int[]

FontSetTransform(Rid, Transform2D)

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

public void FontSetTransform(Rid fontRid, Transform2D transform)

Parameters

fontRid Rid
transform Transform2D

FontSetUnderlinePosition(Rid, long, double)

Sets pixel offset of the underline below the baseline.

public void FontSetUnderlinePosition(Rid fontRid, long size, double underlinePosition)

Parameters

fontRid Rid
size long
underlinePosition double

FontSetUnderlineThickness(Rid, long, double)

Sets thickness of the underline in pixels.

public void FontSetUnderlineThickness(Rid fontRid, long size, double underlineThickness)

Parameters

fontRid Rid
size long
underlineThickness double

FontSetVariationCoordinates(Rid, Dictionary)

Sets variation coordinates for the specified font cache entry. See FontSupportedVariationList(Rid) for more info.

public void FontSetVariationCoordinates(Rid fontRid, Dictionary variationCoordinates)

Parameters

fontRid Rid
variationCoordinates Dictionary

FontSetWeight(Rid, long)

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 FontSetFaceIndex(Rid, long), FontSetVariationCoordinates(Rid, Dictionary), or FontSetEmbolden(Rid, double) instead.

public void FontSetWeight(Rid fontRid, long weight)

Parameters

fontRid Rid
weight long

FontSupportedFeatureList(Rid)

Returns the dictionary of the supported OpenType features.

public Dictionary FontSupportedFeatureList(Rid fontRid)

Parameters

fontRid Rid

Returns

Dictionary

FontSupportedVariationList(Rid)

Returns the dictionary of the supported OpenType variation coordinates.

public Dictionary FontSupportedVariationList(Rid fontRid)

Parameters

fontRid Rid

Returns

Dictionary

FormatNumber(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.

public string FormatNumber(string number, string language = "")

Parameters

number string
language string

Returns

string

FreeRid(Rid)

Frees an object created by this TextServer.

public void FreeRid(Rid rid)

Parameters

rid Rid

GetFeatures()

Returns text server features, see TextServer.Feature.

public long GetFeatures()

Returns

long

GetHexCodeBoxSize(long, long)

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

public Vector2 GetHexCodeBoxSize(long size, long index)

Parameters

size long
index long

Returns

Vector2

GetName()

Returns the name of the server interface.

public string GetName()

Returns

string

GetSupportDataFileName()

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

public string GetSupportDataFileName()

Returns

string

GetSupportDataInfo()

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

public string GetSupportDataInfo()

Returns

string

Has(Rid)

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

public bool Has(Rid rid)

Parameters

rid Rid

Returns

bool

HasFeature(Feature)

Returns true if the server supports a feature.

public bool HasFeature(TextServer.Feature feature)

Parameters

feature TextServer.Feature

Returns

bool

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsConfusable(string, string[])

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 SpoofCheck(string).

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

public long IsConfusable(string @string, string[] dict)

Parameters

string string
dict string[]

Returns

long

IsLocaleRightToLeft(string)

Returns true if locale is right-to-left.

public bool IsLocaleRightToLeft(string locale)

Parameters

locale string

Returns

bool

IsValidIdentifier(string)

Returns true if string is a valid identifier.

If the text server supports the UnicodeIdentifiers 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 UnicodeIdentifiers 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.

public bool IsValidIdentifier(string @string)

Parameters

string string

Returns

bool

LoadSupportData(string)

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.

public bool LoadSupportData(string fileName)

Parameters

fileName string

Returns

bool

NameToTag(string)

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

public long NameToTag(string name)

Parameters

name string

Returns

long

ParseNumber(string, string)

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

public string ParseNumber(string number, string language = "")

Parameters

number string
language string

Returns

string

ParseStructuredText(StructuredTextParser, Array, string)

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

public Array<Vector3I> ParseStructuredText(TextServer.StructuredTextParser parserType, Array args, string text)

Parameters

parserType TextServer.StructuredTextParser
args Array
text string

Returns

Array<Vector3I>

PercentSign(string)

Returns percent sign used in the language.

public string PercentSign(string language = "")

Parameters

language string

Returns

string

SaveSupportData(string)

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.

public bool SaveSupportData(string fileName)

Parameters

fileName string

Returns

bool

ShapedGetSpanCount(Rid)

public long ShapedGetSpanCount(Rid shaped)

Parameters

shaped Rid

Returns

long

ShapedGetSpanMeta(Rid, long)

Returns text span metadata.

public Variant ShapedGetSpanMeta(Rid shaped, long index)

Parameters

shaped Rid
index long

Returns

Variant

ShapedSetSpanUpdateFont(Rid, long, Array<Rid>, long, Dictionary)

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

public void ShapedSetSpanUpdateFont(Rid shaped, long index, Array<Rid> fonts, long size, Dictionary opentypeFeatures = null)

Parameters

shaped Rid
index long
fonts Array<Rid>
size long
opentypeFeatures Dictionary

ShapedTextAddObject(Rid, Variant, Vector2, InlineAlignment, long, double)

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

public bool ShapedTextAddObject(Rid shaped, Variant key, Vector2 size, InlineAlignment inlineAlign = InlineAlignment.Center, long length = 1, double baseline = 0)

Parameters

shaped Rid
key Variant
size Vector2
inlineAlign InlineAlignment
length long
baseline double

Returns

bool

ShapedTextAddString(Rid, string, Array<Rid>, long, Dictionary, string, Variant)

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

public bool ShapedTextAddString(Rid shaped, string text, Array<Rid> fonts, long size, Dictionary opentypeFeatures = null, string language = "", Variant meta = default)

Parameters

shaped Rid
text string
fonts Array<Rid>
size long
opentypeFeatures Dictionary
language string
meta Variant

Returns

bool

ShapedTextClear(Rid)

Clears text buffer (removes text and inline objects).

public void ShapedTextClear(Rid rid)

Parameters

rid Rid

ShapedTextClosestCharacterPos(Rid, long)

Returns composite character position closest to the pos.

public long ShapedTextClosestCharacterPos(Rid shaped, long pos)

Parameters

shaped Rid
pos long

Returns

long

ShapedTextDraw(Rid, Rid, Vector2, double, double, Color?)

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

public void ShapedTextDraw(Rid shaped, Rid canvas, Vector2 pos, double clipL = -1, double clipR = -1, Color? color = null)

Parameters

shaped Rid
canvas Rid
pos Vector2
clipL double
clipR double
color Color?

If the parameter is null, then the default value is new Color(1, 1, 1, 1).

ShapedTextDrawOutline(Rid, Rid, Vector2, double, double, long, Color?)

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

public void ShapedTextDrawOutline(Rid shaped, Rid canvas, Vector2 pos, double clipL = -1, double clipR = -1, long outlineSize = 1, Color? color = null)

Parameters

shaped Rid
canvas Rid
pos Vector2
clipL double
clipR double
outlineSize long
color Color?

If the parameter is null, then the default value is new Color(1, 1, 1, 1).

ShapedTextFitToWidth(Rid, double, JustificationFlag)

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

public double ShapedTextFitToWidth(Rid shaped, double width, TextServer.JustificationFlag justificationFlags = JustificationFlag.Kashida | JustificationFlag.WordBound)

Parameters

shaped Rid
width double
justificationFlags TextServer.JustificationFlag

Returns

double

ShapedTextGetAscent(Rid)

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.

public double ShapedTextGetAscent(Rid shaped)

Parameters

shaped Rid

Returns

double

ShapedTextGetCarets(Rid, long)

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

public Dictionary ShapedTextGetCarets(Rid shaped, long position)

Parameters

shaped Rid
position long

Returns

Dictionary

ShapedTextGetCharacterBreaks(Rid)

Returns array of the composite character boundaries.

public int[] ShapedTextGetCharacterBreaks(Rid shaped)

Parameters

shaped Rid

Returns

int[]

ShapedTextGetCustomPunctuation(Rid)

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

public string ShapedTextGetCustomPunctuation(Rid shaped)

Parameters

shaped Rid

Returns

string

ShapedTextGetDescent(Rid)

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.

public double ShapedTextGetDescent(Rid shaped)

Parameters

shaped Rid

Returns

double

ShapedTextGetDirection(Rid)

Returns direction of the text.

public TextServer.Direction ShapedTextGetDirection(Rid shaped)

Parameters

shaped Rid

Returns

TextServer.Direction

ShapedTextGetDominantDirectionInRange(Rid, long, long)

Returns dominant direction of in the range of text.

public TextServer.Direction ShapedTextGetDominantDirectionInRange(Rid shaped, long start, long end)

Parameters

shaped Rid
start long
end long

Returns

TextServer.Direction

ShapedTextGetEllipsisGlyphCount(Rid)

Returns number of glyphs in the ellipsis.

public long ShapedTextGetEllipsisGlyphCount(Rid shaped)

Parameters

shaped Rid

Returns

long

ShapedTextGetEllipsisGlyphs(Rid)

Returns array of the glyphs in the ellipsis.

public Array<Dictionary> ShapedTextGetEllipsisGlyphs(Rid shaped)

Parameters

shaped Rid

Returns

Array<Dictionary>

ShapedTextGetEllipsisPos(Rid)

Returns position of the ellipsis.

public long ShapedTextGetEllipsisPos(Rid shaped)

Parameters

shaped Rid

Returns

long

ShapedTextGetGlyphCount(Rid)

Returns number of glyphs in the buffer.

public long ShapedTextGetGlyphCount(Rid shaped)

Parameters

shaped Rid

Returns

long

ShapedTextGetGlyphs(Rid)

Returns an array of glyphs in the visual order.

public Array<Dictionary> ShapedTextGetGlyphs(Rid shaped)

Parameters

shaped Rid

Returns

Array<Dictionary>

ShapedTextGetGraphemeBounds(Rid, long)

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

public Vector2 ShapedTextGetGraphemeBounds(Rid shaped, long pos)

Parameters

shaped Rid
pos long

Returns

Vector2

ShapedTextGetInferredDirection(Rid)

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

public TextServer.Direction ShapedTextGetInferredDirection(Rid shaped)

Parameters

shaped Rid

Returns

TextServer.Direction

ShapedTextGetLineBreaks(Rid, double, long, LineBreakFlag)

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

public int[] ShapedTextGetLineBreaks(Rid shaped, double width, long start = 0, TextServer.LineBreakFlag breakFlags = LineBreakFlag.Mandatory | LineBreakFlag.WordBound)

Parameters

shaped Rid
width double
start long
breakFlags TextServer.LineBreakFlag

Returns

int[]

ShapedTextGetLineBreaksAdv(Rid, float[], long, bool, LineBreakFlag)

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

public int[] ShapedTextGetLineBreaksAdv(Rid shaped, float[] width, long start = 0, bool once = true, TextServer.LineBreakFlag breakFlags = LineBreakFlag.Mandatory | LineBreakFlag.WordBound)

Parameters

shaped Rid
width float[]
start long
once bool
breakFlags TextServer.LineBreakFlag

Returns

int[]

ShapedTextGetObjectRect(Rid, Variant)

Returns bounding rectangle of the inline object.

public Rect2 ShapedTextGetObjectRect(Rid shaped, Variant key)

Parameters

shaped Rid
key Variant

Returns

Rect2

ShapedTextGetObjects(Rid)

Returns array of inline objects.

public Array ShapedTextGetObjects(Rid shaped)

Parameters

shaped Rid

Returns

Array

ShapedTextGetOrientation(Rid)

Returns text orientation.

public TextServer.Orientation ShapedTextGetOrientation(Rid shaped)

Parameters

shaped Rid

Returns

TextServer.Orientation

ShapedTextGetParent(Rid)

Returns the parent buffer from which the substring originates.

public Rid ShapedTextGetParent(Rid shaped)

Parameters

shaped Rid

Returns

Rid

ShapedTextGetPreserveControl(Rid)

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

public bool ShapedTextGetPreserveControl(Rid shaped)

Parameters

shaped Rid

Returns

bool

ShapedTextGetPreserveInvalid(Rid)

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.

public bool ShapedTextGetPreserveInvalid(Rid shaped)

Parameters

shaped Rid

Returns

bool

ShapedTextGetRange(Rid)

Returns substring buffer character range in the parent buffer.

public Vector2I ShapedTextGetRange(Rid shaped)

Parameters

shaped Rid

Returns

Vector2I

ShapedTextGetSelection(Rid, long, long)

Returns selection rectangles for the specified character range.

public Vector2[] ShapedTextGetSelection(Rid shaped, long start, long end)

Parameters

shaped Rid
start long
end long

Returns

Vector2[]

ShapedTextGetSize(Rid)

Returns size of the text.

public Vector2 ShapedTextGetSize(Rid shaped)

Parameters

shaped Rid

Returns

Vector2

ShapedTextGetSpacing(Rid, SpacingType)

Returns extra spacing added between glyphs or lines in pixels.

public long ShapedTextGetSpacing(Rid shaped, TextServer.SpacingType spacing)

Parameters

shaped Rid
spacing TextServer.SpacingType

Returns

long

ShapedTextGetTrimPos(Rid)

Returns the position of the overrun trim.

public long ShapedTextGetTrimPos(Rid shaped)

Parameters

shaped Rid

Returns

long

ShapedTextGetUnderlinePosition(Rid)

Returns pixel offset of the underline below the baseline.

public double ShapedTextGetUnderlinePosition(Rid shaped)

Parameters

shaped Rid

Returns

double

ShapedTextGetUnderlineThickness(Rid)

Returns thickness of the underline.

public double ShapedTextGetUnderlineThickness(Rid shaped)

Parameters

shaped Rid

Returns

double

ShapedTextGetWidth(Rid)

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

public double ShapedTextGetWidth(Rid shaped)

Parameters

shaped Rid

Returns

double

ShapedTextGetWordBreaks(Rid, GraphemeFlag)

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

public int[] ShapedTextGetWordBreaks(Rid shaped, TextServer.GraphemeFlag graphemeFlags = GraphemeFlag.Space | GraphemeFlag.Punctuation)

Parameters

shaped Rid
graphemeFlags TextServer.GraphemeFlag

Returns

int[]

ShapedTextHasVisibleChars(Rid)

Returns true if text buffer contains any visible characters.

public bool ShapedTextHasVisibleChars(Rid shaped)

Parameters

shaped Rid

Returns

bool

ShapedTextHitTestGrapheme(Rid, double)

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

public long ShapedTextHitTestGrapheme(Rid shaped, double coords)

Parameters

shaped Rid
coords double

Returns

long

ShapedTextHitTestPosition(Rid, double)

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

public long ShapedTextHitTestPosition(Rid shaped, double coords)

Parameters

shaped Rid
coords double

Returns

long

ShapedTextIsReady(Rid)

Returns true if buffer is successfully shaped.

public bool ShapedTextIsReady(Rid shaped)

Parameters

shaped Rid

Returns

bool

ShapedTextNextCharacterPos(Rid, long)

Returns composite character end position closest to the pos.

public long ShapedTextNextCharacterPos(Rid shaped, long pos)

Parameters

shaped Rid
pos long

Returns

long

ShapedTextNextGraphemePos(Rid, long)

Returns grapheme end position closest to the pos.

public long ShapedTextNextGraphemePos(Rid shaped, long pos)

Parameters

shaped Rid
pos long

Returns

long

ShapedTextOverrunTrimToWidth(Rid, double, TextOverrunFlag)

Trims text if it exceeds the given width.

public void ShapedTextOverrunTrimToWidth(Rid shaped, double width = 0, TextServer.TextOverrunFlag overrunTrimFlags = TextOverrunFlag.NoTrim)

Parameters

shaped Rid
width double
overrunTrimFlags TextServer.TextOverrunFlag

ShapedTextPrevCharacterPos(Rid, long)

Returns composite character start position closest to the pos.

public long ShapedTextPrevCharacterPos(Rid shaped, long pos)

Parameters

shaped Rid
pos long

Returns

long

ShapedTextPrevGraphemePos(Rid, long)

Returns grapheme start position closest to the pos.

public long ShapedTextPrevGraphemePos(Rid shaped, long pos)

Parameters

shaped Rid
pos long

Returns

long

ShapedTextResizeObject(Rid, Variant, Vector2, InlineAlignment, double)

Sets new size and alignment of embedded object.

public bool ShapedTextResizeObject(Rid shaped, Variant key, Vector2 size, InlineAlignment inlineAlign = InlineAlignment.Center, double baseline = 0)

Parameters

shaped Rid
key Variant
size Vector2
inlineAlign InlineAlignment
baseline double

Returns

bool

ShapedTextSetBidiOverride(Rid, Array)

Overrides BiDi for the structured text.

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

public void ShapedTextSetBidiOverride(Rid shaped, Array @override)

Parameters

shaped Rid
override Array

ShapedTextSetCustomPunctuation(Rid, string)

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

public void ShapedTextSetCustomPunctuation(Rid shaped, string punct)

Parameters

shaped Rid
punct string

ShapedTextSetDirection(Rid, Direction)

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

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

public void ShapedTextSetDirection(Rid shaped, TextServer.Direction direction = Direction.Auto)

Parameters

shaped Rid
direction TextServer.Direction

ShapedTextSetOrientation(Rid, Orientation)

Sets desired text orientation.

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

public void ShapedTextSetOrientation(Rid shaped, TextServer.Orientation orientation = Orientation.Horizontal)

Parameters

shaped Rid
orientation TextServer.Orientation

ShapedTextSetPreserveControl(Rid, bool)

If set to true text buffer will display control characters.

public void ShapedTextSetPreserveControl(Rid shaped, bool enabled)

Parameters

shaped Rid
enabled bool

ShapedTextSetPreserveInvalid(Rid, bool)

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

public void ShapedTextSetPreserveInvalid(Rid shaped, bool enabled)

Parameters

shaped Rid
enabled bool

ShapedTextSetSpacing(Rid, SpacingType, long)

Sets extra spacing added between glyphs or lines in pixels.

public void ShapedTextSetSpacing(Rid shaped, TextServer.SpacingType spacing, long value)

Parameters

shaped Rid
spacing TextServer.SpacingType
value long

ShapedTextShape(Rid)

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.

public bool ShapedTextShape(Rid shaped)

Parameters

shaped Rid

Returns

bool

ShapedTextSortLogical(Rid)

Returns text glyphs in the logical order.

public Array<Dictionary> ShapedTextSortLogical(Rid shaped)

Parameters

shaped Rid

Returns

Array<Dictionary>

ShapedTextSubstr(Rid, long, long)

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

public Rid ShapedTextSubstr(Rid shaped, long start, long length)

Parameters

shaped Rid
start long
length long

Returns

Rid

ShapedTextTabAlign(Rid, float[])

Aligns shaped text to the given tab-stops.

public double ShapedTextTabAlign(Rid shaped, float[] tabStops)

Parameters

shaped Rid
tabStops float[]

Returns

double

SpoofCheck(string)

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 UnicodeSecurity feature.

public bool SpoofCheck(string @string)

Parameters

string string

Returns

bool

StringGetCharacterBreaks(string, string)

Returns array of the composite character boundaries.

var ts = TextServerManager.get_primary_interface()
  print(ts.string_get_word_breaks("Test ❤️‍🔥 Test")) # Prints [1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14]
public int[] StringGetCharacterBreaks(string @string, string language = "")

Parameters

string string
language string

Returns

int[]

StringGetWordBreaks(string, string, long)

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 charsPerLine is greater than zero, line break boundaries are returned instead.

var ts = TextServerManager.get_primary_interface()
  print(ts.string_get_word_breaks("Godot Engine")) # Prints [0, 5, 6, 12]
  print(ts.string_get_word_breaks("Godot Engine", "en", 5)) # Prints [0, 5, 6, 11, 11, 12]
public int[] StringGetWordBreaks(string @string, string language = "", long charsPerLine = 0)

Parameters

string string
language string
charsPerLine long

Returns

int[]

StringToLower(string, string)

Returns the string converted to lowercase.

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

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

public string StringToLower(string @string, string language = "")

Parameters

string string
language string

Returns

string

StringToUpper(string, string)

Returns the string converted to uppercase.

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

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

public string StringToUpper(string @string, string language = "")

Parameters

string string
language string

Returns

string

StripDiacritics(string)

Strips diacritics from the string.

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

public string StripDiacritics(string @string)

Parameters

string string

Returns

string

TagToName(long)

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

public string TagToName(long tag)

Parameters

tag long

Returns

string