SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from OpenSuSE fontconfig-2.8.0-86.10.TM.x86_64.rpm

FONTS-CONF

Section: (5)
Updated: 21 January 2011
Index

 

NAME

fonts.conf - Font configuration files 

SYNOPSIS

   /etc/fonts/fonts.conf   /etc/fonts/fonts.dtd   /etc/fonts/conf.d   ~/.fonts.conf.d   ~/.fonts.conf
 

DESCRIPTION

Fontconfig is a library designed to provide system-wide font configuration,customization and application access. 

FUNCTIONAL OVERVIEW

Fontconfig contains two essential modules, the configuration module whichbuilds an internal configuration from XML files and the matching modulewhich accepts font patterns and returns the nearest matching font. 

FONT CONFIGURATION

The configuration module consists of the FcConfig datatype, libexpat andFcConfigParse which walks over an XML tree and amends a configuration withdata found within. From an external perspective, configuration of thelibrary consists of generating a valid XML tree and feeding that toFcConfigParse. The only other mechanism provided to applications forchanging the running configuration is to add fonts and directories to thelist of application-provided font files.

The intent is to make font configurations relatively static, and shared byas many applications as possible. It is hoped that this will lead to morestable font selection when passing names from one application to another.XML was chosen as a configuration file format because it provides a formatwhich is easy for external agents to edit while retaining the correctstructure and syntax.

Font configuration is separate from font matching; applications needing todo their own matching can access the available fonts from the library andperform private matching. The intent is to permit applications to pick andchoose appropriate functionality from the library instead of forcing them tochoose between this library and a private configuration mechanism. The hopeis that this will ensure that configuration of fonts for all applicationscan be centralized in one place. Centralizing font configuration willsimplify and regularize font installation and customization. 

FONT PROPERTIES

While font patterns may contain essentially any properties, there are somewell known properties with associated types. Fontconfig uses some of theseproperties for font matching and font completion. Others are provided as aconvenience for the applications' rendering mechanism.

  Property        Type    Description  --------------------------------------------------------------  family          String  Font family names  familylang      String  Languages corresponding to each family  style           String  Font style. Overrides weight and slant  stylelang       String  Languages corresponding to each style  fullname        String  Font full names (often includes style)  fullnamelang    String  Languages corresponding to each fullname  slant           Int     Italic, oblique or roman  weight          Int     Light, medium, demibold, bold or black  size            Double  Point size  width           Int     Condensed, normal or expanded  aspect          Double  Stretches glyphs horizontally before hinting  pixelsize       Double  Pixel size  spacing         Int     Proportional, dual-width, monospace or charcell  foundry         String  Font foundry name  antialias       Bool    Whether glyphs can be antialiased  hinting         Bool    Whether the rasterizer should use hinting  hintstyle       Int     Automatic hinting style  verticallayout  Bool    Use vertical layout  autohint        Bool    Use autohinter instead of normal hinter  globaladvance   Bool    Use font global advance data  file            String  The filename holding the font  index           Int     The index of the font within the file  ftface          FT_Face Use the specified FreeType face object  rasterizer      String  Which rasterizer is in use  outline         Bool    Whether the glyphs are outlines  scalable        Bool    Whether glyphs can be scaled  scale           Double  Scale factor for point->pixel conversions  dpi             Double  Target dots per inch  rgba            Int     unknown, rgb, bgr, vrgb, vbgr,                          none - subpixel geometry  lcdfilter       Int     Type of LCD filter  minspace        Bool    Eliminate leading from line spacing  charset         CharSet Unicode chars encoded by the font  lang            String  List of RFC-3066-style languages this                          font supports  fontversion     Int     Version number of the font  capability      String  List of layout capabilities in the font  embolden        Bool    Rasterizer should synthetically embolden the font    
 

FONT MATCHING

Fontconfig performs matching by measuring the distance from a providedpattern to all of the available fonts in the system. The closest matchingfont is selected. This ensures that a font will always be returned, butdoesn't ensure that it is anything like the requested pattern.

Font matching starts with an application constructed pattern. The desiredattributes of the resulting font are collected together in a pattern. Eachproperty of the pattern can contain one or more values; these are listed inpriority order; matches earlier in the list are considered "closer" thanmatches later in the list.

The initial pattern is modified by applying the list of editing instructionsspecific to patterns found in the configuration; each consists of a matchpredicate and a set of editing operations. They are executed in the orderthey appeared in the configuration. Each match causes the associatedsequence of editing operations to be applied.

