fc-validate
Validate font files for correctness
SYNOPSIS
fc-validate [ -f file | --file=file ]... [ -c | --config ] [ -i | --info ] [ -q | --quiet ]
PARAMETERS
-f
Validates the specified Fontconfig XML file. This option can be used multiple times to validate several files. If no specific FILE arguments or -f options are provided, fc-validate defaults to validating the effective Fontconfig configuration (as if -c were used).
-i, --info
Prints informational details about the parsed configuration structure, such as the number of directories, aliases, and rules found, in addition to performing the validation.
-c, --config
Validates the effective Fontconfig configuration. This means it loads and processes the default fonts.conf file and any files in the conf.d directories, exactly as Fontconfig would normally do to build its font database.
-q, --quiet
Suppresses the output of validation errors. The command will still return a non-zero exit status if validation fails, making it suitable for scripting where only the exit status is needed to determine success or failure.
DESCRIPTION
The fc-validate command is a utility provided by the Fontconfig library. It is used to parse and validate Fontconfig XML configuration files for structural and basic semantic correctness. This tool helps administrators and users identify common issues, syntax errors, and inconsistencies within their font configuration, ensuring that the Fontconfig system can correctly interpret and apply the defined rules.
It can validate individual files specified as arguments or using the -f option. Alternatively, it can validate the composite, effective configuration that Fontconfig would use, which includes the primary fonts.conf and files within conf.d directories. Upon successful validation, the command exits with a zero status; otherwise, it returns a non-zero status and typically prints error messages to standard error.
CAVEATS
fc-validate primarily checks for structural integrity and basic semantic correctness of Fontconfig XML files according to the Fontconfig DTD. It does not, however, guarantee that the fonts referenced actually exist, are accessible, or that the configuration will produce the desired visual rendering effects. It is a tool for syntax and basic consistency checking, not a rendering simulator. Ensure Fontconfig is properly installed for this command to function.
EXIT STATUS
The command exits with status 0 if the configuration is valid and no errors are found during processing. A non-zero exit status (typically 1) indicates that validation failed, an error occurred during processing, or invalid options were provided. This makes it suitable for use in shell scripts to automate configuration checks.
DEFAULT BEHAVIOR
When fc-validate is invoked without any file arguments (i.e., no -f options or explicit FILE paths) and without the -c option, it implicitly acts as if -c was specified. It attempts to load and validate the system's active Fontconfig configuration, which typically resides in /etc/fonts/fonts.conf and the conf.d directory.