Exemplo n.º 1
0
func makeFont(t testing.TB, ttf string) *truetype.Font {
	// TODO we should probably bundle fonts in testdata
	font, err := truetype.Open(ttf)
	if err != nil {
		t.Fatalf("cannot load font: %v", err)
	}
	return font
}
Exemplo n.º 2
0
Arquivo: clock.go Projeto: tv42/quobar
// New returns a new instance of the plugin.
func (Clock) New(state *quobar.State) (quobar.Drawer, error) {
	font, err := truetype.Open(state.Config.FontPath)
	if err != nil {
		return nil, err
	}
	p := &clock{
		state: state,
		font:  font,
	}
	return p, nil
}