font

package
v0.0.0-...-e27deff Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitmap

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

A Bitmap is a representation of a font. In practice, fonts are PNG images which are a set of rendered characters, or glyphs. This also means that fonts are essentially bitmapped, and they can only scale in accordance to the aspect ratio of the display.

func NewBitmap

func NewBitmap(fn Name) (*Bitmap, error)

NewBitmap returns a new font type, from which you can render text on the screen. The possible fonts for this function are defined as consts.

func (*Bitmap) NewGlyph

func (b *Bitmap) NewGlyph(ch rune) (*Glyph, error)

Glyph returns an image which is a subset of the total font graphic that contains only the text that is indicated by the given rune.

type Glyph

type Glyph struct {
	Image image.Image
}

func (*Glyph) Draw

func (g *Glyph) Draw(coord image.Point)

type Name

type Name int

A Name is simply a const that represents the font. Exactly where and how fonts are stored in the system is an abstraction that is not exported from the font package.

const (
	// A2System is the "system font" for the Apple II. Although it was
	// posible to have a narrow-width font, it turns out that the source
	// font has exactly the same dimensions in both cases; the only
	// difference is that twice as many pixels are rendered within the
	// same physical space.
	A2System Name = iota

	// A2Inverted is essentially the same as the system font, except
	// that all of the pixels are inverted white-to-black. The rendered
	// effect is that each glyph would be shown as a silhouette on a
	// white background.
	A2Inverted
)

Jump to

Keyboard shortcuts

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