[Image-SIG] Re: missing fonts

Fredrik Lundh fredrik@pythonware.com
Tue, 29 Apr 2003 13:00:12 +0200

"VAN DER HEIJDEN Maarten" <mvanderheijden@fininfo.fr> wrote:

> I tried to write text with ImageDraw.  But it seems that the
> following file is missing:
> "BDF/courR14.pil".
> Somebody knows how to use fonts in PIL? For exemple fonts
> already available under windows.

PIL's source distribution contains a single sample font, but most
binary distributions don't seem to include even that one.

you can get a small collection of bitmap fonts from

    http://effbot.org/download (look for pilfonts)

to use a bitmap font, load it using ImageFont.load:

    font = ImageFont.load("courR14.pil")

to use a truetype font (requires PIL 1.1.4), load it
using the ImageFont.truetype function:

    font = ImageFont.truetype("arial.ttf")

    draw.text(xy, text, font=font)