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...
RichTextLabel¶
Inherits: Control < CanvasItem < Node < Object
A control for displaying text that can contain different font styles, images, and basic formatting.
Description¶
A control for displaying text that can contain custom fonts, images, and basic formatting. RichTextLabel manages these as an internal tag stack. It also adapts itself to given width/heights.
Note: Assignments to text clear the tag stack and reconstruct it from the property's contents. Any edits made to text will erase previous edits made from other manual sources such as append_text and the push_*
/ pop methods.
Note: RichTextLabel doesn't support entangled BBCode tags. For example, instead of using [b]bold[i]bold italic[/b]italic[/i]
, use [b]bold[i]bold italic[/i][/b][i]italic[/i]
.
Note: push_*/pop_*
functions won't affect BBCode.
Note: Unlike Label, RichTextLabel doesn't have a property to horizontally align text to the center. Instead, enable bbcode_enabled and surround the text in a [center]
tag as follows: [center]Example[/center]
. There is currently no built-in way to vertically align text either, but this can be emulated by relying on anchors/containers and the fit_content property.
Tutorials¶
Properties¶
|
||
|
||
clip_contents |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
void |
add_image ( Texture2D image, int width=0, int height=0, Color color=Color(1, 1, 1, 1), InlineAlignment inline_align=5, Rect2 region=Rect2(0, 0, 0, 0), Variant key=null, bool pad=false, String tooltip="", bool size_in_percent=false ) |
void |
|
void |
append_text ( String bbcode ) |
void |
clear ( ) |
void |
deselect ( ) |
get_character_line ( int character ) |
|
get_character_paragraph ( int character ) |
|
get_content_height ( ) const |
|
get_content_width ( ) const |
|
get_line_count ( ) const |
|
get_line_offset ( int line ) |
|
get_menu ( ) const |
|
get_paragraph_count ( ) const |
|
get_paragraph_offset ( int paragraph ) |
|
get_parsed_text ( ) const |
|
get_selected_text ( ) const |
|
get_selection_from ( ) const |
|
get_selection_to ( ) const |
|
get_total_character_count ( ) const |
|
get_v_scroll_bar ( ) |
|
get_visible_line_count ( ) const |
|
get_visible_paragraph_count ( ) const |
|
void |
install_effect ( Variant effect ) |
is_menu_visible ( ) const |
|
is_ready ( ) const |
|
void |
menu_option ( int option ) |
void |
newline ( ) |
void |
parse_bbcode ( String bbcode ) |
parse_expressions_for_values ( PackedStringArray expressions ) |
|
void |
pop ( ) |
void |
pop_all ( ) |
void |
pop_context ( ) |
void |
push_bgcolor ( Color bgcolor ) |
void |
push_bold ( ) |
void |
|
void |
push_cell ( ) |
void |
push_color ( Color color ) |
void |
push_context ( ) |
void |
push_customfx ( RichTextEffect effect, Dictionary env ) |
void |
push_dropcap ( String string, Font font, int size, Rect2 dropcap_margins=Rect2(0, 0, 0, 0), Color color=Color(1, 1, 1, 1), int outline_size=0, Color outline_color=Color(0, 0, 0, 0) ) |
void |
push_fgcolor ( Color fgcolor ) |
void |
|
void |
push_font_size ( int font_size ) |
void |
|
void |
push_indent ( int level ) |
void |
push_italics ( ) |
void |
push_language ( String language ) |
void |
push_list ( int level, ListType type, bool capitalize, String bullet="•" ) |
void |
|
void |
push_mono ( ) |
void |
push_normal ( ) |
void |
push_outline_color ( Color color ) |
void |
push_outline_size ( int outline_size ) |
void |
push_paragraph ( HorizontalAlignment alignment, TextDirection base_direction=0, String language="", StructuredTextParser st_parser=0, BitField<JustificationFlag> justification_flags=163, PackedFloat32Array tab_stops=PackedFloat32Array() ) |
void |
|
void |
push_table ( int columns, InlineAlignment inline_align=0, int align_to_row=-1 ) |
void |
push_underline ( ) |
remove_paragraph ( int paragraph ) |
|
void |
scroll_to_line ( int line ) |
void |
scroll_to_paragraph ( int paragraph ) |
void |
|
void |
select_all ( ) |
void |
set_cell_border_color ( Color color ) |
void |
set_cell_padding ( Rect2 padding ) |
void |
set_cell_row_background_color ( Color odd_row_bg, Color even_row_bg ) |
void |
set_cell_size_override ( Vector2 min_size, Vector2 max_size ) |
void |
set_table_column_expand ( int column, bool expand, int ratio=1 ) |
void |
update_image ( Variant key, BitField<ImageUpdateMask> mask, Texture2D image, int width=0, int height=0, Color color=Color(1, 1, 1, 1), InlineAlignment inline_align=5, Rect2 region=Rect2(0, 0, 0, 0), bool pad=false, String tooltip="", |