Re: gd and fontconfig
[email protected] (Ethan Merritt) Sat, 20 Mar 2010 09:49:49 -0700
| Newsgroups | php.gd.devel |
|---|---|
| Organization | University of Washington |
| Message-ID | <[email protected]> |
On Saturday 20 March 2010, Tatsuro MATSUOKA wrote:
>
> In the current cygwin, the gd library provide by the cygwin team is linked with the
> fontconfig library. And the windows binaries of gcc-4.4.0 are also prepared
> with the gd library with the fontconfig without deep consideration.
What is the exact version of libgd?
> In the discussions in the threads it was noticed that the gd linked
> with the fontconfig affects the font setting of gd related terminals
> (png, jpeg, and gif).
>
> In this case the font setting is almost the same as the pango related
> terminals (wxt, pdfcairo, pngcairo).
>
> The font setting like
> set term png font "/usr/local/fonts/ttf/arial.ttf"
> is not allowed and one must use set term png font 'arial'
Both are allowed. The 'old' method using the filename of the font
is tried first. If that fails, then the 'new' fontconfig method is
used.
> and fonts used in these terminals have to be set through the forntconfig
> configuration files. In addition GDFONTPATH is not effective.
> The situation is obviously contradicted to the current manual
> concerning to the gd related terminals.
I think it is likely that your gnuplot executable was linked against
a buggy version of libgd. When the fontconfig code was first added
to libgd (2.0.36RC1), there was a bug that prevented using both methods
from the same calling program. That bug was later fixed.
Here is the fix:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- gd-2.0.36RC1/gdft.c 2007-11-27 00:30:34.000000000 -0800
+++ gd-fixed/gdft.c 2009-05-20 20:22:13.000000000 -0700
@@ -1661,7 +1661,7 @@ static char * font_path(char **fontpath,
BGD_DECLARE(int) gdFTUseFontConfig(int flag)
{
#ifdef HAVE_LIBFONTCONFIG
- fontConfigFlag = 1;
+ fontConfigFlag = flag;
return 1;
#else
return 0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> Should next binary distribution be prepared with the gd not linked with
> the fontconfig library ?
It should be linked against a fixed version of libgd.
Unfortunately I don't see a fixed version listed for download on
libgd.org. I am cc'ing libgd maintainer Pierre Joye, who may be
able to update the version on the site.
Pierre: Isn't it about time that a "final" version of 2.0.36
is packaged up? The -RC1 is now more than 2 years old!
Here is the output from gnuplot-4.4.0 built from source and linked
against libgd 2.0.36RC1 + bugfix. I added a pair of debug statement
to gd.trm so that you can see how the font search works
gnuplot>
gnuplot> set term png font '/home/ttfonts/verdana.ttf'
Terminal type set to 'png'
Trying to find font "/home/ttfonts/verdana.ttf" using old mechanism succeeded
Options are 'nocrop font /home/ttfonts/verdana.ttf 12 fontscale 1.0 size 640,480 '
gnuplot> set term png font 'Embargo'
Terminal type set to 'png'
Trying to find font "Embargo" using old mechanism failed
Trying to find font "Embargo" using new mechanism succeeded
Options are 'nocrop font Embargo 12 fontscale 1.0 size 640,480 '
regards,
Ethan