text

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package text implements text styling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment int

Alignment represents a text alignment.

const (
	AlignmentLeft Alignment = iota
	AlignmentRight
	AlignmentCenter
	AlignmentJustified
)

func (Alignment) MarshalProtobuf

func (a Alignment) MarshalProtobuf() pbtext.TextAlignment

type Font

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

StrikethroughStyle represents a text font.

func DefaultBoldFont added in v0.2.0

func DefaultBoldFont(size float64) *Font

func DefaultFont added in v0.2.0

func DefaultFont(size float64) *Font

func DefaultItalicFont added in v0.2.0

func DefaultItalicFont(size float64) *Font

func FontWithName added in v0.2.0

func FontWithName(name string, size float64) *Font

func (*Font) MarshalProtobuf

func (f *Font) MarshalProtobuf() *pbtext.Font

type StrikethroughStyle

type StrikethroughStyle int

StrikethroughStyle represents a text strikethrough style.

const (
	StrikethroughStyleNone StrikethroughStyle = iota
	StrikethroughStyleSingle
	StrikethroughStyleDouble
	StrikethroughStyleThick
	StrikethroughStyleDotted
	StrikethroughStyleDashed
)

func (StrikethroughStyle) MarshalProtobuf

func (a StrikethroughStyle) MarshalProtobuf() pbtext.StrikethroughStyle

type Style

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

Style holds a group of text formatting options.

func (*Style) Alignment

func (f *Style) Alignment() Alignment

func (*Style) ClearAlignment

func (f *Style) ClearAlignment()

func (*Style) ClearFont

func (f *Style) ClearFont()

func (*Style) ClearHyphenation

func (f *Style) ClearHyphenation()

func (*Style) ClearLineHeightMultiple

func (f *Style) ClearLineHeightMultiple()

func (*Style) ClearStrikethroughColor

func (f *Style) ClearStrikethroughColor()

func (*Style) ClearStrikethroughStyle

func (f *Style) ClearStrikethroughStyle()

func (*Style) ClearTextColor

func (f *Style) ClearTextColor()

func (*Style) ClearTruncation

func (f *Style) ClearTruncation()

func (*Style) ClearTruncationString

func (f *Style) ClearTruncationString()

func (*Style) ClearUnderlineColor

func (f *Style) ClearUnderlineColor()

func (*Style) ClearUnderlineStyle

func (f *Style) ClearUnderlineStyle()

func (*Style) ClearWrap

func (f *Style) ClearWrap()

func (*Style) Font

func (f *Style) Font() *Font

func (*Style) Hyphenation

func (f *Style) Hyphenation() float64

func (*Style) LineHeightMultiple

func (f *Style) LineHeightMultiple() float64

func (*Style) MarshalProtobuf

func (f *Style) MarshalProtobuf() *pbtext.TextStyle

func (*Style) SetAlignment

func (f *Style) SetAlignment(v Alignment)

func (*Style) SetFont

func (f *Style) SetFont(v *Font)

func (*Style) SetHyphenation

func (f *Style) SetHyphenation(v float64)

func (*Style) SetLineHeightMultiple

func (f *Style) SetLineHeightMultiple(v float64)

func (*Style) SetStrikethroughColor

func (f *Style) SetStrikethroughColor(v color.Color)

func (*Style) SetStrikethroughStyle

func (f *Style) SetStrikethroughStyle(v StrikethroughStyle)

func (*Style) SetTextColor

func (f *Style) SetTextColor(v color.Color)

func (*Style) SetTruncation

func (f *Style) SetTruncation(v Truncation)

func (*Style) SetTruncationString

func (f *Style) SetTruncationString(v string)

func (*Style) SetUnderlineColor

func (f *Style) SetUnderlineColor(v color.Color)

func (*Style) SetUnderlineStyle

func (f *Style) SetUnderlineStyle(v UnderlineStyle)

func (*Style) SetWrap

func (f *Style) SetWrap(v Wrap)

func (*Style) StrikethroughColor

func (f *Style) StrikethroughColor() color.Color

func (*Style) StrikethroughStyle

func (f *Style) StrikethroughStyle() StrikethroughStyle

func (*Style) TextColor

func (f *Style) TextColor() color.Color

func (*Style) Truncation

func (f *Style) Truncation() Truncation

func (*Style) TruncationString

func (f *Style) TruncationString() string

func (*Style) UnderlineColor

func (f *Style) UnderlineColor() color.Color

func (*Style) UnderlineStyle

func (f *Style) UnderlineStyle() UnderlineStyle

func (*Style) Update

func (f *Style) Update(u *Style)

Applies the styels from u to f.

func (*Style) Wrap

func (f *Style) Wrap() Wrap

type StyledText added in v0.2.0

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

func NewStyledText added in v0.2.0

func NewStyledText(str string, s *Style) *StyledText

func (*StyledText) At added in v0.2.0

func (st *StyledText) At(a int) *Style

returns null if a is outside of text range.

func (*StyledText) MarshalProtobuf added in v0.2.0

func (st *StyledText) MarshalProtobuf() *pbtext.StyledText

func (*StyledText) Set added in v0.2.0

func (st *StyledText) Set(s *Style, start, end int)

func (*StyledText) Size added in v0.2.0

func (st *StyledText) Size(min layout.Point, max layout.Point, maxLines int) layout.Point

func (*StyledText) Update added in v0.2.0

func (st *StyledText) Update(s *Style, start, end int)

type Text

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

func New

func New(b string) *Text

New is a convenience function that returns a new Text that contains string b.

func (*Text) MarshalProtobuf

func (t *Text) MarshalProtobuf() *pb.Text

func (*Text) Notify

func (t *Text) Notify(f func()) comm.Id

Notify implements comm.Notify.

func (*Text) SetString

func (t *Text) SetString(str string)

func (*Text) String

func (t *Text) String() string

func (*Text) UnmarshalProtobuf

func (t *Text) UnmarshalProtobuf(pbtext *pb.Text) error

func (*Text) Unnotify

func (t *Text) Unnotify(id comm.Id)

Unnotify implements comm.Notify.

func (*Text) Value

func (t *Text) Value() string

Value implements comm.StringNotifier

type Truncation

type Truncation int

Truncation represents how text is truncated to fit within the bounds.

const (
	TruncationNone Truncation = iota
	TruncationStart
	TruncationMiddle
	TruncationEnd
)

func (Truncation) MarshalProtobuf

func (a Truncation) MarshalProtobuf() pbtext.Truncation

type UnderlineStyle

type UnderlineStyle int

StrikethroughStyle represents a text underline style.

const (
	UnderlineStyleNone UnderlineStyle = iota
	UnderlineStyleSingle
	UnderlineStyleDouble
	UnderlineStyleThick
	UnderlineStyleDotted
	UnderlineStyleDashed
)

func (UnderlineStyle) MarshalProtobuf

func (a UnderlineStyle) MarshalProtobuf() pbtext.UnderlineStyle

type Wrap

type Wrap int

StrikethroughStyle represents how text is wrapped.

const (
	WrapNone Wrap = iota
	WrapWord
	WrapCharacter
)

func (Wrap) MarshalProtobuf

func (a Wrap) MarshalProtobuf() pbtext.TextWrap

Jump to

Keyboard shortcuts

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