Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
TextParagraph¶
Inherits: RefCounted < Object
Holds a paragraph of text.
Description¶
Abstraction over TextServer for handling a single paragraph of text.
Properties¶
|
||
BitField<LineBreakFlag> |
|
|
|
||
|
||
BitField<JustificationFlag> |
|
|
|
||
|
||
|
||
|
||
|
||
|
Methods¶
add_object ( Variant key, Vector2 size, InlineAlignment inline_align=5, int length=1, float baseline=0.0 ) |
|
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 |
get_dropcap_lines ( ) const |
|
get_dropcap_rid ( ) const |
|
get_dropcap_size ( ) const |
|
get_line_ascent ( int line ) const |
|
get_line_count ( ) const |
|
get_line_descent ( int line ) const |
|
get_line_object_rect ( int line, Variant key ) const |
|
get_line_objects ( int line ) const |
|
get_line_range ( int line ) const |
|
get_line_rid ( int line ) const |
|
get_line_size ( int line ) const |
|
get_line_underline_position ( int line ) const |
|
get_line_underline_thickness ( int line ) const |
|
get_line_width ( int line ) const |
|
get_non_wrapped_size ( ) const |
|
get_rid ( ) const |
|
get_size ( ) const |
|
resize_object ( Variant key, Vector2 size, InlineAlignment inline_align=5, float baseline=0.0 ) |
|
void |
set_bidi_override ( Array override ) |
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
void set_alignment ( HorizontalAlignment value )
HorizontalAlignment get_alignment ( )
Paragraph horizontal alignment.
BitField<LineBreakFlag> break_flags = 3
void set_break_flags ( BitField<LineBreakFlag> value )
BitField<LineBreakFlag> get_break_flags ( )
Line breaking rules. For more info see TextServer.
String 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
void set_justification_flags ( BitField<JustificationFlag> value )
BitField<JustificationFlag> get_justification_flags ( )
Line fill alignment rules. For more info see JustificationFlag.
int max_lines_visible = -1
Limits the lines of text shown.
Orientation orientation = 0
void set_orientation ( Orientation value )
Orientation get_orientation ( )
Text orientation.
bool preserve_control = false
If set to true
text will display control characters.
bool preserve_invalid = true
If set to true
text will display invalid characters.
OverrunBehavior text_overrun_behavior = 0
void set_text_overrun_behavior ( OverrunBehavior value )
OverrunBehavior get_text_overrun_behavior ( )
Sets the clipping behavior when the text exceeds the paragraph's set width. See OverrunBehavior for a description of all modes.
float width = -1.0
Paragraph width.
Method Descriptions¶
bool add_object ( Variant key, Vector2 size, InlineAlignment inline_align=5, int length=1, float baseline=0.0 )
Adds inline object to the text buffer, key
must be unique. In the text, object is represented as length
object replacement characters.
bool add_string ( String text, Font font, int font_size, String language="", Variant meta=null )
Adds text span and font to draw it.
void clear ( )
Clears text paragraph (removes text and inline objects).
void clear_dropcap ( )
Removes dropcap.
void draw ( RID canvas, Vector2 pos, Color color=Color(1, 1, 1, 1), Color dc_color=Color(1, 1, 1, 1) ) const
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.
void draw_dropcap ( RID canvas, Vector2 pos, Color color=Color(1, 1, 1, 1) ) const
Draw drop cap into a canvas item at a given position, with color
. pos
specifies the top left corner of the bounding box.
void draw_dropcap_outline ( RID canvas, Vector2 pos, int outline_size=1, Color color=Color(1, 1, 1, 1) ) const
Draw drop cap outline into a canvas item at a given position, with color
. pos
specifies the top left corner of the bounding box.
void draw_line ( RID canvas, Vector2 pos, int line, Color color=Color(1, 1, 1, 1) ) const
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.
void draw_line_outline ( RID canvas, Vector2 pos, int line, int outline_size=1, Color color=Color(1, 1, 1, 1) ) const
Draw outline of the single line of text into a canvas item at a gi