TextServer

package
v0.0.0-...-546f9d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package TextServer provides methods for working with TextServer object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsTextServer() Instance
}

type AutowrapMode

type AutowrapMode = gdclass.TextServerAutowrapMode //gd:TextServer.AutowrapMode
const (
	/*Autowrap is disabled.*/
	AutowrapOff AutowrapMode = 0
	/*Wraps the text inside the node's bounding rectangle by allowing to break lines at arbitrary positions, which is useful when very limited space is available.*/
	AutowrapArbitrary AutowrapMode = 1
	/*Wraps the text inside the node's bounding rectangle by soft-breaking between words.*/
	AutowrapWord AutowrapMode = 2
	/*Behaves similarly to [constant AUTOWRAP_WORD], but force-breaks a word if that single word does not fit in one line.*/
	AutowrapWordSmart AutowrapMode = 3
)

type ContourPointTag

type ContourPointTag = gdclass.TextServerContourPointTag //gd:TextServer.ContourPointTag
const (
	/*Contour point is on the curve.*/
	ContourCurveTagOn ContourPointTag = 1
	/*Contour point isn't on the curve, but serves as a control point for a conic (quadratic) Bézier arc.*/
	ContourCurveTagOffConic ContourPointTag = 0
	/*Contour point isn't on the curve, but serves as a control point for a cubic Bézier arc.*/
	ContourCurveTagOffCubic ContourPointTag = 2
)

type Direction

type Direction = gdclass.TextServerDirection //gd:TextServer.Direction
const (
	/*Text direction is determined based on contents and current locale.*/
	DirectionAuto Direction = 0
	/*Text is written from left to right.*/
	DirectionLtr Direction = 1
	/*Text is written from right to left.*/
	DirectionRtl Direction = 2
	/*Text writing direction is the same as base string writing direction. Used for BiDi override only.*/
	DirectionInherited Direction = 3
)

type Feature

type Feature = gdclass.TextServerFeature //gd:TextServer.Feature
const (
	/*TextServer supports simple text layouts.*/
	FeatureSimpleLayout Feature = 1
	/*TextServer supports bidirectional text layouts.*/
	FeatureBidiLayout Feature = 2
	/*TextServer supports vertical layouts.*/
	FeatureVerticalLayout Feature = 4
	/*TextServer supports complex text shaping.*/
	FeatureShaping Feature = 8
	/*TextServer supports justification using kashidas.*/
	FeatureKashidaJustification Feature = 16
	/*TextServer supports complex line/word breaking rules (e.g. dictionary based).*/
	FeatureBreakIterators Feature = 32
	/*TextServer supports loading bitmap fonts.*/
	FeatureFontBitmap Feature = 64
	/*TextServer supports loading dynamic (TrueType, OpeType, etc.) fonts.*/
	FeatureFontDynamic Feature = 128
	/*TextServer supports multichannel signed distance field dynamic font rendering.*/
	FeatureFontMsdf Feature = 256
	/*TextServer supports loading system fonts.*/
	FeatureFontSystem Feature = 512
	/*TextServer supports variable fonts.*/
	FeatureFontVariable Feature = 1024
	/*TextServer supports locale dependent and context sensitive case conversion.*/
	FeatureContextSensitiveCaseConversion Feature = 2048
	/*TextServer require external data file for some features, see [method load_support_data].*/
	FeatureUseSupportData Feature = 4096
	/*TextServer supports UAX #31 identifier validation, see [method is_valid_identifier].*/
	FeatureUnicodeIdentifiers Feature = 8192
	/*TextServer supports [url=https://unicode.org/reports/tr36/]Unicode Technical Report #36[/url] and [url=https://unicode.org/reports/tr39/]Unicode Technical Standard #39[/url] based spoof detection features.*/
	FeatureUnicodeSecurity Feature = 16384
)

type FixedSizeScaleMode

type FixedSizeScaleMode = gdclass.TextServerFixedSizeScaleMode //gd:TextServer.FixedSizeScaleMode
const (
	/*Bitmap font is not scaled.*/
	FixedSizeScaleDisable FixedSizeScaleMode = 0
	/*Bitmap font is scaled to the closest integer multiple of the font's fixed size. This is the recommended option for pixel art fonts.*/
	FixedSizeScaleIntegerOnly FixedSizeScaleMode = 1
	/*Bitmap font is scaled to an arbitrary (fractional) size. This is the recommended option for non-pixel art fonts.*/
	FixedSizeScaleEnabled FixedSizeScaleMode = 2
)

type FontAntialiasing

type FontAntialiasing = gdclass.TextServerFontAntialiasing //gd:TextServer.FontAntialiasing
const (
	/*Font glyphs are rasterized as 1-bit bitmaps.*/
	FontAntialiasingNone FontAntialiasing = 0
	/*Font glyphs are rasterized as 8-bit grayscale anti-aliased bitmaps.*/
	FontAntialiasingGray FontAntialiasing = 1
	/*Font glyphs are rasterized for LCD screens.
	  LCD subpixel layout is determined by the value of [code]gui/theme/lcd_subpixel_layout[/code] project settings.
	  LCD subpixel anti-aliasing mode is suitable only for rendering horizontal, unscaled text in 2D.*/
	FontAntialiasingLcd FontAntialiasing = 2
)

type FontLCDSubpixelLayout

type FontLCDSubpixelLayout = gdclass.TextServerFontLCDSubpixelLayout //gd:TextServer.FontLCDSubpixelLayout
const (
	/*Unknown or unsupported subpixel layout, LCD subpixel antialiasing is disabled.*/
	FontLcdSubpixelLayoutNone FontLCDSubpixelLayout = 0
	/*Horizontal RGB subpixel layout.*/
	FontLcdSubpixelLayoutHrgb FontLCDSubpixelLayout = 1
	/*Horizontal BGR subpixel layout.*/
	FontLcdSubpixelLayoutHbgr FontLCDSubpixelLayout = 2
	/*Vertical RGB subpixel layout.*/
	FontLcdSubpixelLayoutVrgb FontLCDSubpixelLayout = 3
	/*Vertical BGR subpixel layout.*/
	FontLcdSubpixelLayoutVbgr FontLCDSubpixelLayout = 4
	/*Represents the size of the [enum FontLCDSubpixelLayout] enum.*/
	FontLcdSubpixelLayoutMax FontLCDSubpixelLayout = 5
)

type FontStyle

type FontStyle = gdclass.TextServerFontStyle //gd:TextServer.FontStyle
const (
	/*Font is bold.*/
	FontBold FontStyle = 1
	/*Font is italic or oblique.*/
	FontItalic FontStyle = 2
	/*Font have fixed-width characters.*/
	FontFixedWidth FontStyle = 4
)

type GraphemeFlag

type GraphemeFlag = gdclass.TextServerGraphemeFlag //gd:TextServer.GraphemeFlag
const (
	/*Grapheme is supported by the font, and can be drawn.*/
	GraphemeIsValid GraphemeFlag = 1
	/*Grapheme is part of right-to-left or bottom-to-top run.*/
	GraphemeIsRtl GraphemeFlag = 2
	/*Grapheme is not part of source text, it was added by justification process.*/
	GraphemeIsVirtual GraphemeFlag = 4
	/*Grapheme is whitespace.*/
	GraphemeIsSpace GraphemeFlag = 8
	/*Grapheme is mandatory break point (e.g. [code]"\n"[/code]).*/
	GraphemeIsBreakHard GraphemeFlag = 16
	/*Grapheme is optional break point (e.g. space).*/
	GraphemeIsBreakSoft GraphemeFlag = 32
	/*Grapheme is the tabulation character.*/
	GraphemeIsTab GraphemeFlag = 64
	/*Grapheme is kashida.*/
	GraphemeIsElongation GraphemeFlag = 128
	/*Grapheme is punctuation character.*/
	GraphemeIsPunctuation GraphemeFlag = 256
	/*Grapheme is underscore character.*/
	GraphemeIsUnderscore GraphemeFlag = 512
	/*Grapheme is connected to the previous grapheme. Breaking line before this grapheme is not safe.*/
	GraphemeIsConnected GraphemeFlag = 1024
	/*It is safe to insert a U+0640 before this grapheme for elongation.*/
	GraphemeIsSafeToInsertTatweel GraphemeFlag = 2048
	/*Grapheme is an object replacement character for the embedded object.*/
	GraphemeIsEmbeddedObject GraphemeFlag = 4096
	/*Grapheme is a soft hyphen.*/
	GraphemeIsSoftHyphen GraphemeFlag = 8192
)

