TextParagraph

package
v0.0.0-...-af89a4c Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package TextParagraph provides methods for working with TextParagraph 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
	AsTextParagraph() Instance
}

type Expanded

type Expanded [1]gdclass.TextParagraph

func (Expanded) AddObject

func (self Expanded) AddObject(key any, size Vector2.XY, inline_align GUI.InlineAlignment, length int, baseline Float.X) 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 (Expanded) AddString

func (self Expanded) AddString(text string, font Font.Instance, font_size int, language string, meta any) bool

Adds text span and font to draw it.

func (Expanded) Draw

func (self Expanded) Draw(canvas RID.Canvas, pos Vector2.XY, color Color.RGBA, dc_color Color.RGBA)

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

func (Expanded) DrawDropcap

func (self Expanded) DrawDropcap(canvas RID.Canvas, pos Vector2.XY, color Color.RGBA)

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

func (Expanded) DrawDropcapOutline

func (self Expanded) DrawDropcapOutline(canvas RID.Canvas, pos Vector2.XY, outline_size int, color Color.RGBA)

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

func (Expanded) DrawLine

func (self Expanded) DrawLine(canvas RID.Canvas, pos Vector2.XY, line int, color Color.RGBA)

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

func (Expanded) DrawLineOutline

func (self Expanded) DrawLineOutline(canvas RID.Canvas, pos Vector2.XY, line int, outline_size int, color Color.RGBA)

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

func (Expanded) DrawOutline

func (self Expanded) DrawOutline(canvas RID.Canvas, pos Vector2.XY, outline_size int, color Color.RGBA, dc_color Color.RGBA)

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

func (Expanded) ResizeObject

func (self Expanded) ResizeObject(key any, size Vector2.XY, inline_align GUI.InlineAlignment, baseline Float.X) bool

Sets new size and alignment of embedded object.

func (Expanded) SetDropcap

func (self Expanded) SetDropcap(text string, font Font.Instance, font_size int, dropcap_margins Rect2.PositionSize, language string) bool

Sets drop cap, overrides previously set drop cap. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsTextParagraph

func (self *Extension[T]) AsTextParagraph() Instance

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.TextParagraph

Abstraction over [TextServer] for handling a single paragraph 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 Font.Instance, font_size int) bool

Adds text span and font to draw it.

func (Instance) Alignment

func (self Instance) Alignment() GUI.HorizontalAlignment

func (Instance) AsObject

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

func (Instance) AsRefCounted

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

func (Instance) AsTextParagraph

func (self Instance) AsTextParagraph() Instance

func (Instance) BreakFlags

func (self Instance) BreakFlags() TextServer.LineBreakFlag

func (Instance) Clear

func (self Instance) Clear()

Clears text paragraph (removes text and inline objects).

func (Instance) ClearDropcap

func (self Instance) ClearDropcap()

Removes dropcap.

func (Instance) CustomPunctuation

func (self Instance) CustomPunctuation() string

func (Instance) Direction

func (self Instance) Direction() TextServer.Direction

func (Instance) Draw

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

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

func (Instance) DrawDropcap

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

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

func (Instance) DrawDropcapOutline

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

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

func (Instance) DrawLine

func (self Instance) DrawLine(canvas RID.Canvas, pos Vector2.XY, line int)

Draw single line of 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) DrawLineOutline

func (self Instance) DrawLineOutline(canvas RID.Canvas, pos Vector2.XY, line int)

Draw outline of the single line of 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 outlines of all lines of the text and drop cap 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) GetDropcapLines

func (self Instance) GetDropcapLines() int

Returns number of lines used by dropcap.

func (Instance) GetDropcapRid

func (self Instance) GetDropcapRid() RID.TextBuffer

Returns drop cap text buffer RID.

func (Instance) GetDropcapSize

func (self Instance) GetDropcapSize() Vector2.XY

Returns drop cap bounding box size.

func (Instance) GetLineAscent

func (self Instance) GetLineAscent(line int) Float.X

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

func (Instance) GetLineCount

func (self Instance) GetLineCount() int

Returns number of lines in the paragraph.

func (Instance) GetLineDescent

func (self Instance) GetLineDescent(line int) Float.X

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

func (Instance) GetLineObjectRect

func (self Instance) GetLineObjectRect(line int, key any) Rect2.PositionSize

Returns bounding rectangle of the inline object.

func (Instance) GetLineObjects

func (self Instance) GetLineObjects(line int) []any

Returns array of inline objects in the line.

func (Instance) GetLineRange

func (self Instance) GetLineRange(line int) Vector2i.XY

Returns character range of the line.

func (Instance) GetLineRid

func (self Instance) GetLineRid(line int) RID.TextBuffer

Returns TextServer line buffer RID.

func (Instance) GetLineSize

func (self Instance) GetLineSize(line int) Vector2.XY

Returns size of the bounding box of the line of text. Returned size is rounded up.

func (Instance) GetLineUnderlinePosition

func (self Instance) GetLineUnderlinePosition(line int) Float.X

Returns pixel offset of the underline below the baseline.

func (Instance) GetLineUnderlineThickness

func (self Instance) GetLineUnderlineThickness(line int) Float.X

Returns thickness of the underline.

func (Instance) GetLineWidth

func (self Instance) GetLineWidth(line int) Float.X

Returns width (for horizontal layout) or height (for vertical) of the line of text.

func (Instance) GetNonWrappedSize

func (self Instance) GetNonWrappedSize() Vector2.XY

Returns the size of the bounding box of the paragraph, without line breaks.

func (Instance) GetRid

func (self Instance) GetRid() RID.TextBuffer

Returns TextServer full string buffer RID.

func (Instance) GetSize

func (self Instance) GetSize() Vector2.XY

Returns the size of the bounding box of the paragraph.

func (Instance) HitTest

func (self Instance) HitTest(coords Vector2.XY) int

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

func (Instance) ID

func (self Instance) ID() ID

func (Instance) JustificationFlags

func (self Instance) JustificationFlags() TextServer.JustificationFlag

func (Instance) LineSpacing

func (self Instance) LineSpacing() Float.X

func (Instance) MaxLinesVisible

func (self Instance) MaxLinesVisible() int

func (Instance) Orientation

func (self Instance) Orientation() TextServer.Orientation

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 GUI.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) SetBreakFlags

func (self Instance) SetBreakFlags(value TextServer.LineBreakFlag)

func (Instance) SetCustomPunctuation

func (self Instance) SetCustomPunctuation(value string)

func (Instance) SetDirection

func (self Instance) SetDirection(value TextServer.Direction)

func (Instance) SetDropcap

func (self Instance) SetDropcap(text string, font Font.Instance, font_size int) bool

Sets drop cap, overrides previously set drop cap. 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) SetEllipsisChar

func (self Instance) SetEllipsisChar(value string)

func (Instance) SetJustificationFlags

func (self Instance) SetJustificationFlags(value TextServer.JustificationFlag)

func (Instance) SetLineSpacing

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

func (Instance) SetMaxLinesVisible

func (self Instance) SetMaxLinesVisible(value int)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetOrientation

func (self Instance) SetOrientation(value TextServer.Orientation)

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 TextServer.OverrunBehavior)

func (Instance) SetWidth

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

func (Instance) TabAlign

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

Aligns paragraph to the given tab-stops.

func (Instance) TextOverrunBehavior

func (self Instance) TextOverrunBehavior() TextServer.OverrunBehavior

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