Commit 0531748168549744b39da10f82d005acd751bdc5

henry 2004-10-05T04:48:14

Added hasKerningTable member so we don't query the font every glyph. Got rid of the redundant Close() and unused UnitsPerEM()

diff --git a/include/FTFace.h b/include/FTFace.h
index 26bb396..0a985e0 100755
--- a/include/FTFace.h
+++ b/include/FTFace.h
@@ -60,11 +60,6 @@ class FTGL_EXPORT FTFace
         bool Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
 
         /**
-         * Disposes of the face
-         */
-        void Close();
-
-        /**
          * Get the freetype face object..
          *
          * @return pointer to an FT_Face.
@@ -83,8 +78,6 @@ class FTGL_EXPORT FTFace
          */
         const FTSize& Size( const unsigned int size, const unsigned int res);
 
-        unsigned int UnitsPerEM() const;
-
         /**
          * Get the number of character maps in this face.
          *
@@ -140,6 +133,11 @@ class FTGL_EXPORT FTFace
         FT_Encoding* fontEncodingList;
 
         /**
+         * This face has kerning tables
+         */
+         bool hasKerningTable;
+
+        /**
          * Current error code. Zero means no error.
          */
         FT_Error err;
diff --git a/src/FTFace.cpp b/src/FTFace.cpp
index 0385e23..2eb3b26 100755
--- a/src/FTFace.cpp
+++ b/src/FTFace.cpp
@@ -21,6 +21,7 @@ FTFace::FTFace( const char* filename)
     else
     {
         numGlyphs = (*ftFace)->num_glyphs;
+        hasKerningTable = FT_HAS_KERNING((*ftFace));
     }
 }
 
@@ -48,7 +49,12 @@ FTFace::FTFace( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
 
 FTFace::~FTFace()
 {
-    Close();
+    if( ftFace)
+    {
+        FT_Done_Face( *ftFace);
+        delete ftFace;
+        ftFace = 0;
+    }
 }
 
 
@@ -72,17 +78,6 @@ bool FTFace::Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes
 }
 
 
-void FTFace::Close()
-{
-    if( ftFace)
-    {
-        FT_Done_Face( *ftFace);
-        delete ftFace;
-        ftFace = 0;
-    }
-}
-
-
 const FTSize& FTFace::Size( const unsigned int size, const unsigned int res)
 {
     charSize.CharSize( ftFace, size, res, res);
@@ -113,18 +108,12 @@ FT_Encoding* FTFace::CharMapList()
 }
 
 
-unsigned int FTFace::UnitsPerEM() const
-{
-    return (*ftFace)->units_per_EM;
-}
-
-
 FTPoint FTFace::KernAdvance( unsigned int index1, unsigned int index2)
 {
     float x, y;
     x = y = 0.0f;
 
-    if( FT_HAS_KERNING((*ftFace)) && index1 && index2)
+    if( hasKerningTable && index1 && index2)
     {
         FT_Vector kernAdvance;
         kernAdvance.x = kernAdvance.y = 0;