Label that displays rich text.
Rich text can contain custom text, fonts, images and some basic formatting. The label manages these as an internal tag stack. It also adapts itself to given width/heights.
[b]Note:[/b] Assignments to [member bbcode_text] clear the tag stack and reconstruct it from the property's contents. Any edits made to [member bbcode_text] will erase previous edits made from other manual sources such as [method append_bbcode] and the [code]push_*[/code] / [method pop] methods.
[b]Note:[/b] RichTextLabel doesn't support entangled BBCode tags. For example, instead of using [code][b]bold[i]bold italic[/b]italic[/i][/code], use [code][b]bold[i]bold italic[/i][/b][i]italic[/i][/code].
[b]Note:[/b] [code]push_*/pop[/code] functions won't affect BBCode.
[b]Note:[/b] Unlike [Label], RichTextLabel doesn't have a [i]property[/i] to horizontally align text to the center. Instead, enable [member bbcode_enabled] and surround the text in a [code][center][/code] tag as follows: [code][center]Example[/center][/code]. There is currently no built-in way to vertically align text either, but this can be emulated by relying on anchors/containers and the [member fit_content_height] property.
https://docs.godotengine.org/en/latest/tutorials/gui/bbcode_in_richtextlabel.html
https://godotengine.org/asset-library/asset/132
https://godotengine.org/asset-library/asset/677
Adds an image's opening and closing tags to the tag stack, optionally providing a [code]width[/code] and [code]height[/code] to resize the image and a [code]color[/code] to tint the image.
If [code]width[/code] or [code]height[/code] is set to 0, the image size will be adjusted in order to keep the original aspect ratio.
Adds raw non-BBCode-parsed text to the tag stack.
Parses [code]bbcode[/code] and adds tags to the tag stack as needed. Returns the result of the parsing, [constant OK] if successful.
[b]Note:[/b] Using this method, you can't close a tag that was opened in a previous [method append_bbcode] call. This is done to improve performance, especially when updating large RichTextLabels since rebuilding the whole BBCode every time would be slower. If you absolutely need to close a tag in a future method call, append the [member bbcode_text] instead of using [method append_bbcode].
Clears the tag stack and sets [member bbcode_text] to an empty string.
Returns the height of the content.
Returns the total number of lines in the text. Wrapped text is counted as multiple lines.
Returns the total number of paragraphs (newlines or [code]p[/code] tags in the tag stack's text tags). Considers wrapped text as one paragraph.
Returns the current selection text. Does not include BBCodes.
Returns the current selection first character index if a selection is active, [code]-1[/code] otherwise. Does not include BBCodes.
Returns the current selection last character index if a selection is active, [code]-1[/code] otherwise. Does not include BBCodes.
Returns the total number of characters from text tags. Does not include BBCodes.
Returns the vertical scrollbar.
Returns the number of visible lines.
Returns the number of visible paragraphs. A paragraph is considered visible if at least one of its lines is visible.
Installs a custom effect. [code]effect[/code] should be a valid [RichTextEffect].
Adds a newline tag to the tag stack.
The assignment version of [method append_bbcode]. Clears the tag stack and inserts the new content. Returns [constant OK] if parses [code]bbcode[/code] successfully.
Parses BBCode parameter [code]expressions[/code] into a dictionary.
Terminates the current tag. Use after [code]push_*[/code] methods to close BBCodes manually. Does not need to follow [code]add_*[/code] methods.
Adds a [code][bgcolor][/code] tag to the tag stack.
Adds a [code][font][/code] tag with a bold font to the tag stack. This is the same as adding a [code][b][/code] tag if not currently in a [code][i][/code] tag.
Adds a [code][font][/code] tag with a bold italics font to the tag stack.
Adds a [code][cell][/code] tag to the tag stack. Must be inside a [code][table][/code] tag. See [method push_table] for details.
Adds a [code][color][/code] tag to the tag stack.
Adds a [code][dropcap][/code] tag to the tag stack. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.
Adds a [code][fgcolor][/code] tag to the tag stack.
Adds a [code][font][/code] tag to the tag stack. Overrides default fonts for its duration.
Adds a [code][ot_feature][/code] tag to the tag stack. Overrides default OpenType font feature for its duration.
Adds a [code][font_size][/code] tag to the tag stack. Overrides default font size for its duration.
Adds an [code][indent][/code] tag to the tag stack. Multiplies [code]level[/code] by current [member tab_size] to determine new margin length.
Adds a [code][font][/code] tag with a italics font to the tag stack. This is the same as adding a [code][i][/code] tag if not currently in a [code][b][/code] tag.
Adds [code][ol][/code] or [code][ul][/code] tag to the tag stack. Multiplies [code]level[/code] by current [member tab_size] to determine new margin length.
Adds a [code][meta][/code] tag to the tag stack. Similar to the BBCode [code][url=something]{text}[/url][/code], but supports non-[String] metadata types.
Adds a [code][font][/code] tag with a monospace font to the tag stack.
Adds a [code][font][/code] tag with a normal font to the tag stack.
Adds a [code][outline_color][/code] tag to the tag stack. Adds text outline for its duration.
Adds a [code][outline_size][/code] tag to the tag stack. Overrides default text outline size for its duration.
Adds a [code][p][/code] tag to the tag stack.
Adds a [code][s][/code] tag to the tag stack.
Adds a [code][table=columns,inline_align][/code] tag to the tag stack.
Adds a [code][u][/code] tag to the tag stack.
Removes a line of content from the label. Returns [code]true[/code] if the line exists.
The [code]line[/code] argument is the index of the line to remove, it can take values in the interval [code][0, get_line_count() - 1][/code].
Scrolls the window's top line to match [code]line[/code].
Scrolls the window's top line to match first line of the [code]paragraph[/code].
Sets color of a table cell border.
Sets inner padding of a table cell.
Sets color of a table cell. Separate colors for alternating rows can be specified.
Sets minimum and maximum size overrides for a table cell.
Edits the selected column's expansion options. If [code]expand[/code] is [code]true[/code], the column expands in proportion to its expansion ratio versus the other columns' ratios.
For example, 2 columns with ratios 3 and 4 plus 70 pixels in available width would expand 30 and 40 pixels, respectively.
If [code]expand[/code] is [code]false[/code], the column will not contribute to the total ratio.
If [code]true[/code], the label uses BBCode formatting.
The label's text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited.
[b]Note:[/b] It is unadvised to use the [code]+=[/code] operator with [code]bbcode_text[/code] (e.g. [code]bbcode_text += "some string"[/code]) as it replaces the whole text and can cause slowdowns. Use [method append_bbcode] for adding text instead, unless you absolutely need to close a tag that was opened in an earlier method call.
The currently installed custom effects. This is an array of [RichTextEffect]s.
To add a custom effect, it's more convenient to use [method install_effect].
If [code]true[/code], the label's height will be automatically updated to fit its content.
[b]Note:[/b] This property is used as a workaround to fix issues with [RichTextLabel] in [Container]s, but it's unreliable in some cases and will be removed in future versions.
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
If [code]true[/code], the label underlines meta tags such as [code][url]{text}[/url][/code].
If [code]true[/code], the label uses the custom font color.
The range of characters to display, as a [float] between 0.0 and 1.0. When assigned an out of range value, it's the same as assigning 1.0.
[b]Note:[/b] Setting this property updates [member visible_characters] based on current [method get_total_character_count].
If [code]true[/code], the scrollbar is visible. Setting this to [code]false[/code] does not block scrolling completely. See [method scroll_to_line].
If [code]true[/code], the window scrolls down to display new content automatically.
If [code]true[/code], the label allows text selection.
Set BiDi algorithm override for the structured text.
Set additional options for BiDi override.
The number of spaces associated with a single tab length. Does not affect [code]\t[/code] in text tags, only indent tags.
The raw text of the label.
When set, clears the tag stack and adds a raw text tag to the top of it. Does not parse BBCodes. Does not modify [member bbcode_text].
Base text writing direction.
The restricted number of characters to display in the label. If [code]-1[/code], all characters will be displayed.
[b]Note:[/b] Setting this property updates [member percent_visible] based on current [method get_total_character_count].
Triggered when the user clicks on content between meta tags. If the meta is defined in text, e.g. [code][url={"data"="hi"}]hi[/url][/code], then the parameter for this signal will be a [String] type. If a particular type or an object is desired, the [method push_meta] method must be used to manually insert the data into the tag stack.
Triggers when the mouse exits a meta tag.
Triggers when the mouse enters a meta tag.
Makes text left aligned.
Makes text centered.
Makes text right aligned.
Makes text fill width.
Each list item has a number marker.
Each list item has a letter marker.
Each list item has a roman number marker.
Each list item has a filled circle marker.
The font used for bold text.
The font size used for bold text.
The font used for bold italics text.
The font size used for bold italics text.
The default text color.
The background The background used when the [RichTextLabel] is focused.
The default tint of text outline.
The color of selected text, used when [member selection_enabled] is [code]true[/code].
The color of the font's shadow.
The font used for italics text.
The font size used for italics text.
The vertical space between lines.
The font used for monospace text.
The font size used for monospace text.
The normal background for the [RichTextLabel].
The default text font.
The default text font size.
The size of the text outline.
The color of the selection box.
Boolean value. If 1 ([code]true[/code]), the shadow will be displayed around the whole text as an outline.
The horizontal offset of the font's shadow.
The vertical offset of the font's shadow.
The default cell border color.
The default background color for even rows.
The horizontal separation of elements in a table.
The default background color for odd rows.
The vertical separation of elements in a table.