fc-match
Find best matching font for a pattern
TLDR
Return a sorted list of best matching fonts
SYNOPSIS
fc-match [-vqVh] [-s] [-d dpi] [-a] [pattern]
PARAMETERS
-v
Verbose output. Shows the pattern elements of the matched font.
-q
Quiet; do not print any output, just return an exit code.
-V
Show program version and exit.
-h
Show summary of options.
-s
Accepts patterns in standard input.
-d dpi
Specifies the dots per inch (dpi) for font matching.
-a
Accepts font patterns as arguments and match all of them sequentially.
pattern
The font pattern to match. If omitted, it uses the default font pattern.
DESCRIPTION
The fc-match command is a utility that helps you determine which font on your system best matches a given font pattern. This is crucial for applications that need to select fonts dynamically based on properties like family, style, and weight. It queries the font configuration library and uses pattern matching to find the closest matching font available. It takes a font pattern as input (which can be a simple font name or a more complex specification using properties like 'family', 'style', 'weight', etc.) and outputs the filename of the font that best matches that pattern. fc-match is invaluable for debugging font issues, ensuring correct font rendering across different systems, and understanding how font configuration affects application behavior. The command leverages the fontconfig library's powerful pattern matching capabilities, providing a versatile tool for font selection and management. You can specify multiple patterns, and fc-match returns the best match for each one.
CAVEATS
The accuracy of the font matching depends heavily on the font configuration files and available fonts on the system. Results may vary across different systems with different font configurations.
EXIT STATUS
fc-match returns 0 if a match is found, and a non-zero value otherwise.
PATTERN SYNTAX
The pattern argument accepts a font pattern string. This string can specify font properties like family, style, weight, and slant.
For example: 'family=Helvetica, style=Bold'.
HISTORY
fc-match is part of the fontconfig library, which has been developed over time to provide a standardized way to manage and configure fonts on Unix-like systems. Its development aimed to address the inconsistencies in font handling across different applications and operating systems. Its usage has grown with the increasing importance of fonts in graphical user interfaces and document rendering.
SEE ALSO
fc-list(1), fc-cache(1), fc-pattern(1), fontconfig(5)