Fontconfig performs customization with rules placed in the configuration files. These rules can either adjust the pattern to be used in matching fonts or adjust the values in the resulting match. Adjusting the pattern before the match allows the application to modify which font is selected. This is how the generic family names ``serif'', ``sans-serif'' and ``monospace'' are mapped to the preferred real font families. Adjusting the values in the resulting match provides a mechanism to change how the font is rasterized; this is how anti-aliasing can be selected for a certain size range or only for certain families.
There is only one underlying mechanism; a list of match/edit rules -- patterns which ``match'' are modified with the associated ``edits''. Matching is performed by comparing values against pattern names, using the usual relational operators. Because patterns may have more than one value, the matches can either require a match with all of the values for a particular name or with any one of the values.
One common configuration operation is to substitute one font family for another. This is how the generic family names map to one of the available families, it is also how missing families can be mapped to one of the available families. This operation takes a single family name to match and three lists of family names that modify the list of family names in the pattern.
The first list of family names are those which are prefered to the matched family name. These names are placed before the matched family in the pattern so that they will replace the given family even if that family is available.
The second list are those families which are acceptable replacements for the given family. These names are placed after the matched family in the pattern so that if the given family is not available, they will be used instead.
The final list are those families which are used as default family names. They are placed at the end of the list of families in the pattern. Families already in the list remain ahead of these new names; the default families are used only if none of the other specified families are available.
The general match/edit rules allow matching of any of the pattern elements using any of the usual relational operators (=, !=, >, >=, < and <=). More than one match may be listed, the associated edits are performed when all of the matches are true.
Each edit modifies the list of values associated with a single name. If that name appears in a match predicate, then any changes to the list of values can be made relative to that value; new values can be inserted before or after the matching value or the matching value can be replaced by the new values.
There are two kinds of match/edit rules -- those which affect to patterns before matching and those which modify the return value from the match. As the value returned from the match is generally passed off to a rasterizer, this provides a mechanism for modifying the rendering parameters for a particular font.