type Hinting

type Hinting = gdclass.TextServerHinting //gd:TextServer.Hinting
const (
	/*Disables font hinting (smoother but less crisp).*/
	HintingNone Hinting = 0
	/*Use the light font hinting mode.*/
	HintingLight Hinting = 1
	/*Use the default font hinting mode (crisper but less smooth).
	  [b]Note:[/b] This hinting mode changes both horizontal and vertical glyph metrics. If applied to monospace font, some glyphs might have different width.*/
	HintingNormal Hinting = 2
)

type InlineAlignment

type InlineAlignment int
const (
	/*Aligns the top of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.*/
	InlineAlignmentTopTo InlineAlignment = 0
	/*Aligns the center of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.*/
	InlineAlignmentCenterTo InlineAlignment = 1
	/*Aligns the baseline (user defined) of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.*/
	InlineAlignmentBaselineTo InlineAlignment = 3
	/*Aligns the bottom of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.*/
	InlineAlignmentBottomTo InlineAlignment = 2
	/*Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the top of the text.*/
	InlineAlignmentToTop InlineAlignment = 0
	/*Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the center of the text.*/
	InlineAlignmentToCenter InlineAlignment = 4
	/*Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the baseline of the text.*/
	InlineAlignmentToBaseline InlineAlignment = 8
	/*Aligns inline object (e.g. image, table) to the bottom of the text.*/
	InlineAlignmentToBottom InlineAlignment = 12
	/*Aligns top of the inline object (e.g. image, table) to the top of the text. Equivalent to [code]INLINE_ALIGNMENT_TOP_TO | INLINE_ALIGNMENT_TO_TOP[/code].*/
	InlineAlignmentTop InlineAlignment = 0
	/*Aligns center of the inline object (e.g. image, table) to the center of the text. Equivalent to [code]INLINE_ALIGNMENT_CENTER_TO | INLINE_ALIGNMENT_TO_CENTER[/code].*/
	InlineAlignmentCenter InlineAlignment = 5
	/*Aligns bottom of the inline object (e.g. image, table) to the bottom of the text. Equivalent to [code]INLINE_ALIGNMENT_BOTTOM_TO | INLINE_ALIGNMENT_TO_BOTTOM[/code].*/
	InlineAlignmentBottom InlineAlignment = 14
	/*A bit mask for [code]INLINE_ALIGNMENT_*_TO[/code] alignment constants.*/
	InlineAlignmentImageMask InlineAlignment = 3
	/*A bit mask for [code]INLINE_ALIGNMENT_TO_*[/code] alignment constants.*/
	InlineAlignmentTextMask InlineAlignment = 12
)

type Instance

type Instance [1]gdclass.TextServer

[TextServer] is the API backend for managing fonts and rendering text. [b]Note:[/b] This is a low-level API, consider using [TextLine], [TextParagraph], and [Font] classes instead. This is an abstract class, so to get the currently active [TextServer] instance, use the following code: [codeblocks] [gdscript] var ts = TextServerManager.get_primary_interface() [/gdscript] [csharp] var ts = TextServerManager.GetPrimaryInterface(); [/csharp] [/codeblocks]

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsTextServer

func (self Instance) AsTextServer() Instance

func (Instance) CreateFont

func (self Instance) CreateFont() RID.Font

Creates a new, empty font cache entry resource. To free the resulting resource, use the [method free_rid] method.

func (Instance) CreateFontLinkedVariation

func (self Instance) CreateFontLinkedVariation(font_rid RID.Font) RID.Font

Creates a new variation existing font which is reusing the same glyph cache and font data. To free the resulting resource, use the [method free_rid] method.

func (Instance) CreateShapedText

func (self Instance) CreateShapedText() RID.TextBuffer

Creates a new buffer for complex text layout, with the given [param direction] and [param orientation]. To free the resulting buffer, use [method free_rid] method. [b]Note:[/b] Direction is ignored if server does not support [constant FEATURE_BIDI_LAYOUT] feature (supported by [TextServerAdvanced]). [b]Note:[/b] Orientation is ignored if server does not support [constant FEATURE_VERTICAL_LAYOUT] feature (supported by [TextServerAdvanced]).

func (Instance) DrawHexCodeBox

func (self Instance) DrawHexCodeBox(canvas RID.Canvas, size int, pos Vector2.XY, index int, color Color.RGBA)

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

func (Instance) FontClearGlyphs

func (self Instance) FontClearGlyphs(font_rid RID.Font, size Vector2i.XY)

Removes all rendered glyph information from the cache entry. [b]Note:[/b] This function will not remove textures associated with the glyphs, use [method font_remove_texture] to remove them manually.

func (Instance) FontClearKerningMap

func (self Instance) FontClearKerningMap(font_rid RID.Font, size int)

Removes all kerning overrides.

func (Instance) FontClearSizeCache

func (self Instance) FontClearSizeCache(font_rid RID.Font)

Removes all font sizes from the cache entry.

func (Instance) FontClearTextures

func (self Instance) FontClearTextures(font_rid RID.Font, size Vector2i.XY)

Removes all textures from font cache entry. [b]Note:[/b] This function will not remove glyphs associated with the texture, use [method font_remove_glyph] to remove them manually.

func (Instance) FontDrawGlyph

func (self Instance) FontDrawGlyph(font_rid RID.Font, canvas RID.Canvas, size int, pos Vector2.XY, index int)

Draws single glyph into a canvas item at the position, using [param font_rid] at the size [param size]. [b]Note:[/b] Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index]. [b]Note:[/b] If there are pending glyphs to render, calling this function might trigger the texture cache update.

func (Instance) FontDrawGlyphOutline

func (self Instance) FontDrawGlyphOutline(font_rid RID.Font, canvas RID.Canvas, size int, outline_size int, pos Vector2.XY, index int)

Draws single glyph outline of size [param outline_size] into a canvas item at the position, using [param font_rid] at the size [param size]. [b]Note:[/b] Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index]. [b]Note:[/b] If there are pending glyphs to render, calling this function might trigger the texture cache update.

func (Instance) FontGetAntialiasing

func (self Instance) FontGetAntialiasing(font_rid RID.Font) gdclass.TextServerFontAntialiasing

Returns font anti-aliasing mode.

func (Instance) FontGetAscent

func (self Instance) FontGetAscent(font_rid RID.Font, size int) Float.X

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

func (Instance) FontGetBaselineOffset

func (self Instance) FontGetBaselineOffset(font_rid RID.Font) Float.X

Returns extra baseline offset (as a fraction of font height).

func (Instance) FontGetCharFromGlyphIndex

func (self Instance) FontGetCharFromGlyphIndex(font_rid RID.Font, size int, glyph_index int) int

Returns character code associated with [param glyph_index], or [code]0[/code] if [param glyph_index] is invalid. See [method font_get_glyph_index].

func (Instance) FontGetDescent

func (self Instance) FontGetDescent(font_rid RID.Font, size int) Float.X

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

func (Instance) FontGetDisableEmbeddedBitmaps

func (self Instance) FontGetDisableEmbeddedBitmaps(font_rid RID.Font) bool

Returns whether the font's embedded bitmap loading is disabled.

func (Instance) FontGetEmbolden

func (self Instance) FontGetEmbolden(font_rid RID.Font) Float.X

Returns font embolden strength.

func (Instance) FontGetFaceCount

func (self Instance) FontGetFaceCount(font_rid RID.Font) int

Returns number of faces in the TrueType / OpenType collection.

func (Instance) FontGetFaceIndex

func (self Instance) FontGetFaceIndex(font_rid RID.Font) int

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

func (Instance) FontGetFixedSize

func (self Instance) FontGetFixedSize(font_rid RID.Font) int

Returns bitmap font fixed size.

