Now uses FT_Outline_Get_CBox where possible
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
diff --git a/include/FTBBox.h b/include/FTBBox.h
index 4bd7bd3..c7b6dc1 100755
--- a/include/FTBBox.h
+++ b/include/FTBBox.h
@@ -3,7 +3,8 @@
#include <ft2build.h>
#include FT_FREETYPE_H
-#include FT_GLYPH_H
+//#include FT_GLYPH_H
+#include FT_OUTLINE_H
#include "FTGL.h"
#include "FTPoint.h"
@@ -53,14 +54,21 @@ class FTGL_EXPORT FTBBox
upperY(0.0f),
upperZ(0.0f)
{
- FT_Glyph glyphImage;
- if( FT_Get_Glyph( glyph, &glyphImage ))
+ FT_BBox bbox;
+ if( ft_glyph_format_outline == glyph->format)
{
- return;
+ FT_Outline_Get_CBox( &(glyph->outline), &bbox);
+ }
+ else
+ {
+ FT_Glyph glyphImage;
+ if( 0 != FT_Get_Glyph( glyph, &glyphImage ))
+ {
+ return;
+ }
+ FT_Glyph_Get_CBox( glyphImage, ft_glyph_bbox_subpixels, &bbox );
+ FT_Done_Glyph( glyphImage);
}
-
- FT_BBox bbox;
- FT_Glyph_Get_CBox( glyphImage, ft_glyph_bbox_subpixels, &bbox );
lowerX = static_cast<float>( bbox.xMin) / 64.0f;
lowerY = static_cast<float>( bbox.yMin) / 64.0f;
@@ -69,7 +77,6 @@ class FTGL_EXPORT FTBBox
upperY = static_cast<float>( bbox.yMax) / 64.0f;
upperZ = 0.0f;
- FT_Done_Glyph( glyphImage);
}
/**