[Fontconfig] how to detect on change of FcConfig?

Keith Packard keithp at keithp.com
Thu May 1 13:50:22 EST 2003


Around 12 o'clock on May 1, Kang Jeong-Hee wrote:

> as a consequence of routine above, Pango or any other higher level
> must rescan the FcConfig to recognize the change of fonts.

Fontconfig exposes the list of files and directories which need to be 
monitored for changes that might affect the configuration:

	FcStrList *
	FcConfigGetFontDirs (FcConfig   *config);

	FcStrList *
	FcConfigGetConfigDirs (FcConfig   *config);

	FcStrList *
	FcConfigGetConfigFiles (FcConfig    *config);

Monitor every file in those lists and you'll know when the configuration 
might need to be reloaded.  You can poll by using:

	FcBool
	FcConfigUptoDate (FcConfig *config);

which returns TRUE if the configuration is not out of date with the disk 
files.  When it returns FALSE, you can call:

	FcBool
	FcInitReinitialize (void)

to reinitialize the library.

Fontconfig automatically does this process whenever FcFontList is called
(but no more often than the rescan interval, which defaults to 30 seconds).

-keith






More information about the Fontconfig mailing list