fontconfig-user.html revision c9710b42
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<HTML
3><HEAD
4><TITLE
5>fonts-conf</TITLE
6><META
7NAME="GENERATOR"
8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"></HEAD
9><BODY
10CLASS="REFENTRY"
11BGCOLOR="#FFFFFF"
12TEXT="#000000"
13LINK="#0000FF"
14VLINK="#840084"
15ALINK="#0000FF"
16><H1
17><A
18NAME="AEN1"
19></A
20>fonts-conf</H1
21><DIV
22CLASS="REFNAMEDIV"
23><A
24NAME="AEN5"
25></A
26><H2
27>Name</H2
28>fonts.conf&nbsp;--&nbsp;Font configuration files</DIV
29><DIV
30CLASS="REFSYNOPSISDIV"
31><A
32NAME="AEN8"
33></A
34><H2
35>Synopsis</H2
36><TABLE
37BORDER="0"
38BGCOLOR="#E0E0E0"
39WIDTH="100%"
40><TR
41><TD
42><PRE
43CLASS="SYNOPSIS"
44>   /etc/fonts/fonts.conf
45   /etc/fonts/fonts.dtd
46   /etc/fonts/conf.d
47   $XDG_CONFIG_HOME/fontconfig/conf.d
48   $XDG_CONFIG_HOME/fontconfig/fonts.conf
49   ~/.fonts.conf.d
50   ~/.fonts.conf</PRE
51></TD
52></TR
53></TABLE
54></DIV
55><DIV
56CLASS="REFSECT1"
57><A
58NAME="AEN10"
59></A
60><H2
61>Description</H2
62><P
63>Fontconfig is a library designed to provide system-wide font configuration,
64customization and application access.
65  </P
66></DIV
67><DIV
68CLASS="REFSECT1"
69><A
70NAME="AEN13"
71></A
72><H2
73>Functional Overview</H2
74><P
75>Fontconfig contains two essential modules, the configuration module which
76builds an internal configuration from XML files and the matching module
77which accepts font patterns and returns the nearest matching font.
78  </P
79><DIV
80CLASS="REFSECT2"
81><A
82NAME="AEN16"
83></A
84><H3
85>Font Configuration</H3
86><P
87>The configuration module consists of the FcConfig datatype, libexpat and
88FcConfigParse which walks over an XML tree and amends a configuration with
89data found within.  From an external perspective, configuration of the
90library consists of generating a valid XML tree and feeding that to
91FcConfigParse.  The only other mechanism provided to applications for
92changing the running configuration is to add fonts and directories to the
93list of application-provided font files.  
94    </P
95><P
96>The intent is to make font configurations relatively static, and shared by
97as many applications as possible.  It is hoped that this will lead to more
98stable font selection when passing names from one application to another.
99XML was chosen as a configuration file format because it provides a format
100which is easy for external agents to edit while retaining the correct
101structure and syntax.
102    </P
103><P
104>Font configuration is separate from font matching; applications needing to
105do their own matching can access the available fonts from the library and
106perform private matching.  The intent is to permit applications to pick and
107choose appropriate functionality from the library instead of forcing them to
108choose between this library and a private configuration mechanism.  The hope
109is that this will ensure that configuration of fonts for all applications
110can be centralized in one place.  Centralizing font configuration will
111simplify and regularize font installation and customization.
112    </P
113></DIV
114><DIV
115CLASS="REFSECT2"
116><A
117NAME="AEN21"
118></A
119><H3
120>Font Properties</H3
121><P
122>While font patterns may contain essentially any properties, there are some
123well known properties with associated types.  Fontconfig uses some of these
124properties for font matching and font completion.  Others are provided as a
125convenience for the applications' rendering mechanism.
126    </P
127><TABLE
128BORDER="0"
129BGCOLOR="#E0E0E0"
130WIDTH="100%"
131><TR
132><TD
133><PRE
134CLASS="PROGRAMLISTING"
135>  Property        Type    Description
136  --------------------------------------------------------------
137  family          String  Font family names
138  familylang      String  Languages corresponding to each family
139  style           String  Font style. Overrides weight and slant
140  stylelang       String  Languages corresponding to each style
141  fullname        String  Font full names (often includes style)
142  fullnamelang    String  Languages corresponding to each fullname
143  slant           Int     Italic, oblique or roman
144  weight          Int     Light, medium, demibold, bold or black
145  size            Double  Point size
146  width           Int     Condensed, normal or expanded
147  aspect          Double  Stretches glyphs horizontally before hinting
148  pixelsize       Double  Pixel size
149  spacing         Int     Proportional, dual-width, monospace or charcell
150  foundry         String  Font foundry name
151  antialias       Bool    Whether glyphs can be antialiased
152  hinting         Bool    Whether the rasterizer should use hinting
153  hintstyle       Int     Automatic hinting style
154  verticallayout  Bool    Use vertical layout
155  autohint        Bool    Use autohinter instead of normal hinter
156  globaladvance   Bool    Use font global advance data (deprecated)
157  file            String  The filename holding the font
158  index           Int     The index of the font within the file
159  ftface          FT_Face Use the specified FreeType face object
160  rasterizer      String  Which rasterizer is in use
161  outline         Bool    Whether the glyphs are outlines
162  scalable        Bool    Whether glyphs can be scaled
163  scale           Double  Scale factor for point-&#62;pixel conversions
164  dpi             Double  Target dots per inch
165  rgba            Int     unknown, rgb, bgr, vrgb, vbgr,
166                          none - subpixel geometry
167  lcdfilter       Int     Type of LCD filter
168  minspace        Bool    Eliminate leading from line spacing
169  charset         CharSet Unicode chars encoded by the font
170  lang            String  List of RFC-3066-style languages this
171                          font supports
172  fontversion     Int     Version number of the font
173  capability      String  List of layout capabilities in the font
174  embolden        Bool    Rasterizer should synthetically embolden the font
175  fontfeatures    String  List of the feature tags in OpenType to be enabled
176  prgname         String  String  Name of the running program
177    </PRE
178></TD
179></TR
180></TABLE
181></DIV
182><DIV
183CLASS="REFSECT2"
184><A
185NAME="AEN25"
186></A
187><H3
188>Font Matching</H3
189><P
190>Fontconfig performs matching by measuring the distance from a provided
191pattern to all of the available fonts in the system.  The closest matching
192font is selected.  This ensures that a font will always be returned, but
193doesn't ensure that it is anything like the requested pattern.
194    </P
195><P
196> 
197Font matching starts with an application constructed pattern.  The desired
198attributes of the resulting font are collected together in a pattern.  Each
199property of the pattern can contain one or more values; these are listed in
200priority order; matches earlier in the list are considered "closer" than
201matches later in the list.
202    </P
203><P
204>The initial pattern is modified by applying the list of editing instructions
205specific to patterns found in the configuration; each consists of a match
206predicate and a set of editing operations.  They are executed in the order
207they appeared in the configuration.  Each match causes the associated
208sequence of editing operations to be applied.
209    </P
210><P
211>After the pattern has been edited, a sequence of default substitutions are
212performed to canonicalize the set of available properties; this avoids the
213need for the lower layers to constantly provide default values for various
214font properties during rendering.
215    </P
216><P
217>The canonical font pattern is finally matched against all available fonts.
218The distance from the pattern to the font is measured for each of several
219properties: foundry, charset, family, lang, spacing, pixelsize, style,
220slant, weight, antialias, rasterizer and outline.  This list is in priority
221order -- results of comparing earlier elements of this list weigh more
222heavily than later elements.
223    </P
224><P
225>There is one special case to this rule; family names are split into two
226bindings; strong and weak.  Strong family names are given greater precedence
227in the match than lang elements while weak family names are given lower
228precedence than lang elements.  This permits the document language to drive
229font selection when any document specified font is unavailable.
230    </P
231><P
232>The pattern representing that font is augmented to include any properties
233found in the pattern but not found in the font itself; this permits the
234application to pass rendering instructions or any other data through the
235matching system.  Finally, the list of editing instructions specific to
236fonts found in the configuration are applied to the pattern.  This modified
237pattern is returned to the application.
238    </P
239><P
240>The return value contains sufficient information to locate and rasterize the
241font, including the file name, pixel size and other rendering data.  As
242none of the information involved pertains to the FreeType library,
243applications are free to use any rasterization engine or even to take
244the identified font file and access it directly.
245    </P
246><P
247>The match/edit sequences in the configuration are performed in two passes
248because there are essentially two different operations necessary -- the
249first is to modify how fonts are selected; aliasing families and adding
250suitable defaults.  The second is to modify how the selected fonts are
251rasterized.  Those must apply to the selected font, not the original pattern
252as false matches will often occur.
253    </P
254></DIV
255><DIV
256CLASS="REFSECT2"
257><A
258NAME="AEN36"
259></A
260><H3
261>Font Names</H3
262><P
263>Fontconfig provides a textual representation for patterns that the library
264can both accept and generate.  The representation is in three parts, first a
265list of family names, second a list of point sizes and finally a list of
266additional properties:
267    </P
268><TABLE
269BORDER="0"
270BGCOLOR="#E0E0E0"
271WIDTH="100%"
272><TR
273><TD
274><PRE
275CLASS="PROGRAMLISTING"
276>	&#60;families&#62;-&#60;point sizes&#62;:&#60;name1&#62;=&#60;values1&#62;:&#60;name2&#62;=&#60;values2&#62;...
277    </PRE
278></TD
279></TR
280></TABLE
281><P
282>Values in a list are separated with commas.  The name needn't include either
283families or point sizes; they can be elided.  In addition, there are
284symbolic constants that simultaneously indicate both a name and a value.
285Here are some examples:
286    </P
287><TABLE
288BORDER="0"
289BGCOLOR="#E0E0E0"
290WIDTH="100%"
291><TR
292><TD
293><PRE
294CLASS="PROGRAMLISTING"
295>  Name                            Meaning
296  ----------------------------------------------------------
297  Times-12                        12 point Times Roman
298  Times-12:bold                   12 point Times Bold
299  Courier:italic                  Courier Italic in the default size
300  Monospace:matrix=1 .1 0 1       The users preferred monospace font
301                                  with artificial obliquing
302    </PRE
303></TD
304></TR
305></TABLE
306><P
307>The '\', '-', ':' and ',' characters in family names must be preceded by a
308'\' character to avoid having them misinterpreted. Similarly, values
309containing '\', '=', '_', ':' and ',' must also have them preceded by a
310'\' character. The '\' characters are stripped out of the family name and
311values as the font name is read.
312    </P
313></DIV
314></DIV
315><DIV
316CLASS="REFSECT1"
317><A
318NAME="DEBUG"
319></A
320><H2
321>Debugging Applications</H2
322><P
323>To help diagnose font and applications problems, fontconfig is built with a
324large amount of internal debugging left enabled. It is controlled by means
325of the FC_DEBUG environment variable. The value of this variable is
326interpreted as a number, and each bit within that value controls different
327debugging messages.
328  </P
329><TABLE
330BORDER="0"
331BGCOLOR="#E0E0E0"
332WIDTH="100%"
333><TR
334><TD
335><PRE
336CLASS="PROGRAMLISTING"
337>  Name         Value    Meaning
338  ---------------------------------------------------------
339  MATCH            1    Brief information about font matching
340  MATCHV           2    Extensive font matching information
341  EDIT             4    Monitor match/test/edit execution
342  FONTSET          8    Track loading of font information at startup
343  CACHE           16    Watch cache files being written
344  CACHEV          32    Extensive cache file writing information
345  PARSE           64    (no longer in use)
346  SCAN           128    Watch font files being scanned to build caches
347  SCANV          256    Verbose font file scanning information
348  MEMORY         512    Monitor fontconfig memory usage
349  CONFIG        1024    Monitor which config files are loaded
350  LANGSET       2048    Dump char sets used to construct lang values
351  OBJTYPES      4096    Display message when value typechecks fail
352  </PRE
353></TD
354></TR
355></TABLE
356><P
357>Add the value of the desired debug levels together and assign that (in
358base 10) to the FC_DEBUG environment variable before running the
359application. Output from these statements is sent to stdout.
360  </P
361></DIV
362><DIV
363CLASS="REFSECT1"
364><A
365NAME="AEN48"
366></A
367><H2
368>Lang Tags</H2
369><P
370>Each font in the database contains a list of languages it supports.  This is
371computed by comparing the Unicode coverage of the font with the orthography
372of each language.  Languages are tagged using an RFC-3066 compatible naming
373and occur in two parts -- the ISO 639 language tag followed a hyphen and then
374by the ISO 3166 country code.  The hyphen and country code may be elided.
375  </P
376><P
377>Fontconfig has orthographies for several languages built into the library.
378No provision has been made for adding new ones aside from rebuilding the
379library.  It currently supports 122 of the 139 languages named in ISO 639-1,
380141 of the languages with two-letter codes from ISO 639-2 and another 30
381languages with only three-letter codes.  Languages with both two and three
382letter codes are provided with only the two letter code.
383  </P
384><P
385>For languages used in multiple territories with radically different
386character sets, fontconfig includes per-territory orthographies.  This
387includes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese.
388  </P
389></DIV
390><DIV
391CLASS="REFSECT1"
392><A
393NAME="AEN53"
394></A
395><H2
396>Configuration File Format</H2
397><P
398>Configuration files for fontconfig are stored in XML format; this
399format makes external configuration tools easier to write and ensures that
400they will generate syntactically correct configuration files.  As XML
401files are plain text, they can also be manipulated by the expert user using
402a text editor.
403  </P
404><P
405>The fontconfig document type definition resides in the external entity
406"fonts.dtd"; this is normally stored in the default font configuration
407directory (/etc/fonts).  Each configuration file should contain the
408following structure:
409    <TABLE
410BORDER="0"
411BGCOLOR="#E0E0E0"
412WIDTH="100%"
413><TR
414><TD
415><PRE
416CLASS="PROGRAMLISTING"
417>	&#60;?xml version="1.0"?&#62;
418	&#60;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&#62;
419	&#60;fontconfig&#62;
420	...
421	&#60;/fontconfig&#62;
422    </PRE
423></TD
424></TR
425></TABLE
426>
427  </P
428><DIV
429CLASS="REFSECT2"
430><A
431NAME="AEN58"
432></A
433><H3
434><TT
435CLASS="LITERAL"
436>&#60;fontconfig&#62;</TT
437></H3
438><P
439>This is the top level element for a font configuration and can contain
440<TT
441CLASS="LITERAL"
442>&#60;dir&#62;</TT
443>, <TT
444CLASS="LITERAL"
445>&#60;cachedir&#62;</TT
446>, <TT
447CLASS="LITERAL"
448>&#60;include&#62;</TT
449>, <TT
450CLASS="LITERAL"
451>&#60;match&#62;</TT
452> and <TT
453CLASS="LITERAL"
454>&#60;alias&#62;</TT
455> elements in any order.
456  </P
457></DIV
458><DIV
459CLASS="REFSECT2"
460><A
461NAME="AEN67"
462></A
463><H3
464><TT
465CLASS="LITERAL"
466>&#60;dir prefix="default"&#62;</TT
467></H3
468><P
469>This element contains a directory name which will be scanned for font files
470to 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.
471  </P
472></DIV
473><DIV
474CLASS="REFSECT2"
475><A
476NAME="AEN71"
477></A
478><H3
479><TT
480CLASS="LITERAL"
481>&#60;cachedir prefix="default"&#62;</TT
482></H3
483><P
484>This element contains a directory name that is supposed to be stored or read
485the cache of font information.  If multiple elements are specified in
486the configuration file, the directory that can be accessed first in the list
487will be used to store the cache files.  If it starts with '~', it refers to
488a 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.
489The default directory is ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files
490named ``<TT
491CLASS="LITERAL"
492>&#60;hash value&#62;</TT
493>-<TT
494CLASS="LITERAL"
495>&#60;architecture&#62;</TT
496>.cache-<TT
497CLASS="LITERAL"
498>&#60;version</TT
499>'',
500where <TT
501CLASS="LITERAL"
502>&#60;version&#62;</TT
503> is the font configureation file
504version number (currently 3).
505  </P
506></DIV
507><DIV
508CLASS="REFSECT2"
509><A
510NAME="AEN79"
511></A
512><H3
513><TT
514CLASS="LITERAL"
515>&#60;include ignore_missing="no" prefix="default"&#62;</TT
516></H3
517><P
518>This element contains the name of an additional configuration file or
519directory.  If a directory, every file within that directory starting with an
520ASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will be processed in sorted order.  When
521the XML datatype is traversed by FcConfigParse, the contents of the file(s)
522will also be incorporated into the configuration by passing the filename(s) to
523FcConfigLoadAndParse.  If 'ignore_missing' is set to "yes" instead of the
524default "no", a missing file or directory will elicit no warning message from
525the 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.
526  </P
527></DIV
528><DIV
529CLASS="REFSECT2"
530><A
531NAME="AEN83"
532></A
533><H3
534><TT
535CLASS="LITERAL"
536>&#60;config&#62;</TT
537></H3
538><P
539>This element provides a place to consolidate additional configuration
540information.  <TT
541CLASS="LITERAL"
542>&#60;config&#62;</TT
543> can contain <TT
544CLASS="LITERAL"
545>&#60;blank&#62;</TT
546> and <TT
547CLASS="LITERAL"
548>&#60;rescan&#62;</TT
549> elements in any
550order.
551  </P
552></DIV
553><DIV
554CLASS="REFSECT2"
555><A
556NAME="AEN90"
557></A
558><H3
559><TT
560CLASS="LITERAL"
561>&#60;blank&#62;</TT
562></H3
563><P
564>Fonts often include "broken" glyphs which appear in the encoding but are
565drawn as blanks on the screen.  Within the <TT
566CLASS="LITERAL"
567>&#60;blank&#62;</TT
568> element, place each
569Unicode characters which is supposed to be blank in an <TT
570CLASS="LITERAL"
571>&#60;int&#62;</TT
572> element.
573Characters outside of this set which are drawn as blank will be elided from
574the set of characters supported by the font.
575  </P
576></DIV
577><DIV
578CLASS="REFSECT2"
579><A
580NAME="AEN96"
581></A
582><H3
583><TT
584CLASS="LITERAL"
585>&#60;rescan&#62;</TT
586></H3
587><P
588>The <TT
589CLASS="LITERAL"
590>&#60;rescan&#62;</TT
591> element holds an <TT
592CLASS="LITERAL"
593>&#60;int&#62;</TT
594> element which indicates the default
595interval between automatic checks for font configuration changes.
596Fontconfig will validate all of the configuration files and directories and
597automatically rebuild the internal datastructures when this interval passes.
598  </P
599></DIV
600><DIV
601CLASS="REFSECT2"
602><A
603NAME="AEN102"
604></A
605><H3
606><TT
607CLASS="LITERAL"
608>&#60;selectfont&#62;</TT
609></H3
610><P
611>This element is used to black/white list fonts from being listed or matched
612against.  It holds acceptfont and rejectfont elements.
613  </P
614></DIV
615><DIV
616CLASS="REFSECT2"
617><A
618NAME="AEN106"
619></A
620><H3
621><TT
622CLASS="LITERAL"
623>&#60;acceptfont&#62;</TT
624></H3
625><P
626>Fonts matched by an acceptfont element are "whitelisted"; such fonts are
627explicitly included in the set of fonts used to resolve list and match
628requests; including them in this list protects them from being "blacklisted"
629by a rejectfont element.  Acceptfont elements include glob and pattern
630elements which are used to match fonts.
631  </P
632></DIV
633><DIV
634CLASS="REFSECT2"
635><A
636NAME="AEN110"
637></A
638><H3
639><TT
640CLASS="LITERAL"
641>&#60;rejectfont&#62;</TT
642></H3
643><P
644>Fonts matched by an rejectfont element are "blacklisted"; such fonts are
645excluded from the set of fonts used to resolve list and match requests as if
646they didn't exist in the system.  Rejectfont elements include glob and
647pattern elements which are used to match fonts.
648  </P
649></DIV
650><DIV
651CLASS="REFSECT2"
652><A
653NAME="AEN114"
654></A
655><H3
656><TT
657CLASS="LITERAL"
658>&#60;glob&#62;</TT
659></H3
660><P
661>Glob elements hold shell-style filename matching patterns (including ? and
662*) which match fonts based on their complete pathnames.  This can be used to
663exclude a set of directories (/usr/share/fonts/uglyfont*), or particular
664font file types (*.pcf.gz), but the latter mechanism relies rather heavily
665on filenaming conventions which can't be relied upon.  Note that globs
666only apply to directories, not to individual fonts.
667  </P
668></DIV
669><DIV
670CLASS="REFSECT2"
671><A
672NAME="AEN118"
673></A
674><H3
675><TT
676CLASS="LITERAL"
677>&#60;pattern&#62;</TT
678></H3
679><P
680>Pattern elements perform list-style matching on incoming fonts; that is,
681they hold a list of elements and associated values.  If all of those
682elements have a matching value, then the pattern matches the font.  This can
683be used to select fonts based on attributes of the font (scalable, bold,
684etc), which is a more reliable mechanism than using file extensions.
685Pattern elements include patelt elements.
686  </P
687></DIV
688><DIV
689CLASS="REFSECT2"
690><A
691NAME="AEN122"
692></A
693><H3
694><TT
695CLASS="LITERAL"
696>&#60;patelt name="property"&#62;</TT
697></H3
698><P
699>Patelt elements hold a single pattern element and list of values.  They must
700have a 'name' attribute which indicates the pattern element name.  Patelt
701elements include int, double, string, matrix, bool, charset and const
702elements.
703  </P
704></DIV
705><DIV
706CLASS="REFSECT2"
707><A
708NAME="AEN126"
709></A
710><H3
711><TT
712CLASS="LITERAL"
713>&#60;match target="pattern"&#62;</TT
714></H3
715><P
716>This element holds first a (possibly empty) list of <TT
717CLASS="LITERAL"
718>&#60;test&#62;</TT
719> elements and then
720a (possibly empty) list of <TT
721CLASS="LITERAL"
722>&#60;edit&#62;</TT
723> elements.  Patterns which match all of the
724tests are subjected to all the edits.  If 'target' is set to "font" instead
725of the default "pattern", then this element applies to the font name
726resulting from a match rather than a font pattern to be matched. If 'target'
727is set to "scan", then this element applies when the font is scanned to
728build the fontconfig database.
729  </P
730></DIV
731><DIV
732CLASS="REFSECT2"
733><A
734NAME="AEN132"
735></A
736><H3
737><TT
738CLASS="LITERAL"
739>&#60;test qual="any" name="property" target="default" compare="eq"&#62;</TT
740></H3
741><P
742>This element contains a single value which is compared with the target
743('pattern', 'font', 'scan' or 'default') property "property" (substitute any of the property names seen 
744above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", "more_eq", "contains" or
745"not_contains".  'qual' may either be the default, "any", in which case the match
746succeeds if any value associated with the property matches the test value, or
747"all", in which case all of the values associated with the property must
748match 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".
749When used in a &#60;match target="font"&#62; element,
750the target= attribute in the &#60;test&#62; element selects between matching
751the original pattern or the font.  "default" selects whichever target the
752outer &#60;match&#62; element has selected.
753  </P
754></DIV
755><DIV
756CLASS="REFSECT2"
757><A
758NAME="AEN136"
759></A
760><H3
761><TT
762CLASS="LITERAL"
763>&#60;edit name="property" mode="assign" binding="weak"&#62;</TT
764></H3
765><P
766>This element contains a list of expression elements (any of the value or
767operator elements).  The expression elements are evaluated at run-time and
768modify the property "property".  The modification depends on whether
769"property" was matched by one of the associated <TT
770CLASS="LITERAL"
771>&#60;test&#62;</TT
772> elements, if so, the
773modification may affect the first matched value.  Any values inserted into
774the property are given the indicated binding ("strong", "weak" or "same")
775with "same" binding using the value from the matched pattern element.
776'mode' is one of:
777    <TABLE
778BORDER="0"
779BGCOLOR="#E0E0E0"
780WIDTH="100%"
781><TR
782><TD
783><PRE
784CLASS="PROGRAMLISTING"
785>  Mode                    With Match              Without Match
786  ---------------------------------------------------------------------
787  "assign"                Replace matching value  Replace all values
788  "assign_replace"        Replace all values      Replace all values
789  "prepend"               Insert before matching  Insert at head of list
790  "prepend_first"         Insert at head of list  Insert at head of list
791  "append"                Append after matching   Append at end of list
792  "append_last"           Append at end of list   Append at end of list
793  "delete"                Delete matching value   Delete all values
794  "delete_all"            Delete all values       Delete all values
795    </PRE
796></TD
797></TR
798></TABLE
799>
800  </P
801></DIV
802><DIV
803CLASS="REFSECT2"
804><A
805NAME="AEN142"
806></A
807><H3
808><TT
809CLASS="LITERAL"
810>&#60;int&#62;</TT
811>, <TT
812CLASS="LITERAL"
813>&#60;double&#62;</TT
814>, <TT
815CLASS="LITERAL"
816>&#60;string&#62;</TT
817>, <TT
818CLASS="LITERAL"
819>&#60;bool&#62;</TT
820></H3
821><P
822>These elements hold a single value of the indicated type.  <TT
823CLASS="LITERAL"
824>&#60;bool&#62;</TT
825>
826elements hold either true or false.  An important limitation exists in
827the parsing of floating point numbers -- fontconfig requires that
828the mantissa start with a digit, not a decimal point, so insert a leading
829zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5
830instead of -.5).
831  </P
832></DIV
833><DIV
834CLASS="REFSECT2"
835><A
836NAME="AEN150"
837></A
838><H3
839><TT
840CLASS="LITERAL"
841>&#60;matrix&#62;</TT
842></H3
843><P
844>This element holds four numerical expressions of an affine transformation.
845At their simplest these will be four <TT
846CLASS="LITERAL"
847>&#60;double&#62;</TT
848> elements
849but they can also be more involved expressions.
850  </P
851></DIV
852><DIV
853CLASS="REFSECT2"
854><A
855NAME="AEN155"
856></A
857><H3
858><TT
859CLASS="LITERAL"
860>&#60;range&#62;</TT
861></H3
862><P
863>This element holds the two <TT
864CLASS="LITERAL"
865>&#60;int&#62;</TT
866> elements of a range
867representation.
868  </P
869></DIV
870><DIV
871CLASS="REFSECT2"
872><A
873NAME="AEN160"
874></A
875><H3
876><TT
877CLASS="LITERAL"
878>&#60;charset&#62;</TT
879></H3
880><P
881>This element holds at least one <TT
882CLASS="LITERAL"
883>&#60;int&#62;</TT
884> element of
885an Unicode code point or more.
886  </P
887></DIV
888><DIV
889CLASS="REFSECT2"
890><A
891NAME="AEN165"
892></A
893><H3
894><TT
895CLASS="LITERAL"
896>&#60;langset&#62;</TT
897></H3
898><P
899>This element holds at least one <TT
900CLASS="LITERAL"
901>&#60;string&#62;</TT
902> element of
903a RFC-3066-style languages or more.
904  </P
905></DIV
906><DIV
907CLASS="REFSECT2"
908><A
909NAME="AEN170"
910></A
911><H3
912><TT
913CLASS="LITERAL"
914>&#60;name&#62;</TT
915></H3
916><P
917>Holds a property name.  Evaluates to the first value from the property of
918the pattern.  If the 'target' attribute is not present, it will default to
919'default', in which case the property is returned from the font pattern
920during a target="font" match, and to the pattern during a target="pattern"
921match.  The attribute can also take the values 'font' or 'pattern' to
922explicitly choose which pattern to use.  It is an error to use a target
923of 'font' in a match that has target="pattern".
924  </P
925></DIV
926><DIV
927CLASS="REFSECT2"
928><A
929NAME="AEN174"
930></A
931><H3
932><TT
933CLASS="LITERAL"
934>&#60;const&#62;</TT
935></H3
936><P
937>Holds the name of a constant; these are always integers and serve as
938symbolic names for common font values:
939    <TABLE
940BORDER="0"
941BGCOLOR="#E0E0E0"
942WIDTH="100%"
943><TR
944><TD
945><PRE
946CLASS="PROGRAMLISTING"
947>  Constant        Property        Value
948  -------------------------------------
949  thin            weight          0
950  extralight      weight          40
951  ultralight      weight          40
952  light           weight          50
953  book            weight          75
954  regular         weight          80
955  normal          weight          80
956  medium          weight          100
957  demibold        weight          180
958  semibold        weight          180
959  bold            weight          200
960  extrabold       weight          205
961  black           weight          210
962  heavy           weight          210
963  roman           slant           0
964  italic          slant           100
965  oblique         slant           110
966  ultracondensed  width           50
967  extracondensed  width           63
968  condensed       width           75
969  semicondensed   width           87
970  normal          width           100
971  semiexpanded    width           113
972  expanded        width           125
973  extraexpanded   width           150
974  ultraexpanded   width           200
975  proportional    spacing         0
976  dual            spacing         90
977  mono            spacing         100
978  charcell        spacing         110
979  unknown         rgba            0
980  rgb             rgba            1
981  bgr             rgba            2
982  vrgb            rgba            3
983  vbgr            rgba            4
984  none            rgba            5
985  lcdnone         lcdfilter       0
986  lcddefault      lcdfilter       1
987  lcdlight        lcdfilter       2
988  lcdlegacy       lcdfilter       3
989  hintnone        hintstyle       0
990  hintslight      hintstyle       1
991  hintmedium      hintstyle       2
992  hintfull        hintstyle       3
993    </PRE
994></TD
995></TR
996></TABLE
997>
998      </P
999></DIV
1000><DIV
1001CLASS="REFSECT2"
1002><A
1003NAME="AEN179"
1004></A
1005><H3
1006><TT
1007CLASS="LITERAL"
1008>&#60;or&#62;</TT
1009>, <TT
1010CLASS="LITERAL"
1011>&#60;and&#62;</TT
1012>, <TT
1013CLASS="LITERAL"
1014>&#60;plus&#62;</TT
1015>, <TT
1016CLASS="LITERAL"
1017>&#60;minus&#62;</TT
1018>, <TT
1019CLASS="LITERAL"
1020>&#60;times&#62;</TT
1021>, <TT
1022CLASS="LITERAL"
1023>&#60;divide&#62;</TT
1024></H3
1025><P
1026>These elements perform the specified operation on a list of expression
1027elements.  <TT
1028CLASS="LITERAL"
1029>&#60;or&#62;</TT
1030> and <TT
1031CLASS="LITERAL"
1032>&#60;and&#62;</TT
1033> are boolean, not bitwise.
1034      </P
1035></DIV
1036><DIV
1037CLASS="REFSECT2"
1038><A
1039NAME="AEN190"
1040></A
1041><H3
1042><TT
1043CLASS="LITERAL"
1044>&#60;eq&#62;</TT
1045>, <TT
1046CLASS="LITERAL"
1047>&#60;not_eq&#62;</TT
1048>, <TT
1049CLASS="LITERAL"
1050>&#60;less&#62;</TT
1051>, <TT
1052CLASS="LITERAL"
1053>&#60;less_eq&#62;</TT
1054>, <TT
1055CLASS="LITERAL"
1056>&#60;more&#62;</TT
1057>, <TT
1058CLASS="LITERAL"
1059>&#60;more_eq&#62;</TT
1060>, <TT
1061CLASS="LITERAL"
1062>&#60;contains&#62;</TT
1063>, <TT
1064CLASS="LITERAL"
1065>&#60;not_contains</TT
1066></H3
1067><P
1068>These elements compare two values, producing a boolean result.
1069  </P
1070></DIV
1071><DIV
1072CLASS="REFSECT2"
1073><A
1074NAME="AEN201"
1075></A
1076><H3
1077><TT
1078CLASS="LITERAL"
1079>&#60;not&#62;</TT
1080></H3
1081><P
1082>Inverts the boolean sense of its one expression element
1083  </P
1084></DIV
1085><DIV
1086CLASS="REFSECT2"
1087><A
1088NAME="AEN205"
1089></A
1090><H3
1091><TT
1092CLASS="LITERAL"
1093>&#60;if&#62;</TT
1094></H3
1095><P
1096>This element takes three expression elements; if the value of the first is
1097true, it produces the value of the second, otherwise it produces the value
1098of the third.
1099  </P
1100></DIV
1101><DIV
1102CLASS="REFSECT2"
1103><A
1104NAME="AEN209"
1105></A
1106><H3
1107><TT
1108CLASS="LITERAL"
1109>&#60;alias&#62;</TT
1110></H3
1111><P
1112>Alias elements provide a shorthand notation for the set of common match
1113operations needed to substitute one font family for another.  They contain a
1114<TT
1115CLASS="LITERAL"
1116>&#60;family&#62;</TT
1117> element followed by optional <TT
1118CLASS="LITERAL"
1119>&#60;prefer&#62;</TT
1120>, <TT
1121CLASS="LITERAL"
1122>&#60;accept&#62;</TT
1123> and <TT
1124CLASS="LITERAL"
1125>&#60;default&#62;</TT
1126>
1127elements.  Fonts matching the <TT
1128CLASS="LITERAL"
1129>&#60;family&#62;</TT
1130> element are edited to prepend the
1131list of <TT
1132CLASS="LITERAL"
1133>&#60;prefer&#62;</TT
1134>ed families before the matching <TT
1135CLASS="LITERAL"
1136>&#60;family&#62;</TT
1137>, append the
1138<TT
1139CLASS="LITERAL"
1140>&#60;accept&#62;</TT
1141>able families after the matching <TT
1142CLASS="LITERAL"
1143>&#60;family&#62;</TT
1144> and append the <TT
1145CLASS="LITERAL"
1146>&#60;default&#62;</TT
1147>
1148families to the end of the family list.
1149  </P
1150></DIV
1151><DIV
1152CLASS="REFSECT2"
1153><A
1154NAME="AEN223"
1155></A
1156><H3
1157><TT
1158CLASS="LITERAL"
1159>&#60;family&#62;</TT
1160></H3
1161><P
1162>Holds a single font family name
1163  </P
1164></DIV
1165><DIV
1166CLASS="REFSECT2"
1167><A
1168NAME="AEN227"
1169></A
1170><H3
1171><TT
1172CLASS="LITERAL"
1173>&#60;prefer&#62;</TT
1174>, <TT
1175CLASS="LITERAL"
1176>&#60;accept&#62;</TT
1177>, <TT
1178CLASS="LITERAL"
1179>&#60;default&#62;</TT
1180></H3
1181><P
1182>These hold a list of <TT
1183CLASS="LITERAL"
1184>&#60;family&#62;</TT
1185> elements to be used by the <TT
1186CLASS="LITERAL"
1187>&#60;alias&#62;</TT
1188> element.
1189  </P
1190></DIV
1191></DIV
1192><DIV
1193CLASS="REFSECT1"
1194><A
1195NAME="AEN235"
1196></A
1197><H2
1198>EXAMPLE CONFIGURATION FILE</H2
1199><DIV
1200CLASS="REFSECT2"
1201><A
1202NAME="AEN237"
1203></A
1204><H3
1205>System configuration file</H3
1206><P
1207>This is an example of a system-wide configuration file
1208    </P
1209><TABLE
1210BORDER="0"
1211BGCOLOR="#E0E0E0"
1212WIDTH="100%"
1213><TR
1214><TD
1215><PRE
1216CLASS="PROGRAMLISTING"
1217>&#60;?xml version="1.0"?&#62;
1218&#60;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&#62;
1219&#60;!-- /etc/fonts/fonts.conf file to configure system font access --&#62;
1220&#60;fontconfig&#62;
1221&#60;!-- 
1222	Find fonts in these directories
1223--&#62;
1224&#60;dir&#62;/usr/share/fonts&#60;/dir&#62;
1225&#60;dir&#62;/usr/X11R6/lib/X11/fonts&#60;/dir&#62;
1226
1227&#60;!--
1228	Accept deprecated 'mono' alias, replacing it with 'monospace'
1229--&#62;
1230&#60;match target="pattern"&#62;
1231	&#60;test qual="any" name="family"&#62;&#60;string&#62;mono&#60;/string&#62;&#60;/test&#62;
1232	&#60;edit name="family" mode="assign"&#62;&#60;string&#62;monospace&#60;/string&#62;&#60;/edit&#62;
1233&#60;/match&#62;
1234
1235&#60;!--
1236	Names not including any well known alias are given 'sans-serif'
1237--&#62;
1238&#60;match target="pattern"&#62;
1239	&#60;test qual="all" name="family" mode="not_eq"&#62;&#60;string&#62;sans-serif&#60;/string&#62;&#60;/test&#62;
1240	&#60;test qual="all" name="family" mode="not_eq"&#62;&#60;string&#62;serif&#60;/string&#62;&#60;/test&#62;
1241	&#60;test qual="all" name="family" mode="not_eq"&#62;&#60;string&#62;monospace&#60;/string&#62;&#60;/test&#62;
1242	&#60;edit name="family" mode="append_last"&#62;&#60;string&#62;sans-serif&#60;/string&#62;&#60;/edit&#62;
1243&#60;/match&#62;
1244
1245&#60;!--
1246	Load per-user customization file, but don't complain
1247	if it doesn't exist
1248--&#62;
1249&#60;include ignore_missing="yes" prefix="xdg"&#62;fontconfig/fonts.conf&#60;/include&#62;
1250
1251&#60;!--
1252	Load local customization files, but don't complain
1253	if there aren't any
1254--&#62;
1255&#60;include ignore_missing="yes"&#62;conf.d&#60;/include&#62;
1256&#60;include ignore_missing="yes"&#62;local.conf&#60;/include&#62;
1257
1258&#60;!--
1259	Alias well known font names to available TrueType fonts.
1260	These substitute TrueType faces for similar Type1
1261	faces to improve screen appearance.
1262--&#62;
1263&#60;alias&#62;
1264	&#60;family&#62;Times&#60;/family&#62;
1265	&#60;prefer&#62;&#60;family&#62;Times New Roman&#60;/family&#62;&#60;/prefer&#62;
1266	&#60;default&#62;&#60;family&#62;serif&#60;/family&#62;&#60;/default&#62;
1267&#60;/alias&#62;
1268&#60;alias&#62;
1269	&#60;family&#62;Helvetica&#60;/family&#62;
1270	&#60;prefer&#62;&#60;family&#62;Arial&#60;/family&#62;&#60;/prefer&#62;
1271	&#60;default&#62;&#60;family&#62;sans&#60;/family&#62;&#60;/default&#62;
1272&#60;/alias&#62;
1273&#60;alias&#62;
1274	&#60;family&#62;Courier&#60;/family&#62;
1275	&#60;prefer&#62;&#60;family&#62;Courier New&#60;/family&#62;&#60;/prefer&#62;
1276	&#60;default&#62;&#60;family&#62;monospace&#60;/family&#62;&#60;/default&#62;
1277&#60;/alias&#62;
1278
1279&#60;!--
1280	Provide required aliases for standard names
1281	Do these after the users configuration file so that
1282	any aliases there are used preferentially
1283--&#62;
1284&#60;alias&#62;
1285	&#60;family&#62;serif&#60;/family&#62;
1286	&#60;prefer&#62;&#60;family&#62;Times New Roman&#60;/family&#62;&#60;/prefer&#62;
1287&#60;/alias&#62;
1288&#60;alias&#62;
1289	&#60;family&#62;sans&#60;/family&#62;
1290	&#60;prefer&#62;&#60;family&#62;Arial&#60;/family&#62;&#60;/prefer&#62;
1291&#60;/alias&#62;
1292&#60;alias&#62;
1293	&#60;family&#62;monospace&#60;/family&#62;
1294	&#60;prefer&#62;&#60;family&#62;Andale Mono&#60;/family&#62;&#60;/prefer&#62;
1295&#60;/alias&#62;
1296
1297&#60;--
1298	The example of the requirements of OR operator;
1299	If the 'family' contains 'Courier New' OR 'Courier'
1300	add 'monospace' as the alternative
1301--&#62;
1302&#60;match target="pattern"&#62;
1303	&#60;test name="family" mode="eq"&#62;
1304		&#60;string&#62;Courier New&#60;/string&#62;
1305	&#60;/test&#62;
1306	&#60;edit name="family" mode="prepend"&#62;
1307		&#60;string&#62;monospace&#60;/string&#62;
1308	&#60;/edit&#62;
1309&#60;/match&#62;
1310&#60;match target="pattern"&#62;
1311	&#60;test name="family" mode="eq"&#62;
1312		&#60;string&#62;Courier&#60;/string&#62;
1313	&#60;/test&#62;
1314	&#60;edit name="family" mode="prepend"&#62;
1315		&#60;string&#62;monospace&#60;/string&#62;
1316	&#60;/edit&#62;
1317&#60;/match&#62;
1318
1319&#60;/fontconfig&#62;
1320    </PRE
1321></TD
1322></TR
1323></TABLE
1324></DIV
1325><DIV
1326CLASS="REFSECT2"
1327><A
1328NAME="AEN241"
1329></A
1330><H3
1331>User configuration file</H3
1332><P
1333>This is an example of a per-user configuration file that lives in
1334$XDG_CONFIG_HOME/fontconfig/fonts.conf
1335    </P
1336><TABLE
1337BORDER="0"
1338BGCOLOR="#E0E0E0"
1339WIDTH="100%"
1340><TR
1341><TD
1342><PRE
1343CLASS="PROGRAMLISTING"
1344>&#60;?xml version="1.0"?&#62;
1345&#60;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&#62;
1346&#60;!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration --&#62;
1347&#60;fontconfig&#62;
1348
1349&#60;!--
1350	Private font directory
1351--&#62;
1352&#60;dir prefix="xdg"&#62;fonts&#60;/dir&#62;
1353
1354&#60;!--
1355	use rgb sub-pixel ordering to improve glyph appearance on
1356	LCD screens.  Changes affecting rendering, but not matching
1357	should always use target="font".
1358--&#62;
1359&#60;match target="font"&#62;
1360	&#60;edit name="rgba" mode="assign"&#62;&#60;const&#62;rgb&#60;/const&#62;&#60;/edit&#62;
1361&#60;/match&#62;
1362&#60;!--
1363	use WenQuanYi Zen Hei font when serif is requested for Chinese
1364--&#62;
1365&#60;match&#62;
1366	&#60;!--
1367		If you don't want to use WenQuanYi Zen Hei font for zh-tw etc,
1368		you can use zh-cn instead of zh.
1369		Please note, even if you set zh-cn, it still matches zh.
1370		if you don't like it, you can use compare="eq"
1371		instead of compare="contains".
1372	--&#62;
1373	&#60;test name="lang" compare="contains"&#62;
1374		&#60;string&#62;zh&#60;/string&#62;
1375	&#60;/test&#62;
1376	&#60;test name="family"&#62;
1377		&#60;string&#62;serif&#60;/string&#62;
1378	&#60;/test&#62;
1379	&#60;edit name="family" mode="prepend"&#62;
1380		&#60;string&#62;WenQuanYi Zen Hei&#60;/string&#62;
1381	&#60;/edit&#62;
1382&#60;/match&#62;
1383&#60;!--
1384	use VL Gothic font when sans-serif is requested for Japanese
1385--&#62;
1386&#60;match&#62;
1387	&#60;test name="lang" compare="contains"&#62;
1388		&#60;string&#62;ja&#60;/string&#62;
1389	&#60;/test&#62;
1390	&#60;test name="family"&#62;
1391		&#60;string&#62;sans-serif&#60;/string&#62;
1392	&#60;/test&#62;
1393	&#60;edit name="family" mode="prepend"&#62;
1394		&#60;string&#62;VL Gothic&#60;/string&#62;
1395	&#60;/edit&#62;
1396&#60;/match&#62;
1397&#60;/fontconfig&#62;
1398    </PRE
1399></TD
1400></TR
1401></TABLE
1402></DIV
1403></DIV
1404><DIV
1405CLASS="REFSECT1"
1406><A
1407NAME="AEN245"
1408></A
1409><H2
1410>Files</H2
1411><P
1412><I
1413CLASS="EMPHASIS"
1414>fonts.conf</I
1415>
1416contains configuration information for the fontconfig library
1417consisting of directories to look at for font information as well as
1418instructions on editing program specified font patterns before attempting to
1419match the available fonts.  It is in XML format.
1420  </P
1421><P
1422><I
1423CLASS="EMPHASIS"
1424>conf.d</I
1425>
1426is the conventional name for a directory of additional configuration files
1427managed by external applications or the local administrator.  The
1428filenames starting with decimal digits are sorted in lexicographic order
1429and used as additional configuration files.  All of these files are in XML
1430format.  The master fonts.conf file references this directory in an 
1431&#60;include&#62; directive.
1432  </P
1433><P
1434><I
1435CLASS="EMPHASIS"
1436>fonts.dtd</I
1437>
1438is a DTD that describes the format of the configuration files.
1439  </P
1440><P
1441><I
1442CLASS="EMPHASIS"
1443>$XDG_CONFIG_HOME/fontconfig/conf.d</I
1444> and <I
1445CLASS="EMPHASIS"
1446>~/.fonts.conf.d</I
1447>
1448is the conventional name for a per-user directory of (typically
1449auto-generated) configuration files, although the
1450actual 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.
1451  </P
1452><P
1453><I
1454CLASS="EMPHASIS"
1455>$XDG_CONFIG_HOME/fontconfig/fonts.conf</I
1456> and <I
1457CLASS="EMPHASIS"
1458>~/.fonts.conf</I
1459>
1460is the conventional location for per-user font configuration, although the
1461actual 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.
1462  </P
1463><P
1464><I
1465CLASS="EMPHASIS"
1466>$XDG_CACHE_HOME/fontconfig/*.cache-*</I
1467> and <I
1468CLASS="EMPHASIS"
1469> ~/.fontconfig/*.cache-*</I
1470>
1471is the conventional repository of font information that isn't found in the
1472per-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.
1473  </P
1474></DIV
1475><DIV
1476CLASS="REFSECT1"
1477><A
1478NAME="AEN262"
1479></A
1480><H2
1481>Environment variables</H2
1482><P
1483><I
1484CLASS="EMPHASIS"
1485>FONTCONFIG_FILE</I
1486>
1487is used to override the default configuration file.
1488  </P
1489><P
1490><I
1491CLASS="EMPHASIS"
1492>FONTCONFIG_PATH</I
1493>
1494is used to override the default configuration directory.
1495  </P
1496><P
1497><I
1498CLASS="EMPHASIS"
1499>FC_DEBUG</I
1500>
1501is used to output the detailed debugging messages. see <A
1502HREF="#DEBUG"
1503>Debugging Applications</A
1504> section for more details.
1505  </P
1506><P
1507><I
1508CLASS="EMPHASIS"
1509>FONTCONFIG_USE_MMAP</I
1510>
1511is 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.
1512  </P
1513></DIV
1514><DIV
1515CLASS="REFSECT1"
1516><A
1517NAME="AEN273"
1518></A
1519><H2
1520>See Also</H2
1521><P
1522>fc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1)
1523  </P
1524></DIV
1525><DIV
1526CLASS="REFSECT1"
1527><A
1528NAME="AEN276"
1529></A
1530><H2
1531>Version</H2
1532><P
1533>Fontconfig version 2.10.93
1534
1535	    </P
1536></DIV
1537></BODY
1538></HTML
1539>