From: Michael D. <md...@st...> - 2009-10-01 15:08:25
|
Christopher Barrington-Leigh wrote: >> This does not. First of all, "~" and "\mbox" are not supported if >> usetex=False and I guess never will be. On the other hand, >> as far as I can see, the whitespace stripping is not done in mpl >> side. And I have a feeling that it may be the freetype library. mpl >> uses FT_Glyph_Get_CBox to calculate the extents of the text and I >> think this seems to fail when there is a trailing spaces. This is >> beyond me I hope other developers have better idea. >> >> >> > > Thanks, I too hope some other developers chime in! > > The calculation of the text bounding box was only taking into account the outlines of the text -- and spaces don't have any outlines. I have updated this to also take into account the x-advance of each character, so it now works as expected. As this has the potential to break things, I did this on the trunk, not the maintenance branch, so it will make it into the next major release, not the next bugfix release. The patch can be found here, if you wish to apply it locally: http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/src/ft2font.cpp?r1=7635&r2=7838 Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |