]> git.wh0rd.org - fontconfig.git/blame - doc/fcconfig.fncs
Cleanup copyright notices to replace "Keith Packard" with "the author(s)"
[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
5aaf466d 10 * documentation, and that the name of the author(s) not be used in
bfc2dc3a 11 * advertising or publicity pertaining to distribution of the software without
5aaf466d 12 * specific, written prior permission. The authors make no
bfc2dc3a
KP
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
15 *
3074a73b 16 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
bfc2dc3a 17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
3074a73b 18 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
bfc2dc3a
KP
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
241fbde1
BE
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
39381776
KP
45@RET@ void
46@FUNC@ FcConfigDestroy
47@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
48@PURPOSE@ Destroy a configuration
49@DESC@
241fbde1
BE
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.
bfc2dc3a
KP
54@@
55
39381776
KP
56@RET@ FcBool
57@FUNC@ FcConfigSetCurrent
58@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
59@PURPOSE@ Set configuration as default
60@DESC@
2df0c662 61Sets the current default configuration to <parameter>config</parameter>. Implicitly calls
bfc2dc3a
KP
62FcConfigBuildFonts if necessary, returning FcFalse if that call fails.
63@@
64
39381776 65@RET@ FcConfig *
bfc2dc3a
KP
66@FUNC@ FcConfigGetCurrent
67@TYPE1@ void
68@PURPOSE@ Return current configuration
69@DESC@
70Returns the current default configuration.
71@@
72
39381776
KP
73@RET@ FcBool
74@FUNC@ FcConfigUptoDate
75@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
76@PURPOSE@ Check timestamps on config files
77@DESC@
5d82c4c8
KP
78Checks all of the files related to <parameter>config</parameter> and returns
79whether any of them has been modified since the configuration was created.
03dcaaa0 80If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
81@@
82
bb65f58f 83@RET@ FcChar8 *
a190678e
KP
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
bb65f58f
BE
89is enabled, and NULL otherwise.
90See also <function>FcConfigEnableHome</function>).
a190678e
KP
91@@
92
93@RET@ FcBol
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
39381776
KP
105@RET@ FcBool
106@FUNC@ FcConfigBuildFonts
107@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
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.
03dcaaa0 113If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
114@@
115
39381776
KP
116@RET@ FcStrList *
117@FUNC@ FcConfigGetConfigDirs
118@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
119@PURPOSE@ Get config directories
120@DESC@
121Returns the list of font directories specified in the configuration files
2df0c662 122for <parameter>config</parameter>. Does not include any subdirectories.
03dcaaa0 123If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
124@@
125
39381776
KP
126@RET@ FcStrList *
127@FUNC@ FcConfigGetFontDirs
128@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
129@PURPOSE@ Get font directories
130@DESC@
2df0c662 131Returns the list of font directories in <parameter>config</parameter>. This includes the
bfc2dc3a
KP
132configured font directories along with any directories below those in the
133filesystem.
03dcaaa0 134If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
135@@
136
39381776
KP
137@RET@ FcStrList *
138@FUNC@ FcConfigGetConfigFiles
139@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
140@PURPOSE@ Get config files
141@DESC@
2df0c662 142Returns the list of known configuration files used to generate <parameter>config</parameter>.
03dcaaa0 143If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
144@@
145
f2772d6b 146@RET@ FcChar8 *
39381776
KP
147@FUNC@ FcConfigGetCache
148@TYPE1@ FcConfig * @ARG1@ config
7c693979 149@PURPOSE@ DEPRECATED used to return per-user cache filename
bfc2dc3a 150@DESC@
7c693979
KP
151With fontconfig no longer using per-user cache files, this function now
152simply returns NULL to indicate that no per-user file exists.
bfc2dc3a
KP
153@@
154
a190678e
KP
155@RET@ FcStrList *
156@FUNC@ FcConfigGetCacheDirs
157@TYPE1@ 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.
03dcaaa0 163If <parameter>config</parameter> is NULL, the current configuration is used.
a190678e
KP
164@@
165
39381776
KP
166@RET@ FcFontSet *
167@FUNC@ FcConfigGetFonts
bfc2dc3a 168@TYPE1@ FcConfig * @ARG1@ config
61895ed1 169@TYPE2@ FcSetName% @ARG2@ set
bfc2dc3a
KP
170@PURPOSE@ Get config font set
171@DESC@
39381776 172Returns one of the two sets of fonts from the configuration as specified
eaf4470a 173by <parameter>set</parameter>. This font set is owned by the library and must
3b725d0a 174not be modified or freed.
03dcaaa0 175If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
176@@
177
39381776
KP
178@RET@ FcBlanks *
179@FUNC@ FcConfigGetBlanks
180@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
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.
03dcaaa0
BE
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.
bfc2dc3a
KP
188@@
189
39381776 190@RET@ int
61139cf6 191@FUNC@ FcConfigGetRescanInterval
39381776 192@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
193@PURPOSE@ Get config rescan interval
194@DESC@
195Returns the interval between automatic checks of the configuration (in
2df0c662 196seconds) specified in <parameter>config</parameter>. The configuration is checked during
bfc2dc3a 197a call to FcFontList when this interval has passed since the last check.
30420509 198An interval setting of zero disables automatic checks.
03dcaaa0 199If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
200@@
201
39381776 202@RET@ FcBool
61139cf6 203@FUNC@ FcConfigSetRescanInterval
bfc2dc3a 204@TYPE1@ FcConfig * @ARG1@ config
61895ed1 205@TYPE2@ int% @ARG2@ rescanInterval
bfc2dc3a
KP
206@PURPOSE@ Set config rescan interval
207@DESC@
fab44f3c
KP
208Sets the rescan interval. Returns FcFalse if the interval cannot be set (due
209to allocation failure). Otherwise returns FcTrue.
30420509 210An interval setting of zero disables automatic checks.
03dcaaa0 211If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
212@@
213
39381776
KP
214@RET@ FcBool
215@FUNC@ FcConfigAppFontAddFile
bfc2dc3a 216@TYPE1@ FcConfig * @ARG1@ config
f2772d6b 217@TYPE2@ const FcChar8 * @ARG2@ file
bfc2dc3a
KP
218@PURPOSE@ Add font file to font database
219@DESC@
fab44f3c
KP
220Adds an application-specific font to the configuration. Returns FcFalse
221if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
03dcaaa0 222If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
223@@
224
39381776
KP
225@RET@ FcBool
226@FUNC@ FcConfigAppFontAddDir
bfc2dc3a 227@TYPE1@ FcConfig * @ARG1@ config
f2772d6b 228@TYPE2@ const FcChar8 * @ARG2@ dir
bfc2dc3a
KP
229@PURPOSE@ Add fonts from directory to font database
230@DESC@
231Scans the specified directory for fonts, adding each one found to the
fab44f3c
KP
232application-specific set of fonts. Returns FcFalse
233if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
03dcaaa0 234If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
235@@
236
39381776
KP
237@RET@ void
238@FUNC@ FcConfigAppFontClear
239@TYPE1@ FcConfig * @ARG1@ config
bfc2dc3a
KP
240@PURPOSE@ Remove all app fonts from font database
241@DESC@
242Clears the set of application-specific fonts.
03dcaaa0 243If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
244@@
245
39381776
KP
246@RET@ FcBool
247@FUNC@ FcConfigSubstituteWithPat
bfc2dc3a
KP
248@TYPE1@ FcConfig * @ARG1@ config
249@TYPE2@ FcPattern * @ARG2@ p
250@TYPE3@ FcPattern * @ARG3@ p_pat
61895ed1 251@TYPE4@ FcMatchKind% @ARG4@ kind
bfc2dc3a
KP
252@PURPOSE@ Execute substitutions
253@DESC@
2df0c662 254Performs the sequence of pattern modification operations, if <parameter>kind</parameter> is
39381776 255FcMatchPattern, then those tagged as pattern operations are applied, else
2df0c662 256if <parameter>kind</parameter> is FcMatchFont, those tagged as font operations are applied and
fab44f3c
KP
257p_pat is used for &lt;test&gt; elements with target=pattern. Returns FcFalse
258if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
03dcaaa0 259If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
260@@
261
39381776
KP
262@RET@ FcBool
263@FUNC@ FcConfigSubstitute
bfc2dc3a
KP
264@TYPE1@ FcConfig * @ARG1@ config
265@TYPE2@ FcPattern * @ARG2@ p
61895ed1 266@TYPE3@ FcMatchKind% @ARG3@ kind
bfc2dc3a
KP
267@PURPOSE@ Execute substitutions
268@DESC@
fab44f3c
KP
269Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns FcFalse
270if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
03dcaaa0 271If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
272@@
273
39381776
KP
274@RET@ FcPattern *
275@FUNC@ FcFontMatch
bfc2dc3a
KP
276@TYPE1@ FcConfig * @ARG1@ config
277@TYPE2@ FcPattern * @ARG2@ p
39381776 278@TYPE3@ FcResult * @ARG3@ result
bfc2dc3a
KP
279@PURPOSE@ Return best font
280@DESC@
3fb38716
KP
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.
03dcaaa0 288If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
289@@
290
39381776
KP
291@RET@ FcFontSet *
292@FUNC@ FcFontSort
bfc2dc3a
KP
293@TYPE1@ FcConfig * @ARG1@ config
294@TYPE2@ FcPattern * @ARG2@ p
61895ed1 295@TYPE3@ FcBool% @ARG3@ trim
bfc2dc3a 296@TYPE4@ FcCharSet ** @ARG4@ csp
39381776 297@TYPE5@ FcResult * @ARG5@ result
bfc2dc3a
KP
298@PURPOSE@ Return list of matching fonts
299@DESC@
2df0c662 300Returns the list of fonts sorted by closeness to <parameter>p</parameter>. If <parameter>trim</parameter> is FcTrue,
bfc2dc3a
KP
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
2df0c662 303all of the fonts is returned in <parameter>csp</parameter>, if <parameter>csp</parameter> is not NULL. This function
bfc2dc3a 304should be called only after FcConfigSubstitute and FcDefaultSubstitute have
2df0c662 305been called for <parameter>p</parameter>; otherwise the results will not be correct.
bfc2dc3a
KP
306 </para><para>
307The returned FcFontSet references FcPattern structures which may be shared
308by the return value from multiple FcFontSort calls, applications must not
2df0c662 309modify these patterns. Instead, they should be passed, along with <parameter>p</parameter> to
3fb38716 310<function>FcFontRenderPrepare</function> which combines them into a complete pattern.
bfc2dc3a
KP
311 </para><para>
312The FcFontSet returned by FcFontSort is destroyed by caling FcFontSetDestroy.
03dcaaa0 313If <parameter>config</parameter> is NULL, the current configuration is used.
bfc2dc3a
KP
314@@
315
39381776
KP
316@RET@ FcPattern *
317@FUNC@ FcFontRenderPrepare
bfc2dc3a
KP
318@TYPE1@ FcConfig * @ARG1@ config
319@TYPE2@ FcPattern * @ARG2@ pat
39381776 320@TYPE3@ FcPattern * @ARG3@ font
bfc2dc3a
KP
321@PURPOSE@ Prepare pattern for loading font file
322@DESC@
2df0c662
KP
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
b21bea37 326FcConfigSubstituteWithPat with <parameter>kind</parameter> FcMatchFont and then returned.
bfc2dc3a
KP
327@@
328
39381776
KP
329@RET@ FcFontSet *
330@FUNC@ FcFontList
bfc2dc3a
KP
331@TYPE1@ FcConfig * @ARG1@ config
332@TYPE2@ FcPattern * @ARG2@ p
39381776 333@TYPE3@ FcObjectSet * @ARG3@ os
bfc2dc3a
KP
334@PURPOSE@ List fonts
335@DESC@
2df0c662
KP
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.
03dcaaa0
BE
338If <parameter>config</parameter> is NULL, the default configuration is checked
339to be up to date, and used.
bfc2dc3a
KP
340@@
341
f2772d6b 342@RET@ FcChar8 *
39381776 343@FUNC@ FcConfigFilename
f2772d6b 344@TYPE1@ const FcChar8 * @ARG1@ name
bfc2dc3a
KP
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
39381776 349references into filename form.
bfc2dc3a 350 </para><para>
2df0c662 351A null or empty <parameter>name</parameter> indicates that the default configuration file should
bfc2dc3a 352be used; which file this references can be overridden with the
2df0c662 353FC_CONFIG_FILE environment variable. Next, if the name starts with <parameter>~</parameter>, it
bfc2dc3a
KP
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
357FC_CONFIG_DIR environment variable.
358@@
39381776
KP
359
360@RET@ FcBool
361@FUNC@ FcConfigParseAndLoad
362@TYPE1@ FcConfig * @ARG1@ config
363@TYPE2@ const FcChar8 * @ARG2@ file
26437d49 364@TYPE3@ FcBool% @ARG3@ complain
39381776
KP
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
fab44f3c
KP
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.
39381776 373@@