text

package
v0.1.122 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 23 Imported by: 0

README

Foundation Text

Gio Implementation

Documentation

Index

Constants

View Source
const BasicTextNodeID = "BasicText"

Variables

View Source
var GetThemeManager = theme.GetThemeManager

Functions

This section is empty.

Types

type Alignment

type Alignment = text.Alignment
const (
	Start  Alignment = text.Start
	End    Alignment = text.End
	Middle Alignment = text.Middle
)

type BasicTextConstructorArgs

type BasicTextConstructorArgs struct {
	Value   string
	Options TextOptions
	// contains filtered or unexported fields
}

type Composable

type Composable = api.Composable

func Text

func Text(value string, options ...TextOption) Composable

Text renders a text leaf. The value is stored in a slot for tooling.

type Composer

type Composer = api.Composer

type TextOption

type TextOption func(*TextOptions)

func Selectable

func Selectable() TextOption

TextSelectable sets the text to be selectable. stores *widget.Selectable in runtime memoization

func StyleWithColor deprecated

func StyleWithColor(color graphics.Color) TextOption

Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions

func StyleWithFont deprecated

func StyleWithFont(font gioFont.Font) TextOption

Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions

func StyleWithSelectionColor

func StyleWithSelectionColor(color graphics.Color) TextOption

StyleWithSelectionColor sets the selection highlight color. Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions

func StyleWithStrikethrough

func StyleWithStrikethrough() TextOption

StyleWithStrikethrough enables strikethrough text decoration. Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions

func StyleWithTextSize deprecated

func StyleWithTextSize(sizeInSP float32) TextOption

Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions

func WithAdditionalTextStyle

func WithAdditionalTextStyle(ts *text.TextStyle) TextOption

merge TextStyle

func WithAlignment

func WithAlignment(alignment style.TextAlign) TextOption

func WithColor

func WithColor(color graphics.Color) TextOption

func WithGioAlignment

func WithGioAlignment(alignment Alignment) TextOption

func WithLineHeight deprecated

func WithLineHeight(lineHeightInSP float32) TextOption

Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions

func WithLineHeightScale

func WithLineHeightScale(lineHeightScale float32) TextOption

Deprecated

func WithMaxLines

func WithMaxLines(maxLines int) TextOption

func WithModifier

func WithModifier(m ui.Modifier) TextOption

func WithTextStyle

func WithTextStyle(ts *text.TextStyle) TextOption

replace TextStyle

func WithTextStyleOptions

func WithTextStyleOptions(options ...text.TextStyleOption) TextOption

func WithTruncator

func WithTruncator(truncator string) TextOption

func WithWrapPolicy deprecated

func WithWrapPolicy(wrapPolicy WrapPolicy) TextOption

Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions

type TextOptions

type TextOptions struct {
	Modifier ui.Modifier

	TextStyle *text.TextStyle

	MaxLines int
	// Truncator is the text that will be shown at the end of the final
	// line if MaxLines is exceeded. Defaults to "…" if empty.
	Truncator string

	// LineHeightScale applies a scaling factor to the LineHeight. If zero, a
	// sensible default will be used.
	LineHeightScale maybe.Maybe[float32]

	// Selectable provides text selection state for the label. If not set, the label cannot
	// be selected or copied interactively.
	Selectable maybe.Maybe[bool]

	// SelectionColor is the color of the background for selected text.
	SelectionColor graphics.Color
}

func DefaultTextOptions

func DefaultTextOptions() TextOptions

type ThemeManager

type ThemeManager = theme.ThemeManager

type WrapPolicy

type WrapPolicy = text.WrapPolicy

WrapPolicy configures strategies for choosing where to break lines of text for line wrapping.

const (
	// WrapHeuristically tries to minimize breaking within words (UAX#14 text segments)
	// while also ensuring that text fits within the given MaxWidth. It will only break
	// a line within a word (on a UAX#29 grapheme cluster boundary) when that word cannot
	// fit on a line by itself. Additionally, when the final word of a line is being
	// truncated, this policy will preserve as many symbols of that word as
	// possible before the truncator.
	WrapHeuristically WrapPolicy = text.WrapHeuristically
	// WrapWords does not permit words (UAX#14 text segments) to be broken across lines.
	// This means that sometimes long words will exceed the MaxWidth they are wrapped with.
	WrapWords WrapPolicy = text.WrapWords
	// WrapGraphemes will maximize the amount of text on each line at the expense of readability,
	// breaking any word across lines on UAX#29 grapheme cluster boundaries to maximize the number of
	// grapheme clusters on each line.
	WrapGraphemes WrapPolicy = text.WrapGraphemes
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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