style

package
v0.1.59 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TextDecorationNone Defines a horizontal line to be drawn on the text.
	TextDecorationNone = &TextDecoration{mask: TextDecorationMaskNone}

	// TextDecorationUnderline Draws a horizontal line below the text.
	TextDecorationUnderline = &TextDecoration{mask: TextDecorationMaskUnderline}

	// TextDecorationLineThrough Draws a horizontal line over the text.
	TextDecorationLineThrough = &TextDecoration{mask: TextDecorationMaskLineThrough}

	TextDecorationUnspecified = &TextDecoration{mask: TextDecorationMaskUnspecified}
)

Functions

func EqualTextDecoration

func EqualTextDecoration(a, b *TextDecoration) bool

func IsSpecifiedTextDecoration

func IsSpecifiedTextDecoration(t *TextDecoration) bool

func LineBreakToGioWrapPolicy

func LineBreakToGioWrapPolicy(l LineBreak) gioText.WrapPolicy

func SameTextDecoration

func SameTextDecoration(a, b *TextDecoration) bool

Identity (2 ns)

func SemanticEqualTextDecoration

func SemanticEqualTextDecoration(a, b *TextDecoration) bool

Semantic equality (field-by-field, 20 ns)

func StringTextDecoration

func StringTextDecoration(t *TextDecoration) string

func TextAlignToGioTextAlignment

func TextAlignToGioTextAlignment(t TextAlign) gioText.Alignment

Types

type LineBreak

type LineBreak gioText.WrapPolicy

LineBreak configures strategies for choosing where to break lines of text for line

const LineBreakUnspecified LineBreak = 99

This represents an unset value, a usual replacement for "null" when a primitive value is desired.

var LineBreakHeading LineBreak = LineBreak(gioText.WrapWords)

Looser breaking rules, suitable for short text such as titles or narrow newspaper columns. For longer lines of text, use [Paragraph] for improved readability.

var LineBreakParagraph LineBreak = LineBreak(gioText.WrapHeuristically)

Slower, higher quality line breaking for improved readability. Suitable for larger amounts of text.

var LineBreakSimple LineBreak = LineBreak(gioText.WrapGraphemes)

Basic, fast line breaking. Ideal for text input fields, as it will cause minimal text reflow when editing.

func GioWrapPolicyToLineBreak

func GioWrapPolicyToLineBreak(gioWrapPolicy gioText.WrapPolicy) LineBreak

func (LineBreak) IsSpecified

func (l LineBreak) IsSpecified() bool

IsSpecified returns true if it is not LineBreakUnspecified.

func (LineBreak) String

func (l LineBreak) String() string

func (LineBreak) TakeOrElse

func (l LineBreak) TakeOrElse(other LineBreak) LineBreak

type TextAlign

type TextAlign gioText.Alignment

TextAlign defines how to align text horizontally. TextAlign controls how text aligns in the space it appears.

const (
	// TextAlignUnspecified represents an unset value, a usual replacement for "null"
	// when a primitive value is desired.
	TextAlignUnspecified TextAlign = 99

	// TextAlignStart aligns the text on the leading edge of the container.
	// For Left to Right text, this is the left edge.
	// For Right to Left text, like Arabic, this is the right edge.
	TextAlignStart TextAlign = TextAlign(gioText.Start)

	// TextAlignEnd aligns the text on the trailing edge of the container.
	// For Left to Right text, this is the right edge.
	// For Right to Left text, like Arabic, this is the left edge.
	TextAlignEnd TextAlign = TextAlign(gioText.End)

	// TextAlignCenter aligns the text in the center of the container.
	TextAlignMiddle TextAlign = TextAlign(gioText.Middle)
)

TextAlign constants

func FromGioTextAlign

func FromGioTextAlign(gioTextAlign gioText.Alignment) TextAlign

func TextAlignValueOf

func TextAlignValueOf(value int) (TextAlign, error)

TextAlignValueOf creates a TextAlign from the given integer value. This can be useful if you need to serialize/deserialize TextAlign values. Returns an error if the given value is not recognized by the preset TextAlign values.

func TextAlignValues

func TextAlignValues() []TextAlign

TextAlignValues returns a list containing all possible values of TextAlign.

func (TextAlign) IsSpecified

func (t TextAlign) IsSpecified() bool

IsSpecified returns true if this TextAlign is not TextAlignUnspecified.

func (TextAlign) String

func (t TextAlign) String() string

String returns the string representation of the TextAlign.

