anton

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: BSD-3-Clause Imports: 0 Imported by: 0

README

anton

GitHub release GoDoc License

anton provides the anton fonts as importable Go packages.

The fonts are released under the SIL Open Font license. The Go packages under the BSD-3 license.

Example

import (
	"fmt"
	"log"

	"github.com/go-fonts/anton/antonregular"
	"golang.org/x/image/font/sfnt"
)

func Example() {
	ttf, err := sfnt.Parse(antonregular.TTF)
	if err != nil {
		log.Fatalf("could not parse anton font: %+v", err)
	}

	var buf sfnt.Buffer
	v, err := ttf.Name(&buf, sfnt.NameIDVersion)
	if err != nil {
		log.Fatalf("could not retrieve font version: %+v", err)
	}

	fmt.Printf("version:    %s\n", v)
	fmt.Printf("num glyphs: %d\n", ttf.NumGlyphs())

	// Output:
	// version:    Version 2.116; ttfautohint (v1.8.3)
	// num glyphs: 1373
}

Documentation

Overview

Package anton holds TTF data of the Anton fonts.

Example
package main

import (
	"fmt"
	"log"

	"github.com/go-fonts/anton/antonregular"
	"golang.org/x/image/font/sfnt"
)

func main() {
	ttf, err := sfnt.Parse(antonregular.TTF)
	if err != nil {
		log.Fatalf("could not parse anton font: %+v", err)
	}

	var buf sfnt.Buffer
	v, err := ttf.Name(&buf, sfnt.NameIDVersion)
	if err != nil {
		log.Fatalf("could not retrieve font version: %+v", err)
	}

	fmt.Printf("version:    %s\n", v)
	fmt.Printf("num glyphs: %d\n", ttf.NumGlyphs())

}
Output:

version:    Version 2.116; ttfautohint (v1.8.3)
num glyphs: 1373

Directories

Path Synopsis
Package antonregular provides the "Anton Regular" TrueType font from the Anton font family.
Package antonregular provides the "Anton Regular" TrueType font from the Anton font family.

Jump to

Keyboard shortcuts

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