Technology Tips and Tricks – The Mansurovs
22Oct/033

Russian GD 1.8.4 Guide

This guide is for those people, who would like to print Cyrillic letters in GD. Since native GD fonts do not support Cyrillic characters, the only way to print out Cyrillic on GD is to use TrueType fonts. If you are using GD very often, using TTF is not the best and speedy solution. TrueType fonts do require more memory, time and CPU usage for producing an image in GD, whereas native GD fonts take up a lot less memory and time, because they are already compiled into GD.


Russian GD 1.8.4 Guide
or
Support for Cyrillic letters in GD 1.8.4

1) Who should use this guide?
Those of you who are really worried about productivity and speed in producing images with Cyrillic letters using Boutell's GD.

2) On what operating systems has this guide been tested on?
This guide should work on all flavors of Linux, FreeBSD and OpenBSD systems. If you make it work on any other platform, please let me know :-)

3) Stuff we'll be needing (sources)
Latest versions of GD do not have gif image support. This happened because of some patent and copyright issues. Officially, Boutell.com is not allowed to add gif image support to its versions of GD, but there have been some brave developers out there who patch the released versions of GD to add internal gif support. In this guide, I provide links to both official and patched releases of GD. If you are really worried about copyright laws, please do not use the patched gif version for your own good. Otherwise, download the patched version and cross your fingers :-)

Create a "GD" folder in /usr/local/src and download the following sources to the directory /usr/local/src/GD:

Official GD:
- Official GD v1.8.4 sources from Boutell.com
- Perl GD Module v1.33 sources from Lincoln Stein

Patched GD:
- Patched GD v1.8.4 sources with Gif support from Albatross Consulting
- Patched Perl GD Module v1.30 sources from Albatross Consulting

Other Files:
- JPEG v6b sources from Independent JPEG Group
- TIFF v3.5.7 sources from Libtiff.org
- LibPNG v1.2.5 from Libpng.org
- zlib v1.1.4 from Gzip.org
- Freetype v1.3.1 from The FreeType Project
- Russian GD Patch from this site

4) Installing LibPNG and Zlib
We first start with LibPNG and Zlib, because the installation is a little tricky.

cd /usr/local/src/GD
tar zxf libpng-1.2.5.tar.gz
mv libpng-1.2.5 libpng
tar zxf zlib-1.1.4.tar.gz
mv zlib-1.1.4 zlib
cd zlib
./configure --shared --prefix=/usr
make
make test
make install
cd ../libpng
cp scripts/makefile.linux makefile

Before running make and make install for LibPNG, edit the makefile and change the line prefix=/usr/local to prefix=/usr

The reason why we changed the prefix (path) is because I personally prefer main libraries to be in /usr instead of /usr/local. You may change the efault installation path to /usr/local if you want to.

Now execute the following commands:

make
make test
make install

LibPNG is now installed.

5) Installing TIFF and JPEG

cd /usr/local/src/GD
tar zxf tiff-v3.5.7.tar.gz
tar zxf jpegsrc.v6b.tar.gz
cd tiff-v3.5.7
./configure --prefix=/usr
make
make install
cd ../jpeg-6b
./configure --prefix=/usr --enable-shared --enable-static
make
make test
make install

This should take care of the installation.

6) Installing FreeType
Installing FreeType is very easy as well. Just execute the following commands:

cd /usr/local/src/GD
tar zxf freetype-1.3.1.tar.gz
cd freetype-1.3.1
./configure --prefix=/usr --enable-shared --enable-static
make
make install

8) Configuring, patching and installing GD
Now we are going through the most important part - installation of GD. If you've downloaded an official GD source, then change the filename to gd-1.8.4.tar.gz while untarring the sources.

cd /usr/local/src/GD
tar zxf gd-1.8.4amgif.tar.gz
mv russian_1.8.4.patch gd-1.8.4
cd gd-1.8.4
patch < russian_1.8.4.patch

Then, we run configure, make and make install (if you don't have X-Windows installed, remove the --with-x switch).

./configure --prefix=/usr --enable-jpeg --enable-freetype --enable-xpm --x-includes=/usr/include/freetype --with-x
make
make install

If you get any errors during the configure call, check out the output and see where it stops. In most cases configure should run without a problem. In case you get an error with make, look at the last couple of lines, you should be able to find out what's wrong.

9) Installing Perl GD Module
Now we have GD installed and fully operational. What's next? Let's install GD.pm - a perl module written by Lincoln Stein. Again, change the filename to GD-1.33.tar.gz if you've downloaded an official Perl GD module.

cd /usr/local/src/GD
tar zxf GD-1.30gif.tar.gz
cd GD-1.30
perl Makefile.PL
make
make test
make install

After you type perl Makefile.PL, the configure script will ask you a couple of questions. Answer "Y" to all of them and everything should go smoothly. Execution of "make test" might give you some errors. Don't worry if you get 1-3 errors - I investigated the problem and seems like the errors occur because of the patched libraries. If you get more than 3 errors, something went wrong. Try to go over this guide once again and see if you've missed something.

You are done! :)

Nasim Mansurov is a professional photographer based out of Denver, Colorado. He is the author and founder of The Mansurovs, along with a number of other online resources. Read more about Nasim here.
Tagged as: ,
Posted in: Linux-Unix
Leave a comment
7 Views
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Diigo
  • email
  • LinkedIn
  • Live
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Related posts:

  1. Russian GD 2.0.33 Guide
  2. GCC 2.95.3 Guide
  3. Apache, PHP, GD & Mod_Perl Guide
  4. ProcMail Installation and Configuration Guide
  5. Guide updates
Comments (3) Trackbacks (0)

Leave a comment


Trackbacks are disabled.