Skip to content

PinwheelSystem/bitmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

✍ Bitmap font loader library for Go.

This library loads font data from an image ("bitmap").
It gets loaded into a Go map which means a Glyph can be retrieved with font[glyph], for example font["A"].

Example

bm := bitmap.New() font := bm.Load("font.png") x := 0 y := 0 xx := x yy := y ch := font[glyph] for i := 0; i < ch.Height; i++ { bin := ch.Data[i] // Gets a line: a glyph is 8x8 binarr := strings.Split(bin, "") for _, pix := range binarr { if pix == "1" { draw(xx, yy) } xx += 1	} yy += 1 xx = x }

Used by

This library is used in Pinwheel for its pixel font.

If you also use this for reason, you can make a PR to add your use here.

License

BSD 3-Clause

About

✍ Bitmap font loader library for Go.

Topics

Resources

License

Stars

Watchers

Forks

Languages