fontsource

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0, MIT Imports: 3 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 fontsource loads caller-supplied font files from an io/fs filesystem.

It performs no system font discovery, environment lookup, or network access. Use it with os.DirFS, embed.FS, testing/fstest, or another host-owned fs.FS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadMath

func LoadMath(fsys fs.FS, path string, opts ...font.FontOption) (*font.FontSet, error)

LoadMath loads one math face from fsys.

func LoadSet

func LoadSet(fsys fs.FS, config Config) (*font.FontSet, error)

LoadSet loads a complete math, text, and fallback configuration.

func ReadFace

func ReadFace(fsys fs.FS, path string, opts ...font.FontOption) (font.FontFace, error)

ReadFace reads one face file without parsing or copying its bytes beyond the filesystem read. LoadMath or LoadSet performs validation and ownership copies.

Types

type Config

type Config struct {
	Math      Face
	Text      *Face
	Fallbacks []Face
}

Config identifies the files that make up a font set.

type Face

type Face struct {
	Path  string
	ID    string
	Index int
}

Face identifies one font file and, optionally, a face inside a TTC.

ID is optional. The font loader derives a stable ID when it is blank.

Jump to

Keyboard shortcuts

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