fontfamily

package
v0.0.0-...-5959671 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Thin    = "Thin"
	Light   = "Light"
	Regular = "Regular"
	Medium  = "Medium"
	Bold    = "Bold"
	Black   = "Black"
)
View Source
const (
	TrueTypeFontExt = ".ttf"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FontFamily

type FontFamily struct {
	Name string
	// contains filtered or unexported fields
}

func LoadFromDir

func LoadFromDir(dir string) (*FontFamily, error)

LoadFromDir loads files and return FontFamily object from the specified directory. The directory name is used as a family name, and all font files in it are identified as part of the same font family. Each filename must follows this `<name>-<style>.ttf`naming rule.

func NewFontFamily

func NewFontFamily(name string) *FontFamily

NewFontFamily initialize a FontFamily object and return it.

func (*FontFamily) LoadFont

func (fs *FontFamily) LoadFont(filename string, style Style) error

LoadFont loads TrueType font from a file.

func (*FontFamily) NewFace

func (fs *FontFamily) NewFace(style Style, size float64) (font.Face, error)

NewFace creates a new font face with size option.

type Style

type Style string

Jump to

Keyboard shortcuts

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