After the pattern has been edited, a sequence of default substitutions areperformed to canonicalize the set of available properties; this avoids theneed for the lower layers to constantly provide default values for variousfont properties during rendering.

The canonical font pattern is finally matched against all available fonts.The distance from the pattern to the font is measured for each of severalproperties: foundry, charset, family, lang, spacing, pixelsize, style,slant, weight, antialias, rasterizer and outline. This list is in priorityorder -- results of comparing earlier elements of this list weigh moreheavily than later elements.

There is one special case to this rule; family names are split into twobindings; strong and weak. Strong family names are given greater precedencein the match than lang elements while weak family names are given lowerprecedence than lang elements. This permits the document language to drivefont selection when any document specified font is unavailable.

The pattern representing that font is augmented to include any propertiesfound in the pattern but not found in the font itself; this permits theapplication to pass rendering instructions or any other data through thematching system. Finally, the list of editing instructions specific tofonts found in the configuration are applied to the pattern. This modifiedpattern is returned to the application.

The return value contains sufficient information to locate and rasterize thefont, including the file name, pixel size and other rendering data. Asnone of the information involved pertains to the FreeType library,applications are free to use any rasterization engine or even to takethe identified font file and access it directly.

The match/edit sequences in the configuration are performed in two passesbecause there are essentially two different operations necessary -- thefirst is to modify how fonts are selected; aliasing families and addingsuitable defaults. The second is to modify how the selected fonts arerasterized. Those must apply to the selected font, not the original patternas false matches will often occur. 

FONT NAMES

Fontconfig provides a textual representation for patterns that the librarycan both accept and generate. The representation is in three parts, first alist of family names, second a list of point sizes and finally a list ofadditional properties:

        <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>...    

Values in a list are separated with commas. The name needn't include eitherfamilies or point sizes; they can be elided. In addition, there aresymbolic constants that simultaneously indicate both a name and a value.Here are some examples:

  Name                            Meaning  ----------------------------------------------------------  Times-12                        12 point Times Roman  Times-12:bold                   12 point Times Bold  Courier:italic                  Courier Italic in the default size  Monospace:matrix=1 .1 0 1       The users preferred monospace font                                  with artificial obliquing    

The '\', '-', ':' and ',' characters in family names must be preceeded by a'\' character to avoid having them misinterpreted. Similarly, valuescontaining '\', '=', '_', ':' and ',' must also have them preceeded by a'\' character. The '\' characters are stripped out of the family name andvalues as the font name is read. 

DEBUGGING APPLICATIONS

To help diagnose font and applications problems, fontconfig is built with alarge amount of internal debugging left enabled. It is controlled by meansof the FC_DEBUG environment variable. The value of this variable isinterpreted as a number, and each bit within that value controls differentdebugging messages.

  Name         Value    Meaning  ---------------------------------------------------------  MATCH            1    Brief information about font matching  MATCHV           2    Extensive font matching information  EDIT             4    Monitor match/test/edit execution  FONTSET          8    Track loading of font information at startup  CACHE           16    Watch cache files being written  CACHEV          32    Extensive cache file writing information  PARSE           64    (no longer in use)  SCAN           128    Watch font files being scanned to build caches  SCANV          256    Verbose font file scanning information  MEMORY         512    Monitor fontconfig memory usage  CONFIG        1024    Monitor which config files are loaded  LANGSET       2048    Dump char sets used to construct lang values  OBJTYPES      4096    Display message when value typechecks fail  

Add the value of the desired debug levels together and assign that (inbase 10) to the FC_DEBUG environment variable before running theapplication. Output from these statements is sent to stdout. 

LANG TAGS

Each font in the database contains a list of languages it supports. This iscomputed by comparing the Unicode coverage of the font with the orthographyof each language. Languages are tagged using an RFC-3066 compatible namingand occur in two parts -- the ISO 639 language tag followed a hyphen and thenby the ISO 3166 country code. The hyphen and country code may be elided.

Fontconfig has orthographies for several languages built into the library.No provision has been made for adding new ones aside from rebuilding thelibrary. It currently supports 122 of the 139 languages named in ISO 639-1,141 of the languages with two-letter codes from ISO 639-2 and another 30languages with only three-letter codes. Languages with both two and threeletter codes are provided with only the two letter code.

For languages used in multiple territories with radically differentcharacter sets, fontconfig includes per-territory orthographies. Thisincludes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese. 

CONFIGURATION FILE FORMAT

