title: Matplotlib PDF export uses wrong font
body: <p>I want to generate high-quality diagrams for a presentation. I’m using Python’s matplotlib to generate the graphics. Unfortunately, the PDF export seems to ignore my font settings.</p>
  
  <p>I tried setting the font both by passing a <code>FontProperties</code> object to the text drawing functions and by setting the option globally. For the record, here is a MWE to reproduce the problem:</p>
  
  <pre><code>import scipy
  import matplotlib
  matplotlib.use('cairo')
  import matplotlib.pylab as pylab
  import matplotlib.font_manager as fm
  
  data = scipy.arange(5)
  
  for font in ['Helvetica', 'Gill Sans']:
      fig = pylab.figure()
      ax = fig.add_subplot(111)
      ax.bar(data, data)
      ax.set_xticks(data)
      ax.set_xticklabels(data, fontproperties = fm.FontProperties(family = font))
      pylab.savefig('foo-%s.pdf' % font)
  </code></pre>
  
  <p>In both cases, the produced output is identical and uses Helvetica (and yes, I <em>do</em> have both fonts installed).</p>
  
  <p>Just to be sure, the following doesn’t help either:</p>
  
  <pre><code>matplotlib.rc('font', family = 'Gill Sans')
  </code></pre>
  
  <p>Finally, if I replace the backend, instead using the native viewer:</p>
  
  <pre><code>matplotlib.use('MacOSX')
  </code></pre>
  
  <p>I <em>do</em> get the correct font displayed – but only in the viewer GUI. The PDF output is once again wrong.</p>
  
  <p>To be sure – I <em>can</em> set other fonts – but only other classes of font families: I can set <code>serif</code> fonts or <code>fantasy</code> or <code>monospace</code>. But all sans-serif fonts seem to default to Helvetica.</p>