This project exposes free ggfnt fonts for use with Golang programs, most commonly Ebitengine games that use the ptxt font rendering library.
github.com/tinne26/ggfnt-fonts/tinny
github.com/tinne26/ggfnt-fonts/tinnybold
github.com/tinne26/ggfnt-fonts/graybit
github.com/tinne26/ggfnt-fonts/omen
github.com/tinne26/ggfnt-fonts/candy
github.com/tinne26/ggfnt-fonts/strut
github.com/tinne26/ggfnt-fonts/starship
github.com/tinne26/ggfnt-fonts/flick
github.com/tinne26/ggfnt-fonts/minitile
Most fonts in this project are licensed under CC BY-SA 4.0, though some might be adaptations of well known fonts designed in other formats and with their own licenses. See each font subfolder for additional details.
The Golang code used to provide access to the fonts is extremely trivial and MIT licensed. The code for building fonts is not licensed, as it contains representations of the font glyphs themselves (but feel free to use the structure and basic methods as reference).
All subpackages expose at least two methods:
Font()
, which parses the font if it wasn't parsed yet, caches it and returns it as a*ggfnt.Font
.Release()
, which frees the cached font if it was loaded at any point byFont()
.
Some subpackages contain additional constants for font settings, specific glyphs and code point mappings. The most common is probably NotdefRune
(rune
) and Notdef
(ggfnt.GlyphIndex
). Glyph pickers might also be provided for some fancy fonts in order to make life easier when working with ptxt.
Example program:
package main
import "fmt"
import "github.com/tinne26/ggfnt-fonts/graybit"
func main() {
font := graybit.Font()
verMajor, verMinor := font.Header().VersionMajor(), font.Header().VersionMinor()
fmt.Printf("Font: %s (v%d.%02d)\n", font.Header().Name(), verMajor, verMinor)
fmt.Printf("Num. glyphs: %d\n", font.Glyphs().Count())
fmt.Printf("Author: %s\n", font.Header().Author())
fmt.Printf("About:\n> %s\n", font.Header().About())
}
The names of the subpackages and their paths match what you can find in this repository.
I actually made some of the pangrams for the examples on my own, here they are:
- Twin axes ablaze, the grumpy viking reconquered the fjord.
- The zombie geeks acquired explosive jellyfish now!?
- Saxophonists frequently acknowledge my jazzy vibes.
- Catalyzer hijack verified, equip low oxygen bombs.
- Objectively speaking, frozen marshmallows are darn exquisite.
- Hendrix's jam —if unequivocably squawky— was hypnotizing.
- Josephine, buddy, the squeezy wolfkin are exclusively mine!
They are a tad long, but at least some of them have nice and understandable stories. A few more variations:
- Wanted zombie geeks aquire explosive jellyfish. (shorter but less funny imo)
- Saxophonists disqualify overembellished spacewalking jazz. (only five words, but convoluted)
- Hendrix's jam was hypnotizing, unequivocably funky.
Sadly, I don't know the authors of "amazingly few discotheques provide jukeboxes", "sphinx of black quartz, judge my vow" and other cool pangrams; I'd love to give them credit otherwise!