fcconfig.fncs revision b09479dc
1/* 2 * fontconfig/doc/fcconfig.fncs 3 * 4 * Copyright © 2003 Keith Packard 5 * 6 * Permission to use, copy, modify, distribute, and sell this software and its 7 * documentation for any purpose is hereby granted without fee, provided that 8 * the above copyright notice appear in all copies and that both that 9 * copyright notice and this permission notice appear in supporting 10 * documentation, and that the name of the author(s) not be used in 11 * advertising or publicity pertaining to distribution of the software without 12 * specific, written prior permission. The authors make no 13 * representations about the suitability of this software for any purpose. It 14 * is provided "as is" without express or implied warranty. 15 * 16 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 18 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR 19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 22 * PERFORMANCE OF THIS SOFTWARE. 23 */ 24@RET@ FcConfig * 25@FUNC@ FcConfigCreate 26@TYPE1@ void 27@PURPOSE@ Create a configuration 28@DESC@ 29Creates an empty configuration. 30@@ 31 32@RET@ FcConfig * 33@FUNC@ FcConfigReference 34@TYPE1@ FcConfig * @ARG1@ config 35@PURPOSE@ Increment config reference count 36@DESC@ 37Add another reference to <parameter>config</parameter>. Configs are freed only 38when the reference count reaches zero. 39If <parameter>config</parameter> is NULL, the current configuration is used. 40In that case this function will be similar to FcConfigGetCurrent() except that 41it increments the reference count before returning and the user is responsible 42for destroying the configuration when not needed anymore. 43@@ 44 45@RET@ void 46@FUNC@ FcConfigDestroy 47@TYPE1@ FcConfig * @ARG1@ config 48@PURPOSE@ Destroy a configuration 49@DESC@ 50Decrements the config reference count. If all references are gone, destroys 51the configuration and any data associated with it. 52Note that calling this function with the return from FcConfigGetCurrent will 53cause a new configuration to be created for use as current configuration. 54@@ 55 56@RET@ FcBool 57@FUNC@ FcConfigSetCurrent 58@TYPE1@ FcConfig * @ARG1@ config 59@PURPOSE@ Set configuration as default 60@DESC@ 61Sets the current default configuration to <parameter>config</parameter>. Implicitly calls 62FcConfigBuildFonts if necessary, returning FcFalse if that call fails. 63@@ 64 65@RET@ FcConfig * 66@FUNC@ FcConfigGetCurrent 67@TYPE1@ void 68@PURPOSE@ Return current configuration 69@DESC@ 70Returns the current default configuration. 71@@ 72 73@RET@ FcBool 74@FUNC@ FcConfigUptoDate 75@TYPE1@ FcConfig * @ARG1@ config 76@PURPOSE@ Check timestamps on config files 77@DESC@ 78Checks all of the files related to <parameter>config</parameter> and returns 79whether any of them has been modified since the configuration was created. 80If <parameter>config</parameter> is NULL, the current configuration is used. 81@@ 82 83@RET@ FcChar8 * 84@FUNC@ FcConfigHome 85@TYPE1@ void 86@PURPOSE@ return the current home directory. 87@DESC@ 88Return the current user's home directory, if it is available, and if using it 89is enabled, and NULL otherwise. 90See also <function>FcConfigEnableHome</function>). 91@@ 92 93@RET@ FcBool 94@FUNC@ FcConfigEnableHome 95@TYPE1@ FcBool% @ARG1@ enable 96@PURPOSE@ controls use of the home directory. 97@DESC@ 98If <parameter>enable</parameter> is FcTrue, then Fontconfig will use various 99files which are specified relative to the user's home directory (using the ~ 100notation in the configuration). When <parameter>enable</parameter> is 101FcFalse, then all use of the home directory in these contexts will be 102disabled. The previous setting of the value is returned. 103@@ 104 105@RET@ FcBool 106@FUNC@ FcConfigBuildFonts 107@TYPE1@ FcConfig * @ARG1@ config 108@PURPOSE@ Build font database 109@DESC@ 110Builds the set of available fonts for the given configuration. Note that 111any changes to the configuration after this call have indeterminate effects. 112Returns FcFalse if this operation runs out of memory. 113If <parameter>config</parameter> is NULL, the current configuration is used. 114@@ 115 116@RET@ FcStrList * 117@FUNC@ FcConfigGetConfigDirs 118@TYPE1@ FcConfig * @ARG1@ config 119@PURPOSE@ Get config directories 120@DESC@ 121Returns the list of font directories specified in the configuration files 122for <parameter>config</parameter>. Does not include any subdirectories. 123If <parameter>config</parameter> is NULL, the current configuration is used. 124@@ 125 126@RET@ FcStrList * 127@FUNC@ FcConfigGetFontDirs 128@TYPE1@ FcConfig * @ARG1@ config 129@PURPOSE@ Get font directories 130@DESC@ 131Returns the list of font directories in <parameter>config</parameter>. This includes the 132configured font directories along with any directories below those in the 133filesystem. 134If <parameter>config</parameter> is NULL, the current configuration is used. 135@@ 136 137@RET@ FcStrList * 138@FUNC@ FcConfigGetConfigFiles 139@TYPE1@ FcConfig * @ARG1@ config 140@PURPOSE@ Get config files 141@DESC@ 142Returns the list of known configuration files used to generate <parameter>config</parameter>. 143If <parameter>config</parameter> is NULL, the current configuration is used. 144@@ 145 146@RET@ FcChar8 * 147@FUNC@ FcConfigGetCache 148@TYPE1@ FcConfig * @ARG1@ config 149@PURPOSE@ DEPRECATED used to return per-user cache filename 150@DESC@ 151With fontconfig no longer using per-user cache files, this function now 152simply returns NULL to indicate that no per-user file exists. 153@@ 154 155@RET@ FcStrList * 156@FUNC@ FcConfigGetCacheDirs 157@TYPE1@ const FcConfig * @ARG1@ config 158@PURPOSE@ return the list of directories searched for cache files 159@DESC@ 160<function>FcConfigGetCacheDirs</function> returns a string list containing 161all of the directories that fontconfig will search when attempting to load a 162cache file for a font directory. 163If <parameter>config</parameter> is NULL, the current configuration is used. 164@@ 165 166@RET@ FcFontSet * 167@FUNC@ FcConfigGetFonts 168@TYPE1@ FcConfig * @ARG1@ config 169@TYPE2@ FcSetName% @ARG2@ set 170@PURPOSE@ Get config font set 171@DESC@ 172Returns one of the two sets of fonts from the configuration as specified 173by <parameter>set</parameter>. This font set is owned by the library and must 174not be modified or freed. 175If <parameter>config</parameter> is NULL, the current configuration is used. 176@@ 177 178@RET@ FcBlanks * 179@FUNC@ FcConfigGetBlanks 180@TYPE1@ FcConfig * @ARG1@ config 181@PURPOSE@ Get config blanks 182@DESC@ 183Returns the FcBlanks object associated with the given configuration, if no 184blanks were present in the configuration, this function will return 0. 185The returned FcBlanks object if not NULL, is valid as long as the owning 186FcConfig is alive. 187If <parameter>config</parameter> is NULL, the current configuration is used. 188@@ 189 190@RET@ int 191@FUNC@ FcConfigGetRescanInterval 192@TYPE1@ FcConfig * @ARG1@ config 193@PURPOSE@ Get config rescan interval 194@DESC@ 195Returns the interval between automatic checks of the configuration (in 196seconds) specified in <parameter>config</parameter>. The configuration is checked during 197a call to FcFontList when this interval has passed since the last check. 198An interval setting of zero disables automatic checks. 199If <parameter>config</parameter> is NULL, the current configuration is used. 200@@ 201 202@RET@ FcBool 203@FUNC@ FcConfigSetRescanInterval 204@TYPE1@ FcConfig * @ARG1@ config 205@TYPE2@ int% @ARG2@ rescanInterval 206@PURPOSE@ Set config rescan interval 207@DESC@ 208Sets the rescan interval. Returns FcFalse if the interval cannot be set (due 209to allocation failure). Otherwise returns FcTrue. 210An interval setting of zero disables automatic checks. 211If <parameter>config</parameter> is NULL, the current configuration is used. 212@@ 213 214@RET@ FcBool 215@FUNC@ FcConfigAppFontAddFile 216@TYPE1@ FcConfig * @ARG1@ config 217@TYPE2@ const FcChar8 * @ARG2@ file 218@PURPOSE@ Add font file to font database 219@DESC@ 220Adds an application-specific font to the configuration. Returns FcFalse 221if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue. 222If <parameter>config</parameter> is NULL, the current configuration is used. 223@@ 224 225@RET@ FcBool 226@FUNC@ FcConfigAppFontAddDir 227@TYPE1@ FcConfig * @ARG1@ config 228@TYPE2@ const FcChar8 * @ARG2@ dir 229@PURPOSE@ Add fonts from directory to font database 230@DESC@ 231Scans the specified directory for fonts, adding each one found to the 232application-specific set of fonts. Returns FcFalse 233if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue. 234If <parameter>config</parameter> is NULL, the current configuration is used. 235@@ 236 237@RET@ void 238@FUNC@ FcConfigAppFontClear 239@TYPE1@ FcConfig * @ARG1@ config 240@PURPOSE@ Remove all app fonts from font database 241@DESC@ 242Clears the set of application-specific fonts. 243If <parameter>config</parameter> is NULL, the current configuration is used. 244@@ 245 246@RET@ FcBool 247@FUNC@ FcConfigSubstituteWithPat 248@TYPE1@ FcConfig * @ARG1@ config 249@TYPE2@ FcPattern * @ARG2@ p 250@TYPE3@ FcPattern * @ARG3@ p_pat 251@TYPE4@ FcMatchKind% @ARG4@ kind 252@PURPOSE@ Execute substitutions 253@DESC@ 254Performs the sequence of pattern modification operations, if <parameter>kind</parameter> is 255FcMatchPattern, then those tagged as pattern operations are applied, else 256if <parameter>kind</parameter> is FcMatchFont, those tagged as font operations are applied and 257p_pat is used for <test> elements with target=pattern. Returns FcFalse 258if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue. 259If <parameter>config</parameter> is NULL, the current configuration is used. 260@@ 261 262@RET@ FcBool 263@FUNC@ FcConfigSubstitute 264@TYPE1@ FcConfig * @ARG1@ config 265@TYPE2@ FcPattern * @ARG2@ p 266@TYPE3@ FcMatchKind% @ARG3@ kind 267@PURPOSE@ Execute substitutions 268@DESC@ 269Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns FcFalse 270if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue. 271If <parameter>config</parameter> is NULL, the current configuration is used. 272@@ 273 274@RET@ FcPattern * 275@FUNC@ FcFontMatch 276@TYPE1@ FcConfig * @ARG1@ config 277@TYPE2@ FcPattern * @ARG2@ p 278@TYPE3@ FcResult * @ARG3@ result 279@PURPOSE@ Return best font 280@DESC@ 281Finds the font in <parameter>sets</parameter> most closely matching 282<parameter>pattern</parameter> and returns the result of 283<function>FcFontRenderPrepare</function> for that font and the provided 284pattern. This function should be called only after 285<function>FcConfigSubstitute</function> and 286<function>FcDefaultSubstitute</function> have been called for 287<parameter>p</parameter>; otherwise the results will not be correct. 288If <parameter>config</parameter> is NULL, the current configuration is used. 289@@ 290 291@RET@ FcFontSet * 292@FUNC@ FcFontSort 293@TYPE1@ FcConfig * @ARG1@ config 294@TYPE2@ FcPattern * @ARG2@ p 295@TYPE3@ FcBool% @ARG3@ trim 296@TYPE4@ FcCharSet ** @ARG4@ csp 297@TYPE5@ FcResult * @ARG5@ result 298@PURPOSE@ Return list of matching fonts 299@DESC@ 300Returns the list of fonts sorted by closeness to <parameter>p</parameter>. If <parameter>trim</parameter> is FcTrue, 301elements in the list which don't include Unicode coverage not provided by 302earlier elements in the list are elided. The union of Unicode coverage of 303all of the fonts is returned in <parameter>csp</parameter>, if <parameter>csp</parameter> is not NULL. This function 304should be called only after FcConfigSubstitute and FcDefaultSubstitute have 305been called for <parameter>p</parameter>; otherwise the results will not be correct. 306 </para><para> 307The returned FcFontSet references FcPattern structures which may be shared 308by the return value from multiple FcFontSort calls, applications must not 309modify these patterns. Instead, they should be passed, along with <parameter>p</parameter> to 310<function>FcFontRenderPrepare</function> which combines them into a complete pattern. 311 </para><para> 312The FcFontSet returned by FcFontSort is destroyed by calling FcFontSetDestroy. 313If <parameter>config</parameter> is NULL, the current configuration is used. 314@@ 315 316@RET@ FcPattern * 317@FUNC@ FcFontRenderPrepare 318@TYPE1@ FcConfig * @ARG1@ config 319@TYPE2@ FcPattern * @ARG2@ pat 320@TYPE3@ FcPattern * @ARG3@ font 321@PURPOSE@ Prepare pattern for loading font file 322@DESC@ 323Creates a new pattern consisting of elements of <parameter>font</parameter> not appearing 324in <parameter>pat</parameter>, elements of <parameter>pat</parameter> not appearing in <parameter>font</parameter> and the best matching 325value from <parameter>pat</parameter> for elements appearing in both. The result is passed to 326FcConfigSubstituteWithPat with <parameter>kind</parameter> FcMatchFont and then returned. 327@@ 328 329@RET@ FcFontSet * 330@FUNC@ FcFontList 331@TYPE1@ FcConfig * @ARG1@ config 332@TYPE2@ FcPattern * @ARG2@ p 333@TYPE3@ FcObjectSet * @ARG3@ os 334@PURPOSE@ List fonts 335@DESC@ 336Selects fonts matching <parameter>p</parameter>, creates patterns from those fonts containing 337only the objects in <parameter>os</parameter> and returns the set of unique such patterns. 338If <parameter>config</parameter> is NULL, the default configuration is checked 339to be up to date, and used. 340@@ 341 342@RET@ FcChar8 * 343@FUNC@ FcConfigFilename 344@TYPE1@ const FcChar8 * @ARG1@ name 345@PURPOSE@ Find a config file 346@DESC@ 347Given the specified external entity name, return the associated filename. 348This provides applications a way to convert various configuration file 349references into filename form. 350 </para><para> 351A null or empty <parameter>name</parameter> indicates that the default configuration file should 352be used; which file this references can be overridden with the 353FONTCONFIG_FILE environment variable. Next, if the name starts with <parameter>~</parameter>, it 354refers to a file in the current users home directory. Otherwise if the name 355doesn't start with '/', it refers to a file in the default configuration 356directory; the built-in default directory can be overridden with the 357FONTCONFIG_PATH environment variable. 358@@ 359 360@RET@ FcBool 361@FUNC@ FcConfigParseAndLoad 362@TYPE1@ FcConfig * @ARG1@ config 363@TYPE2@ const FcChar8 * @ARG2@ file 364@TYPE3@ FcBool% @ARG3@ complain 365@PURPOSE@ load a configuration file 366@DESC@ 367Walks the configuration in 'file' and constructs the internal representation 368in 'config'. Any include files referenced from within 'file' will be loaded 369and parsed. If 'complain' is FcFalse, no warning will be displayed if 370'file' does not exist. Error and warning messages will be output to stderr. 371Returns FcFalse if some error occurred while loading the file, either a 372parse error, semantic error or allocation failure. Otherwise returns FcTrue. 373@@ 374 375@RET@ const FcChar8 * 376@FUNC@ FcConfigGetSysRoot 377@TYPE1@ const FcConfig * @ARG1@ config 378@PURPOSE@ Obtain the system root directory 379@DESC@ 380Obtrains the system root directory in 'config' if available. 381@SINCE@ 2.10.92 382@@ 383 384@RET@ void 385@FUNC@ FcConfigSetSysRoot 386@TYPE1@ FcConfig * @ARG1@ config 387@TYPE2@ const FcChar8 * @ARG2@ sysroot 388@PURPOSE@ Set the system root directory 389@DESC@ 390Set 'sysroot' as the system root directory. fontconfig prepend 'sysroot' 391to the cache directories in order to allow people to generate caches at 392the build time. Note that this causes changing current config. i.e. 393this function calls FcConfigSetCurrent() internally. 394@SINCE@ 2.10.92 395@@ 396 397