fcconfig.fncs 18.1 KB
Newer Older
1
/*
Behdad Esfahbod's avatar
Behdad Esfahbod committed
2
 * fontconfig/doc/fcconfig.fncs
3
 *
4
 * Copyright © 2003 Keith Packard
5 6 7 8 9
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
10
 * documentation, and that the name of the author(s) not be used in
11
 * advertising or publicity pertaining to distribution of the software without
12
 * specific, written prior permission.  The authors make no
13 14 15
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.
 *
16
 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 20 21 22 23
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */
24
@RET@           FcConfig *
25 26 27 28 29 30 31
@FUNC@          FcConfigCreate
@TYPE1@		void
@PURPOSE@	Create a configuration
@DESC@
Creates an empty configuration.
@@

32 33 34 35 36 37 38 39 40 41 42 43 44
@RET@           FcConfig *
@FUNC@          FcConfigReference
@TYPE1@         FcConfig *                      @ARG1@          config
@PURPOSE@	Increment config reference count
@DESC@
Add another reference to <parameter>config</parameter>. Configs are freed only
when the reference count reaches zero.
If <parameter>config</parameter> is NULL, the current configuration is used.
In that case this function will be similar to FcConfigGetCurrent() except that
it increments the reference count before returning and the user is responsible
for destroying the configuration when not needed anymore.
@@

45 46 47
@RET@           void
@FUNC@          FcConfigDestroy
@TYPE1@         FcConfig *                      @ARG1@          config
48 49
@PURPOSE@	Destroy a configuration
@DESC@
50 51 52 53
Decrements the config reference count. If all references are gone, destroys
the configuration and any data associated with it.
Note that calling this function with the return from FcConfigGetCurrent will
cause a new configuration to be created for use as current configuration.
54 55
@@

56 57 58
@RET@           FcBool
@FUNC@          FcConfigSetCurrent
@TYPE1@         FcConfig *                      @ARG1@          config
59 60
@PURPOSE@	Set configuration as default
@DESC@
61
Sets the current default configuration to <parameter>config</parameter>.  Implicitly calls
62 63
FcConfigBuildFonts if necessary, and FcConfigReference() to inrease the reference count
in <parameter>config</parameter> since 2.12.0, returning FcFalse if that call fails.
64 65
@@

66
@RET@           FcConfig *
67 68 69 70 71 72 73
@FUNC@          FcConfigGetCurrent
@TYPE1@		void
@PURPOSE@	Return current configuration
@DESC@
Returns the current default configuration.
@@

74 75 76
@RET@           FcBool
@FUNC@          FcConfigUptoDate
@TYPE1@         FcConfig *                      @ARG1@          config
77 78
@PURPOSE@	Check timestamps on config files
@DESC@
79 80
Checks all of the files related to <parameter>config</parameter> and returns
whether any of them has been modified since the configuration was created.
81
If <parameter>config</parameter> is NULL, the current configuration is used.
82 83
@@

84
@RET@		FcChar8 *
85 86 87 88 89
@FUNC@		FcConfigHome
@TYPE1@		void
@PURPOSE@	return the current home directory.
@DESC@
Return the current user's home directory, if it is available, and if using it
90 91
is enabled, and NULL otherwise.
See also <function>FcConfigEnableHome</function>).
92 93
@@

Behdad Esfahbod's avatar
Behdad Esfahbod committed
94
@RET@		FcBool
95 96 97 98 99 100 101 102 103 104 105
@FUNC@		FcConfigEnableHome
@TYPE1@		FcBool%				@ARG1@		enable
@PURPOSE@	controls use of the home directory.
@DESC@
If <parameter>enable</parameter> is FcTrue, then Fontconfig will use various
files which are specified relative to the user's home directory (using the ~
notation in the configuration). When <parameter>enable</parameter> is
FcFalse, then all use of the home directory in these contexts will be
disabled. The previous setting of the value is returned.
@@

