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
TextParagraph

Table of contents

TextParagraph #

is_refcounted, is_instantiable, core, not_builtin_classes

Holds a paragraph of text.

Abstraction over TextServer for handling a single paragraph of text.

Members #

var alignment: int = 0#

Paragraph horizontal alignment.

var break_flags: int = 3#

Line breaking rules. For more info see TextServer.

var custom_punctuation: String = ""#

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

var direction = DIRECTION_AUTO#

Text writing direction.

var ellipsis_char: String = "…"#

Ellipsis character used for text clipping.

var justification_flags: int = 163#

Line fill alignment rules. See TextServer.JustificationFlag for more information.

var line_spacing: float = 0.0#

Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.

var max_lines_visible: int = -1#

Limits the lines of text shown.

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_NO_TRIMMING#

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

var width: float = -1.0#

Paragraph 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 paragraph (removes text and inline objects).

func clear_dropcap() -> void#

Removes dropcap.

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

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

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

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

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

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

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

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

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

Draw outline of the single line of 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(dc_color: Color = Color(1, 1, 1, 1)) -> void#

Draw outlines of all lines of the text and drop cap into a canvas item at a given position, with color. pos specifies the top left corner of the bounding box.

const func get_dropcap_lines() -> int#

Returns number of lines used by dropcap.

const func get_dropcap_rid() -> RID#

Returns drop cap text buffer RID.

const func get_dropcap_size() -> Vector2#

Returns drop cap bounding box size.

const func get_line_ascent(line: int) -> float#

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

const func get_line_count() -> int#

Returns number of lines in the paragraph.

const func get_line_descent(line: int) -> float#

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

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

Returns bounding rectangle of the inline object.

const func get_line_objects(line: int) -> Array#

Returns array of inline objects in the line.

const func get_line_range(line: int) -> Vector2i#

Returns character range of the line.

const func get_line_rid(line: int) -> RID#

Returns TextServer line buffer RID.

const func get_line_size(line: int) -> Vector2#

Returns size of the bounding box of the line of text. Returned size is rounded up.

const func get_line_underline_position(line: int) -> float#

Returns pixel offset of the underline below the baseline.

const func get_line_underline_thickness(line: int) -> float#

Returns thickness of the underline.

const func get_line_width(line: int) -> float#

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

const func get_non_wrapped_size() -> Vector2#

Returns the size of the bounding box of the paragraph, without line breaks.

const func get_rid() -> RID#

Returns TextServer full string buffer RID.

const func get_size() -> Vector2#

Returns the size of the bounding box of the paragraph.

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

Returns caret character offset at the specified coordinates. 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 set_dropcap(language: String = "") -> bool#

Sets drop cap, overrides previously set drop cap. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.

func tab_align(tab_stops: PackedFloat32Array) -> void#

Aligns paragraph to the given tab-stops.

Annotations #

Constants #

Constructors #

Enums #

Operators #

Signals #

Theme Items #

Tutorials #