Documentation
¶
Overview ¶
Package fonts detects installed Nerd Fonts and installs the official NerdFontsSymbolsOnly fallback font (plus Linux fontconfig fallback rules) on Linux, macOS, and Windows.
Index ¶
Constants ¶
const SymbolsFontArchiveURL = "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/NerdFontsSymbolsOnly.zip"
SymbolsFontArchiveURL is the official Nerd Fonts Symbols-Only release archive. Installing it adds Nerd Font glyphs as a system fallback without changing the user's primary font.
Variables ¶
This section is empty.
Functions ¶
func HasNerdFont ¶
func HasNerdFont() bool
HasNerdFont reports whether the current terminal environment is ready to render Nerd Font glyphs out of the box.
func IsSymbolsFontInstalled ¶
func IsSymbolsFontInstalled() bool
IsSymbolsFontInstalled reports whether Symbols Nerd Font files are already present on disk.
func LinuxFontconfigPath ¶
LinuxFontconfigPath returns the user fontconfig conf.d path for Nerd Font symbol fallback.
func UserFontDir ¶
UserFontDir returns the per-user font installation directory for the current OS.
Types ¶
type InstallResult ¶
type InstallResult struct {
Dir string `json:"dir"`
Files []string `json:"files"`
FontconfigPath string `json:"fontconfig_path,omitempty"`
TerminalConfigPath string `json:"terminal_config_path,omitempty"`
CacheUpdated bool `json:"cache_updated"`
NeedsRestart bool `json:"needs_restart"`
}
InstallResult summarizes the outcome of a Symbols Nerd Font installation.
func InstallSymbolsNerdFont ¶
func InstallSymbolsNerdFont(ctx context.Context) (InstallResult, error)
InstallSymbolsNerdFont downloads and installs the official NerdFontsSymbolsOnly fallback font (and Linux fontconfig fallback rule) into the user's font directory.
func InstallSymbolsNerdFontFrom ¶
func InstallSymbolsNerdFontFrom(ctx context.Context, archiveURL, destDir string, httpClient *http.Client) (InstallResult, error)
InstallSymbolsNerdFontFrom downloads a Nerd Fonts zip archive from archiveURL and extracts its .ttf/.otf files into destDir (defaulting to UserFontDir).