bdf

package
v0.0.0-...-3832ca7 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: 0BSD Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Font

type Font struct {
	Name    string
	Ascent  int // needn't be present in the font
	Descent int // needn't be present in the font
	// contains filtered or unexported fields
}

Font represents a particular bitmap font.

func NewFromBDF

func NewFromBDF(r io.Reader) (f *Font, err error)

func (*Font) BoundString

func (f *Font) BoundString(s string) (image.Rectangle, int)

BoundString measures the text's bounds when drawn along the X axis for the baseline. Also returns the total advance.

func (*Font) DrawString

func (f *Font) DrawString(dst draw.Image, dp image.Point,
	color color.Color, s string)

DrawString draws the specified text string onto dst horizontally along the baseline starting at dp, using black color.

func (*Font) FindGlyph

func (f *Font) FindGlyph(r rune) (glyph, bool)

FindGlyph returns the best glyph to use for the given rune. The returned boolean indicates whether a fallback has been used.

Jump to

Keyboard shortcuts

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