'Select a font based on fontprop and return a name suitable for
Op.selectfont. If fontprop is a string, it will be interpreted
as the filename of the font.'

def fontName(self, fontprop):

    if isinstance(fontprop, six.string_types):
        filename = fontprop
    elif rcParams[u'pdf.use14corefonts']:
        filename = findfont(fontprop, fontext=u'afm', directory=self._core14fontdir)
        if (filename is None):
            filename = findfont(u'Helvetica', fontext=u'afm', directory=self._core14fontdir)
    else:
        filename = findfont(fontprop)
    Fx = self.fontNames.get(filename)
    if (Fx is None):
        Fx = Name((u'F%d' % self.nextFont))
        self.fontNames[filename] = Fx
        self.nextFont += 1
        matplotlib.verbose.report((u'Assigning    font    %s    =    %r' % (Fx, filename)), u'debug')
    return Fx
