LinuxCommandLibrary

fc-query

Query font files for information

SYNOPSIS

fc-query [options] [pattern…]

PARAMETERS

-h, --help
    Display help message and exit

-V, --version
    Print version information and exit

-v, --verbose
    Increase verbosity (repeat for more detail)

-f format, --format=format
    Output using specified format string (e.g., '%{family} ')

-s field, --sort=field
    Sort results by field (e.g., family, file, weight)

-n, --no-canon
    Disable pattern canonicalization

DESCRIPTION

fc-query is a command-line tool from the fontconfig library that queries the system's font database to list fonts matching specified patterns. Fontconfig maintains a cache of font information from directories like /usr/share/fonts and ~/.local/share/fonts, configured via files such as /etc/fonts/fonts.conf and ~/.config/fontconfig/fonts.conf.

Without arguments, it lists all available fonts with details including family, style, full name, file path, and index. Patterns like 'Arial' or 'Sans:style=Italic' filter results using fontconfig's pattern syntax. This makes it invaluable for font management, scripting font detection, or debugging configuration issues.

Output is human-readable by default but customizable via --format for scripting (e.g., XML or CSV-like). Verbose modes (-v) reveal more properties like slant, weight, and spacing. Sorting (-s) organizes by fields such as family or file. It respects aliases and substitutions defined in config files, ensuring consistent results across applications using fontconfig, like GTK, Qt, and X11.

Primarily used by developers and sysadmins, fc-query helps verify font installations post-fc-cache updates.

EXAMPLES

fc-query 'Arial'
fc-query -f '%{family}\t%{style}\t%{file}\n'
fc-query -v -s family

DEFAULT OUTPUT

Pattern/Info: Family: Style: Fullname: filename:index
Verbose adds slant, weight, etc.

HISTORY

Developed by Keith Packard for Fontconfig (circa 2001) as part of XFree86/Xorg evolution; now core to Linux font handling in GNOME, KDE, and beyond.

SEE ALSO

fc-list(1), fc-match(1), fc-cache(8), fc-scan(1)

Copied to clipboard