Commit 2b8fc1b1157e0b5ba12bdc284ea91d118acf1b7b

henry 2003-10-01T06:46:18

Now uses FT_Outline_Get_CBox where possible

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);
         }       
 
         /**