Configuration files for fontconfig are stored in XML format; thisformat makes external configuration tools easier to write and ensures thatthey will generate syntactically correct configuration files. As XMLfiles are plain text, they can also be manipulated by the expert user usinga text editor.

The fontconfig document type definition resides in the external entity"fonts.dtd"; this is normally stored in the default font configurationdirectory (/etc/fonts). Each configuration file should contain thefollowing structure:

        <?xml version="1.0"?>        <!DOCTYPE fontconfig SYSTEM "fonts.dtd">        <fontconfig>        ...        </fontconfig>    
 

<FONTCONFIG>

This is the top level element for a font configuration and can contain<dir>, <cache>, <include>, <match> and <alias> elements in any order. 

<DIR>

This element contains a directory name which will be scanned for font filesto include in the set of available fonts. 

<CACHE>

This element contains a file name for the per-user cache of fontinformation. If it starts with '~', it refers to a file in the usershome directory. This file is used to hold information about fonts thatisn't present in the per-directory cache files. It is automaticallymaintained by the fontconfig library. The default for this file is ``~/.fonts.cache-<version>'', where <version> is the font configurationfile version number (currently 2). 

<INCLUDE IGNORE_MISSING=NO>

This element contains the name of an additional configuration file ordirectory. If a directory, every file within that directory starting with anASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will be processed in sorted order. Whenthe XML datatype is traversed by FcConfigParse, the contents of the file(s)will also be incorporated into the configuration by passing the filename(s) toFcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of thedefault "no", a missing file or directory will elicit no warning message fromthe library. 

<CONFIG>

This element provides a place to consolidate additional configurationinformation. <config> can contain <blank> and <rescan> elements in anyorder. 

<BLANK>

Fonts often include "broken" glyphs which appear in the encoding but aredrawn as blanks on the screen. Within the <blank> element, place eachUnicode characters which is supposed to be blank in an <int> element.Characters outside of this set which are drawn as blank will be elided fromthe set of characters supported by the font. 

<RESCAN>

The <rescan> element holds an <int> element which indicates the defaultinterval between automatic checks for font configuration changes.Fontconfig will validate all of the configuration files and directories andautomatically rebuild the internal datastructures when this interval passes. 

<SELECTFONT>

This element is used to black/white list fonts from being listed or matchedagainst. It holds acceptfont and rejectfont elements. 

<ACCEPTFONT>

Fonts matched by an acceptfont element are "whitelisted"; such fonts areexplicitly included in the set of fonts used to resolve list and matchrequests; including them in this list protects them from being "blacklisted"by a rejectfont element. Acceptfont elements include glob and patternelements which are used to match fonts. 

<REJECTFONT>

Fonts matched by an rejectfont element are "blacklisted"; such fonts areexcluded from the set of fonts used to resolve list and match requests as ifthey didn't exist in the system. Rejectfont elements include glob andpattern elements which are used to match fonts. 

<GLOB>

Glob elements hold shell-style filename matching patterns (including ? and*) which match fonts based on their complete pathnames. This can be used toexclude a set of directories (/usr/share/fonts/uglyfont*), or particularfont file types (*.pcf.gz), but the latter mechanism relies rather heavilyon filenaming conventions which can't be relied upon. Note that globsonly apply to directories, not to individual fonts. 

<PATTERN>

Pattern elements perform list-style matching on incoming fonts; that is,they hold a list of elements and associated values. If all of thoseelements have a matching value, then the pattern matches the font. This canbe used to select fonts based on attributes of the font (scalable, bold,etc), which is a more reliable mechanism than using file extensions.Pattern elements include patelt elements. 

<PATELT NAME=PROPERTY>

Patelt elements hold a single pattern element and list of values. They musthave a 'name' attribute which indicates the pattern element name. Pateltelements include int, double, string, matrix, bool, charset and constelements. 

<MATCH TARGET=PATTERN>

This element holds first a (possibly empty) list of <test> elements and thena (possibly empty) list of <edit> elements. Patterns which match all of thetests are subjected to all the edits. If 'target' is set to "font" insteadof the default "pattern", then this element applies to the font nameresulting from a match rather than a font pattern to be matched. If 'target'is set to "scan", then this element applies when the font is scanned tobuild the fontconfig database. 

<TEST QUAL=ANY NAME=PROPERTY TARGET=DEFAULT COMPARE=EQ>

