Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

TextParagraph

Inherits: RefCounted < Object

Holds a paragraph of text.

Description

Abstraction over TextServer for handling a single paragraph of text.

Properties

HorizontalAlignment

alignment

0

BitField<LineBreakFlag>

break_flags

3

String

custom_punctuation

""

Direction

direction

0

BitField<JustificationFlag>

justification_flags

163

int

max_lines_visible

-1

Orientation

orientation

0

bool

preserve_control

false

bool

preserve_invalid

true

OverrunBehavior

text_overrun_behavior

0

float

width

-1.0

Methods

bool

add_object ( Variant key, Vector2 size, InlineAlignment inline_align=5, int length=1, float baseline=0.0 )

bool

add_string ( String text, Font font, int font_size, String language="", Variant meta=null )

void

clear ( )

void

clear_dropcap ( )

void

draw ( RID canvas, Vector2 pos, Color color=Color(1, 1, 1, 1), Color dc_color=Color(1, 1, 1, 1) ) const

void

draw_dropcap ( RID canvas, Vector2 pos, Color color=Color(1, 1, 1, 1) ) const

void

draw_dropcap_outline ( RID canvas, Vector2 pos, int outline_size=1, Color color=Color(1, 1, 1, 1) ) const

void

draw_line ( RID canvas, Vector2 pos, int line, Color color=Color(1, 1, 1, 1) ) const

void

draw_line_outline ( RID canvas, Vector2 pos, int line, int outline_size=1, Color color=Color(1, 1, 1, 1) ) const

void

draw_outline ( RID canvas, Vector2 pos, int outline_size=1, Color color=Color(1, 1, 1, 1), Color dc_color=Color(1, 1, 1, 1) ) const

int

get_dropcap_lines ( ) const

RID

get_dropcap_rid ( ) const

Vector2

get_dropcap_size ( ) const

float

get_line_ascent ( int line ) const

int

get_line_count ( ) const

float

get_line_descent ( int line ) const

Rect2

get_line_object_rect ( int line, Variant key ) const

Array

get_line_objects ( int line ) const

Vector2i

get_line_range ( int line ) const

RID

get_line_rid ( int line ) const

Vector2

get_line_size ( int line ) const

float

get_line_underline_position ( int line ) const

float

get_line_underline_thickness ( int line ) const

float

get_line_width ( int line ) const

Vector2

get_non_wrapped_size ( ) const

RID

get_rid ( ) const

Vector2

get_size ( ) const

int

hit_test ( Vector2 coords ) const

bool

resize_object ( Variant key, Vector2 size, InlineAlignment inline_align=5, float baseline=0.0 )

void

set_bidi_override ( Array override )

bool

set_dropcap ( String text, Font font, int font_size, Rect2 dropcap_margins=Rect2(0, 0, 0, 0), String language="" )

void

tab_align ( PackedFloat32Array tab_stops )


Property Descriptions

HorizontalAlignment alignment = 0

Paragraph horizontal alignment.


BitField<LineBreakFlag> break_flags = 3

Line breaking rules. For more info see TextServer.


String custom_punctuation = ""

  • void set_custom_punctuation ( String value )

  • String get_custom_punctuation ( )

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


Direction direction = 0

Text writing direction.


BitField<JustificationFlag> justification_flags = 163

Line fill alignment rules. For more info see JustificationFlag.


int max_lines_visible = -1

  • void set_max_lines_visible ( int value )

  • int get_max_lines_visible ( )

Limits the lines of text shown.


Orientation orientation = 0

Text orientation.


bool preserve_control = false

  • void set_preserve_control ( bool value )

  • bool get_preserve_control ( )

If set to