106 107 108
@RET@           FcBool
@FUNC@          FcConfigBuildFonts
@TYPE1@         FcConfig *                      @ARG1@          config
109 110 111 112 113
@PURPOSE@	Build font database
@DESC@
Builds the set of available fonts for the given configuration.  Note that
any changes to the configuration after this call have indeterminate effects.
Returns FcFalse if this operation runs out of memory.
114
If <parameter>config</parameter> is NULL, the current configuration is used.
115 116
@@

117 118 119
@RET@           FcStrList *
@FUNC@          FcConfigGetConfigDirs
@TYPE1@         FcConfig *                      @ARG1@          config
120 121 122
@PURPOSE@	Get config directories
@DESC@
Returns the list of font directories specified in the configuration files
123
for <parameter>config</parameter>.  Does not include any subdirectories.
124
If <parameter>config</parameter> is NULL, the current configuration is used.
125 126
@@

127 128 129
@RET@           FcStrList *
@FUNC@          FcConfigGetFontDirs
@TYPE1@         FcConfig *                      @ARG1@          config
130 131
@PURPOSE@	Get font directories
@DESC@
132
Returns the list of font directories in <parameter>config</parameter>. This includes the
133 134
configured font directories along with any directories below those in the
filesystem.
135
If <parameter>config</parameter> is NULL, the current configuration is used.
136 137
@@

138 139 140
@RET@           FcStrList *
@FUNC@          FcConfigGetConfigFiles
@TYPE1@         FcConfig *                      @ARG1@          config
141 142
@PURPOSE@	Get config files
@DESC@
143
Returns the list of known configuration files used to generate <parameter>config</parameter>.
144
If <parameter>config</parameter> is NULL, the current configuration is used.
145 146
@@

147
@RET@           FcChar8 *
148 149
@FUNC@          FcConfigGetCache
@TYPE1@         FcConfig *                      @ARG1@          config
150
@PURPOSE@	DEPRECATED used to return per-user cache filename
151
@DESC@
152 153
With fontconfig no longer using per-user cache files, this function now
simply returns NULL to indicate that no per-user file exists.
154 155
@@

156 157
@RET@		FcStrList *
@FUNC@		FcConfigGetCacheDirs
158
@TYPE1@		const FcConfig *		@ARG1@		config
159 160 161 162 163
@PURPOSE@	return the list of directories searched for cache files
@DESC@
<function>FcConfigGetCacheDirs</function> returns a string list containing
all of the directories that fontconfig will search when attempting to load a
cache file for a font directory.
164
If <parameter>config</parameter> is NULL, the current configuration is used.
165 166
@@

167 168
@RET@           FcFontSet *
@FUNC@          FcConfigGetFonts
169
@TYPE1@         FcConfig *			@ARG1@		config
170
@TYPE2@		FcSetName%                      @ARG2@          set
171 172
@PURPOSE@	Get config font set
@DESC@
173
Returns one of the two sets of fonts from the configuration as specified
174
by <parameter>set</parameter>. This font set is owned by the library and must
175
not be modified or freed.
176
If <parameter>config</parameter> is NULL, the current configuration is used.
177 178
@@

179 180 181
@RET@           FcBlanks *
@FUNC@          FcConfigGetBlanks
@TYPE1@         FcConfig *                      @ARG1@          config
182 183
@PURPOSE@	Get config blanks
@DESC@
184 185
FcBlanks is deprecated.
This function always returns NULL.
186 187
@@

188
@RET@           int
189
@FUNC@          FcConfigGetRescanInterval
190
@TYPE1@         FcConfig *                      @ARG1@          config
191 192 193
@PURPOSE@	Get config rescan interval
@DESC@
Returns the interval between automatic checks of the configuration (in
194
seconds) specified in <parameter>config</parameter>.  The configuration is checked during
195
a call to FcFontList when this interval has passed since the last check.
196
An interval setting of zero disables automatic checks.
197
If <parameter>config</parameter> is NULL, the current configuration is used.
198 199
@@

