font

package
v0.0.0-...-821d67c Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package font implements a basic type for the font face of ASCII characters. Only 3 font sizes are currently supported. Glyphs are described as simple bitmaps in rectangular palettes of uniform area.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Font

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

Font represents a collection of characters or symbols that constitute an ASCII-only font face.

func New

func New(size Size, fore, back color.RGBA) (*Font, error)

New returns a new Font with given size and color scheme.

func (*Font) Bitmap

func (f *Font) Bitmap(char rune) []uint16

Bitmap constructs a bitmap (uint16 slice) describing the given char using the reciever f's font size, foreground color, and background color. Each of the uint16 elements are RGB565-formatted pixel colors with native byte ordering.

func (*Font) Height

func (f *Font) Height() int16

Height returns the height (in pixels) of each glyph in the receiver f.

func (*Font) Width

func (f *Font) Width() int16

Width returns the width (in pixels) of each glyph in the receiver f.

type Glyph

type Glyph []uint16

Glyph represents an individual character or symbol of a Font.

type Size

type Size byte

Size stores an arbitrary enumerated value of the 3 supported Font sizes.

const (
	Small Size = iota
	Medium
	Large
	// enum indices
	NumSize
	MinSize Size = Small
	MaxSize Size = Large
)

Constants defining the enumerated value of the 3 supported Font sizes.

The _values_ assigned to each identifier declared here have no relation to the actual width or height of their respective Font, and are subject to change in the future.

Jump to

Keyboard shortcuts

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