Document when config can be NULL (#17105)

Note that this also fixes a bug with FcFontList() where previously
it was NOT checking whether the config is up-to-date.  May want to
keep the old behavior and document that ScanInterval is essentially
unused internally (FcFontSetList uses it, but we can remove that
too).
This commit is contained in:
Behdad Esfahbod 2008-08-22 17:49:02 -04:00
parent 1439c8f21a
commit 03dcaaa08f
3 changed files with 27 additions and 0 deletions

View File

@ -63,6 +63,7 @@ Returns the current default configuration.
@DESC@ @DESC@
Checks all of the files related to <parameter>config</parameter> and returns Checks all of the files related to <parameter>config</parameter> and returns
whether any of them has been modified since the configuration was created. whether any of them has been modified since the configuration was created.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcChar8 * @RET@ FcChar8 *
@ -95,6 +96,7 @@ disabled. The previous setting of the value is returned.
Builds the set of available fonts for the given configuration. Note that Builds the set of available fonts for the given configuration. Note that
any changes to the configuration after this call have indeterminate effects. any changes to the configuration after this call have indeterminate effects.
Returns FcFalse if this operation runs out of memory. Returns FcFalse if this operation runs out of memory.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcStrList * @RET@ FcStrList *
@ -104,6 +106,7 @@ Returns FcFalse if this operation runs out of memory.
@DESC@ @DESC@
Returns the list of font directories specified in the configuration files Returns the list of font directories specified in the configuration files
for <parameter>config</parameter>. Does not include any subdirectories. for <parameter>config</parameter>. Does not include any subdirectories.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcStrList * @RET@ FcStrList *
@ -114,6 +117,7 @@ for <parameter>config</parameter>. Does not include any subdirectories.
Returns the list of font directories in <parameter>config</parameter>. This includes the Returns the list of font directories in <parameter>config</parameter>. This includes the
configured font directories along with any directories below those in the configured font directories along with any directories below those in the
filesystem. filesystem.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcStrList * @RET@ FcStrList *
@ -122,6 +126,7 @@ filesystem.
@PURPOSE@ Get config files @PURPOSE@ Get config files
@DESC@ @DESC@
Returns the list of known configuration files used to generate <parameter>config</parameter>. Returns the list of known configuration files used to generate <parameter>config</parameter>.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcChar8 * @RET@ FcChar8 *
@ -141,6 +146,7 @@ simply returns NULL to indicate that no per-user file exists.
<function>FcConfigGetCacheDirs</function> returns a string list containing <function>FcConfigGetCacheDirs</function> returns a string list containing
all of the directories that fontconfig will search when attempting to load a all of the directories that fontconfig will search when attempting to load a
cache file for a font directory. cache file for a font directory.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcFontSet * @RET@ FcFontSet *
@ -152,6 +158,7 @@ cache file for a font directory.
Returns one of the two sets of fonts from the configuration as specified Returns one of the two sets of fonts from the configuration as specified
by <parameter>set</parameter>. This font set is owned by the library and must by <parameter>set</parameter>. This font set is owned by the library and must
not be freed. not be freed.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcBlanks * @RET@ FcBlanks *
@ -161,6 +168,9 @@ not be freed.
@DESC@ @DESC@
Returns the FcBlanks object associated with the given configuration, if no Returns the FcBlanks object associated with the given configuration, if no
blanks were present in the configuration, this function will return 0. blanks were present in the configuration, this function will return 0.
The returned FcBlanks object if not NULL, is valid as long as the owning
FcConfig is alive.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ int @RET@ int
@ -172,6 +182,7 @@ Returns the interval between automatic checks of the configuration (in
seconds) specified in <parameter>config</parameter>. The configuration is checked during seconds) specified in <parameter>config</parameter>. The configuration is checked during
a call to FcFontList when this interval has passed since the last check. a call to FcFontList when this interval has passed since the last check.
An interval setting of zero disables automatic checks. An interval setting of zero disables automatic checks.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcBool @RET@ FcBool
@ -183,6 +194,7 @@ An interval setting of zero disables automatic checks.
Sets the rescan interval. Returns FcFalse if the interval cannot be set (due Sets the rescan interval. Returns FcFalse if the interval cannot be set (due
to allocation failure). Otherwise returns FcTrue. to allocation failure). Otherwise returns FcTrue.
An interval setting of zero disables automatic checks. An interval setting of zero disables automatic checks.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcBool @RET@ FcBool
@ -193,6 +205,7 @@ An interval setting of zero disables automatic checks.
@DESC@ @DESC@
Adds an application-specific font to the configuration. Returns FcFalse Adds an application-specific font to the configuration. Returns FcFalse
if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue. if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcBool @RET@ FcBool
@ -204,6 +217,7 @@ if the fonts cannot be added (due to allocation failure). Otherwise returns FcTr
Scans the specified directory for fonts, adding each one found to the Scans the specified directory for fonts, adding each one found to the
application-specific set of fonts. Returns FcFalse application-specific set of fonts. Returns FcFalse
if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue. if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ void @RET@ void
@ -212,6 +226,7 @@ if the fonts cannot be added (due to allocation failure). Otherwise returns FcTr
@PURPOSE@ Remove all app fonts from font database @PURPOSE@ Remove all app fonts from font database
@DESC@ @DESC@
Clears the set of application-specific fonts. Clears the set of application-specific fonts.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcBool @RET@ FcBool
@ -227,6 +242,7 @@ FcMatchPattern, then those tagged as pattern operations are applied, else
if <parameter>kind</parameter> is FcMatchFont, those tagged as font operations are applied and if <parameter>kind</parameter> is FcMatchFont, those tagged as font operations are applied and
p_pat is used for &lt;test&gt; elements with target=pattern. Returns FcFalse 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. if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcBool @RET@ FcBool
@ -238,6 +254,7 @@ if the substitution cannot be performed (due to allocation failure). Otherwise r
@DESC@ @DESC@
Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns FcFalse Calls FcConfigSubstituteWithPat setting p_pat to NULL. Returns FcFalse
if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue. if the substitution cannot be performed (due to allocation failure). Otherwise returns FcTrue.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcPattern * @RET@ FcPattern *
@ -254,6 +271,7 @@ pattern. This function should be called only after
<function>FcConfigSubstitute</function> and <function>FcConfigSubstitute</function> and
<function>FcDefaultSubstitute</function> have been called for <function>FcDefaultSubstitute</function> have been called for
<parameter>p</parameter>; otherwise the results will not be correct. <parameter>p</parameter>; otherwise the results will not be correct.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcFontSet * @RET@ FcFontSet *
@ -278,6 +296,7 @@ modify these patterns. Instead, they should be passed, along with <parameter>p<
<function>FcFontRenderPrepare</function> which combines them into a complete pattern. <function>FcFontRenderPrepare</function> which combines them into a complete pattern.
</para><para> </para><para>
The FcFontSet returned by FcFontSort is destroyed by caling FcFontSetDestroy. The FcFontSet returned by FcFontSort is destroyed by caling FcFontSetDestroy.
If <parameter>config</parameter> is NULL, the current configuration is used.
@@ @@
@RET@ FcPattern * @RET@ FcPattern *
@ -302,6 +321,8 @@ FcConfigSubstituteWithPat with <parameter>kind</parameter> FcMatchFont and then
@DESC@ @DESC@
Selects fonts matching <parameter>p</parameter>, creates patterns from those fonts containing 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. only the objects in <parameter>os</parameter> and returns the set of unique such patterns.
If <parameter>config</parameter> is NULL, the default configuration is checked
to be up to date, and used.
@@ @@
@RET@ FcChar8 * @RET@ FcChar8 *

