import scipy
import matplotlib
matplotlib.use('cairo')
import matplotlib.pylab as pylab
import matplotlib.font_manager as fm
font = fm.FontProperties(family='Gill Sans', fname=
    '/Library/Fonts/GillSans.ttc')
data = scipy.arange(5)
fig = pylab.figure()
ax = fig.add_subplot(111)
ax.bar(data, data)
ax.set_yticklabels(ax.get_yticks(), fontproperties=font)
ax.set_xticklabels(ax.get_xticks(), fontproperties=font)
pylab.savefig('foo.pdf')
Matplotlib PDF export uses wrong font