From: John H. <jdh...@ac...> - 2004-02-13 14:10:50
|
Almost all of the backends (save postscript) either support freetype or are capable or supporting it. We need a good cross-platform freetype font finder package. Right now, we have fonttools and TTFQuery, which get the job done. But they bring a lot of extra installation overhead. For the postscript backend, I wrote a standalone AFM parser which has worked well - the alternative was to require fonttools, which is larger than all of matplotlib combined. I would like to have the same for TTF files - a small, free standing module with no extrinsic dependencies that we can ship with matplotlib. A introduction to the ttf specification can be found here http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=IWS-Chapter08. We don't need much out of these files: things like character sizes, kerning distances, etc, are already handled by the freetype extension modules, eg, paint.font (which I also used for agg). What we need is for someone to identify the relevant *.ttf dirs on the major platforms (you can extract most of this information from TTFQuery), and parse enough of the ttf file to get family name, font style, weight, etc.... You could either pull out the relevant bits from fonttools and ttfquery or just roll your own. Ideally, you should be able to take a matplotlib.text.Text instance and returns the ttf file which is the closest match for you on your system, falling back on Vera (which ships with matplotlib) as the default. I notice on http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=IWS-Chapter08#3054f18b there is a field for "Postscript name for the font" which would be nice to incorporate for backend switching (saving PS from GTK, etc...). Anyway, it would be a very useful addition to matplotlib, and would speed the process of standardizing fonts across the backends. JDH |