View File

@ -62,6 +62,8 @@ Selects fonts matching <parameter>pattern</parameter> from
<parameter>sets</parameter>, creates patterns from those <parameter>sets</parameter>, creates patterns from those
fonts containing only the objects in <parameter>object_set</parameter> and returns fonts containing only the objects in <parameter>object_set</parameter> and returns
the set of unique such patterns. the set of unique such patterns.
If <parameter>config</parameter> is NULL, the default configuration is checked
to be up to date, and used.
@@ @@
@RET@ FcPattern * @RET@ FcPattern *
@ -80,6 +82,7 @@ pattern. This function should be called only after
<function>FcConfigSubstitute</function> and <function>FcConfigSubstitute</function> and
<function>FcDefaultSubstitute</function> have been called for <function>FcDefaultSubstitute</function> have been called for
<parameter>pattern</parameter>; otherwise the results will not be correct. <parameter>pattern</parameter>; otherwise the results will not be correct.
If <parameter>config</parameter> is NULL, the current configuration is used.
Returns NULL if an error occurs during this process. Returns NULL if an error occurs during this process.
@@ @@

View File

@ -555,6 +555,9 @@ FcFontList (FcConfig *config,
if (!config) if (!config)
{ {
if (!FcInitBringUptoDate ())
return 0;
config = FcConfigGetCurrent (); config = FcConfigGetCurrent ();
if (!config) if (!config)
return 0; return 0;