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

Rupa Kamoji rkamoji at knightsindia.co.in
Tue Apr 11 21:54:30 PDT 2006


Hello,

I am new to fontconfig. I am not aware of source code of fontconfig.
Where should I write this piece of code? 

One more way is to specify the path with environm,ent variable in
fonts.conf file right? On line number 26 in fonts.conf file, there is a
list of directories in which fontconfig is searching for the font files.
I want to write some something like below in fonts.conf file.

<dir>$MYFONTFILES/fontfiles</dir>

Where $MYFONTFILES is an environment variable which has
/mydisk/usr/home/mysettings directory path assigned to it .

Instead of 

<dir>/mydisk/usr/home/mysettings/fontfiles</dir> on line no. 26 in
fonts.conf file.

Thanks a lot for your response.



Thanks and Regards,
Rupa.


-----Original Message-----
From: Patrick Lam [mailto:plam at MIT.EDU] 
Sent: Wednesday, April 12, 2006 10:17 AM
To: Rupa Kamoji
Cc: fontconfig at lists.freedesktop.org
Subject: Re: [Fontconfig] RE: Specifying location of fontfiles in
fonts.conf file.

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