'returns a filename based on a hash of the string, fontsize, and dpi'

def get_basefile(self, tex, fontsize, dpi=None):

    s = u''.join([tex, self.get_font_config(), (u'%f' % fontsize), self.get_custom_preamble(), str((dpi or u''))])
    bytes = six.text_type(s).encode(u'utf-8')
    return os.path.join(self.texcache, md5(bytes).hexdigest())