func (Instance) FontGetFixedSizeScaleMode

func (self Instance) FontGetFixedSizeScaleMode(font_rid RID.Font) gdclass.TextServerFixedSizeScaleMode

Returns bitmap font scaling mode.

func (Instance) FontGetGenerateMipmaps

func (self Instance) FontGetGenerateMipmaps(font_rid RID.Font) bool

Returns [code]true[/code] if font texture mipmap generation is enabled.

func (Instance) FontGetGlobalOversampling

func (self Instance) FontGetGlobalOversampling() Float.X

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

func (Instance) FontGetGlyphAdvance

func (self Instance) FontGetGlyphAdvance(font_rid RID.Font, size int, glyph int) Vector2.XY

Returns glyph advance (offset of the next glyph). [b]Note:[/b] Advance for glyphs outlines is the same as the base glyph advance and is not saved.

func (Instance) FontGetGlyphContours

func (self Instance) FontGetGlyphContours(font RID.Font, size int, index int) map[string]interface{}

Returns outline contours of the glyph as a [Dictionary] with the following contents: [code]points[/code] - [PackedVector3Array], containing outline points. [code]x[/code] and [code]y[/code] are point coordinates. [code]z[/code] is the type of the point, using the [enum ContourPointTag] values. [code]contours[/code] - [PackedInt32Array], containing indices the end points of each contour. [code]orientation[/code] - [bool], contour orientation. If [code]true[/code], clockwise contours must be filled.

func (Instance) FontGetGlyphIndex

func (self Instance) FontGetGlyphIndex(font_rid RID.Font, size int, char int, variation_selector int) int

Returns the glyph index of a [param char], optionally modified by the [param variation_selector]. See [method font_get_char_from_glyph_index].

func (Instance) FontGetGlyphList

func (self Instance) FontGetGlyphList(font_rid RID.Font, size Vector2i.XY) []int32

Returns list of rendered glyphs in the cache entry.

func (Instance) FontGetGlyphOffset

func (self Instance) FontGetGlyphOffset(font_rid RID.Font, size Vector2i.XY, glyph int) Vector2.XY

Returns glyph offset from the baseline.

func (Instance) FontGetGlyphSize

func (self Instance) FontGetGlyphSize(font_rid RID.Font, size Vector2i.XY, glyph int) Vector2.XY

Returns size of the glyph.

func (Instance) FontGetGlyphTextureIdx

func (self Instance) FontGetGlyphTextureIdx(font_rid RID.Font, size Vector2i.XY, glyph int) int

Returns index of the cache texture containing the glyph.

func (Instance) FontGetGlyphTextureRid

func (self Instance) FontGetGlyphTextureRid(font_rid RID.Font, size Vector2i.XY, glyph int) RID.Texture

Returns resource ID of the cache texture containing the glyph. [b]Note:[/b] If there are pending glyphs to render, calling this function might trigger the texture cache update.

func (Instance) FontGetGlyphTextureSize

func (self Instance) FontGetGlyphTextureSize(font_rid RID.Font, size Vector2i.XY, glyph int) Vector2.XY

Returns size of the cache texture containing the glyph. [b]Note:[/b] If there are pending glyphs to render, calling this function might trigger the texture cache update.

func (Instance) FontGetGlyphUvRect

func (self Instance) FontGetGlyphUvRect(font_rid RID.Font, size Vector2i.XY, glyph int) Rect2.PositionSize

Returns rectangle in the cache texture containing the glyph.

func (Instance) FontGetHinting

func (self Instance) FontGetHinting(font_rid RID.Font) gdclass.TextServerHinting

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

func (Instance) FontGetKerning

func (self Instance) FontGetKerning(font_rid RID.Font, size int, glyph_pair Vector2i.XY) Vector2.XY

Returns kerning for the pair of glyphs.

func (Instance) FontGetKerningList

func (self Instance) FontGetKerningList(font_rid RID.Font, size int) []Vector2i.XY

Returns list of the kerning overrides.

func (Instance) FontGetLanguageSupportOverride

func (self Instance) FontGetLanguageSupportOverride(font_rid RID.Font, language string) bool

Returns [code]true[/code] if support override is enabled for the [param language].

func (Instance) FontGetLanguageSupportOverrides

func (self Instance) FontGetLanguageSupportOverrides(font_rid RID.Font) []string

Returns list of language support overrides.

func (Instance) FontGetMsdfPixelRange

func (self Instance) FontGetMsdfPixelRange(font_rid RID.Font) int

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

func (Instance) FontGetMsdfSize

func (self Instance) FontGetMsdfSize(font_rid RID.Font) int

Returns source font size used to generate MSDF textures.

func (Instance) FontGetName

func (self Instance) FontGetName(font_rid RID.Font) string

Returns font family name.

func (Instance) FontGetOpentypeFeatureOverrides

func (self Instance) FontGetOpentypeFeatureOverrides(font_rid RID.Font) map[string]string

Returns font OpenType feature set override.

func (Instance) FontGetOtNameStrings

func (self Instance) FontGetOtNameStrings(font_rid RID.Font) map[string]string

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

func (Instance) FontGetOversampling

func (self Instance) FontGetOversampling(font_rid RID.Font) Float.X

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

func (Instance) FontGetScale

func (self Instance) FontGetScale(font_rid RID.Font, size int) Float.X

Returns scaling factor of the color bitmap font.

func (Instance) FontGetScriptSupportOverride

func (self Instance) FontGetScriptSupportOverride(font_rid RID.Font, script string) bool

Returns [code]true[/code] if support override is enabled for the [param script].

func (Instance) FontGetScriptSupportOverrides

func (self Instance) FontGetScriptSupportOverrides(font_rid RID.Font) []string

Returns list of script support overrides.

func (Instance) FontGetSizeCacheList

func (self Instance) FontGetSizeCacheList(font_rid RID.Font) []Vector2i.XY

Returns list of the font sizes in the cache. Each size is [Vector2i] with font size and outline size.

func (Instance) FontGetSpacing

func (self Instance) FontGetSpacing(font_rid RID.Font, spacing gdclass.TextServerSpacingType) int

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

func (Instance) FontGetStretch

func (self Instance) FontGetStretch(font_rid RID.Font) int

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

func (Instance) FontGetStyle

func (self Instance) FontGetStyle(font_rid RID.Font) gdclass.TextServerFontStyle

Returns font style flags, see [enum FontStyle].

func (Instance) FontGetStyleName

func (self Instance) FontGetStyleName(font_rid RID.Font) string

Returns font style name.

func (Instance) FontGetSubpixelPositioning

func (self Instance) FontGetSubpixelPositioning(font_rid RID.Font) gdclass.TextServerSubpixelPositioning

Returns font subpixel glyph positioning mode.

func (Instance) FontGetSupportedChars

func (self Instance) FontGetSupportedChars(font_rid RID.Font) string

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

func (Instance) FontGetTextureCount

func (self Instance) FontGetTextureCount(font_rid RID.Font, size Vector2i.XY) int

Returns number of textures used by font cache entry.

func (Instance) FontGetTextureImage

func (self Instance) FontGetTextureImage(font_rid RID.Font, size Vector2i.XY, texture_index int) [1]gdclass.Image

Returns font cache texture image data.

func (Instance) FontGetTextureOffsets

func (self Instance) FontGetTextureOffsets(font_rid RID.Font, size Vector2i.XY, texture_index int) []int32

Returns array containing glyph packing data.

func (Instance) FontGetTransform

func (self Instance) FontGetTransform(font_rid RID.Font) Transform2D.OriginXY

Returns 2D transform applied to the font outlines.

func (Instance) FontGetUnderlinePosition

func (self Instance) FontGetUnderlinePosition(font_rid RID.Font, size int) Float.X

Returns pixel offset of the underline below the baseline.

func (Instance) FontGetUnderlineThickness

func (self Instance) FontGetUnderlineThickness(font_rid RID.Font, size int) Float.X

Returns thickness of the underline in pixels.

func (Instance) FontGetVariationCoordinates

func (self Instance) FontGetVariationCoordinates(font_rid RID.Font) map[string]float32

Returns variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info.

func (Instance) FontGetWeight

