Documentation
¶
Overview ¶
A control for displaying text that can contain custom fonts, images, and basic formatting. graphics.gd/classdb/RichTextLabel manages these as an internal tag stack. It also adapts itself to given width/heights.
Note: Instance.Newline, Instance.PushParagraph, "\n", "\r\n", p tag, and alignment tags start a new paragraph. Each paragraph is processed independently, in its own BiDi context. If you want to force line wrapping within paragraph, any other line breaking character can be used, for example, Form Feed (U+000C), Next Line (U+0085), Line Separator (U+2028).
Note: Assignments to Instance.Text clear the tag stack and reconstruct it from the property's contents. Any edits made to Instance.Text will erase previous edits made from other manual sources such as Instance.AppendText and the push_* / Instance.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 graphics.gd/classdb/Label, graphics.gd/classdb/RichTextLabel doesn't have a property to horizontally align text to the center. Instead, enable Instance.BbcodeEnabled 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 Instance.FitContent property.
Index ¶
- type Advanced
- type Any
- type Expanded
- func (self Expanded) AddImage(image Texture2D.Instance, width int, height int, color Color.RGBA, ...)
- func (self Expanded) PushDropcap(s string, font Font.Instance, size int, dropcap_margins Rect2.PositionSize, ...)
- func (self Expanded) PushFont(font Font.Instance, font_size int)
- func (self Expanded) PushList(level int, atype ListType, capitalize bool, bullet string)
- func (self Expanded) PushMeta(data any, underline_mode MetaUnderline, tooltip string)
- func (self Expanded) PushParagraph(alignment GUI.HorizontalAlignment, base_direction Control.TextDirection, ...)
- func (self Expanded) PushTable(columns int, inline_align GUI.InlineAlignment, align_to_row int)
- func (self Expanded) RemoveParagraph(paragraph int, no_invalidate bool) bool
- func (self Expanded) SetTableColumnExpand(column int, expand bool, ratio int, shrink bool)
- func (self Expanded) UpdateImage(key any, mask ImageUpdateMask, image Texture2D.Instance, width int, height int, ...)
- type Extension
- type ID
- type ImageUpdateMask
- type Instance
- func (self Instance) AddImage(image Texture2D.Instance)
- func (self Instance) AddText(text string)
- func (self Instance) AppendText(bbcode string)
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsControl() Control.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRichTextLabel() Instance
- func (self Instance) AutowrapMode() TextServer.AutowrapMode
- func (self Instance) BbcodeEnabled() bool
- func (self Instance) Clear()
- func (self Instance) ContextMenuEnabled() bool
- func (self Instance) CustomEffects() []any
- func (self Instance) Deselect()
- func (self Instance) DeselectOnFocusLossEnabled() bool
- func (self Instance) DragAndDropSelectionEnabled() bool
- func (self Instance) FitContent() bool
- func (self Instance) GetCharacterLine(character int) int
- func (self Instance) GetCharacterParagraph(character int) int
- func (self Instance) GetContentHeight() int
- func (self Instance) GetContentWidth() int
- func (self Instance) GetLineCount() int
- func (self Instance) GetLineOffset(line int) Float.X
- func (self Instance) GetLineRange(line int) Vector2i.XY
- func (self Instance) GetMenu() PopupMenu.Instance
- func (self Instance) GetParagraphCount() int
- func (self Instance) GetParagraphOffset(paragraph int) Float.X
- func (self Instance) GetParsedText() string
- func (self Instance) GetSelectedText() string
- func (self Instance) GetSelectionFrom() int
- func (self Instance) GetSelectionLineOffset() Float.X
- func (self Instance) GetSelectionTo() int
- func (self Instance) GetTotalCharacterCount() int
- func (self Instance) GetVScrollBar() VScrollBar.Instance
- func (self Instance) GetVisibleLineCount() int
- func (self Instance) GetVisibleParagraphCount() int
- func (self Instance) HintUnderlined() bool
- func (self Instance) HorizontalAlignment() GUI.HorizontalAlignment
- func (self Instance) ID() ID
- func (self Instance) InstallEffect(effect any)
- func (self Instance) InvalidateParagraph(paragraph int) bool
- func (self Instance) IsFinished() bool
- func (self Instance) IsMenuVisible() bool
- func (self Instance) IsReady() bool
- func (self Instance) JustificationFlags() TextServer.JustificationFlag
- func (self Instance) Language() string
- func (self Instance) MenuOption(option int)
- func (self Instance) MetaUnderlined() bool
- func (self Instance) Newline()
- func (self Instance) OnFinished(cb func(), flags ...Signal.Flags)
- func (self Instance) OnMetaClicked(cb func(meta any), flags ...Signal.Flags)
- func (self Instance) OnMetaHoverEnded(cb func(meta any), flags ...Signal.Flags)
- func (self Instance) OnMetaHoverStarted(cb func(meta any), flags ...Signal.Flags)
- func (self Instance) ParseBbcode(bbcode string)
- func (self Instance) ParseExpressionsForValues(expressions []string) map[string]interface{}
- func (self Instance) Pop()
- func (self Instance) PopAll()
- func (self Instance) PopContext()
- func (self Instance) ProgressBarDelay() int
- func (self Instance) PushBgcolor(bgcolor Color.RGBA)
- func (self Instance) PushBold()
- func (self Instance) PushBoldItalics()
- func (self Instance) PushCell()
- func (self Instance) PushColor(color Color.RGBA)
- func (self Instance) PushContext()
- func (self Instance) PushCustomfx(effect RichTextEffect.Instance, env map[string]interface{})
- func (self Instance) PushDropcap(s string, font Font.Instance, size int)
- func (self Instance) PushFgcolor(fgcolor Color.RGBA)
- func (self Instance) PushFont(font Font.Instance)
- func (self Instance) PushFontSize(font_size int)
- func (self Instance) PushHint(description string)
- func (self Instance) PushIndent(level int)
- func (self Instance) PushItalics()
- func (self Instance) PushLanguage(language string)
- func (self Instance) PushList(level int, atype ListType, capitalize bool)
- func (self Instance) PushMeta(data any)
- func (self Instance) PushMono()
- func (self Instance) PushNormal()
- func (self Instance) PushOutlineColor(color Color.RGBA)
- func (self Instance) PushOutlineSize(outline_size int)
- func (self Instance) PushParagraph(alignment GUI.HorizontalAlignment)
- func (self Instance) PushStrikethrough()
- func (self Instance) PushTable(columns int)
- func (self Instance) PushUnderline()
- func (self Instance) RemoveParagraph(paragraph int) bool
- func (self Instance) ScrollActive() bool
- func (self Instance) ScrollFollowing() bool
- func (self Instance) ScrollToLine(line int)
- func (self Instance) ScrollToParagraph(paragraph int)
- func (self Instance) ScrollToSelection()
- func (self Instance) SelectAll()
- func (self Instance) SelectionEnabled() bool
- func (self Instance) SetAutowrapMode(value TextServer.AutowrapMode)
- func (self Instance) SetBbcodeEnabled(value bool)
- func (self Instance) SetCellBorderColor(color Color.RGBA)
- func (self Instance) SetCellPadding(padding Rect2.PositionSize)
- func (self Instance) SetCellRowBackgroundColor(odd_row_bg Color.RGBA, even_row_bg Color.RGBA)
- func (self Instance) SetCellSizeOverride(min_size Vector2.XY, max_size Vector2.XY)
- func (self Instance) SetContextMenuEnabled(value bool)
- func (self Instance) SetCustomEffects(value []any)
- func (self Instance) SetDeselectOnFocusLossEnabled(value bool)
- func (self Instance) SetDragAndDropSelectionEnabled(value bool)
- func (self Instance) SetFitContent(value bool)
- func (self Instance) SetHintUnderlined(value bool)
- func (self Instance) SetHorizontalAlignment(value GUI.HorizontalAlignment)
- func (self Instance) SetJustificationFlags(value TextServer.JustificationFlag)
- func (self Instance) SetLanguage(value string)
- func (self Instance) SetMetaUnderlined(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetProgressBarDelay(value int)
- func (self Instance) SetScrollActive(value bool)
- func (self Instance) SetScrollFollowing(value bool)
- func (self Instance) SetSelectionEnabled(value bool)
- func (self Instance) SetShortcutKeysEnabled(value bool)
- func (self Instance) SetStructuredTextBidiOverride(value TextServer.StructuredTextParser)
- func (self Instance) SetStructuredTextBidiOverrideOptions(value []any)
- func (self Instance) SetTabSize(value int)
- func (self Instance) SetTabStops(value []float32)
- func (self Instance) SetTableColumnExpand(column int, expand bool)
- func (self Instance) SetText(value string)
- func (self Instance) SetTextDirection(value Control.TextDirection)
- func (self Instance) SetThreaded(value bool)
- func (self Instance) SetVerticalAlignment(value GUI.VerticalAlignment)
- func (self Instance) SetVisibleCharacters(value int)
- func (self Instance) SetVisibleCharactersBehavior(value TextServer.VisibleCharactersBehavior)
- func (self Instance) SetVisibleRatio(value Float.X)
- func (self Instance) ShortcutKeysEnabled() bool
- func (self Instance) StructuredTextBidiOverride() TextServer.StructuredTextParser
- func (self Instance) StructuredTextBidiOverrideOptions() []any
- func (self Instance) TabSize() int
- func (self Instance) TabStops() []float32
- func (self Instance) Text() string
- func (self Instance) TextDirection() Control.TextDirection
- func (self Instance) Threaded() bool
- func (self Instance) UpdateImage(key any, mask ImageUpdateMask, image Texture2D.Instance)
- func (self Instance) VerticalAlignment() GUI.VerticalAlignment
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) VisibleCharacters() int
- func (self Instance) VisibleCharactersBehavior() TextServer.VisibleCharactersBehavior
- func (self Instance) VisibleRatio() Float.X
- type ListType
- type MenuItems
- type MetaUnderline
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Expanded ¶
type Expanded [1]gdclass.RichTextLabel
func (Expanded) AddImage ¶
func (self Expanded) AddImage(image Texture2D.Instance, width int, height int, color Color.RGBA, inline_align GUI.InlineAlignment, region Rect2.PositionSize, key any, pad bool, tooltip string, size_in_percent bool)
Adds an image's opening and closing tags to the tag stack, optionally providing a 'width' and 'height' to resize the image, a 'color' to tint the image and a 'region' to only use parts of the image.
If 'width' or 'height' is set to 0, the image size will be adjusted in order to keep the original aspect ratio.
If 'width' and 'height' are not set, but 'region' is, the region's rect will be used.
'key' is an optional identifier, that can be used to modify the image via Instance.UpdateImage.
If 'pad' is set, and the image is smaller than the size specified by 'width' and 'height', the image padding is added to match the size instead of upscaling.
If 'size_in_percent' is set, 'width' and 'height' values are percentages of the control width instead of pixels.
func (Expanded) PushDropcap ¶
func (self Expanded) PushDropcap(s string, font Font.Instance, size int, dropcap_margins Rect2.PositionSize, color Color.RGBA, outline_size int, outline_color Color.RGBA)
Adds a [dropcap] 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.
func (Expanded) PushFont ¶
Adds a [font] tag to the tag stack. Overrides default fonts for its duration.
Passing 0 to 'font_size' will use the existing default font size.
func (Expanded) PushList ¶
Adds [ol] or [ul] tag to the tag stack. Multiplies 'level' by current Instance.TabSize to determine new margin length.
func (Expanded) PushMeta ¶
func (self Expanded) PushMeta(data any, underline_mode MetaUnderline, tooltip string)
Adds a meta tag to the tag stack. Similar to the BBCode [url=something]{text}[/url], but supports non-string metadata types.
If Instance.MetaUnderlined is true, meta tags display an underline. This behavior can be customized with 'underline_mode'.
Note: Meta tags do nothing by default when clicked. To assign behavior when clicked, connect Instance.OnMetaClicked to a function that is called when the meta tag is clicked.
func (Expanded) PushParagraph ¶
func (self Expanded) PushParagraph(alignment GUI.HorizontalAlignment, base_direction Control.TextDirection, language string, st_parser TextServer.StructuredTextParser, justification_flags TextServer.JustificationFlag, tab_stops []float32)
Adds a [p] tag to the tag stack.
func (Expanded) PushTable ¶
func (self Expanded) PushTable(columns int, inline_align GUI.InlineAlignment, align_to_row int)
Adds a [table=columns,inline_align] tag to the tag stack. Use Instance.SetTableColumnExpand to set column expansion ratio. Use Instance.PushCell to add cells.
func (Expanded) RemoveParagraph ¶
Removes a paragraph of content from the label. Returns true if the paragraph exists.
The 'paragraph' argument is the index of the paragraph to remove, it can take values in the interval [0, get_paragraph_count() - 1].
If 'no_invalidate' is set to true, cache for the subsequent paragraphs is not invalidated. Use it for faster updates if deleted paragraph is fully self-contained (have no unclosed tags), or this call is part of the complex edit operation and Instance.InvalidateParagraph will be called at the end of operation.
func (Expanded) SetTableColumnExpand ¶
Edits the selected column's expansion options. If 'expand' is true, 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 'expand' is false, the column will not contribute to the total ratio.
func (Expanded) UpdateImage ¶
func (self Expanded) UpdateImage(key any, mask ImageUpdateMask, image Texture2D.Instance, width int, height int, color Color.RGBA, inline_align GUI.InlineAlignment, region Rect2.PositionSize, pad bool, tooltip string, size_in_percent bool)
Updates the existing images with the key 'key'. Only properties specified by 'mask' bits are updated. See Instance.AddImage.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsCanvasItem ¶
func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
func (*Extension[T]) AsRichTextLabel ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type ImageUpdateMask ¶
type ImageUpdateMask int //gd:RichTextLabel.ImageUpdateMask
const ( // If this bit is set, [Instance.UpdateImage] changes image texture. UpdateTexture ImageUpdateMask = 1 // If this bit is set, [Instance.UpdateImage] changes image size. UpdateSize ImageUpdateMask = 2 // If this bit is set, [Instance.UpdateImage] changes image color. UpdateColor ImageUpdateMask = 4 // If this bit is set, [Instance.UpdateImage] changes image inline alignment. UpdateAlignment ImageUpdateMask = 8 // If this bit is set, [Instance.UpdateImage] changes image texture region. UpdateRegion ImageUpdateMask = 16 // If this bit is set, [Instance.UpdateImage] changes image padding. UpdatePad ImageUpdateMask = 32 // If this bit is set, [Instance.UpdateImage] changes image tooltip. UpdateTooltip ImageUpdateMask = 64 // If this bit is set, [Instance.UpdateImage] changes image width from/to percents. UpdateWidthInPercent ImageUpdateMask = 128 )
type Instance ¶
type Instance [1]gdclass.RichTextLabel
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddImage ¶
Adds an image's opening and closing tags to the tag stack, optionally providing a 'width' and 'height' to resize the image, a 'color' to tint the image and a 'region' to only use parts of the image.
If 'width' or 'height' is set to 0, the image size will be adjusted in order to keep the original aspect ratio.
If 'width' and 'height' are not set, but 'region' is, the region's rect will be used.
'key' is an optional identifier, that can be used to modify the image via Instance.UpdateImage.
If 'pad' is set, and the image is smaller than the size specified by 'width' and 'height', the image padding is added to match the size instead of upscaling.
If 'size_in_percent' is set, 'width' and 'height' values are percentages of the control width instead of pixels.
func (Instance) AppendText ¶
Parses 'bbcode' and adds tags to the tag stack as needed.
Note: Using this method, you can't close a tag that was opened in a previous Instance.AppendText 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 Instance.Text instead of using Instance.AppendText.
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AsRichTextLabel ¶
func (Instance) AutowrapMode ¶
func (self Instance) AutowrapMode() TextServer.AutowrapMode
func (Instance) BbcodeEnabled ¶
func (Instance) Clear ¶
func (self Instance) Clear()
Clears the tag stack, causing the label to display nothing.
Note: This method does not affect Instance.Text, and its contents will show again if the label is redrawn. However, setting Instance.Text to an empty string also clears the stack.
func (Instance) ContextMenuEnabled ¶
func (Instance) CustomEffects ¶
func (Instance) DeselectOnFocusLossEnabled ¶
func (Instance) DragAndDropSelectionEnabled ¶
func (Instance) FitContent ¶
func (Instance) GetCharacterLine ¶
Returns the line number of the character position provided. Line and character numbers are both zero-indexed.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) GetCharacterParagraph ¶
Returns the paragraph number of the character position provided. Paragraph and character numbers are both zero-indexed.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) GetContentHeight ¶
Returns the height of the content.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) GetContentWidth ¶
Returns the width of the content.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) GetLineCount ¶
Returns the total number of lines in the text. Wrapped text is counted as multiple lines.
Note: If Instance.VisibleCharactersBehavior is set to [Textserver.VcCharsBeforeShaping] only visible wrapped lines are counted.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) GetLineOffset ¶
Returns the vertical offset of the line found at the provided index.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) GetLineRange ¶
Returns the indexes of the first and last visible characters for the given 'line', as a [Vector2i.XY].
Note: If Instance.VisibleCharactersBehavior is set to [Textserver.VcCharsBeforeShaping] only visible wrapped lines are counted.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) GetMenu ¶
Returns the graphics.gd/classdb/PopupMenu of this graphics.gd/classdb/RichTextLabel. By default, this menu is displayed when right-clicking on the graphics.gd/classdb/RichTextLabel.
You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see MenuItems). For example:
Warning: 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 graphics.gd/classdb/Window.Instance.Visible property.
func (Instance) GetParagraphCount ¶
Returns the total number of paragraphs (newlines or p tags in the tag stack's text tags). Considers wrapped text as one paragraph.
func (Instance) GetParagraphOffset ¶
Returns the vertical offset of the paragraph found at the provided index.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) GetParsedText ¶
Returns the text without BBCode mark-up.
func (Instance) GetSelectedText ¶
Returns the current selection text. Does not include BBCodes.
func (Instance) GetSelectionFrom ¶
Returns the current selection first character index if a selection is active, -1 otherwise. Does not include BBCodes.
func (Instance) GetSelectionLineOffset ¶
Returns the current selection vertical line offset if a selection is active, -1.0 otherwise.
func (Instance) GetSelectionTo ¶
Returns the current selection last character index if a selection is active, -1 otherwise. Does not include BBCodes.
func (Instance) GetTotalCharacterCount ¶
Returns the total number of characters from text tags. Does not include BBCodes.
func (Instance) GetVScrollBar ¶
func (self Instance) GetVScrollBar() VScrollBar.Instance
Returns the vertical scrollbar.
Warning: 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 graphics.gd/classdb/CanvasItem.Instance.Visible property.
func (Instance) GetVisibleLineCount ¶
Returns the number of visible lines.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) GetVisibleParagraphCount ¶
Returns the number of visible paragraphs. A paragraph is considered visible if at least one of its lines is visible.
Note: If Instance.Threaded is enabled, this method returns a value for the loaded part of the document. Use Instance.IsFinished or Instance.OnFinished to determine whether document is fully loaded.
func (Instance) HintUnderlined ¶
func (Instance) HorizontalAlignment ¶
func (self Instance) HorizontalAlignment() GUI.HorizontalAlignment
func (Instance) InstallEffect ¶
Installs a custom effect. This can also be done in the Inspector through the Instance.CustomEffects property. 'effect' should be a valid graphics.gd/classdb/RichTextEffect.
Example: With the following script extending from graphics.gd/classdb/RichTextEffect:
The above effect can be installed in graphics.gd/classdb/RichTextLabel from a script:
func (Instance) InvalidateParagraph ¶
Invalidates 'paragraph' and all subsequent paragraphs cache.
func (Instance) IsFinished ¶
If Instance.Threaded is enabled, returns true if the background thread has finished text processing, otherwise always return true.
func (Instance) IsMenuVisible ¶
Returns whether the menu is visible. Use this instead of get_menu().visible to improve performance (so the creation of the menu is avoided).
func (Instance) IsReady ¶
If Instance.Threaded is enabled, returns true if the background thread has finished text processing, otherwise always return true.
func (Instance) JustificationFlags ¶
func (self Instance) JustificationFlags() TextServer.JustificationFlag
func (Instance) MenuOption ¶
Executes a given action as defined in the MenuItems enum.
func (Instance) MetaUnderlined ¶
func (Instance) OnFinished ¶
func (Instance) OnMetaClicked ¶
func (Instance) OnMetaHoverEnded ¶
func (Instance) OnMetaHoverStarted ¶
func (Instance) ParseBbcode ¶
The assignment version of Instance.AppendText. Clears the tag stack and inserts the new content.
func (Instance) ParseExpressionsForValues ¶
Parses BBCode parameter 'expressions' into a dictionary.
func (Instance) Pop ¶
func (self Instance) Pop()
Terminates the current tag. Use after push_* methods to close BBCodes manually. Does not need to follow add_* methods.
func (Instance) PopAll ¶
func (self Instance) PopAll()
Terminates all tags opened by push_* methods.
func (Instance) PopContext ¶
func (self Instance) PopContext()
Terminates tags opened after the last Instance.PushContext call (including context marker), or all tags if there's no context marker on the stack.
func (Instance) ProgressBarDelay ¶
func (Instance) PushBgcolor ¶
Adds a [bgcolor] tag to the tag stack.
func (Instance) PushBold ¶
func (self Instance) PushBold()
Adds a [font] tag with a bold font to the tag stack. This is the same as adding a [b] tag if not currently in a [i] tag.
func (Instance) PushBoldItalics ¶
func (self Instance) PushBoldItalics()
Adds a [font] tag with a bold italics font to the tag stack.
func (Instance) PushCell ¶
func (self Instance) PushCell()
Adds a [cell] tag to the tag stack. Must be inside a [table] tag. See Instance.PushTable for details. Use Instance.SetTableColumnExpand to set column expansion ratio, Instance.SetCellBorderColor to set cell border, Instance.SetCellRowBackgroundColor to set cell background, Instance.SetCellSizeOverride to override cell size, and Instance.SetCellPadding to set padding.
func (Instance) PushContext ¶
func (self Instance) PushContext()
Adds a context marker to the tag stack. See Instance.PopContext.
func (Instance) PushCustomfx ¶
func (self Instance) PushCustomfx(effect RichTextEffect.Instance, env map[string]interface{})
Adds a custom effect tag to the tag stack. The effect does not need to be in Instance.CustomEffects. The environment is directly passed to the effect.
func (Instance) PushDropcap ¶
Adds a [dropcap] 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.
func (Instance) PushFgcolor ¶
Adds a [fgcolor] tag to the tag stack.
func (Instance) PushFont ¶
Adds a [font] tag to the tag stack. Overrides default fonts for its duration.
Passing 0 to 'font_size' will use the existing default font size.
func (Instance) PushFontSize ¶
Adds a [font_size] tag to the tag stack. Overrides default font size for its duration.
func (Instance) PushHint ¶
Adds a [hint] tag to the tag stack. Same as BBCode [hint=something]{text}[/hint].
func (Instance) PushIndent ¶
Adds an [indent] tag to the tag stack. Multiplies 'level' by current Instance.TabSize to determine new margin length.
func (Instance) PushItalics ¶
func (self Instance) PushItalics()
Adds a [font] tag with an italics font to the tag stack. This is the same as adding an [i] tag if not currently in a [b] tag.
func (Instance) PushLanguage ¶
Adds language code used for text shaping algorithm and Open-Type font features.
func (Instance) PushList ¶
Adds [ol] or [ul] tag to the tag stack. Multiplies 'level' by current Instance.TabSize to determine new margin length.
func (Instance) PushMeta ¶
Adds a meta tag to the tag stack. Similar to the BBCode [url=something]{text}[/url], but supports non-string metadata types.
If Instance.MetaUnderlined is true, meta tags display an underline. This behavior can be customized with 'underline_mode'.
Note: Meta tags do nothing by default when clicked. To assign behavior when clicked, connect Instance.OnMetaClicked to a function that is called when the meta tag is clicked.
func (Instance) PushMono ¶
func (self Instance) PushMono()
Adds a [font] tag with a monospace font to the tag stack.
func (Instance) PushNormal ¶
func (self Instance) PushNormal()
Adds a [font] tag with a normal font to the tag stack.
func (Instance) PushOutlineColor ¶
Adds a [outline_color] tag to the tag stack. Adds text outline for its duration.
func (Instance) PushOutlineSize ¶
Adds a [outline_size] tag to the tag stack. Overrides default text outline size for its duration.
func (Instance) PushParagraph ¶
func (self Instance) PushParagraph(alignment GUI.HorizontalAlignment)
Adds a [p] tag to the tag stack.
func (Instance) PushStrikethrough ¶
func (self Instance) PushStrikethrough()
Adds a [s] tag to the tag stack.
func (Instance) PushTable ¶
Adds a [table=columns,inline_align] tag to the tag stack. Use Instance.SetTableColumnExpand to set column expansion ratio. Use Instance.PushCell to add cells.
func (Instance) PushUnderline ¶
func (self Instance) PushUnderline()
Adds a [u] tag to the tag stack.
func (Instance) RemoveParagraph ¶
Removes a paragraph of content from the label. Returns true if the paragraph exists.
The 'paragraph' argument is the index of the paragraph to remove, it can take values in the interval [0, get_paragraph_count() - 1].
If 'no_invalidate' is set to true, cache for the subsequent paragraphs is not invalidated. Use it for faster updates if deleted paragraph is fully self-contained (have no unclosed tags), or this call is part of the complex edit operation and Instance.InvalidateParagraph will be called at the end of operation.
func (Instance) ScrollActive ¶
func (Instance) ScrollFollowing ¶
func (Instance) ScrollToLine ¶
Scrolls the window's top line to match 'line'.
func (Instance) ScrollToParagraph ¶
Scrolls the window's top line to match first line of the 'paragraph'.
func (Instance) ScrollToSelection ¶
func (self Instance) ScrollToSelection()
Scrolls to the beginning of the current selection.
func (Instance) SelectAll ¶
func (self Instance) SelectAll()
Select all the text.
If Instance.SelectionEnabled is false, no selection will occur.
func (Instance) SelectionEnabled ¶
func (Instance) SetAutowrapMode ¶
func (self Instance) SetAutowrapMode(value TextServer.AutowrapMode)
func (Instance) SetBbcodeEnabled ¶
func (Instance) SetCellBorderColor ¶
Sets color of a table cell border.
func (Instance) SetCellPadding ¶
func (self Instance) SetCellPadding(padding Rect2.PositionSize)
Sets inner padding of a table cell.
func (Instance) SetCellRowBackgroundColor ¶
Sets color of a table cell. Separate colors for alternating rows can be specified.
func (Instance) SetCellSizeOverride ¶
Sets minimum and maximum size overrides for a table cell.
func (Instance) SetContextMenuEnabled ¶
func (Instance) SetCustomEffects ¶
func (Instance) SetDeselectOnFocusLossEnabled ¶
func (Instance) SetDragAndDropSelectionEnabled ¶
func (Instance) SetFitContent ¶
func (Instance) SetHintUnderlined ¶
func (Instance) SetHorizontalAlignment ¶
func (self Instance) SetHorizontalAlignment(value GUI.HorizontalAlignment)
func (Instance) SetJustificationFlags ¶
func (self Instance) SetJustificationFlags(value TextServer.JustificationFlag)
func (Instance) SetLanguage ¶
func (Instance) SetMetaUnderlined ¶
func (Instance) SetProgressBarDelay ¶
func (Instance) SetScrollActive ¶
func (Instance) SetScrollFollowing ¶
func (Instance) SetSelectionEnabled ¶
func (Instance) SetShortcutKeysEnabled ¶
func (Instance) SetStructuredTextBidiOverride ¶
func (self Instance) SetStructuredTextBidiOverride(value TextServer.StructuredTextParser)
func (Instance) SetStructuredTextBidiOverrideOptions ¶
func (Instance) SetTabSize ¶
func (Instance) SetTabStops ¶
func (Instance) SetTableColumnExpand ¶
Edits the selected column's expansion options. If 'expand' is true, 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 'expand' is false, the column will not contribute to the total ratio.
func (Instance) SetTextDirection ¶
func (self Instance) SetTextDirection(value Control.TextDirection)
func (Instance) SetThreaded ¶
func (Instance) SetVerticalAlignment ¶
func (self Instance) SetVerticalAlignment(value GUI.VerticalAlignment)
func (Instance) SetVisibleCharacters ¶
func (Instance) SetVisibleCharactersBehavior ¶
func (self Instance) SetVisibleCharactersBehavior(value TextServer.VisibleCharactersBehavior)
func (Instance) SetVisibleRatio ¶
func (Instance) ShortcutKeysEnabled ¶
func (Instance) StructuredTextBidiOverride ¶
func (self Instance) StructuredTextBidiOverride() TextServer.StructuredTextParser
func (Instance) StructuredTextBidiOverrideOptions ¶
func (Instance) TextDirection ¶
func (self Instance) TextDirection() Control.TextDirection
func (Instance) UpdateImage ¶
func (self Instance) UpdateImage(key any, mask ImageUpdateMask, image Texture2D.Instance)
Updates the existing images with the key 'key'. Only properties specified by 'mask' bits are updated. See Instance.AddImage.
func (Instance) VerticalAlignment ¶
func (self Instance) VerticalAlignment() GUI.VerticalAlignment
func (Instance) VisibleCharacters ¶
func (Instance) VisibleCharactersBehavior ¶
func (self Instance) VisibleCharactersBehavior() TextServer.VisibleCharactersBehavior
func (Instance) VisibleRatio ¶
type MetaUnderline ¶
type MetaUnderline int //gd:RichTextLabel.MetaUnderline
const ( // Meta tag does not display an underline, even if [Instance.MetaUnderlined] is true. MetaUnderlineNever MetaUnderline = 0 // If [Instance.MetaUnderlined] is true, meta tag always display an underline. MetaUnderlineAlways MetaUnderline = 1 // If [Instance.MetaUnderlined] is true, meta tag display an underline when the mouse cursor is over it. MetaUnderlineOnHover MetaUnderline = 2 )