Documentation
¶
Overview ¶
Abstraction over TextServer for handling a single line of text.
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AddObject(key any, size Vector2.XY) bool
- func (self Instance) AddString(text string, font Font.Instance, font_size int) bool
- func (self Instance) Alignment() GUI.HorizontalAlignment
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsTextLine() Instance
- func (self Instance) Clear()
- func (self Instance) Direction() TextServer.Direction
- func (self Instance) Draw(canvas RID.Canvas, pos Vector2.XY)
- func (self Instance) DrawOutline(canvas RID.Canvas, pos Vector2.XY)
- func (self Instance) EllipsisChar() string
- func (self Instance) Flags() TextServer.JustificationFlag
- func (self Instance) GetInferredDirection() TextServer.Direction
- func (self Instance) GetLineAscent() Float.X
- func (self Instance) GetLineDescent() Float.X
- func (self Instance) GetLineUnderlinePosition() Float.X
- func (self Instance) GetLineUnderlineThickness() Float.X
- func (self Instance) GetLineWidth() Float.X
- func (self Instance) GetObjectRect(key any) Rect2.PositionSize
- func (self Instance) GetObjects() []any
- func (self Instance) GetRid() RID.TextBuffer
- func (self Instance) GetSize() Vector2.XY
- func (self Instance) HitTest(coords Float.X) int
- func (self Instance) ID() ID
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) Orientation() TextServer.Orientation
- func (self Instance) PreserveControl() bool
- func (self Instance) PreserveInvalid() bool
- func (self Instance) ResizeObject(key any, size Vector2.XY) bool
- func (self Instance) SetAlignment(value GUI.HorizontalAlignment)
- func (self Instance) SetBidiOverride(override []any)
- func (self Instance) SetDirection(value TextServer.Direction)
- func (self Instance) SetEllipsisChar(value string)
- func (self Instance) SetFlags(value TextServer.JustificationFlag)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOrientation(value TextServer.Orientation)
- func (self Instance) SetPreserveControl(value bool)
- func (self Instance) SetPreserveInvalid(value bool)
- func (self Instance) SetTextOverrunBehavior(value TextServer.OverrunBehavior)
- func (self Instance) SetWidth(value Float.X)
- func (self Instance) TabAlign(tab_stops []float32)
- func (self Instance) TextOverrunBehavior() TextServer.OverrunBehavior
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) Width() Float.X
- type MoreArgs
- func (self MoreArgs) AddObject(key any, size Vector2.XY, inline_align GUI.InlineAlignment, length int, ...) bool
- func (self MoreArgs) AddString(text string, font Font.Instance, font_size int, language string, meta any) bool
- func (self MoreArgs) Draw(canvas RID.Canvas, pos Vector2.XY, color Color.RGBA, oversampling Float.X)
- func (self MoreArgs) DrawOutline(canvas RID.Canvas, pos Vector2.XY, outline_size int, color Color.RGBA, ...)
- func (self MoreArgs) ResizeObject(key any, size Vector2.XY, inline_align GUI.InlineAlignment, baseline Float.X) bool
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]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsTextLine ¶
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) AddObject ¶
Adds inline object to the text buffer, 'key' must be unique. In the text, object is represented as 'length' object replacement characters.
func (Instance) Alignment ¶
func (self Instance) Alignment() GUI.HorizontalAlignment
Sets text alignment within the line as if the line was horizontal.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsTextLine ¶
func (Instance) Clear ¶
func (self Instance) Clear()
Clears text line (removes text and inline objects).
func (Instance) Direction ¶
func (self Instance) Direction() TextServer.Direction
Text writing direction.
func (Instance) Draw ¶
Draw text into a canvas item at a given position, with 'color'. 'pos' specifies the top left corner of the bounding box. If 'oversampling' is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.
func (Instance) DrawOutline ¶
Draw text into a canvas item at a given position, with 'color'. 'pos' specifies the top left corner of the bounding box. If 'oversampling' is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.
func (Instance) EllipsisChar ¶
Ellipsis character used for text clipping.
func (Instance) Flags ¶
func (self Instance) Flags() TextServer.JustificationFlag
Line alignment rules. For more info see TextServer.
func (Instance) GetInferredDirection ¶
func (self Instance) GetInferredDirection() TextServer.Direction
Returns the text writing direction inferred by the BiDi algorithm.
func (Instance) GetLineAscent ¶
Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
func (Instance) GetLineDescent ¶
Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
func (Instance) GetLineUnderlinePosition ¶
Returns pixel offset of the underline below the baseline.
func (Instance) GetLineUnderlineThickness ¶
Returns thickness of the underline.
func (Instance) GetLineWidth ¶
Returns width (for horizontal layout) or height (for vertical) of the text.
func (Instance) GetObjectRect ¶
func (self Instance) GetObjectRect(key any) Rect2.PositionSize
Returns bounding rectangle of the inline object.
func (Instance) GetObjects ¶
Returns array of inline objects.
func (Instance) GetRid ¶
func (self Instance) GetRid() RID.TextBuffer
Returns TextServer buffer RID.
func (Instance) HitTest ¶
Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
func (Instance) MoreArgs ¶
MoreArgs enables certain functions to be called with additional 'optional' arguments.
func (Instance) Orientation ¶
func (self Instance) Orientation() TextServer.Orientation
Text orientation.
func (Instance) PreserveControl ¶
If set to true text will display control characters.
func (Instance) PreserveInvalid ¶
If set to true text will display invalid characters.
func (Instance) ResizeObject ¶
Sets new size and alignment of embedded object.
func (Instance) SetAlignment ¶
func (self Instance) SetAlignment(value GUI.HorizontalAlignment)
SetAlignment sets the property returned by [GetHorizontalAlignment].
func (Instance) SetBidiOverride ¶
Overrides BiDi for the structured text.
Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.
func (Instance) SetDirection ¶
func (self Instance) SetDirection(value TextServer.Direction)
SetDirection sets the property returned by [GetDirection].
func (Instance) SetEllipsisChar ¶
SetEllipsisChar sets the property returned by [GetEllipsisChar].
func (Instance) SetFlags ¶
func (self Instance) SetFlags(value TextServer.JustificationFlag)
SetFlags sets the property returned by [GetFlags].
func (Instance) SetOrientation ¶
func (self Instance) SetOrientation(value TextServer.Orientation)
SetOrientation sets the property returned by [GetOrientation].
func (Instance) SetPreserveControl ¶
SetPreserveControl sets the property returned by [GetPreserveControl].
func (Instance) SetPreserveInvalid ¶
SetPreserveInvalid sets the property returned by [GetPreserveInvalid].
func (Instance) SetTextOverrunBehavior ¶
func (self Instance) SetTextOverrunBehavior(value TextServer.OverrunBehavior)
SetTextOverrunBehavior sets the property returned by [GetTextOverrunBehavior].
func (Instance) TextOverrunBehavior ¶
func (self Instance) TextOverrunBehavior() TextServer.OverrunBehavior
The clipping behavior when the text exceeds the text line's set width.
type MoreArgs ¶
MoreArgs is a container for Instance functions with additional 'optional' arguments.
func (MoreArgs) AddObject ¶
func (self MoreArgs) AddObject(key any, size Vector2.XY, inline_align GUI.InlineAlignment, length int, baseline Float.X) bool
Adds inline object to the text buffer, 'key' must be unique. In the text, object is represented as 'length' object replacement characters.
func (MoreArgs) AddString ¶
func (self MoreArgs) AddString(text string, font Font.Instance, font_size int, language string, meta any) bool
Adds text span and font to draw it.
func (MoreArgs) Draw ¶
func (self MoreArgs) Draw(canvas RID.Canvas, pos Vector2.XY, color Color.RGBA, oversampling Float.X)
Draw text into a canvas item at a given position, with 'color'. 'pos' specifies the top left corner of the bounding box. If 'oversampling' is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.
func (MoreArgs) DrawOutline ¶
func (self MoreArgs) DrawOutline(canvas RID.Canvas, pos Vector2.XY, outline_size int, color Color.RGBA, oversampling Float.X)
Draw text into a canvas item at a given position, with 'color'. 'pos' specifies the top left corner of the bounding box. If 'oversampling' is greater than zero, it is used as font oversampling factor, otherwise viewport oversampling settings are used.