txtplacer

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Placer

type Placer struct {
	Face   font.Face
	Drawer font.Drawer
	Dst    draw.Image
	Size   float64
}

func NewPlacer

func NewPlacer(dst draw.Image, fontPath string, size float64) (Placer, error)

func (*Placer) Bounds

func (p *Placer) Bounds(text string, wrapwidth int) (width int, height int)

Returns the size the string will take up on the image. Font may be drawn outside of the box depending on the font.

func (*Placer) CenterAt

func (p *Placer) CenterAt(pt image.Point, text string, wrapwidth int, align string)

Write string where pt will be in the center after drawn to image.

func (*Placer) SetColor

func (p *Placer) SetColor(c color.Color)

Sets text to be a new color otherwise defaults to image.Black.

func (*Placer) SetFont

func (p *Placer) SetFont(fontPath string) error

func (*Placer) WriteAt

func (p *Placer) WriteAt(pt image.Point, text string, wrapwidth int, align string)

Writes string starting from pt. If there are multiple lines text will be aligned within the boundary.

func (*Placer) WriteAtCenter

func (p *Placer) WriteAtCenter(text string, wrapwidth int, align string)

Jump to

Keyboard shortcuts

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