Added bounding box function
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
diff --git a/include/FTGlyphContainer.h b/include/FTGlyphContainer.h
index 2eaa7b0..5ce5d48 100755
--- a/include/FTGlyphContainer.h
+++ b/include/FTGlyphContainer.h
@@ -1,16 +1,18 @@
#ifndef __FTGlyphContainer__
#define __FTGlyphContainer__
-#include "FTGL.h"
-
#include <vector>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
+#include "FTGL.h"
+
+#include "FTGlyph.h"
+
class FTFace;
-class FTGlyph;
+//class FTGlyph;
using namespace std;
@@ -55,6 +57,9 @@ class FTGL_EXPORT FTGlyphContainer
*/
FTGlyph* Glyph( unsigned int c) const;
+
+ FTBBox BBox( unsigned int index);
+
/**
* Returns the kerned advance width for a glyph.
*
diff --git a/src/FTGlyphContainer.cpp b/src/FTGlyphContainer.cpp
index 710e253..fc9d8de 100755
--- a/src/FTGlyphContainer.cpp
+++ b/src/FTGlyphContainer.cpp
@@ -47,6 +47,14 @@ FTGlyph* FTGlyphContainer::Glyph( unsigned int c) const
}
+FTBBox FTGlyphContainer::BBox( unsigned int index)
+{
+ unsigned int left = face->CharIndex( index);
+
+ return glyphs[left]->BBox();
+}
+
+
float FTGlyphContainer::Advance( unsigned int index, unsigned int next)
{
unsigned int left = face->CharIndex( index);