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