200
@RET@           FcBool
201
@FUNC@          FcConfigSetRescanInterval
202
@TYPE1@         FcConfig *			@ARG1@		config
203
@TYPE2@		int%                       	@ARG2@          rescanInterval
204 205
@PURPOSE@	Set config rescan interval
@DESC@
206 207
Sets the rescan interval. Returns FcFalse if the interval cannot be set (due
to allocation failure). Otherwise returns FcTrue.
208
An interval setting of zero disables automatic checks.
209
If <parameter>config</parameter> is NULL, the current configuration is used.
210 211
@@

212 213
@RET@           FcBool
@FUNC@          FcConfigAppFontAddFile
214
@TYPE1@         FcConfig *			@ARG1@		config
215
@TYPE2@		const FcChar8 *			@ARG2@          file
216 217
@PURPOSE@	Add font file to font database
@DESC@
218
Adds an application-specific font to the configuration. Returns FcFalse
Akira TAGOH's avatar
Akira TAGOH committed
219 220 221
if the fonts cannot be added (due to allocation failure or no fonts found).
Otherwise returns FcTrue. If <parameter>config</parameter> is NULL,
the current configuration is used.
222 223
@@

224 225
@RET@           FcBool
@FUNC@          FcConfigAppFontAddDir
226
@TYPE1@         FcConfig *			@ARG1@		config
227
@TYPE2@		const FcChar8 *			@ARG2@          dir
228 229 230
@PURPOSE@	Add fonts from directory to font database
@DESC@
Scans the specified directory for fonts, adding each one found to the
231
application-specific set of fonts. Returns FcFalse
232
if the fonts cannot be added (due to allocation failure).
Akira TAGOH's avatar
Akira TAGOH committed
233 234
Otherwise returns FcTrue. If <parameter>config</parameter> is NULL,
the current configuration is used.
235 236
@@

237 238 239
@RET@           void
@FUNC@          FcConfigAppFontClear
@TYPE1@         FcConfig *                      @ARG1@          config
240 241 242
@PURPOSE@	Remove all app fonts from font database
@DESC@
Clears the set of application-specific fonts.
243
If <parameter>config</parameter> is NULL, the current configuration is used.
244 245
@@

246 247
@RET@           FcBool
@FUNC@          FcConfigSubstituteWithPat
248 249 250
@TYPE1@         FcConfig *			@ARG1@		config
@TYPE2@		FcPattern *			@ARG2@		p
@TYPE3@		FcPattern *			@ARG3@		p_pat
251
@TYPE4@		FcMatchKind%                     @ARG4@          kind
252 253
@PURPOSE@	Execute substitutions
@DESC@
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 258
p_pat is used for &lt;test&gt; elements with target=pattern. Returns FcFalse
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.
260 261
@@

262 263
@RET@           FcBool
@FUNC@          FcConfigSubstitute
264 265
@TYPE1@         FcConfig *			@ARG1@		config
@TYPE2@		FcPattern *			@ARG2@		p
266
@TYPE3@		FcMatchKind%                    @ARG3@          kind
267 268
@PURPOSE@	Execute substitutions
@DESC@
269 270
Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns FcFalse
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.
272 273
@@

274 275
@RET@           FcPattern *
@FUNC@          FcFontMatch
276 277
@TYPE1@         FcConfig *			@ARG1@		config
@TYPE2@		FcPattern *			@ARG2@		p
278
@TYPE3@		FcResult *                      @ARG3@          result
279 280
@PURPOSE@	Return best font
@DESC@
281 282 283 284 285 286 287
Finds the font in <parameter>sets</parameter> most closely matching
<parameter>pattern</parameter> and returns the result of
<function>FcFontRenderPrepare</function> for that font and the provided
pattern. This function should be called only after
<function>FcConfigSubstitute</function> and
<function>FcDefaultSubstitute</function> have been called for
<parameter>p</parameter>; otherwise the results will not be correct.
288
If <parameter>config</parameter> is NULL, the current configuration is used.
289 290
@@

