Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fb02ecd

Browse files
committed
Fix bug in last commit that caused unit test to fail.
svn path=/trunk/matplotlib/; revision=7839
1 parent a438983 commit fb02ecd

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/ft2font.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -898,12 +898,15 @@ FT2Font::compute_string_bbox( ) {
898898
for ( size_t n = 0; n < glyphs.size(); n++ ) {
899899
FT_BBox glyph_bbox;
900900
FT_Glyph_Get_CBox( glyphs[n], ft_glyph_bbox_subpixels, &glyph_bbox );
901-
if ( glyph_bbox.xMin < bbox.xMin ) bbox.xMin = glyph_bbox.xMin;
902-
if ( glyph_bbox.yMin < bbox.yMin ) bbox.yMin = glyph_bbox.yMin;
903-
if ( glyph_bbox.xMax > bbox.xMax ) bbox.xMax = glyph_bbox.xMax;
904-
if ( glyph_bbox.yMax > bbox.yMax ) bbox.yMax = glyph_bbox.yMax;
905-
right_side += glyphs[n]->advance.x >> 10;
906-
if ( right_side > bbox.xMax ) bbox.xMax = right_side;
901+
if (glyph_bbox.xMin == glyph_bbox.xMax) {
902+
right_side += glyphs[n]->advance.x >> 10;
903+
if ( right_side > bbox.xMax ) bbox.xMax = right_side;
904+
} else {
905+
if ( glyph_bbox.xMin < bbox.xMin ) bbox.xMin = glyph_bbox.xMin;
906+
if ( glyph_bbox.yMin < bbox.yMin ) bbox.yMin = glyph_bbox.yMin;
907+
if ( glyph_bbox.xMax > bbox.xMax ) bbox.xMax = glyph_bbox.xMax;
908+
if ( glyph_bbox.yMax > bbox.yMax ) bbox.yMax = glyph_bbox.yMax;
909+
}
907910
}
908911
/* check that we really grew the string bbox */
909912
if ( bbox.xMin > bbox.xMax ) {

0 commit comments

Comments
 (0)