fontconfig-user.sgml revision ae02b298
1<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [ 2<!ENTITY version SYSTEM "version.sgml"> 3<!ENTITY confdir SYSTEM "confdir.sgml"> 4]> 5<!-- 6 Copyright © 2003 Keith Packard 7 8 Permission to use, copy, modify, distribute, and sell this software and its 9 documentation for any purpose is hereby granted without fee, provided that 10 the above copyright notice appear in all copies and that both that 11 copyright notice and this permission notice appear in supporting 12 documentation, and that the name of the author(s) not be used in 13 advertising or publicity pertaining to distribution of the software without 14 specific, written prior permission. The authors make no 15 representations about the suitability of this software for any purpose. It 16 is provided "as is" without express or implied warranty. 17 18 THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 19 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 20 EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR 21 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 22 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 23 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 24 PERFORMANCE OF THIS SOFTWARE. 25--> 26<refentry> 27<refmeta> 28 <refentrytitle>fonts-conf</refentrytitle> 29 <manvolnum>5</manvolnum> 30</refmeta> 31<refnamediv> 32 <refname>fonts.conf</refname> 33 <refpurpose>Font configuration files</refpurpose> 34</refnamediv> 35<refsynopsisdiv> 36<synopsis> 37 &confdir;/fonts.conf 38 &confdir;/fonts.dtd 39 &confdir;/conf.d 40 $XDG_CONFIG_HOME/fontconfig/conf.d 41 $XDG_CONFIG_HOME/fontconfig/fonts.conf 42 ~/.fonts.conf.d 43 ~/.fonts.conf 44</synopsis> 45</refsynopsisdiv> 46<refsect1><title>Description</title> 47 <para> 48Fontconfig is a library designed to provide system-wide font configuration, 49customization and application access. 50 </para> 51</refsect1> 52<refsect1><title>Functional Overview</title> 53 <para> 54Fontconfig contains two essential modules, the configuration module which 55builds an internal configuration from XML files and the matching module 56which accepts font patterns and returns the nearest matching font. 57 </para> 58 <refsect2><title>Font Configuration</title> 59 <para> 60The configuration module consists of the FcConfig datatype, libexpat and 61FcConfigParse which walks over an XML tree and amends a configuration with 62data found within. From an external perspective, configuration of the 63library consists of generating a valid XML tree and feeding that to 64FcConfigParse. The only other mechanism provided to applications for 65changing the running configuration is to add fonts and directories to the 66list of application-provided font files. 67 </para><para> 68The intent is to make font configurations relatively static, and shared by 69as many applications as possible. It is hoped that this will lead to more 70stable font selection when passing names from one application to another. 71XML was chosen as a configuration file format because it provides a format 72which is easy for external agents to edit while retaining the correct 73structure and syntax. 74 </para><para> 75Font configuration is separate from font matching; applications needing to 76do their own matching can access the available fonts from the library and 77perform private matching. The intent is to permit applications to pick and 78choose appropriate functionality from the library instead of forcing them to 79choose between this library and a private configuration mechanism. The hope 80is that this will ensure that configuration of fonts for all applications 81can be centralized in one place. Centralizing font configuration will 82simplify and regularize font installation and customization. 83 </para> 84 </refsect2> 85 <refsect2> 86 <title>Font Properties</title> 87 <para> 88While font patterns may contain essentially any properties, there are some 89well known properties with associated types. Fontconfig uses some of these 90properties for font matching and font completion. Others are provided as a 91convenience for the applications' rendering mechanism. 92 </para> 93 <programlisting> 94Property Type Description 95-------------------------------------------------------------- 96family String Font family names 97familylang String Languages corresponding to each family 98style String Font style. Overrides weight and slant 99stylelang String Languages corresponding to each style 100fullname String Font full names (often includes style) 101fullnamelang String Languages corresponding to each fullname 102slant Int Italic, oblique or roman 103weight Int Light, medium, demibold, bold or black 104size Double Point size 105width Int Condensed, normal or expanded 106aspect Double Stretches glyphs horizontally before hinting 107pixelsize Double Pixel size 108spacing Int Proportional, dual-width, monospace or charcell 109foundry String Font foundry name 110antialias Bool Whether glyphs can be antialiased 111hinting Bool Whether the rasterizer should use hinting 112hintstyle Int Automatic hinting style 113verticallayout Bool Use vertical layout 114autohint Bool Use autohinter instead of normal hinter 115globaladvance Bool Use font global advance data (deprecated) 116file String The filename holding the font 117index Int The index of the font within the file 118ftface FT_Face Use the specified FreeType face object 119rasterizer String Which rasterizer is in use (deprecated) 120outline Bool Whether the glyphs are outlines 121scalable Bool Whether glyphs can be scaled 122color Bool Whether any glyphs have color 123scale Double Scale factor for point->pixel conversions 124 (deprecated) 125dpi Double Target dots per inch 126rgba Int unknown, rgb, bgr, vrgb, vbgr, 127 none - subpixel geometry 128lcdfilter Int Type of LCD filter 129minspace Bool Eliminate leading from line spacing 130charset CharSet Unicode chars encoded by the font 131lang String List of RFC-3066-style languages this 132 font supports 133fontversion Int Version number of the font 134capability String List of layout capabilities in the font 135fontformat String String name of the font format 136embolden Bool Rasterizer should synthetically embolden the font 137embeddedbitmap Bool Use the embedded bitmap instead of the outline 138decorative Bool Whether the style is a decorative variant 139fontfeatures String List of the feature tags in OpenType to be enabled 140namelang String Language name to be used for the default value of 141 familylang, stylelang, and fullnamelang 142prgname String String Name of the running program 143postscriptname String Font family name in PostScript 144fonthashint Bool Whether the font has hinting 145order Int Order number of the font 146 </programlisting> 147 </refsect2> 148 <refsect2> 149 <title>Font Matching</title> 150 <para> 151Fontconfig performs matching by measuring the distance from a provided 152pattern to all of the available fonts in the system. The closest matching 153font is selected. This ensures that a font will always be returned, but 154doesn't ensure that it is anything like the requested pattern. 155 </para><para> 156Font matching starts with an application constructed pattern. The desired 157attributes of the resulting font are collected together in a pattern. Each 158property of the pattern can contain one or more values; these are listed in 159priority order; matches earlier in the list are considered "closer" than 160matches later in the list. 161 </para><para> 162The initial pattern is modified by applying the list of editing instructions 163specific to patterns found in the configuration; each consists of a match 164predicate and a set of editing operations. They are executed in the order 165they appeared in the configuration. Each match causes the associated 166sequence of editing operations to be applied. 167 </para><para> 168After the pattern has been edited, a sequence of default substitutions are 169performed to canonicalize the set of available properties; this avoids the 170need for the lower layers to constantly provide default values for various 171font properties during rendering. 172 </para><para> 173The canonical font pattern is finally matched against all available fonts. 174The distance from the pattern to the font is measured for each of several 175properties: foundry, charset, family, lang, spacing, pixelsize, style, 176slant, weight, antialias, rasterizer and outline. This list is in priority 177order -- results of comparing earlier elements of this list weigh more 178heavily than later elements. 179 </para><para> 180There is one special case to this rule; family names are split into two 181bindings; strong and weak. Strong family names are given greater precedence 182in the match than lang elements while weak family names are given lower 183precedence than lang elements. This permits the document language to drive 184font selection when any document specified font is unavailable. 185 </para><para> 186The pattern representing that font is augmented to include any properties 187found in the pattern but not found in the font itself; this permits the 188application to pass rendering instructions or any other data through the 189matching system. Finally, the list of editing instructions specific to 190fonts found in the configuration are applied to the pattern. This modified 191pattern is returned to the application. 192 </para><para> 193The return value contains sufficient information to locate and rasterize the 194font, including the file name, pixel size and other rendering data. As 195none of the information involved pertains to the FreeType library, 196applications are free to use any rasterization engine or even to take 197the identified font file and access it directly. 198 </para><para> 199The match/edit sequences in the configuration are performed in two passes 200because there are essentially two different operations necessary -- the 201first is to modify how fonts are selected; aliasing families and adding 202suitable defaults. The second is to modify how the selected fonts are 203rasterized. Those must apply to the selected font, not the original pattern 204as false matches will often occur. 205 </para> 206 </refsect2> 207 <refsect2><title>Font Names</title> 208 <para> 209Fontconfig provides a textual representation for patterns that the library 210can both accept and generate. The representation is in three parts, first a 211list of family names, second a list of point sizes and finally a list of 212additional properties: 213 </para> 214 <programlisting> 215<families>-<point sizes>:<name1>=<values1>:<name2>=<values2>... 216 </programlisting> 217 <para> 218Values in a list are separated with commas. The name needn't include either 219families or point sizes; they can be elided. In addition, there are 220symbolic constants that simultaneously indicate both a name and a value. 221Here are some examples: 222 </para> 223 <programlisting> 224Name Meaning 225---------------------------------------------------------- 226Times-12 12 point Times Roman 227Times-12:bold 12 point Times Bold 228Courier:italic Courier Italic in the default size 229Monospace:matrix=1 .1 0 1 The users preferred monospace font 230 with artificial obliquing 231 </programlisting> 232 <para> 233The '\', '-', ':' and ',' characters in family names must be preceded by a 234'\' character to avoid having them misinterpreted. Similarly, values 235containing '\', '=', '_', ':' and ',' must also have them preceded by a 236'\' character. The '\' characters are stripped out of the family name and 237values as the font name is read. 238 </para> 239 </refsect2> 240</refsect1> 241<refsect1 id="debug"><title>Debugging Applications</title> 242 <para> 243To help diagnose font and applications problems, fontconfig is built with a 244large amount of internal debugging left enabled. It is controlled by means 245of the FC_DEBUG environment variable. The value of this variable is 246interpreted as a number, and each bit within that value controls different 247debugging messages. 248 </para> 249 <programlisting> 250Name Value Meaning 251--------------------------------------------------------- 252MATCH 1 Brief information about font matching 253MATCHV 2 Extensive font matching information 254EDIT 4 Monitor match/test/edit execution 255FONTSET 8 Track loading of font information at startup 256CACHE 16 Watch cache files being written 257CACHEV 32 Extensive cache file writing information 258PARSE 64 (no longer in use) 259SCAN 128 Watch font files being scanned to build caches 260SCANV 256 Verbose font file scanning information 261MEMORY 512 Monitor fontconfig memory usage 262CONFIG 1024 Monitor which config files are loaded 263LANGSET 2048 Dump char sets used to construct lang values 264MATCH2 4096 Display font-matching transformation in patterns 265 </programlisting> 266 <para> 267Add the value of the desired debug levels together and assign that (in 268base 10) to the FC_DEBUG environment variable before running the 269application. Output from these statements is sent to stdout. 270 </para> 271</refsect1> 272<refsect1><title>Lang Tags</title> 273 <para> 274Each font in the database contains a list of languages it supports. This is 275computed by comparing the Unicode coverage of the font with the orthography 276of each language. Languages are tagged using an RFC-3066 compatible naming 277and occur in two parts -- the ISO 639 language tag followed a hyphen and then 278by the ISO 3166 country code. The hyphen and country code may be elided. 279 </para><para> 280Fontconfig has orthographies for several languages built into the library. 281No provision has been made for adding new ones aside from rebuilding the 282library. It currently supports 122 of the 139 languages named in ISO 639-1, 283141 of the languages with two-letter codes from ISO 639-2 and another 30 284languages with only three-letter codes. Languages with both two and three 285letter codes are provided with only the two letter code. 286 </para><para> 287For languages used in multiple territories with radically different 288character sets, fontconfig includes per-territory orthographies. This 289includes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese. 290 </para> 291</refsect1> 292<refsect1><title>Configuration File Format</title> 293 <para> 294Configuration files for fontconfig are stored in XML format; this 295format makes external configuration tools easier to write and ensures that 296they will generate syntactically correct configuration files. As XML 297files are plain text, they can also be manipulated by the expert user using 298a text editor. 299 </para><para> 300The fontconfig document type definition resides in the external entity 301"fonts.dtd"; this is normally stored in the default font configuration 302directory (&confdir;). Each configuration file should contain the 303following structure: 304 <programlisting> 305<?xml version="1.0"?> 306<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 307<fontconfig> 308... 309</fontconfig> 310 </programlisting> 311 </para> 312<refsect2><title><literal><fontconfig></literal></title><para> 313This is the top level element for a font configuration and can contain 314<literal><dir></literal>, <literal><cachedir></literal>, <literal><include></literal>, <literal><match></literal> and <literal><alias></literal> elements in any order. 315 </para></refsect2> 316 <refsect2><title><literal><dir prefix="default" salt=""></literal></title><para> 317This element contains a directory name which will be scanned for font files 318to include in the set of available fonts. 319 </para><para> 320If 'prefix' is set to "default" or "cwd", the current working directory will be added as the path prefix prior to the value. 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. If 'prefix' is set to "relative", the path of current file will be added prior to the value. 321 </para><para> 322'salt' property affects to determine cache filename. this is useful for example when having different fonts sets on same path at container and share fonts from host on different font path. 323 </para></refsect2> 324 <refsect2><title><literal><cachedir prefix="default"></literal></title><para> 325This element contains a directory name that is supposed to be stored or read 326the cache of font information. If multiple elements are specified in 327the configuration file, the directory that can be accessed first in the list 328will be used to store the cache files. If it starts with '~', it refers to 329a 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. 330The default directory is ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files 331named ``<literal><hash value></literal>-<literal><architecture></literal>.cache-<literal><version></literal>'', 332where <literal><version></literal> is the fontconfig cache file 333version number (currently 8). 334 </para></refsect2> 335 <refsect2><title><literal><include ignore_missing="no" prefix="default"></literal></title><para> 336This element contains the name of an additional configuration file or 337directory. If a directory, every file within that directory starting with an 338ASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will be processed in sorted order. When 339the XML datatype is traversed by FcConfigParse, the contents of the file(s) 340will also be incorporated into the configuration by passing the filename(s) to 341FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the 342default "no", a missing file or directory will elicit no warning message from 343the 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. 344 </para></refsect2> 345 <refsect2><title><literal><config></literal></title><para> 346This element provides a place to consolidate additional configuration 347information. <literal><config></literal> can contain <literal><blank></literal> and <literal><rescan></literal> elements in any 348order. 349 </para></refsect2> 350 <refsect2><title><literal><description domain="fontconfig-conf"></literal></title><para> 351This element is supposed to hold strings which describe what a config is used for. 352This string can be translated through gettext. 'domain' needs to be set the proper name to apply then. 353fontconfig will tries to retrieve translations with 'domain' from gettext. 354 </para></refsect2> 355 <refsect2><title><literal><blank></literal></title><para> 356Fonts often include "broken" glyphs which appear in the encoding but are 357drawn as blanks on the screen. Within the <literal><blank></literal> element, place each 358Unicode characters which is supposed to be blank in an <literal><int></literal> element. 359Characters outside of this set which are drawn as blank will be elided from 360the set of characters supported by the font. 361 </para></refsect2> 362 <refsect2><title><literal><remap-dir prefix="default" as-path="" salt=""></literal></title><para> 363This element contains a directory name where will be mapped 364as the path 'as-path' in cached information. 365This is useful if the directory name is an alias 366(via a bind mount or symlink) to another directory in the system for 367which cached font information is likely to exist. 368 </para><para> 369'salt' property affects to determine cache filename as same as <literal><dir></literal> element. 370 </para></refsect2> 371 <refsect2><title><literal><reset-dirs /></literal></title><para> 372This element removes all of fonts directories where added by <literal><dir></literal> elements. 373This is useful to override fonts directories from system to own fonts directories only. 374 </para></refsect2> 375 <refsect2><title><literal><rescan></literal></title><para> 376The <literal><rescan></literal> element holds an <literal><int></literal> element which indicates the default 377interval between automatic checks for font configuration changes. 378Fontconfig will validate all of the configuration files and directories and 379automatically rebuild the internal datastructures when this interval passes. 380 </para></refsect2> 381 <refsect2><title><literal><selectfont></literal></title><para> 382This element is used to black/white list fonts from being listed or matched 383against. It holds acceptfont and rejectfont elements. 384 </para></refsect2> 385 <refsect2><title><literal><acceptfont></literal></title><para> 386Fonts matched by an acceptfont element are "whitelisted"; such fonts are 387explicitly included in the set of fonts used to resolve list and match 388requests; including them in this list protects them from being "blacklisted" 389by a rejectfont element. Acceptfont elements include glob and pattern 390elements which are used to match fonts. 391 </para></refsect2> 392 <refsect2><title><literal><rejectfont></literal></title><para> 393Fonts matched by an rejectfont element are "blacklisted"; such fonts are 394excluded from the set of fonts used to resolve list and match requests as if 395they didn't exist in the system. Rejectfont elements include glob and 396pattern elements which are used to match fonts. 397 </para></refsect2> 398 <refsect2><title><literal><glob></literal></title><para> 399Glob elements hold shell-style filename matching patterns (including ? and 400*) which match fonts based on their complete pathnames. If it starts with '~', 401it refers to a directory in the users home directory. This can be used to 402exclude a set of directories (/usr/share/fonts/uglyfont*), or particular 403font file types (*.pcf.gz), but the latter mechanism relies rather heavily 404on filenaming conventions which can't be relied upon. Note that globs 405only apply to directories, not to individual fonts. 406 </para></refsect2> 407 <refsect2><title><literal><pattern></literal></title><para> 408Pattern elements perform list-style matching on incoming fonts; that is, 409they hold a list of elements and associated values. If all of those 410elements have a matching value, then the pattern matches the font. This can 411be used to select fonts based on attributes of the font (scalable, bold, 412etc), which is a more reliable mechanism than using file extensions. 413Pattern elements include patelt elements. 414 </para></refsect2> 415 <refsect2><title><literal><patelt name="property"></literal></title><para> 416Patelt elements hold a single pattern element and list of values. They must 417have a 'name' attribute which indicates the pattern element name. Patelt 418elements include int, double, string, matrix, bool, charset and const 419elements. 420 </para></refsect2> 421 <refsect2><title><literal><match target="pattern"></literal></title><para> 422This element holds first a (possibly empty) list of <literal><test></literal> elements and then 423a (possibly empty) list of <literal><edit></literal> elements. Patterns which match all of the 424tests are subjected to all the edits. If 'target' is set to "font" instead 425of the default "pattern", then this element applies to the font name 426resulting from a match rather than a font pattern to be matched. If 'target' 427is set to "scan", then this element applies when the font is scanned to 428build the fontconfig database. 429 </para></refsect2> 430 <refsect2><title><literal><test qual="any" name="property" target="default" compare="eq"></literal></title><para> 431This element contains a single value which is compared with the target 432('pattern', 'font', 'scan' or 'default') property "property" (substitute any of the property names seen 433above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", "more_eq", "contains" or 434"not_contains". 'qual' may either be the default, "any", in which case the match 435succeeds if any value associated with the property matches the test value, or 436"all", in which case all of the values associated with the property must 437match 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". 438When used in a <match target="font"> element, 439the target= attribute in the <test> element selects between matching 440the original pattern or the font. "default" selects whichever target the 441outer <match> element has selected. 442 </para></refsect2> 443 <refsect2><title><literal><edit name="property" mode="assign" binding="weak"></literal></title><para> 444This element contains a list of expression elements (any of the value or 445operator elements). The expression elements are evaluated at run-time and 446modify the property "property". The modification depends on whether 447"property" was matched by one of the associated <literal><test></literal> elements, if so, the 448modification may affect the first matched value. Any values inserted into 449the property are given the indicated binding ("strong", "weak" or "same") 450with "same" binding using the value from the matched pattern element. 451'mode' is one of: 452 <programlisting> 453Mode With Match Without Match 454--------------------------------------------------------------------- 455"assign" Replace matching value Replace all values 456"assign_replace" Replace all values Replace all values 457"prepend" Insert before matching Insert at head of list 458"prepend_first" Insert at head of list Insert at head of list 459"append" Append after matching Append at end of list 460"append_last" Append at end of list Append at end of list 461"delete" Delete matching value Delete all values 462"delete_all" Delete all values Delete all values 463 </programlisting> 464 </para></refsect2> 465 <refsect2><title><literal><int></literal>, <literal><double></literal>, <literal><string></literal>, <literal><bool></literal></title><para> 466These elements hold a single value of the indicated type. <literal><bool></literal> 467elements hold either true or false. An important limitation exists in 468the parsing of floating point numbers -- fontconfig requires that 469the mantissa start with a digit, not a decimal point, so insert a leading 470zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5 471instead of -.5). 472 </para></refsect2> 473 <refsect2><title><literal><matrix></literal></title><para> 474This element holds four numerical expressions of an affine transformation. 475At their simplest these will be four <literal><double></literal> elements 476but they can also be more involved expressions. 477 </para></refsect2> 478 <refsect2><title><literal><range></literal></title><para> 479This element holds the two <literal><int></literal> elements of a range 480representation. 481 </para></refsect2> 482 <refsect2><title><literal><charset></literal></title><para> 483This element holds at least one <literal><int></literal> element of 484an Unicode code point or more. 485 </para></refsect2> 486 <refsect2><title><literal><langset></literal></title><para> 487This element holds at least one <literal><string></literal> element of 488a RFC-3066-style languages or more. 489 </para></refsect2> 490 <refsect2><title><literal><name></literal></title><para> 491Holds a property name. Evaluates to the first value from the property of 492the pattern. If the 'target' attribute is not present, it will default to 493'default', in which case the property is returned from the font pattern 494during a target="font" match, and to the pattern during a target="pattern" 495match. The attribute can also take the values 'font' or 'pattern' to 496explicitly choose which pattern to use. It is an error to use a target 497of 'font' in a match that has target="pattern". 498 </para></refsect2> 499 <refsect2><title><literal><const></literal></title><para> 500Holds the name of a constant; these are always integers and serve as 501symbolic names for common font values: 502 <programlisting> 503Constant Property Value 504------------------------------------- 505thin weight 0 506extralight weight 40 507ultralight weight 40 508light weight 50 509demilight weight 55 510semilight weight 55 511book weight 75 512regular weight 80 513normal weight 80 514medium weight 100 515demibold weight 180 516semibold weight 180 517bold weight 200 518extrabold weight 205 519ultrabold weight 205 520black weight 210 521heavy weight 210 522extrablack weight 215 523ultrablack weight 215 524roman slant 0 525italic slant 100 526oblique slant 110 527ultracondensed width 50 528extracondensed width 63 529condensed width 75 530semicondensed width 87 531normal width 100 532semiexpanded width 113 533expanded width 125 534extraexpanded width 150 535ultraexpanded width 200 536proportional spacing 0 537dual spacing 90 538mono spacing 100 539charcell spacing 110 540unknown rgba 0 541rgb rgba 1 542bgr rgba 2 543vrgb rgba 3 544vbgr rgba 4 545none rgba 5 546lcdnone lcdfilter 0 547lcddefault lcdfilter 1 548lcdlight lcdfilter 2 549lcdlegacy lcdfilter 3 550hintnone hintstyle 0 551hintslight hintstyle 1 552hintmedium hintstyle 2 553hintfull hintstyle 3 554 </programlisting> 555 </para> 556 </refsect2> 557 <refsect2> 558 <title><literal><or></literal>, <literal><and></literal>, <literal><plus></literal>, <literal><minus></literal>, <literal><times></literal>, <literal><divide></literal></title> 559 <para> 560These elements perform the specified operation on a list of expression 561elements. <literal><or></literal> and <literal><and></literal> are boolean, not bitwise. 562 </para> 563 </refsect2> 564 <refsect2> 565 <title><literal><eq></literal>, <literal><not_eq></literal>, <literal><less></literal>, <literal><less_eq></literal>, <literal><more></literal>, <literal><more_eq></literal>, <literal><contains></literal>, <literal><not_contains</literal></title> 566 <para> 567These elements compare two values, producing a boolean result. 568 </para></refsect2> 569 <refsect2><title><literal><not></literal></title><para> 570Inverts the boolean sense of its one expression element 571 </para></refsect2> 572 <refsect2><title><literal><if></literal></title><para> 573This element takes three expression elements; if the value of the first is 574true, it produces the value of the second, otherwise it produces the value 575of the third. 576 </para></refsect2> 577 <refsect2><title><literal><alias></literal></title><para> 578Alias elements provide a shorthand notation for the set of common match 579operations needed to substitute one font family for another. They contain a 580<literal><family></literal> element followed by optional <literal><prefer></literal>, <literal><accept></literal> and <literal><default></literal> 581elements. Fonts matching the <literal><family></literal> element are edited to prepend the 582list of <literal><prefer></literal>ed families before the matching <literal><family></literal>, append the 583<literal><accept></literal>able families after the matching <literal><family></literal> and append the <literal><default></literal> 584families to the end of the family list. 585 </para></refsect2> 586 <refsect2><title><literal><family></literal></title><para> 587Holds a single font family name 588 </para></refsect2> 589 <refsect2><title><literal><prefer></literal>, <literal><accept></literal>, <literal><default></literal></title><para> 590These hold a list of <literal><family></literal> elements to be used by the <literal><alias></literal> element. 591 </para></refsect2> 592</refsect1> 593<refsect1><title>EXAMPLE CONFIGURATION FILE</title> 594 <refsect2><title>System configuration file</title> 595 <para> 596This is an example of a system-wide configuration file 597 </para> 598 <programlisting> 599<?xml version="1.0"?> 600<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 601<!-- &confdir;/fonts.conf file to configure system font access --> 602<fontconfig> 603 <!-- 604 Find fonts in these directories 605 --> 606 <dir>/usr/share/fonts</dir> 607 <dir>/usr/X11R6/lib/X11/fonts</dir> 608 609 <!-- 610 Accept deprecated 'mono' alias, replacing it with 'monospace' 611 --> 612 <match target="pattern"> 613 <test qual="any" name="family"> 614 <string>mono</string> 615 </test> 616 <edit name="family" mode="assign"> 617 <string>monospace</string> 618 </edit> 619 </match> 620 621 <!-- 622 Names not including any well known alias are given 'sans-serif' 623 --> 624 <match target="pattern"> 625 <test qual="all" name="family" compare="not_eq"> 626 <string>sans-serif</string> 627 </test> 628 <test qual="all" name="family" compare="not_eq"> 629 <string>serif</string> 630 </test> 631 <test qual="all" name="family" compare="not_eq"> 632 <string>monospace</string> 633 </test> 634 <edit name="family" mode="append_last"> 635 <string>sans-serif</string> 636 </edit> 637 </match> 638 639 <!-- 640 Load per-user customization file, but don't complain 641 if it doesn't exist 642 --> 643 <include ignore_missing="yes" prefix="xdg"> 644 fontconfig/fonts.conf 645 </include> 646 647 <!-- 648 Load local customization files, but don't complain 649 if there aren't any 650 --> 651 <include ignore_missing="yes">conf.d</include> 652 <include ignore_missing="yes">local.conf</include> 653 654 <!-- 655 Alias well known font names to available TrueType fonts. 656 These substitute TrueType faces for similar Type1 657 faces to improve screen appearance. 658 --> 659 <alias> 660 <family>Times</family> 661 <prefer> 662 <family>Times New Roman</family> 663 </prefer> 664 <default> 665 <family>serif</family> 666 </default> 667 </alias> 668 <alias> 669 <family>Helvetica</family> 670 <prefer> 671 <family>Arial</family> 672 </prefer> 673 <default> 674 <family>sans</family> 675 </default> 676 </alias> 677 <alias> 678 <family>Courier</family> 679 <prefer> 680 <family>Courier New</family> 681 </prefer> 682 <default> 683 <family>monospace</family> 684 </default> 685 </alias> 686 687 <!-- 688 Provide required aliases for standard names 689 Do these after the users configuration file so that 690 any aliases there are used preferentially 691 --> 692 <alias> 693 <family>serif</family> 694 <prefer> 695 <family>Times New Roman</family> 696 </prefer> 697 </alias> 698 <alias> 699 <family>sans</family> 700 <prefer> 701 <family>Arial</family> 702 </prefer> 703 </alias> 704 <alias> 705 <family>monospace</family> 706 <prefer> 707 <family>Andale Mono</family> 708 </prefer> 709 </alias> 710 711 <-- 712 The example of the requirements of OR operator; 713 If the 'family' contains 'Courier New' OR 'Courier' 714 add 'monospace' as the alternative 715 --> 716 <match target="pattern"> 717 <test name="family" compare="eq"> 718 <string>Courier New</string> 719 </test> 720 <edit name="family" mode="prepend"> 721 <string>monospace</string> 722 </edit> 723 </match> 724 <match target="pattern"> 725 <test name="family" compare="eq"> 726 <string>Courier</string> 727 </test> 728 <edit name="family" mode="prepend"> 729 <string>monospace</string> 730 </edit> 731 </match> 732 733</fontconfig> 734 </programlisting> 735 </refsect2> 736 <refsect2><title>User configuration file</title> 737 <para> 738This is an example of a per-user configuration file that lives in 739$XDG_CONFIG_HOME/fontconfig/fonts.conf 740 </para> 741 <programlisting> 742<?xml version="1.0"?> 743<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 744<!-- 745 $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration 746--> 747<fontconfig> 748 749 <!-- 750 Private font directory 751 --> 752 <dir prefix="xdg">fonts</dir> 753 754 <!-- 755 use rgb sub-pixel ordering to improve glyph appearance on 756 LCD screens. Changes affecting rendering, but not matching 757 should always use target="font". 758 --> 759 <match target="font"> 760 <edit name="rgba" mode="assign"> 761 <const>rgb</const> 762 </edit> 763 </match> 764 <!-- 765 use WenQuanYi Zen Hei font when serif is requested for Chinese 766 --> 767 <match> 768 <!-- 769 If you don't want to use WenQuanYi Zen Hei font for zh-tw etc, 770 you can use zh-cn instead of zh. 771 Please note, even if you set zh-cn, it still matches zh. 772 if you don't like it, you can use compare="eq" 773 instead of compare="contains". 774 --> 775 <test name="lang" compare="contains"> 776 <string>zh</string> 777 </test> 778 <test name="family"> 779 <string>serif</string> 780 </test> 781 <edit name="family" mode="prepend"> 782 <string>WenQuanYi Zen Hei</string> 783 </edit> 784 </match> 785 <!-- 786 use VL Gothic font when sans-serif is requested for Japanese 787 --> 788 <match> 789 <test name="lang" compare="contains"> 790 <string>ja</string> 791 </test> 792 <test name="family"> 793 <string>sans-serif</string> 794 </test> 795 <edit name="family" mode="prepend"> 796 <string>VL Gothic</string> 797 </edit> 798 </match> 799</fontconfig> 800 </programlisting> 801 </refsect2> 802</refsect1> 803<refsect1><title>Files</title> 804 <para> 805<emphasis>fonts.conf</emphasis> 806contains configuration information for the fontconfig library 807consisting of directories to look at for font information as well as 808instructions on editing program specified font patterns before attempting to 809match the available fonts. It is in XML format. 810 </para> 811 <para> 812<emphasis>conf.d</emphasis> 813is the conventional name for a directory of additional configuration files 814managed by external applications or the local administrator. The 815filenames starting with decimal digits are sorted in lexicographic order 816and used as additional configuration files. All of these files are in XML 817format. The master fonts.conf file references this directory in an 818<include> directive. 819 </para> 820 <para> 821<emphasis>fonts.dtd</emphasis> 822is a DTD that describes the format of the configuration files. 823 </para> 824 <para> 825<emphasis>$XDG_CONFIG_HOME/fontconfig/conf.d</emphasis> and <emphasis>~/.fonts.conf.d</emphasis> 826is the conventional name for a per-user directory of (typically 827auto-generated) configuration files, although the 828actual 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. 829 </para> 830 <para> 831<emphasis>$XDG_CONFIG_HOME/fontconfig/fonts.conf</emphasis> and <emphasis>~/.fonts.conf</emphasis> 832is the conventional location for per-user font configuration, although the 833actual 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. 834 </para> 835 <para> 836<emphasis>$XDG_CACHE_HOME/fontconfig/*.cache-*</emphasis> and <emphasis> ~/.fontconfig/*.cache-*</emphasis> 837is the conventional repository of font information that isn't found in the 838per-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. 839 </para> 840</refsect1> 841<refsect1><title>Environment variables</title> 842 <para> 843<emphasis>FONTCONFIG_FILE</emphasis> 844is used to override the default configuration file. 845 </para> 846 <para> 847<emphasis>FONTCONFIG_PATH</emphasis> 848is used to override the default configuration directory. 849 </para> 850 <para> 851<emphasis>FONTCONFIG_SYSROOT</emphasis> 852is used to set a default sysroot directory. 853 </para> 854 <para> 855<emphasis>FC_DEBUG</emphasis> 856is used to output the detailed debugging messages. see <link linkend="debug">Debugging Applications</link> section for more details. 857 </para> 858 <para> 859<emphasis>FC_DBG_MATCH_FILTER</emphasis> 860is used to filter out the patterns. this takes a comma-separated list of object names and effects only when FC_DEBUG has MATCH2. see <link linkend="debug">Debugging Applications</link> section for more details. 861 </para> 862 <para> 863<emphasis>FC_LANG</emphasis> 864is used to specify the default language as the weak binding in the query. if this isn't set, the default language will be determined from current locale. 865 </para> 866 <para> 867<emphasis>FONTCONFIG_USE_MMAP</emphasis> 868is 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. 869 </para> 870 <para> 871<emphasis>SOURCE_DATE_EPOCH</emphasis> 872is used to ensure <literal>fc-cache(1)</literal> generates files in a deterministic manner in order to support reproducible builds. When set to a numeric representation of UNIX timestamp, fontconfig will prefer this value over using the modification timestamps of the input files in order to identify which cache files require regeneration. If <literal>SOURCE_DATE_EPOCH</literal> is not set (or is newer than the mtime of the directory), the existing behaviour is unchanged. 873 </para> 874</refsect1> 875<refsect1><title>See Also</title> 876 <para> 877fc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1), <ulink url="https://reproducible-builds.org/specs/source-date-epoch/">SOURCE_DATE_EPOCH</ulink>. 878 </para> 879</refsect1> 880<refsect1><title>Version</title> 881 <para> 882Fontconfig version &version; 883 </para> 884</refsect1> 885</refentry> 886