291 292
@RET@           FcFontSet *
@FUNC@          FcFontSort
293 294
@TYPE1@         FcConfig *			@ARG1@		config
@TYPE2@		FcPattern *			@ARG2@		p
295
@TYPE3@		FcBool%				@ARG3@		trim
296
@TYPE4@		FcCharSet **			@ARG4@		csp
297
@TYPE5@		FcResult *                      @ARG5@          result
298 299
@PURPOSE@	Return list of matching fonts
@DESC@
300
Returns the list of fonts sorted by closeness to <parameter>p</parameter>.  If <parameter>trim</parameter> is FcTrue,
301 302
elements in the list which don't include Unicode coverage not provided by
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.
306 307 308
    </para><para>
The returned FcFontSet references FcPattern structures which may be shared
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.
311
    </para><para>
Behdad Esfahbod's avatar
Behdad Esfahbod committed
312
The FcFontSet returned by FcFontSort is destroyed by calling FcFontSetDestroy.
313
If <parameter>config</parameter> is NULL, the current configuration is used.
314 315
@@

316 317
@RET@           FcPattern *
@FUNC@          FcFontRenderPrepare
318 319
@TYPE1@         FcConfig *			@ARG1@		config
@TYPE2@		FcPattern *			@ARG2@		pat
320
@TYPE3@		FcPattern *                     @ARG3@          font
321 322
@PURPOSE@	Prepare pattern for loading font file
@DESC@
323 324 325
Creates a new pattern consisting of elements of <parameter>font</parameter> not appearing
in <parameter>pat</parameter>, elements of <parameter>pat</parameter> not appearing in <parameter>font</parameter> and the best matching
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.
327 328
@@

329 330
@RET@           FcFontSet *
@FUNC@          FcFontList
331 332
@TYPE1@         FcConfig *			@ARG1@		config
@TYPE2@		FcPattern *			@ARG2@		p
333
@TYPE3@		FcObjectSet *                   @ARG3@          os
334 335
@PURPOSE@	List fonts
@DESC@
336 337
Selects fonts matching <parameter>p</parameter>, creates patterns from those fonts containing
only the objects in <parameter>os</parameter> and returns the set of unique such patterns.
338 339
If <parameter>config</parameter> is NULL, the default configuration is checked
to be up to date, and used.
340 341
@@

342
@RET@           FcChar8 *
343
@FUNC@          FcConfigFilename
344
@TYPE1@         const FcChar8 *			@ARG1@          name
345 346 347 348
@PURPOSE@	Find a config file
@DESC@
Given the specified external entity name, return the associated filename.
This provides applications a way to convert various configuration file
349
references into filename form.
350
    </para><para>
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
FONTCONFIG_FILE environment variable.  Next, if the name starts with <parameter>~</parameter>, it
354 355 356
refers to a file in the current users home directory.  Otherwise if the name
doesn't start with '/', it refers to a file in the default configuration
directory; the built-in default directory can be overridden with the
357
FONTCONFIG_PATH environment variable.
358
@@
359 360 361 362 363

@RET@		FcBool
@FUNC@		FcConfigParseAndLoad
@TYPE1@		FcConfig *			@ARG1@		config
@TYPE2@		const FcChar8 *			@ARG2@		file
364
@TYPE3@		FcBool%				@ARG3@		complain
365 366 367 368
@PURPOSE@	load a configuration file
@DESC@
Walks the configuration in 'file' and constructs the internal representation
in 'config'.  Any include files referenced from within 'file' will be loaded
369 370 371 372
and parsed.  If 'complain' is FcFalse, no warning will be displayed if
'file' does not exist. Error and warning messages will be output to stderr.
Returns FcFalse if some error occurred while loading the file, either a
parse error, semantic error or allocation failure. Otherwise returns FcTrue.
373
@@
374

