Documentation
¶
Overview ¶
Package fonts holds giokit's curated font sets, bundled so text renders the same on every machine. Each set is a UI face plus a code face.
th.UseFonts(fonts.Inter())
The font files are embedded in the binary. A program that calls only specific set constructors links only those sets' files; ByName refers to every set, so calling it links them all. Each family is parsed once, on first use (a parsed family costs a few MB of heap, several times its file size), and the parsed faces are shared by every set that includes it. A picker lists Names and loads only the set the user chooses.
All fonts are under the SIL Open Font License 1.1 (OFL.txt beside each).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoSystemFont = errors.New("fonts: no installed font covers the script")
ErrNoSystemFont is returned when no installed font covers the runes.
Functions ¶
func Atkinson ¶
Atkinson is Atkinson Hyperlegible, designed for low-vision readers (distinct letterforms, regular and bold only), with JetBrains Mono.
func ByName ¶
ByName returns the set called name, as stored in Theme.Fonts and tokens. It loads only the families of that set.
func Names ¶
func Names() []string
Names lists every set's name, Go first, for a picker. It loads nothing; pass the chosen name to ByName.
func SystemCJK ¶
SystemCJK finds an installed font covering Chinese, Japanese and Korean and returns its regular face. It runs once per process; later calls return the same faces. The first run on a machine indexes the system fonts (seconds; the index is cached in the user cache directory), so call it off the UI goroutine.
func SystemFallback ¶
SystemFallback finds the installed font that covers every rune of sample and returns its regular face. prefer lists family names, best first, matched without case or spaces; among fonts that match none, a sans-serif regular face wins. The returned face is renamed so it can never be chosen by typeface name, only to fill in runes.
Types ¶
This section is empty.