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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBackgroundColor = graphics.ColorTransparent
View Source
var DefaultColor = graphics.ColorBlack
View Source
var DefaultFontFamily = font.FontFamilyDefault
View Source
var DefaultFontSize = unit.Sp(14)
View Source
var DefaultFontStyle = font.FontStyleNormal
View Source
var DefaultFontWeight = font.FontWeightNormal
View Source
var DefaultLetterSpacing = unit.Sp(0)
View Source
var DefaultLineBreak = style.LineBreakParagraph
View Source
var DefaultLineHeight = unit.TextUnitUnspecified // TODO: Should this stay unspecified ?
View Source
var DefaultShadow = graphics.ShadowNone
View Source
var DefaultTextAlign = style.TextAlignStart
View Source
var DefaultTextDecoration = style.TextDecorationNone

Functions

func EqualParagraphStyle

func EqualParagraphStyle(a, b *ParagraphStyle) bool

func EqualSpanStyle

func EqualSpanStyle(a, b *SpanStyle) bool

func EqualTextStyle

func EqualTextStyle(a, b *TextStyle) bool

func IsSpecifiedParagraphStyle

func IsSpecifiedParagraphStyle(s *ParagraphStyle) bool

func IsSpecifiedSpanStyle

func IsSpecifiedSpanStyle(s *SpanStyle) bool

func IsSpecifiedTextStyle

func IsSpecifiedTextStyle(s *TextStyle) bool

func SameParagraphStyle

func SameParagraphStyle(a, b *ParagraphStyle) bool

Identity (2 ns)

func SameSpanStyle

func SameSpanStyle(a, b *SpanStyle) bool

Identity (2 ns)

func SameTextStyle

func SameTextStyle(a, b *TextStyle) bool

Identity (2 ns)

func SemanticEqualParagraphStyle

func SemanticEqualParagraphStyle(a, b *ParagraphStyle) bool

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

func SemanticEqualSpanStyle

func SemanticEqualSpanStyle(a, b *SpanStyle) bool

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

func SemanticEqualTextStyle

func SemanticEqualTextStyle(a, b *TextStyle) bool

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

func StringParagraphStyle

func StringParagraphStyle(s *ParagraphStyle) string

func StringSpanStyle

func StringSpanStyle(s *SpanStyle) string

func StringTextStyle

func StringTextStyle(ts *TextStyle) string

func ToGioFont

func ToGioFont(ts *TextStyle) gioFont.Font

ToGioFont converts a TextStyle to a gio font.Font. This extracts the font family, weight, and style from the TextStyle and converts them to Gio's font representation.

Types

type ParaghStyleInterface

type ParaghStyleInterface interface {
	TextAlign() style.TextAlign
	TextDirection() style.TextDirection
	LineHeight() unit.TextUnit
	LineBreak() style.LineBreak
}

type ParagraphStyle

type ParagraphStyle struct {
	// contains filtered or unexported fields
}
var ParagraphStyleUnspecified *ParagraphStyle = &ParagraphStyle{
	textAlign:     style.TextAlignUnspecified,
	textDirection: style.TextDirectionUnspecified,
	lineHeight:    unit.TextUnitUnspecified,
	lineBreak:     style.LineBreakUnspecified,
}

func CoalesceParagraphStyle

func CoalesceParagraphStyle(ptr, def *ParagraphStyle) *ParagraphStyle

func CopyParagraphStyle

func CopyParagraphStyle(s *ParagraphStyle, options ...ParagraphStyleOption) *ParagraphStyle

func LerpParagraphStyle

func LerpParagraphStyle(width, start, stop *ParagraphStyle, fraction float32) *ParagraphStyle

func MergeParagraphStyle

func MergeParagraphStyle(a, b *ParagraphStyle) *ParagraphStyle

func ParagraphStyleResolveDefaults

func ParagraphStyleResolveDefaults(s *ParagraphStyle, direction unit.LayoutDirection) *ParagraphStyle

func TakeOrElseParagraphStyle

func TakeOrElseParagraphStyle(s, def *ParagraphStyle) *ParagraphStyle

func (ParagraphStyle) LineBreak

func (ps ParagraphStyle) LineBreak() style.LineBreak

func (ParagraphStyle) LineHeight

func (ps ParagraphStyle) LineHeight() unit.TextUnit

func (ParagraphStyle) TextAlign

func (ps ParagraphStyle) TextAlign() style.TextAlign

func (ParagraphStyle) TextDirection

func (ps ParagraphStyle) TextDirection() style.TextDirection

type ParagraphStyleOption

type ParagraphStyleOption func(*ParagraphStyle)

type SpanStyle

type SpanStyle struct {
	// contains filtered or unexported fields
}
var SpanStyleUnspecified *SpanStyle = &SpanStyle{
	color:          graphics.ColorUnspecified,
	fontSize:       unit.TextUnitUnspecified,
	fontWeight:     font.FontWeightUnspecified,
	fontStyle:      font.FontStyleUnspecified,
	fontFamily:     nil,
	letterSpacing:  unit.TextUnitUnspecified,
	background:     graphics.ColorUnspecified,
	textDecoration: nil,
	shadow:         nil,
}

func CoalesceSpanStyle

func CoalesceSpanStyle(ptr, def *SpanStyle) *SpanStyle

func CopySpanStyle

func CopySpanStyle(s *SpanStyle, options ...SpanStyleOption) *SpanStyle

func LerpSpanStyle

func LerpSpanStyle(width, start, stop *SpanStyle, fraction float32) *SpanStyle

func MergeSpanStyle

func MergeSpanStyle(a, b *SpanStyle) *SpanStyle

func SpanStyleResolveDefaults

func SpanStyleResolveDefaults(s *SpanStyle) *SpanStyle

