fontrepository

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fontrepository implements font repository.

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotReadFile = errors.New("cannot read file")

ErrCannotReadFile is returned when a custom font file cannot be read.

Functions

This section is empty.

Types

type FontRepository

type FontRepository struct {
	// contains filtered or unexported fields
}

FontRepository manages custom fonts to be loaded into a document.

func (*FontRepository) AddUTF8Font

func (r *FontRepository) AddUTF8Font(family string, style fontstyle.Type, file string) Repository

AddUTF8Font adds a custom font to the repository.

func (*FontRepository) AddUTF8FontFromBytes

func (r *FontRepository) AddUTF8FontFromBytes(family string, style fontstyle.Type, bytes []byte) Repository

AddUTF8FontFromBytes adds a custom font to the repository from a byte slice.

func (*FontRepository) Load

func (r *FontRepository) Load() ([]entity.CustomFont, error)

Load loads all custom fonts, reading file contents from disk where needed.

type Repository

type Repository interface {
	AddUTF8Font(family string, style fontstyle.Type, file string) Repository
	AddUTF8FontFromBytes(family string, style fontstyle.Type, bytes []byte) Repository
	Load() ([]entity.CustomFont, error)
}

Repository is the abstraction to load custom fonts.

func New

func New() Repository

New creates a new Repository.

Jump to

Keyboard shortcuts

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