Logo Search packages:      
Sourcecode: kayali version File versions  Download package

def pdf::afm::_parse_char_metrics (   fh  )  [private]

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
  bbox (llx, lly, urx, ury)

This function is incomplete per the standard, but thus far parse
all the sample afm files I have

Definition at line 172 of file afm.py.

00172                            :
    """
    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
      bbox (llx, lly, urx, ury)

    This function is incomplete per the standard, but thus far parse
    all the sample afm files I have
    """

    d = {}
    while 1:
        line = fh.readline()
        if not line: break
        line = line.rstrip()
        if line.startswith('EndCharMetrics'): return d
        vals = line.split(';')[:4]
        if len(vals)!=4: raise RuntimeError('Bad char metrics line: %s'%line)
        num = _to_int(vals[0].split()[1])
        if num==-1: continue
        wx = _to_float(vals[1].split()[1])
        name = vals[2].split()[1]
        bbox = _to_list_of_ints(vals[3][2:])
        d[num] = (wx, name, bbox)
    raise RuntimeError('Bad parse')

def _parse_kern_pairs(fh):


Generated by  Doxygen 1.6.0   Back to index