func TakeOrElseSpanStyle

func TakeOrElseSpanStyle(s, def *SpanStyle) *SpanStyle

func (SpanStyle) Background

func (s SpanStyle) Background() graphics.Color

func (SpanStyle) Color

func (s SpanStyle) Color() graphics.Color

func (SpanStyle) FontFamily

func (s SpanStyle) FontFamily() font.FontFamily

func (SpanStyle) FontSize

func (s SpanStyle) FontSize() unit.TextUnit

func (SpanStyle) FontStyle

func (s SpanStyle) FontStyle() font.FontStyle

func (SpanStyle) FontWeight

func (s SpanStyle) FontWeight() font.FontWeight

func (SpanStyle) LetterSpacing

func (s SpanStyle) LetterSpacing() unit.TextUnit

func (SpanStyle) Shadow

func (s SpanStyle) Shadow() *graphics.Shadow

func (SpanStyle) TextDecoration

func (s SpanStyle) TextDecoration() *style.TextDecoration

type SpanStyleInterface

type SpanStyleInterface interface {
	Color() graphics.Color
	FontSize() unit.TextUnit
	FontWeight() font.FontWeight
	FontStyle() font.FontStyle
	FontFamily() font.FontFamily
	LetterSpacing() unit.TextUnit
	Background() graphics.Color
	TextDecoration() *style.TextDecoration
	Shadow() *graphics.Shadow
}

type SpanStyleOption

type SpanStyleOption func(*SpanStyle)

type TextShaper

type TextShaper struct {
	Shaper *text.Shaper
}

type TextStyle

type TextStyle struct {
	// contains filtered or unexported fields
}
var TextStyleUnspecified *TextStyle = &TextStyle{
	spanStyle:      SpanStyleUnspecified,
	paragraphStyle: ParagraphStyleUnspecified,
}

func CoalesceTextStyle

func CoalesceTextStyle(ptr, def *TextStyle) *TextStyle

func CopyTextStyle

func CopyTextStyle(ts *TextStyle, options ...TextStyleOption) *TextStyle

func MergeTextStyle

func MergeTextStyle(a, b *TextStyle) *TextStyle

func TakeOrElseTextStyle

func TakeOrElseTextStyle(s, def *TextStyle) *TextStyle

func TextStyleFromGioFont

func TextStyleFromGioFont(gf gioFont.Font) *TextStyle

TextStyleFromGioFont converts a gio font.Font to a TextStyle. This is useful for integrating with Gio's font system.

func TextStyleFromOptions

func TextStyleFromOptions(options ...TextStyleOption) *TextStyle

func TextStyleResolveDefaults

func TextStyleResolveDefaults(ts *TextStyle, direction unit.LayoutDirection) *TextStyle

func (TextStyle) Alpha

func (ts TextStyle) Alpha() float32

func (TextStyle) Background

func (ts TextStyle) Background() graphics.Color

func (TextStyle) Color

func (ts TextStyle) Color() graphics.Color

func (TextStyle) FontFamily

func (ts TextStyle) FontFamily() font.FontFamily

func (TextStyle) FontSize

func (ts TextStyle) FontSize() unit.TextUnit

func (TextStyle) FontStyle

func (ts TextStyle) FontStyle() font.FontStyle

func (TextStyle) FontWeight

func (ts TextStyle) FontWeight() font.FontWeight

func (TextStyle) LetterSpacing

func (ts TextStyle) LetterSpacing() unit.TextUnit

func (TextStyle) LineBreak

func (ts TextStyle) LineBreak() style.LineBreak

func (TextStyle) LineHeight

func (ts TextStyle) LineHeight() unit.TextUnit

func (TextStyle) TextAlign

func (ts TextStyle) TextAlign() style.TextAlign

func (TextStyle) TextDecoration

func (ts TextStyle) TextDecoration() *style.TextDecoration

func (TextStyle) TextDirection

func (ts TextStyle) TextDirection() style.TextDirection

type TextStyleInterface

type TextStyleInterface interface {
	Alpha() float32
	Background() graphics.Color
	Color() graphics.Color
	FontFamily() font.FontFamily
	FontSize() unit.TextUnit
	FontStyle() font.FontStyle
	FontWeight() font.FontWeight
	LetterSpacing() unit.TextUnit
	LineBreak() style.LineBreak
	LineHeight() unit.TextUnit
	TextAlign() style.TextAlign
	TextDecoration() *style.TextDecoration
	TextDirection() style.TextDirection
}

type TextStyleOption

type TextStyleOption func(ts *TextStyle)

func WithBackground

func WithBackground(color graphics.Color) TextStyleOption

func WithColor

func WithColor(color graphics.Color) TextStyleOption

func WithFontFamily

func WithFontFamily(family font.FontFamily) TextStyleOption

func WithFontSize

func WithFontSize(size unit.TextUnit) TextStyleOption

func WithFontStyle

func WithFontStyle(style font.FontStyle) TextStyleOption

func WithFontWeight

func WithFontWeight(weight font.FontWeight) TextStyleOption

func WithLetterSpacing

func WithLetterSpacing(spacing unit.TextUnit) TextStyleOption

func WithLineBreak

func WithLineBreak(lineBreak style.LineBreak) TextStyleOption

func WithLineHeight

func WithLineHeight(lineHeight unit.TextUnit) TextStyleOption

func WithShadow

func WithShadow(shadow *graphics.Shadow) TextStyleOption

func WithTextAlign

func WithTextAlign(textAlign style.TextAlign) TextStyleOption

func WithTextDecoration

func WithTextDecoration(decoration *style.TextDecoration) TextStyleOption

func WithTextDirection

func WithTextDirection(textDirection style.TextDirection) TextStyleOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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