John Hunter wrote:
> On Tue, Sep 16, 2008 at 8:57 PM, John Hunter <[EMAIL PROTECTED]> wrote:
>> On Tue, Sep 16, 2008 at 5:09 PM, Eric Firing <[EMAIL PROTECTED]> wrote:
>>
>>> I find this very confusing--the _renderer.dpi is not being used by
>>> get_window_extent(). Is this the intended behavior? If so, I would
>>> like to at least add a note to that effect to the get_window_extent
>>> docstring
>> No, this was definitely a bug. Because text layout is expensive, the
>> text module caches the layout based on a cache key (see
>> text.Text.get_prop_tup). We were using the renderer id, and lots of
>> other stuff, but not the dpi, in the cache key. I just added the dpi,
>> so it should work correctly now, though I have done no tests. Give
>> r6098 a whirl and let me know.
>
> Oops, wait, I answered too fast. The figure.dpi *was* already used in
> the cache key and the renderer.dpi, which I just added, is not
> guaranteed to exist (depending on the backend). I need to figure out
> why the figure.dpi in the cache key is not sufficient ....
Maybe because backend_bases FigureCanvasBase.print_figure cleverly
changes figure.dpi, prints, and then changes it back again?
origDPI = self.figure.dpi
origfacecolor = self.figure.get_facecolor()
origedgecolor = self.figure.get_edgecolor()
self.figure.dpi = dpi
self.figure.set_facecolor(facecolor)
self.figure.set_edgecolor(edgecolor)
try:
result = getattr(self, method_name)(
filename,
dpi=dpi,
facecolor=facecolor,
edgecolor=edgecolor,
orientation=orientation,
**kwargs)
finally:
self.figure.dpi = origDPI
self.figure.set_facecolor(origfacecolor)
self.figure.set_edgecolor(origedgecolor)
self.figure.set_canvas(self)
#self.figure.canvas.draw() ## seems superfluous
return result
Eric
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel