Error checking in Add Un-virtualised some functions Minor tidy ups
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
diff --git a/include/FTGlyphContainer.h b/include/FTGlyphContainer.h
index baad88d..d536bc5 100755
--- a/include/FTGlyphContainer.h
+++ b/include/FTGlyphContainer.h
@@ -6,11 +6,12 @@
#include FT_GLYPH_H
#include "FTGL.h"
-#include "FTVector.h"
-#include "FTGlyph.h"
+#include "FTBBox.h"
#include "FTPoint.h"
+#include "FTVector.h"
class FTFace;
+class FTGlyph;
/**
* FTGlyphContainer holds the post processed FTGlyph objects.
@@ -31,7 +32,7 @@ class FTGL_EXPORT FTGlyphContainer
/**
* Destructor
*/
- virtual ~FTGlyphContainer();
+ ~FTGlyphContainer();
/**
* Adds a glyph to this glyph list.
@@ -77,16 +78,16 @@ class FTGL_EXPORT FTGlyphContainer
*
* @return The current error code.
*/
- virtual FT_Error Error() const { return err;}
+ FT_Error Error() const { return err;}
private:
/**
- * How meny glyphs are stored in this container
+ * How many glyphs are reserved in this container
*/
int numGlyphs;
/**
- * The current Freetype face
+ * The current FTGL face
*/
FTFace* face;
diff --git a/src/FTGlyphContainer.cpp b/src/FTGlyphContainer.cpp
index 0527b1b..73e6835 100755
--- a/src/FTGlyphContainer.cpp
+++ b/src/FTGlyphContainer.cpp
@@ -29,6 +29,11 @@ FTGlyphContainer::~FTGlyphContainer()
bool FTGlyphContainer::Add( FTGlyph* tempGlyph, unsigned int g)
{
+ if( g >= numGlyphs)
+ {
+ return false;
+ }
+
glyphs[g] = tempGlyph;
return true;
}