Problem with GD and Freetype / TTF Configuration

Problem with GD and Freetype / TTF Configuration

by Cormac McClean -
Number of replies: 2
Hi,

I'm having a problem with the configuration of GD with true type fonts on our server. It's not a Moodle problem, but it is having an impact on the survey graphs and my own development work, and I was hoping that someone might have come across this problem and solved it. I've spent the last 3 hours trying to figure it out with help from Google, and while I'm closer to a solution than when I started, I still haven't solved the problem.

The problem is indicated by a blank (all white) graph when viewing the results of a survey. Previously I was getting no image file, but I recompiled PHP with GD and FreeType and now there is an image, but it's blank. I'm having a similar problem with the concept map feature of the brainstorm activity module in development - I can display an image, and place text in it using ImageString, but when I try to use ImageTTFText it doesn't appear. Again, previously it gave an error "undefined function", but it no longer does, I get the image but without the effect of the ImageTTFText function.

The problem is down to the configuration of PHP, GD and FreeType. I'm running RedHat 9, GD 1.8.4-11 (from rpm), freetype 2.1.3-6 (with freetype-devel, also from rpm) and PHP 4.3.3 (installed from source).

My most recent attempt at configuring PHP with GD/FreeType uses:
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-pdflib=/usr/local --with-zlib-dir=/usr/lib --enable-versioning --enable-track-vars=yes --enable-url-includes --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --with-config-file-path=/etc --with-freetype1=/usr/include/freetype1 --with-gd --enable-gd-native-ttf --with-ttf=/usr --with-jpeg-dir=/usr --with-gif-dir=/usr --with-png-dir=/usr

and I've tried variations with freetype2, --enable-force-freetype1.

PHPInfo tells me that GD is installed with FreeType support
GD Support enabled
GD Version bundled (2.0.15 compatible)
FreeType Support enabled
FreeType Linkage with TTF library
GIF Read Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

However, I still can't see the survey images, and the ImageTTFText function doesn't have any effect.

Can anyone shed any light on this, please?

Thanks in advance,
Cormac.
Average of ratings: -
In reply to Cormac McClean

Re: Problem with GD and Freetype / TTF Configuration - Problem Solved

by Cormac McClean -
Hi,

I figured out what my problem was with the GD/FreeType configuration. I had the wrong (too many?) configuration options. It should have been
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-pdflib=/usr/local --with-zlib-dir=/usr/lib --enable-versioning --enable-track-vars=yes --enable-url-includes --enable-sysvshm=yes --enable-sysvsem=yes --enable-ftp --with-config-file-path=/etc --with-gd --with-freetype-dir=/usr/include/freetype2 --with-ttf=/usr/lib --with-jpeg-dir=/usr --with-gif-dir=/usr --with-png-dir=/usr

The key point being the --with-gd --with-freetype-dir=/usr/include/freetype2

I had a combination of --with-ttf and --enable-gd-native-ttf.

Now, why couldn't I have figured that out yesterday instead of staying up until 3am!!

Regards,
Cormac.
In reply to Cormac McClean

Re: Problem with GD and Freetype / TTF Configuration - Problem Solved

by Gunther Dippe -
Never underestimate a good nights sleep smile
Cheers
Günther