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
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
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.Directionorientation
TextServer.Orientation
Returns
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
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
FontClearKerningMap(Rid, long)
Removes all kerning overrides.
public void FontClearKerningMap(Rid fontRid, long size)
Parameters
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
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
Ridcanvas
Ridsize
longpos
Vector2index
longcolor
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
Ridcanvas
Ridsize
longoutlineSize
longpos
Vector2index
longcolor
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
FontGetAscent(Rid, long)
Returns the font ascent (number of pixels above the baseline).
public double FontGetAscent(Rid fontRid, long size)
Parameters
Returns
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
Returns
FontGetDescent(Rid, long)
Returns the font descent (number of pixels below the baseline).
public double FontGetDescent(Rid fontRid, long size)
Parameters
Returns
FontGetEmbolden(Rid)
Returns font embolden strength.
public double FontGetEmbolden(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetFaceCount(Rid)
Returns number of faces in the TrueType / OpenType collection.
public long FontGetFaceCount(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetFaceIndex(Rid)
Returns an active face index in the TrueType / OpenType collection.
public long FontGetFaceIndex(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetFixedSize(Rid)
Returns bitmap font fixed size.
public long FontGetFixedSize(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetFixedSizeScaleMode(Rid)
Returns bitmap font scaling mode.
public TextServer.FixedSizeScaleMode FontGetFixedSizeScaleMode(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetGenerateMipmaps(Rid)
Returns true
if font texture mipmap generation is enabled.
public bool FontGetGenerateMipmaps(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetGlobalOversampling()
Returns the font oversampling factor, shared by all fonts in the TextServer.
public double FontGetGlobalOversampling()
Returns
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
Returns
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
Returns
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
Returns
FontGetGlyphList(Rid, Vector2I)
Returns list of rendered glyphs in the cache entry.
public int[] FontGetGlyphList(Rid fontRid, Vector2I size)
Parameters
Returns
- int[]
FontGetGlyphOffset(Rid, Vector2I, long)
Returns glyph offset from the baseline.
public Vector2 FontGetGlyphOffset(Rid fontRid, Vector2I size, long glyph)
Parameters
Returns
FontGetGlyphSize(Rid, Vector2I, long)
Returns size of the glyph.
public Vector2 FontGetGlyphSize(Rid fontRid, Vector2I size, long glyph)
Parameters
Returns
FontGetGlyphTextureIdx(Rid, Vector2I, long)
Returns index of the cache texture containing the glyph.
public long FontGetGlyphTextureIdx(Rid fontRid, Vector2I size, long glyph)
Parameters
Returns
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
Returns
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
Returns
FontGetGlyphUVRect(Rid, Vector2I, long)
Returns rectangle in the cache texture containing the glyph.
public Rect2 FontGetGlyphUVRect(Rid fontRid, Vector2I size, long glyph)
Parameters
Returns
FontGetHinting(Rid)
Returns the font hinting mode. Used by dynamic fonts only.
public TextServer.Hinting FontGetHinting(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetKerning(Rid, long, Vector2I)
Returns kerning for the pair of glyphs.
public Vector2 FontGetKerning(Rid fontRid, long size, Vector2I glyphPair)
Parameters
Returns
FontGetKerningList(Rid, long)
Returns list of the kerning overrides.
public Array<Vector2I> FontGetKerningList(Rid fontRid, long size)
Parameters
Returns
FontGetLanguageSupportOverride(Rid, string)
Returns true
if support override is enabled for the language
.
public bool FontGetLanguageSupportOverride(Rid fontRid, string language)
Parameters
Returns
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
FontGetMsdfSize(Rid)
Returns source font size used to generate MSDF textures.
public long FontGetMsdfSize(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetName(Rid)
Returns font family name.
public string FontGetName(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetOpentypeFeatureOverrides(Rid)
Returns font OpenType feature set override.
public Dictionary FontGetOpentypeFeatureOverrides(Rid fontRid)
Parameters
fontRid
Rid
Returns
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
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
FontGetScale(Rid, long)
Returns scaling factor of the color bitmap font.
public double FontGetScale(Rid fontRid, long size)
Parameters
Returns
FontGetScriptSupportOverride(Rid, string)
Returns true
if support override is enabled for the script
.
public bool FontGetScriptSupportOverride(Rid fontRid, string script)
Parameters
Returns
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
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
Ridspacing
TextServer.SpacingType
Returns
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
FontGetStyle(Rid)
Returns font style flags, see TextServer.FontStyle.
public TextServer.FontStyle FontGetStyle(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetStyleName(Rid)
Returns font style name.
public string FontGetStyleName(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetSubpixelPositioning(Rid)
Returns font subpixel glyph positioning mode.
public TextServer.SubpixelPositioning FontGetSubpixelPositioning(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetSupportedChars(Rid)
Returns a string containing all the characters available in the font.
public string FontGetSupportedChars(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetTextureCount(Rid, Vector2I)
Returns number of textures used by font cache entry.
public long FontGetTextureCount(Rid fontRid, Vector2I size)
Parameters
Returns
FontGetTextureImage(Rid, Vector2I, long)
Returns font cache texture image data.
public Image FontGetTextureImage(Rid fontRid, Vector2I size, long textureIndex)
Parameters
Returns
FontGetTextureOffsets(Rid, Vector2I, long)
Returns array containing glyph packing data.
public int[] FontGetTextureOffsets(Rid fontRid, Vector2I size, long textureIndex)
Parameters
Returns
- int[]
FontGetTransform(Rid)
Returns 2D transform applied to the font outlines.
public Transform2D FontGetTransform(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontGetUnderlinePosition(Rid, long)
Returns pixel offset of the underline below the baseline.
public double FontGetUnderlinePosition(Rid fontRid, long size)
Parameters
Returns
FontGetUnderlineThickness(Rid, long)
Returns thickness of the underline in pixels.
public double FontGetUnderlineThickness(Rid fontRid, long size)
Parameters
Returns
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
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
FontHasChar(Rid, long)
Returns true
if a Unicode char
is available in the font.
public bool FontHasChar(Rid fontRid, long @char)
Parameters
Returns
FontIsAllowSystemFallback(Rid)
Returns true
if system fonts can be automatically used as fallbacks.
public bool FontIsAllowSystemFallback(Rid fontRid)
Parameters
fontRid
Rid
Returns
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
FontIsLanguageSupported(Rid, string)
Returns true
, if font supports given language (ISO 639 code).
public bool FontIsLanguageSupported(Rid fontRid, string language)
Parameters
Returns
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
FontIsScriptSupported(Rid, string)
Returns true
, if font supports given script (ISO 15924 code).
public bool FontIsScriptSupported(Rid fontRid, string script)
Parameters
Returns
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
FontRemoveKerning(Rid, long, Vector2I)
Removes kerning override for the pair of glyphs.
public void FontRemoveKerning(Rid fontRid, long size, Vector2I glyphPair)
Parameters
FontRemoveLanguageSupportOverride(Rid, string)
Remove language support override.
public void FontRemoveLanguageSupportOverride(Rid fontRid, string language)
Parameters
FontRemoveScriptSupportOverride(Rid, string)
Removes script support override.
public void FontRemoveScriptSupportOverride(Rid fontRid, string script)
Parameters
FontRemoveSizeCache(Rid, Vector2I)
Removes specified font size from the cache entry.
public void FontRemoveSizeCache(Rid fontRid, Vector2I size)
Parameters
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
FontRenderGlyph(Rid, Vector2I, long)
Renders specified glyph to the font cache texture.
public void FontRenderGlyph(Rid fontRid, Vector2I size, long index)
Parameters
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
FontSetAllowSystemFallback(Rid, bool)
If set to true
, system fonts can be automatically used as fallbacks.
public void FontSetAllowSystemFallback(Rid fontRid, bool allowSystemFallback)
Parameters
FontSetAntialiasing(Rid, FontAntialiasing)
Sets font anti-aliasing mode.
public void FontSetAntialiasing(Rid fontRid, TextServer.FontAntialiasing antialiasing)
Parameters
fontRid
Ridantialiasing
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
FontSetData(Rid, byte[])
Sets font source data, e.g contents of the dynamic font source file.
public void FontSetData(Rid fontRid, byte[] data)
Parameters
FontSetDescent(Rid, long, double)
Sets the font descent (number of pixels below the baseline).
public void FontSetDescent(Rid fontRid, long size, double descent)
Parameters
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
FontSetFaceIndex(Rid, long)
Sets an active face index in the TrueType / OpenType collection.
public void FontSetFaceIndex(Rid fontRid, long faceIndex)
Parameters
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
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
RidfixedSizeScaleMode
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
FontSetGenerateMipmaps(Rid, bool)
If set to true
font texture mipmap generation is enabled.
public void FontSetGenerateMipmaps(Rid fontRid, bool generateMipmaps)
Parameters
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
FontSetGlyphOffset(Rid, Vector2I, long, Vector2)
Sets glyph offset from the baseline.
public void FontSetGlyphOffset(Rid fontRid, Vector2I size, long glyph, Vector2 offset)
Parameters
FontSetGlyphSize(Rid, Vector2I, long, Vector2)
Sets size of the glyph.
public void FontSetGlyphSize(Rid fontRid, Vector2I size, long glyph, Vector2 glSize)
Parameters
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
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
FontSetHinting(Rid, Hinting)
Sets font hinting mode. Used by dynamic fonts only.
public void FontSetHinting(Rid fontRid, TextServer.Hinting hinting)
Parameters
fontRid
Ridhinting
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
FontSetLanguageSupportOverride(Rid, string, bool)
Adds override for FontIsLanguageSupported(Rid, string).
public void FontSetLanguageSupportOverride(Rid fontRid, string language, bool supported)
Parameters
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
FontSetMsdfSize(Rid, long)
Sets source font size used to generate MSDF textures.
public void FontSetMsdfSize(Rid fontRid, long msdfSize)
Parameters
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
FontSetName(Rid, string)
Sets the font family name.
public void FontSetName(Rid fontRid, string name)
Parameters
FontSetOpentypeFeatureOverrides(Rid, Dictionary)
Sets font OpenType feature set override.
public void FontSetOpentypeFeatureOverrides(Rid fontRid, Dictionary overrides)
Parameters
fontRid
Ridoverrides
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
FontSetScale(Rid, long, double)
Sets scaling factor of the color bitmap font.
public void FontSetScale(Rid fontRid, long size, double scale)
Parameters
FontSetScriptSupportOverride(Rid, string, bool)
Adds override for FontIsScriptSupported(Rid, string).
public void FontSetScriptSupportOverride(Rid fontRid, string script, bool supported)
Parameters
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
Ridspacing
TextServer.SpacingTypevalue
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
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
Ridstyle
TextServer.FontStyle
FontSetStyleName(Rid, string)
Sets the font style name.
public void FontSetStyleName(Rid fontRid, string name)
Parameters
FontSetSubpixelPositioning(Rid, SubpixelPositioning)
Sets font subpixel glyph positioning mode.
public void FontSetSubpixelPositioning(Rid fontRid, TextServer.SubpixelPositioning subpixelPositioning)
Parameters
fontRid
RidsubpixelPositioning
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
FontSetTextureOffsets(Rid, Vector2I, long, int[])
Sets array containing glyph packing data.
public void FontSetTextureOffsets(Rid fontRid, Vector2I size, long textureIndex, int[] offset)
Parameters
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
Ridtransform
Transform2D
FontSetUnderlinePosition(Rid, long, double)
Sets pixel offset of the underline below the baseline.
public void FontSetUnderlinePosition(Rid fontRid, long size, double underlinePosition)
Parameters
FontSetUnderlineThickness(Rid, long, double)
Sets thickness of the underline in pixels.
public void FontSetUnderlineThickness(Rid fontRid, long size, double underlineThickness)
Parameters
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
RidvariationCoordinates
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
FontSupportedFeatureList(Rid)
Returns the dictionary of the supported OpenType features.
public Dictionary FontSupportedFeatureList(Rid fontRid)
Parameters
fontRid
Rid
Returns
FontSupportedVariationList(Rid)
Returns the dictionary of the supported OpenType variation coordinates.
public Dictionary FontSupportedVariationList(Rid fontRid)
Parameters
fontRid
Rid
Returns
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
Returns
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
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
Returns
GetName()
Returns the name of the server interface.
public string GetName()
Returns
GetSupportDataFileName()
Returns default TextServer database (e.g. ICU break iterators and dictionaries) filename.
public string GetSupportDataFileName()
Returns
GetSupportDataInfo()
Returns TextServer database (e.g. ICU break iterators and dictionaries) description.
public string GetSupportDataInfo()
Returns
Has(Rid)
Returns true
if rid
is valid resource owned by this text server.
public bool Has(Rid rid)
Parameters
rid
Rid
Returns
HasFeature(Feature)
Returns true
if the server supports a feature.
public bool HasFeature(TextServer.Feature feature)
Parameters
feature
TextServer.Feature
Returns
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
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
Returns
IsLocaleRightToLeft(string)
Returns true
if locale is right-to-left.
public bool IsLocaleRightToLeft(string locale)
Parameters
locale
string
Returns
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
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
NameToTag(string)
Converts readable feature, variation, script or language name to OpenType tag.
public long NameToTag(string name)
Parameters
name
string
Returns
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
Returns
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.StructuredTextParserargs
Arraytext
string
Returns
PercentSign(string)
Returns percent sign used in the language
.
public string PercentSign(string language = "")
Parameters
language
string
Returns
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
ShapedGetSpanCount(Rid)
Returns number of text spans added using ShapedTextAddString(Rid, string, Array<Rid>, long, Dictionary, string, Variant) or ShapedTextAddObject(Rid, Variant, Vector2, InlineAlignment, long, double).
public long ShapedGetSpanCount(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedGetSpanMeta(Rid, long)
Returns text span metadata.
public Variant ShapedGetSpanMeta(Rid shaped, long index)
Parameters
Returns
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
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
Returns
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
Ridtext
stringfonts
Array<Rid>size
longopentypeFeatures
Dictionarylanguage
stringmeta
Variant
Returns
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
Returns
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
Ridcanvas
Ridpos
Vector2clipL
doubleclipR
doublecolor
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
Ridcanvas
Ridpos
Vector2clipL
doubleclipR
doubleoutlineSize
longcolor
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
Ridwidth
doublejustificationFlags
TextServer.JustificationFlag
Returns
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
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
Returns
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
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
ShapedTextGetDirection(Rid)
Returns direction of the text.
public TextServer.Direction ShapedTextGetDirection(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetDominantDirectionInRange(Rid, long, long)
Returns dominant direction of in the range of text.
public TextServer.Direction ShapedTextGetDominantDirectionInRange(Rid shaped, long start, long end)
Parameters
Returns
ShapedTextGetEllipsisGlyphCount(Rid)
Returns number of glyphs in the ellipsis.
public long ShapedTextGetEllipsisGlyphCount(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetEllipsisGlyphs(Rid)
Returns array of the glyphs in the ellipsis.
public Array<Dictionary> ShapedTextGetEllipsisGlyphs(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetEllipsisPos(Rid)
Returns position of the ellipsis.
public long ShapedTextGetEllipsisPos(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetGlyphCount(Rid)
Returns number of glyphs in the buffer.
public long ShapedTextGetGlyphCount(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetGlyphs(Rid)
Returns an array of glyphs in the visual order.
public Array<Dictionary> ShapedTextGetGlyphs(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetGraphemeBounds(Rid, long)
Returns composite character's bounds as offsets from the start of the line.
public Vector2 ShapedTextGetGraphemeBounds(Rid shaped, long pos)
Parameters
Returns
ShapedTextGetInferredDirection(Rid)
Returns direction of the text, inferred by the BiDi algorithm.
public TextServer.Direction ShapedTextGetInferredDirection(Rid shaped)
Parameters
shaped
Rid
Returns
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
Ridwidth
doublestart
longbreakFlags
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
Ridwidth
float[]start
longonce
boolbreakFlags
TextServer.LineBreakFlag
Returns
- int[]
ShapedTextGetObjectRect(Rid, Variant)
Returns bounding rectangle of the inline object.
public Rect2 ShapedTextGetObjectRect(Rid shaped, Variant key)
Parameters
Returns
ShapedTextGetObjects(Rid)
Returns array of inline objects.
public Array ShapedTextGetObjects(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetOrientation(Rid)
Returns text orientation.
public TextServer.Orientation ShapedTextGetOrientation(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetParent(Rid)
Returns the parent buffer from which the substring originates.
public Rid ShapedTextGetParent(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetPreserveControl(Rid)
Returns true
if text buffer is configured to display control characters.
public bool ShapedTextGetPreserveControl(Rid shaped)
Parameters
shaped
Rid
Returns
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
ShapedTextGetRange(Rid)
Returns substring buffer character range in the parent buffer.
public Vector2I ShapedTextGetRange(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetSelection(Rid, long, long)
Returns selection rectangles for the specified character range.
public Vector2[] ShapedTextGetSelection(Rid shaped, long start, long end)
Parameters
Returns
- Vector2[]
ShapedTextGetSize(Rid)
Returns size of the text.
public Vector2 ShapedTextGetSize(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetSpacing(Rid, SpacingType)
Returns extra spacing added between glyphs or lines in pixels.
public long ShapedTextGetSpacing(Rid shaped, TextServer.SpacingType spacing)
Parameters
shaped
Ridspacing
TextServer.SpacingType
Returns
ShapedTextGetTrimPos(Rid)
Returns the position of the overrun trim.
public long ShapedTextGetTrimPos(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetUnderlinePosition(Rid)
Returns pixel offset of the underline below the baseline.
public double ShapedTextGetUnderlinePosition(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetUnderlineThickness(Rid)
Returns thickness of the underline.
public double ShapedTextGetUnderlineThickness(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextGetWidth(Rid)
Returns width (for horizontal layout) or height (for vertical) of the text.
public double ShapedTextGetWidth(Rid shaped)
Parameters
shaped
Rid
Returns
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
RidgraphemeFlags
TextServer.GraphemeFlag
Returns
- int[]
ShapedTextHasVisibleChars(Rid)
Returns true
if text buffer contains any visible characters.
public bool ShapedTextHasVisibleChars(Rid shaped)
Parameters
shaped
Rid
Returns
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
Returns
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
Returns
ShapedTextIsReady(Rid)
Returns true
if buffer is successfully shaped.
public bool ShapedTextIsReady(Rid shaped)
Parameters
shaped
Rid
Returns
ShapedTextNextCharacterPos(Rid, long)
Returns composite character end position closest to the pos
.
public long ShapedTextNextCharacterPos(Rid shaped, long pos)
Parameters
Returns
ShapedTextNextGraphemePos(Rid, long)
Returns grapheme end position closest to the pos
.
public long ShapedTextNextGraphemePos(Rid shaped, long pos)
Parameters
Returns
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
Ridwidth
doubleoverrunTrimFlags
TextServer.TextOverrunFlag
ShapedTextPrevCharacterPos(Rid, long)
Returns composite character start position closest to the pos
.
public long ShapedTextPrevCharacterPos(Rid shaped, long pos)
Parameters
Returns
ShapedTextPrevGraphemePos(Rid, long)
Returns grapheme start position closest to the pos
.
public long ShapedTextPrevGraphemePos(Rid shaped, long pos)
Parameters
Returns
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
Ridkey
Variantsize
Vector2inlineAlign
InlineAlignmentbaseline
double
Returns
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
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
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
Riddirection
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
Ridorientation
TextServer.Orientation
ShapedTextSetPreserveControl(Rid, bool)
If set to true
text buffer will display control characters.
public void ShapedTextSetPreserveControl(Rid shaped, bool enabled)
Parameters
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
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
Ridspacing
TextServer.SpacingTypevalue
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
ShapedTextSortLogical(Rid)
Returns text glyphs in the logical order.
public Array<Dictionary> ShapedTextSortLogical(Rid shaped)
Parameters
shaped
Rid
Returns
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
Returns
ShapedTextTabAlign(Rid, float[])
Aligns shaped text to the given tab-stops.
public double ShapedTextTabAlign(Rid shaped, float[] tabStops)
Parameters
Returns
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
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
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
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
Returns
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
Returns
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
TagToName(long)
Converts OpenType tag to readable feature, variation, script or language name.
public string TagToName(long tag)
Parameters
tag
long