2 * fontconfig/doc/fcconfig.fncs
4 * Copyright © 2003 Keith Packard
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 Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD 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.
27 @PURPOSE@ Create a configuration
29 Creates an empty configuration.
33 @FUNC@ FcConfigReference
34 @TYPE1@ FcConfig * @ARG1@ config
35 @PURPOSE@ Increment config reference count
37 Add another reference to <parameter>config</parameter>. Configs are freed only
38 when the reference count reaches zero.
39 If <parameter>config</parameter> is NULL, the current configuration is used.
40 In that case this function will be similar to FcConfigGetCurrent() except that
41 it increments the reference count before returning and the user is responsible
42 for destroying the configuration when not needed anymore.
46 @FUNC@ FcConfigDestroy
47 @TYPE1@ FcConfig * @ARG1@ config
48 @PURPOSE@ Destroy a configuration
50 Decrements the config reference count. If all references are gone, destroys
51 the configuration and any data associated with it.
52 Note that calling this function with the return from FcConfigGetCurrent will
53 cause a new configuration to be created for use as current configuration.
57 @FUNC@ FcConfigSetCurrent
58 @TYPE1@ FcConfig * @ARG1@ config
59 @PURPOSE@ Set configuration as default
61 Sets the current default configuration to <parameter>config</parameter>. Implicitly calls
62 FcConfigBuildFonts if necessary, returning FcFalse if that call fails.
66 @FUNC@ FcConfigGetCurrent
68 @PURPOSE@ Return current configuration
70 Returns the current default configuration.
74 @FUNC@ FcConfigUptoDate
75 @TYPE1@ FcConfig * @ARG1@ config
76 @PURPOSE@ Check timestamps on config files
78 Checks all of the files related to <parameter>config</parameter> and returns
79 whether any of them has been modified since the configuration was created.
80 If <parameter>config</parameter> is NULL, the current configuration is used.
86 @PURPOSE@ return the current home directory.
88 Return the current user's home directory, if it is available, and if using it
89 is enabled, and NULL otherwise.
90 See also <function>FcConfigEnableHome</function>).
94 @FUNC@ FcConfigEnableHome
95 @TYPE1@ FcBool% @ARG1@ enable
96 @PURPOSE@ controls use of the home directory.
98 If <parameter>enable</parameter> is FcTrue, then Fontconfig will use various
99 files which are specified relative to the user's home directory (using the ~
100 notation in the configuration). When <parameter>enable</parameter> is
101 FcFalse, then all use of the home directory in these contexts will be
102 disabled. The previous setting of the value is returned.
106 @FUNC@ FcConfigBuildFonts
107 @TYPE1@ FcConfig * @ARG1@ config
108 @PURPOSE@ Build font database
110 Builds the set of available fonts for the given configuration. Note that
111 any changes to the configuration after this call have indeterminate effects.
112 Returns FcFalse if this operation runs out of memory.
113 If <parameter>config</parameter> is NULL, the current configuration is used.
117 @FUNC@ FcConfigGetConfigDirs
118 @TYPE1@ FcConfig * @ARG1@ config
119 @PURPOSE@ Get config directories
121 Returns the list of font directories specified in the configuration files
122 for <parameter>config</parameter>. Does not include any subdirectories.
123 If <parameter>config</parameter> is NULL, the current configuration is used.
127 @FUNC@ FcConfigGetFontDirs
128 @TYPE1@ FcConfig * @ARG1@ config
129 @PURPOSE@ Get font directories
131 Returns the list of font directories in <parameter>config</parameter>. This includes the
132 configured font directories along with any directories below those in the
134 If <parameter>config</parameter> is NULL, the current configuration is used.
138 @FUNC@ FcConfigGetConfigFiles
139 @TYPE1@ FcConfig * @ARG1@ config
140 @PURPOSE@ Get config files
142 Returns the list of known configuration files used to generate <parameter>config</parameter>.
143 If <parameter>config</parameter> is NULL, the current configuration is used.
147 @FUNC@ FcConfigGetCache
148 @TYPE1@ FcConfig * @ARG1@ config
149 @PURPOSE@ DEPRECATED used to return per-user cache filename
151 With fontconfig no longer using per-user cache files, this function now
152 simply returns NULL to indicate that no per-user file exists.
156 @FUNC@ FcConfigGetCacheDirs
157 @TYPE1@ FcConfig * @ARG1@ config
158 @PURPOSE@ return the list of directories searched for cache files
160 <function>FcConfigGetCacheDirs</function> returns a string list containing
161 all of the directories that fontconfig will search when attempting to load a
162 cache file for a font directory.
163 If <parameter>config</parameter> is NULL, the current configuration is used.
167 @FUNC@ FcConfigGetFonts
168 @TYPE1@ FcConfig * @ARG1@ config
169 @TYPE2@ FcSetName% @ARG2@ set
170 @PURPOSE@ Get config font set
172 Returns one of the two sets of fonts from the configuration as specified
173 by <parameter>set</parameter>. This font set is owned by the library and must
174 not be modified or freed.
175 If <parameter>config</parameter> is NULL, the current configuration is used.
179 @FUNC@ FcConfigGetBlanks
180 @TYPE1@ FcConfig * @ARG1@ config
181 @PURPOSE@ Get config blanks
183 Returns the FcBlanks object associated with the given configuration, if no
184 blanks were present in the configuration, this function will return 0.
185 The returned FcBlanks object if not NULL, is valid as long as the owning
187 If <parameter>config</parameter> is NULL, the current configuration is used.
191 @FUNC@ FcConfigGetRescanInterval
192 @TYPE1@ FcConfig * @ARG1@ config
193 @PURPOSE@ Get config rescan interval
195 Returns the interval between automatic checks of the configuration (in
196 seconds) specified in <parameter>config</parameter>. The configuration is checked during
197 a call to FcFontList when this interval has passed since the last check.
198 An interval setting of zero disables automatic checks.
199 If <parameter>config</parameter> is NULL, the current configuration is used.
203 @FUNC@ FcConfigSetRescanInterval
204 @TYPE1@ FcConfig * @ARG1@ config
205 @TYPE2@ int% @ARG2@ rescanInterval
206 @PURPOSE@ Set config rescan interval
208 Sets the rescan interval. Returns FcFalse if the interval cannot be set (due
209 to allocation failure). Otherwise returns FcTrue.
210 An interval setting of zero disables automatic checks.
211 If <parameter>config</parameter> is NULL, the current configuration is used.
215 @FUNC@ FcConfigAppFontAddFile
216 @TYPE1@ FcConfig * @ARG1@ config
217 @TYPE2@ const FcChar8 * @ARG2@ file
218 @PURPOSE@ Add font file to font database
220 Adds an application-specific font to the configuration. Returns FcFalse
221 if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
222 If <parameter>config</parameter> is NULL, the current configuration is used.
226 @FUNC@ FcConfigAppFontAddDir
227 @TYPE1@ FcConfig * @ARG1@ config
228 @TYPE2@ const FcChar8 * @ARG2@ dir
229 @PURPOSE@ Add fonts from directory to font database
231 Scans the specified directory for fonts, adding each one found to the
232 application-specific set of fonts. Returns FcFalse
233 if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
234 If <parameter>config</parameter> is NULL, the current configuration is used.
238 @FUNC@ FcConfigAppFontClear
239 @TYPE1@ FcConfig * @ARG1@ config
240 @PURPOSE@ Remove all app fonts from font database
242 Clears the set of application-specific fonts.
243 If <parameter>config</parameter> is NULL, the current configuration is used.
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
254 Performs the sequence of pattern modification operations, if <parameter>kind</parameter> is
255 FcMatchPattern, then those tagged as pattern operations are applied, else
256 if <parameter>kind</parameter> is FcMatchFont, those tagged as font operations are applied and
257 p_pat is used for <test> elements with target=pattern. Returns FcFalse
258 if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
259 If <parameter>config</parameter> is NULL, the current configuration is used.
263 @FUNC@ FcConfigSubstitute
264 @TYPE1@ FcConfig * @ARG1@ config
265 @TYPE2@ FcPattern * @ARG2@ p
266 @TYPE3@ FcMatchKind% @ARG3@ kind
267 @PURPOSE@ Execute substitutions
269 Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns FcFalse
270 if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
271 If <parameter>config</parameter> is NULL, the current configuration is used.
276 @TYPE1@ FcConfig * @ARG1@ config
277 @TYPE2@ FcPattern * @ARG2@ p
278 @TYPE3@ FcResult * @ARG3@ result
279 @PURPOSE@ Return best font
281 Finds 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
284 pattern. 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.
288 If <parameter>config</parameter> is NULL, the current configuration is used.
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
300 Returns the list of fonts sorted by closeness to <parameter>p</parameter>. If <parameter>trim</parameter> is FcTrue,
301 elements in the list which don't include Unicode coverage not provided by
302 earlier elements in the list are elided. The union of Unicode coverage of
303 all of the fonts is returned in <parameter>csp</parameter>, if <parameter>csp</parameter> is not NULL. This function
304 should be called only after FcConfigSubstitute and FcDefaultSubstitute have
305 been called for <parameter>p</parameter>; otherwise the results will not be correct.
307 The returned FcFontSet references FcPattern structures which may be shared
308 by the return value from multiple FcFontSort calls, applications must not
309 modify these patterns. Instead, they should be passed, along with <parameter>p</parameter> to
310 <function>FcFontRenderPrepare</function> which combines them into a complete pattern.
312 The FcFontSet returned by FcFontSort is destroyed by caling FcFontSetDestroy.
313 If <parameter>config</parameter> is NULL, the current configuration is used.
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
323 Creates a new pattern consisting of elements of <parameter>font</parameter> not appearing
324 in <parameter>pat</parameter>, elements of <parameter>pat</parameter> not appearing in <parameter>font</parameter> and the best matching
325 value from <parameter>pat</parameter> for elements appearing in both. The result is passed to
326 FcConfigSubstituteWithPat with <parameter>kind</parameter> FcMatchFont and then returned.
331 @TYPE1@ FcConfig * @ARG1@ config
332 @TYPE2@ FcPattern * @ARG2@ p
333 @TYPE3@ FcObjectSet * @ARG3@ os
336 Selects fonts matching <parameter>p</parameter>, creates patterns from those fonts containing
337 only the objects in <parameter>os</parameter> and returns the set of unique such patterns.
338 If <parameter>config</parameter> is NULL, the default configuration is checked
339 to be up to date, and used.
343 @FUNC@ FcConfigFilename
344 @TYPE1@ const FcChar8 * @ARG1@ name
345 @PURPOSE@ Find a config file
347 Given the specified external entity name, return the associated filename.
348 This provides applications a way to convert various configuration file
349 references into filename form.
351 A null or empty <parameter>name</parameter> indicates that the default configuration file should
352 be used; which file this references can be overridden with the
353 FC_CONFIG_FILE environment variable. Next, if the name starts with <parameter>~</parameter>, it
354 refers to a file in the current users home directory. Otherwise if the name
355 doesn't start with '/', it refers to a file in the default configuration
356 directory; the built-in default directory can be overridden with the
357 FC_CONFIG_DIR environment variable.
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
367 Walks the configuration in 'file' and constructs the internal representation
368 in 'config'. Any include files referenced from within 'file' will be loaded
369 and 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.
371 Returns FcFalse if some error occurred while loading the file, either a
372 parse error, semantic error or allocation failure. Otherwise returns FcTrue.