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
</PRE
></TD
></TR
></TABLE
><P
>Add the value of the desired debug levels together and assign that (in
base 10) to the FC_DEBUG environment variable before running the
application. Output from these statements is sent to stdout.
</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN48"
></A
><H2
>Lang Tags</H2
><P
>Each font in the database contains a list of languages it supports. This is
computed by comparing the Unicode coverage of the font with the orthography
of each language. Languages are tagged using an RFC-3066 compatible naming
and occur in two parts -- the ISO 639 language tag followed a hyphen and then
by the ISO 3166 country code. The hyphen and country code may be elided.
</P
><P
>Fontconfig has orthographies for several languages built into the library.
No provision has been made for adding new ones aside from rebuilding the
library. 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 30
languages with only three-letter codes. Languages with both two and three
letter codes are provided with only the two letter code.
</P
><P
>For languages used in multiple territories with radically different
character sets, fontconfig includes per-territory orthographies. This
includes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese.
</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN53"
></A
><H2
>Configuration File Format</H2
><P
>Configuration files for fontconfig are stored in XML format; this
format makes external configuration tools easier to write and ensures that
they will generate syntactically correct configuration files. As XML
files are plain text, they can also be manipulated by the expert user using
a text editor.
</P
><P
>The fontconfig document type definition resides in the external entity
"fonts.dtd"; this is normally stored in the default font configuration
directory (/etc/fonts). Each configuration file should contain the
following structure:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
> <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
...
</fontconfig>
</PRE
></TD
></TR
></TABLE
>
</P
><DIV
CLASS="REFSECT2"
><A
NAME="AEN58"
></A
><H3
><TT
CLASS="LITERAL"
><fontconfig></TT
></H3
><P
>This is the top level element for a font configuration and can contain
<TT
CLASS="LITERAL"
><dir></TT
>, <TT
CLASS="LITERAL"
><cachedir></TT
>, <TT
CLASS="LITERAL"
><include></TT
>, <TT
CLASS="LITERAL"
><match></TT
> and <TT
CLASS="LITERAL"
><alias></TT
> elements in any order.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN67"
></A
><H3
><TT
CLASS="LITERAL"
><dir prefix="default"></TT
></H3
><P
>This element contains a directory name which will be scanned for font files
to include in the set of available fonts. If 'prefix' is set to "xdg", the value in the XDG_DATA_HOME environment variable will be added as the path prefix. please see XDG Base Directory Specification for more details.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN71"
></A
><H3
><TT
CLASS="LITERAL"
><cachedir prefix="default"></TT
></H3
><P
>This element contains a directory name that is supposed to be stored or read
the cache of font information. If multiple elements are specified in
the configuration file, the directory that can be accessed first in the list
will be used to store the cache files. If it starts with '~', it refers to
a directory in the users home directory. If 'prefix' is set to "xdg", the value in the XDG_CACHE_HOME environment variable will be added as the path prefix. please see XDG Base Directory Specification for more details.
The default directory is ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files
>This element contains the name of an additional configuration file or
directory. If a directory, every file within that directory starting with an
ASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will be processed in sorted order. When
the XML datatype is traversed by FcConfigParse, the contents of the file(s)
will also be incorporated into the configuration by passing the filename(s) to
FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the
default "no", a missing file or directory will elicit no warning message from
the library. If 'prefix' is set to "xdg", the value in the XDG_CONFIG_HOME environment variable will be added as the path prefix. please see XDG Base Directory Specification for more details.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN83"
></A
><H3
><TT
CLASS="LITERAL"
><config></TT
></H3
><P
>This element provides a place to consolidate additional configuration
information. <TT
CLASS="LITERAL"
><config></TT
> can contain <TT
CLASS="LITERAL"
><blank></TT
> and <TT
CLASS="LITERAL"
><rescan></TT
> elements in any
order.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN90"
></A
><H3
><TT
CLASS="LITERAL"
><blank></TT
></H3
><P
>Fonts often include "broken" glyphs which appear in the encoding but are
drawn as blanks on the screen. Within the <TT
CLASS="LITERAL"
><blank></TT
> element, place each
Unicode characters which is supposed to be blank in an <TT
CLASS="LITERAL"
><int></TT
> element.
Characters outside of this set which are drawn as blank will be elided from
the set of characters supported by the font.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN96"
></A
><H3
><TT
CLASS="LITERAL"
><rescan></TT
></H3
><P
>The <TT
CLASS="LITERAL"
><rescan></TT
> element holds an <TT
CLASS="LITERAL"
><int></TT
> element which indicates the default
interval between automatic checks for font configuration changes.
Fontconfig will validate all of the configuration files and directories and
automatically rebuild the internal datastructures when this interval passes.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN102"
></A
><H3
><TT
CLASS="LITERAL"
><selectfont></TT
></H3
><P
>This element is used to black/white list fonts from being listed or matched
against. It holds acceptfont and rejectfont elements.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN106"
></A
><H3
><TT
CLASS="LITERAL"
><acceptfont></TT
></H3
><P
>Fonts matched by an acceptfont element are "whitelisted"; such fonts are
explicitly included in the set of fonts used to resolve list and match
requests; including them in this list protects them from being "blacklisted"
by a rejectfont element. Acceptfont elements include glob and pattern
elements which are used to match fonts.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN110"
></A
><H3
><TT
CLASS="LITERAL"
><rejectfont></TT
></H3
><P
>Fonts matched by an rejectfont element are "blacklisted"; such fonts are
excluded from the set of fonts used to resolve list and match requests as if
they didn't exist in the system. Rejectfont elements include glob and
pattern elements which are used to match fonts.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN114"
></A
><H3
><TT
CLASS="LITERAL"
><glob></TT
></H3
><P
>Glob elements hold shell-style filename matching patterns (including ? and
*) which match fonts based on their complete pathnames. This can be used to
exclude a set of directories (/usr/share/fonts/uglyfont*), or particular
font file types (*.pcf.gz), but the latter mechanism relies rather heavily
on filenaming conventions which can't be relied upon. Note that globs
only apply to directories, not to individual fonts.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN118"
></A
><H3
><TT
CLASS="LITERAL"
><pattern></TT
></H3
><P
>Pattern elements perform list-style matching on incoming fonts; that is,
they hold a list of elements and associated values. If all of those
elements have a matching value, then the pattern matches the font. This can
be 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.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN122"
></A
><H3
><TT
CLASS="LITERAL"
><patelt name="property"></TT
></H3
><P
>Patelt elements hold a single pattern element and list of values. They must
have a 'name' attribute which indicates the pattern element name. Patelt
elements include int, double, string, matrix, bool, charset and const
elements.
</P
></DIV
><DIV
CLASS="REFSECT2"
><A
NAME="AEN126"
></A
><H3
><TT
CLASS="LITERAL"
><match target="pattern"></TT
></H3
><P
>This element holds first a (possibly empty) list of <TT
CLASS="LITERAL"
><test></TT
> elements and then
a (possibly empty) list of <TT
CLASS="LITERAL"
><edit></TT
> elements. Patterns which match all of the
tests are subjected to all the edits. If 'target' is set to "font" instead
of the default "pattern", then this element applies to the font name
resulting 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 to
>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", "more_eq", "contains" or
"not_contains". 'qual' may either be the default, "any", in which case the match
succeeds if any value associated with the property matches the test value, or
"all", in which case all of the values associated with the property must
match the test value. 'ignore-blanks' takes a boolean value. if 'ignore-blanks' is set "true", any blanks in the string will be ignored on its comparison. this takes effects only when compare="eq" or compare="not_eq".
When used in a <match target="font"> element,
the target= attribute in the <test> element selects between matching
the original pattern or the font. "default" selects whichever target the
use WenQuanYi Zen Hei font when serif is requested for Chinese
-->
<match>
<!--
If you don't want to use WenQuanYi Zen Hei font for zh-tw etc,
you can use zh-cn instead of zh.
Please note, even if you set zh-cn, it still matches zh.
if you don't like it, you can use compare="eq"
instead of compare="contains".
-->
<test name="lang" compare="contains">
<string>zh</string>
</test>
<test name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend">
<string>WenQuanYi Zen Hei</string>
</edit>
</match>
<!--
use VL Gothic font when sans-serif is requested for Japanese
-->
<match>
<test name="lang" compare="contains">
<string>ja</string>
</test>
<test name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend">
<string>VL Gothic</string>
</edit>
</match>
</fontconfig>
</PRE
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN245"
></A
><H2
>Files</H2
><P
><I
CLASS="EMPHASIS"
>fonts.conf</I
>
contains configuration information for the fontconfig library
consisting of directories to look at for font information as well as
instructions on editing program specified font patterns before attempting to
match the available fonts. It is in XML format.
</P
><P
><I
CLASS="EMPHASIS"
>conf.d</I
>
is the conventional name for a directory of additional configuration files
managed by external applications or the local administrator. The
filenames starting with decimal digits are sorted in lexicographic order
and used as additional configuration files. All of these files are in XML
format. The master fonts.conf file references this directory in an
<include> directive.
</P
><P
><I
CLASS="EMPHASIS"
>fonts.dtd</I
>
is a DTD that describes the format of the configuration files.
</P
><P
><I
CLASS="EMPHASIS"
>$XDG_CONFIG_HOME/fontconfig/conf.d</I
> and <I
CLASS="EMPHASIS"
>~/.fonts.conf.d</I
>
is the conventional name for a per-user directory of (typically
auto-generated) configuration files, although the
actual location is specified in the global fonts.conf file. please note that ~/.fonts.conf.d is deprecated now. it will not be read by default in the future version.
</P
><P
><I
CLASS="EMPHASIS"
>$XDG_CONFIG_HOME/fontconfig/fonts.conf</I
> and <I
CLASS="EMPHASIS"
>~/.fonts.conf</I
>
is the conventional location for per-user font configuration, although the
actual location is specified in the global fonts.conf file. please note that ~/.fonts.conf is deprecated now. it will not be read by default in the future version.
</P
><P
><I
CLASS="EMPHASIS"
>$XDG_CACHE_HOME/fontconfig/*.cache-*</I
> and <I
CLASS="EMPHASIS"
> ~/.fontconfig/*.cache-*</I
>
is the conventional repository of font information that isn't found in the
per-directory caches. This file is automatically maintained by fontconfig. please note that ~/.fontconfig/*.cache-* is deprecated now. it will not be read by default in the future version.
</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN262"
></A
><H2
>Environment variables</H2
><P
><I
CLASS="EMPHASIS"
>FONTCONFIG_FILE</I
>
is used to override the default configuration file.
</P
><P
><I
CLASS="EMPHASIS"
>FONTCONFIG_PATH</I
>
is used to override the default configuration directory.
</P
><P
><I
CLASS="EMPHASIS"
>FC_DEBUG</I
>
is used to output the detailed debugging messages. see <A
HREF="#DEBUG"
>Debugging Applications</A
> section for more details.
</P
><P
><I
CLASS="EMPHASIS"
>FONTCONFIG_USE_MMAP</I
>
is used to control the use of mmap(2) for the cache files if available. this take a boolean value. fontconfig will checks if the cache files are stored on the filesystem that is safe to use mmap(2). explicitly setting this environment variable will causes skipping this check and enforce to use or not use mmap(2) anyway.