Inheritance #

RefCounted

- AESContext
- AStar2D
- AStar3D
- AStarGrid2D
- AudioEffectInstance (1)
- AudioSample
- AudioSamplePlayback
- AudioStreamPlayback (5)
- CameraFeed
- CharFXTransform
- ConfigFile
- Crypto
- DTLSServer
- DirAccess
- ENetConnection
- EditorContextMenuPlugin
- EditorDebuggerPlugin
- EditorDebuggerSession
- EditorExportPlatform (6)
- EditorExportPlugin
- EditorExportPreset
- EditorFeatureProfile
- EditorFileSystemImportFormatSupportQuery
- EditorInspectorPlugin
- EditorResourceConversionPlugin
- EditorResourcePreviewGenerator
- EditorResourceTooltipPlugin
- EditorSceneFormatImporter (4)
- EditorScenePostImport
- EditorScenePostImportPlugin
- EditorScript
- EditorTranslationParserPlugin
- EncodedObjectAsID
- EngineProfiler
- Expression
- FileAccess
- GLTFObjectModelProperty
- HMACContext
- HTTPClient
- HashingContext
- ImageFormatLoader (1)
- JavaClass
- JavaObject
- JavaScriptObject
- KinematicCollision2D
- KinematicCollision3D
- Lightmapper (1)
- MeshConvexDecompositionSettings
- MeshDataTool
- MultiplayerAPI (2)
- Mutex
- NavigationPathQueryParameters2D
- NavigationPathQueryParameters3D
- NavigationPathQueryResult2D
- NavigationPathQueryResult3D
- Node3DGizmo (1)
- OggPacketSequencePlayback
- OpenXRAPIExtension
- PCKPacker
- PackedDataContainerRef
- PacketPeer (8)
- PhysicsPointQueryParameters2D
- PhysicsPointQueryParameters3D
- PhysicsRayQueryParameters2D
- PhysicsRayQueryParameters3D
- PhysicsShapeQueryParameters2D
- PhysicsShapeQueryParameters3D
- PhysicsTestMotionParameters2D
- PhysicsTestMotionParameters3D
- PhysicsTestMotionResult2D
- PhysicsTestMotionResult3D
- RDAttachmentFormat
- RDFramebufferPass
- RDPipelineColorBlendState
- RDPipelineColorBlendStateAttachment
- RDPipelineDepthStencilState
- RDPipelineMultisampleState
- RDPipelineRasterizationState
- RDPipelineSpecializationConstant
- RDSamplerState
- RDShaderSource
- RDTextureFormat
- RDTextureView
- RDUniform
- RDVertexAttribute
- RandomNumberGenerator
- RegEx
- RegExMatch
- RenderSceneBuffers (2)
- RenderSceneBuffersConfiguration
- Resource (103)
- ResourceFormatLoader
- ResourceFormatSaver
- ResourceImporter (16)
- SceneState
- SceneTreeTimer
- Semaphore
- SkinReference
- StreamPeer (5)
- SurfaceTool
- TCPServer
- TLSOptions
- TextLine
- TextParagraph
- TextServer (1)
- Thread
- TranslationDomain
- TriangleMesh
- Tween
- Tweener (5)
- UDPServer
- UPNP
- UPNPDevice
- WeakRef
- WebRTCPeerConnection (1)
- XMLParser
- XRInterface (4)
- XRPose
- XRTracker (2)
- ZIPPacker
- ZIPReader
TextLine

Table of contents

TextLine #

is_refcounted, is_instantiable, core, not_builtin_classes

Holds a line of text.

Abstraction over TextServer for handling a single line of text.

Members #

var alignment: int = 0#

Sets text alignment within the line as if the line was horizontal.

var direction = DIRECTION_AUTO#

Text writing direction.

var ellipsis_char: String = "…"#

Ellipsis character used for text clipping.

var flags: int = 3#

Line alignment rules. For more info see TextServer.

var orientation = ORIENTATION_HORIZONTAL#

Text orientation.

var preserve_control: bool = false#

If set to true text will display control characters.

var preserve_invalid: bool = true#

If set to true text will display invalid characters.

var text_overrun_behavior = OVERRUN_TRIM_ELLIPSIS#

Sets the clipping behavior when the text exceeds the text line's set width. See TextServer.OverrunBehavior for a description of all modes.

var width: float = -1.0#

Text line width.

Methods #

func add_object(baseline: float = 0.0) -> bool#

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

func add_string(meta: Variant = null) -> bool#

Adds text span and font to draw it.

func clear() -> void#

Clears text line (removes text and inline objects).

const func draw(color: Color = Color(1, 1, 1, 1)) -> void#

Draw text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box.

const func draw_outline(color: Color = Color(1, 1, 1, 1)) -> void#

Draw text into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box.

const func get_line_ascent() -> float#

Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).

const func get_line_descent() -> float#

Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).

const func get_line_underline_position() -> float#

Returns pixel offset of the underline below the baseline.

const func get_line_underline_thickness() -> float#

Returns thickness of the underline.

const func get_line_width() -> float#

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

const func get_object_rect(key: Variant) -> Rect2#

Returns bounding rectangle of the inline object.

const func get_objects() -> Array#

Returns array of inline objects.

const func get_rid() -> RID#

Returns TextServer buffer RID.

const func get_size() -> Vector2#

Returns size of the bounding box of the text.

const func hit_test(coords: float) -> int#

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

func resize_object(baseline: float = 0.0) -> bool#

Sets new size and alignment of embedded object.

func set_bidi_override(override: Array) -> void#

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 tab_align(tab_stops: PackedFloat32Array) -> void#

Aligns text to the given tab-stops.

Annotations #

Constants #

Constructors #

Enums #

Operators #

Signals #

Theme Items #

Tutorials #