func (self Instance) FontGetWeight(font_rid RID.Font) int

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

func (Instance) FontHasChar

func (self Instance) FontHasChar(font_rid RID.Font, char int) bool

Returns [code]true[/code] if a Unicode [param char] is available in the font.

func (Instance) FontIsAllowSystemFallback

func (self Instance) FontIsAllowSystemFallback(font_rid RID.Font) bool

Returns [code]true[/code] if system fonts can be automatically used as fallbacks.

func (Instance) FontIsForceAutohinter

func (self Instance) FontIsForceAutohinter(font_rid RID.Font) bool

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

func (Instance) FontIsLanguageSupported

func (self Instance) FontIsLanguageSupported(font_rid RID.Font, language string) bool

Returns [code]true[/code], if font supports given language ([url=https://en.wikipedia.org/wiki/ISO_639-1]ISO 639[/url] code).

func (Instance) FontIsMultichannelSignedDistanceField

func (self Instance) FontIsMultichannelSignedDistanceField(font_rid RID.Font) bool

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

func (Instance) FontIsScriptSupported

func (self Instance) FontIsScriptSupported(font_rid RID.Font, script string) bool

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

func (Instance) FontRemoveGlyph

func (self Instance) FontRemoveGlyph(font_rid RID.Font, size Vector2i.XY, glyph int)

Removes specified rendered glyph information from the cache entry. [b]Note:[/b] This function will not remove textures associated with the glyphs, use [method font_remove_texture] to remove them manually.

func (Instance) FontRemoveKerning

func (self Instance) FontRemoveKerning(font_rid RID.Font, size int, glyph_pair Vector2i.XY)

Removes kerning override for the pair of glyphs.

func (Instance) FontRemoveLanguageSupportOverride

func (self Instance) FontRemoveLanguageSupportOverride(font_rid RID.Font, language string)

Remove language support override.

func (Instance) FontRemoveScriptSupportOverride

func (self Instance) FontRemoveScriptSupportOverride(font_rid RID.Font, script string)

Removes script support override.

func (Instance) FontRemoveSizeCache

func (self Instance) FontRemoveSizeCache(font_rid RID.Font, size Vector2i.XY)

Removes specified font size from the cache entry.

func (Instance) FontRemoveTexture

func (self Instance) FontRemoveTexture(font_rid RID.Font, size Vector2i.XY, texture_index int)

Removes specified texture from the cache entry. [b]Note:[/b] This function will not remove glyphs associated with the texture, remove them manually, using [method font_remove_glyph].

func (Instance) FontRenderGlyph

func (self Instance) FontRenderGlyph(font_rid RID.Font, size Vector2i.XY, index int)

Renders specified glyph to the font cache texture.

func (Instance) FontRenderRange

func (self Instance) FontRenderRange(font_rid RID.Font, size Vector2i.XY, start int, end int)

Renders the range of characters to the font cache texture.

func (Instance) FontSetAllowSystemFallback

func (self Instance) FontSetAllowSystemFallback(font_rid RID.Font, allow_system_fallback bool)

If set to [code]true[/code], system fonts can be automatically used as fallbacks.

func (Instance) FontSetAntialiasing

func (self Instance) FontSetAntialiasing(font_rid RID.Font, antialiasing gdclass.TextServerFontAntialiasing)

Sets font anti-aliasing mode.

func (Instance) FontSetAscent

func (self Instance) FontSetAscent(font_rid RID.Font, size int, ascent Float.X)

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

func (Instance) FontSetBaselineOffset

func (self Instance) FontSetBaselineOffset(font_rid RID.Font, baseline_offset Float.X)

Sets extra baseline offset (as a fraction of font height).

func (Instance) FontSetData

func (self Instance) FontSetData(font_rid RID.Font, data []byte)

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

func (Instance) FontSetDescent

func (self Instance) FontSetDescent(font_rid RID.Font, size int, descent Float.X)

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

func (Instance) FontSetDisableEmbeddedBitmaps

func (self Instance) FontSetDisableEmbeddedBitmaps(font_rid RID.Font, disable_embedded_bitmaps bool)

If set to [code]true[/code], embedded font bitmap loading is disabled (bitmap-only and color fonts ignore this property).

func (Instance) FontSetEmbolden

func (self Instance) FontSetEmbolden(font_rid RID.Font, strength Float.X)

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

func (Instance) FontSetFaceIndex

func (self Instance) FontSetFaceIndex(font_rid RID.Font, face_index int)

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

func (Instance) FontSetFixedSize

func (self Instance) FontSetFixedSize(font_rid RID.Font, fixed_size int)

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

func (Instance) FontSetFixedSizeScaleMode

func (self Instance) FontSetFixedSizeScaleMode(font_rid RID.Font, fixed_size_scale_mode gdclass.TextServerFixedSizeScaleMode)

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

func (Instance) FontSetForceAutohinter

func (self Instance) FontSetForceAutohinter(font_rid RID.Font, force_autohinter bool)

If set to [code]true[/code] auto-hinting is preferred over font built-in hinting.

func (Instance) FontSetGenerateMipmaps

func (self Instance) FontSetGenerateMipmaps(font_rid RID.Font, generate_mipmaps bool)

If set to [code]true[/code] font texture mipmap generation is enabled.

func (Instance) FontSetGlobalOversampling

func (self Instance) FontSetGlobalOversampling(oversampling Float.X)

Sets oversampling factor, shared by all font in the TextServer. [b]Note:[/b] This value can be automatically changed by display server.

func (Instance) FontSetGlyphAdvance

func (self Instance) FontSetGlyphAdvance(font_rid RID.Font, size int, glyph int, advance Vector2.XY)

Sets glyph advance (offset of the next glyph). [b]Note:[/b] Advance for glyphs outlines is the same as the base glyph advance and is not saved.

func (Instance) FontSetGlyphOffset

func (self Instance) FontSetGlyphOffset(font_rid RID.Font, size Vector2i.XY, glyph int, offset Vector2.XY)

Sets glyph offset from the baseline.

func (Instance) FontSetGlyphSize

func (self Instance) FontSetGlyphSize(font_rid RID.Font, size Vector2i.XY, glyph int, gl_size Vector2.XY)

Sets size of the glyph.

func (Instance) FontSetGlyphTextureIdx

func (self Instance) FontSetGlyphTextureIdx(font_rid RID.Font, size Vector2i.XY, glyph int, texture_idx int)

Sets index of the cache texture containing the glyph.

func (Instance) FontSetGlyphUvRect

func (self Instance) FontSetGlyphUvRect(font_rid RID.Font, size Vector2i.XY, glyph int, uv_rect Rect2.PositionSize)

Sets rectangle in the cache texture containing the glyph.

func (Instance) FontSetHinting

func (self Instance) FontSetHinting(font_rid RID.Font, hinting gdclass.TextServerHinting)

Sets font hinting mode. Used by dynamic fonts only.

func (Instance) FontSetKerning

func (self Instance) FontSetKerning(font_rid RID.Font, size int, glyph_pair Vector2i.XY, kerning Vector2.XY)

Sets kerning for the pair of glyphs.

func (Instance) FontSetLanguageSupportOverride

func (self Instance) FontSetLanguageSupportOverride(font_rid RID.Font, language string, supported bool)

Adds override for [method font_is_language_supported].

func (Instance) FontSetMsdfPixelRange

func (self Instance) FontSetMsdfPixelRange(font_rid RID.Font, msdf_pixel_range int)

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

func (Instance) FontSetMsdfSize

func (self Instance) FontSetMsdfSize(font_rid RID.Font, msdf_size int)

Sets source font size used to generate MSDF textures.

func (Instance) FontSetMultichannelSignedDistanceField

func (self Instance) FontSetMultichannelSignedDistanceField(font_rid RID.Font, msdf bool)

If set to [code]true[/code], 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. [b]Note:[/b] 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.

func (Instance) FontSetName

func (self Instance) FontSetName(font_rid RID.Font, name string)

Sets the font family name.

func (Instance) FontSetOpentypeFeatureOverrides

func (self Instance) FontSetOpentypeFeatureOverrides(font_rid RID.Font, overrides map[string]string)

Sets font OpenType feature set override.

func (Instance) FontSetOversampling

func (self Instance) FontSetOversampling(font_rid RID.Font, oversampling Float.X)

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

func (Instance) FontSetScale

func (self Instance) FontSetScale(font_rid RID.Font, size int, scale Float.X)

Sets scaling factor of the color bitmap font.

func (Instance) FontSetScriptSupportOverride

func (self Instance) FontSetScriptSupportOverride(font_rid RID.Font, script string, supported bool)

Adds override for [method font_is_script_supported].

func (Instance) FontSetSpacing

func (self Instance) FontSetSpacing(font_rid RID.Font, spacing gdclass.TextServerSpacingType, value int)

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

func (Instance) FontSetStretch

func (self Instance) FontSetStretch(font_rid RID.Font, weight int)

Sets font stretch amount, compared to a normal width. A percentage value between [code]50%[/code] and [code]200%[/code]. [b]Note:[/b] This value is used for font matching only and will not affect font rendering. Use [method font_set_face_index], [method font_set_variation_coordinates], or [method font_set_transform] instead.

func (Instance) FontSetStyle

func (self Instance) FontSetStyle(font_rid RID.Font, style gdclass.TextServerFontStyle)

Sets the font style flags, see [enum FontStyle]. [b]Note:[/b] This value is used for font matching only and will not affect font rendering. Use [method font_set_face_index], [method font_set_variation_coordinates], [method font_set_embolden], or [method font_set_transform] instead.

func (Instance) FontSetStyleName

func (self Instance) FontSetStyleName(font_rid RID.Font, name string)

Sets the font style name.

func (Instance) FontSetSubpixelPositioning

func (self Instance) FontSetSubpixelPositioning(font_rid RID.Font, subpixel_positioning gdclass.TextServerSubpixelPositioning)

Sets font subpixel glyph positioning mode.

func (Instance) FontSetTextureImage

func (self Instance) FontSetTextureImage(font_rid RID.Font, size Vector2i.XY, texture_index int, image [1]gdclass.Image)

Sets font cache texture image data.

func (Instance) FontSetTextureOffsets

func (self Instance) FontSetTextureOffsets(font_rid RID.Font, size Vector2i.XY, texture_index int, offset []int32)

Sets array containing glyph packing data.

func (Instance) FontSetTransform

func (self Instance) FontSetTransform(font_rid RID.Font, transform Transform2D.OriginXY)

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 [code]Transform2D(1.0, slant, 0.0, 1.0, 0.0, 0.0)[/code].

func (Instance) FontSetUnderlinePosition

func (self Instance) FontSetUnderlinePosition(font_rid RID.Font, size int, underline_position Float.X)

Sets pixel offset of the underline below the baseline.

func (Instance) FontSetUnderlineThickness

func (self Instance) FontSetUnderlineThickness(font_rid RID.Font, size int, underline_thickness Float.X)

Sets thickness of the underline in pixels.

func (Instance) FontSetVariationCoordinates

func (self Instance) FontSetVariationCoordinates(font_rid RID.Font, variation_coordinates map[string]float32)

Sets variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info.

func (Instance) FontSetWeight

func (self Instance) FontSetWeight(font_rid RID.Font, weight int)

Sets weight (boldness) of the font. A value in the [code]100...999[/code] range, normal font weight is [code]400[/code], bold font weight is [code]700[/code]. [b]Note:[/b] This value is used for font matching only and will not affect font rendering. Use [method font_set_face_index], [method font_set_variation_coordinates], or [method font_set_embolden] instead.

func (Instance) FontSupportedFeatureList

func (self Instance) FontSupportedFeatureList(font_rid RID.Font) map[string]string

Returns the dictionary of the supported OpenType features.

func (Instance) FontSupportedVariationList

func (self Instance) FontSupportedVariationList(font_rid RID.Font) map[string]string

Returns the dictionary of the supported OpenType variation coordinates.

func (Instance) FormatNumber

func (self Instance) FormatNumber(number string) string

Converts a number from the Western Arabic (0..9) to the numeral systems used in [param language]. If [param language] is omitted, the active locale will be used.

func (Instance) FreeRid

func (self Instance) FreeRid(rid RID.Any)

Frees an object created by this [TextServer].

func (Instance) GetFeatures

func (self Instance) GetFeatures() int

Returns text server features, see [enum Feature].

func (Instance) GetHexCodeBoxSize

func (self Instance) GetHexCodeBoxSize(size int, index int) Vector2.XY

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

func (Instance) GetName

func (self Instance) GetName() string

Returns the name of the server interface.

func (Instance) GetSupportDataFilename

func (self Instance) GetSupportDataFilename() string

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

func (Instance) GetSupportDataInfo

func (self Instance) GetSupportDataInfo() string

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

func (Instance) Has

func (self Instance) Has(rid RID.Any) bool

Returns [code]true[/code] if [param rid] is valid resource owned by this text server.

func (Instance) HasFeature

func (self Instance) HasFeature(feature gdclass.TextServerFeature) bool

Returns [code]true[/code] if the server supports a feature.

func (Instance) IsConfusable

func (self Instance) IsConfusable(s string, dict []string) int

Returns index of the first string in [param dict] which is visually confusable with the [param string], or [code]-1[/code] if none is found. [b]Note:[/b] This method doesn't detect invisible characters, for spoof detection use it in combination with [method spoof_check]. [b]Note:[/b] Always returns [code]-1[/code] if the server does not support the [constant FEATURE_UNICODE_SECURITY] feature.

func (Instance) IsLocaleRightToLeft

func (self Instance) IsLocaleRightToLeft(locale string) bool

Returns [code]true[/code] if locale is right-to-left.

func (Instance) IsValidIdentifier

func (self Instance) IsValidIdentifier(s string) bool

Returns [code]true[/code] if [param string] is a valid identifier. If the text server supports the [constant FEATURE_UNICODE_IDENTIFIERS] feature, a valid identifier must: - Conform to normalization form C. - Begin with a Unicode character of class XID_Start or [code]"_"[/code]. - May contain Unicode characters of class XID_Continue in the other positions. - Use UAX #31 recommended scripts only (mixed scripts are allowed). If the [constant FEATURE_UNICODE_IDENTIFIERS] feature is not supported, a valid identifier must: - Begin with a Unicode character of class XID_Start or [code]"_"[/code]. - May contain Unicode characters of class XID_Continue in the other positions.

func (Instance) IsValidLetter

func (self Instance) IsValidLetter(unicode int) bool

Returns [code]true[/code] if the given code point is a valid letter, i.e. it belongs to the Unicode category "L".

func (Instance) LoadSupportData

func (self Instance) LoadSupportData(filename string) bool

Loads optional TextServer database (e.g. ICU break iterators and dictionaries). [b]Note:[/b] This function should be called before any other TextServer functions used, otherwise it won't have any effect.

func (Instance) NameToTag

func (self Instance) NameToTag(name string) int

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

func (Instance) ParseNumber

func (self Instance) ParseNumber(number string) string

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

func (Instance) ParseStructuredText

func (self Instance) ParseStructuredText(parser_type gdclass.TextServerStructuredTextParser, args []any, text string) []Vector3i.XYZ

Default implementation of the BiDi algorithm override function. See [enum StructuredTextParser] for more info.

func (Instance) PercentSign

func (self Instance) PercentSign() string

Returns percent sign used in the [param language].

func (Instance) SaveSupportData

func (self Instance) SaveSupportData(filename string) bool

Saves optional TextServer database (e.g. ICU break iterators and dictionaries) to the file. [b]Note:[/b] This function is used by during project export, to include TextServer database.

func (Instance) ShapedGetSpanCount

func (self Instance) ShapedGetSpanCount(shaped RID.TextBuffer) int

Returns number of text spans added using [method shaped_text_add_string] or [method shaped_text_add_object].

func (Instance) ShapedGetSpanMeta

func (self Instance) ShapedGetSpanMeta(shaped RID.TextBuffer, index int) any

Returns text span metadata.

func (Instance) ShapedSetSpanUpdateFont

func (self Instance) ShapedSetSpanUpdateFont(shaped RID.TextBuffer, index int, fonts [][]RID.Font, size int)

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

func (Instance) ShapedTextAddObject

func (self Instance) ShapedTextAddObject(shaped RID.TextBuffer, key any, size Vector2.XY) bool

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

func (Instance) ShapedTextAddString

func (self Instance) ShapedTextAddString(shaped RID.TextBuffer, text string, fonts []RID.TextBuffer, size int) bool

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

func (Instance) ShapedTextClear

func (self Instance) ShapedTextClear(rid RID.TextBuffer)

Clears text buffer (removes text and inline objects).

func (Instance) ShapedTextClosestCharacterPos

func (self Instance) ShapedTextClosestCharacterPos(shaped RID.TextBuffer, pos int) int

Returns composite character position closest to the [param pos].

func (Instance) ShapedTextDraw

func (self Instance) ShapedTextDraw(shaped RID.TextBuffer, canvas RID.Canvas, pos Vector2.XY)

Draw shaped text into a canvas item at a given position, with [param color]. [param pos] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout).

func (Instance) ShapedTextDrawOutline

func (self Instance) ShapedTextDrawOutline(shaped RID.TextBuffer, canvas RID.Canvas, pos Vector2.XY)

Draw the outline of the shaped text into a canvas item at a given position, with [param color]. [param pos] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout).

