Hi, far from being a font expert, let alone PostScript,
i was making experiments with the PS backend in Matplotlib.
In SuSE Linux 8.0, i set my AFMPATH to point to TeX and
GhostScript directories containing tons of afm font files.
I notice that my whole AFMPATH is parsed for font files.
At some point, the parser is in a subdirectory
containing TeX font files, named 'public'. After fiddling
a little, i remarked that these font files have a
'EncodingScheme' field with an empty value.
The parser breaks on such a file, when it executes
line.split():
File "/usr/local/lib/python2.3/site-packages/matplotlib/afm.py", line 101, in _parse_header
key, val = line.split(' ', 1)
ValueError: unpack list of wrong size
The font files are called
anttb.afm anttr.afm anttri.afm
and come standard with LaTeX2e.
There may be others. I just wanted to bring to your attention that
there may be afm files with that field empty, which causes your
parser to break.
Similarly, some (TeX) afm font files have 'Characters' and
'Capheight' fields with integer values.
I could fix all this by editing afm.py and adding the two lines
'Characters': _to_int,
'Capheight': _to_int,
to the initialization of headerConverters in _parse_header(),
and the lines
lst = line.split( ' ', 1 )
key = lst[0]
if len( lst ) == 2:
val = lst[1]
else:
val = ''
to replace line 100 :
key, val = line.split(' ', 1)
Otherwise, all works very nicely and i am most impressed with the
quality of the plots produced by Matplotlib. Congratulations.
Dominique
|