RendererPdf.get_text_width_height_descent() uses dviread to figure out the text extent. It seems that the text height returned by dviread is a height with descent not being included. Therefore, by manually adding the amount of the descent to its height, problem seems to be solved.
At line 1652 of "lib/backends/backend_pdf.py" - return page.width, page.height, page.descent + return page.width, page.height+page.descent, page.descent By the way, agg and ps backends do not respect baselines when usetex=True. get_text_width_height_descent() method in these backends just returns 0 for the descent value and baseline alignment is not properly done. It seems that this can be fixed with the same method as in the pdf backend (using the dviread module). Is there any reason not doing this? While using the dviread seems to slow things down a bit, I guess it is better being correct than being fast. Regards, -JJ On Mon, Aug 18, 2008 at 6:09 PM, Jae-Joon Lee <[EMAIL PROTECTED]> wrote: > Hi, > > The pdf backend seems to return incorrect window extent (i.e., return > value of get_window_extent()) when usetex==True. > I'm attaching a small script to test this. > >> python test_text_window_extent.py -dPdf > > Its results for the pdf backend with usetex==True is attached. For > comparison, results for the Agg backend with usetex==False (which > seems correct) is also attached. > > I guess this bug is related with > > http://article.gmane.org/gmane.comp.python.matplotlib.general/13997 > > -JJ > ------------------------------------------------------------------------- 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-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users