This element contains a single value which is compared with the target('pattern', 'font', 'scan' or 'default') property "property" (substitute any of the property names seen above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", or"more_eq". 'qual' may either be the default, "any", in which case the matchsucceeds if any value associated with the property matches the test value, or"all", in which case all of the values associated with the property mustmatch the test value. When used in a <match target="font"> element,the target= attribute in the <test> element selects between matchingthe original pattern or the font. "default" selects whichever target theouter <match> element has selected. 

<EDIT NAME=PROPERTY MODE=ASSIGN BINDING=WEAK>

This element contains a list of expression elements (any of the value oroperator elements). The expression elements are evaluated at run-time andmodify the property "property". The modification depends on whether"property" was matched by one of the associated <test> elements, if so, themodification may affect the first matched value. Any values inserted intothe property are given the indicated binding ("strong", "weak" or "same")with "same" binding using the value from the matched pattern element.'mode' is one of:

  Mode                    With Match              Without Match  ---------------------------------------------------------------------  "assign"                Replace matching value  Replace all values  "assign_replace"        Replace all values      Replace all values  "prepend"               Insert before matching  Insert at head of list  "prepend_first"         Insert at head of list  Insert at head of list  "append"                Append after matching   Append at end of list  "append_last"           Append at end of list   Append at end of list    
 

<INT>, <DOUBLE>, <STRING>, <BOOL>

These elements hold a single value of the indicated type. <bool>elements hold either true or false. An important limitation exists inthe parsing of floating point numbers -- fontconfig requires thatthe mantissa start with a digit, not a decimal point, so insert a leadingzero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5instead of -.5). 

<MATRIX>

This element holds the four <double> elements of an affinetransformation. 

<NAME>

Holds a property name. Evaluates to the first value from the property ofthe font, not the pattern. 

<CONST>

Holds the name of a constant; these are always integers and serve assymbolic names for common font values:

  Constant        Property        Value  -------------------------------------  thin            weight          0  extralight      weight          40  ultralight      weight          40  light           weight          50  book            weight          75  regular         weight          80  normal          weight          80  medium          weight          100  demibold        weight          180  semibold        weight          180  bold            weight          200  extrabold       weight          205  black           weight          210  heavy           weight          210  roman           slant           0  italic          slant           100  oblique         slant           110  ultracondensed  width           50  extracondensed  width           63  condensed       width           75  semicondensed   width           87  normal          width           100  semiexpanded    width           113  expanded        width           125  extraexpanded   width           150  ultraexpanded   width           200  proportional    spacing         0  dual            spacing         90  mono            spacing         100  charcell        spacing         110  unknown         rgba            0  rgb             rgba            1  bgr             rgba            2  vrgb            rgba            3  vbgr            rgba            4  none            rgba            5  lcdnone         lcdfilter       0  lcddefault      lcdfilter       1  lcdlight        lcdfilter       2  lcdlegacy       lcdfilter       3  hintnone        hintstyle       0  hintslight      hintstyle       1  hintmedium      hintstyle       2  hintfull        hintstyle       3    
 

<OR>, <AND>, <PLUS>, <MINUS>, <TIMES>, <DIVIDE>

These elements perform the specified operation on a list of expressionelements. <or> and <and> are boolean, not bitwise. 

<EQ>, <NOT_EQ>, <LESS>, <LESS_EQ>, <MORE>, <MORE_EQ>

These elements compare two values, producing a boolean result. 

<NOT>

Inverts the boolean sense of its one expression element 

<IF>

This element takes three expression elements; if the value of the first istrue, it produces the value of the second, otherwise it produces the valueof the third. 

<ALIAS>

Alias elements provide a shorthand notation for the set of common matchoperations needed to substitute one font family for another. They contain a<family> element followed by optional <prefer>, <accept> and <default>elements. Fonts matching the <family> element are edited to prepend thelist of <prefer>ed families before the matching <family>, append the<accept>able families after the matching <family> and append the <default>families to the end of the family list. 

<FAMILY>

Holds a single font family name 

<PREFER>, <ACCEPT>, <DEFAULT>

These hold a list of <family> elements to be used by the <alias> element. 

EXAMPLE CONFIGURATION FILE

 

SYSTEM CONFIGURATION FILE

This is an example of a system-wide configuration file

