fonts

package
v0.0.0-...-16767da Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFonts

func LoadFonts(dir string) (map[string]*Font, error)

Types

type Font

type Font struct {
	Name string
	// Contains the sprite data for the font
	ObjectFile string

	// Maps ASCII bytes to a sprite offset in the ObjectFile
	Ranges  []Range
	Mapping map[rune]int
}

func LoadFont

func LoadFont(filename string) (*Font, error)

func (*Font) Entries

func (f *Font) Entries() int

func (*Font) Indices

func (f *Font) Indices(s string) ([]int, error)

Returns the offsets required to display a given string, returning an error if some of the runes in the string are unknown to the font

type Point

type Point struct {
	Rune   rune
	Sprite int
}

type Range

type Range struct {
	Min Point
	Max Point
}

Jump to

Keyboard shortcuts

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