375 376 377 378 379 380 381 382 383 384 385 386 387
@RET@		FcBool
@FUNC@		FcConfigParseAndLoadFromMemory
@TYPE1@		FcConfig *			@ARG1@		config
@TYPE2@		const FcChar8 *			@ARG2@		buffer
@TYPE3@		FcBool%				@ARG3@		complain
@PURPOSE@	load a configuration from memory
@DESC@
Walks the configuration in 'memory' and constructs the internal representation
in 'config'.  Any includes files referenced from within 'memory' will be loaded
and dparsed.  If 'complain' is FcFalse, no warning will be displayed if
'file' does not exist. Error and warning messages will be output to stderr.
Returns FcFalse if fsome error occurred while loading the file, either a
parse error, semantic error or allocation failure. Otherwise returns FcTrue.
Akira TAGOH's avatar
Akira TAGOH committed
388
@SINCE@		2.12.5
389 390
@@

391 392 393 394 395
@RET@		const FcChar8 *
@FUNC@		FcConfigGetSysRoot
@TYPE1@		const FcConfig *		@ARG1@		config
@PURPOSE@	Obtain the system root directory
@DESC@
Ben Wagner's avatar
Ben Wagner committed
396 397 398
Obtains the system root directory in 'config' if available. All files
(including file properties in patterns) obtained from this 'config' are
relative to this system root directory.
399
@SINCE@		2.10.92
400 401 402 403 404 405 406 407
@@

@RET@		void
@FUNC@		FcConfigSetSysRoot
@TYPE1@		FcConfig *			@ARG1@		config
@TYPE2@		const FcChar8 *			@ARG2@		sysroot
@PURPOSE@	Set the system root directory
@DESC@
Ben Wagner's avatar
Ben Wagner committed
408 409 410 411 412 413 414
Set 'sysroot' as the system root directory. All file paths used or created with
this 'config' (including file properties in patterns) will be considered or
made relative to this 'sysroot'. This allows a host to generate caches for
targets at build time. This also allows a cache to be re-targeted to a
different base directory if 'FcConfigGetSysRoot' is used to resolve file paths.
When setting this on the current config this causes changing current config
(calls FcConfigSetCurrent()).
415
@SINCE@		2.10.92
416 417
@@

418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
@RET@		void
@FUNC@		FcConfigFileInfoIterInit
@TYPE1@		FcConfig *			@ARG1@		config
@TYPE2@		FcConfigFileInfoIter *		@ARG2@		iter
@PURPOSE@	Initialize the iterator
@DESC@
Initialize 'iter' with the first iterator in the config file information list.
@SINCE@		2.12.91
@@

@RET@		FcBool
@FUNC@		FcConfigFileInfoIterNext
@TYPE1@		FcConfig *			@ARG1@		config
@TYPE2@		FcConfigFileInfoIter *		@ARG2@		iter
@PURPOSE@	Set the iterator to point to the next list
@DESC@
Set 'iter' to point to the next node in the config file information list.
If there is no next node, FcFalse is returned.
@SINCE@		2.12.91
@@

@RET@		FcBool
@FUNC@		FcConfigFileInfoIterGet
@TYPE1@		FcConfig *			@ARG1@		config
@TYPE2@		FcConfigFileInfoIter *		@ARG2@		iter
@TYPE3@		FcChar8 **	     		@ARG3@		name
@TYPE4@		FcChar8 **			@ARG4@		description
@TYPE5@		FcBool *			@ARG5@		enabled
@PURPOSE@	Obtain the configuration file information
@DESC@
Obtain the filename, the description and the flag whether it is enabled or not
for 'iter' where points to current configuration file information.
If the iterator is invalid, FcFalse is returned.
@SINCE@		2.12.91
@@