ggtext

package
v0.0.0-...-5d2067b Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT, MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ggtext draws text on images. It is a modified copy of a portion of github.com/fogleman/gg by Michael Fogleman. See LICENSE.md for the original copyright notice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drawer

type Drawer struct {
	Face  font.Face
	Color color.Color
}

Drawer is a font drawer

func (*Drawer) Draw

func (td *Drawer) Draw(img draw.Image, s string, x, y float64)

Draw draws the specified text at the specified point.

func (*Drawer) DrawAnchored

func (td *Drawer) DrawAnchored(img draw.Image, s string, x, y, ax, ay float64)

DrawAnchored draws the specified text at the specified anchor point. The anchor point is x - w * ax, y - h * ay, where w, h is the size of the text. Use ax=0.5, ay=0.5 to center the text at the specified point.

func (*Drawer) Measure

func (td *Drawer) Measure(s string) (w, h float64)

Measure returns the rendered width and height of the specified text given the current font face.

Jump to

Keyboard shortcuts

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