[mapserver-users] How I got PHP + GD + Freetype + MapScript to work with proper text label angle
Peter Rukavina
peter at rukavina.net
Sat Nov 16 19:46:08 PST 2002
Several users have reported problems with text label angle after using
MapServer 3.6 + GD-2 + FreeType2. I had the same problem: text labels
would appear on the map, but at either (a) a seemingly weird angle to
the line their were labeling and/or (b) each individual letter in the
text labels rotated at a weird angle.
Advice on this mailing list was to backstep to GD-1.8.4.
I experimented with various combinations of all of the above, and found
the following worked for me:
1. RedHat 7.2 with 2.4.7 kernel
2. PHP 4.2.3
3. GD 1.8.4
3. Freetype-pre1.4
When I compiled the Freetype and GD libraries, I modified the base
installation directory to /usr/local/src/mapserver-dev to ensure that
conflicting versions of either weren't being picked up by mistake.
Here's how I got things working:
1. GD 1.8.4
Important lines in the Makefile are:
CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBTTF
LIBS=-lgd -lpng -lz -lm -lttf -ljpeg
INCLUDEDIRS=-I. -I/usr/local/src/mapserver-dev/include/freetype
-I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include
LIBDIRS=-L. -L/usr/local/src/mapserver-dev -L/usr/local/lib
-L/usr/lib/X11 -L/usr/X11R6/lib
INSTALL_LIB=/usr/local/src/mapserver-dev/lib
INSTALL_INCLUDE=/usr/local/src/mapserver-dev/include
INSTALL_BIN=/usr/local/bin
2. Freetype-pre1.4
I couldn't get freetype-1.3.1 to compile for me, as it appears that the
--without-x switch is broken (confirmed by others) so that if you don't
have the proper X setup available it won't compile. I downloaded the
pre-1.4 version from the Freetype "unstable" FTP area.
Configured with:
./configure --prefix=/usr/local/src/mapserver-dev
3. PHP 4.2.3
Configured with:
./configure --with-sybase-ct=/opt/sybase --enable-track-vars
--with-mysql=no --with-system-regex
--with-gd=/usr/local/src/mapserver-dev --with-zlib
--with-jpeg-dir=/usr --with-png-dir=/usr --without-ttf
Note that the "--without-ttf" seems important, and perhaps
counter-intuitively so.
4. Mapserver 3.6
Configured with:
./configure --prefix=/usr/local/src/mapserver-dev
-with-gd=static,/usr/local/src/mapserver-dev
--with-freetype=/usr/local/src/mapserver-dev --enable-force-freetype1
--enable-runpath --with-php=../php-4.2.3
Once I did all of the above, the resulting was a PHP executable and a
MapServer PHP module that, together, produce fine, well-angled labels.
Peter Rukavina
Charlottetown, Prince Edward Island
More information about the MapServer-users
mailing list