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] 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/3.2/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. 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 newlines in the tag stack's text tags. Considers wrapped text as one line.
Returns the total number of characters from text tags. Does not include BBCodes.
Returns the vertical scrollbar.
Returns the number of visible lines.
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 an [code][align][/code] tag based on the given [code]align[/code] value. See [enum Align] for possible values.
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][font][/code] tag to the tag stack. Overrides default fonts 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 a [code][list][/code] tag to the tag stack. Similar to the BBCodes [code][ol][/code] or [code][ul][/code], but supports more list types. Not fully implemented!
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][s][/code] tag to the tag stack.
Adds a [code][table=columns][/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].
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.
- 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.
- 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].
- The restricted number of characters to display in the label. If [code]-1[/code], all characters will be displayed.
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 filled circle marker.
The font used for bold text.
The font used for bold italics text.
The default text color.
The background The background used when the [RichTextLabel] is focused.
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 vertical space between lines.
The font used for monospace text.
The normal background for the [RichTextLabel].
The default text font.
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 horizontal separation of elements in a table.
The vertical separation of elements in a table.