Agg backend in Windows

Just wanted to signal some path issues with the current

    > Windows installer. I have looked in the mailing list,
    > but haven't seen anyone having the same problem.

    > In both Windows 2000 and XP, installation of Matplotlib
    > 0.50 results in the following directory hierarchy in my
    > main Python directory c:\Python23\Lib\site-packages
    > (Enthought Edition):

    > FontTools/ fontTools/ sstruct.py ttLib/

Critically, you should also have
c:\Python23\Lib\site-packages\FontTools.pth. I am pretty certain it
is in the windows installer. This file should contain one line, which
reads simply

FontTools

If you don't have it I would like to know!

ttfquery and FontTools are packages to enable cross platform
font-finding. I am very interested in factoring out this dependency
since it complicates installation (as you are seeing). [ Perry, if
anyone in your group is still interested in this, there is a
reasonably well documented example in cvs examples/ftface_props.py
that shows how to access all the relevant freetype attributes (family
name, is italics, etc) using the matplotlib.ft2face module ]

    > it says it cannot import 'fontTools' (lowercase f,
    > uppercase T). Changing the name of the top directory
    > (FontTools) to 'fontTools' doesn't solve it of course,
    > since what it is looking for is the innermost
    > one. Hence i must move the 'fontTools' directory one
    > level up. Next, it can import ttLib, scans my TTFPATH,
    > but breaks down (after litterally one zillion messages)
    > saying that 'module' has no attribute 'SFNTReader'. It
    > is in fact trying to import sfnt and is stuck in the
    > __init__() of Class TTFont. Drastically reducing my
    > TTFPATH, i see that the error is in fact coming from
    > the fact that it cannot import module 'sstruct' in
    > sfnt.py.

All of this is consistent with a missing FontTools.pth. ttfquery will
try and load each windows font, but catches all exceptions and
continues. So you'll get an exception *for each font* the first time
you load ttfquery if something is wrong with your install. After you
have fixed fontools, be sure to remove site-packages/font.cache so
ttfquery can regenerate the font cache.

    > That stuns me. A 'from fontTools import sstruct' would
    > do. How comes Python isn't looking recursively into
    > directories? I guess moving everything to the top level
    > isn't a good idea. Also, still in sfnt.py, the 'import
    > struct' works, but i have no clue where it finds this
    > one; a search was unsuccessful. Anyhow, including
    > 'c:\Python23\fontTools' into the PYTHONPATH solves it
    > but i thought directories would be parsed recursively.

    > Also, can you only use savefig() with the Agg backend?
    > show() isn't popping any window.

Agg is a pure image backend - ie, it only produces image output. In
the next release of matplotlib (this week) there will are 2 GUI
backends that use agg for rendering GtkAgg and TkAgg, both of which
are compiled into the windows installer.

    > As they told me to at SuSE, i'm having a lot of fun.

You mean battling the hairy windows beast?

JDH

* On Tue, 02 Mar 2004, John Hunter wrote:

Critically, you should also have
c:\Python23\Lib\site-packages\FontTools.pth. I am pretty certain it
is in the windows installer. This file should contain one line, which
reads simply

FontTools

If you don't have it I would like to know!

I don't have it actually. It is on neither of my Windows installs.
Can i just create it?

I haven't seen any other user complain about this. Could this come from
an upgrade of matplotlib? During the upgrade, it seems to be backing up
stuff but who knows what it is doing exactly.

All of this is consistent with a missing FontTools.pth. ttfquery will
try and load each windows font, but catches all exceptions and
continues. So you'll get an exception *for each font* the first time
you load ttfquery if something is wrong with your install. After you
have fixed fontools, be sure to remove site-packages/font.cache so
ttfquery can regenerate the font cache.

The font.cache is in site-packages/ttfquery, i presume this is correct?

Agg is a pure image backend - ie, it only produces image output. In
the next release of matplotlib (this week) there will are 2 GUI
backends that use agg for rendering GtkAgg and TkAgg, both of which
are compiled into the windows installer.

Great!

Thanks much,
Dominique

John Hunter wrote:

ttfquery and FontTools are packages to enable cross platform
font-finding. I am very interested in factoring out this dependency
since it complicates installation (as you are seeing). [ Perry, if
anyone in your group is still interested in this, there is a
reasonably well documented example in cvs examples/ftface_props.py
that shows how to access all the relevant freetype attributes (family
name, is italics, etc) using the matplotlib.ft2face module ]

Hi John,

I'm currently working on a replacment for FontTools. I hope to have something out in the next day or so.

  -- Paul

···

--
Paul Barrett, PhD Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Branch
FAX: 410-338-4767 Baltimore, MD 21218