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 text] clear the tag stack and reconstruct it from the property's contents. Any edits made to [member text] will erase previous edits made from other manual sources such as [method append_text] 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.
$DOCS_URL/tutorials/ui/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.
[b]Note:[/b] Using this method, you can't close a tag that was opened in a previous [method append_text] 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 text] instead of using [method append_text].
Clears the tag stack and sets [member text] to an empty string.
Returns the height of the content.
Returns the width 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 text without BBCode mark-up.
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.
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
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_text]. Clears the tag stack and inserts the new content.
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 set to something other than [constant AUTOWRAP_OFF], the text gets wrapped inside the node's bounding rectangle. To see how each mode behaves, see [enum AutowrapMode].
If [code]true[/code], the label uses BBCode formatting.
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 selected text will be deselected when focus is lost.
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 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] If [member bbcode_enabled] is [code]true[/code], it is unadvised to use the [code]+=[/code] operator with [code]text[/code] (e.g. [code]text += "some string"[/code]) as it replaces the whole text and can cause slowdowns. It will also erase all BBCode that was added to stack using [code]push_*[/code] methods. Use [method append_text] for adding text instead, unless you absolutely need to close a tag that was opened in an earlier method call.
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].
Sets the clipping behavior when [member visible_characters] or [member percent_visible] is set. See [enum VisibleCharactersBehavior] for more info.
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.
Autowrap is disabled.
Wraps the text inside the node's bounding rectangle by allowing to break lines at arbitrary positions, which is useful when very limited space is available.
Wraps the text inside the node's bounding rectangle by soft-breaking between words.
Behaves similarly to [constant AUTOWRAP_WORD], but force-breaks a word if that single word does not fit in one line.
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.
Trims text before the shaping. e.g, increasing [member visible_characters] value is visually identical to typing the text.
Displays glyphs that are mapped to the first [member visible_characters] characters from the beginning of the text.
Displays [member percent_visible] glyphs, starting from the left or from the right, depending on [member Control.layout_direction] value.
Displays [member percent_visible] glyphs, starting from the left.
Displays [member percent_visible] glyphs, starting from the right.
The default text color.
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 color of the selection box.
The default cell border color.
The default background color for even rows.
The default background color for odd rows.
The vertical space between lines.
The size of the text outline.
The horizontal offset of the font's shadow.
The vertical offset of the font's shadow.
The size of the shadow outline.
The horizontal separation of elements in a table.
The vertical separation of elements in a table.
The font used for bold text.
The font used for bold italics text.
The font used for italics text.
The font used for monospace text.
The default text font.
The font size used for bold text.
The font size used for bold italics text.
The font size used for italics text.
The font size used for monospace text.
The default text font size.
The background used when the [RichTextLabel] is focused. The [code]focus[/code] [StyleBox] is displayed [i]over[/i] the base [StyleBox], so a partially transparent [StyleBox] should be used to ensure the base [StyleBox] remains visible. A [StyleBox] that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a [StyleBoxEmpty] resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
The normal background for the [RichTextLabel].