matplotlib/matplotlib — pull request #2391 by pwuertz (2013-09-07 16:17:53+00:00)
Title: tight_bbox, fixes #2342: support pgf by removing the need for the fake-figure-save

The `tight_bbox` and `tight_layout` mechanisms are quite similar. Both require the figure's renderer to determine the size of text elements. While `tight_layout` acquires the renderer from the canvas, `tight_bbox` grabs the cached renderer after doing a dummy-figsave. In order to support pgf, which cannot save to a stream, I borrowed the `get_renderer` method from `tight_layout`.

Some trivial changes in `tight_bbox.py` were necessary to identify the renderer in `adjust_bbox` because I don't imply a fixed number of dpi in backend_pgf.

Maybe @leejjoon would also like to have a look at this, since he commented on that section of code.