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.
71 @PURPOSE@ return the current home directory.
73 Return the current user's home directory, if it is available, and if using it
74 is enabled. See also <function>FcConfigEnableHome</function>).
78 @FUNC@ FcConfigEnableHome
79 @TYPE1@ FcBool% @ARG1@ enable
80 @PURPOSE@ controls use of the home directory.
82 If <parameter>enable</parameter> is FcTrue, then Fontconfig will use various
83 files which are specified relative to the user's home directory (using the ~
84 notation in the configuration). When <parameter>enable</parameter> is
85 FcFalse, then all use of the home directory in these contexts will be
86 disabled. The previous setting of the value is returned.
90 @FUNC@ FcConfigBuildFonts
91 @TYPE1@ FcConfig * @ARG1@ config
92 @PURPOSE@ Build font database
94 Builds the set of available fonts for the given configuration. Note that
95 any changes to the configuration after this call have indeterminate effects.
96 Returns FcFalse if this operation runs out of memory.
100 @FUNC@ FcConfigGetConfigDirs
101 @TYPE1@ FcConfig * @ARG1@ config
102 @PURPOSE@ Get config directories
104 Returns the list of font directories specified in the configuration files
105 for <parameter>config</parameter>. Does not include any subdirectories.
109 @FUNC@ FcConfigGetFontDirs
110 @TYPE1@ FcConfig * @ARG1@ config
111 @PURPOSE@ Get font directories
113 Returns the list of font directories in <parameter>config</parameter>. This includes the
114 configured font directories along with any directories below those in the
119 @FUNC@ FcConfigGetConfigFiles
120 @TYPE1@ FcConfig * @ARG1@ config
121 @PURPOSE@ Get config files
123 Returns the list of known configuration files used to generate <parameter>config</parameter>.
127 @FUNC@ FcConfigGetCache
128 @TYPE1@ FcConfig * @ARG1@ config
129 @PURPOSE@ DEPRECATED used to return per-user cache filename
131 With fontconfig no longer using per-user cache files, this function now
132 simply returns NULL to indicate that no per-user file exists.
136 @FUNC@ FcConfigGetCacheDirs
137 @TYPE1@ FcConfig * @ARG1@ config
138 @PURPOSE@ return the list of directories searched for cache files
140 <function>FcConfigGetCacheDirs</function> returns a string list containing
141 all of the directories that fontconfig will search when attempting to load a
142 cache file for a font directory.
146 @FUNC@ FcConfigGetFonts
147 @TYPE1@ FcConfig * @ARG1@ config
148 @TYPE2@ FcSetName% @ARG2@ set
149 @PURPOSE@ Get config font set
151 Returns one of the two sets of fonts from the configuration as specified
152 by <parameter>set</parameter>. This font set is owned by the library and must
157 @FUNC@ FcConfigGetBlanks
158 @TYPE1@ FcConfig * @ARG1@ config
159 @PURPOSE@ Get config blanks
161 Returns the FcBlanks object associated with the given configuration, if no
162 blanks were present in the configuration, this function will return 0.
166 @FUNC@ FcConfigGetRescanInterval
167 @TYPE1@ FcConfig * @ARG1@ config
168 @PURPOSE@ Get config rescan interval
170 Returns the interval between automatic checks of the configuration (in
171 seconds) specified in <parameter>config</parameter>. The configuration is checked during
172 a call to FcFontList when this interval has passed since the last check.
176 @FUNC@ FcConfigSetRescanInterval
177 @TYPE1@ FcConfig * @ARG1@ config
178 @TYPE2@ int% @ARG2@ rescanInterval
179 @PURPOSE@ Set config rescan interval
181 Sets the rescan interval. Returns FcFalse if the interval cannot be set (due
182 to allocation failure). Otherwise returns FcTrue.
186 @FUNC@ FcConfigAppFontAddFile
187 @TYPE1@ FcConfig * @ARG1@ config
188 @TYPE2@ const FcChar8 * @ARG2@ file
189 @PURPOSE@ Add font file to font database
191 Adds an application-specific font to the configuration. Returns FcFalse
192 if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
196 @FUNC@ FcConfigAppFontAddDir
197 @TYPE1@ FcConfig * @ARG1@ config
198 @TYPE2@ const FcChar8 * @ARG2@ dir
199 @PURPOSE@ Add fonts from directory to font database
201 Scans the specified directory for fonts, adding each one found to the
202 application-specific set of fonts. Returns FcFalse
203 if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
207 @FUNC@ FcConfigAppFontClear
208 @TYPE1@ FcConfig * @ARG1@ config
209 @PURPOSE@ Remove all app fonts from font database
211 Clears the set of application-specific fonts.
215 @FUNC@ FcConfigSubstituteWithPat
216 @TYPE1@ FcConfig * @ARG1@ config
217 @TYPE2@ FcPattern * @ARG2@ p
218 @TYPE3@ FcPattern * @ARG3@ p_pat
219 @TYPE4@ FcMatchKind% @ARG4@ kind
220 @PURPOSE@ Execute substitutions
222 Performs the sequence of pattern modification operations, if <parameter>kind</parameter> is
223 FcMatchPattern, then those tagged as pattern operations are applied, else
224 if <parameter>kind</parameter> is FcMatchFont, those tagged as font operations are applied and
225 p_pat is used for <test> elements with target=pattern. Returns FcFalse
226 if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
230 @FUNC@ FcConfigSubstitute
231 @TYPE1@ FcConfig * @ARG1@ config
232 @TYPE2@ FcPattern * @ARG2@ p
233 @TYPE3@ FcMatchKind% @ARG3@ kind
234 @PURPOSE@ Execute substitutions
236 Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns FcFalse
237 if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
242 @TYPE1@ FcConfig * @ARG1@ config
243 @TYPE2@ FcPattern * @ARG2@ p
244 @TYPE3@ FcResult * @ARG3@ result
245 @PURPOSE@ Return best font
247 Finds the font in <parameter>sets</parameter> most closely matching
248 <parameter>pattern</parameter> and returns the result of
249 <function>FcFontRenderPrepare</function> for that font and the provided
250 pattern. This function should be called only after
251 <function>FcConfigSubstitute</function> and
252 <function>FcDefaultSubstitute</function> have been called for
253 <parameter>p</parameter>; otherwise the results will not be correct.
258 @TYPE1@ FcConfig * @ARG1@ config
259 @TYPE2@ FcPattern * @ARG2@ p
260 @TYPE3@ FcBool% @ARG3@ trim
261 @TYPE4@ FcCharSet ** @ARG4@ csp
262 @TYPE5@ FcResult * @ARG5@ result
263 @PURPOSE@ Return list of matching fonts
265 Returns the list of fonts sorted by closeness to <parameter>p</parameter>. If <parameter>trim</parameter> is FcTrue,
266 elements in the list which don't include Unicode coverage not provided by
267 earlier elements in the list are elided. The union of Unicode coverage of
268 all of the fonts is returned in <parameter>csp</parameter>, if <parameter>csp</parameter> is not NULL. This function
269 should be called only after FcConfigSubstitute and FcDefaultSubstitute have
270 been called for <parameter>p</parameter>; otherwise the results will not be correct.
272 The returned FcFontSet references FcPattern structures which may be shared
273 by the return value from multiple FcFontSort calls, applications must not
274 modify these patterns. Instead, they should be passed, along with <parameter>p</parameter> to
275 <function>FcFontRenderPrepare</function> which combines them into a complete pattern.
277 The FcFontSet returned by FcFontSort is destroyed by caling FcFontSetDestroy.
281 @FUNC@ FcFontRenderPrepare
282 @TYPE1@ FcConfig * @ARG1@ config
283 @TYPE2@ FcPattern * @ARG2@ pat
284 @TYPE3@ FcPattern * @ARG3@ font
285 @PURPOSE@ Prepare pattern for loading font file
287 Creates a new pattern consisting of elements of <parameter>font</parameter> not appearing
288 in <parameter>pat</parameter>, elements of <parameter>pat</parameter> not appearing in <parameter>font</parameter> and the best matching
289 value from <parameter>pat</parameter> for elements appearing in both. The result is passed to
290 FcConfigSubstitute with <parameter>kind</parameter> FcMatchFont and then returned.
295 @TYPE1@ FcConfig * @ARG1@ config
296 @TYPE2@ FcPattern * @ARG2@ p
297 @TYPE3@ FcObjectSet * @ARG3@ os
300 Selects fonts matching <parameter>p</parameter>, creates patterns from those fonts containing
301 only the objects in <parameter>os</parameter> and returns the set of unique such patterns.
305 @FUNC@ FcConfigFilename
306 @TYPE1@ const FcChar8 * @ARG1@ name
307 @PURPOSE@ Find a config file
309 Given the specified external entity name, return the associated filename.
310 This provides applications a way to convert various configuration file
311 references into filename form.
313 A null or empty <parameter>name</parameter> indicates that the default configuration file should
314 be used; which file this references can be overridden with the
315 FC_CONFIG_FILE environment variable. Next, if the name starts with <parameter>~</parameter>, it
316 refers to a file in the current users home directory. Otherwise if the name
317 doesn't start with '/', it refers to a file in the default configuration
318 directory; the built-in default directory can be overridden with the
319 FC_CONFIG_DIR environment variable.
323 @FUNC@ FcConfigParseAndLoad
324 @TYPE1@ FcConfig * @ARG1@ config
325 @TYPE2@ const FcChar8 * @ARG2@ file
326 @TYPE3@ FcBool% @ARG3@ complain
327 @PURPOSE@ load a configuration file
329 Walks the configuration in 'file' and constructs the internal representation
330 in 'config'. Any include files referenced from within 'file' will be loaded
331 and parsed. If 'complain' is FcFalse, no warning will be displayed if
332 'file' does not exist. Error and warning messages will be output to stderr.
333 Returns FcFalse if some error occurred while loading the file, either a
334 parse error, semantic error or allocation failure. Otherwise returns FcTrue.