ffff

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 12 Imported by: 1

README

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
	dpi := 72
	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)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuzzyFindFace

func FuzzyFindFace(keyword string, to *truetype.Options, oo *opentype.FaceOptions) (font.Face, error)

FuzzyFindFace find font.Face by keyword

func FuzzyFindPath

func FuzzyFindPath(keyword string) (string, error)

FuzzyFindPath find font file path by keyword

Types

type Font

type Font struct {
	Path string
	Face font.Face
}

func FuzzyFind

func FuzzyFind(keyword string, to *truetype.Options, oo *opentype.FaceOptions) (Font, error)

FuzzyFind find font by keyword

Jump to

Keyboard shortcuts

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