fontconfig-user.txt revision a32e9e42
1a32e9e42Smrg fonts-conf 22c393a42Smrg 32c393a42SmrgName 42c393a42Smrg 5a32e9e42Smrg fonts.conf -- Font configuration files 62c393a42Smrg 72c393a42SmrgSynopsis 82c393a42Smrg 9a32e9e42Smrg /etc/fonts/fonts.conf 10a32e9e42Smrg /etc/fonts/fonts.dtd 11a32e9e42Smrg /etc/fonts/conf.d 12a32e9e42Smrg $XDG_CONFIG_HOME/fontconfig/conf.d 13a32e9e42Smrg $XDG_CONFIG_HOME/fontconfig/fonts.conf 14a32e9e42Smrg ~/.fonts.conf.d 15a32e9e42Smrg ~/.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 24a32e9e42Smrg Fontconfig contains two essential modules, the configuration module which 25a32e9e42Smrg builds an internal configuration from XML files and the matching module 26a32e9e42Smrg which accepts font patterns and returns the nearest matching font. 27a32e9e42Smrg 28a32e9e42Smrg Font Configuration 29a32e9e42Smrg 30a32e9e42Smrg The configuration module consists of the FcConfig datatype, libexpat and 31a32e9e42Smrg FcConfigParse which walks over an XML tree and amends a configuration with 32a32e9e42Smrg data found within. From an external perspective, configuration of the 33a32e9e42Smrg library consists of generating a valid XML tree and feeding that to 34a32e9e42Smrg FcConfigParse. The only other mechanism provided to applications for 35a32e9e42Smrg changing the running configuration is to add fonts and directories to the 36a32e9e42Smrg list of application-provided font files. 37a32e9e42Smrg 38a32e9e42Smrg The intent is to make font configurations relatively static, and shared by 39a32e9e42Smrg as many applications as possible. It is hoped that this will lead to more 40a32e9e42Smrg stable font selection when passing names from one application to another. 41a32e9e42Smrg XML was chosen as a configuration file format because it provides a format 42a32e9e42Smrg which is easy for external agents to edit while retaining the correct 43ca08ab68Smrg structure and syntax. 44ca08ab68Smrg 45a32e9e42Smrg Font configuration is separate from font matching; applications needing to 46a32e9e42Smrg do their own matching can access the available fonts from the library and 47a32e9e42Smrg perform private matching. The intent is to permit applications to pick and 48a32e9e42Smrg choose appropriate functionality from the library instead of forcing them 49a32e9e42Smrg to choose between this library and a private configuration mechanism. The 50a32e9e42Smrg hope is that this will ensure that configuration of fonts for all 51a32e9e42Smrg applications can be centralized in one place. Centralizing font 52a32e9e42Smrg configuration will simplify and regularize font installation and 53a32e9e42Smrg customization. 54a32e9e42Smrg 55a32e9e42Smrg Font Properties 56a32e9e42Smrg 57a32e9e42Smrg While font patterns may contain essentially any properties, there are some 58a32e9e42Smrg well known properties with associated types. Fontconfig uses some of these 59a32e9e42Smrg properties for font matching and font completion. Others are provided as a 60a32e9e42Smrg convenience for the applications' rendering mechanism. 61a32e9e42Smrg 62953daebaSmrg Property Type Description 63953daebaSmrg -------------------------------------------------------------- 64953daebaSmrg family String Font family names 65953daebaSmrg familylang String Languages corresponding to each family 66953daebaSmrg style String Font style. Overrides weight and slant 67953daebaSmrg stylelang String Languages corresponding to each style 68953daebaSmrg fullname String Font full names (often includes style) 69953daebaSmrg fullnamelang String Languages corresponding to each fullname 70953daebaSmrg slant Int Italic, oblique or roman 71953daebaSmrg weight Int Light, medium, demibold, bold or black 72953daebaSmrg size Double Point size 73953daebaSmrg width Int Condensed, normal or expanded 74953daebaSmrg aspect Double Stretches glyphs horizontally before hinting 75953daebaSmrg pixelsize Double Pixel size 76a32e9e42Smrg spacing Int Proportional, dual-width, monospace or charcell 77953daebaSmrg foundry String Font foundry name 78953daebaSmrg antialias Bool Whether glyphs can be antialiased 79953daebaSmrg hinting Bool Whether the rasterizer should use hinting 80953daebaSmrg hintstyle Int Automatic hinting style 81953daebaSmrg verticallayout Bool Use vertical layout 82953daebaSmrg autohint Bool Use autohinter instead of normal hinter 83953daebaSmrg globaladvance Bool Use font global advance data (deprecated) 84953daebaSmrg file String The filename holding the font 85953daebaSmrg index Int The index of the font within the file 86953daebaSmrg ftface FT_Face Use the specified FreeType face object 87953daebaSmrg rasterizer String Which rasterizer is in use (deprecated) 88953daebaSmrg outline Bool Whether the glyphs are outlines 89953daebaSmrg scalable Bool Whether glyphs can be scaled 90953daebaSmrg color Bool Whether any glyphs have color 91a32e9e42Smrg scale Double Scale factor for point->pixel conversions (deprecated) 92953daebaSmrg dpi Double Target dots per inch 93953daebaSmrg rgba Int unknown, rgb, bgr, vrgb, vbgr, 94953daebaSmrg none - subpixel geometry 95953daebaSmrg lcdfilter Int Type of LCD filter 96953daebaSmrg minspace Bool Eliminate leading from line spacing 97953daebaSmrg charset CharSet Unicode chars encoded by the font 98953daebaSmrg lang String List of RFC-3066-style languages this 99953daebaSmrg font supports 100953daebaSmrg fontversion Int Version number of the font 101953daebaSmrg capability String List of layout capabilities in the font 102953daebaSmrg fontformat String String name of the font format 103a32e9e42Smrg embolden Bool Rasterizer should synthetically embolden the font 104953daebaSmrg embeddedbitmap Bool Use the embedded bitmap instead of the outline 105953daebaSmrg decorative Bool Whether the style is a decorative variant 106a32e9e42Smrg fontfeatures String List of the feature tags in OpenType to be enabled 107a32e9e42Smrg namelang String Language name to be used for the default value of 108953daebaSmrg familylang, stylelang, and fullnamelang 109953daebaSmrg prgname String String Name of the running program 110953daebaSmrg postscriptname String Font family name in PostScript 111953daebaSmrg 112953daebaSmrg 113a32e9e42Smrg Font Matching 114953daebaSmrg 115a32e9e42Smrg Fontconfig performs matching by measuring the distance from a provided 116a32e9e42Smrg pattern to all of the available fonts in the system. The closest matching 117a32e9e42Smrg font is selected. This ensures that a font will always be returned, but 118a32e9e42Smrg doesn't ensure that it is anything like the requested pattern. 119a32e9e42Smrg 120a32e9e42Smrg Font matching starts with an application constructed pattern. The desired 121a32e9e42Smrg attributes of the resulting font are collected together in a pattern. Each 122a32e9e42Smrg property of the pattern can contain one or more values; these are listed 123a32e9e42Smrg in priority order; matches earlier in the list are considered "closer" 124a32e9e42Smrg than matches later in the list. 125ca08ab68Smrg 126ca08ab68Smrg The initial pattern is modified by applying the list of editing 127a32e9e42Smrg instructions specific to patterns found in the configuration; each 128a32e9e42Smrg consists of a match predicate and a set of editing operations. They are 129a32e9e42Smrg executed in the order they appeared in the configuration. Each match 130a32e9e42Smrg causes the associated sequence of editing operations to be applied. 131a32e9e42Smrg 132a32e9e42Smrg After the pattern has been edited, a sequence of default substitutions are 133a32e9e42Smrg performed to canonicalize the set of available properties; this avoids the 134a32e9e42Smrg need for the lower layers to constantly provide default values for various 135a32e9e42Smrg font properties during rendering. 136a32e9e42Smrg 137a32e9e42Smrg The canonical font pattern is finally matched against all available fonts. 138a32e9e42Smrg The distance from the pattern to the font is measured for each of several 139a32e9e42Smrg properties: foundry, charset, family, lang, spacing, pixelsize, style, 140a32e9e42Smrg slant, weight, antialias, rasterizer and outline. This list is in priority 141a32e9e42Smrg order -- results of comparing earlier elements of this list weigh more 142a32e9e42Smrg heavily than later elements. 143a32e9e42Smrg 144a32e9e42Smrg There is one special case to this rule; family names are split into two 145a32e9e42Smrg bindings; strong and weak. Strong family names are given greater 146a32e9e42Smrg precedence in the match than lang elements while weak family names are 147a32e9e42Smrg given lower precedence than lang elements. This permits the document 148a32e9e42Smrg language to drive font selection when any document specified font is 149a32e9e42Smrg unavailable. 150a32e9e42Smrg 151a32e9e42Smrg The pattern representing that font is augmented to include any properties 152a32e9e42Smrg found in the pattern but not found in the font itself; this permits the 153a32e9e42Smrg application to pass rendering instructions or any other data through the 154a32e9e42Smrg matching system. Finally, the list of editing instructions specific to 155a32e9e42Smrg fonts found in the configuration are applied to the pattern. This modified 156a32e9e42Smrg pattern is returned to the application. 157a32e9e42Smrg 158a32e9e42Smrg The return value contains sufficient information to locate and rasterize 159a32e9e42Smrg the font, including the file name, pixel size and other rendering data. As 160a32e9e42Smrg none of the information involved pertains to the FreeType library, 161a32e9e42Smrg applications are free to use any rasterization engine or even to take the 162a32e9e42Smrg identified font file and access it directly. 163a32e9e42Smrg 164a32e9e42Smrg The match/edit sequences in the configuration are performed in two passes 165a32e9e42Smrg because there are essentially two different operations necessary -- the 166a32e9e42Smrg first is to modify how fonts are selected; aliasing families and adding 167a32e9e42Smrg suitable defaults. The second is to modify how the selected fonts are 168a32e9e42Smrg rasterized. Those must apply to the selected font, not the original 169a32e9e42Smrg pattern as false matches will often occur. 170a32e9e42Smrg 171a32e9e42Smrg Font Names 172a32e9e42Smrg 173a32e9e42Smrg Fontconfig provides a textual representation for patterns that the library 174a32e9e42Smrg can both accept and generate. The representation is in three parts, first 175a32e9e42Smrg a list of family names, second a list of point sizes and finally a list of 176a32e9e42Smrg additional properties: 177a32e9e42Smrg 178a32e9e42Smrg <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>... 179a32e9e42Smrg 180a32e9e42Smrg 181a32e9e42Smrg Values in a list are separated with commas. The name needn't include 182a32e9e42Smrg either families or point sizes; they can be elided. In addition, there are 183a32e9e42Smrg symbolic constants that simultaneously indicate both a name and a value. 184a32e9e42Smrg Here are some examples: 185a32e9e42Smrg 186a32e9e42Smrg Name Meaning 187a32e9e42Smrg ---------------------------------------------------------- 188a32e9e42Smrg Times-12 12 point Times Roman 189a32e9e42Smrg Times-12:bold 12 point Times Bold 190a32e9e42Smrg Courier:italic Courier Italic in the default size 191a32e9e42Smrg Monospace:matrix=1 .1 0 1 The users preferred monospace font 192a32e9e42Smrg with artificial obliquing 193a32e9e42Smrg 194a32e9e42Smrg 195a32e9e42Smrg The '\', '-', ':' and ',' characters in family names must be preceded by a 196a32e9e42Smrg '\' character to avoid having them misinterpreted. Similarly, values 197a32e9e42Smrg containing '\', '=', '_', ':' and ',' must also have them preceded by a 198a32e9e42Smrg '\' character. The '\' characters are stripped out of the family name and 199a32e9e42Smrg values as the font name is read. 2002c393a42Smrg 2012c393a42SmrgDebugging Applications 2022c393a42Smrg 203a32e9e42Smrg To help diagnose font and applications problems, fontconfig is built with 204a32e9e42Smrg a large amount of internal debugging left enabled. It is controlled by 205a32e9e42Smrg means of the FC_DEBUG environment variable. The value of this variable is 206a32e9e42Smrg interpreted as a number, and each bit within that value controls different 207a32e9e42Smrg debugging messages. 208a32e9e42Smrg 209a32e9e42Smrg Name Value Meaning 210a32e9e42Smrg --------------------------------------------------------- 211a32e9e42Smrg MATCH 1 Brief information about font matching 212a32e9e42Smrg MATCHV 2 Extensive font matching information 213a32e9e42Smrg EDIT 4 Monitor match/test/edit execution 214a32e9e42Smrg FONTSET 8 Track loading of font information at startup 215a32e9e42Smrg CACHE 16 Watch cache files being written 216a32e9e42Smrg CACHEV 32 Extensive cache file writing information 217a32e9e42Smrg PARSE 64 (no longer in use) 218a32e9e42Smrg SCAN 128 Watch font files being scanned to build caches 219a32e9e42Smrg SCANV 256 Verbose font file scanning information 220a32e9e42Smrg MEMORY 512 Monitor fontconfig memory usage 221a32e9e42Smrg CONFIG 1024 Monitor which config files are loaded 222a32e9e42Smrg LANGSET 2048 Dump char sets used to construct lang values 223a32e9e42Smrg MATCH2 4096 Display font-matching transformation in patterns 224a32e9e42Smrg 225a32e9e42Smrg 226a32e9e42Smrg Add the value of the desired debug levels together and assign that (in 227a32e9e42Smrg base 10) to the FC_DEBUG environment variable before running the 228a32e9e42Smrg application. Output from these statements is sent to stdout. 2292c393a42Smrg 2302c393a42SmrgLang Tags 2312c393a42Smrg 232a32e9e42Smrg Each font in the database contains a list of languages it supports. This 233a32e9e42Smrg is computed by comparing the Unicode coverage of the font with the 234a32e9e42Smrg orthography of each language. Languages are tagged using an RFC-3066 235a32e9e42Smrg compatible naming and occur in two parts -- the ISO 639 language tag 236a32e9e42Smrg followed a hyphen and then by the ISO 3166 country code. The hyphen and 237a32e9e42Smrg country code may be elided. 238a6844aabSmrg 239a32e9e42Smrg Fontconfig has orthographies for several languages built into the library. 240a32e9e42Smrg No provision has been made for adding new ones aside from rebuilding the 241a32e9e42Smrg library. It currently supports 122 of the 139 languages named in ISO 242a32e9e42Smrg 639-1, 141 of the languages with two-letter codes from ISO 639-2 and 243a32e9e42Smrg another 30 languages with only three-letter codes. Languages with both two 244a32e9e42Smrg and three letter codes are provided with only the two letter code. 245a6844aabSmrg 246a32e9e42Smrg For languages used in multiple territories with radically different 247a32e9e42Smrg character sets, fontconfig includes per-territory orthographies. This 248a32e9e42Smrg includes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese. 2492c393a42Smrg 250a32e9e42SmrgConfiguration File Format 2512c393a42Smrg 252a32e9e42Smrg Configuration files for fontconfig are stored in XML format; this format 253a32e9e42Smrg makes external configuration tools easier to write and ensures that they 254a32e9e42Smrg will generate syntactically correct configuration files. As XML files are 255a32e9e42Smrg plain text, they can also be manipulated by the expert user using a text 256a32e9e42Smrg editor. 257a32e9e42Smrg 258a32e9e42Smrg The fontconfig document type definition resides in the external entity 259a32e9e42Smrg "fonts.dtd"; this is normally stored in the default font configuration 260a32e9e42Smrg directory (/etc/fonts). Each configuration file should contain the 261a32e9e42Smrg following structure: 262a32e9e42Smrg 263a32e9e42Smrg <?xml version="1.0"?> 264a32e9e42Smrg <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> 265a32e9e42Smrg <fontconfig> 266a32e9e42Smrg ... 267a32e9e42Smrg </fontconfig> 268a32e9e42Smrg 269a32e9e42Smrg 270a32e9e42Smrg <fontconfig> 271a32e9e42Smrg 272a32e9e42Smrg This is the top level element for a font configuration and can contain 273a32e9e42Smrg <dir>, <cachedir>, <include>, <match> and <alias> elements in any order. 274a32e9e42Smrg 275a32e9e42Smrg <dir prefix="default"> 276a32e9e42Smrg 277a32e9e42Smrg This element contains a directory name which will be scanned for font 278a32e9e42Smrg files to include in the set of available fonts. If 'prefix' is set to 279a32e9e42Smrg "xdg", the value in the XDG_DATA_HOME environment variable will be added 280a32e9e42Smrg as the path prefix. please see XDG Base Directory Specification for more 281a32e9e42Smrg details. 282a32e9e42Smrg 283a32e9e42Smrg <cachedir prefix="default"> 284a32e9e42Smrg 285a32e9e42Smrg This element contains a directory name that is supposed to be stored or 286a32e9e42Smrg read the cache of font information. If multiple elements are specified in 287a32e9e42Smrg the configuration file, the directory that can be accessed first in the 288a32e9e42Smrg list will be used to store the cache files. If it starts with '~', it 289a32e9e42Smrg refers to a directory in the users home directory. If 'prefix' is set to 290a32e9e42Smrg "xdg", the value in the XDG_CACHE_HOME environment variable will be added 291a32e9e42Smrg as the path prefix. please see XDG Base Directory Specification for more 292a32e9e42Smrg details. The default directory is ``$XDG_CACHE_HOME/fontconfig'' and it 293a32e9e42Smrg contains the cache files named ``<hash 294a32e9e42Smrg value>-<architecture>.cache-<version>'', where <version> is the fontconfig 295a32e9e42Smrg cache file version number (currently 7). 296a32e9e42Smrg 297a32e9e42Smrg <include ignore_missing="no" prefix="default"> 298a32e9e42Smrg 299a32e9e42Smrg This element contains the name of an additional configuration file or 300a32e9e42Smrg directory. If a directory, every file within that directory starting with 301a32e9e42Smrg an ASCII digit (U+0030 - U+0039) and ending with the string ``.conf'' will 302a32e9e42Smrg be processed in sorted order. When the XML datatype is traversed by 303a32e9e42Smrg FcConfigParse, the contents of the file(s) will also be incorporated into 304a32e9e42Smrg the configuration by passing the filename(s) to FcConfigLoadAndParse. If 305a32e9e42Smrg 'ignore_missing' is set to "yes" instead of the default "no", a missing 306a32e9e42Smrg file or directory will elicit no warning message from the library. If 307a32e9e42Smrg 'prefix' is set to "xdg", the value in the XDG_CONFIG_HOME environment 308a32e9e42Smrg variable will be added as the path prefix. please see XDG Base Directory 309ca08ab68Smrg Specification for more details. 310ca08ab68Smrg 311a32e9e42Smrg <config> 312a32e9e42Smrg 313a32e9e42Smrg This element provides a place to consolidate additional configuration 314a32e9e42Smrg information. <config> can contain <blank> and <rescan> elements in any 315a32e9e42Smrg order. 316a32e9e42Smrg 317a32e9e42Smrg <blank> 318a32e9e42Smrg 319a32e9e42Smrg Fonts often include "broken" glyphs which appear in the encoding but are 320a32e9e42Smrg drawn as blanks on the screen. Within the <blank> element, place each 321a32e9e42Smrg Unicode characters which is supposed to be blank in an <int> element. 322a32e9e42Smrg Characters outside of this set which are drawn as blank will be elided 323a32e9e42Smrg from the set of characters supported by the font. 324a32e9e42Smrg 325a32e9e42Smrg <rescan> 326a32e9e42Smrg 327a32e9e42Smrg The <rescan> element holds an <int> element which indicates the default 328a32e9e42Smrg interval between automatic checks for font configuration changes. 329a32e9e42Smrg Fontconfig will validate all of the configuration files and directories 330a32e9e42Smrg and automatically rebuild the internal datastructures when this interval 331a32e9e42Smrg passes. 332a32e9e42Smrg 333a32e9e42Smrg <selectfont> 334a32e9e42Smrg 335a32e9e42Smrg This element is used to black/white list fonts from being listed or 336a32e9e42Smrg matched against. It holds acceptfont and rejectfont elements. 337a32e9e42Smrg 338a32e9e42Smrg <acceptfont> 339a32e9e42Smrg 340a32e9e42Smrg Fonts matched by an acceptfont element are "whitelisted"; such fonts are 341a32e9e42Smrg explicitly included in the set of fonts used to resolve list and match 342a32e9e42Smrg requests; including them in this list protects them from being 343a32e9e42Smrg "blacklisted" by a rejectfont element. Acceptfont elements include glob 344a32e9e42Smrg and pattern elements which are used to match fonts. 345a32e9e42Smrg 346a32e9e42Smrg <rejectfont> 347953daebaSmrg 348a32e9e42Smrg Fonts matched by an rejectfont element are "blacklisted"; such fonts are 349a32e9e42Smrg excluded from the set of fonts used to resolve list and match requests as 350a32e9e42Smrg if they didn't exist in the system. Rejectfont elements include glob and 351a32e9e42Smrg pattern elements which are used to match fonts. 352953daebaSmrg 353a32e9e42Smrg <glob> 354ca08ab68Smrg 355a32e9e42Smrg Glob elements hold shell-style filename matching patterns (including ? and 356a32e9e42Smrg *) which match fonts based on their complete pathnames. This can be used 357a32e9e42Smrg to exclude a set of directories (/usr/share/fonts/uglyfont*), or 358a32e9e42Smrg particular font file types (*.pcf.gz), but the latter mechanism relies 359a32e9e42Smrg rather heavily on filenaming conventions which can't be relied upon. Note 360a32e9e42Smrg that globs only apply to directories, not to individual fonts. 361ca08ab68Smrg 362a32e9e42Smrg <pattern> 363ca08ab68Smrg 364a32e9e42Smrg Pattern elements perform list-style matching on incoming fonts; that is, 365a32e9e42Smrg they hold a list of elements and associated values. If all of those 366a32e9e42Smrg elements have a matching value, then the pattern matches the font. This 367a32e9e42Smrg can be used to select fonts based on attributes of the font (scalable, 368a32e9e42Smrg bold, etc), which is a more reliable mechanism than using file extensions. 369a32e9e42Smrg Pattern elements include patelt elements. 3702c393a42Smrg 371a32e9e42Smrg <patelt name="property"> 3722c393a42Smrg 373a32e9e42Smrg Patelt elements hold a single pattern element and list of values. They 374a32e9e42Smrg must have a 'name' attribute which indicates the pattern element name. 375a32e9e42Smrg Patelt elements include int, double, string, matrix, bool, charset and 376a32e9e42Smrg const elements. 377a32e9e42Smrg 378a32e9e42Smrg <match target="pattern"> 379a32e9e42Smrg 380a32e9e42Smrg This element holds first a (possibly empty) list of <test> elements and 381a32e9e42Smrg then a (possibly empty) list of <edit> elements. Patterns which match all 382a32e9e42Smrg of the tests are subjected to all the edits. If 'target' is set to "font" 383a32e9e42Smrg instead of the default "pattern", then this element applies to the font 384a32e9e42Smrg name resulting from a match rather than a font pattern to be matched. If 385a32e9e42Smrg 'target' is set to "scan", then this element applies when the font is 386a32e9e42Smrg scanned to build the fontconfig database. 387a32e9e42Smrg 388a32e9e42Smrg <test qual="any" name="property" target="default" compare="eq"> 389a32e9e42Smrg 390a32e9e42Smrg This element contains a single value which is compared with the target 391a32e9e42Smrg ('pattern', 'font', 'scan' or 'default') property "property" (substitute 392a32e9e42Smrg any of the property names seen above). 'compare' can be one of "eq", 393a32e9e42Smrg "not_eq", "less", "less_eq", "more", "more_eq", "contains" or 394a32e9e42Smrg "not_contains". 'qual' may either be the default, "any", in which case the 395a32e9e42Smrg match succeeds if any value associated with the property matches the test 396a32e9e42Smrg value, or "all", in which case all of the values associated with the 397a32e9e42Smrg property must match the test value. 'ignore-blanks' takes a boolean value. 398a32e9e42Smrg if 'ignore-blanks' is set "true", any blanks in the string will be ignored 399a32e9e42Smrg on its comparison. this takes effects only when compare="eq" or 400a32e9e42Smrg compare="not_eq". When used in a <match target="font"> element, the 401a32e9e42Smrg target= attribute in the <test> element selects between matching the 402a32e9e42Smrg original pattern or the font. "default" selects whichever target the outer 403a32e9e42Smrg <match> element has selected. 404a32e9e42Smrg 405a32e9e42Smrg <edit name="property" mode="assign" binding="weak"> 406a32e9e42Smrg 407a32e9e42Smrg This element contains a list of expression elements (any of the value or 408a32e9e42Smrg operator elements). The expression elements are evaluated at run-time and 409a32e9e42Smrg modify the property "property". The modification depends on whether 410a32e9e42Smrg "property" was matched by one of the associated <test> elements, if so, 411a32e9e42Smrg the modification may affect the first matched value. Any values inserted 412a32e9e42Smrg into the property are given the indicated binding ("strong", "weak" or 413a32e9e42Smrg "same") with "same" binding using the value from the matched pattern 414a32e9e42Smrg element. 'mode' is one of: 415a32e9e42Smrg 416a32e9e42Smrg Mode With Match Without Match 417a32e9e42Smrg --------------------------------------------------------------------- 418a32e9e42Smrg "assign" Replace matching value Replace all values 419a32e9e42Smrg "assign_replace" Replace all values Replace all values 420a32e9e42Smrg "prepend" Insert before matching Insert at head of list 421a32e9e42Smrg "prepend_first" Insert at head of list Insert at head of list 422a32e9e42Smrg "append" Append after matching Append at end of list 423a32e9e42Smrg "append_last" Append at end of list Append at end of list 424a32e9e42Smrg "delete" Delete matching value Delete all values 425a32e9e42Smrg "delete_all" Delete all values Delete all values 426a32e9e42Smrg 427a32e9e42Smrg 428a32e9e42Smrg <int>, <double>, <string>, <bool> 429a32e9e42Smrg 430a32e9e42Smrg These elements hold a single value of the indicated type. <bool> elements 431a32e9e42Smrg hold either true or false. An important limitation exists in the parsing 432a32e9e42Smrg of floating point numbers -- fontconfig requires that the mantissa start 433a32e9e42Smrg with a digit, not a decimal point, so insert a leading zero for purely 434a32e9e42Smrg fractional values (e.g. use 0.5 instead of .5 and -0.5 instead of -.5). 435a32e9e42Smrg 436a32e9e42Smrg <matrix> 437a32e9e42Smrg 438a32e9e42Smrg This element holds four numerical expressions of an affine transformation. 439a32e9e42Smrg At their simplest these will be four <double> elements but they can also 440a32e9e42Smrg be more involved expressions. 441a32e9e42Smrg 442a32e9e42Smrg <range> 443a32e9e42Smrg 444a32e9e42Smrg This element holds the two <int> elements of a range representation. 445a32e9e42Smrg 446a32e9e42Smrg <charset> 447a32e9e42Smrg 448a32e9e42Smrg This element holds at least one <int> element of an Unicode code point or 449a32e9e42Smrg more. 450a32e9e42Smrg 451a32e9e42Smrg <langset> 452a32e9e42Smrg 453a32e9e42Smrg This element holds at least one <string> element of a RFC-3066-style 454a32e9e42Smrg languages or more. 455a32e9e42Smrg 456a32e9e42Smrg <name> 457a32e9e42Smrg 458a32e9e42Smrg Holds a property name. Evaluates to the first value from the property of 459a32e9e42Smrg the pattern. If the 'target' attribute is not present, it will default to 460a32e9e42Smrg 'default', in which case the property is returned from the font pattern 461a32e9e42Smrg during a target="font" match, and to the pattern during a target="pattern" 462a32e9e42Smrg match. The attribute can also take the values 'font' or 'pattern' to 463a32e9e42Smrg explicitly choose which pattern to use. It is an error to use a target of 464a32e9e42Smrg 'font' in a match that has target="pattern". 465a32e9e42Smrg 466a32e9e42Smrg <const> 467a32e9e42Smrg 468a32e9e42Smrg Holds the name of a constant; these are always integers and serve as 469a32e9e42Smrg symbolic names for common font values: 470a32e9e42Smrg 471a32e9e42Smrg Constant Property Value 472a32e9e42Smrg ------------------------------------- 473a32e9e42Smrg thin weight 0 474a32e9e42Smrg extralight weight 40 475a32e9e42Smrg ultralight weight 40 476a32e9e42Smrg light weight 50 477a32e9e42Smrg demilight weight 55 478a32e9e42Smrg semilight weight 55 479a32e9e42Smrg book weight 75 480a32e9e42Smrg regular weight 80 481a32e9e42Smrg normal weight 80 482a32e9e42Smrg medium weight 100 483a32e9e42Smrg demibold weight 180 484a32e9e42Smrg semibold weight 180 485a32e9e42Smrg bold weight 200 486a32e9e42Smrg extrabold weight 205 487a32e9e42Smrg black weight 210 488a32e9e42Smrg heavy weight 210 489a32e9e42Smrg roman slant 0 490a32e9e42Smrg italic slant 100 491a32e9e42Smrg oblique slant 110 492a32e9e42Smrg ultracondensed width 50 493a32e9e42Smrg extracondensed width 63 494a32e9e42Smrg condensed width 75 495a32e9e42Smrg semicondensed width 87 496a32e9e42Smrg normal width 100 497a32e9e42Smrg semiexpanded width 113 498a32e9e42Smrg expanded width 125 499a32e9e42Smrg extraexpanded width 150 500a32e9e42Smrg ultraexpanded width 200 501a32e9e42Smrg proportional spacing 0 502a32e9e42Smrg dual spacing 90 503a32e9e42Smrg mono spacing 100 504a32e9e42Smrg charcell spacing 110 505a32e9e42Smrg unknown rgba 0 506a32e9e42Smrg rgb rgba 1 507a32e9e42Smrg bgr rgba 2 508a32e9e42Smrg vrgb rgba 3 509a32e9e42Smrg vbgr rgba 4 510a32e9e42Smrg none rgba 5 511a32e9e42Smrg lcdnone lcdfilter 0 512a32e9e42Smrg lcddefault lcdfilter 1 513a32e9e42Smrg lcdlight lcdfilter 2 514a32e9e42Smrg lcdlegacy lcdfilter 3 515a32e9e42Smrg hintnone hintstyle 0 516a32e9e42Smrg hintslight hintstyle 1 517a32e9e42Smrg hintmedium hintstyle 2 518a32e9e42Smrg hintfull hintstyle 3 519a32e9e42Smrg 520a32e9e42Smrg 521a32e9e42Smrg <or>, <and>, <plus>, <minus>, <times>, <divide> 522a32e9e42Smrg 523a32e9e42Smrg These elements perform the specified operation on a list of expression 524a32e9e42Smrg elements. <or> and <and> are boolean, not bitwise. 525a32e9e42Smrg 526a32e9e42Smrg <eq>, <not_eq>, <less>, <less_eq>, <more>, <more_eq>, <contains>, 527a32e9e42Smrg <not_contains 5282c393a42Smrg 529ca08ab68Smrg These elements compare two values, producing a boolean result. 5302c393a42Smrg 531a32e9e42Smrg <not> 5322c393a42Smrg 533ca08ab68Smrg Inverts the boolean sense of its one expression element 5342c393a42Smrg 535a32e9e42Smrg <if> 5362c393a42Smrg 537a32e9e42Smrg This element takes three expression elements; if the value of the first is 538a32e9e42Smrg true, it produces the value of the second, otherwise it produces the value 539a32e9e42Smrg of the third. 5402c393a42Smrg 541a32e9e42Smrg <alias> 5422c393a42Smrg 543a32e9e42Smrg Alias elements provide a shorthand notation for the set of common match 544a32e9e42Smrg operations needed to substitute one font family for another. They contain 545a32e9e42Smrg a <family> element followed by optional <prefer>, <accept> and <default> 546a32e9e42Smrg elements. Fonts matching the <family> element are edited to prepend the 547a32e9e42Smrg list of <prefer>ed families before the matching <family>, append the 548a32e9e42Smrg <accept>able families after the matching <family> and append the <default> 549a32e9e42Smrg families to the end of the family list. 550ca08ab68Smrg 551a32e9e42Smrg <family> 552ca08ab68Smrg 553ca08ab68Smrg Holds a single font family name 554ca08ab68Smrg 555a32e9e42Smrg <prefer>, <accept>, <default> 556ca08ab68Smrg 557a32e9e42Smrg These hold a list of <family> elements to be used by the <alias> element. 5582c393a42Smrg 5592c393a42SmrgEXAMPLE CONFIGURATION FILE 5602c393a42Smrg 561a32e9e42Smrg System configuration file 5622c393a42Smrg 563ca08ab68Smrg This is an example of a system-wide configuration file 564a32e9e42Smrg 5652c393a42Smrg<?xml version="1.0"?> 5662c393a42Smrg<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> 5672c393a42Smrg<!-- /etc/fonts/fonts.conf file to configure system font access --> 5682c393a42Smrg<fontconfig> 5692c393a42Smrg<!-- 5702c393a42Smrg Find fonts in these directories 5712c393a42Smrg--> 5722c393a42Smrg<dir>/usr/share/fonts</dir> 5732c393a42Smrg<dir>/usr/X11R6/lib/X11/fonts</dir> 5742c393a42Smrg 5752c393a42Smrg<!-- 5762c393a42Smrg Accept deprecated 'mono' alias, replacing it with 'monospace' 5772c393a42Smrg--> 5782c393a42Smrg<match target="pattern"> 5792c393a42Smrg <test qual="any" name="family"><string>mono</string></test> 580a32e9e42Smrg <edit name="family" mode="assign"><string>monospace</string></edit> 5812c393a42Smrg</match> 5822c393a42Smrg 5832c393a42Smrg<!-- 584ca08ab68Smrg Names not including any well known alias are given 'sans-serif' 5852c393a42Smrg--> 5862c393a42Smrg<match target="pattern"> 587a32e9e42Smrg <test qual="all" name="family" compare="not_eq"><string>sans-serif</string></test> 588a32e9e42Smrg <test qual="all" name="family" compare="not_eq"><string>serif</string></test> 589a32e9e42Smrg <test qual="all" name="family" compare="not_eq"><string>monospace</string></test> 590a32e9e42Smrg <edit name="family" mode="append_last"><string>sans-serif</string></edit> 5912c393a42Smrg</match> 5922c393a42Smrg 5932c393a42Smrg<!-- 5942c393a42Smrg Load per-user customization file, but don't complain 5952c393a42Smrg if it doesn't exist 5962c393a42Smrg--> 597a32e9e42Smrg<include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</include> 5982c393a42Smrg 5992c393a42Smrg<!-- 6002c393a42Smrg Load local customization files, but don't complain 6012c393a42Smrg if there aren't any 6022c393a42Smrg--> 6032c393a42Smrg<include ignore_missing="yes">conf.d</include> 6042c393a42Smrg<include ignore_missing="yes">local.conf</include> 6052c393a42Smrg 6062c393a42Smrg<!-- 6072c393a42Smrg Alias well known font names to available TrueType fonts. 6082c393a42Smrg These substitute TrueType faces for similar Type1 6092c393a42Smrg faces to improve screen appearance. 6102c393a42Smrg--> 6112c393a42Smrg<alias> 6122c393a42Smrg <family>Times</family> 6132c393a42Smrg <prefer><family>Times New Roman</family></prefer> 6142c393a42Smrg <default><family>serif</family></default> 6152c393a42Smrg</alias> 6162c393a42Smrg<alias> 6172c393a42Smrg <family>Helvetica</family> 6182c393a42Smrg <prefer><family>Arial</family></prefer> 6192c393a42Smrg <default><family>sans</family></default> 6202c393a42Smrg</alias> 6212c393a42Smrg<alias> 6222c393a42Smrg <family>Courier</family> 6232c393a42Smrg <prefer><family>Courier New</family></prefer> 6242c393a42Smrg <default><family>monospace</family></default> 6252c393a42Smrg</alias> 6262c393a42Smrg 6272c393a42Smrg<!-- 6282c393a42Smrg Provide required aliases for standard names 6292c393a42Smrg Do these after the users configuration file so that 6302c393a42Smrg any aliases there are used preferentially 6312c393a42Smrg--> 6322c393a42Smrg<alias> 6332c393a42Smrg <family>serif</family> 6342c393a42Smrg <prefer><family>Times New Roman</family></prefer> 6352c393a42Smrg</alias> 6362c393a42Smrg<alias> 6372c393a42Smrg <family>sans</family> 6382c393a42Smrg <prefer><family>Arial</family></prefer> 6392c393a42Smrg</alias> 6402c393a42Smrg<alias> 6412c393a42Smrg <family>monospace</family> 6422c393a42Smrg <prefer><family>Andale Mono</family></prefer> 6432c393a42Smrg</alias> 644ca08ab68Smrg 645ca08ab68Smrg<-- 646ca08ab68Smrg The example of the requirements of OR operator; 647ca08ab68Smrg If the 'family' contains 'Courier New' OR 'Courier' 648ca08ab68Smrg add 'monospace' as the alternative 649ca08ab68Smrg--> 650ca08ab68Smrg<match target="pattern"> 651a32e9e42Smrg <test name="family" compare="eq"> 652ca08ab68Smrg <string>Courier New</string> 653ca08ab68Smrg </test> 654ca08ab68Smrg <edit name="family" mode="prepend"> 655ca08ab68Smrg <string>monospace</string> 656ca08ab68Smrg </edit> 657ca08ab68Smrg</match> 658ca08ab68Smrg<match target="pattern"> 659a32e9e42Smrg <test name="family" compare="eq"> 660ca08ab68Smrg <string>Courier</string> 661ca08ab68Smrg </test> 662ca08ab68Smrg <edit name="family" mode="prepend"> 663ca08ab68Smrg <string>monospace</string> 664ca08ab68Smrg </edit> 665ca08ab68Smrg</match> 666ca08ab68Smrg 6672c393a42Smrg</fontconfig> 6682c393a42Smrg 669a6844aabSmrg 670a32e9e42Smrg User configuration file 671ca08ab68Smrg 672a32e9e42Smrg This is an example of a per-user configuration file that lives in 673a32e9e42Smrg $XDG_CONFIG_HOME/fontconfig/fonts.conf 674a32e9e42Smrg 675a32e9e42Smrg <?xml version="1.0"?> 676a32e9e42Smrg <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> 677a32e9e42Smrg <!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration --> 678a32e9e42Smrg <fontconfig> 679a32e9e42Smrg 680a32e9e42Smrg <!-- 681a32e9e42Smrg Private font directory 682a32e9e42Smrg --> 683a32e9e42Smrg <dir prefix="xdg">fonts</dir> 684a32e9e42Smrg 685a32e9e42Smrg <!-- 686a32e9e42Smrg use rgb sub-pixel ordering to improve glyph appearance on 687a32e9e42Smrg LCD screens. Changes affecting rendering, but not matching 688a32e9e42Smrg should always use target="font". 689a32e9e42Smrg --> 690a32e9e42Smrg <match target="font"> 691a32e9e42Smrg <edit name="rgba" mode="assign"><const>rgb</const></edit> 692a32e9e42Smrg </match> 693a32e9e42Smrg <!-- 694a32e9e42Smrg use WenQuanYi Zen Hei font when serif is requested for Chinese 695a32e9e42Smrg --> 696a32e9e42Smrg <match> 697a32e9e42Smrg <!-- 698a32e9e42Smrg If you don't want to use WenQuanYi Zen Hei font for zh-tw etc, 699a32e9e42Smrg you can use zh-cn instead of zh. 700a32e9e42Smrg Please note, even if you set zh-cn, it still matches zh. 701a32e9e42Smrg if you don't like it, you can use compare="eq" 702a32e9e42Smrg instead of compare="contains". 703a32e9e42Smrg --> 704a32e9e42Smrg <test name="lang" compare="contains"> 705a32e9e42Smrg <string>zh</string> 706a32e9e42Smrg </test> 707a32e9e42Smrg <test name="family"> 708a32e9e42Smrg <string>serif</string> 709a32e9e42Smrg </test> 710a32e9e42Smrg <edit name="family" mode="prepend"> 711a32e9e42Smrg <string>WenQuanYi Zen Hei</string> 712a32e9e42Smrg </edit> 713a32e9e42Smrg </match> 714a32e9e42Smrg <!-- 715a32e9e42Smrg use VL Gothic font when sans-serif is requested for Japanese 716a32e9e42Smrg --> 717a32e9e42Smrg <match> 718a32e9e42Smrg <test name="lang" compare="contains"> 719a32e9e42Smrg <string>ja</string> 720a32e9e42Smrg </test> 721a32e9e42Smrg <test name="family"> 722a32e9e42Smrg <string>sans-serif</string> 723a32e9e42Smrg </test> 724a32e9e42Smrg <edit name="family" mode="prepend"> 725a32e9e42Smrg <string>VL Gothic</string> 726a32e9e42Smrg </edit> 727a32e9e42Smrg </match> 728a32e9e42Smrg </fontconfig> 7292c393a42Smrg 730a6844aabSmrg 731ca08ab68SmrgFiles 7322c393a42Smrg 733a32e9e42Smrg fonts.conf contains configuration information for the fontconfig library 734a32e9e42Smrg consisting of directories to look at for font information as well as 735a32e9e42Smrg instructions on editing program specified font patterns before attempting 736a32e9e42Smrg to match the available fonts. It is in XML format. 7372c393a42Smrg 738ca08ab68Smrg conf.d is the conventional name for a directory of additional 739a32e9e42Smrg configuration files managed by external applications or the local 740a32e9e42Smrg administrator. The filenames starting with decimal digits are sorted in 741a32e9e42Smrg lexicographic order and used as additional configuration files. All of 742a32e9e42Smrg these files are in XML format. The master fonts.conf file references this 743a32e9e42Smrg directory in an <include> directive. 744a32e9e42Smrg 745a32e9e42Smrg fonts.dtd is a DTD that describes the format of the configuration files. 746a32e9e42Smrg 747a32e9e42Smrg $XDG_CONFIG_HOME/fontconfig/conf.d and ~/.fonts.conf.d is the conventional 748a32e9e42Smrg name for a per-user directory of (typically auto-generated) configuration 749a32e9e42Smrg files, although the actual location is specified in the global fonts.conf 750a32e9e42Smrg file. please note that ~/.fonts.conf.d is deprecated now. it will not be 751ca08ab68Smrg read by default in the future version. 752ca08ab68Smrg 753ca08ab68Smrg $XDG_CONFIG_HOME/fontconfig/fonts.conf and ~/.fonts.conf is the 754a32e9e42Smrg conventional location for per-user font configuration, although the actual 755a32e9e42Smrg location is specified in the global fonts.conf file. please note that 756a32e9e42Smrg ~/.fonts.conf is deprecated now. it will not be read by default in the 757a32e9e42Smrg future version. 758a32e9e42Smrg 759a32e9e42Smrg $XDG_CACHE_HOME/fontconfig/*.cache-* and ~/.fontconfig/*.cache-* is the 760a32e9e42Smrg conventional repository of font information that isn't found in the 761a32e9e42Smrg per-directory caches. This file is automatically maintained by fontconfig. 762a32e9e42Smrg please note that ~/.fontconfig/*.cache-* is deprecated now. it will not be 763ca08ab68Smrg read by default in the future version. 7642c393a42Smrg 765ca08ab68SmrgEnvironment variables 7662c393a42Smrg 767a32e9e42Smrg FONTCONFIG_FILE is used to override the default configuration file. 7682c393a42Smrg 769a32e9e42Smrg FONTCONFIG_PATH is used to override the default configuration directory. 7702c393a42Smrg 771a32e9e42Smrg FONTCONFIG_SYSROOT is used to set a default sysroot directory. 772953daebaSmrg 773a32e9e42Smrg FC_DEBUG is used to output the detailed debugging messages. see 774a32e9e42Smrg [1]Debugging Applications section for more details. 775a32e9e42Smrg 776a32e9e42Smrg FC_DBG_MATCH_FILTER is used to filter out the patterns. this takes a 777a32e9e42Smrg comma-separated list of object names and effects only when FC_DEBUG has 778a32e9e42Smrg MATCH2. see [2]Debugging Applications section for more details. 779a32e9e42Smrg 780a32e9e42Smrg FC_LANG is used to specify the default language as the weak binding in the 781a32e9e42Smrg query. if this isn't set, the default language will be determined from 782a32e9e42Smrg current locale. 783a32e9e42Smrg 784a32e9e42Smrg FONTCONFIG_USE_MMAP is used to control the use of mmap(2) for the cache 785a32e9e42Smrg files if available. this take a boolean value. fontconfig will checks if 786a32e9e42Smrg the cache files are stored on the filesystem that is safe to use mmap(2). 787a32e9e42Smrg explicitly setting this environment variable will causes skipping this 788a32e9e42Smrg check and enforce to use or not use mmap(2) anyway. 789a32e9e42Smrg 790a32e9e42Smrg SOURCE_DATE_EPOCH is used to ensure fc-cache(1) generates files in a 791a32e9e42Smrg deterministic manner in order to support reproducible builds. When set to 792a32e9e42Smrg a numeric representation of UNIX timestamp, fontconfig will prefer this 793a32e9e42Smrg value over using the modification timestamps of the input files in order 794a32e9e42Smrg to identify which cache files require regeneration. If SOURCE_DATE_EPOCH 795a32e9e42Smrg is not set (or is newer than the mtime of the directory), the existing 796a32e9e42Smrg behaviour is unchanged. 7972c393a42Smrg 7982c393a42SmrgSee Also 7992c393a42Smrg 800a32e9e42Smrg fc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1), 801a32e9e42Smrg [3]SOURCE_DATE_EPOCH. 8022c393a42Smrg 8032c393a42SmrgVersion 8042c393a42Smrg 805a32e9e42Smrg Fontconfig version 2.13.1 806a32e9e42Smrg 807a32e9e42SmrgReferences 808a32e9e42Smrg 809a32e9e42Smrg Visible links 810a32e9e42Smrg 1. file:///tmp/html-cm5uzN#DEBUG 811a32e9e42Smrg 2. file:///tmp/html-cm5uzN#DEBUG 812a32e9e42Smrg 3. https://reproducible-builds.org/specs/source-date-epoch/ 813