fontmanager

package
v0.0.0-...-90f0e2a Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STANDARD_NORMAL      = "standard_normal"
	STANDARD_ITALIC      = "standard_italic"
	STANDARD_BOLD        = "standard_bold"
	STANDARD_BOLD_ITALIC = "standard_bold_italic"

	MONO_NORMAL      = "mono_normal"
	MONO_ITALIC      = "mono_italic"
	MONO_BOLD        = "mono_bold"
	MONO_BOLD_ITALIC = "mono_bold_italic"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FontManager

type FontManager struct {
	FS fs.FS
	// contains filtered or unexported fields
}

func Create

func Create() *FontManager

func CreateWithFS

func CreateWithFS(filesystem fs.FS) *FontManager

func (*FontManager) Clear

func (fm *FontManager) Clear()

This function will remove all font data and the font cache in this Manager.

func (*FontManager) GetFace

func (fm *FontManager) GetFace(name string, size float64) (text.Face, error)

This function returns a font face for the loaded font with 'name'. It will cache this face for future use.

func (*FontManager) LoadFont

func (fm *FontManager) LoadFont(name string, path string) error

This function loads a font at the provided filesystem path.

func (*FontManager) LoadFontData

func (fm *FontManager) LoadFontData(name string, fontData []byte) error

This function loads a font from the provided byte array

func (*FontManager) LoadMonoFonts

func (fm *FontManager) LoadMonoFonts() error

This function loads the mono gofonts into the manager

It loads the mono, monoitalic, monobold, and monobolditalic fonts

see https://pkg.go.dev/golang.org/x/image/font/gofont

func (*FontManager) LoadStandardFonts

func (fm *FontManager) LoadStandardFonts() error

This function loads the standard san-serif gofonts into the manager

It loads the regular, italic, bold, and bolditalic fonts

see https://pkg.go.dev/golang.org/x/image/font/gofont

func (*FontManager) PurgeCache

func (fm *FontManager) PurgeCache()

This function will clear the font cache

func (*FontManager) Remove

func (fm *FontManager) Remove(key string)

This function will remove the specified font data

Jump to

Keyboard shortcuts

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