Hi,
On Mon, 2 Jan 2006, Han-Wen Nienhuys wrote:
> Johannes Schindelin wrote:
> > I do not have any experience with fontconfig, but this path should be
> > queried, right?
>
> yes. Question is: how.
>
> the easiest is probably to do
>
> locate c059033l.pfb
>
> in configure.
Sorry, if you want to stay portable you better not rely on the presence of
locate.
What I meant with "queried" was: now that we link in that BPOC named
fontconfig, whose purpose is to ease the font configuration, fontconfig
should tell us where the font is, right? Is not a call to
FcConfigGetFontDirs() the correct thing? So, configure should write,
compile and run something like this:
-- snip --
#include <fontconfig.h>
#include <stdio.h>
#include <sys/stat.h>
int main()
{
FcStrList* list = FcConfigGetFontDirs(FcInitLoadConfig());
FcChar8* dir;
static char filename[] = "/c059013l.pfb";
while ((dir = FcStrListNext(list))) {
char buffer[1024];
int len = strlen(dir);
if (len + sizeof(filename) + 1 > sizeof(buffer))
fprintf(stderr, "WARNING: path too long: %s\n",
dir);
else {
struct stat st;
strcpy(buffer, dir);
strcpy(buffer + len, filename);
if (stat(buffer, &st) >= 0) {
printf("%s\n", dir);
return 0;
}
}
}
fprintf(stderr, "Font not found: %s\n", filename + 1);
return 1;
}
-- snap --
If this program succeeds, it prints the (first) directory containing the
desired font. If it fails, the font could not be found.
However, this means that fontconfig must be configured properly, which
most people compiling fontconfig from scratch don't do. And it does not do
it automatically either.
BTW the absence of a program like this in fontconfig just adds to my
frustration with fontconfig.
Ciao,
Dscho
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel