LinuxCommandLibrary

fc-scan

List available fonts on the system

SYNOPSIS

fc-scan [OPTIONS] [FILE...]

PARAMETERS

FILE...
    One or more paths to font files to be scanned. If no files are specified, fc-scan attempts to read filenames from standard input.

-f <file>
    Reads font filenames to be scanned from the specified <file>, with each filename expected on a new line.

-V
    Prints the Fontconfig library version and exits.

--verbose
    Enables verbose output, providing more detailed information during the scanning process, useful for debugging parsing issues.

-y
    Prints only the filenames of the fonts that were successfully scanned, suppressing the detailed property output for each font.

-s
    Prints a summary of the fonts found in each file, offering a more concise output than the full property listing.

--format=<format>
    Specifies a custom output format string using printf-like syntax. This allows users to define exactly which font properties are displayed and how, using property names (e.g., '%{family}', '%{pixelsize}').

--quiet
    Suppresses warnings that might occur during the scanning process, useful for automated scripts.

--help
    Displays a brief help message with command usage and available options.

DESCRIPTION

The fc-scan command is a utility from the Fontconfig library, designed to inspect and extract information from specific font files. Unlike fc-list which queries the font cache, fc-scan directly processes font files (e.g., TrueType, OpenType, OpenType CFF) provided as arguments or via standard input. It parses the font data and outputs a detailed list of its properties, such as family name, style, weight, width, spacing, PostScript name, and unique ID. This tool is invaluable for
debugging font-related issues, verifying the integrity of font files, or understanding the precise characteristics of a font before adding it to the system's font cache. It helps developers and system administrators to confirm if Fontconfig can correctly interpret a font file's metadata and properties.

CAVEATS

fc-scan is primarily an inspection tool; it does not modify the system's font cache or install fonts. For font installation and cache management, use fc-cache. The default output format is detailed and XML-like, which might require parsing for automated scripting, although the --format option provides more control.
The exact set of available options and their behavior can vary slightly between different versions of the Fontconfig library. Users should consult their system's specific man page for the most accurate information.

OUTPUT FORMAT

By default, fc-scan outputs font properties in an XML-like structure, detailing various attributes like family, style, weight, width, slant, spacing, pixelsize, scalable status, and the file path itself. This structured output facilitates programmatic parsing. The --format option offers greater control over the output, allowing users to specify a printf-like format string to extract specific properties, making it highly suitable for scripting and custom reporting.

USE CASES

Key use cases for fc-scan include:
Verifying Font Integrity: Checking if a downloaded or newly created font file is valid and readable by Fontconfig's parsing engine.
Debugging Font Issues: Pinpointing why a particular font might not be appearing correctly in applications by examining its reported properties and comparing them to expectations.
Inspecting Font Metadata: Quickly retrieving detailed metadata about a font file without needing to install it on the system or rebuild font caches.
Scripting and Automation: Extracting specific font properties for custom scripts that process or categorize font collections.

HISTORY

The Fontconfig library, which includes fc-scan, was developed by Keith Packard as a robust and flexible system for font configuration and customization on Linux and other Unix-like operating systems. It was first released in the early 2000s, providing a much-needed standardized approach to font management beyond the traditional X11 font mechanisms.
fc-scan has been a fundamental part of the Fontconfig utility suite since its early days, consistently serving its purpose of direct font file inspection as a core debugging and information-gathering tool within the font ecosystem.

SEE ALSO

fc-list(1), fc-match(1), fc-cache(1), fc-cat(1), fc-query(1)

Copied to clipboard