func (Instance) ShapedTextFitToWidth

func (self Instance) ShapedTextFitToWidth(shaped RID.TextBuffer, width Float.X) Float.X

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

func (Instance) ShapedTextGetAscent

func (self Instance) ShapedTextGetAscent(shaped RID.TextBuffer) Float.X

Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical). [b]Note:[/b] Overall ascent can be higher than font ascent, if some glyphs are displaced from the baseline.

func (Instance) ShapedTextGetCarets

func (self Instance) ShapedTextGetCarets(shaped RID.TextBuffer, position int) map[int]struct {
	X float32
	Y float32
}

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

func (Instance) ShapedTextGetCharacterBreaks

func (self Instance) ShapedTextGetCharacterBreaks(shaped RID.TextBuffer) []int32

Returns array of the composite character boundaries.

func (Instance) ShapedTextGetCustomEllipsis

func (self Instance) ShapedTextGetCustomEllipsis(shaped RID.TextBuffer) int

Returns ellipsis character used for text clipping.

func (Instance) ShapedTextGetCustomPunctuation

func (self Instance) ShapedTextGetCustomPunctuation(shaped RID.TextBuffer) string

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

func (Instance) ShapedTextGetDescent

func (self Instance) ShapedTextGetDescent(shaped RID.TextBuffer) Float.X

Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical). [b]Note:[/b] Overall descent can be higher than font descent, if some glyphs are displaced from the baseline.

