def _get_text_prop(fig, text_obj):
    """ Return length of text in pixels """
    renderer = fig.canvas.get_renderer()
    bbox = text_obj.get_window_extent(renderer=renderer).transformed(fig.
        dpi_scale_trans.inverted())
    return {'width': bbox.width * fig.dpi, 'height': bbox.height * fig.dpi}
