'return width, heigth and descent of the text.'

def get_text_width_height_descent(self, tex, fontsize, renderer=None):

    if (tex.strip() == u''):
        return (0, 0, 0)
    if renderer:
        dpi_fraction = renderer.points_to_pixels(1.0)
    else:
        dpi_fraction = 1.0
    if rcParams[u'text.latex.preview']:
        basefile = self.get_basefile(tex, fontsize)
        baselinefile = (u'%s.baseline' % basefile)
        if (DEBUG or (not os.path.exists(baselinefile))):
            dvifile = self.make_dvi_preview(tex, fontsize)
        with open(baselinefile) as fh:
            l = fh.read().split()
        (height, depth, width) = [(float(l1) * dpi_fraction) for l1 in l]
        return (width, (height + depth), depth)
    else:
        dvifile = self.make_dvi(tex, fontsize)
        with dviread.Dvi(dvifile, (72 * dpi_fraction)) as dvi:
            page = next(iter(dvi))
        return (page.width, (page.height + page.descent), page.descent)
