Problem loading true-type font with PIL

Discussion in 'Python' started by Christian Stapfer, Sep 1, 2006.

  1. After switching from Python 2.3 to 2.4 (Enought),
    PIL throws an exception that did not occur formerly
    (under Python 2.3) when executing

    ImageFont.truetype(font, size)

    where font = "C:/Windows/Fonts/comic.TTF".

    Here is the traceback that results:

    Traceback (most recent call last):
    File "Gen\gen.py", line 808, in ?
    mylabeler = labeler.Labeler(szNavigFont, iNavigFontSize)
    File "E:\Homepage\Gen\labeler.py", line 11, in __init__
    self._font = ImageFont.truetype(font, size)
    File "C:\Python24\lib\site-packages\PIL\ImageFont.py", line 202, in
    truetype
    return FreeTypeFont(filename, size, index, encoding)
    File "C:\Python24\lib\site-packages\PIL\ImageFont.py", line 120, in
    __init__
    import _imagingft
    ImportError: No module named _imagingft

    A module seems to be missing: do I have to install something
    in addition to PIL in order to be able to load true-type fonts?

    Could someone (more knowledgeable than myself as regards PIL
    and this true-type font loading business) please point me
    in the right direction?

    Many thanks in advance,
    Christian Stapfer
    Christian Stapfer, Sep 1, 2006
    #1
    1. Advertising

  2. Christian Stapfer" <> wrote in message
    news:e3b9a$44f8597f$54482a8f$...
    > After switching from Python 2.3 to 2.4 (Enought),

    ^^^^^
    I mean: Python Enthought Edition--Python 2.4.3 for Windows,
    sorry for that.

    I see in the documentation for PIL that an additional
    module is needed: but I don't see where I can get
    it from. I'd expected that the Python Enthought Edition
    --Python 2.4.3 for *Windows* would include that module....

    Regards,
    Christian STapfer
    Christian Stapfer, Sep 1, 2006
    #2
    1. Advertising

  3. Re: Problem loading true-type font with PIL - "solved"

    Christian Stapfer wrote:

    > After switching from Python 2.3 to 2.4 (Enought),
    > PIL throws an exception that did not occur formerly
    > (under Python 2.3) when executing
    >
    > ImageFont.truetype(font, size)


    <snip/>

    > A module seems to be missing: do I have to install something
    > in addition to PIL in order to be able to load true-type fonts?


    <snip/>

    Problem "solved" by rudely installing PIL 1.1.5 for Windows and
    Python 2.4 from http://www.pythonware.com/products/pil/
    right on top of my existing "Python Enthought Edition--Python
    2.4.3 for Windows". This might have destroyed the consistency
    of the overall installation, of course. I'm well punished
    for installing Enthought Python 2.4.3: Next time I will again
    install all packages that I need myself, as I did for Python
    2.3, instead of using a prepackaged distribution like Enthought
    Python.

    Regards (and sorry for having bothered you with my silly
    posts about this problem),
    Christian Stapfer
    Christian Stapfer, Sep 2, 2006
    #3
  4. Re: Problem loading true-type font with PIL - "solved"

    Christian Stapfer wrote:

    > Problem "solved" by rudely installing PIL 1.1.5 for Windows and
    > Python 2.4 from http://www.pythonware.com/products/pil/
    > right on top of my existing "Python Enthought Edition--Python
    > 2.4.3 for Windows". This might have destroyed the consistency
    > of the overall installation, of course. I'm well punished
    > for installing Enthought Python 2.4.3: Next time I will again
    > install all packages that I need myself, as I did for Python
    > 2.3, instead of using a prepackaged distribution like Enthought
    > Python.


    Since the truetype extension is quite popular, and from what I'm told
    worked just fine in earlier Enthought releases, this is probably just an
    accidental omission. I'm sure the Enthought people will fix this if you
    report it to them.

    </F>
    Fredrik Lundh, Sep 3, 2006
    #4
  5. Christian Stapfer

    Robert Kern Guest

    Re: Problem loading true-type font with PIL - "solved"

    Fredrik Lundh wrote:
    > Christian Stapfer wrote:
    >
    >> Problem "solved" by rudely installing PIL 1.1.5 for Windows and
    >> Python 2.4 from http://www.pythonware.com/products/pil/
    >> right on top of my existing "Python Enthought Edition--Python
    >> 2.4.3 for Windows". This might have destroyed the consistency
    >> of the overall installation, of course. I'm well punished
    >> for installing Enthought Python 2.4.3: Next time I will again
    >> install all packages that I need myself, as I did for Python
    >> 2.3, instead of using a prepackaged distribution like Enthought
    >> Python.

    >
    > Since the truetype extension is quite popular, and from what I'm told
    > worked just fine in earlier Enthought releases, this is probably just an
    > accidental omission. I'm sure the Enthought people will fix this if you
    > report it to them.


    https://svn.enthought.com/enthought/ticket/864

    The person who builds the Enthought Edition releases is out on vacation this
    week, so a new release will probably wait until he comes back. In the meantime,
    installing Fredrik's binaries on top of ours should work just fine.

    --
    Robert Kern

    "I have come to believe that the whole world is an enigma, a harmless enigma
    that is made terrible by our own mad attempt to interpret it as though it had
    an underlying truth."
    -- Umberto Eco
    Robert Kern, Sep 3, 2006
    #5
  6. Re: Problem loading true-type font with PIL - "solved"

    Robert Kern wrote:
    > Fredrik Lundh wrote:
    >> Christian Stapfer wrote:
    >>
    >>> Problem "solved" by rudely installing PIL 1.1.5 for Windows and
    >>> Python 2.4 from http://www.pythonware.com/products/pil/
    >>> right on top of my existing "Python Enthought Edition--Python
    >>> 2.4.3 for Windows". This might have destroyed the consistency
    >>> of the overall installation, of course. I'm well punished
    >>> for installing Enthought Python 2.4.3: Next time I will again
    >>> install all packages that I need myself, as I did for Python
    >>> 2.3, instead of using a prepackaged distribution like Enthought
    >>> Python.

    >>
    >> Since the truetype extension is quite popular, and from what I'm told
    >> worked just fine in earlier Enthought releases, this is probably just an
    >> accidental omission. I'm sure the Enthought people will fix this if you
    >> report it to them.

    >
    > https://svn.enthought.com/enthought/ticket/864
    >
    > The person who builds the Enthought Edition releases is out on vacation
    > this week, so a new release will probably wait until he comes back. In the
    > meantime, installing Fredrik's binaries on top of ours should work just
    > fine.


    Great! - if it does. (Your words in God's ear...) Sorry about leaving out
    some details about the release I installed. Maybe the following helps?

    C:\Python24\Enthought\Doc>python
    Python 2.4.3 - Enthought Edition 1.0.0 (#69, Aug 2 2006, 12:09:59) [MSC
    v.1310 32 bit (Intel)] on win32

    Perhaps not. Since I have already deleted the Windows installer, and do not
    know of any other way to get Enthought-specific version info, this is all I
    can
    offer at the moment... (I had downloaded the installer from
    http://code.enthought.com/enthon/
    on August 31, around 06:00 GMT. I suppose this means that it was
    enthon-python2.4-1.0.0.exe, but cannot verify anymore whether it was this
    specific installer that I used - or not.)

    Best regards and thanks for your reply,
    Christian Stapfer
    Christian Stapfer, Sep 3, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Glavitsch
    Replies:
    1
    Views:
    763
    Roedy Green
    Jul 15, 2003
  2. John Hunter

    gdmodule true type font size

    John Hunter, Sep 13, 2003, in forum: Python
    Replies:
    0
    Views:
    309
    John Hunter
    Sep 13, 2003
  3. bdb112
    Replies:
    45
    Views:
    1,341
    jazbees
    Apr 29, 2009
  4. mttc
    Replies:
    2
    Views:
    2,391
    Roedy Green
    Jul 3, 2009
  5. Sverre
    Replies:
    2
    Views:
    3,555
    Sverre
    Dec 17, 2009
Loading...

Share This Page