Exemplo n.º 1
0
func Example() {
	fontPath := "./fonts"

	fc := fontcache.New()
	fc.Init(fontPath)

	// Retrieve font by name for use in a program.
	font, err := fc.Get("Luxi Sans", "Regular")
	if err != nil {
		log.Fatalf("%s", err)
	}

	func(f *truetype.Font) {
		fmt.Printf("Do something with %s", f.Name(truetype.NameIDFontFamily))
	}(font)
	// Output: Do something with Luxi Sans
}
Exemplo n.º 2
0
func init() {
	fc = fontcache.New()
	fc.Init("./fonts/")
}