LinuxCommandLibrary

fc-validate

Validate font files for correctness

SYNOPSIS

fc-validate [-h?vVq] [-n] [-l file] [--index] [--services] [file...]

PARAMETERS

-h, -?, --help
    Display help information and exit.

-v, --verbose
    Display verbose output listing all files validated.

-V, --version
    Display fontconfig version and exit.

-q, --quiet
    Suppress all warnings.

-n, --no-default-ignore
    Load files from the default ignore list.

-l file, --list=file
    Write list of validated files to file.

--index
    Validate the index file.

--services
    Validate service files.

DESCRIPTION

fc-validate is a utility from the fontconfig library that checks the syntax and validity of font configuration files on Linux and Unix-like systems. Fontconfig uses XML-based configuration files to manage font selection, aliasing, and substitution for applications.

Without arguments, fc-validate scans all standard configuration files in directories like ~/.config/fontconfig/fonts.conf, /etc/fonts/fonts.conf, and /etc/fonts/conf.d/. It parses each file, verifies XML structure, and ensures directives like <match>, <alias>, and <family> are correctly formed. Errors such as malformed XML, invalid patterns, or unknown elements are reported to stderr, aiding in debugging issues that cause font mismatches or rendering failures.

Key features include verbose listing of checked files, quiet mode to suppress warnings, and options to validate specific components like index or service files. It ignores certain default files unless overridden. This tool is crucial for system administrators maintaining font ecosystems, ensuring compatibility across X11, Wayland, and applications like Firefox or LibreOffice.

Usage helps prevent subtle bugs where fonts fail to load, improving text display consistency.

CAVEATS

Errors and warnings output to stderr. Validates only fontconfig XML files; does not check font files themselves. Requires fontconfig library installed.

EXIT STATUS

0 if all files valid, non-zero otherwise.

DEFAULT FILES

Checks XDG_CONFIG_HOME/fontconfig/fonts.conf, ~/.config/fontconfig/fonts.conf, /etc/fonts/fonts.conf, /etc/fonts/conf.d/*.conf.

EXAMPLE

fc-validate --verbose /etc/fonts/fonts.conf
Validates specific file with verbose output.

HISTORY

Part of fontconfig project initiated by Keith Packard in 2000; first stable release 2.0 in 2002. fc-validate introduced early to support configuration debugging as fontconfig gained adoption in XFree86 and GNOME.

SEE ALSO

fc-list(1), fc-cache(1), fc-match(1), fc-scan(1), fontconfig(3)

Copied to clipboard