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. 66ae02b298SmrgProperty Type Description 67ae02b298Smrg-------------------------------------------------------------- 68ae02b298Smrgfamily String Font family names 69ae02b298Smrgfamilylang String Languages corresponding to each family 70ae02b298Smrgstyle String Font style. Overrides weight and slant 71ae02b298Smrgstylelang String Languages corresponding to each style 72ae02b298Smrgfullname String Font full names (often includes style) 73ae02b298Smrgfullnamelang String Languages corresponding to each fullname 74ae02b298Smrgslant Int Italic, oblique or roman 75ae02b298Smrgweight Int Light, medium, demibold, bold or black 76ae02b298Smrgsize Double Point size 77ae02b298Smrgwidth Int Condensed, normal or expanded 78ae02b298Smrgaspect Double Stretches glyphs horizontally before hinting 79ae02b298Smrgpixelsize Double Pixel size 80ae02b298Smrgspacing Int Proportional, dual-width, monospace or charcell 81ae02b298Smrgfoundry String Font foundry name 82ae02b298Smrgantialias Bool Whether glyphs can be antialiased 83ae02b298Smrghinting Bool Whether the rasterizer should use hinting 84ae02b298Smrghintstyle Int Automatic hinting style 85ae02b298Smrgverticallayout Bool Use vertical layout 86ae02b298Smrgautohint Bool Use autohinter instead of normal hinter 87ae02b298Smrgglobaladvance Bool Use font global advance data (deprecated) 88ae02b298Smrgfile String The filename holding the font 89ae02b298Smrgindex Int The index of the font within the file 90ae02b298Smrgftface FT_Face Use the specified FreeType face object 91ae02b298Smrgrasterizer String Which rasterizer is in use (deprecated) 92ae02b298Smrgoutline Bool Whether the glyphs are outlines 93ae02b298Smrgscalable Bool Whether glyphs can be scaled 94ae02b298Smrgcolor Bool Whether any glyphs have color 95ae02b298Smrgscale Double Scale factor for point->pixel conversions 96ae02b298Smrg (deprecated) 97ae02b298Smrgdpi Double Target dots per inch 98ae02b298Smrgrgba Int unknown, rgb, bgr, vrgb, vbgr, 99ae02b298Smrg none - subpixel geometry 100ae02b298Smrglcdfilter Int Type of LCD filter 101ae02b298Smrgminspace Bool Eliminate leading from line spacing 102ae02b298Smrgcharset CharSet Unicode chars encoded by the font 103ae02b298Smrglang String List of RFC-3066-style languages this 104ae02b298Smrg font supports 105ae02b298Smrgfontversion Int Version number of the font 106ae02b298Smrgcapability String List of layout capabilities in the font 107ae02b298Smrgfontformat String String name of the font format 108ae02b298Smrgembolden Bool Rasterizer should synthetically embolden the fon 109ae02b298Smrgt 110ae02b298Smrgembeddedbitmap Bool Use the embedded bitmap instead of the outline 111ae02b298Smrgdecorative Bool Whether the style is a decorative variant 112ae02b298Smrgfontfeatures String List of the feature tags in OpenType to be enabl 113ae02b298Smrged 114ae02b298Smrgnamelang String Language name to be used for the default value o 115ae02b298Smrgf 116ae02b298Smrg familylang, stylelang, and fullnamelang 117ae02b298Smrgprgname String String Name of the running program 118ae02b298Smrgpostscriptname String Font family name in PostScript 119ae02b298Smrgfonthashint Bool Whether the font has hinting 120ae02b298Smrgorder Int Order number of the font 121953daebaSmrg 122eceda581SmrgFont Matching 123953daebaSmrg 124eceda581Smrg Fontconfig performs matching by measuring the distance from a 125eceda581Smrg provided pattern to all of the available fonts in the system. 126eceda581Smrg The closest matching font is selected. This ensures that a font 127eceda581Smrg will always be returned, but doesn't ensure that it is anything 128eceda581Smrg like the requested pattern. 129a32e9e42Smrg 130eceda581Smrg Font matching starts with an application constructed pattern. 131eceda581Smrg The desired attributes of the resulting font are collected 132eceda581Smrg together in a pattern. Each property of the pattern can contain 133eceda581Smrg one or more values; these are listed in priority order; matches 134eceda581Smrg earlier in the list are considered "closer" than matches later 135eceda581Smrg in the list. 136ca08ab68Smrg 137ca08ab68Smrg The initial pattern is modified by applying the list of editing 138eceda581Smrg instructions specific to patterns found in the configuration; 139eceda581Smrg each consists of a match predicate and a set of editing 140eceda581Smrg operations. They are executed in the order they appeared in the 141eceda581Smrg configuration. Each match causes the associated sequence of 142eceda581Smrg editing operations to be applied. 143eceda581Smrg 144eceda581Smrg After the pattern has been edited, a sequence of default 145eceda581Smrg substitutions are performed to canonicalize the set of 146eceda581Smrg available properties; this avoids the need for the lower layers 147eceda581Smrg to constantly provide default values for various font 148eceda581Smrg properties during rendering. 149eceda581Smrg 150eceda581Smrg The canonical font pattern is finally matched against all 151eceda581Smrg available fonts. The distance from the pattern to the font is 152eceda581Smrg measured for each of several properties: foundry, charset, 153eceda581Smrg family, lang, spacing, pixelsize, style, slant, weight, 154eceda581Smrg antialias, rasterizer and outline. This list is in priority 155eceda581Smrg order -- results of comparing earlier elements of this list 156eceda581Smrg weigh more heavily than later elements. 157eceda581Smrg 158eceda581Smrg There is one special case to this rule; family names are split 159eceda581Smrg into two bindings; strong and weak. Strong family names are 160eceda581Smrg given greater precedence in the match than lang elements while 161eceda581Smrg weak family names are given lower precedence than lang 162eceda581Smrg elements. This permits the document language to drive font 163eceda581Smrg selection when any document specified font is unavailable. 164eceda581Smrg 165eceda581Smrg The pattern representing that font is augmented to include any 166eceda581Smrg properties found in the pattern but not found in the font 167eceda581Smrg itself; this permits the application to pass rendering 168eceda581Smrg instructions or any other data through the matching system. 169eceda581Smrg Finally, the list of editing instructions specific to fonts 170eceda581Smrg found in the configuration are applied to the pattern. This 171eceda581Smrg modified pattern is returned to the application. 172eceda581Smrg 173eceda581Smrg The return value contains sufficient information to locate and 174eceda581Smrg rasterize the font, including the file name, pixel size and 175eceda581Smrg other rendering data. As none of the information involved 176eceda581Smrg pertains to the FreeType library, applications are free to use 177eceda581Smrg any rasterization engine or even to take the identified font 178eceda581Smrg file and access it directly. 179eceda581Smrg 180eceda581Smrg The match/edit sequences in the configuration are performed in 181eceda581Smrg two passes because there are essentially two different 182eceda581Smrg operations necessary -- the first is to modify how fonts are 183eceda581Smrg selected; aliasing families and adding suitable defaults. The 184eceda581Smrg second is to modify how the selected fonts are rasterized. 185eceda581Smrg Those must apply to the selected font, not the original pattern 186eceda581Smrg as false matches will often occur. 187eceda581Smrg 188eceda581SmrgFont Names 189eceda581Smrg 190eceda581Smrg Fontconfig provides a textual representation for patterns that 191eceda581Smrg the library can both accept and generate. The representation is 192eceda581Smrg in three parts, first a list of family names, second a list of 193eceda581Smrg point sizes and finally a list of additional properties: 194ae02b298Smrg<families>-<point sizes>:<name1>=<values1>:<name2>=<values2>... 195eceda581Smrg 196eceda581Smrg Values in a list are separated with commas. The name needn't 197eceda581Smrg include either families or point sizes; they can be elided. In 198eceda581Smrg addition, there are symbolic constants that simultaneously 199eceda581Smrg indicate both a name and a value. Here are some examples: 200ae02b298SmrgName Meaning 201ae02b298Smrg---------------------------------------------------------- 202ae02b298SmrgTimes-12 12 point Times Roman 203ae02b298SmrgTimes-12:bold 12 point Times Bold 204ae02b298SmrgCourier:italic Courier Italic in the default size 205ae02b298SmrgMonospace:matrix=1 .1 0 1 The users preferred monospace font 206ae02b298Smrg with artificial obliquing 207eceda581Smrg 208eceda581Smrg The '\', '-', ':' and ',' characters in family names must be 209eceda581Smrg preceded by a '\' character to avoid having them 210eceda581Smrg misinterpreted. Similarly, values containing '\', '=', '_', ':' 211eceda581Smrg and ',' must also have them preceded by a '\' character. The 212eceda581Smrg '\' characters are stripped out of the family name and values 213eceda581Smrg as the font name is read. 2142c393a42Smrg 2152c393a42SmrgDebugging Applications 2162c393a42Smrg 217eceda581Smrg To help diagnose font and applications problems, fontconfig is 218eceda581Smrg built with a large amount of internal debugging left enabled. 219eceda581Smrg It is controlled by means of the FC_DEBUG environment variable. 220eceda581Smrg The value of this variable is interpreted as a number, and each 221eceda581Smrg bit within that value controls different debugging messages. 222ae02b298SmrgName Value Meaning 223ae02b298Smrg--------------------------------------------------------- 224ae02b298SmrgMATCH 1 Brief information about font matching 225ae02b298SmrgMATCHV 2 Extensive font matching information 226ae02b298SmrgEDIT 4 Monitor match/test/edit execution 227ae02b298SmrgFONTSET 8 Track loading of font information at startup 228ae02b298SmrgCACHE 16 Watch cache files being written 229ae02b298SmrgCACHEV 32 Extensive cache file writing information 230ae02b298SmrgPARSE 64 (no longer in use) 231ae02b298SmrgSCAN 128 Watch font files being scanned to build caches 232ae02b298SmrgSCANV 256 Verbose font file scanning information 233ae02b298SmrgMEMORY 512 Monitor fontconfig memory usage 234ae02b298SmrgCONFIG 1024 Monitor which config files are loaded 235ae02b298SmrgLANGSET 2048 Dump char sets used to construct lang values 236ae02b298SmrgMATCH2 4096 Display font-matching transformation in patterns 237eceda581Smrg 238eceda581Smrg Add the value of the desired debug levels together and assign 239eceda581Smrg that (in base 10) to the FC_DEBUG environment variable before 240eceda581Smrg running the application. Output from these statements is sent 241eceda581Smrg to stdout. 2422c393a42Smrg 2432c393a42SmrgLang Tags 2442c393a42Smrg 245eceda581Smrg Each font in the database contains a list of languages it 246eceda581Smrg supports. This is computed by comparing the Unicode coverage of 247eceda581Smrg the font with the orthography of each language. Languages are 248eceda581Smrg tagged using an RFC-3066 compatible naming and occur in two 249eceda581Smrg parts -- the ISO 639 language tag followed a hyphen and then by 250eceda581Smrg the ISO 3166 country code. The hyphen and country code may be 251eceda581Smrg elided. 252eceda581Smrg 253eceda581Smrg Fontconfig has orthographies for several languages built into 254eceda581Smrg the library. No provision has been made for adding new ones 255eceda581Smrg aside from rebuilding the library. It currently supports 122 of 256eceda581Smrg the 139 languages named in ISO 639-1, 141 of the languages with 257eceda581Smrg two-letter codes from ISO 639-2 and another 30 languages with 258eceda581Smrg only three-letter codes. Languages with both two and three 259eceda581Smrg letter codes are provided with only the two letter code. 260eceda581Smrg 261eceda581Smrg For languages used in multiple territories with radically 262eceda581Smrg different character sets, fontconfig includes per-territory 263eceda581Smrg orthographies. This includes Azerbaijani, Kurdish, Pashto, 264eceda581Smrg Tigrinya and Chinese. 265a6844aabSmrg 266eceda581SmrgConfiguration File Format 267a6844aabSmrg 268eceda581Smrg Configuration files for fontconfig are stored in XML format; 269eceda581Smrg this format makes external configuration tools easier to write 270eceda581Smrg and ensures that they will generate syntactically correct 271eceda581Smrg configuration files. As XML files are plain text, they can also 272eceda581Smrg be manipulated by the expert user using a text editor. 273eceda581Smrg 274eceda581Smrg The fontconfig document type definition resides in the external 275eceda581Smrg entity "fonts.dtd"; this is normally stored in the default font 276eceda581Smrg configuration directory (/etc/fonts). Each configuration file 277eceda581Smrg should contain the following structure: 278ae02b298Smrg<?xml version="1.0"?> 279ae02b298Smrg<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 280ae02b298Smrg<fontconfig> 281ae02b298Smrg... 282ae02b298Smrg</fontconfig> 2832c393a42Smrg 284eceda581Smrg<fontconfig> 2852c393a42Smrg 286eceda581Smrg This is the top level element for a font configuration and can 287eceda581Smrg contain <dir>, <cachedir>, <include>, <match> and <alias> 288eceda581Smrg elements in any order. 289eceda581Smrg 290eceda581Smrg<dir prefix="default" salt=""> 291eceda581Smrg 292eceda581Smrg This element contains a directory name which will be scanned 293eceda581Smrg for font files to include in the set of available fonts. 294eceda581Smrg 295eceda581Smrg If 'prefix' is set to "default" or "cwd", the current working 296eceda581Smrg directory will be added as the path prefix prior to the value. 297eceda581Smrg If 'prefix' is set to "xdg", the value in the XDG_DATA_HOME 298eceda581Smrg environment variable will be added as the path prefix. please 299eceda581Smrg see XDG Base Directory Specification for more details. If 300eceda581Smrg 'prefix' is set to "relative", the path of current file will be 301eceda581Smrg added prior to the value. 302eceda581Smrg 303eceda581Smrg 'salt' property affects to determine cache filename. this is 304eceda581Smrg useful for example when having different fonts sets on same 305eceda581Smrg path at container and share fonts from host on different font 306eceda581Smrg path. 307eceda581Smrg 308eceda581Smrg<cachedir prefix="default"> 309eceda581Smrg 310eceda581Smrg This element contains a directory name that is supposed to be 311eceda581Smrg stored or read the cache of font information. If multiple 312eceda581Smrg elements are specified in the configuration file, the directory 313eceda581Smrg that can be accessed first in the list will be used to store 314eceda581Smrg the cache files. If it starts with '~', it refers to a 315eceda581Smrg directory in the users home directory. If 'prefix' is set to 316eceda581Smrg "xdg", the value in the XDG_CACHE_HOME environment variable 317eceda581Smrg will be added as the path prefix. please see XDG Base Directory 318eceda581Smrg Specification for more details. The default directory is 319eceda581Smrg ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files 320eceda581Smrg named ``<hash value>-<architecture>.cache-<version>'', where 321eceda581Smrg <version> is the fontconfig cache file version number 322ae02b298Smrg (currently 8). 323eceda581Smrg 324eceda581Smrg<include ignore_missing="no" prefix="default"> 325eceda581Smrg 326eceda581Smrg This element contains the name of an additional configuration 327eceda581Smrg file or directory. If a directory, every file within that 328eceda581Smrg directory starting with an ASCII digit (U+0030 - U+0039) and 329eceda581Smrg ending with the string ``.conf'' will be processed in sorted 330eceda581Smrg order. When the XML datatype is traversed by FcConfigParse, the 331eceda581Smrg contents of the file(s) will also be incorporated into the 332eceda581Smrg configuration by passing the filename(s) to 333eceda581Smrg FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" 334eceda581Smrg instead of the default "no", a missing file or directory will 335eceda581Smrg elicit no warning message from the library. If 'prefix' is set 336eceda581Smrg to "xdg", the value in the XDG_CONFIG_HOME environment variable 337eceda581Smrg will be added as the path prefix. please see XDG Base Directory 338ca08ab68Smrg Specification for more details. 339ca08ab68Smrg 340eceda581Smrg<config> 341eceda581Smrg 342eceda581Smrg This element provides a place to consolidate additional 343eceda581Smrg configuration information. <config> can contain <blank> and 344eceda581Smrg <rescan> elements in any order. 345eceda581Smrg 346eceda581Smrg<description domain="fontconfig-conf"> 347eceda581Smrg 348eceda581Smrg This element is supposed to hold strings which describe what a 349eceda581Smrg config is used for. This string can be translated through 350eceda581Smrg gettext. 'domain' needs to be set the proper name to apply 351eceda581Smrg then. fontconfig will tries to retrieve translations with 352eceda581Smrg 'domain' from gettext. 353eceda581Smrg 354eceda581Smrg<blank> 355a32e9e42Smrg 356eceda581Smrg Fonts often include "broken" glyphs which appear in the 357eceda581Smrg encoding but are drawn as blanks on the screen. Within the 358eceda581Smrg <blank> element, place each Unicode characters which is 359eceda581Smrg supposed to be blank in an <int> element. Characters outside of 360eceda581Smrg this set which are drawn as blank will be elided from the set 361eceda581Smrg of characters supported by the font. 362a32e9e42Smrg 363eceda581Smrg<remap-dir prefix="default" as-path="" salt=""> 364a4e54154Smrg 365eceda581Smrg This element contains a directory name where will be mapped as 366eceda581Smrg the path 'as-path' in cached information. This is useful if the 367eceda581Smrg directory name is an alias (via a bind mount or symlink) to 368eceda581Smrg another directory in the system for which cached font 369eceda581Smrg information is likely to exist. 370a4e54154Smrg 371eceda581Smrg 'salt' property affects to determine cache filename as same as 372eceda581Smrg <dir> element. 373a32e9e42Smrg 374eceda581Smrg<reset-dirs /> 375a32e9e42Smrg 376eceda581Smrg This element removes all of fonts directories where added by 377eceda581Smrg <dir> elements. This is useful to override fonts directories 378eceda581Smrg from system to own fonts directories only. 379a4e54154Smrg 380eceda581Smrg<rescan> 381a4e54154Smrg 382eceda581Smrg The <rescan> element holds an <int> element which indicates the 383eceda581Smrg default interval between automatic checks for font 384eceda581Smrg configuration changes. Fontconfig will validate all of the 385eceda581Smrg configuration files and directories and automatically rebuild 386eceda581Smrg the internal datastructures when this interval passes. 387a32e9e42Smrg 388eceda581Smrg<selectfont> 389a32e9e42Smrg 390eceda581Smrg This element is used to black/white list fonts from being 391eceda581Smrg listed or matched against. It holds acceptfont and rejectfont 392eceda581Smrg elements. 393953daebaSmrg 394eceda581Smrg<acceptfont> 395953daebaSmrg 396eceda581Smrg Fonts matched by an acceptfont element are "whitelisted"; such 397eceda581Smrg fonts are explicitly included in the set of fonts used to 398eceda581Smrg resolve list and match requests; including them in this list 399eceda581Smrg protects them from being "blacklisted" by a rejectfont element. 400eceda581Smrg Acceptfont elements include glob and pattern elements which are 401eceda581Smrg used to match fonts. 402ca08ab68Smrg 403eceda581Smrg<rejectfont> 404ca08ab68Smrg 405eceda581Smrg Fonts matched by an rejectfont element are "blacklisted"; such 406eceda581Smrg fonts are excluded from the set of fonts used to resolve list 407eceda581Smrg and match requests as if they didn't exist in the system. 408eceda581Smrg Rejectfont elements include glob and pattern elements which are 409eceda581Smrg used to match fonts. 410ca08ab68Smrg 411eceda581Smrg<glob> 4122c393a42Smrg 413eceda581Smrg Glob elements hold shell-style filename matching patterns 414eceda581Smrg (including ? and *) which match fonts based on their complete 415ae02b298Smrg pathnames. If it starts with '~', it refers to a directory in 416ae02b298Smrg the users home directory. This can be used to exclude a set of 417ae02b298Smrg directories (/usr/share/fonts/uglyfont*), or particular font 418ae02b298Smrg file types (*.pcf.gz), but the latter mechanism relies rather 419ae02b298Smrg heavily on filenaming conventions which can't be relied upon. 420ae02b298Smrg Note that globs only apply to directories, not to individual 421ae02b298Smrg fonts. 4222c393a42Smrg 423eceda581Smrg<pattern> 424a32e9e42Smrg 425eceda581Smrg Pattern elements perform list-style matching on incoming fonts; 426eceda581Smrg that is, they hold a list of elements and associated values. If 427eceda581Smrg all of those elements have a matching value, then the pattern 428eceda581Smrg matches the font. This can be used to select fonts based on 429eceda581Smrg attributes of the font (scalable, bold, etc), which is a more 430eceda581Smrg reliable mechanism than using file extensions. Pattern elements 431eceda581Smrg include patelt elements. 432a32e9e42Smrg 433eceda581Smrg<patelt name="property"> 434eceda581Smrg 435eceda581Smrg Patelt elements hold a single pattern element and list of 436eceda581Smrg values. They must have a 'name' attribute which indicates the 437eceda581Smrg pattern element name. Patelt elements include int, double, 438eceda581Smrg string, matrix, bool, charset and const elements. 439eceda581Smrg 440eceda581Smrg<match target="pattern"> 441eceda581Smrg 442eceda581Smrg This element holds first a (possibly empty) list of <test> 443eceda581Smrg elements and then a (possibly empty) list of <edit> elements. 444eceda581Smrg Patterns which match all of the tests are subjected to all the 445eceda581Smrg edits. If 'target' is set to "font" instead of the default 446eceda581Smrg "pattern", then this element applies to the font name resulting 447eceda581Smrg from a match rather than a font pattern to be matched. If 448eceda581Smrg 'target' is set to "scan", then this element applies when the 449eceda581Smrg font is scanned to build the fontconfig database. 450eceda581Smrg 451eceda581Smrg<test qual="any" name="property" target="default" compare="eq"> 452eceda581Smrg 453eceda581Smrg This element contains a single value which is compared with the 454eceda581Smrg target ('pattern', 'font', 'scan' or 'default') property 455eceda581Smrg "property" (substitute any of the property names seen above). 456eceda581Smrg 'compare' can be one of "eq", "not_eq", "less", "less_eq", 457eceda581Smrg "more", "more_eq", "contains" or "not_contains". 'qual' may 458eceda581Smrg either be the default, "any", in which case the match succeeds 459eceda581Smrg if any value associated with the property matches the test 460eceda581Smrg value, or "all", in which case all of the values associated 461eceda581Smrg with the property must match the test value. 'ignore-blanks' 462eceda581Smrg takes a boolean value. if 'ignore-blanks' is set "true", any 463eceda581Smrg blanks in the string will be ignored on its comparison. this 464eceda581Smrg takes effects only when compare="eq" or compare="not_eq". When 465eceda581Smrg used in a <match target="font"> element, the target= attribute 466eceda581Smrg in the <test> element selects between matching the original 467eceda581Smrg pattern or the font. "default" selects whichever target the 468eceda581Smrg outer <match> element has selected. 469eceda581Smrg 470eceda581Smrg<edit name="property" mode="assign" binding="weak"> 471eceda581Smrg 472eceda581Smrg This element contains a list of expression elements (any of the 473eceda581Smrg value or operator elements). The expression elements are 474eceda581Smrg evaluated at run-time and modify the property "property". The 475eceda581Smrg modification depends on whether "property" was matched by one 476eceda581Smrg of the associated <test> elements, if so, the modification may 477eceda581Smrg affect the first matched value. Any values inserted into the 478eceda581Smrg property are given the indicated binding ("strong", "weak" or 479eceda581Smrg "same") with "same" binding using the value from the matched 480eceda581Smrg pattern element. 'mode' is one of: 481ae02b298SmrgMode With Match Without Match 482ae02b298Smrg--------------------------------------------------------------------- 483ae02b298Smrg"assign" Replace matching value Replace all values 484ae02b298Smrg"assign_replace" Replace all values Replace all values 485ae02b298Smrg"prepend" Insert before matching Insert at head of list 486ae02b298Smrg"prepend_first" Insert at head of list Insert at head of list 487ae02b298Smrg"append" Append after matching Append at end of list 488ae02b298Smrg"append_last" Append at end of list Append at end of list 489ae02b298Smrg"delete" Delete matching value Delete all values 490ae02b298Smrg"delete_all" Delete all values Delete all values 491eceda581Smrg 492eceda581Smrg<int>, <double>, <string>, <bool> 493eceda581Smrg 494eceda581Smrg These elements hold a single value of the indicated type. 495eceda581Smrg <bool> elements hold either true or false. An important 496eceda581Smrg limitation exists in the parsing of floating point numbers -- 497eceda581Smrg fontconfig requires that the mantissa start with a digit, not a 498eceda581Smrg decimal point, so insert a leading zero for purely fractional 499eceda581Smrg values (e.g. use 0.5 instead of .5 and -0.5 instead of -.5). 500eceda581Smrg 501eceda581Smrg<matrix> 502eceda581Smrg 503eceda581Smrg This element holds four numerical expressions of an affine 504eceda581Smrg transformation. At their simplest these will be four <double> 505eceda581Smrg elements but they can also be more involved expressions. 506eceda581Smrg 507eceda581Smrg<range> 508eceda581Smrg 509eceda581Smrg This element holds the two <int> elements of a range 510eceda581Smrg representation. 511eceda581Smrg 512eceda581Smrg<charset> 513eceda581Smrg 514eceda581Smrg This element holds at least one <int> element of an Unicode 515eceda581Smrg code point or more. 516eceda581Smrg 517eceda581Smrg<langset> 518eceda581Smrg 519eceda581Smrg This element holds at least one <string> element of a 520eceda581Smrg RFC-3066-style languages or more. 521eceda581Smrg 522eceda581Smrg<name> 523eceda581Smrg 524eceda581Smrg Holds a property name. Evaluates to the first value from the 525eceda581Smrg property of the pattern. If the 'target' attribute is not 526eceda581Smrg present, it will default to 'default', in which case the 527eceda581Smrg property is returned from the font pattern during a 528eceda581Smrg target="font" match, and to the pattern during a 529eceda581Smrg target="pattern" match. The attribute can also take the values 530eceda581Smrg 'font' or 'pattern' to explicitly choose which pattern to use. 531eceda581Smrg It is an error to use a target of 'font' in a match that has 532eceda581Smrg target="pattern". 533eceda581Smrg 534eceda581Smrg<const> 535eceda581Smrg 536eceda581Smrg Holds the name of a constant; these are always integers and 537eceda581Smrg serve as symbolic names for common font values: 538ae02b298SmrgConstant Property Value 539ae02b298Smrg------------------------------------- 540ae02b298Smrgthin weight 0 541ae02b298Smrgextralight weight 40 542ae02b298Smrgultralight weight 40 543ae02b298Smrglight weight 50 544ae02b298Smrgdemilight weight 55 545ae02b298Smrgsemilight weight 55 546ae02b298Smrgbook weight 75 547ae02b298Smrgregular weight 80 548ae02b298Smrgnormal weight 80 549ae02b298Smrgmedium weight 100 550ae02b298Smrgdemibold weight 180 551ae02b298Smrgsemibold weight 180 552ae02b298Smrgbold weight 200 553ae02b298Smrgextrabold weight 205 554ae02b298Smrgultrabold weight 205 555ae02b298Smrgblack weight 210 556ae02b298Smrgheavy weight 210 557ae02b298Smrgextrablack weight 215 558ae02b298Smrgultrablack weight 215 559ae02b298Smrgroman slant 0 560ae02b298Smrgitalic slant 100 561ae02b298Smrgoblique slant 110 562ae02b298Smrgultracondensed width 50 563ae02b298Smrgextracondensed width 63 564ae02b298Smrgcondensed width 75 565ae02b298Smrgsemicondensed width 87 566ae02b298Smrgnormal width 100 567ae02b298Smrgsemiexpanded width 113 568ae02b298Smrgexpanded width 125 569ae02b298Smrgextraexpanded width 150 570ae02b298Smrgultraexpanded width 200 571ae02b298Smrgproportional spacing 0 572ae02b298Smrgdual spacing 90 573ae02b298Smrgmono spacing 100 574ae02b298Smrgcharcell spacing 110 575ae02b298Smrgunknown rgba 0 576ae02b298Smrgrgb rgba 1 577ae02b298Smrgbgr rgba 2 578ae02b298Smrgvrgb rgba 3 579ae02b298Smrgvbgr rgba 4 580ae02b298Smrgnone rgba 5 581ae02b298Smrglcdnone lcdfilter 0 582ae02b298Smrglcddefault lcdfilter 1 583ae02b298Smrglcdlight lcdfilter 2 584ae02b298Smrglcdlegacy lcdfilter 3 585ae02b298Smrghintnone hintstyle 0 586ae02b298Smrghintslight hintstyle 1 587ae02b298Smrghintmedium hintstyle 2 588ae02b298Smrghintfull hintstyle 3 589eceda581Smrg 590eceda581Smrg<or>, <and>, <plus>, <minus>, <times>, <divide> 591eceda581Smrg 592eceda581Smrg These elements perform the specified operation on a list of 593eceda581Smrg expression elements. <or> and <and> are boolean, not bitwise. 594eceda581Smrg 595eceda581Smrg<eq>, <not_eq>, <less>, <less_eq>, <more>, <more_eq>, <contains>, 596eceda581Smrg<not_contains 5972c393a42Smrg 598ca08ab68Smrg These elements compare two values, producing a boolean result. 5992c393a42Smrg 600eceda581Smrg<not> 6012c393a42Smrg 602ca08ab68Smrg Inverts the boolean sense of its one expression element 6032c393a42Smrg 604eceda581Smrg<if> 6052c393a42Smrg 606eceda581Smrg This element takes three expression elements; if the value of 607eceda581Smrg the first is true, it produces the value of the second, 608eceda581Smrg otherwise it produces the value of the third. 6092c393a42Smrg 610eceda581Smrg<alias> 6112c393a42Smrg 612eceda581Smrg Alias elements provide a shorthand notation for the set of 613eceda581Smrg common match operations needed to substitute one font family 614eceda581Smrg for another. They contain a <family> element followed by 615eceda581Smrg optional <prefer>, <accept> and <default> elements. Fonts 616eceda581Smrg matching the <family> element are edited to prepend the list of 617eceda581Smrg <prefer>ed families before the matching <family>, append the 618eceda581Smrg <accept>able families after the matching <family> and append 619eceda581Smrg the <default> families to the end of the family list. 620ca08ab68Smrg 621eceda581Smrg<family> 622ca08ab68Smrg 623ca08ab68Smrg Holds a single font family name 624ca08ab68Smrg 625eceda581Smrg<prefer>, <accept>, <default> 626ca08ab68Smrg 627eceda581Smrg These hold a list of <family> elements to be used by the 628eceda581Smrg <alias> element. 6292c393a42Smrg 6302c393a42SmrgEXAMPLE CONFIGURATION FILE 6312c393a42Smrg 632eceda581SmrgSystem configuration file 6332c393a42Smrg 634ca08ab68Smrg This is an example of a system-wide configuration file 6352c393a42Smrg<?xml version="1.0"?> 636a4e54154Smrg<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 6372c393a42Smrg<!-- /etc/fonts/fonts.conf file to configure system font access --> 6382c393a42Smrg<fontconfig> 639ae02b298Smrg <!-- 640ae02b298Smrg Find fonts in these directories 641ae02b298Smrg --> 642ae02b298Smrg <dir>/usr/share/fonts</dir> 643ae02b298Smrg <dir>/usr/X11R6/lib/X11/fonts</dir> 644ae02b298Smrg 645ae02b298Smrg <!-- 646ae02b298Smrg Accept deprecated 'mono' alias, replacing it with 'monospace' 647ae02b298Smrg --> 648ae02b298Smrg <match target="pattern"> 649ae02b298Smrg <test qual="any" name="family"> 650ae02b298Smrg <string>mono</string> 651ae02b298Smrg </test> 652ae02b298Smrg <edit name="family" mode="assign"> 653ae02b298Smrg <string>monospace</string> 654ae02b298Smrg </edit> 655ae02b298Smrg </match> 656ae02b298Smrg 657ae02b298Smrg <!-- 658ae02b298Smrg Names not including any well known alias are given 'sans-serif' 659ae02b298Smrg --> 660ae02b298Smrg <match target="pattern"> 661ae02b298Smrg <test qual="all" name="family" compare="not_eq"> 662ae02b298Smrg <string>sans-serif</string> 663ae02b298Smrg </test> 664ae02b298Smrg <test qual="all" name="family" compare="not_eq"> 665ae02b298Smrg <string>serif</string> 666ae02b298Smrg </test> 667ae02b298Smrg <test qual="all" name="family" compare="not_eq"> 668ae02b298Smrg <string>monospace</string> 669ae02b298Smrg </test> 670ae02b298Smrg <edit name="family" mode="append_last"> 671ae02b298Smrg <string>sans-serif</string> 672ae02b298Smrg </edit> 673ae02b298Smrg </match> 674ae02b298Smrg 675ae02b298Smrg <!-- 676ae02b298Smrg Load per-user customization file, but don't complain 677ae02b298Smrg if it doesn't exist 678ae02b298Smrg --> 679ae02b298Smrg <include ignore_missing="yes" prefix="xdg"> 680ae02b298Smrg fontconfig/fonts.conf 681ae02b298Smrg </include> 682ae02b298Smrg 683ae02b298Smrg <!-- 684ae02b298Smrg Load local customization files, but don't complain 685ae02b298Smrg if there aren't any 686ae02b298Smrg --> 687ae02b298Smrg <include ignore_missing="yes">conf.d</include> 688ae02b298Smrg <include ignore_missing="yes">local.conf</include> 689ae02b298Smrg 690ae02b298Smrg <!-- 691ae02b298Smrg Alias well known font names to available TrueType fonts. 692ae02b298Smrg These substitute TrueType faces for similar Type1 693ae02b298Smrg faces to improve screen appearance. 694ae02b298Smrg --> 695ae02b298Smrg <alias> 696ae02b298Smrg <family>Times</family> 697ae02b298Smrg <prefer> 698ae02b298Smrg <family>Times New Roman</family> 699ae02b298Smrg </prefer> 700ae02b298Smrg <default> 701ae02b298Smrg <family>serif</family> 702ae02b298Smrg </default> 703ae02b298Smrg </alias> 704ae02b298Smrg <alias> 705ae02b298Smrg <family>Helvetica</family> 706ae02b298Smrg <prefer> 707ae02b298Smrg <family>Arial</family> 708ae02b298Smrg </prefer> 709ae02b298Smrg <default> 710ae02b298Smrg <family>sans</family> 711ae02b298Smrg </default> 712ae02b298Smrg </alias> 713ae02b298Smrg <alias> 714ae02b298Smrg <family>Courier</family> 715ae02b298Smrg <prefer> 716ae02b298Smrg <family>Courier New</family> 717ae02b298Smrg </prefer> 718ae02b298Smrg <default> 719ae02b298Smrg <family>monospace</family> 720ae02b298Smrg </default> 721ae02b298Smrg </alias> 722ae02b298Smrg 723ae02b298Smrg <!-- 724ae02b298Smrg Provide required aliases for standard names 725ae02b298Smrg Do these after the users configuration file so that 726ae02b298Smrg any aliases there are used preferentially 727ae02b298Smrg --> 728ae02b298Smrg <alias> 729ae02b298Smrg <family>serif</family> 730ae02b298Smrg <prefer> 731ae02b298Smrg <family>Times New Roman</family> 732ae02b298Smrg </prefer> 733ae02b298Smrg </alias> 734ae02b298Smrg <alias> 735ae02b298Smrg <family>sans</family> 736ae02b298Smrg <prefer> 737ae02b298Smrg <family>Arial</family> 738ae02b298Smrg </prefer> 739ae02b298Smrg </alias> 740ae02b298Smrg <alias> 741ae02b298Smrg <family>monospace</family> 742ae02b298Smrg <prefer> 743ae02b298Smrg <family>Andale Mono</family> 744ae02b298Smrg </prefer> 745ae02b298Smrg </alias> 746ae02b298Smrg 747ae02b298Smrg <-- 748ae02b298Smrg The example of the requirements of OR operator; 749ae02b298Smrg If the 'family' contains 'Courier New' OR 'Courier' 750ae02b298Smrg add 'monospace' as the alternative 751ae02b298Smrg --> 752ae02b298Smrg <match target="pattern"> 753ae02b298Smrg <test name="family" compare="eq"> 754ae02b298Smrg <string>Courier New</string> 755ae02b298Smrg </test> 756ae02b298Smrg <edit name="family" mode="prepend"> 757ae02b298Smrg <string>monospace</string> 758ae02b298Smrg </edit> 759ae02b298Smrg </match> 760ae02b298Smrg <match target="pattern"> 761ae02b298Smrg <test name="family" compare="eq"> 762ae02b298Smrg <string>Courier</string> 763ae02b298Smrg </test> 764ae02b298Smrg <edit name="family" mode="prepend"> 765ae02b298Smrg <string>monospace</string> 766ae02b298Smrg </edit> 767ae02b298Smrg </match> 768ca08ab68Smrg 7692c393a42Smrg</fontconfig> 7702c393a42Smrg 771eceda581SmrgUser configuration file 772a6844aabSmrg 773eceda581Smrg This is an example of a per-user configuration file that lives 774eceda581Smrg in $XDG_CONFIG_HOME/fontconfig/fonts.conf 775eceda581Smrg<?xml version="1.0"?> 776eceda581Smrg<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> 777eceda581Smrg<!-- 778ae02b298Smrg $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration 779eceda581Smrg--> 780ae02b298Smrg<fontconfig> 7812c393a42Smrg 782ae02b298Smrg <!-- 783ae02b298Smrg Private font directory 784ae02b298Smrg --> 785ae02b298Smrg <dir prefix="xdg">fonts</dir> 786ae02b298Smrg 787ae02b298Smrg <!-- 788ae02b298Smrg use rgb sub-pixel ordering to improve glyph appearance on 789ae02b298Smrg LCD screens. Changes affecting rendering, but not matching 790ae02b298Smrg should always use target="font". 791ae02b298Smrg --> 792ae02b298Smrg <match target="font"> 793ae02b298Smrg <edit name="rgba" mode="assign"> 794ae02b298Smrg <const>rgb</const> 795ae02b298Smrg </edit> 796ae02b298Smrg </match> 797ae02b298Smrg <!-- 798ae02b298Smrg use WenQuanYi Zen Hei font when serif is requested for Chinese 799ae02b298Smrg --> 800ae02b298Smrg <match> 801ae02b298Smrg <!-- 802ae02b298Smrg If you don't want to use WenQuanYi Zen Hei font for zh-tw etc, 803ae02b298Smrg you can use zh-cn instead of zh. 804ae02b298Smrg Please note, even if you set zh-cn, it still matches zh. 805ae02b298Smrg if you don't like it, you can use compare="eq" 806ae02b298Smrg instead of compare="contains". 807ae02b298Smrg --> 808ae02b298Smrg <test name="lang" compare="contains"> 809ae02b298Smrg <string>zh</string> 810ae02b298Smrg </test> 811ae02b298Smrg <test name="family"> 812ae02b298Smrg <string>serif</string> 813ae02b298Smrg </test> 814ae02b298Smrg <edit name="family" mode="prepend"> 815ae02b298Smrg <string>WenQuanYi Zen Hei</string> 816ae02b298Smrg </edit> 817ae02b298Smrg </match> 818ae02b298Smrg <!-- 819ae02b298Smrg use VL Gothic font when sans-serif is requested for Japanese 820ae02b298Smrg --> 821ae02b298Smrg <match> 822ae02b298Smrg <test name="lang" compare="contains"> 823ae02b298Smrg <string>ja</string> 824ae02b298Smrg </test> 825ae02b298Smrg <test name="family"> 826ae02b298Smrg <string>sans-serif</string> 827ae02b298Smrg </test> 828ae02b298Smrg <edit name="family" mode="prepend"> 829ae02b298Smrg <string>VL Gothic</string> 830ae02b298Smrg </edit> 831ae02b298Smrg </match> 832eceda581Smrg</fontconfig> 833a6844aabSmrg 834ca08ab68SmrgFiles 8352c393a42Smrg 836eceda581Smrg fonts.conf contains configuration information for the 837eceda581Smrg fontconfig library consisting of directories to look at for 838eceda581Smrg font information as well as instructions on editing program 839eceda581Smrg specified font patterns before attempting to match the 840eceda581Smrg available fonts. It is in XML format. 8412c393a42Smrg 842ca08ab68Smrg conf.d is the conventional name for a directory of additional 843eceda581Smrg configuration files managed by external applications or the 844eceda581Smrg local administrator. The filenames starting with decimal digits 845eceda581Smrg are sorted in lexicographic order and used as additional 846eceda581Smrg configuration files. All of these files are in XML format. The 847eceda581Smrg master fonts.conf file references this directory in an 848eceda581Smrg <include> directive. 849eceda581Smrg 850eceda581Smrg fonts.dtd is a DTD that describes the format of the 851eceda581Smrg configuration files. 852eceda581Smrg 853eceda581Smrg $XDG_CONFIG_HOME/fontconfig/conf.d and ~/.fonts.conf.d is the 854eceda581Smrg conventional name for a per-user directory of (typically 855eceda581Smrg auto-generated) configuration files, although the actual 856eceda581Smrg location is specified in the global fonts.conf file. please 857eceda581Smrg note that ~/.fonts.conf.d is deprecated now. it will not be 858ca08ab68Smrg read by default in the future version. 859ca08ab68Smrg 860ca08ab68Smrg $XDG_CONFIG_HOME/fontconfig/fonts.conf and ~/.fonts.conf is the 861eceda581Smrg conventional location for per-user font configuration, although 862eceda581Smrg the actual location is specified in the global fonts.conf file. 863eceda581Smrg please note that ~/.fonts.conf is deprecated now. it will not 864eceda581Smrg be read by default in the future version. 865eceda581Smrg 866eceda581Smrg $XDG_CACHE_HOME/fontconfig/*.cache-* and 867eceda581Smrg ~/.fontconfig/*.cache-* is the conventional repository of font 868eceda581Smrg information that isn't found in the per-directory caches. This 869eceda581Smrg file is automatically maintained by fontconfig. please note 870eceda581Smrg that ~/.fontconfig/*.cache-* is deprecated now. it will not be 871ca08ab68Smrg read by default in the future version. 8722c393a42Smrg 873ca08ab68SmrgEnvironment variables 8742c393a42Smrg 875eceda581Smrg FONTCONFIG_FILE is used to override the default configuration 876eceda581Smrg file. 8772c393a42Smrg 878eceda581Smrg FONTCONFIG_PATH is used to override the default configuration 879eceda581Smrg directory. 8802c393a42Smrg 881a32e9e42Smrg FONTCONFIG_SYSROOT is used to set a default sysroot directory. 882953daebaSmrg 883a32e9e42Smrg FC_DEBUG is used to output the detailed debugging messages. see 884eceda581Smrg Debugging Applications section for more details. 885eceda581Smrg 886eceda581Smrg FC_DBG_MATCH_FILTER is used to filter out the patterns. this 887eceda581Smrg takes a comma-separated list of object names and effects only 888eceda581Smrg when FC_DEBUG has MATCH2. see Debugging Applications section 889eceda581Smrg for more details. 890eceda581Smrg 891eceda581Smrg FC_LANG is used to specify the default language as the weak 892eceda581Smrg binding in the query. if this isn't set, the default language 893eceda581Smrg will be determined from current locale. 894eceda581Smrg 895eceda581Smrg FONTCONFIG_USE_MMAP is used to control the use of mmap(2) for 896eceda581Smrg the cache files if available. this take a boolean value. 897eceda581Smrg fontconfig will checks if the cache files are stored on the 898eceda581Smrg filesystem that is safe to use mmap(2). explicitly setting this 899eceda581Smrg environment variable will causes skipping this check and 900eceda581Smrg enforce to use or not use mmap(2) anyway. 901eceda581Smrg 902eceda581Smrg SOURCE_DATE_EPOCH is used to ensure fc-cache(1) generates files 903eceda581Smrg in a deterministic manner in order to support reproducible 904eceda581Smrg builds. When set to a numeric representation of UNIX timestamp, 905eceda581Smrg fontconfig will prefer this value over using the modification 906eceda581Smrg timestamps of the input files in order to identify which cache 907eceda581Smrg files require regeneration. If SOURCE_DATE_EPOCH is not set (or 908eceda581Smrg is newer than the mtime of the directory), the existing 909a32e9e42Smrg behaviour is unchanged. 9102c393a42Smrg 9112c393a42SmrgSee Also 9122c393a42Smrg 913a32e9e42Smrg fc-cat(1), fc-cache(1), fc-list(1), fc-match(1), fc-query(1), 914eceda581Smrg SOURCE_DATE_EPOCH. 9152c393a42Smrg 9162c393a42SmrgVersion 9172c393a42Smrg 918ae02b298Smrg Fontconfig version 2.15.0 919