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@ FcConfigDestroy
34 @TYPE1@ FcConfig * @ARG1@ config
35 @PURPOSE@ Destroy a configuration
37 Destroys a configuration and any data associated with it. Note that calling
38 this function with the return from FcConfigGetCurrent will place the library
39 in an indeterminate state.
43 @FUNC@ FcConfigSetCurrent
44 @TYPE1@ FcConfig * @ARG1@ config
45 @PURPOSE@ Set configuration as default
47 Sets the current default configuration to <parameter>config</parameter>. Implicitly calls
48 FcConfigBuildFonts if necessary, returning FcFalse if that call fails.
52 @FUNC@ FcConfigGetCurrent
54 @PURPOSE@ Return current configuration
56 Returns the current default configuration.
60 @FUNC@ FcConfigUptoDate
61 @TYPE1@ FcConfig * @ARG1@ config
62 @PURPOSE@ Check timestamps on config files
64 Checks all of the files related to <parameter>config</parameter> and returns
65 whether any of them has been modified since the configuration was created.
66 If <parameter>config</parameter> is NULL, the current configuration is used.
72 @PURPOSE@ return the current home directory.
74 Return the current user's home directory, if it is available, and if using it
75 is enabled, and NULL otherwise.
76 See also <function>FcConfigEnableHome</function>).
80 @FUNC@ FcConfigEnableHome
81 @TYPE1@ FcBool% @ARG1@ enable
82 @PURPOSE@ controls use of the home directory.
84 If <parameter>enable</parameter> is FcTrue, then Fontconfig will use various
85 files which are specified relative to the user's home directory (using the ~
86 notation in the configuration). When <parameter>enable</parameter> is
87 FcFalse, then all use of the home directory in these contexts will be
88 disabled. The previous setting of the value is returned.
92 @FUNC@ FcConfigBuildFonts
93 @TYPE1@ FcConfig * @ARG1@ config
94 @PURPOSE@ Build font database
96 Builds the set of available fonts for the given configuration. Note that
97 any changes to the configuration after this call have indeterminate effects.
98 Returns FcFalse if this operation runs out of memory.
99 If <parameter>config</parameter> is NULL, the current configuration is used.
103 @FUNC@ FcConfigGetConfigDirs
104 @TYPE1@ FcConfig * @ARG1@ config
105 @PURPOSE@ Get config directories
107 Returns the list of font directories specified in the configuration files
108 for <parameter>config</parameter>. Does not include any subdirectories.
109 If <parameter>config</parameter> is NULL, the current configuration is used.
113 @FUNC@ FcConfigGetFontDirs
114 @TYPE1@ FcConfig * @ARG1@ config
115 @PURPOSE@ Get font directories
117 Returns the list of font directories in <parameter>config</parameter>. This includes the
118 configured font directories along with any directories below those in the
120 If <parameter>config</parameter> is NULL, the current configuration is used.
124 @FUNC@ FcConfigGetConfigFiles
125 @TYPE1@ FcConfig * @ARG1@ config
126 @PURPOSE@ Get config files
128 Returns the list of known configuration files used to generate <parameter>config</parameter>.
129 If <parameter>config</parameter> is NULL, the current configuration is used.
133 @FUNC@ FcConfigGetCache
134 @TYPE1@ FcConfig * @ARG1@ config
135 @PURPOSE@ DEPRECATED used to return per-user cache filename
137 With fontconfig no longer using per-user cache files, this function now
138 simply returns NULL to indicate that no per-user file exists.
142 @FUNC@ FcConfigGetCacheDirs
143 @TYPE1@ FcConfig * @ARG1@ config
144 @PURPOSE@ return the list of directories searched for cache files
146 <function>FcConfigGetCacheDirs</function> returns a string list containing
147 all of the directories that fontconfig will search when attempting to load a
148 cache file for a font directory.
149 If <parameter>config</parameter> is NULL, the current configuration is used.
153 @FUNC@ FcConfigGetFonts
154 @TYPE1@ FcConfig * @ARG1@ config
155 @TYPE2@ FcSetName% @ARG2@ set
156 @PURPOSE@ Get config font set
158 Returns one of the two sets of fonts from the configuration as specified
159 by <parameter>set</parameter>. This font set is owned by the library and must
161 If <parameter>config</parameter> is NULL, the current configuration is used.
165 @FUNC@ FcConfigGetBlanks
166 @TYPE1@ FcConfig * @ARG1@ config
167 @PURPOSE@ Get config blanks
169 Returns the FcBlanks object associated with the given configuration, if no
170 blanks were present in the configuration, this function will return 0.
171 The returned FcBlanks object if not NULL, is valid as long as the owning
173 If <parameter>config</parameter> is NULL, the current configuration is used.
177 @FUNC@ FcConfigGetRescanInterval
178 @TYPE1@ FcConfig * @ARG1@ config
179 @PURPOSE@ Get config rescan interval
181 Returns the interval between automatic checks of the configuration (in
182 seconds) specified in <parameter>config</parameter>. The configuration is checked during
183 a call to FcFontList when this interval has passed since the last check.
184 An interval setting of zero disables automatic checks.
185 If <parameter>config</parameter> is NULL, the current configuration is used.
189 @FUNC@ FcConfigSetRescanInterval
190 @TYPE1@ FcConfig * @ARG1@ config
191 @TYPE2@ int% @ARG2@ rescanInterval
192 @PURPOSE@ Set config rescan interval
194 Sets the rescan interval. Returns FcFalse if the interval cannot be set (due
195 to allocation failure). Otherwise returns FcTrue.
196 An interval setting of zero disables automatic checks.
197 If <parameter>config</parameter> is NULL, the current configuration is used.
201 @FUNC@ FcConfigAppFontAddFile
202 @TYPE1@ FcConfig * @ARG1@ config
203 @TYPE2@ const FcChar8 * @ARG2@ file
204 @PURPOSE@ Add font file to font database
206 Adds an application-specific font to the configuration. Returns FcFalse
207 if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
208 If <parameter>config</parameter> is NULL, the current configuration is used.
212 @FUNC@ FcConfigAppFontAddDir
213 @TYPE1@ FcConfig * @ARG1@ config
214 @TYPE2@ const FcChar8 * @ARG2@ dir
215 @PURPOSE@ Add fonts from directory to font database
217 Scans the specified directory for fonts, adding each one found to the
218 application-specific set of fonts. Returns FcFalse
219 if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
220 If <parameter>config</parameter> is NULL, the current configuration is used.
224 @FUNC@ FcConfigAppFontClear
225 @TYPE1@ FcConfig * @ARG1@ config
226 @PURPOSE@ Remove all app fonts from font database
228 Clears the set of application-specific fonts.
229 If <parameter>config</parameter> is NULL, the current configuration is used.
233 @FUNC@ FcConfigSubstituteWithPat
234 @TYPE1@ FcConfig * @ARG1@ config
235 @TYPE2@ FcPattern * @ARG2@ p
236 @TYPE3@ FcPattern * @ARG3@ p_pat
237 @TYPE4@ FcMatchKind% @ARG4@ kind
238 @PURPOSE@ Execute substitutions
240 Performs the sequence of pattern modification operations, if <parameter>kind</parameter> is
241 FcMatchPattern, then those tagged as pattern operations are applied, else
242 if <parameter>kind</parameter> is FcMatchFont, those tagged as font operations are applied and
243 p_pat is used for <test> elements with target=pattern. Returns FcFalse
244 if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
245 If <parameter>config</parameter> is NULL, the current configuration is used.
249 @FUNC@ FcConfigSubstitute
250 @TYPE1@ FcConfig * @ARG1@ config
251 @TYPE2@ FcPattern * @ARG2@ p
252 @TYPE3@ FcMatchKind% @ARG3@ kind
253 @PURPOSE@ Execute substitutions
255 Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns FcFalse
256 if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
257 If <parameter>config</parameter> is NULL, the current configuration is used.
262 @TYPE1@ FcConfig * @ARG1@ config
263 @TYPE2@ FcPattern * @ARG2@ p
264 @TYPE3@ FcResult * @ARG3@ result
265 @PURPOSE@ Return best font
267 Finds 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
270 pattern. 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.
274 If <parameter>config</parameter> is NULL, the current configuration is used.
279 @TYPE1@ FcConfig * @ARG1@ config
280 @TYPE2@ FcPattern * @ARG2@ p
281 @TYPE3@ FcBool% @ARG3@ trim
282 @TYPE4@ FcCharSet ** @ARG4@ csp
283 @TYPE5@ FcResult * @ARG5@ result
284 @PURPOSE@ Return list of matching fonts
286 Returns the list of fonts sorted by closeness to <parameter>p</parameter>. If <parameter>trim</parameter> is FcTrue,
287 elements in the list which don't include Unicode coverage not provided by
288 earlier elements in the list are elided. The union of Unicode coverage of
289 all of the fonts is returned in <parameter>csp</parameter>, if <parameter>csp</parameter> is not NULL. This function
290 should be called only after FcConfigSubstitute and FcDefaultSubstitute have
291 been called for <parameter>p</parameter>; otherwise the results will not be correct.
293 The returned FcFontSet references FcPattern structures which may be shared
294 by the return value from multiple FcFontSort calls, applications must not
295 modify these patterns. Instead, they should be passed, along with <parameter>p</parameter> to
296 <function>FcFontRenderPrepare</function> which combines them into a complete pattern.
298 The FcFontSet returned by FcFontSort is destroyed by caling FcFontSetDestroy.
299 If <parameter>config</parameter> is NULL, the current configuration is used.
303 @FUNC@ FcFontRenderPrepare
304 @TYPE1@ FcConfig * @ARG1@ config
305 @TYPE2@ FcPattern * @ARG2@ pat
306 @TYPE3@ FcPattern * @ARG3@ font
307 @PURPOSE@ Prepare pattern for loading font file
309 Creates a new pattern consisting of elements of <parameter>font</parameter> not appearing
310 in <parameter>pat</parameter>, elements of <parameter>pat</parameter> not appearing in <parameter>font</parameter> and the best matching
311 value from <parameter>pat</parameter> for elements appearing in both. The result is passed to
312 FcConfigSubstituteWithPat with <parameter>kind</parameter> FcMatchFont and then returned.
317 @TYPE1@ FcConfig * @ARG1@ config
318 @TYPE2@ FcPattern * @ARG2@ p
319 @TYPE3@ FcObjectSet * @ARG3@ os
322 Selects fonts matching <parameter>p</parameter>, creates patterns from those fonts containing
323 only the objects in <parameter>os</parameter> and returns the set of unique such patterns.
324 If <parameter>config</parameter> is NULL, the default configuration is checked
325 to be up to date, and used.
329 @FUNC@ FcConfigFilename
330 @TYPE1@ const FcChar8 * @ARG1@ name
331 @PURPOSE@ Find a config file
333 Given the specified external entity name, return the associated filename.
334 This provides applications a way to convert various configuration file
335 references into filename form.
337 A null or empty <parameter>name</parameter> indicates that the default configuration file should
338 be used; which file this references can be overridden with the
339 FC_CONFIG_FILE environment variable. Next, if the name starts with <parameter>~</parameter>, it
340 refers to a file in the current users home directory. Otherwise if the name
341 doesn't start with '/', it refers to a file in the default configuration
342 directory; the built-in default directory can be overridden with the
343 FC_CONFIG_DIR environment variable.
347 @FUNC@ FcConfigParseAndLoad
348 @TYPE1@ FcConfig * @ARG1@ config
349 @TYPE2@ const FcChar8 * @ARG2@ file
350 @TYPE3@ FcBool% @ARG3@ complain
351 @PURPOSE@ load a configuration file
353 Walks the configuration in 'file' and constructs the internal representation
354 in 'config'. Any include files referenced from within 'file' will be loaded
355 and 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.
357 Returns FcFalse if some error occurred while loading the file, either a
358 parse error, semantic error or allocation failure. Otherwise returns FcTrue.