[Fontconfig] RE: Specifying location of fontfiles in fonts.conf file.

Patrick Lam plam at MIT.EDU
Tue Apr 11 21:46:40 PDT 2006


Rupa Kamoji wrote:
> Hello,
> 
> Thanks for your reply. I need to ship the fontconfig library, fonts.conf
> file and font files with my application. I want to avoid the requirement
> of modification to any of the files by the recipient of my application.
> He sets an environment variable and uses this env variable to run my
> application. So I want to mention the location of font files in
> fonts.conf file using this env variable. So this way he will not have to
> do anything but at that same time he will be able to use fontcong for
> all text display in my application.
> 
> Please help me in using this env variable in fonts.conf file to specify
> the location of font files.

The code does not presently support the use of arbitrary environment 
variables and I'm not sure if there might be any security implications 
from doing so.

However, if you want your shipped copy of fontconfig to use an 
environment variable, then you can write a quick and dirty hack to, for 
instance, FcConfigAddDir.  Add something like the following lines:

	if (strcmp(d, "$CUSTOM_FONT_DIR") == 0)
		d = (FcChar8 *) getenv ("CUSTOM_FONT_DIR");

I think that'll work for your case.

pat



More information about the Fontconfig mailing list