[Zope] How to load PIL fonts

Phil Harris phil.harris@zope.co.uk
Thu, 11 Oct 2001 12:28:25 +0100


At last, someone else to hassle the powers that be (PythonWare).

I've tried this so many times, and *never* got the fonts to load.  It works
fine on *nix, but doesn't work at all on Win32 afaics.

If you do have any luck, please let me know what you did.

tia

Phil

----- Original Message -----
From: "Chris Fenton" <chrisf@fagmed.uit.no>
To: <zope@zope.org>
Sent: Thursday, October 11, 2001 12:34 PM
Subject: [Zope] How to load PIL fonts


>     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
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )