fonts

package
v2.2.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindFonts

func FindFonts(fontsPath string, config adrianConfig.Config)

FindFonts loads all the fonts in a directory

func FontFaceCSS

func FontFaceCSS(font FontData, fontWeights []int, display string) string

FontFaceCSS generates the CSS for a font

func GetCanonicalExtension

func GetCanonicalExtension(filePath string) string

GetCanonicalExtension is

func InstantiateWatcher

func InstantiateWatcher(path string, config adrianConfig.Config)

InstantiateWatcher is a thing

func LoadFont

func LoadFont(filePath string, config adrianConfig.Config)

LoadFont loads a font into memory

Types

type FontData

type FontData struct {
	Family   string
	Metadata map[sfnt.NameID]string
	Variants map[string]FontVariant
}

FontData describes a font file and the various metadata associated with it.

func GetFont

func GetFont(name string) (fontData FontData, err error)

GetFont returns the data for a single font by its name

type FontFileData

type FontFileData struct {
	Name      string
	Path      string
	FileName  string
	Extension string
	CSSFormat string
	MD5       string
}

FontFileData describes a font (format) belonging to a font family

type FontVariant

type FontVariant struct {
	Name         string
	SubFamily    string
	UniqueID     string
	CSSFontStyle string
	CSSWeight    int
	Files        map[string]FontFileData
}

FontVariant describes a variant (ex: "Black", "Italic") of a font

func GetFontVariantByUniqueID

func GetFontVariantByUniqueID(uniqueID string) (fontVariant *FontVariant, err error)

GetFontVariantByUniqueID returns the data for a single font by its unique ID

Jump to

Keyboard shortcuts

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