Commit d604d3c2abc428e7cce39fdb60e7b041181deea7

henry 2002-12-12T20:48:41

Added GlyphCount accessor to FTFace

diff --git a/include/FTFace.h b/include/FTFace.h
index e30f037..19f9687 100755
--- a/include/FTFace.h
+++ b/include/FTFace.h
@@ -111,7 +111,9 @@ class FTGL_EXPORT FTFace
         /**
          * Gets the current Freetype face.
          */
-        FT_Face* Face() const { return ftFace;}
+//        FT_Face* Face() const { return ftFace;}
+
+        unsigned int GlyphCount() const { return numGlyphs;}
 
         /**
          * Queries for errors.
diff --git a/include/FTGlyphContainer.h b/include/FTGlyphContainer.h
index b8a328f..bb11f50 100755
--- a/include/FTGlyphContainer.h
+++ b/include/FTGlyphContainer.h
@@ -27,7 +27,7 @@ class FTGL_EXPORT FTGlyphContainer
          * @param face      The Freetype face
          * @param numGlyphs the number of glyphs in this face
          */
-        FTGlyphContainer( FTFace* face, unsigned int numGlyphs);
+        FTGlyphContainer( FTFace* face);
 
         /**
          * Destructor
@@ -84,7 +84,7 @@ class FTGL_EXPORT FTGlyphContainer
         /**
          * How many glyphs are reserved in this container
          */
-        unsigned int numGlyphs;
+        unsigned int numberOfGlyphs;
 
         /**
          * The current FTGL face
diff --git a/src/FTFace.cpp b/src/FTFace.cpp
index 18162fb..ffe24d0 100755
--- a/src/FTFace.cpp
+++ b/src/FTFace.cpp
@@ -36,6 +36,7 @@ bool FTFace::Open( const char* filename)
     else
     {
         charMap = new FTCharmap( *ftFace);
+        numGlyphs = (*ftFace)->num_glyphs;
         return true;
     }
 }
@@ -58,6 +59,7 @@ bool FTFace::Open( const unsigned char *pBufferBytes, size_t bufferSizeInBytes )
     else
     {
         charMap = new FTCharmap( *ftFace);
+        numGlyphs = (*ftFace)->num_glyphs;
         return true;
     }
 }
diff --git a/src/FTGlyphContainer.cpp b/src/FTGlyphContainer.cpp
index 73e6835..9f4728d 100755
--- a/src/FTGlyphContainer.cpp
+++ b/src/FTGlyphContainer.cpp
@@ -3,12 +3,12 @@
 #include    "FTFace.h"
 
 
-FTGlyphContainer::FTGlyphContainer( FTFace* f, unsigned int g)
-:   numGlyphs( g),
-    face( f),
+FTGlyphContainer::FTGlyphContainer( FTFace* f)
+:   face( f),
     err( 0)
 {
-    glyphs.resize( g, NULL);
+    numberOfGlyphs = face->GlyphCount();
+    glyphs.resize( numberOfGlyphs, NULL);
 }
 
 
@@ -29,7 +29,7 @@ FTGlyphContainer::~FTGlyphContainer()
 
 bool FTGlyphContainer::Add( FTGlyph* tempGlyph, unsigned int g)
 {
-    if( g >= numGlyphs)
+    if( g >= numberOfGlyphs)
     {
         return false;
     }