TextLine

package
v0.0.0-...-c909628 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package TextLine provides methods for working with TextLine object instances.

Index

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 Any

type Any interface {
	gd.IsClass
	AsTextLine() Instance
}

type HorizontalAlignment

type HorizontalAlignment int
const (
	/*Horizontal left alignment, usually for text-derived classes.*/
	HorizontalAlignmentLeft HorizontalAlignment = 0
	/*Horizontal center alignment, usually for text-derived classes.*/
	HorizontalAlignmentCenter HorizontalAlignment = 1
	/*Horizontal right alignment, usually for text-derived classes.*/
	HorizontalAlignmentRight HorizontalAlignment = 2
	/*Expand row to fit width, usually for text-derived classes.*/
	HorizontalAlignmentFill HorizontalAlignment = 3
)

type InlineAlignment

type InlineAlignment int
const (
	/*Aligns the top of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.*/
	InlineAlignmentTopTo InlineAlignment = 0
	/*Aligns the center of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.*/
	InlineAlignmentCenterTo InlineAlignment = 1
	/*Aligns the baseline (user defined) of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.*/
	InlineAlignmentBaselineTo InlineAlignment = 3
	/*Aligns the bottom of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant.*/
	InlineAlignmentBottomTo InlineAlignment = 2
	/*Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the top of the text.*/
	InlineAlignmentToTop InlineAlignment = 0
	/*Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the center of the text.*/
	InlineAlignmentToCenter InlineAlignment = 4
	/*Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the baseline of the text.*/
	InlineAlignmentToBaseline InlineAlignment = 8
	/*Aligns inline object (e.g. image, table) to the bottom of the text.*/
	InlineAlignmentToBottom InlineAlignment = 12
	/*Aligns top of the inline object (e.g. image, table) to the top of the text. Equivalent to [code]INLINE_ALIGNMENT_TOP_TO | INLINE_ALIGNMENT_TO_TOP[/code].*/
	InlineAlignmentTop InlineAlignment = 0
	/*Aligns center of the inline object (e.g. image, table) to the center of the text. Equivalent to [code]INLINE_ALIGNMENT_CENTER_TO | INLINE_ALIGNMENT_TO_CENTER[/code].*/
	InlineAlignmentCenter InlineAlignment = 5
	/*Aligns bottom of the inline object (e.g. image, table) to the bottom of the text. Equivalent to [code]INLINE_ALIGNMENT_BOTTOM_TO | INLINE_ALIGNMENT_TO_BOTTOM[/code].*/
	InlineAlignmentBottom InlineAlignment = 14
	/*A bit mask for [code]INLINE_ALIGNMENT_*_TO[/code] alignment constants.*/
	InlineAlignmentImageMask InlineAlignment = 3
	/*A bit mask for [code]INLINE_ALIGNMENT_TO_*[/code] alignment constants.*/
	InlineAlignmentTextMask InlineAlignment = 12
)

type Instance

type Instance [1]gdclass.TextLine

Abstraction over [TextServer] for handling a single line of text.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddObject

func (self Instance) AddObject(key any, size Vector2.XY) bool

Adds inline object to the text buffer, [param key] must be unique. In the text, object is represented as [param length] object replacement characters.

func (Instance) AddString

func (self Instance) AddString(text string, font [1]gdclass.Font, font_size int) bool

Adds text span and font to draw it.

func (Instance) Alignment

func (self Instance) Alignment() HorizontalAlignment

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsTextLine

func (self Instance) AsTextLine() Instance

func (Instance) Clear

func (self Instance) Clear()

Clears text line (removes text and inline objects).

func (Instance) Direction

func (self Instance) Direction() gdclass.TextServerDirection

func (Instance) Draw

func (self Instance) Draw(canvas RID.Canvas, pos Vector2.XY)

Draw text into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.

func (Instance) DrawOutline

func (self Instance) DrawOutline(canvas RID.Canvas, pos Vector2.XY)

Draw text into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.

func (Instance) EllipsisChar

func (self Instance) EllipsisChar() string

func (Instance) Flags

func (Instance) GetLineAscent

func (self Instance) GetLineAscent() Float.X

Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).

func (Instance) GetLineDescent

func (self Instance) GetLineDescent() Float.X

Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).

func (Instance) GetLineUnderlinePosition

func (self Instance) GetLineUnderlinePosition() Float.X

Returns pixel offset of the underline below the baseline.

func (Instance) GetLineUnderlineThickness

func (self Instance) GetLineUnderlineThickness() Float.X

Returns thickness of the underline.

func (Instance) GetLineWidth

func (self Instance) GetLineWidth() Float.X

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

func (self Instance) GetObjects() []any

Returns array of inline objects.

func (Instance) GetRid

func (self Instance) GetRid() RID.TextBuffer

Returns TextServer buffer RID.

func (Instance) GetSize

func (self Instance) GetSize() Vector2.XY

Returns size of the bounding box of the text.

func (Instance) HitTest

func (self Instance) HitTest(coords Float.X) int

Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.

func (Instance) Orientation

func (self Instance) Orientation() gdclass.TextServerOrientation

func (Instance) PreserveControl

func (self Instance) PreserveControl() bool

func (Instance) PreserveInvalid

func (self Instance) PreserveInvalid() bool

func (Instance) ResizeObject

func (self Instance) ResizeObject(key any, size Vector2.XY) bool

Sets new size and alignment of embedded object.

func (Instance) SetAlignment

func (self Instance) SetAlignment(value HorizontalAlignment)

func (Instance) SetBidiOverride

func (self Instance) SetBidiOverride(override []any)

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 gdclass.TextServerDirection)

func (Instance) SetEllipsisChar

func (self Instance) SetEllipsisChar(value string)

func (Instance) SetFlags

func (self Instance) SetFlags(value gdclass.TextServerJustificationFlag)

func (Instance) SetOrientation

func (self Instance) SetOrientation(value gdclass.TextServerOrientation)

func (Instance) SetPreserveControl

func (self Instance) SetPreserveControl(value bool)

func (Instance) SetPreserveInvalid

func (self Instance) SetPreserveInvalid(value bool)

func (Instance) SetTextOverrunBehavior

func (self Instance) SetTextOverrunBehavior(value gdclass.TextServerOverrunBehavior)

func (Instance) SetWidth

func (self Instance) SetWidth(value Float.X)

func (Instance) TabAlign

func (self Instance) TabAlign(tab_stops []float32)

Aligns text to the given tab-stops.

func (Instance) TextOverrunBehavior

func (self Instance) TextOverrunBehavior() gdclass.TextServerOverrunBehavior

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

func (Instance) Width

func (self Instance) Width() Float.X

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL