[Zope] How to load PIL fonts

Chris Fenton chrisf@fagmed.uit.no
Thu, 11 Oct 2001 13:34:05 +0200


    The following snippet bothers me.
    Run from the command line OK, from within Zope :- File not found ???

    In my sitecustomize.py file I have appended the font directory to
pythons path  "C:\\py21\\fonts\\100".
    I did this both for my python2.1 executable and the zope python
executable.
    I checked sys.path it has been appended.
    Yet run the snippet from python the font file is found, but as an
external method it is not ???
    OF COURSE I tried hard coding the path but all I get is ERROR: no
font glyph file found :(


    {
    import Image, ImageDraw, ImageFont
    myfont = ImageFont.load_path("Arial Narrow Bold_18_100.pil")
    white = (255,255,255)
    black = (0,0,0)
    image = Image.new('RGB',(100,36),white)
    draw  = ImageDraw.Draw(image)
    draw.text((0,4),'chris', fill=black, font=myfont)
   }

   What am I missing ???

   Thanks in advance Chris