]> git.wh0rd.org - fontconfig.git/blame - doc/fcconfig.fncs
Document when config can be NULL (#17105)
[fontconfig.git] / doc / fcconfig.fncs
CommitLineData
bfc2dc3a 1/*
e690fbb2 2 * fontconfig/doc/fcconfig.fncs
bfc2dc3a 3 *
46b51147 4 * Copyright © 2003 Keith Packard
bfc2dc3a
KP
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 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.
15 *
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.
23 */
39381776 24@RET@ FcConfig *
bfc2dc3a
KP
25@FUNC@ FcConfigCreate
26@TYPE1@ void
27@PURPOSE@ Create a configuration
28@DESC@
29Creates an empty configuration.
30@@
31
39381776
KP
32@RET@ void
33@FUNC@ FcConfigDestroy
34@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
35@PURPOSE@ Destroy a configuration
36@DESC@
37Destroys a configuration and any data associated with it. Note that calling
38this function with the return from FcConfigGetCurrent will place the library
39in an indeterminate state.
40@@
41
39381776
KP
42@RET@ FcBool
43@FUNC@ FcConfigSetCurrent
44@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
45@PURPOSE@ Set configuration as default
46@DESC@
2df0c662 47Sets the current default configuration to <parameter>config</parameter>. Implicitly calls
bfc2dc3a
KP
48FcConfigBuildFonts if necessary, returning FcFalse if that call fails.
49@@
50
39381776 51@RET@ FcConfig *
bfc2dc3a
KP
52@FUNC@ FcConfigGetCurrent
53@TYPE1@ void
54@PURPOSE@ Return current configuration
55@DESC@
56Returns the current default configuration.
57@@
58
39381776
KP
59@RET@ FcBool
60@FUNC@ FcConfigUptoDate
61@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
62@PURPOSE@ Check timestamps on config files
63@DESC@
5d82c4c8
KP
64Checks all of the files related to <parameter>config</parameter> and returns
65whether any of them has been modified since the configuration was created.
03dcaaa0 66If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
67@@
68
bb65f58f 69@RET@ FcChar8 *
a190678e
KP
70@FUNC@ FcConfigHome
71@TYPE1@ void
72@PURPOSE@ return the current home directory.
73@DESC@
74Return the current user's home directory, if it is available, and if using it
bb65f58f
BE
75is enabled, and NULL otherwise.
76See also <function>FcConfigEnableHome</function>).
a190678e
KP
77@@
78
79@RET@ FcBol
80@FUNC@ FcConfigEnableHome
81@TYPE1@ FcBool% @ARG1@ enable
82@PURPOSE@ controls use of the home directory.
83@DESC@
84If <parameter>enable</parameter> is FcTrue, then Fontconfig will use various
85files which are specified relative to the user's home directory (using the ~
86notation in the configuration). When <parameter>enable</parameter> is
87FcFalse, then all use of the home directory in these contexts will be
88disabled. The previous setting of the value is returned.
89@@
90
39381776
KP
91@RET@ FcBool
92@FUNC@ FcConfigBuildFonts
93@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
94@PURPOSE@ Build font database
95@DESC@
96Builds the set of available fonts for the given configuration. Note that
97any changes to the configuration after this call have indeterminate effects.
98Returns FcFalse if this operation runs out of memory.
03dcaaa0 99If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
100@@
101
39381776
KP
102@RET@ FcStrList *
103@FUNC@ FcConfigGetConfigDirs
104@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
105@PURPOSE@ Get config directories
106@DESC@
107Returns the list of font directories specified in the configuration files
2df0c662 108for <parameter>config</parameter>. Does not include any subdirectories.
03dcaaa0 109If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
110@@
111
39381776
KP
112@RET@ FcStrList *
113@FUNC@ FcConfigGetFontDirs
114@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
115@PURPOSE@ Get font directories
116@DESC@
2df0c662 117Returns the list of font directories in <parameter>config</parameter>. This includes the
bfc2dc3a
KP
118configured font directories along with any directories below those in the
119filesystem.
03dcaaa0 120If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
121@@
122
39381776
KP
123@RET@ FcStrList *
124@FUNC@ FcConfigGetConfigFiles
125@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
126@PURPOSE@ Get config files
127@DESC@
2df0c662 128Returns the list of known configuration files used to generate <parameter>config</parameter>.
03dcaaa0 129If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
130@@
131
f2772d6b 132@RET@ FcChar8 *
39381776
KP
133@FUNC@ FcConfigGetCache
134@TYPE1@ FcConfig * @ARG1@ config
7c693979 135@PURPOSE@ DEPRECATED used to return per-user cache filename
bfc2dc3a 136@DESC@
7c693979
KP
137With fontconfig no longer using per-user cache files, this function now
138simply returns NULL to indicate that no per-user file exists.
bfc2dc3a
KP
139@@
140
a190678e
KP
141@RET@ FcStrList *
142@FUNC@ FcConfigGetCacheDirs
143@TYPE1@ FcConfig * @ARG1@ config
144@PURPOSE@ return the list of directories searched for cache files
145@DESC@
146<function>FcConfigGetCacheDirs</function> returns a string list containing
147all of the directories that fontconfig will search when attempting to load a
148cache file for a font directory.
03dcaaa0 149If <parameter>config</parameter> is NULL, the current configuration is used.
a190678e
KP
150@@
151
39381776
KP
152@RET@ FcFontSet *
153@FUNC@ FcConfigGetFonts
bfc2dc3a 154@TYPE1@ FcConfig * @ARG1@ config
61895ed1 155@TYPE2@ FcSetName% @ARG2@ set
bfc2dc3a
KP
156@PURPOSE@ Get config font set
157@DESC@
39381776 158Returns one of the two sets of fonts from the configuration as specified
eaf4470a
KP
159by <parameter>set</parameter>. This font set is owned by the library and must
160not be freed.
03dcaaa0 161If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
162@@
163
39381776
KP
164@RET@ FcBlanks *
165@FUNC@ FcConfigGetBlanks
166@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
167@PURPOSE@ Get config blanks
168@DESC@
169Returns the FcBlanks object associated with the given configuration, if no
170blanks were present in the configuration, this function will return 0.
03dcaaa0
BE
171The returned FcBlanks object if not NULL, is valid as long as the owning
172FcConfig is alive.
173If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
174@@
175
39381776 176@RET@ int
61139cf6 177@FUNC@ FcConfigGetRescanInterval
39381776 178@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
179@PURPOSE@ Get config rescan interval
180@DESC@
181Returns the interval between automatic checks of the configuration (in
2df0c662 182seconds) specified in <parameter>config</parameter>. The configuration is checked during
bfc2dc3a 183a call to FcFontList when this interval has passed since the last check.
30420509 184An interval setting of zero disables automatic checks.
03dcaaa0 185If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
186@@
187
39381776 188@RET@ FcBool
61139cf6 189@FUNC@ FcConfigSetRescanInterval
bfc2dc3a 190@TYPE1@ FcConfig * @ARG1@ config
61895ed1 191@TYPE2@ int% @ARG2@ rescanInterval
bfc2dc3a
KP
192@PURPOSE@ Set config rescan interval
193@DESC@
fab44f3c
KP
194Sets the rescan interval. Returns FcFalse if the interval cannot be set (due
195to allocation failure). Otherwise returns FcTrue.
30420509 196An interval setting of zero disables automatic checks.
03dcaaa0 197If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
198@@
199
39381776
KP
200@RET@ FcBool
201@FUNC@ FcConfigAppFontAddFile
bfc2dc3a 202@TYPE1@ FcConfig * @ARG1@ config
f2772d6b 203@TYPE2@ const FcChar8 * @ARG2@ file
bfc2dc3a
KP
204@PURPOSE@ Add font file to font database
205@DESC@
fab44f3c
KP
206Adds an application-specific font to the configuration. Returns FcFalse
207if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
03dcaaa0 208If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
209@@
210
39381776
KP
211@RET@ FcBool
212@FUNC@ FcConfigAppFontAddDir
bfc2dc3a 213@TYPE1@ FcConfig * @ARG1@ config
f2772d6b 214@TYPE2@ const FcChar8 * @ARG2@ dir
bfc2dc3a
KP
215@PURPOSE@ Add fonts from directory to font database
216@DESC@
217Scans the specified directory for fonts, adding each one found to the
fab44f3c
KP
218application-specific set of fonts. Returns FcFalse
219if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
03dcaaa0 220If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
221@@
222
39381776
KP
223@RET@ void
224@FUNC@ FcConfigAppFontClear
225@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
226@PURPOSE@ Remove all app fonts from font database
227@DESC@
228Clears the set of application-specific fonts.
03dcaaa0 229If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
230@@
231
39381776
KP
232@RET@ FcBool
233@FUNC@ FcConfigSubstituteWithPat
bfc2dc3a
KP
234@TYPE1@ FcConfig * @ARG1@ config
235@TYPE2@ FcPattern * @ARG2@ p
236@TYPE3@ FcPattern * @ARG3@ p_pat
61895ed1 237@TYPE4@ FcMatchKind% @ARG4@ kind
bfc2dc3a
KP
238@PURPOSE@ Execute substitutions
239@DESC@
2df0c662 240Performs the sequence of pattern modification operations, if <parameter>kind</parameter> is
39381776 241FcMatchPattern, then those tagged as pattern operations are applied, else
2df0c662 242if <parameter>kind</parameter> is FcMatchFont, those tagged as font operations are applied and
fab44f3c
KP
243p_pat is used for &lt;test&gt; elements with target=pattern. Returns FcFalse
244if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
03dcaaa0 245If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
246@@
247
39381776
KP
248@RET@ FcBool
249@FUNC@ FcConfigSubstitute
bfc2dc3a
KP
250@TYPE1@ FcConfig * @ARG1@ config
251@TYPE2@ FcPattern * @ARG2@ p
61895ed1 252@TYPE3@ FcMatchKind% @ARG3@ kind
bfc2dc3a
KP
253@PURPOSE@ Execute substitutions
254@DESC@
fab44f3c
KP
255Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns FcFalse
256if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
03dcaaa0 257If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
258@@
259
39381776
KP
260@RET@ FcPattern *
261@FUNC@ FcFontMatch
bfc2dc3a
KP
262@TYPE1@ FcConfig * @ARG1@ config
263@TYPE2@ FcPattern * @ARG2@ p
39381776 264@TYPE3@ FcResult * @ARG3@ result
bfc2dc3a
KP
265@PURPOSE@ Return best font
266@DESC@
3fb38716
KP
267Finds the font in <parameter>sets</parameter> most closely matching
268<parameter>pattern</parameter> and returns the result of
269<function>FcFontRenderPrepare</function> for that font and the provided
270pattern. This function should be called only after
271<function>FcConfigSubstitute</function> and
272<function>FcDefaultSubstitute</function> have been called for
273<parameter>p</parameter>; otherwise the results will not be correct.
03dcaaa0 274If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
275@@
276
39381776
KP
277@RET@ FcFontSet *
278@FUNC@ FcFontSort
bfc2dc3a
KP
279@TYPE1@ FcConfig * @ARG1@ config
280@TYPE2@ FcPattern * @ARG2@ p
61895ed1 281@TYPE3@ FcBool% @ARG3@ trim
bfc2dc3a 282@TYPE4@ FcCharSet ** @ARG4@ csp
39381776 283@TYPE5@ FcResult * @ARG5@ result
bfc2dc3a
KP
284@PURPOSE@ Return list of matching fonts
285@DESC@
2df0c662 286Returns the list of fonts sorted by closeness to <parameter>p</parameter>. If <parameter>trim</parameter> is FcTrue,
bfc2dc3a
KP
287elements in the list which don't include Unicode coverage not provided by
288earlier elements in the list are elided. The union of Unicode coverage of
2df0c662 289all of the fonts is returned in <parameter>csp</parameter>, if <parameter>csp</parameter> is not NULL. This function
bfc2dc3a 290should be called only after FcConfigSubstitute and FcDefaultSubstitute have
2df0c662 291been called for <parameter>p</parameter>; otherwise the results will not be correct.
bfc2dc3a
KP
292 </para><para>
293The returned FcFontSet references FcPattern structures which may be shared
294by the return value from multiple FcFontSort calls, applications must not
2df0c662 295modify these patterns. Instead, they should be passed, along with <parameter>p</parameter> to
3fb38716 296<function>FcFontRenderPrepare</function> which combines them into a complete pattern.
bfc2dc3a
KP
297 </para><para>
298The FcFontSet returned by FcFontSort is destroyed by caling FcFontSetDestroy.
03dcaaa0 299If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
300@@
301
39381776
KP
302@RET@ FcPattern *
303@FUNC@ FcFontRenderPrepare
bfc2dc3a
KP
304@TYPE1@ FcConfig * @ARG1@ config
305@TYPE2@ FcPattern * @ARG2@ pat
39381776 306@TYPE3@ FcPattern * @ARG3@ font
bfc2dc3a
KP
307@PURPOSE@ Prepare pattern for loading font file
308@DESC@
2df0c662
KP
309Creates a new pattern consisting of elements of <parameter>font</parameter> not appearing
310in <parameter>pat</parameter>, elements of <parameter>pat</parameter> not appearing in <parameter>font</parameter> and the best matching
311value from <parameter>pat</parameter> for elements appearing in both. The result is passed to
b21bea37 312FcConfigSubstituteWithPat with <parameter>kind</parameter> FcMatchFont and then returned.
bfc2dc3a
KP
313@@
314
39381776
KP
315@RET@ FcFontSet *
316@FUNC@ FcFontList
bfc2dc3a
KP
317@TYPE1@ FcConfig * @ARG1@ config
318@TYPE2@ FcPattern * @ARG2@ p
39381776 319@TYPE3@ FcObjectSet * @ARG3@ os
bfc2dc3a
KP
320@PURPOSE@ List fonts
321@DESC@
2df0c662
KP
322Selects fonts matching <parameter>p</parameter>, creates patterns from those fonts containing
323only the objects in <parameter>os</parameter> and returns the set of unique such patterns.
03dcaaa0
BE
324If <parameter>config</parameter> is NULL, the default configuration is checked
325to be up to date, and used.
bfc2dc3a
KP
326@@
327
f2772d6b 328@RET@ FcChar8 *
39381776 329@FUNC@ FcConfigFilename
f2772d6b 330@TYPE1@ const FcChar8 * @ARG1@ name
bfc2dc3a
KP
331@PURPOSE@ Find a config file
332@DESC@
333Given the specified external entity name, return the associated filename.
334This provides applications a way to convert various configuration file
39381776 335references into filename form.
bfc2dc3a 336 </para><para>
2df0c662 337A null or empty <parameter>name</parameter> indicates that the default configuration file should
bfc2dc3a 338be used; which file this references can be overridden with the
2df0c662 339FC_CONFIG_FILE environment variable. Next, if the name starts with <parameter>~</parameter>, it
bfc2dc3a
KP
340refers to a file in the current users home directory. Otherwise if the name
341doesn't start with '/', it refers to a file in the default configuration
342directory; the built-in default directory can be overridden with the
343FC_CONFIG_DIR environment variable.
344@@
39381776
KP
345
346@RET@ FcBool
347@FUNC@ FcConfigParseAndLoad
348@TYPE1@ FcConfig * @ARG1@ config
349@TYPE2@ const FcChar8 * @ARG2@ file
26437d49 350@TYPE3@ FcBool% @ARG3@ complain
39381776
KP
351@PURPOSE@ load a configuration file
352@DESC@
353Walks the configuration in 'file' and constructs the internal representation
354in 'config'. Any include files referenced from within 'file' will be loaded
fab44f3c
KP
355and parsed. If 'complain' is FcFalse, no warning will be displayed if
356'file' does not exist. Error and warning messages will be output to stderr.
357Returns FcFalse if some error occurred while loading the file, either a
358parse error, semantic error or allocation failure. Otherwise returns FcTrue.
39381776 359@@