etext

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AlignLeft = iota
	AlignCenter
	AlignRight
)
View Source
const (
	DefaultFontSize = 12
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment int

type Font

type Font interface {
	WithSize(size int) Font

	BoundString(text string) (bound egeom.Rectangle, advance int)

	// Size returns vertical font size in pixel.
	Size() int

	Face() font.Face
}

func MustNewTrueTypeParse

func MustNewTrueTypeParse(fontData []byte) Font

func NewTrueType

func NewTrueType(f *truetype.Font) Font

func NewTrueTypeParse

func NewTrueTypeParse(fontData []byte) (f Font, oc eoutcome.ParseOutcome)

type Style

type Style interface {
	WithLineHeight(h float64) Style
	WithAlignment(a Alignment) Style
	WithFont(f Font) Style
	WithColor(c ecolor.Color) Style

	// Alignment is for specify text alignment
	Alignment() Alignment

	// LineHeight is a multiplier for font height. If you set 2.0 that means one empty line between the lines.
	LineHeight() float64

	// Font returns font setting for this style
	Font() Font

	// Color returns color setting for this style
	Color() ecolor.Color

	Layout(text string, start egeom.Point, f func(s string, p egeom.Point)) (bound egeom.Rectangle)

	Bound(text string) (bound egeom.Rectangle)
}

func NewStyle

func NewStyle(f Font, c ecolor.Color) Style

Jump to

Keyboard shortcuts

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