SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Dominique O. <do...@da...> - 2004年02月20日 20:59:05
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
From: John H. <jdh...@ac...> - 2004年02月20日 23:55:49
>>>>> "Dominique" == Dominique Orban <do...@da...> writes:
 Dominique> Hi, far from being a font expert, let alone PostScript,
 Dominique> i was making experiments with the PS backend in
 Dominique> Matplotlib. In SuSE Linux 8.0, i set my AFMPATH to
 Dominique> point to TeX and GhostScript directories containing
 Dominique> tons of afm font files.
Hi Dominique,
Thanks for the fix. Could you send me your updated backend_ps.py. It
will be easiest for me to merge in your changes that way. Is it slow
for you to load backend_ps. If you have a lot of font files, I assume
it can take a while to parse them all. It might be useful to cache
this information in the way that ttfquery does...
JDH
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /