Documentation
¶
Overview ¶
A control for displaying plain text. It gives you control over the horizontal and vertical alignment and can wrap the text inside the node's bounding rectangle. It doesn't support bold, italics, or other rich text formatting. For that, use RichTextLabel instead.
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsControl() Control.Instance
- func (self Instance) AsLabel() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AutowrapMode() TextServer.AutowrapMode
- func (self Instance) AutowrapTrimFlags() TextServer.LineBreakFlag
- func (self Instance) ClipText() bool
- func (self Instance) EllipsisChar() string
- func (self Instance) GetCharacterBounds(pos int) Rect2.PositionSize
- func (self Instance) GetLineCount() int
- func (self Instance) GetLineHeight() int
- func (self Instance) GetTotalCharacterCount() int
- func (self Instance) GetVisibleLineCount() int
- func (self Instance) HorizontalAlignment() GUI.HorizontalAlignment
- func (self Instance) ID() ID
- func (self Instance) JustificationFlags() TextServer.JustificationFlag
- func (self Instance) LabelSettings() LabelSettings.Instance
- func (self Instance) Language() string
- func (self Instance) LinesSkipped() int
- func (self Instance) MaxLinesVisible() int
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) ParagraphSeparator() string
- func (self Instance) SetAutowrapMode(value TextServer.AutowrapMode)
- func (self Instance) SetAutowrapTrimFlags(value TextServer.LineBreakFlag)
- func (self Instance) SetClipText(value bool)
- func (self Instance) SetEllipsisChar(value string)
- func (self Instance) SetHorizontalAlignment(value GUI.HorizontalAlignment)
- func (self Instance) SetJustificationFlags(value TextServer.JustificationFlag)
- func (self Instance) SetLabelSettings(value LabelSettings.Instance)
- func (self Instance) SetLanguage(value string)
- func (self Instance) SetLinesSkipped(value int)
- func (self Instance) SetMaxLinesVisible(value int)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetParagraphSeparator(value string)
- func (self Instance) SetStructuredTextBidiOverride(value TextServer.StructuredTextParser)
- func (self Instance) SetStructuredTextBidiOverrideOptions(value []any)
- func (self Instance) SetTabStops(value []float32)
- func (self Instance) SetText(value string)
- func (self Instance) SetTextDirection(value Control.TextDirection)
- func (self Instance) SetTextOverrunBehavior(value TextServer.OverrunBehavior)
- func (self Instance) SetUppercase(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) StructuredTextBidiOverride() TextServer.StructuredTextParser
- func (self Instance) StructuredTextBidiOverrideOptions() []any
- func (self Instance) TabStops() []float32
- func (self Instance) Text() string
- func (self Instance) TextDirection() Control.TextDirection
- func (self Instance) TextOverrunBehavior() TextServer.OverrunBehavior
- func (self Instance) Uppercase() bool
- 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 MoreArgs
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 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
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 Instance ¶
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) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AutowrapMode ¶
func (self Instance) AutowrapMode() TextServer.AutowrapMode
If set to something other than [Textserver.AutowrapOff], the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text.
func (Instance) AutowrapTrimFlags ¶
func (self Instance) AutowrapTrimFlags() TextServer.LineBreakFlag
Autowrap space trimming flags. See [Textserver.BreakTrimStartEdgeSpaces] and [Textserver.BreakTrimEndEdgeSpaces] for more info.
func (Instance) ClipText ¶
If true, the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
func (Instance) EllipsisChar ¶
Ellipsis character used for text clipping.
func (Instance) GetCharacterBounds ¶
func (self Instance) GetCharacterBounds(pos int) Rect2.PositionSize
Returns the bounding rectangle of the character at position 'pos' in the label's local coordinate system. If the character is a non-visual character or 'pos' is outside the valid range, an empty Rect2.PositionSize is returned. If the character is a part of a composite grapheme, the bounding rectangle of the whole grapheme is returned.
func (Instance) GetLineCount ¶
Returns the number of lines of text the Label has.
func (Instance) GetLineHeight ¶
Returns the height of the line 'line'.
If 'line' is set to -1, returns the biggest line height.
If there are no lines, returns font size in pixels.
func (Instance) GetTotalCharacterCount ¶
Returns the total number of printable characters in the text (excluding spaces and newlines).
func (Instance) GetVisibleLineCount ¶
Returns the number of lines shown. Useful if the Label's height cannot currently display all lines.
func (Instance) HorizontalAlignment ¶
func (self Instance) HorizontalAlignment() GUI.HorizontalAlignment
Controls the text's horizontal alignment. Supports left, center, right, and fill (also known as justify).
func (Instance) JustificationFlags ¶
func (self Instance) JustificationFlags() TextServer.JustificationFlag
Line fill alignment rules.
func (Instance) LabelSettings ¶
func (self Instance) LabelSettings() LabelSettings.Instance
A LabelSettings resource that can be shared between multiple Label nodes. Takes priority over theme properties.
func (Instance) Language ¶
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
func (Instance) LinesSkipped ¶
The number of the lines ignored and not displayed from the start of the Text value.
func (Instance) MaxLinesVisible ¶
Limits the lines of text the node shows on screen.
func (Instance) MoreArgs ¶
MoreArgs enables certain functions to be called with additional 'optional' arguments.
func (Instance) ParagraphSeparator ¶
String used as a paragraph separator. Each paragraph is processed independently, in its own BiDi context.
func (Instance) SetAutowrapMode ¶
func (self Instance) SetAutowrapMode(value TextServer.AutowrapMode)
SetAutowrapMode sets the property returned by [GetAutowrapMode].
func (Instance) SetAutowrapTrimFlags ¶
func (self Instance) SetAutowrapTrimFlags(value TextServer.LineBreakFlag)
SetAutowrapTrimFlags sets the property returned by [GetAutowrapTrimFlags].
func (Instance) SetClipText ¶
SetClipText sets the property returned by [IsClippingText].
func (Instance) SetEllipsisChar ¶
SetEllipsisChar sets the property returned by [GetEllipsisChar].
func (Instance) SetHorizontalAlignment ¶
func (self Instance) SetHorizontalAlignment(value GUI.HorizontalAlignment)
SetHorizontalAlignment sets the property returned by [GetHorizontalAlignment].
func (Instance) SetJustificationFlags ¶
func (self Instance) SetJustificationFlags(value TextServer.JustificationFlag)
SetJustificationFlags sets the property returned by [GetJustificationFlags].
func (Instance) SetLabelSettings ¶
func (self Instance) SetLabelSettings(value LabelSettings.Instance)
SetLabelSettings sets the property returned by [GetLabelSettings].
func (Instance) SetLanguage ¶
SetLanguage sets the property returned by [GetLanguage].
func (Instance) SetLinesSkipped ¶
SetLinesSkipped sets the property returned by [GetLinesSkipped].
func (Instance) SetMaxLinesVisible ¶
SetMaxLinesVisible sets the property returned by [GetMaxLinesVisible].
func (Instance) SetParagraphSeparator ¶
SetParagraphSeparator sets the property returned by [GetParagraphSeparator].
func (Instance) SetStructuredTextBidiOverride ¶
func (self Instance) SetStructuredTextBidiOverride(value TextServer.StructuredTextParser)
SetStructuredTextBidiOverride sets the property returned by [GetStructuredTextBidiOverride].
func (Instance) SetStructuredTextBidiOverrideOptions ¶
SetStructuredTextBidiOverrideOptions sets the property returned by [GetStructuredTextBidiOverrideOptions].
func (Instance) SetTabStops ¶
SetTabStops sets the property returned by [GetTabStops].
func (Instance) SetTextDirection ¶
func (self Instance) SetTextDirection(value Control.TextDirection)
SetTextDirection sets the property returned by [GetTextDirection].
func (Instance) SetTextOverrunBehavior ¶
func (self Instance) SetTextOverrunBehavior(value TextServer.OverrunBehavior)
SetTextOverrunBehavior sets the property returned by [GetTextOverrunBehavior].
func (Instance) SetUppercase ¶
SetUppercase sets the property returned by [IsUppercase].
func (Instance) SetVerticalAlignment ¶
func (self Instance) SetVerticalAlignment(value GUI.VerticalAlignment)
SetVerticalAlignment sets the property returned by [GetVerticalAlignment].
func (Instance) SetVisibleCharacters ¶
SetVisibleCharacters sets the property returned by [GetVisibleCharacters].
func (Instance) SetVisibleCharactersBehavior ¶
func (self Instance) SetVisibleCharactersBehavior(value TextServer.VisibleCharactersBehavior)
SetVisibleCharactersBehavior sets the property returned by [GetVisibleCharactersBehavior].
func (Instance) SetVisibleRatio ¶
SetVisibleRatio sets the property returned by [GetVisibleRatio].
func (Instance) StructuredTextBidiOverride ¶
func (self Instance) StructuredTextBidiOverride() TextServer.StructuredTextParser
Set BiDi algorithm override for the structured text.
func (Instance) StructuredTextBidiOverrideOptions ¶
Set additional options for BiDi override.
func (Instance) TextDirection ¶
func (self Instance) TextDirection() Control.TextDirection
Base text writing direction.
func (Instance) TextOverrunBehavior ¶
func (self Instance) TextOverrunBehavior() TextServer.OverrunBehavior
The clipping behavior when the text exceeds the node's bounding rectangle.
func (Instance) VerticalAlignment ¶
func (self Instance) VerticalAlignment() GUI.VerticalAlignment
Controls the text's vertical alignment. Supports top, center, bottom, and fill.
func (Instance) VisibleCharacters ¶
The number of characters to display. If set to -1, all characters are displayed. This can be useful when animating the text appearing in a dialog box.
Note: Setting this property updates VisibleRatio accordingly.
Note: Characters are counted as Unicode codepoints. A single visible grapheme may contain multiple codepoints (e.g. certain emoji use three codepoints). A single codepoint may contain two UTF-16 characters, which are used in C# strings.
func (Instance) VisibleCharactersBehavior ¶
func (self Instance) VisibleCharactersBehavior() TextServer.VisibleCharactersBehavior
The clipping behavior when VisibleCharacters or VisibleRatio is set.
func (Instance) VisibleRatio ¶
The fraction of characters to display, relative to the total number of characters (see GetTotalCharacterCount). If set to 1.0, all characters are displayed. If set to 0.5, only half of the characters will be displayed. This can be useful when animating the text appearing in a dialog box.
Note: Setting this property updates VisibleCharacters accordingly.
type MoreArgs ¶
MoreArgs is a container for Instance functions with additional 'optional' arguments.
func (MoreArgs) GetLineHeight ¶
Returns the height of the line 'line'.
If 'line' is set to -1, returns the biggest line height.
If there are no lines, returns font size in pixels.