Fyne API "canvas.Text"

canvas.Text


import "fyne.io/fyne/v2/canvas"

Usage

type Text

type Text struct {
	Alignment fyne.TextAlign // The alignment of the text content

	Color     color.Color    // The main text draw color
	Text      string         // The string content of this Text
	TextSize  float32        // Size of the text - if the Canvas scale is 1.0 this will be equivalent to point size
	TextStyle fyne.TextStyle // The style of the text content
}

Text describes a text primitive in a Fyne canvas. A text object can have a style set which will apply to the whole string. No formatting or text parsing will be performed

func NewText

func NewText(text string, color color.Color) *Text

NewText returns a new Text implementation

func (*Text) Hide

func (t *Text) Hide()

Hide will set this text to not be visible

func (*Text) MinSize

func (t *Text) MinSize() fyne.Size

MinSize returns the minimum size of this text object based on its font size and content. This is normally determined by the render implementation.

func (*Text) Move

func (t *Text) Move(pos fyne.Position)

Move the text to a new position, relative to its parent / canvas

func (*Text) Position

func (o *Text) Position() fyne.Position

Position gets the current position of this canvas object, relative to its parent.

func (*Text) Refresh

func (t *Text) Refresh()

Refresh causes this text to be redrawn with its configured state.

func (*Text) Resize

func (t *Text) Resize(s fyne.Size)

Resize on a text updates the new size of this object, which may not result in a visual change, depending on alignment.

func (*Text) SetMinSize

func (t *Text) SetMinSize(fyne.Size)

SetMinSize has no effect as the smallest size this canvas object can be is based on its font size and content.

func (*Text) Show

func (o *Text) Show()

Show will set this object to be visible.

func (*Text) Size

func (o *Text) Size() fyne.Size

Size returns the current size of this canvas object.

func (*Text) Visible

func (o *Text) Visible() bool

Visible returns true if this object is visible, false otherwise.