[Image-SIG] TrueType and Type 1 fonts with PIL

Kevin Cazabon KCAZA@cymbolic.com
Thu, 30 Mar 2000 08:45:33 -0800


This is an ideal solution... although it doesn=27t yet work for me (I=27m =
using Windows,
and it doesn=27t yet build on Windows)...

Thanks for the patch, I hope I can use it soon=21  It=27ll save a LOT of =
storage space,
as large PIL fonts take a lot of room, and you need to pre-compile them at =
all the
sizes you want to use.

Kevin.

>>> Joerg Baumann <Joerg.Baumann=40stud.informatik.uni-erlangen.de> =
03/25/00 05:03PM
>>>
After the short discussion about fonts and PIL, I wrote a small patch
(attached to this mail) for Imaging-1.0.

This patch uses the FreeType2 Beta library from www.freetype.org to
enable ImageFont to use TrueType and Type 1 (and other) font-files.

The FreeType2 Beta library does not run on all systems yet, but
the development of FreeType1 is stopped, and I didn=B4t want to use a soon
obsolete library. (It should run fine on most unix-boxes with gcc)

In _imaging.c  WITH_IMAGEFREETYPEFONT must be defined,
and in Setup.in the location of the freetype-library must be adjusted.

Old pil-font are loaded as it used to be:
f=3DImageFont.load(=22courR14.pil=22)
The new syntax to load fonts with freetype is:
f=3DImageFont.load(=22verdana.ttf=22,0,30)

the new options are face_index and size.
Some of the now supported fontfiles support more than one face, you
can select one with face_index (should be 0 in most cases)
Size is the height of the font in pixels.

This runs fine for me (linux 2.2.10, glibc 2.1)

please try it, and if you find a bug, contact me.

Regards,
   joerg

  Joerg Baumann       joerg.baumann=40stud.informatik.uni-erlangen.de=20
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ =20
  Beware of bugs in the above code; I have only proved it correct,=20
  not tried it.
                  Don Knuth=20
=20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                                           =
         =20
                                                      =20