matplotlib/matplotlib — pull request #2783 by jdeblese (2014-02-02 19:26:52+00:00)
Title: Use metric identifiers to parse an AFM character metric line

An AFM Character Metric line contains key-value pairs, with some of these being mandatory and some optional. Matplotlib currently parses this using absolute positions, but there are no guarantees as to the order of keys on a line. For example, a Chinese font converted through FontForge results in an AFM with the following Character Metric:

C 0 ; WX 1000 ; WY 1377 ; N uni5200 ; B 73 -131 890 665 ;

The solution is to make use of the keys when parsing the metrics. Parsing a line out into a dictionary, as below, is one straightforward way.

Cheers,
Jw