func (Instance) ShapedTextGetDirection

func (self Instance) ShapedTextGetDirection(shaped RID.TextBuffer) gdclass.TextServerDirection

Returns direction of the text.

func (Instance) ShapedTextGetDominantDirectionInRange

func (self Instance) ShapedTextGetDominantDirectionInRange(shaped RID.TextBuffer, start int, end int) gdclass.TextServerDirection

Returns dominant direction of in the range of text.

func (Instance) ShapedTextGetEllipsisGlyphCount

func (self Instance) ShapedTextGetEllipsisGlyphCount(shaped RID.TextBuffer) int

Returns number of glyphs in the ellipsis.

func (Instance) ShapedTextGetEllipsisGlyphs

func (self Instance) ShapedTextGetEllipsisGlyphs(shaped RID.TextBuffer) []map[int]struct {
	X float32
	Y float32
}

Returns array of the glyphs in the ellipsis.

func (Instance) ShapedTextGetEllipsisPos

func (self Instance) ShapedTextGetEllipsisPos(shaped RID.TextBuffer) int

Returns position of the ellipsis.

func (Instance) ShapedTextGetGlyphCount

func (self Instance) ShapedTextGetGlyphCount(shaped RID.TextBuffer) int

Returns number of glyphs in the buffer.

func (Instance) ShapedTextGetGlyphs

func (self Instance) ShapedTextGetGlyphs(shaped RID.TextBuffer) []map[int]struct {
	X float32
	Y float32
}

Returns an array of glyphs in the visual order.

func (Instance) ShapedTextGetGraphemeBounds

func (self Instance) ShapedTextGetGraphemeBounds(shaped RID.TextBuffer, pos int) Vector2.XY

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

func (Instance) ShapedTextGetInferredDirection

func (self Instance) ShapedTextGetInferredDirection(shaped RID.TextBuffer) gdclass.TextServerDirection

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

func (Instance) ShapedTextGetLineBreaks

func (self Instance) ShapedTextGetLineBreaks(shaped RID.TextBuffer, width Float.X) []int32

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

func (Instance) ShapedTextGetLineBreaksAdv

func (self Instance) ShapedTextGetLineBreaksAdv(shaped RID.TextBuffer, width []float32) []int32

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

func (Instance) ShapedTextGetObjectGlyph

func (self Instance) ShapedTextGetObjectGlyph(shaped RID.TextBuffer, key any) int

Returns the glyph index of the inline object.

func (Instance) ShapedTextGetObjectRange

func (self Instance) ShapedTextGetObjectRange(shaped RID.TextBuffer, key any) Vector2i.XY

Returns the character range of the inline object.

func (Instance) ShapedTextGetObjectRect

func (self Instance) ShapedTextGetObjectRect(shaped RID.TextBuffer, key any) Rect2.PositionSize

Returns bounding rectangle of the inline object.

func (Instance) ShapedTextGetObjects

func (self Instance) ShapedTextGetObjects(shaped RID.TextBuffer) []any

Returns array of inline objects.

func (Instance) ShapedTextGetOrientation

func (self Instance) ShapedTextGetOrientation(shaped RID.TextBuffer) gdclass.TextServerOrientation

Returns text orientation.

func (Instance) ShapedTextGetParent

func (self Instance) ShapedTextGetParent(shaped RID.TextBuffer) RID.TextBuffer

Returns the parent buffer from which the substring originates.

func (Instance) ShapedTextGetPreserveControl

func (self Instance) ShapedTextGetPreserveControl(shaped RID.TextBuffer) bool

Returns [code]true[/code] if text buffer is configured to display control characters.

func (Instance) ShapedTextGetPreserveInvalid

func (self Instance) ShapedTextGetPreserveInvalid(shaped RID.TextBuffer) bool

Returns [code]true[/code] if text buffer is configured to display hexadecimal codes in place of invalid characters. [b]Note:[/b] If set to [code]false[/code], nothing is displayed in place of invalid characters.

func (Instance) ShapedTextGetRange

func (self Instance) ShapedTextGetRange(shaped RID.TextBuffer) Vector2i.XY

Returns substring buffer character range in the parent buffer.

func (Instance) ShapedTextGetSelection

func (self Instance) ShapedTextGetSelection(shaped RID.TextBuffer, start int, end int) []Vector2.XY

Returns selection rectangles for the specified character range.

func (Instance) ShapedTextGetSize

func (self Instance) ShapedTextGetSize(shaped RID.TextBuffer) Vector2.XY

Returns size of the text.

func (Instance) ShapedTextGetSpacing

func (self Instance) ShapedTextGetSpacing(shaped RID.TextBuffer, spacing gdclass.TextServerSpacingType) int

Returns extra spacing added between glyphs or lines in pixels.

func (Instance) ShapedTextGetTrimPos

func (self Instance) ShapedTextGetTrimPos(shaped RID.TextBuffer) int

Returns the position of the overrun trim.

func (Instance) ShapedTextGetUnderlinePosition

func (self Instance) ShapedTextGetUnderlinePosition(shaped RID.TextBuffer) Float.X

Returns pixel offset of the underline below the baseline.

func (Instance) ShapedTextGetUnderlineThickness

func (self Instance) ShapedTextGetUnderlineThickness(shaped RID.TextBuffer) Float.X

Returns thickness of the underline.

func (Instance) ShapedTextGetWidth

func (self Instance) ShapedTextGetWidth(shaped RID.TextBuffer) Float.X

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

func (Instance) ShapedTextGetWordBreaks

func (self Instance) ShapedTextGetWordBreaks(shaped RID.TextBuffer) []int32

Breaks text into words and returns array of character ranges. Use [param grapheme_flags] to set what characters are used for breaking (see [enum GraphemeFlag]).

func (Instance) ShapedTextHasVisibleChars

func (self Instance) ShapedTextHasVisibleChars(shaped RID.TextBuffer) bool

Returns [code]true[/code] if text buffer contains any visible characters.

func (Instance) ShapedTextHitTestGrapheme

func (self Instance) ShapedTextHitTestGrapheme(shaped RID.TextBuffer, coords Float.X) int

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

func (Instance) ShapedTextHitTestPosition

func (self Instance) ShapedTextHitTestPosition(shaped RID.TextBuffer, coords Float.X) int

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

func (Instance) ShapedTextIsReady

func (self Instance) ShapedTextIsReady(shaped RID.TextBuffer) bool

Returns [code]true[/code] if buffer is successfully shaped.

func (Instance) ShapedTextNextCharacterPos

func (self Instance) ShapedTextNextCharacterPos(shaped RID.TextBuffer, pos int) int

Returns composite character end position closest to the [param pos].

func (Instance) ShapedTextNextGraphemePos

func (self Instance) ShapedTextNextGraphemePos(shaped RID.TextBuffer, pos int) int

Returns grapheme end position closest to the [param pos].

func (Instance) ShapedTextOverrunTrimToWidth

func (self Instance) ShapedTextOverrunTrimToWidth(shaped RID.TextBuffer)

Trims text if it exceeds the given width.

func (Instance) ShapedTextPrevCharacterPos

func (self Instance) ShapedTextPrevCharacterPos(shaped RID.TextBuffer, pos int) int

Returns composite character start position closest to the [param pos].

func (Instance) ShapedTextPrevGraphemePos

func (self Instance) ShapedTextPrevGraphemePos(shaped RID.TextBuffer, pos int) int

Returns grapheme start position closest to the [param pos].

func (Instance) ShapedTextResizeObject

func (self Instance) ShapedTextResizeObject(shaped RID.TextBuffer, key any, size Vector2.XY) bool

Sets new size and alignment of embedded object.

func (Instance) ShapedTextSetBidiOverride

func (self Instance) ShapedTextSetBidiOverride(shaped RID.TextBuffer, override []any)

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

func (Instance) ShapedTextSetCustomEllipsis

func (self Instance) ShapedTextSetCustomEllipsis(shaped RID.TextBuffer, char int)

Sets ellipsis character used for text clipping.

func (Instance) ShapedTextSetCustomPunctuation

func (self Instance) ShapedTextSetCustomPunctuation(shaped RID.TextBuffer, punct string)

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

func (Instance) ShapedTextSetDirection

func (self Instance) ShapedTextSetDirection(shaped RID.TextBuffer)

Sets desired text direction. If set to [constant DIRECTION_AUTO], direction will be detected based on the buffer contents and current locale. [b]Note:[/b] Direction is ignored if server does not support [constant FEATURE_BIDI_LAYOUT] feature (supported by [TextServerAdvanced]).

func (Instance) ShapedTextSetOrientation

func (self Instance) ShapedTextSetOrientation(shaped RID.TextBuffer)

Sets desired text orientation. [b]Note:[/b] Orientation is ignored if server does not support [constant FEATURE_VERTICAL_LAYOUT] feature (supported by [TextServerAdvanced]).

func (Instance) ShapedTextSetPreserveControl

func (self Instance) ShapedTextSetPreserveControl(shaped RID.TextBuffer, enabled bool)

If set to [code]true[/code] text buffer will display control characters.

func (Instance) ShapedTextSetPreserveInvalid

func (self Instance) ShapedTextSetPreserveInvalid(shaped RID.TextBuffer, enabled bool)

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

func (Instance) ShapedTextSetSpacing

func (self Instance) ShapedTextSetSpacing(shaped RID.TextBuffer, spacing gdclass.TextServerSpacingType, value int)

Sets extra spacing added between glyphs or lines in pixels.

func (Instance) ShapedTextShape

func (self Instance) ShapedTextShape(shaped RID.TextBuffer) bool

Shapes buffer if it's not shaped. Returns [code]true[/code] if the string is shaped successfully. [b]Note:[/b] It is not necessary to call this function manually, buffer will be shaped automatically as soon as any of its output data is requested.

func (Instance) ShapedTextSortLogical

func (self Instance) ShapedTextSortLogical(shaped RID.TextBuffer) []map[int]int

Returns text glyphs in the logical order.

func (Instance) ShapedTextSubstr

func (self Instance) ShapedTextSubstr(shaped RID.TextBuffer, start int, length int) RID.TextBuffer

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

func (Instance) ShapedTextTabAlign

func (self Instance) ShapedTextTabAlign(shaped RID.TextBuffer, tab_stops []float32) Float.X

Aligns shaped text to the given tab-stops.

func (Instance) SpoofCheck

func (self Instance) SpoofCheck(s string) bool

Returns [code]true[/code] if [param string] is likely to be an attempt at confusing the reader. [b]Note:[/b] Always returns [code]false[/code] if the server does not support the [constant FEATURE_UNICODE_SECURITY] feature.

func (Instance) StringGetCharacterBreaks

func (self Instance) StringGetCharacterBreaks(s string) []int32

Returns array of the composite character boundaries. [codeblock] 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] [/codeblock]

func (Instance) StringGetWordBreaks

func (self Instance) StringGetWordBreaks(s string) []int32

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 [param chars_per_line] is greater than zero, line break boundaries are returned instead. [codeblock] var ts = TextServerManager.get_primary_interface() print(ts.string_get_word_breaks("The Godot Engine, 4")) # Prints [0, 3, 4, 9, 10, 16, 18, 19], which corresponds to the following substrings: "The", "Godot", "Engine", "4" print(ts.string_get_word_breaks("The Godot Engine, 4", "en", 5)) # Prints [0, 3, 4, 9, 10, 15, 15, 19], which corresponds to the following substrings: "The", "Godot", "Engin", "e, 4" print(ts.string_get_word_breaks("The Godot Engine, 4", "en", 10)) # Prints [0, 9, 10, 19], which corresponds to the following substrings: "The Godot", "Engine, 4" [/codeblock]

func (Instance) StringToLower

func (self Instance) StringToLower(s string) string

Returns the string converted to lowercase. [b]Note:[/b] Casing is locale dependent and context sensitive if server support [constant FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION] feature (supported by [TextServerAdvanced]). [b]Note:[/b] The result may be longer or shorter than the original.

func (Instance) StringToTitle

func (self Instance) StringToTitle(s string) string

Returns the string converted to title case. [b]Note:[/b] Casing is locale dependent and context sensitive if server support [constant FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION] feature (supported by [TextServerAdvanced]). [b]Note:[/b] The result may be longer or shorter than the original.

func (Instance) StringToUpper

func (self Instance) StringToUpper(s string) string

Returns the string converted to uppercase. [b]Note:[/b] Casing is locale dependent and context sensitive if server support [constant FEATURE_CONTEXT_SENSITIVE_CASE_CONVERSION] feature (supported by [TextServerAdvanced]). [b]Note:[/b] The result may be longer or shorter than the original.

func (Instance) StripDiacritics

func (self Instance) StripDiacritics(s string) string

Strips diacritics from the string. [b]Note:[/b] The result may be longer or shorter than the original.

func (Instance) TagToName

func (self Instance) TagToName(tag int) string

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

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type JustificationFlag