<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"><!-- /etc/fonts/fonts.conf file to configure system font access --><fontconfig><!--         Find fonts in these directories--><dir>/usr/share/fonts</dir><dir>/usr/X11R6/lib/X11/fonts</dir><!--        Accept deprecated 'mono' alias, replacing it with 'monospace'--><match target="pattern">        <test qual="any" name="family"><string>mono</string></test>        <edit name="family" mode="assign"><string>monospace</string></edit></match><!--        Names not including any well known alias are given 'sans'--><match target="pattern">        <test qual="all" name="family" mode="not_eq">sans</test>        <test qual="all" name="family" mode="not_eq">serif</test>        <test qual="all" name="family" mode="not_eq">monospace</test>        <edit name="family" mode="append_last"><string>sans</string></edit></match><!--        Load per-user customization file, but don't complain        if it doesn't exist--><include ignore_missing="yes">~/.fonts.conf</include><!--        Load local customization files, but don't complain        if there aren't any--><include ignore_missing="yes">conf.d</include><include ignore_missing="yes">local.conf</include><!--        Alias well known font names to available TrueType fonts.        These substitute TrueType faces for similar Type1        faces to improve screen appearance.--><alias>        <family>Times</family>        <prefer><family>Times New Roman</family></prefer>        <default><family>serif</family></default></alias><alias>        <family>Helvetica</family>        <prefer><family>Arial</family></prefer>        <default><family>sans</family></default></alias><alias>        <family>Courier</family>        <prefer><family>Courier New</family></prefer>        <default><family>monospace</family></default></alias><!--        Provide required aliases for standard names        Do these after the users configuration file so that        any aliases there are used preferentially--><alias>        <family>serif</family>        <prefer><family>Times New Roman</family></prefer></alias><alias>        <family>sans</family>        <prefer><family>Arial</family></prefer></alias><alias>        <family>monospace</family>        <prefer><family>Andale Mono</family></prefer></alias></fontconfig>    
 

USER CONFIGURATION FILE

This is an example of a per-user configuration file that lives in~/.fonts.conf

<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"><!-- ~/.fonts.conf for per-user font configuration --><fontconfig><!--        Private font directory--><dir>~/.fonts</dir><!--        use rgb sub-pixel ordering to improve glyph appearance on        LCD screens.  Changes affecting rendering, but not matching        should always use target="font".--><match target="font">        <edit name="rgba" mode="assign"><const>rgb</const></edit></match></fontconfig>    
 

FILES

fonts.confcontains configuration information for the fontconfig libraryconsisting of directories to look at for font information as well asinstructions on editing program specified font patterns before attempting tomatch the available fonts. It is in xml format.

conf.dis the conventional name for a directory of additional configuration filesmanaged by external applications or the local administrator. Thefilenames starting with decimal digits are sorted in lexicographic orderand used as additional configuration files. All of these files are in xmlformat. The master fonts.conf file references this directory in an <include> directive.

fonts.dtdis a DTD that describes the format of the configuration files.

~/.fonts.conf.dis the conventional name for a per-user directory of (typicallyauto-generated) configuration files, although theactual location is specified in the global fonts.conf file.

~/.fonts.confis the conventional location for per-user font configuration, although theactual location is specified in the global fonts.conf file.

~/.fonts.cache-*is the conventional repository of font information that isn't found in theper-directory caches. This file is automatically maintained by fontconfig. 

SEE ALSO

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

VERSION

Fontconfig version 2.8.0


 

Index

NAME
SYNOPSIS
DESCRIPTION
FUNCTIONAL OVERVIEW
FONT CONFIGURATION
FONT PROPERTIES
FONT MATCHING
FONT NAMES
DEBUGGING APPLICATIONS
LANG TAGS
CONFIGURATION FILE FORMAT
<FONTCONFIG>
<DIR>
<CACHE>
<INCLUDE IGNORE_MISSING=NO>
<CONFIG>
<BLANK>
<RESCAN>
<SELECTFONT>
<ACCEPTFONT>
<REJECTFONT>
<GLOB>
<PATTERN>
<PATELT NAME=PROPERTY>
<MATCH TARGET=PATTERN>
<TEST QUAL=ANY NAME=PROPERTY TARGET=DEFAULT COMPARE=EQ>
<EDIT NAME=PROPERTY MODE=ASSIGN BINDING=WEAK>
<INT>, <DOUBLE>, <STRING>, <BOOL>
<MATRIX>
<NAME>
<CONST>
<OR>, <AND>, <PLUS>, <MINUS>, <TIMES>, <DIVIDE>
<EQ>, <NOT_EQ>, <LESS>, <LESS_EQ>, <MORE>, <MORE_EQ>
<NOT>
<IF>
<ALIAS>
<FAMILY>
<PREFER>, <ACCEPT>, <DEFAULT>
EXAMPLE CONFIGURATION FILE
SYSTEM CONFIGURATION FILE
USER CONFIGURATION FILE
FILES
SEE ALSO
VERSION

This document was created byman2html,using the manual pages.