Skip to content

k1LoW/ffff

Repository files navigation

ffff Build Status Go Reference

finder for font files

Usage

package main

import (
	"fmt"

	"github.com/beta/freetype/truetype"
	"github.com/k1LoW/ffff"
	"golang.org/x/image/font"
	"golang.org/x/image/font/opentype"
)

func main() {
	fontSize := 12.0
	dpi := 72.0
	to := &truetype.Options{
		Size:              fontSize,
		DPI:               dpi,
		Hinting:           font.HintingNone,
		GlyphCacheEntries: 0,
		SubPixelsX:        0,
		SubPixelsY:        0,
	}
	oo := &opentype.FaceOptions{
		Size:    fontSize,
		DPI:     dpi,
		Hinting: font.HintingNone,
	}

	face, err := ffff.FuzzyFindFace("Arial", to, oo)
	if err != nil {
		panic(err)
	}
	fmt.Printf("%v", face)
}