File: //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/afm.pyc
�
�)�Uc @ s+ d Z d d l Z d d l Z d d l Z d d l m Z d � Z e Z e Z
d � Z d � Z d � Z
d � Z d � Z d
� Z d � Z d � Z d
� Z d � Z d d d � � YZ e d k r'd Z xV e j e � D]B Z e e j j e e � � Z e e � Z e j d � \ Z Z! q� Wn d S( s�
This is a python interface to Adobe Font Metrics Files. Although a
number of other python implementations exist (and may be more complete
than mine) I decided not to go with them because either they were
either
1) copyrighted or used a non-BSD compatible license
2) had too many dependencies and I wanted a free standing lib
3) Did more than I needed and it was easier to write my own than
figure out how to just get what I needed from theirs
It is pretty easy to use, and requires only built-in python libs::
>>> from afm import AFM
>>> fh = file('ptmr8a.afm')
>>> afm = AFM(fh)
>>> afm.string_width_height('What the heck?')
(6220.0, 683)
>>> afm.get_fontname()
'Times-Roman'
>>> afm.get_kern_dist('A', 'f')
0
>>> afm.get_kern_dist('A', 'y')
-92.0
>>> afm.get_bbox_char('!')
[130, -9, 238, 676]
>>> afm.get_bbox_font()
[-168, -218, 1000, 898]
AUTHOR:
John D. Hunter <jdh2358@gmail.com>
i����N( t uni2type1c C s t t | � � S( N( t intt float( t x( ( sA /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/afm.pyt _to_int0 s c C s5 | j d d � } g | j � D] } t | � ^ q S( Nt ,t ( t replacet splitR ( t st val( ( sA /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/afm.pyt _to_list_of_ints6 s c C s# g | j � D] } t | � ^ q
S( N( R t _to_float( R R
( ( sA /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/afm.pyt _to_list_of_floats: s c C s$ | j � j � d k r t St Sd S( Nt falset 0t no( R R R ( t lowert stript Falset True( R ( ( sA /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/afm.pyt _to_bool<