code: def _parse_char_metrics(fh):
      """
      Return a character metric dictionary.  Keys are the ASCII num of
      the character, values are a (*wx*, *name*, *bbox*) tuple, where
      *wx* is the character width, *name* is the postscript language
      name, and *bbox* is a (*llx*, *lly*, *urx*, *ury*) tuple.
  
      This function is incomplete per the standard, but thus far parses
      all the sample afm files tried.
      """
  
      ascii_d = {}
      name_d = {}
      while 1:
          line = fh.readline()
          if not line:
              break
          line = line.rstrip()
          if line.startswith("EndCharMetrics"):
              return ascii_d, name_d
          vals = line.split(";")[:4]
          if len(vals) != 4:
              raise RuntimeError("Bad char metrics line: %s" % line)
          num = _to_int(vals[0].split()[1])
          wx = _to_float(vals[1].split()[1])
          name = vals[2].split()[1]
          bbox = _to_list_of_ints(vals[3][2:])
          # Workaround: If the character name is 'Euro', give it the corresponding
          # character code, according to WinAnsiEncoding (see PDF Reference).
          if name == "Euro":
              num = 128
          if num != -1:
              ascii_d[num] = (wx, name, bbox)
          name_d[name] = (wx, bbox)
      raise RuntimeError("Bad parse")
  
imports: import sys, os, re
  from _mathtext_data import uni2type1
label_desc: Use image node_id 6 for calling a global function with example usage: _parse_char_metrics(fh) and returns: ascii_d,  name_d