fontconfig-user.txt revision eceda581
1eceda581Smrg fonts-conf 22c393a42Smrg 32c393a42SmrgName 42c393a42Smrg 5eceda581Smrg fonts.conf -- Font configuration files 62c393a42Smrg 72c393a42SmrgSynopsis 82c393a42Smrg 9eceda581Smrg /etc/fonts/fonts.conf 10eceda581Smrg /etc/fonts/fonts.dtd 11eceda581Smrg /etc/fonts/conf.d 12eceda581Smrg $XDG_CONFIG_HOME/fontconfig/conf.d 13eceda581Smrg $XDG_CONFIG_HOME/fontconfig/fonts.conf 14eceda581Smrg ~/.fonts.conf.d 15eceda581Smrg ~/.fonts.conf 162c393a42Smrg 172c393a42SmrgDescription 182c393a42Smrg 19ca08ab68Smrg Fontconfig is a library designed to provide system-wide font 20ca08ab68Smrg configuration, customization and application access. 212c393a42Smrg 222c393a42SmrgFunctional Overview 232c393a42Smrg 24eceda581Smrg Fontconfig contains two essential modules, the configuration 25eceda581Smrg module which builds an internal configuration from XML files 26eceda581Smrg and the matching module which accepts font patterns and returns 27eceda581Smrg the nearest matching font. 28eceda581Smrg 29eceda581SmrgFont Configuration 30eceda581Smrg 31eceda581Smrg The configuration module consists of the FcConfig datatype, 32eceda581Smrg libexpat and FcConfigParse which walks over an XML tree and 33eceda581Smrg amends a configuration with data found within. From an external 34eceda581Smrg perspective, configuration of the library consists of 35eceda581Smrg generating a valid XML tree and feeding that to FcConfigParse. 36eceda581Smrg The only other mechanism provided to applications for changing 37eceda581Smrg the running configuration is to add fonts and directories to 38eceda581Smrg the list of application-provided font files. 39eceda581Smrg 40eceda581Smrg The intent is to make font configurations relatively static, 41eceda581Smrg and shared by as many applications as possible. It is hoped 42eceda581Smrg that this will lead to more stable font selection when passing 43eceda581Smrg names from one application to another. XML was chosen as a 44eceda581Smrg configuration file format because it provides a format which is 45eceda581Smrg easy for external agents to edit while retaining the correct 46ca08ab68Smrg structure and syntax. 47ca08ab68Smrg 48eceda581Smrg Font configuration is separate from font matching; applications 49eceda581Smrg needing to do their own matching can access the available fonts 50eceda581Smrg from the library and perform private matching. The intent is to 51eceda581Smrg permit applications to pick and choose appropriate 52eceda581Smrg functionality from the library instead of forcing them to 53eceda581Smrg choose between this library and a private configuration 54eceda581Smrg mechanism. The hope is that this will ensure that configuration 55eceda581Smrg of fonts for all applications can be centralized in one place. 56eceda581Smrg Centralizing font configuration will simplify and regularize 57eceda581Smrg font installation and customization. 58eceda581Smrg 59eceda581SmrgFont Properties 60eceda581Smrg 61eceda581Smrg While font patterns may contain essentially any properties, 62eceda581Smrg there are some well known properties with associated types. 63eceda581Smrg Fontconfig uses some of these properties for font matching and 64eceda581Smrg font completion. Others are provided as a convenience for the 65eceda581Smrg applications' rendering mechanism. 66953daebaSmrg Property Type Description 67953daebaSmrg -------------------------------------------------------------- 68953daebaSmrg family String Font family names 69953daebaSmrg familylang String Languages corresponding to each family 70953daebaSmrg style String Font style. Overrides weight and slant 71953daebaSmrg stylelang String Languages corresponding to each style 72953daebaSmrg fullname String Font full names (often includes style) 73953daebaSmrg fullnamelang String Languages corresponding to each fullname 74953daebaSmrg slant Int Italic, oblique or roman 75953daebaSmrg weight Int Light, medium, demibold, bold or black 76953daebaSmrg size Double Point size 77953daebaSmrg width Int Condensed, normal or expanded 78953daebaSmrg aspect Double Stretches glyphs horizontally before hinting 79953daebaSmrg pixelsize Double Pixel size 80eceda581Smrg spacing Int Proportional, dual-width, monospace or charcel 81eceda581Smrgl 82953daebaSmrg foundry String Font foundry name 83953daebaSmrg antialias Bool Whether glyphs can be antialiased 84953daebaSmrg hinting Bool Whether the rasterizer should use hinting 85953daebaSmrg hintstyle Int Automatic hinting style 86953daebaSmrg verticallayout Bool Use vertical layout 87953daebaSmrg autohint Bool Use autohinter instead of normal hinter 88953daebaSmrg globaladvance Bool Use font global advance data (deprecated) 89953daebaSmrg file String The filename holding the font 90953daebaSmrg index Int The index of the font within the file 91953daebaSmrg ftface FT_Face Use the specified FreeType face object 92953daebaSmrg rasterizer String Which rasterizer is in use (deprecated) 93953daebaSmrg outline Bool Whether the glyphs are outlines 94953daebaSmrg scalable Bool Whether glyphs can be scaled 95953daebaSmrg color Bool Whether any glyphs have color 96eceda581Smrg scale Double Scale factor for point->pixel conversions (dep 97eceda581Smrgrecated) 98953daebaSmrg dpi Double Target dots per inch 99953daebaSmrg rgba Int unknown, rgb, bgr, vrgb, vbgr, 100953daebaSmrg none - subpixel geometry 101953daebaSmrg lcdfilter Int Type of LCD filter 102953daebaSmrg minspace Bool Eliminate leading from line spacing 103953daebaSmrg charset CharSet Unicode chars encoded by the font 104953daebaSmrg lang String List of RFC-3066-style languages this 105953daebaSmrg font supports 106953daebaSmrg fontversion Int Version number of the font 107953daebaSmrg capability String List of layout capabilities in the font 108953daebaSmrg fontformat String String name of the font format 109eceda581Smrg embolden Bool Rasterizer should synthetically embolden the f 110eceda581Smrgont 111953daebaSmrg embeddedbitmap Bool Use the embedded bitmap instead of the outline 112953daebaSmrg decorative Bool Whether the style is a decorative variant 113eceda581Smrg fontfeatures String List of the feature tags in OpenType to be ena 114eceda581Smrgbled 115eceda581Smrg namelang String Language name to be used for the default value 116eceda581Smrg of 117953daebaSmrg familylang, stylelang, and fullnamelang 118953daebaSmrg prgname String String Name of the running program 119953daebaSmrg postscriptname String Font family name in PostScript 120a4e54154Smrg fonthashint Bool Whether the font has hinting 121a4e54154Smrg order Int Order number of the font 122953daebaSmrg 123eceda581SmrgFont Matching 124953daebaSmrg 125eceda581Smrg Fontconfig performs matching by measuring the distance from a 126eceda581Smrg provided pattern to all of the available fonts in the system. 127eceda581Smrg The closest matching font is selected. This ensures that a font 128eceda581Smrg will always be returned, but doesn't ensure that it is anything 129eceda581Smrg like the requested pattern. 130a32e9e42Smrg 131eceda581Smrg Font matching starts with an application constructed pattern. 132eceda581Smrg The desired attributes of the resulting font are collected 133eceda581Smrg together in a pattern. Each property of the pattern can contain 134eceda581Smrg one or more values; these are listed in priority order; matches 135eceda581Smrg earlier in the list are considered "closer" than matches later 136eceda581Smrg in the list. 137ca08ab68Smrg 138ca08ab68Smrg The initial pattern is modified by applying the list of editing 139eceda581Smrg instructions specific to patterns found in the configuration; 140eceda581Smrg each consists of a match predicate and a set of editing 141eceda581Smrg operations. They are executed in the order they appeared in the 142eceda581Smrg configuration. Each match causes the associated sequence of 143eceda581Smrg editing operations to be applied. 144eceda581Smrg 145eceda581Smrg After the pattern has been edited, a sequence of default 146eceda581Smrg substitutions are performed to canonicalize the set of 147eceda581Smrg available properties; this avoids the need for the lower layers 148eceda581Smrg to constantly provide default values for various font 149eceda581Smrg properties during rendering. 150eceda581Smrg 151eceda581Smrg The canonical font pattern is finally matched against all 152eceda581Smrg available fonts. The distance from the pattern to the font is 153eceda581Smrg measured for each of several properties: foundry, charset, 154eceda581Smrg family, lang, spacing, pixelsize, style, slant, weight, 155eceda581Smrg antialias, rasterizer and outline. This list is in priority 156eceda581Smrg order -- results of comparing earlier elements of this list 157eceda581Smrg weigh more heavily than later elements. 158eceda581Smrg 159eceda581Smrg There is one special case to this rule; family names are split 160eceda581Smrg into two bindings; strong and weak. Strong family names are 161eceda581Smrg given greater precedence in the match than lang elements while 162eceda581Smrg weak family names are given lower precedence than lang 163eceda581Smrg elements. This permits the document language to drive font 164eceda581Smrg selection when any document specified font is unavailable. 165eceda581Smrg 166eceda581Smrg The pattern representing that font is augmented to include any 167eceda581Smrg properties found in the pattern but not found in the font 168eceda581Smrg itself; this permits the application to pass rendering 169eceda581Smrg instructions or any other data through the matching system. 170eceda581Smrg Finally, the list of editing instructions specific to fonts 171eceda581Smrg found in the configuration are applied to the pattern. This 172eceda581Smrg modified pattern is returned to the application. 173eceda581Smrg 174eceda581Smrg The return value contains sufficient information to locate and 175eceda581Smrg rasterize the font, including the file name, pixel size and 176eceda581Smrg other rendering data. As none of the information involved 177eceda581Smrg pertains to the FreeType library, applications are free to use 178eceda581Smrg any rasterization engine or even to take the identified font 179eceda581Smrg file and access it directly. 180eceda581Smrg 181eceda581Smrg The match/edit sequences in the configuration are performed in 182eceda581Smrg two passes because there are essentially two different 183eceda581Smrg operations necessary -- the first is to modify how fonts are 184eceda581Smrg selected; aliasing families and adding suitable defaults. The 185eceda581Smrg second is to modify how the selected fonts are rasterized. 186eceda581Smrg Those must apply to the selected font, not the original pattern 187eceda581Smrg as false matches will often occur. 188eceda581Smrg 189eceda581SmrgFont Names 190eceda581Smrg 191eceda581Smrg Fontconfig provides a textual representation for patterns that 192eceda581Smrg the library can both accept and generate. The representation is 193eceda581Smrg in three parts, first a list of family names, second a list of 194eceda581Smrg point sizes and finally a list of additional properties: 195eceda581Smrg <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>... 196eceda581Smrg 197eceda581Smrg Values in a list are separated with commas. The name needn't 198eceda581Smrg include either families or point sizes; they can be elided. In 199eceda581Smrg addition, there are symbolic constants that simultaneously 200eceda581Smrg indicate both a name and a value. Here are some examples: 201eceda581Smrg Name Meaning 202eceda581Smrg ---------------------------------------------------------- 203eceda581Smrg Times-12 12 point Times Roman 204eceda581Smrg Times-12:bold 12 point Times Bold 205eceda581Smrg Courier:italic Courier Italic in the default size 206eceda581Smrg Monospace:matrix=1 .1 0 1 The users preferred monospace font 207eceda581Smrg with artificial obliquing 208eceda581Smrg 209eceda581Smrg The '\', '-', ':' and ',' characters in family names must be 210eceda581Smrg preceded by a '\' character to avoid having them 211eceda581Smrg misinterpreted. Similarly, values containing '\', '=', '_', ':' 212eceda581Smrg and ',' must also have them preceded by a '\' character. The 213eceda581Smrg '\' characters are stripped out of the family name and values 214eceda581Smrg as the font name is read. 2152c393a42Smrg 2162c393a42SmrgDebugging Applications 2172c393a42Smrg 218eceda581Smrg To help diagnose font and applications problems, fontconfig is 219eceda581Smrg built with a large amount of internal debugging left enabled. 220eceda581Smrg It is controlled by means of the FC_DEBUG environment variable. 221eceda581Smrg The value of this variable is interpreted as a number, and each 222eceda581Smrg bit within that value controls different debugging messages. 223eceda581Smrg Name Value Meaning 224eceda581Smrg --------------------------------------------------------- 225eceda581Smrg MATCH 1 Brief information about font matching 226eceda581Smrg MATCHV 2 Extensive font matching information 227eceda581Smrg EDIT 4 Monitor match/test/edit execution 228eceda581Smrg FONTSET 8 Track loading of font information at startup 229eceda581Smrg CACHE 16 Watch cache files being written 230eceda581Smrg CACHEV 32 Extensive cache file writing information 231eceda581Smrg PARSE 64 (no longer in use) 232eceda581Smrg SCAN 128 Watch font files being scanned to build caches 233eceda581Smrg SCANV 256 Verbose font file scanning information 234eceda581Smrg MEMORY 512 Monitor fontconfig memory usage 235eceda581Smrg CONFIG 1024 Monitor which config files are loaded 236eceda581Smrg LANGSET 2048 Dump char sets used to construct lang values 237eceda581Smrg MATCH2 4096 Display font-matching transformation in patterns 238eceda581Smrg 239eceda581Smrg Add the value of the desired debug levels together and assign 240eceda581Smrg that (in base 10) to the FC_DEBUG environment variable before 241eceda581Smrg running the application. Output from these statements is sent 242eceda581Smrg to stdout. 2432c393a42Smrg 2442c393a42SmrgLang Tags 2452c393a42Smrg 246eceda581Smrg Each font in the database contains a list of languages it 247eceda581Smrg supports. This is computed by comparing the Unicode coverage of 248eceda581Smrg the font with the orthography of each language. Languages are 249eceda581Smrg tagged using an RFC-3066 compatible naming and occur in two 250eceda581Smrg parts -- the ISO 639 language tag followed a hyphen and then by 251eceda581Smrg the ISO 3166 country code. The hyphen and country code may be 252eceda581Smrg elided. 253eceda581Smrg 254eceda581Smrg Fontconfig has orthographies for several languages built into 255eceda581Smrg the library. No provision has been made for adding new ones 256eceda581Smrg aside from rebuilding the library. It currently supports 122 of 257eceda581Smrg the 139 languages named in ISO 639-1, 141 of the languages with 258eceda581Smrg two-letter codes from ISO 639-2 and another 30 languages with 259eceda581Smrg only three-letter codes. Languages with both two and three 260eceda581Smrg letter codes are provided with only the two letter code. 261eceda581Smrg 262eceda581Smrg For languages used in multiple territories with radically 263eceda581Smrg different character sets, fontconfig includes per-territory 264eceda581Smrg orthographies. This includes Azerbaijani, Kurdish, Pashto, 265eceda581Smrg Tigrinya and Chinese. 266a6844aabSmrg 267eceda581SmrgConfiguration File Format 268a6844aabSmrg 269eceda581Smrg Configuration files for fontconfig are stored in XML format; 270eceda581Smrg this format makes external configuration tools easier to write 271eceda581Smrg and ensures that they will generate syntactically correct 272eceda581Smrg configuration files. As XML files are plain text, they can also 273eceda581Smrg be manipulated by the expert user using a text editor. 274eceda581Smrg 275eceda581Smrg The fontconfig document type definition resides in the external 276eceda581Smrg entity "fonts.dtd"; this is normally stored in the default font 277eceda581Smrg configuration directory (/etc/fonts). Each configuration file 278eceda581Smrg should contain the following structure: 279eceda581Smrg <?xml version="1.0"?> 280eceda581Smrg <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 281eceda581Smrg <fontconfig> 282eceda581Smrg ... 283eceda581Smrg </fontconfig> 2842c393a42Smrg 285eceda581Smrg<fontconfig> 2862c393a42Smrg 287eceda581Smrg This is the top level element for a font configuration and can 288eceda581Smrg contain <dir>, <cachedir>, <include>, <match> and <alias> 289eceda581Smrg elements in any order. 290eceda581Smrg 291eceda581Smrg<dir prefix="default" salt=""> 292eceda581Smrg 293eceda581Smrg This element contains a directory name which will be scanned 294eceda581Smrg for font files to include in the set of available fonts. 295eceda581Smrg 296eceda581Smrg If 'prefix' is set to "default" or "cwd", the current working 297eceda581Smrg directory will be added as the path prefix prior to the value. 298eceda581Smrg If 'prefix' is set to "xdg", the value in the XDG_DATA_HOME 299eceda581Smrg environment variable will be added as the path prefix. please 300eceda581Smrg see XDG Base Directory Specification for more details. If 301eceda581Smrg 'prefix' is set to "relative", the path of current file will be 302eceda581Smrg added prior to the value. 303eceda581Smrg 304eceda581Smrg 'salt' property affects to determine cache filename. this is 305eceda581Smrg useful for example when having different fonts sets on same 306eceda581Smrg path at container and share fonts from host on different font 307eceda581Smrg path. 308eceda581Smrg 309eceda581Smrg<cachedir prefix="default"> 310eceda581Smrg 311eceda581Smrg This element contains a directory name that is supposed to be 312eceda581Smrg stored or read the cache of font information. If multiple 313eceda581Smrg elements are specified in the configuration file, the directory 314eceda581Smrg that can be accessed first in the list will be used to store 315eceda581Smrg the cache files. If it starts with '~', it refers to a 316eceda581Smrg directory in the users home directory. If 'prefix' is set to 317eceda581Smrg "xdg", the value in the XDG_CACHE_HOME environment variable 318eceda581Smrg will be added as the path prefix. please see XDG Base Directory 319eceda581Smrg Specification for more details. The default directory is 320eceda581Smrg ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files 321eceda581Smrg named ``<hash value>-<architecture>.cache-<version>'', where 322eceda581Smrg <version> is the fontconfig cache file version number 323eceda581Smrg (currently 7). 324eceda581Smrg 325eceda581Smrg<include ignore_missing="no" prefix="default"> 326eceda581Smrg 327eceda581Smrg This element contains the name of an additional configuration 328eceda581Smrg file or directory. If a directory, every file within that 329eceda581Smrg directory starting with an ASCII digit (U+0030 - U+0039) and 330eceda581Smrg ending with the string ``.conf'' will be processed in sorted 331eceda581Smrg order. When the XML datatype is traversed by FcConfigParse, the 332eceda581Smrg contents of the file(s) will also be incorporated into the 333eceda581Smrg configuration by passing the filename(s) to 334eceda581Smrg FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" 335eceda581Smrg instead of the default "no", a missing file or directory will 336eceda581Smrg elicit no warning message from the library. If 'prefix' is set 337eceda581Smrg to "xdg", the value in the XDG_CONFIG_HOME environment variable 338eceda581Smrg will be added as the path prefix. please see XDG Base Directory 339ca08ab68Smrg Specification for more details. 340ca08ab68Smrg 341eceda581Smrg<config> 342eceda581Smrg 343eceda581Smrg This element provides a place to consolidate additional 344eceda581Smrg configuration information. <config> can contain <blank> and 345eceda581Smrg <rescan> elements in any order. 346eceda581Smrg 347eceda581Smrg<description domain="fontconfig-conf"> 348eceda581Smrg 349eceda581Smrg This element is supposed to hold strings which describe what a 350eceda581Smrg config is used for. This string can be translated through 351eceda581Smrg gettext. 'domain' needs to be set the proper name to apply 352eceda581Smrg then. fontconfig will tries to retrieve translations with 353eceda581Smrg 'domain' from gettext. 354eceda581Smrg 355eceda581Smrg<blank> 356a32e9e42Smrg 357eceda581Smrg Fonts often include "broken" glyphs which appear in the 358eceda581Smrg encoding but are drawn as blanks on the screen. Within the 359eceda581Smrg <blank> element, place each Unicode characters which is 360eceda581Smrg supposed to be blank in an <int> element. Characters outside of 361eceda581Smrg this set which are drawn as blank will be elided from the set 362eceda581Smrg of characters supported by the font. 363a32e9e42Smrg 364eceda581Smrg<remap-dir prefix="default" as-path="" salt=""> 365a4e54154Smrg 366eceda581Smrg This element contains a directory name where will be mapped as 367eceda581Smrg the path 'as-path' in cached information. This is useful if the 368eceda581Smrg directory name is an alias (via a bind mount or symlink) to 369eceda581Smrg another directory in the system for which cached font 370eceda581Smrg information is likely to exist. 371a4e54154Smrg 372eceda581Smrg 'salt' property affects to determine cache filename as same as 373eceda581Smrg <dir> element. 374a32e9e42Smrg 375eceda581Smrg<reset-dirs /> 376a32e9e42Smrg 377eceda581Smrg This element removes all of fonts directories where added by 378eceda581Smrg <dir> elements. This is useful to override fonts directories 379eceda581Smrg from system to own fonts directories only. 380a4e54154Smrg 381eceda581Smrg<rescan> 382a4e54154Smrg 383eceda581Smrg The <rescan> element holds an <int> element which indicates the 384eceda581Smrg default interval between automatic checks for font 385eceda581Smrg configuration changes. Fontconfig will validate all of the 386eceda581Smrg configuration files and directories and automatically rebuild 387eceda581Smrg the internal datastructures when this interval passes. 388a32e9e42Smrg 389eceda581Smrg<selectfont> 390a32e9e42Smrg 391eceda581Smrg This element is used to black/white list fonts from being 392eceda581Smrg listed or matched against. It holds acceptfont and rejectfont 393eceda581Smrg elements. 394953daebaSmrg 395eceda581Smrg<acceptfont> 396953daebaSmrg 397eceda581Smrg Fonts matched by an acceptfont element are "whitelisted"; such 398eceda581Smrg fonts are explicitly included in the set of fonts used to 399eceda581Smrg resolve list and match requests; including them in this list 400eceda581Smrg protects them from being "blacklisted" by a rejectfont element. 401eceda581Smrg Acceptfont elements include glob and pattern elements which are 402eceda581Smrg used to match fonts. 403ca08ab68Smrg 404eceda581Smrg<rejectfont> 405ca08ab68Smrg 406eceda581Smrg Fonts matched by an rejectfont element are "blacklisted"; such 407eceda581Smrg fonts are excluded from the set of fonts used to resolve list 408eceda581Smrg and match requests as if they didn't exist in the system. 409eceda581Smrg Rejectfont elements include glob and pattern elements which are 410eceda581Smrg used to match fonts. 411ca08ab68Smrg 412eceda581Smrg<glob> 4132c393a42Smrg 414eceda581Smrg Glob elements hold shell-style filename matching patterns 415eceda581Smrg (including ? and *) which match fonts based on their complete 416eceda581Smrg pathnames. This can be used to exclude a set of directories 417eceda581Smrg (/usr/share/fonts/uglyfont*), or particular font file types 418eceda581Smrg (*.pcf.gz), but the latter mechanism relies rather heavily on 419eceda581Smrg filenaming conventions which can't be relied upon. Note that 420eceda581Smrg globs only apply to directories, not to individual fonts. 4212c393a42Smrg 422eceda581Smrg<pattern> 423a32e9e42Smrg 424eceda581Smrg Pattern elements perform list-style matching on incoming fonts; 425eceda581Smrg that is, they hold a list of elements and associated values. If 426eceda581Smrg all of those elements have a matching value, then the pattern 427eceda581Smrg matches the font. This can be used to select fonts based on 428eceda581Smrg attributes of the font (scalable, bold, etc), which is a more 429eceda581Smrg reliable mechanism than using file extensions. Pattern elements 430eceda581Smrg include patelt elements. 431a32e9e42Smrg 432eceda581Smrg<patelt name="property"> 433eceda581Smrg 434eceda581Smrg Patelt elements hold a single pattern element and list of 435eceda581Smrg values. They must have a 'name' attribute which indicates the 436eceda581Smrg pattern element name. Patelt elements include int, double, 437eceda581Smrg string, matrix, bool, charset and const elements. 438eceda581Smrg 439eceda581Smrg<match target="pattern"> 440eceda581Smrg 441eceda581Smrg This element holds first a (possibly empty) list of <test> 442eceda581Smrg elements and then a (possibly empty) list of <edit> elements. 443eceda581Smrg Patterns which match all of the tests are subjected to all the 444eceda581Smrg edits. If 'target' is set to "font" instead of the default 445eceda581Smrg "pattern", then this element applies to the font name resulting 446eceda581Smrg from a match rather than a font pattern to be matched. If 447eceda581Smrg 'target' is set to "scan", then this element applies when the 448eceda581Smrg font is scanned to build the fontconfig database. 449eceda581Smrg 450eceda581Smrg<test qual="any" name="property" target="default" compare="eq"> 451eceda581Smrg 452eceda581Smrg This element contains a single value which is compared with the 453eceda581Smrg target ('pattern', 'font', 'scan' or 'default') property 454eceda581Smrg "property" (substitute any of the property names seen above). 455eceda581Smrg 'compare' can be one of "eq", "not_eq", "less", "less_eq", 456eceda581Smrg "more", "more_eq", "contains" or "not_contains". 'qual' may 457eceda581Smrg either be the default, "any", in which case the match succeeds 458eceda581Smrg if any value associated with the property matches the test 459eceda581Smrg value, or "all", in which case all of the values associated 460eceda581Smrg with the property must match the test value. 'ignore-blanks' 461eceda581Smrg takes a boolean value. if 'ignore-blanks' is set "true", any 462eceda581Smrg blanks in the string will be ignored on its comparison. this 463eceda581Smrg takes effects only when compare="eq" or compare="not_eq". When 464eceda581Smrg used in a <match target="font"> element, the target= attribute 465eceda581Smrg in the <test> element selects between matching the original 466eceda581Smrg pattern or the font. "default" selects whichever target the 467eceda581Smrg outer <match> element has selected. 468eceda581Smrg 469eceda581Smrg<edit name="property" mode="assign" binding="weak"> 470eceda581Smrg 471eceda581Smrg This element contains a list of expression elements (any of the 472eceda581Smrg value or operator elements). The expression elements are 473eceda581Smrg evaluated at run-time and modify the property "property". The 474eceda581Smrg modification depends on whether "property" was matched by one 475eceda581Smrg of the associated <test> elements, if so, the modification may 476eceda581Smrg affect the first matched value. Any values inserted into the 477eceda581Smrg property are given the indicated binding ("strong", "weak" or 478eceda581Smrg "same") with "same" binding using the value from the matched 479eceda581Smrg pattern element. 'mode' is one of: 480eceda581Smrg Mode With Match Without Match 481eceda581Smrg --------------------------------------------------------------------- 482eceda581Smrg "assign" Replace matching value Replace all values 483eceda581Smrg "assign_replace" Replace all values Replace all values 484eceda581Smrg "prepend" Insert before matching Insert at head of list 485eceda581Smrg "prepend_first" Insert at head of list Insert at head of list 486eceda581Smrg "append" Append after matching Append at end of list 487eceda581Smrg "append_last" Append at end of list Append at end of list 488eceda581Smrg "delete" Delete matching value Delete all values 489eceda581Smrg "delete_all" Delete all values Delete all values 490eceda581Smrg 491eceda581Smrg<int>, <double>, <string>, <bool> 492eceda581Smrg 493eceda581Smrg These elements hold a single value of the indicated type. 494eceda581Smrg <bool> elements hold either true or false. An important 495eceda581Smrg limitation exists in the parsing of floating point numbers -- 496eceda581Smrg fontconfig requires that the mantissa start with a digit, not a 497eceda581Smrg decimal point, so insert a leading zero for purely fractional 498eceda581Smrg values (e.g. use 0.5 instead of .5 and -0.5 instead of -.5). 499eceda581Smrg 500eceda581Smrg<matrix> 501eceda581Smrg 502eceda581Smrg This element holds four numerical expressions of an affine 503eceda581Smrg transformation. At their simplest these will be four <double> 504eceda581Smrg elements but they can also be more involved expressions. 505eceda581Smrg 506eceda581Smrg<range> 507eceda581Smrg 508eceda581Smrg This element holds the two <int> elements of a range 509eceda581Smrg representation. 510eceda581Smrg 511eceda581Smrg<charset> 512eceda581Smrg 513eceda581Smrg This element holds at least one <int> element of an Unicode 514eceda581Smrg code point or more. 515eceda581Smrg 516eceda581Smrg<langset> 517eceda581Smrg 518eceda581Smrg This element holds at least one <string> element of a 519eceda581Smrg RFC-3066-style languages or more. 520eceda581Smrg 521eceda581Smrg<name> 522eceda581Smrg 523eceda581Smrg Holds a property name. Evaluates to the first value from the 524eceda581Smrg property of the pattern. If the 'target' attribute is not 525eceda581Smrg present, it will default to 'default', in which case the 526eceda581Smrg property is returned from the font pattern during a 527eceda581Smrg target="font" match, and to the pattern during a 528eceda581Smrg target="pattern" match. The attribute can also take the values 529eceda581Smrg 'font' or 'pattern' to explicitly choose which pattern to use. 530eceda581Smrg It is an error to use a target of 'font' in a match that has 531eceda581Smrg target="pattern". 532eceda581Smrg 533eceda581Smrg<const> 534eceda581Smrg 535eceda581Smrg Holds the name of a constant; these are always integers and 536eceda581Smrg serve as symbolic names for common font values: 537eceda581Smrg Constant Property Value 538eceda581Smrg ------------------------------------- 539eceda581Smrg thin weight 0 540eceda581Smrg extralight weight 40 541eceda581Smrg ultralight weight 40 542eceda581Smrg light weight 50 543eceda581Smrg demilight weight 55 544eceda581Smrg semilight weight 55 545eceda581Smrg book weight 75 546eceda581Smrg regular weight 80 547eceda581Smrg normal weight 80 548eceda581Smrg medium weight 100 549eceda581Smrg demibold weight 180 550eceda581Smrg semibold weight 180 551eceda581Smrg bold weight 200 552eceda581Smrg extrabold weight 205 553eceda581Smrg black weight 210 554eceda581Smrg heavy weight 210 555eceda581Smrg roman slant 0 556eceda581Smrg italic slant 100 557eceda581Smrg oblique slant 110 558eceda581Smrg ultracondensed width 50 559eceda581Smrg extracondensed width 63 560eceda581Smrg condensed width 75 561eceda581Smrg semicondensed width 87 562eceda581Smrg normal width 100 563eceda581Smrg semiexpanded width 113 564eceda581Smrg expanded width 125 565eceda581Smrg extraexpanded width 150 566eceda581Smrg ultraexpanded width 200 567eceda581Smrg proportional spacing 0 568eceda581Smrg dual spacing 90 569eceda581Smrg mono spacing 100 570eceda581Smrg charcell spacing 110 571eceda581Smrg unknown rgba 0 572eceda581Smrg rgb rgba 1 573eceda581Smrg bgr rgba 2 574eceda581Smrg vrgb rgba 3 575eceda581Smrg vbgr rgba 4 576eceda581Smrg none rgba 5 577eceda581Smrg lcdnone lcdfilter 0 578eceda581Smrg lcddefault lcdfilter 1 579eceda581Smrg lcdlight lcdfilter 2 580eceda581Smrg lcdlegacy lcdfilter 3 581eceda581Smrg hintnone hintstyle 0 582eceda581Smrg hintslight hintstyle 1 583eceda581Smrg hintmedium hintstyle 2 584eceda581Smrg hintfull hintstyle 3 585eceda581Smrg 586eceda581Smrg<or>, <and>, <plus>, <minus>, <times>, <divide> 587eceda581Smrg 588eceda581Smrg These elements perform the specified operation on a list of 589eceda581Smrg expression elements. <or> and <and> are boolean, not bitwise. 590eceda581Smrg 591eceda581Smrg<eq>, <not_eq>, <less>, <less_eq>, <more>, <more_eq>, <contains>, 592eceda581Smrg<not_contains 5932c393a42Smrg 594ca08ab68Smrg These elements compare two values, producing a boolean result. 5952c393a42Smrg 596eceda581Smrg<not> 5972c393a42Smrg 598ca08ab68Smrg Inverts the boolean sense of its one expression element 5992c393a42Smrg 600eceda581Smrg<if> 6012c393a42Smrg 602eceda581Smrg This element takes three expression elements; if the value of 603eceda581Smrg the first is true, it produces the value of the second, 604eceda581Smrg otherwise it produces the value of the third. 6052c393a42Smrg 606eceda581Smrg<alias> 6072c393a42Smrg 608eceda581Smrg Alias elements provide a shorthand notation for the set of 609eceda581Smrg common match operations needed to substitute one font family 610eceda581Smrg for another. They contain a <family> element followed by 611eceda581Smrg optional <prefer>, <accept> and <default> elements. Fonts 612eceda581Smrg matching the <family> element are edited to prepend the list of 613eceda581Smrg <prefer>ed families before the matching <family>, append the 614eceda581Smrg <accept>able families after the matching <family> and append 615eceda581Smrg the <default> families to the end of the family list. 616ca08ab68Smrg 617eceda581Smrg<family> 618ca08ab68Smrg 619ca08ab68Smrg Holds a single font family name 620ca08ab68Smrg 621eceda581Smrg<prefer>, <accept>, <default> 622ca08ab68Smrg 623eceda581Smrg These hold a list of <family> elements to be used by the 624eceda581Smrg <alias> element. 6252c393a42Smrg 6262c393a42SmrgEXAMPLE CONFIGURATION FILE 6272c393a42Smrg 628eceda581SmrgSystem configuration file 6292c393a42Smrg 630ca08ab68Smrg This is an example of a system-wide configuration file 6312c393a42Smrg<?xml version="1.0"?> 632a4e54154Smrg<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 6332c393a42Smrg<!-- /etc/fonts/fonts.conf file to configure system font access --> 6342c393a42Smrg<fontconfig> 6352c393a42Smrg<!-- 6362c393a42Smrg Find fonts in these directories 6372c393a42Smrg--> 6382c393a42Smrg<dir>/usr/share/fonts</dir> 6392c393a42Smrg<dir>/usr/X11R6/lib/X11/fonts</dir> 6402c393a42Smrg 6412c393a42Smrg<!-- 6422c393a42Smrg Accept deprecated 'mono' alias, replacing it with 'monospace' 6432c393a42Smrg--> 6442c393a42Smrg<match target="pattern"> 6452c393a42Smrg <test qual="any" name="family"><string>mono</string></test> 646eceda581Smrg <edit name="family" mode="assign"><string>monospace</string></ed 647eceda581Smrgit> 6482c393a42Smrg</match> 6492c393a42Smrg 6502c393a42Smrg<!-- 651ca08ab68Smrg Names not including any well known alias are given 'sans-serif' 6522c393a42Smrg--> 6532c393a42Smrg<match target="pattern"> 654eceda581Smrg <test qual="all" name="family" compare="not_eq"><string>sans-ser 655eceda581Smrgif</string></test> 656eceda581Smrg <test qual="all" name="family" compare="not_eq"><string>serif</s 657eceda581Smrgtring></test> 658eceda581Smrg <test qual="all" name="family" compare="not_eq"><string>monospac 659eceda581Smrge</string></test> 660eceda581Smrg <edit name="family" mode="append_last"><string>sans-serif</strin 661eceda581Smrgg></edit> 6622c393a42Smrg</match> 6632c393a42Smrg 6642c393a42Smrg<!-- 6652c393a42Smrg Load per-user customization file, but don't complain 6662c393a42Smrg if it doesn't exist 6672c393a42Smrg--> 668eceda581Smrg<include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</includ 669eceda581Smrge> 6702c393a42Smrg 6712c393a42Smrg<!-- 6722c393a42Smrg Load local customization files, but don't complain 6732c393a42Smrg if there aren't any 6742c393a42Smrg--> 6752c393a42Smrg<include ignore_missing="yes">conf.d</include> 6762c393a42Smrg<include ignore_missing="yes">local.conf</include> 6772c393a42Smrg 6782c393a42Smrg<!-- 6792c393a42Smrg Alias well known font names to available TrueType fonts. 6802c393a42Smrg These substitute TrueType faces for similar Type1 6812c393a42Smrg faces to improve screen appearance. 6822c393a42Smrg--> 6832c393a42Smrg<alias> 6842c393a42Smrg <family>Times</family> 6852c393a42Smrg <prefer><family>Times New Roman</family></prefer> 6862c393a42Smrg <default><family>serif</family></default> 6872c393a42Smrg</alias> 6882c393a42Smrg<alias> 6892c393a42Smrg <family>Helvetica</family> 6902c393a42Smrg <prefer><family>Arial</family></prefer> 6912c393a42Smrg <default><family>sans</family></default> 6922c393a42Smrg</alias> 6932c393a42Smrg<alias> 6942c393a42Smrg <family>Courier</family> 6952c393a42Smrg <prefer><family>Courier New</family></prefer> 6962c393a42Smrg <default><family>monospace</family></default> 6972c393a42Smrg</alias> 6982c393a42Smrg 6992c393a42Smrg<!-- 7002c393a42Smrg Provide required aliases for standard names 7012c393a42Smrg Do these after the users configuration file so that 7022c393a42Smrg any aliases there are used preferentially 7032c393a42Smrg--> 7042c393a42Smrg<alias> 7052c393a42Smrg <family>serif</family> 7062c393a42Smrg <prefer><family>Times New Roman</family></prefer> 7072c393a42Smrg</alias> 7082c393a42Smrg<alias> 7092c393a42Smrg <family>sans</family> 7102c393a42Smrg <prefer><family>Arial</family></prefer> 7112c393a42Smrg</alias> 7122c393a42Smrg<alias> 7132c393a42Smrg <family>monospace</family> 7142c393a42Smrg <prefer><family>Andale Mono</family></prefer> 7152c393a42Smrg</alias> 716ca08ab68Smrg 717ca08ab68Smrg<-- 718ca08ab68Smrg The example of the requirements of OR operator; 719ca08ab68Smrg If the 'family' contains 'Courier New' OR 'Courier' 720ca08ab68Smrg add 'monospace' as the alternative 721ca08ab68Smrg--> 722ca08ab68Smrg<match target="pattern"> 723a32e9e42Smrg <test name="family" compare="eq"> 724ca08ab68Smrg <string>Courier New</string> 725ca08ab68Smrg </test> 726ca08ab68Smrg <edit name="family" mode="prepend"> 727ca08ab68Smrg <string>monospace</string> 728ca08ab68Smrg </edit> 729ca08ab68Smrg</match> 730ca08ab68Smrg<match target="pattern"> 731a32e9e42Smrg <test name="family" compare="eq"> 732ca08ab68Smrg <string>Courier</string> 733ca08ab68Smrg </test> 734ca08ab68Smrg <edit name="family" mode="prepend"> 735ca08ab68Smrg <string>monospace</string> 736ca08ab68Smrg </edit> 737ca08ab68Smrg</match> 738ca08ab68Smrg 7392c393a42Smrg</fontconfig> 7402c393a42Smrg 741eceda581SmrgUser configuration file 742a6844aabSmrg 743eceda581Smrg This is an example of a per-user configuration file that lives 744eceda581Smrg in $XDG_CONFIG_HOME/fontconfig/fonts.conf 745eceda581Smrg<?xml version="1.0"?> 746eceda581Smrg<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 747eceda581Smrg<!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configurat 748eceda581Smrgion --> 749eceda581Smrg<fontconfig> 750a32e9e42Smrg 751eceda581Smrg<!-- 752eceda581Smrg Private font directory 753eceda581Smrg--> 754eceda581Smrg<dir prefix="xdg">fonts</dir> 7552c393a42Smrg 756eceda581Smrg<!-- 757eceda581Smrg use rgb sub-pixel ordering to improve glyph appearance on 758eceda581Smrg LCD screens. Changes affecting rendering, but not matching 759eceda581Smrg should always use target="font". 760eceda581Smrg--> 761eceda581Smrg<match target="font"> 762eceda581Smrg <edit name="rgba" mode="assign"><const>rgb</const></edit> 763eceda581Smrg</match> 764eceda581Smrg<!-- 765eceda581Smrg use WenQuanYi Zen Hei font when serif is requested for Chinese 766eceda581Smrg--> 767eceda581Smrg<match> 768eceda581Smrg <!-- 769eceda581Smrg If you don't want to use WenQuanYi Zen Hei font for zh-t 770eceda581Smrgw etc, 771eceda581Smrg you can use zh-cn instead of zh. 772eceda581Smrg Please note, even if you set zh-cn, it still matches zh. 773eceda581Smrg if you don't like it, you can use compare="eq" 774eceda581Smrg instead of compare="contains". 775eceda581Smrg --> 776eceda581Smrg <test name="lang" compare="contains"> 777eceda581Smrg <string>zh</string> 778eceda581Smrg </test> 779eceda581Smrg <test name="family"> 780eceda581Smrg <string>serif</string> 781eceda581Smrg </test> 782eceda581Smrg <edit name="family" mode="prepend"> 783eceda581Smrg <string>WenQuanYi Zen Hei</string> 784eceda581Smrg </edit> 785eceda581Smrg</match> 786eceda581Smrg<!-- 787eceda581Smrg use VL Gothic font when sans-serif is requested for Japanese 788eceda581Smrg--> 789eceda581Smrg<match> 790eceda581Smrg <test name="lang" compare="contains"> 791eceda581Smrg <string>ja</string> 792eceda581Smrg </test> 793eceda581Smrg <test name="family"> 794eceda581Smrg <string>sans-serif</string> 795eceda581Smrg </test> 796eceda581Smrg <edit name="family" mode="prepend"> 797eceda581Smrg <string>VL Gothic</string> 798eceda581Smrg </edit> 799eceda581Smrg</match> 800eceda581Smrg</fontconfig> 801a6844aabSmrg 802ca08ab68SmrgFiles 8032c393a42Smrg 804eceda581Smrg fonts.conf contains configuration information for the 805eceda581Smrg fontconfig library consisting of directories to look at for 806eceda581Smrg font information as well as instructions on editing program 807eceda581Smrg specified font patterns before attempting to match the 808eceda581Smrg available fonts. It is in XML format. 8092c393a42Smrg 810ca08ab68Smrg conf.d is the conventional name for a directory of additional 811eceda581Smrg configuration files managed by external applications or the 812eceda581Smrg local administrator. The filenames starting with decimal digits 813eceda581Smrg are sorted in lexicographic order and used as additional 814eceda581Smrg configuration files. All of these files are in XML format. The 815eceda581Smrg master fonts.conf file references this directory in an 816eceda581Smrg <include> directive. 817eceda581Smrg 818eceda581Smrg fonts.dtd is a DTD that describes the format of the 819eceda581Smrg configuration files. 820eceda581Smrg 821eceda581Smrg $XDG_CONFIG_HOME/fontconfig/conf.d and ~/.fonts.conf.d is the 822eceda581Smrg conventional name for a per-user directory of (typically 823eceda581Smrg auto-generated) configuration files, although the actual 824eceda581Smrg location is specified in the global fonts.conf file. please 825eceda581Smrg note that ~/.fonts.conf.d is deprecated now. it will not be 826ca08ab68Smrg read by default in the future version. 827ca08ab68Smrg 828ca08ab68Smrg $XDG_CONFIG_HOME/fontconfig/fonts.conf and ~/.fonts.conf is the 829eceda581Smrg conventional location for per-user font configuration, although 830eceda581Smrg the actual location is specified in the global fonts.conf file. 831eceda581Smrg please note that ~/.fonts.conf is deprecated now. it will not 832eceda581Smrg be read by default in the future version. 833eceda581Smrg 834eceda581Smrg $XDG_CACHE_HOME/fontconfig/*.cache-* and 835eceda581Smrg ~/.fontconfig/*.cache-* is the conventional repository of font 836eceda581Smrg information that isn't found in the per-directory caches. This 837eceda581Smrg file is automatically maintained by fontconfig. please note 838eceda581Smrg that ~/.fontconfig/*.cache-* is deprecated now. it will not be 839ca08ab68Smrg read by default in the future version. 8402c393a42Smrg 841ca08ab68SmrgEnvironment variables 8422c393a42Smrg 843eceda581Smrg FONTCONFIG_FILE is used to override the default configuration 844eceda581Smrg file. 8452c393a42Smrg 846eceda581Smrg FONTCONFIG_PATH is used to override the default configuration 847eceda581Smrg directory. 8482c393a42Smrg 849a32e9e42Smrg FONTCONFIG_SYSROOT is used to set a default sysroot directory. 850953daebaSmrg 851a32e9e42Smrg FC_DEBUG is used to output the detailed debugging messages. see 852eceda581Smrg Debugging Applications section for more details. 853eceda581Smrg 854eceda581Smrg FC_DBG_MATCH_FILTER is used to filter out the patterns. this 855eceda581Smrg takes a comma-separated list of object names and effects only 856eceda581Smrg when FC_DEBUG has MATCH2. see Debugging Applications section 857eceda581Smrg for more details. 858eceda581Smrg 859eceda581Smrg FC_LANG is used to specify the default language as the weak 860eceda581Smrg binding in the query. if this isn't set, the default language 861eceda581Smrg will be determined from current locale. 862eceda581Smrg 863eceda581Smrg FONTCONFIG_USE_MMAP is used to control the use of mmap(2) for 864eceda581Smrg the cache files if available. this take a boolean value. 865eceda581Smrg fontconfig will checks if the cache files are stored on the 866eceda581Smrg filesystem that is safe to use mmap(2). explicitly setting this 867eceda581Smrg environment variable will causes skipping this check and 868eceda581Smrg enforce to use or not use mmap(2) anyway. 869eceda581Smrg 870eceda581Smrg SOURCE_DATE_EPOCH is used to ensure fc-cache(1) generates files 871eceda581Smrg in a deterministic manner in order to support reproducible 872eceda581Smrg builds. When set to a numeric representation of UNIX timestamp, 873eceda581Smrg fontconfig will prefer this value over using the modification 874eceda581Smrg timestamps of the input files in order to identify which cache 875eceda581Smrg files require regeneration. If SOURCE_DATE_EPOCH is not set (or 876eceda581Smrg is newer than the mtime of the directory), the existing 877a32e9e42Smrg behaviour is unchanged. 8782c393a42Smrg 8792c393a42SmrgSee Also 8802c393a42Smrg 881a32e9e42Smrg fc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1), 882eceda581Smrg SOURCE_DATE_EPOCH. 8832c393a42Smrg 8842c393a42SmrgVersion 8852c393a42Smrg 886eceda581Smrg Fontconfig version 2.14.1 887