Added GlyphCount accessor to FTFace
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
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;
}