type JustificationFlag = gdclass.TextServerJustificationFlag //gd:TextServer.JustificationFlag
const (
	/*Do not justify text.*/
	JustificationNone JustificationFlag = 0
	/*Justify text by adding and removing kashidas.*/
	JustificationKashida JustificationFlag = 1
	/*Justify text by changing width of the spaces between the words.*/
	JustificationWordBound JustificationFlag = 2
	/*Remove trailing and leading spaces from the justified text.*/
	JustificationTrimEdgeSpaces JustificationFlag = 4
	/*Only apply justification to the part of the text after the last tab.*/
	JustificationAfterLastTab JustificationFlag = 8
	/*Apply justification to the trimmed line with ellipsis.*/
	JustificationConstrainEllipsis JustificationFlag = 16
	/*Do not apply justification to the last line of the paragraph.*/
	JustificationSkipLastLine JustificationFlag = 32
	/*Do not apply justification to the last line of the paragraph with visible characters (takes precedence over [constant JUSTIFICATION_SKIP_LAST_LINE]).*/
	JustificationSkipLastLineWithVisibleChars JustificationFlag = 64
	/*Always apply justification to the paragraphs with a single line ([constant JUSTIFICATION_SKIP_LAST_LINE] and [constant JUSTIFICATION_SKIP_LAST_LINE_WITH_VISIBLE_CHARS] are ignored).*/
	JustificationDoNotSkipSingleLine JustificationFlag = 128
)

type LineBreakFlag

type LineBreakFlag = gdclass.TextServerLineBreakFlag //gd:TextServer.LineBreakFlag
const (
	/*Do not break the line.*/
	BreakNone LineBreakFlag = 0
	/*Break the line at the line mandatory break characters (e.g. [code]"\n"[/code]).*/
	BreakMandatory LineBreakFlag = 1
	/*Break the line between the words.*/
	BreakWordBound LineBreakFlag = 2
	/*Break the line between any unconnected graphemes.*/
	BreakGraphemeBound LineBreakFlag = 4
	/*Should be used only in conjunction with [constant BREAK_WORD_BOUND], break the line between any unconnected graphemes, if it's impossible to break it between the words.*/
	BreakAdaptive LineBreakFlag = 8
	/*Remove edge spaces from the broken line segments.*/
	BreakTrimEdgeSpaces LineBreakFlag = 16
	/*Subtract first line indentation width from all lines after the first one.*/
	BreakTrimIndent LineBreakFlag = 32
)

type Orientation

type Orientation = gdclass.TextServerOrientation //gd:TextServer.Orientation
const (
	/*Text is written horizontally.*/
	OrientationHorizontal Orientation = 0
	/*Left to right text is written vertically from top to bottom.
	  Right to left text is written vertically from bottom to top.*/
	OrientationVertical Orientation = 1
)

type OverrunBehavior

type OverrunBehavior = gdclass.TextServerOverrunBehavior //gd:TextServer.OverrunBehavior
const (
	/*No text trimming is performed.*/
	OverrunNoTrimming OverrunBehavior = 0
	/*Trims the text per character.*/
	OverrunTrimChar OverrunBehavior = 1
	/*Trims the text per word.*/
	OverrunTrimWord OverrunBehavior = 2
	/*Trims the text per character and adds an ellipsis to indicate that parts are hidden.*/
	OverrunTrimEllipsis OverrunBehavior = 3
	/*Trims the text per word and adds an ellipsis to indicate that parts are hidden.*/
	OverrunTrimWordEllipsis OverrunBehavior = 4
)

type SpacingType

type SpacingType = gdclass.TextServerSpacingType //gd:TextServer.SpacingType
const (
	/*Spacing for each glyph.*/
	SpacingGlyph SpacingType = 0
	/*Spacing for the space character.*/
	SpacingSpace SpacingType = 1
	/*Spacing at the top of the line.*/
	SpacingTop SpacingType = 2
	/*Spacing at the bottom of the line.*/
	SpacingBottom SpacingType = 3
	/*Represents the size of the [enum SpacingType] enum.*/
	SpacingMax SpacingType = 4
)

type StructuredTextParser

type StructuredTextParser = gdclass.TextServerStructuredTextParser //gd:TextServer.StructuredTextParser
const (
	/*Use default Unicode BiDi algorithm.*/
	StructuredTextDefault StructuredTextParser = 0
	/*BiDi override for URI.*/
	StructuredTextUri StructuredTextParser = 1
	/*BiDi override for file path.*/
	StructuredTextFile StructuredTextParser = 2
	/*BiDi override for email.*/
	StructuredTextEmail StructuredTextParser = 3
	/*BiDi override for lists. Structured text options: list separator [String].*/
	StructuredTextList StructuredTextParser = 4
	/*BiDi override for GDScript.*/
	StructuredTextGdscript StructuredTextParser = 5
	/*User defined structured text BiDi override function.*/
	StructuredTextCustom StructuredTextParser = 6
)

type SubpixelPositioning

type SubpixelPositioning = gdclass.TextServerSubpixelPositioning //gd:TextServer.SubpixelPositioning
const (
	/*Glyph horizontal position is rounded to the whole pixel size, each glyph is rasterized once.*/
	SubpixelPositioningDisabled SubpixelPositioning = 0
	/*Glyph horizontal position is rounded based on font size.
	  - To one quarter of the pixel size if font size is smaller or equal to [constant SUBPIXEL_POSITIONING_ONE_QUARTER_MAX_SIZE].
	  - To one half of the pixel size if font size is smaller or equal to [constant SUBPIXEL_POSITIONING_ONE_HALF_MAX_SIZE].
	  - To the whole pixel size for larger fonts.*/
	SubpixelPositioningAuto SubpixelPositioning = 1
	/*Glyph horizontal position is rounded to one half of the pixel size, each glyph is rasterized up to two times.*/
	SubpixelPositioningOneHalf SubpixelPositioning = 2
	/*Glyph horizontal position is rounded to one quarter of the pixel size, each glyph is rasterized up to four times.*/
	SubpixelPositioningOneQuarter SubpixelPositioning = 3
	/*Maximum font size which will use one half of the pixel subpixel positioning in [constant SUBPIXEL_POSITIONING_AUTO] mode.*/
	SubpixelPositioningOneHalfMaxSize SubpixelPositioning = 20
	/*Maximum font size which will use one quarter of the pixel subpixel positioning in [constant SUBPIXEL_POSITIONING_AUTO] mode.*/
	SubpixelPositioningOneQuarterMaxSize SubpixelPositioning = 16
)

type TextOverrunFlag

type TextOverrunFlag = gdclass.TextServerTextOverrunFlag //gd:TextServer.TextOverrunFlag
const (
	/*No trimming is performed.*/
	OverrunNoTrim TextOverrunFlag = 0
	/*Trims the text when it exceeds the given width.*/
	OverrunTrim TextOverrunFlag = 1
	/*Trims the text per word instead of per grapheme.*/
	OverrunTrimWordOnly TextOverrunFlag = 2
	/*Determines whether an ellipsis should be added at the end of the text.*/
	OverrunAddEllipsis TextOverrunFlag = 4
	/*Determines whether the ellipsis at the end of the text is enforced and may not be hidden.*/
	OverrunEnforceEllipsis TextOverrunFlag = 8
	/*Accounts for the text being justified before attempting to trim it (see [enum JustificationFlag]).*/
	OverrunJustificationAware TextOverrunFlag = 16
)

type VisibleCharactersBehavior

type VisibleCharactersBehavior = gdclass.TextServerVisibleCharactersBehavior //gd:TextServer.VisibleCharactersBehavior
const (
	/*Trims text before the shaping. e.g, increasing [member Label.visible_characters] or [member RichTextLabel.visible_characters] value is visually identical to typing the text.*/
	VcCharsBeforeShaping VisibleCharactersBehavior = 0
	/*Displays glyphs that are mapped to the first [member Label.visible_characters] or [member RichTextLabel.visible_characters] characters from the beginning of the text.*/
	VcCharsAfterShaping VisibleCharactersBehavior = 1
	/*Displays [member Label.visible_ratio] or [member RichTextLabel.visible_ratio] glyphs, starting from the left or from the right, depending on [member Control.layout_direction] value.*/
	VcGlyphsAuto VisibleCharactersBehavior = 2
	/*Displays [member Label.visible_ratio] or [member RichTextLabel.visible_ratio] glyphs, starting from the left.*/
	VcGlyphsLtr VisibleCharactersBehavior = 3
	/*Displays [member Label.visible_ratio] or [member RichTextLabel.visible_ratio] glyphs, starting from the right.*/
	VcGlyphsRtl VisibleCharactersBehavior = 4
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL