freetype2 and font finder

Alternatively, we could see which methods ttfquery requires of

    >> the ttLib.TTFont and engineer a handrolled TTFont which parses
    >> the relevant bits from the ttf files and provides these
    >> methods.

    > I'll see if someone here can take a brief look at this
    > approach (cutting all the wires to fonttools) to see if it
    > is manageable.

I just checked a freetype2 wrapper module into CVS (and upgraded the
agg backend to work with it). The module is matplotlib.ft2font and
has no external dependencies other than the freetype2 library itself.

If someone in your group decides to take a look at cutting the wires
to fonttools, FT2Font can provide the information needed to replace
it. With a skeleton freetype2 wrapper, there is now no good reason to
parse ttf files ourselves. It is currently a minimalist wrapping,
exposing only what was needed to renderer rotated strings into a pixel
buffer for a given ttf file (the backend uses ttfquery to find the
font file and ft2font to render it).

It is easy to add new methods from the freetype2 API at
http://www.freetype.org/freetype2/docs/reference/ft2-index.html as
needed; eg, to expose the style_flags, family_name, style_name etc of
FT_FaceRec. If it looks like more work to mimic fonttools TTFont, we
can use these attributes to write our own font finder, borrowing from
the ttfquery stuff (eg, platform dirs, using the windows registry to
get system fonts) that does not require fonttools.

By the way, you mentioned math type earlier. I think it would not be
too difficult to use freetype to write a poor-man's latex, handling
subscripts, superscripts and Greek characters. We'd have to locate a
free font that renders Greek characters - I don't know of any but
haven't looked extensively. Or we could require users who want this
feature to come up with the core set of Microsoft fonts and use the
symbol font. I suspect most have access of Windows fonts that they
could copy to their linux boxes, but I am not sure if this is kosher.
Anybody know of some decent free freetype symbol fonts?

David, you can also use FT2Font to render to libart if you want -
check out _backend_agg.c and backend_agg.py for an example of how to
use the wrapper. You basically just need to add one method
"draw_text" to the image extension code, and make some minor changes
in backend_paint.py.

If you want to build agg from cvs, you will need to copy the agg2 dir
from the 0.50 src distribution into your cvs build tree. I haven't
decided yet how I want to handle the distribution of these
dependencies so I'm holding off on checking them into CVS.

JDH