func (TextAlign) TakeOrElse

func (t TextAlign) TakeOrElse(other TextAlign) TextAlign

TakeOrElse returns this TextAlign if IsSpecified() is true, otherwise executes the provided function and returns its result.

type TextDecoration

type TextDecoration struct {
	// contains filtered or unexported fields
}

TextDecoration defines a horizontal line to be drawn on the text.

func CoalesceTextDecoration

func CoalesceTextDecoration(ptr, def *TextDecoration) *TextDecoration

func Combine

func Combine(decorations []*TextDecoration) *TextDecoration

Combine creates a decoration that includes all the given decorations.

func MergeTextDecoration

func MergeTextDecoration(a, b *TextDecoration) *TextDecoration

func NewTextDecoration

func NewTextDecoration(mask TextDecorationMask) TextDecoration

NewTextDecoration constructs a TextDecoration instance from the underlying mask. This method ensures the mask is valid.

func TakeOrElseTextDecoration

func TakeOrElseTextDecoration(s, def *TextDecoration) *TextDecoration

func (TextDecoration) Contains

func (t TextDecoration) Contains(other *TextDecoration) bool

Contains checks whether this TextDecoration contains the given decoration.

func (TextDecoration) Plus

func (t TextDecoration) Plus(decoration *TextDecoration) *TextDecoration

Plus creates a decoration that includes both of the TextDecorations.

type TextDecorationMask

type TextDecorationMask int
const (
	TextDecorationMaskUnspecified TextDecorationMask = -1
	TextDecorationMaskNone        TextDecorationMask = 0x0
	TextDecorationMaskUnderline   TextDecorationMask = 0x1
	TextDecorationMaskLineThrough TextDecorationMask = 0x2
)

type TextDirection

type TextDirection int

TextDirection defines the algorithm to be used while determining the text direction.

const (
	// TextDirectionUnspecified represents an unset value, a usual replacement for "null"
	// when a primitive value is desired.
	TextDirectionUnspecified TextDirection = 0

	// TextDirectionLtr always sets the text direction to be Left to Right.
	TextDirectionLtr TextDirection = 1

	// TextDirectionRtl always sets the text direction to be Right to Left.
	TextDirectionRtl TextDirection = 2

	// TextDirectionContent indicates that the text direction depends on the first strong
	// directional character in the text according to the Unicode Bidirectional Algorithm.
	// If no strong directional character is present, then LayoutDirection is used to
	// resolve the final TextDirection.
	// * if used while creating a Paragraph object, LocaleList will be used to resolve
	//   the direction as a fallback instead of LayoutDirection.
	TextDirectionContent TextDirection = 3

	// TextDirectionContentOrLtr indicates that the text direction depends on the first
	// strong directional character in the text according to the Unicode Bidirectional
	// Algorithm. If no strong directional character is present, then Left to Right will
	// be used as the default direction.
	TextDirectionContentOrLtr TextDirection = 4

	// TextDirectionContentOrRtl indicates that the text direction depends on the first
	// strong directional character in the text according to the Unicode Bidirectional
	// Algorithm. If no strong directional character is present, then Right to Left will
	// be used as the default direction.
	TextDirectionContentOrRtl TextDirection = 5
)

func ResolveTextDirection

func ResolveTextDirection(layoutDirection unit.LayoutDirection, textDirection TextDirection) TextDirection

ResolveTextDirection resolves the TextDirection, using the LayoutDirection if necessary. If the TextDirection is unspecified, it defaults to Ltr.

func TextDirectionValueOf

func TextDirectionValueOf(value int) (TextDirection, error)

TextDirectionValueOf creates a TextDirection from the given integer value. This can be useful if you need to serialize/deserialize TextDirection values. Returns an error if the given value is not recognized by the preset TextDirection values.

func TextDirectionValues

func TextDirectionValues() []TextDirection

TextDirectionValues returns a list containing all possible values of TextDirection. Note: Does not include TextDirectionUnspecified.

func (TextDirection) IsSpecified

func (t TextDirection) IsSpecified() bool

TextDirection returns true if this TextDirection is not TextDirectionUnspecified.

func (TextDirection) String

func (t TextDirection) String() string

String returns the string representation of the TextDirection.

func (TextDirection) TakeOrElse

func (t TextDirection) TakeOrElse(block TextDirection) TextDirection

TakeOrElse returns this TextDirection if IsSpecified() is true, otherwise executes the provided function and returns its result.

Jump to

Keyboard shortcuts

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