Documentation
¶
Overview ¶
Package fonts bundles several legible, permissively-licensed TrueType fonts as embedded []byte payloads, ready to feed into github.com/go-opentype/opentype without sourcing a font file yourself.
Six families are included: Atkinson Hyperlegible, Inter, Go, Lora, Go Mono and JetBrains Mono. Call All to enumerate them, an accessor such as AtkinsonHyperlegible or Inter to fetch one directly, ByName to look one up by name, or MostLegible for the family the Braille Institute designed specifically for maximum legibility (including for low-vision readers). Parse is a thin convenience wrapper around opentype.Parse.
Inter, Lora and JetBrains Mono are variable fonts upstream; the bundled .ttf files are pinned at each family's default master (static instance). go-opentype has no variable-font support, so it always renders that default instance — OpenType Variations axes are not applied.
The Go code in this repository is BSD-3-Clause (see LICENSE). Each bundled font keeps its own upstream license — see the "Bundled fonts" table in README.md and the full texts under licenses/.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtkinsonHyperlegible ¶
func AtkinsonHyperlegible() []byte
AtkinsonHyperlegible returns the raw TrueType bytes of Atkinson Hyperlegible Regular, designed by the Braille Institute for maximum legibility, including for low-vision readers. Licensed OFL-1.1.
func ByName ¶
ByName looks up a bundled family by its Family.Name, case-insensitively. ok is false when no family matches.
func GoMono ¶
func GoMono() []byte
GoMono returns the raw TrueType bytes of Go Mono, the Go project's monospace companion to Go Regular. Licensed BSD-3-Clause.
func GoRegular ¶
func GoRegular() []byte
GoRegular returns the raw TrueType bytes of Go Regular, the Go project's screen sans-serif designed by Bigelow & Holmes. Licensed BSD-3-Clause.
func Inter ¶
func Inter() []byte
Inter returns the raw TrueType bytes of Inter Regular, a UI sans-serif designed for computer screens. Licensed OFL-1.1.
Inter is a variable font upstream; the bundled file is pinned at its default master (static instance). go-opentype renders that default instance only — variation axes are not applied.
func JetBrainsMono ¶
func JetBrainsMono() []byte
JetBrainsMono returns the raw TrueType bytes of JetBrains Mono Regular, a monospace face designed for code. Licensed OFL-1.1.
JetBrains Mono is a variable font upstream; the bundled file is pinned at its default master (static instance). go-opentype renders that default instance only — variation axes are not applied.
func Lora ¶
func Lora() []byte
Lora returns the raw TrueType bytes of Lora Regular, a contemporary serif with roots in calligraphy. Licensed OFL-1.1.
Lora is a variable font upstream; the bundled file is pinned at its default master (static instance). go-opentype renders that default instance only — variation axes are not applied.
func MostLegible ¶
func MostLegible() []byte
MostLegible returns Atkinson Hyperlegible, the bundled font with the strongest legibility credentials: it was designed by the Braille Institute specifically to maximize character distinction for readers with low vision, and it benefits every reader in the process. Prefer it whenever legibility, not brand voice, is the deciding factor.
Types ¶
type Family ¶
type Family struct {
Name string // display name, e.g. "Atkinson Hyperlegible"
Kind Kind
License string // SPDX identifier: "OFL-1.1" or "BSD-3-Clause"
TTF []byte // raw .ttf file contents, ready for opentype.Parse
}
Family describes one bundled font: its display name, general style, the SPDX identifier of the license it ships under, and its raw TrueType bytes.