From: <md...@us...> - 2009-10-01 20:40:16
|
Revision: 7838 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7838&view=rev Author: mdboom Date: 2009-10-01 12:57:39 +0000 (Thu, 01 Oct 2009) Log Message: ----------- Handle trailing whitespace in text. Modified Paths: -------------- trunk/matplotlib/src/ft2font.cpp Modified: trunk/matplotlib/src/ft2font.cpp =================================================================== --- trunk/matplotlib/src/ft2font.cpp 2009-10-01 12:37:49 UTC (rev 7837) +++ trunk/matplotlib/src/ft2font.cpp 2009-10-01 12:57:39 UTC (rev 7838) @@ -894,6 +894,7 @@ bbox.xMin = bbox.yMin = 32000; bbox.xMax = bbox.yMax = -32000; + int right_side = 0; for ( size_t n = 0; n < glyphs.size(); n++ ) { FT_BBox glyph_bbox; FT_Glyph_Get_CBox( glyphs[n], ft_glyph_bbox_subpixels, &glyph_bbox ); @@ -901,6 +902,8 @@ if ( glyph_bbox.yMin < bbox.yMin ) bbox.yMin = glyph_bbox.yMin; if ( glyph_bbox.xMax > bbox.xMax ) bbox.xMax = glyph_bbox.xMax; if ( glyph_bbox.yMax > bbox.yMax ) bbox.yMax = glyph_bbox.yMax; + right_side += glyphs[n]->advance.x >> 10; + if ( right_side > bbox.xMax ) bbox.xMax = right_side; } /* check that we really grew the string bbox */ if ( bbox.xMin > bbox.xMax ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |