Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Mein <mein@cs.umn.edu>2005-01-21 08:15:33 +0300
committerKent Mein <mein@cs.umn.edu>2005-01-21 08:15:33 +0300
commit26f63bfa197e82a6d3a3f298c603f1878891b8f8 (patch)
tree370880862bd533224e42e7b374f39a43279e79f8 /extern/bFTGL/include
parentb561ca88cfc2445b82c3dc59bdbb8d9e46ee7e31 (diff)
Added bFTGL to extern and updated the Makefiles. I'm guessing there will
need to be tweaks but it seems to work on my linux box. I haven't touched any of the other build systems so those will need to be done. We probably don't need all of this stuff but I figured better to add a little too much then to little. Kent
Diffstat (limited to 'extern/bFTGL/include')
-rwxr-xr-xextern/bFTGL/include/FTBBox.h124
-rwxr-xr-xextern/bFTGL/include/FTBitmapGlyph.h76
-rwxr-xr-xextern/bFTGL/include/FTBufferGlyph.h76
-rw-r--r--extern/bFTGL/include/FTCharToGlyphIndexMap.h130
-rw-r--r--extern/bFTGL/include/FTCharmap.h136
-rw-r--r--extern/bFTGL/include/FTContour.h88
-rw-r--r--extern/bFTGL/include/FTExtrdGlyph.h71
-rwxr-xr-xextern/bFTGL/include/FTFace.h149
-rwxr-xr-xextern/bFTGL/include/FTFont.h260
-rwxr-xr-xextern/bFTGL/include/FTGL.h96
-rwxr-xr-xextern/bFTGL/include/FTGLBitmapFont.h65
-rwxr-xr-xextern/bFTGL/include/FTGLBufferFont.h76
-rw-r--r--extern/bFTGL/include/FTGLExtrdFont.h55
-rwxr-xr-xextern/bFTGL/include/FTGLOutlineFont.h64
-rwxr-xr-xextern/bFTGL/include/FTGLPixmapFont.h68
-rwxr-xr-xextern/bFTGL/include/FTGLPolygonFont.h53
-rwxr-xr-xextern/bFTGL/include/FTGLTextureFont.h151
-rwxr-xr-xextern/bFTGL/include/FTGlyph.h89
-rwxr-xr-xextern/bFTGL/include/FTGlyphContainer.h127
-rwxr-xr-xextern/bFTGL/include/FTLibrary.h97
-rw-r--r--extern/bFTGL/include/FTList.h112
-rw-r--r--extern/bFTGL/include/FTOutlineGlyph.h54
-rwxr-xr-xextern/bFTGL/include/FTPixmapGlyph.h68
-rwxr-xr-xextern/bFTGL/include/FTPoint.h85
-rw-r--r--extern/bFTGL/include/FTPolyGlyph.h55
-rwxr-xr-xextern/bFTGL/include/FTSize.h132
-rwxr-xr-xextern/bFTGL/include/FTTextureGlyph.h89
-rw-r--r--extern/bFTGL/include/FTVector.h190
-rw-r--r--extern/bFTGL/include/FTVectoriser.h275
29 files changed, 3111 insertions, 0 deletions
diff --git a/extern/bFTGL/include/FTBBox.h b/extern/bFTGL/include/FTBBox.h
new file mode 100755
index 00000000000..7ff530166ca
--- /dev/null
+++ b/extern/bFTGL/include/FTBBox.h
@@ -0,0 +1,124 @@
+#ifndef __FTBBox__
+#define __FTBBox__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+//#include FT_GLYPH_H
+#include FT_OUTLINE_H
+
+#include "FTGL.h"
+#include "FTPoint.h"
+
+
+/**
+ * FTBBox is a convenience class for handling bounding boxes.
+ */
+class FTGL_EXPORT FTBBox
+{
+ public:
+ /**
+ * Default constructor. Bounding box is set to zero.
+ */
+ FTBBox()
+ : lowerX(0.0f),
+ lowerY(0.0f),
+ lowerZ(0.0f),
+ upperX(0.0f),
+ upperY(0.0f),
+ upperZ(0.0f)
+ {}
+
+ /**
+ * Constructor.
+ */
+ FTBBox( float lx, float ly, float lz, float ux, float uy, float uz)
+ : lowerX(lx),
+ lowerY(ly),
+ lowerZ(lz),
+ upperX(ux),
+ upperY(uy),
+ upperZ(uz)
+ {}
+
+ /**
+ * Constructor. Extracts a bounding box from a freetype glyph. Uses
+ * the control box for the glyph. <code>FT_Glyph_Get_CBox()</code>
+ *
+ * @param glyph A freetype glyph
+ */
+ FTBBox( FT_GlyphSlot glyph)
+ : lowerX(0.0f),
+ lowerY(0.0f),
+ lowerZ(0.0f),
+ upperX(0.0f),
+ upperY(0.0f),
+ upperZ(0.0f)
+ {
+ FT_BBox bbox;
+ FT_Outline_Get_CBox( &(glyph->outline), &bbox);
+
+ lowerX = static_cast<float>( bbox.xMin) / 64.0f;
+ lowerY = static_cast<float>( bbox.yMin) / 64.0f;
+ lowerZ = 0.0f;
+ upperX = static_cast<float>( bbox.xMax) / 64.0f;
+ upperY = static_cast<float>( bbox.yMax) / 64.0f;
+ upperZ = 0.0f;
+
+ }
+
+ /**
+ * Destructor
+ */
+ ~FTBBox()
+ {}
+
+
+ /**
+ * Move the Bounding Box by a vector.
+ *
+ * @param distance The distance to move the bbox in 3D space.
+ */
+ FTBBox& Move( FTPoint distance)
+ {
+ lowerX += distance.x;
+ lowerY += distance.y;
+ lowerZ += distance.z;
+ upperX += distance.x;
+ upperY += distance.y;
+ upperZ += distance.z;
+ return *this;
+ }
+
+ FTBBox& operator += ( const FTBBox& bbox)
+ {
+ lowerX = bbox.lowerX < lowerX? bbox.lowerX: lowerX;
+ lowerY = bbox.lowerY < lowerY? bbox.lowerY: lowerY;
+ lowerZ = bbox.lowerZ < lowerZ? bbox.lowerZ: lowerZ;
+ upperX = bbox.upperX > upperX? bbox.upperX: upperX;
+ upperY = bbox.upperY > upperY? bbox.upperY: upperY;
+ upperZ = bbox.upperZ > upperZ? bbox.upperZ: upperZ;
+
+ return *this;
+ }
+
+ void SetDepth( float depth)
+ {
+ upperZ = lowerZ + depth;
+ }
+
+
+ /**
+ * The bounds of the box
+ */
+ // Make these ftPoints & private
+ float lowerX, lowerY, lowerZ, upperX, upperY, upperZ;
+ protected:
+
+
+ private:
+
+};
+
+
+#endif // __FTBBox__
+
diff --git a/extern/bFTGL/include/FTBitmapGlyph.h b/extern/bFTGL/include/FTBitmapGlyph.h
new file mode 100755
index 00000000000..89154a97fac
--- /dev/null
+++ b/extern/bFTGL/include/FTBitmapGlyph.h
@@ -0,0 +1,76 @@
+#ifndef __FTBitmapGlyph__
+#define __FTBitmapGlyph__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+#include "FTGlyph.h"
+
+
+/**
+ * FTBitmapGlyph is a specialisation of FTGlyph for creating bitmaps.
+ *
+ * It provides the interface between Freetype glyphs and their openGL
+ * Renderable counterparts. This is an abstract class and derived classes
+ * must implement the <code>Render</code> function.
+ *
+ * @see FTGlyphContainer
+ *
+ */
+class FTGL_EXPORT FTBitmapGlyph : public FTGlyph
+{
+ public:
+ /**
+ * Constructor
+ *
+ * @param glyph The Freetype glyph to be processed
+ */
+ FTBitmapGlyph( FT_GlyphSlot glyph);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTBitmapGlyph();
+
+ /**
+ * Renders this glyph at the current pen position.
+ *
+ * @param pen The current pen position.
+ * @return The advance distance for this glyph.
+ */
+ virtual float Render( const FTPoint& pen);
+
+ private:
+ /**
+ * The width of the glyph 'image'
+ */
+ unsigned int destWidth;
+
+ /**
+ * The height of the glyph 'image'
+ */
+ unsigned int destHeight;
+
+ /**
+ * The pitch of the glyph 'image'
+ */
+ unsigned int destPitch;
+
+ /**
+ * Vector from the pen position to the topleft corner of the bitmap
+ */
+ FTPoint pos;
+
+ /**
+ * Pointer to the 'image' data
+ */
+ unsigned char* data;
+
+};
+
+
+#endif // __FTBitmapGlyph__
+
diff --git a/extern/bFTGL/include/FTBufferGlyph.h b/extern/bFTGL/include/FTBufferGlyph.h
new file mode 100755
index 00000000000..9795f4de5d4
--- /dev/null
+++ b/extern/bFTGL/include/FTBufferGlyph.h
@@ -0,0 +1,76 @@
+#ifndef __FTBufferGlyph__
+#define __FTBufferGlyph__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+#include "FTGlyph.h"
+
+
+/**
+ * FTBufferGlyph is a specialisation of FTGlyph for creating pixmaps.
+ *
+ * @see FTGlyphContainer
+ *
+ */
+class FTGL_EXPORT FTBufferGlyph : public FTGlyph
+{
+ public:
+ /**
+ * Constructor
+ *
+ * @param glyph The Freetype glyph to be processed
+ */
+ FTBufferGlyph( FT_GlyphSlot glyph, unsigned char* clientBuffer);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTBufferGlyph();
+
+ /**
+ * Renders this glyph at the current pen position.
+ *
+ * @param pen The current pen position.
+ * @return The advance distance for this glyph.
+ */
+ virtual float Render( const FTPoint& pen);
+
+ // attributes
+
+ private:
+ /**
+ * The width of the glyph 'image'
+ */
+ int destWidth;
+
+ /**
+ * The height of the glyph 'image'
+ */
+ int destHeight;
+
+ /**
+ * The pitch of the glyph 'image'
+ */
+ unsigned int destPitch;
+
+ /**
+ * Vector from the pen position to the topleft corner of the pixmap
+ */
+ FTPoint pos;
+
+ /**
+ * Pointer to the 'image' data
+ */
+ unsigned char* data;
+
+
+ unsigned char* buffer;
+
+};
+
+
+#endif // __FTBufferGlyph__
diff --git a/extern/bFTGL/include/FTCharToGlyphIndexMap.h b/extern/bFTGL/include/FTCharToGlyphIndexMap.h
new file mode 100644
index 00000000000..6e40d3c9574
--- /dev/null
+++ b/extern/bFTGL/include/FTCharToGlyphIndexMap.h
@@ -0,0 +1,130 @@
+#ifndef __FTCharToGlyphIndexMap__
+#define __FTCharToGlyphIndexMap__
+
+#include <stdlib.h>
+
+#include "FTGL.h"
+
+/**
+ * Provides a non-STL alternative to the STL map<unsigned long, unsigned long>
+ * which maps character codes to glyph indices inside FTCharmap.
+ *
+ * Implementation:
+ * - NumberOfBuckets buckets are considered.
+ * - Each bucket has BucketSize entries.
+ * - When the glyph index for the character code C has to be stored, the
+ * bucket this character belongs to is found using 'C div BucketSize'.
+ * If this bucket has not been allocated yet, do it now.
+ * The entry in the bucked is found using 'C mod BucketSize'.
+ * If it is set to IndexNotFound, then the glyph entry has not been set.
+ * - Try to mimic the calls made to the STL map API.
+ *
+ * Caveats:
+ * - The glyph index is now a signed long instead of unsigned long, so
+ * the special value IndexNotFound (= -1) can be used to specify that the
+ * glyph index has not been stored yet.
+ */
+class FTGL_EXPORT FTCharToGlyphIndexMap
+{
+ public:
+
+ typedef unsigned long CharacterCode;
+ typedef signed long GlyphIndex;
+
+ enum
+ {
+ NumberOfBuckets = 256,
+ BucketSize = 256,
+ IndexNotFound = -1
+ };
+
+ FTCharToGlyphIndexMap()
+ {
+ this->Indices = 0;
+ }
+
+ virtual ~FTCharToGlyphIndexMap()
+ {
+ if( this->Indices)
+ {
+ // Free all buckets
+ this->clear();
+
+ // Free main structure
+ delete [] this->Indices;
+ this->Indices = 0;
+ }
+ }
+
+ void clear()
+ {
+ if(this->Indices)
+ {
+ for( int i = 0; i < FTCharToGlyphIndexMap::NumberOfBuckets; i++)
+ {
+ if( this->Indices[i])
+ {
+ delete [] this->Indices[i];
+ this->Indices[i] = 0;
+ }
+ }
+ }
+ }
+
+ const GlyphIndex find( CharacterCode c)
+ {
+ if( !this->Indices)
+ {
+ return 0;
+ }
+
+ // Find position of char code in buckets
+ div_t pos = div( c, FTCharToGlyphIndexMap::BucketSize);
+
+ if( !this->Indices[pos.quot])
+ {
+ return 0;
+ }
+
+ const FTCharToGlyphIndexMap::GlyphIndex *ptr = &this->Indices[pos.quot][pos.rem];
+ if( *ptr == FTCharToGlyphIndexMap::IndexNotFound)
+ {
+ return 0;
+ }
+
+ return *ptr;
+ }
+
+ void insert( CharacterCode c, GlyphIndex g)
+ {
+ if( !this->Indices)
+ {
+ this->Indices = new GlyphIndex* [FTCharToGlyphIndexMap::NumberOfBuckets];
+ for( int i = 0; i < FTCharToGlyphIndexMap::NumberOfBuckets; i++)
+ {
+ this->Indices[i] = 0;
+ }
+ }
+
+ // Find position of char code in buckets
+ div_t pos = div(c, FTCharToGlyphIndexMap::BucketSize);
+
+ // Allocate bucket if does not exist yet
+ if( !this->Indices[pos.quot])
+ {
+ this->Indices[pos.quot] = new GlyphIndex [FTCharToGlyphIndexMap::BucketSize];
+ for( int i = 0; i < FTCharToGlyphIndexMap::BucketSize; i++)
+ {
+ this->Indices[pos.quot][i] = FTCharToGlyphIndexMap::IndexNotFound;
+ }
+ }
+
+ this->Indices[pos.quot][pos.rem] = g;
+ }
+
+ private:
+ GlyphIndex** Indices;
+};
+
+
+#endif // __FTCharToGlyphIndexMap__
diff --git a/extern/bFTGL/include/FTCharmap.h b/extern/bFTGL/include/FTCharmap.h
new file mode 100644
index 00000000000..74ca6f2cacb
--- /dev/null
+++ b/extern/bFTGL/include/FTCharmap.h
@@ -0,0 +1,136 @@
+#ifndef __FTCharmap__
+#define __FTCharmap__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTCharToGlyphIndexMap.h"
+
+#include "FTGL.h"
+
+
+/**
+ * FTCharmap takes care of specifying the encoding for a font and mapping
+ * character codes to glyph indices.
+ *
+ * It doesn't preprocess all indices, only on an as needed basis. This may
+ * seem like a performance penalty but it is quicker than using the 'raw'
+ * freetype calls and will save significant amounts of memory when dealing
+ * with unicode encoding
+ *
+ * @see "Freetype 2 Documentation"
+ *
+ */
+
+class FTFace;
+
+class FTGL_EXPORT FTCharmap
+{
+ public:
+ /**
+ * Constructor
+ */
+ FTCharmap( FTFace* face);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTCharmap();
+
+ /**
+ * Queries for the current character map code.
+ *
+ * @return The current character map code.
+ */
+ FT_Encoding Encoding() const { return ftEncoding;}
+
+ /**
+ * Sets the character map for the face.
+ * Valid encodings as at Freetype 2.0.4
+ * ft_encoding_none
+ * ft_encoding_symbol
+ * ft_encoding_unicode
+ * ft_encoding_latin_2
+ * ft_encoding_sjis
+ * ft_encoding_gb2312
+ * ft_encoding_big5
+ * ft_encoding_wansung
+ * ft_encoding_johab
+ * ft_encoding_adobe_standard
+ * ft_encoding_adobe_expert
+ * ft_encoding_adobe_custom
+ * ft_encoding_apple_roman
+ *
+ * @param encoding the Freetype encoding symbol. See above.
+ * @return <code>true</code> if charmap was valid and set
+ * correctly. If the requested encoding is
+ * unavailable it will be set to ft_encoding_none.
+ */
+ bool CharMap( FT_Encoding encoding);
+
+ /**
+ * Get the FTGlyphContainer index of the input character.
+ *
+ * @param characterCode The character code of the requested glyph in
+ * the current encoding eg apple roman.
+ * @return The FTGlyphContainer index for the character or zero
+ * if it wasn't found
+ */
+ unsigned int GlyphListIndex( const unsigned int characterCode);
+
+ /**
+ * Get the font glyph index of the input character.
+ *
+ * @param characterCode The character code of the requested glyph in
+ * the current encoding eg apple roman.
+ * @return The glyph index for the character.
+ */
+ unsigned int FontIndex( const unsigned int characterCode);
+
+ /**
+ * Set the FTGlyphContainer index of the character code.
+ *
+ * @param characterCode The character code of the requested glyph in
+ * the current encoding eg apple roman.
+ * @param containerIndex The index into the FTGlyphContainer of the
+ * character code.
+ */
+ void InsertIndex( const unsigned int characterCode, const unsigned int containerIndex);
+
+ /**
+ * Queries for errors.
+ *
+ * @return The current error code. Zero means no error.
+ */
+ FT_Error Error() const { return err;}
+
+ private:
+ /**
+ * Current character map code.
+ */
+ FT_Encoding ftEncoding;
+
+ /**
+ * The current Freetype face.
+ */
+ const FT_Face ftFace;
+
+ /**
+ * A structure that maps glyph indices to character codes
+ *
+ * < character code, face glyph index>
+ */
+ typedef FTCharToGlyphIndexMap CharacterMap;
+ CharacterMap charMap;
+
+ /**
+ * Current error code.
+ */
+ FT_Error err;
+
+};
+
+
+#endif // __FTCharmap__
diff --git a/extern/bFTGL/include/FTContour.h b/extern/bFTGL/include/FTContour.h
new file mode 100644
index 00000000000..895d9edeff8
--- /dev/null
+++ b/extern/bFTGL/include/FTContour.h
@@ -0,0 +1,88 @@
+#ifndef __FTContour__
+#define __FTContour__
+
+#include "FTPoint.h"
+#include "FTVector.h"
+#include "FTGL.h"
+
+
+/**
+ * FTContour class is a container of points that describe a vector font
+ * outline. It is used as a container for the output of the bezier curve
+ * evaluator in FTVectoriser.
+ *
+ * @see FTOutlineGlyph
+ * @see FTPolyGlyph
+ * @see FTPoint
+ */
+class FTGL_EXPORT FTContour
+{
+ public:
+ /**
+ * Constructor
+ *
+ * @param contour
+ * @param pointTags
+ * @param numberOfPoints
+ */
+ FTContour( FT_Vector* contour, char* pointTags, unsigned int numberOfPoints);
+
+ /**
+ * Destructor
+ */
+ ~FTContour()
+ {
+ pointList.clear();
+ }
+
+ /**
+ * Return a point at index.
+ *
+ * @param index of the point in the curve.
+ * @return const point reference
+ */
+ const FTPoint& Point( unsigned int index) const { return pointList[index];}
+
+ /**
+ * How many points define this contour
+ *
+ * @return the number of points in this contour
+ */
+ size_t PointCount() const { return pointList.size();}
+
+ private:
+ /**
+ * Add a point to this contour. This function tests for duplicate
+ * points.
+ *
+ * @param point The point to be added to the contour.
+ */
+ inline void AddPoint( FTPoint point);
+
+ inline void AddPoint( float x, float y);
+
+ /**
+ * De Casteljau (bezier) algorithm contributed by Jed Soane
+ * Evaluates a quadratic or conic (second degree) curve
+ */
+ inline void evaluateQuadraticCurve();
+
+ /**
+ * De Casteljau (bezier) algorithm contributed by Jed Soane
+ * Evaluates a cubic (third degree) curve
+ */
+ inline void evaluateCubicCurve();
+
+ /**
+ * The list of points in this contour
+ */
+ typedef FTVector<FTPoint> PointVector;
+ PointVector pointList;
+
+ /**
+ * 2D array storing values of de Casteljau algorithm.
+ */
+ float controlPoints[4][2];
+};
+
+#endif // __FTContour__
diff --git a/extern/bFTGL/include/FTExtrdGlyph.h b/extern/bFTGL/include/FTExtrdGlyph.h
new file mode 100644
index 00000000000..01e7c9e1d76
--- /dev/null
+++ b/extern/bFTGL/include/FTExtrdGlyph.h
@@ -0,0 +1,71 @@
+#ifndef __FTExtrdGlyph__
+#define __FTExtrdGlyph__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+#include "FTGlyph.h"
+
+class FTVectoriser;
+
+/**
+ * FTExtrdGlyph is a specialisation of FTGlyph for creating tessellated
+ * extruded polygon glyphs.
+ *
+ * @see FTGlyphContainer
+ * @see FTVectoriser
+ *
+ */
+class FTGL_EXPORT FTExtrdGlyph : public FTGlyph
+{
+ public:
+ /**
+ * Constructor. Sets the Error to Invalid_Outline if the glyphs isn't an outline.
+ *
+ * @param glyph The Freetype glyph to be processed
+ * @param depth The distance along the z axis to extrude the glyph
+ */
+ FTExtrdGlyph( FT_GlyphSlot glyph, float depth);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTExtrdGlyph();
+
+ /**
+ * Renders this glyph at the current pen position.
+ *
+ * @param pen The current pen position.
+ * @return The advance distance for this glyph.
+ */
+ virtual float Render( const FTPoint& pen);
+
+ private:
+ /**
+ * Calculate the normal vector to 2 points. This is 2D and ignores
+ * the z component. The normal will be normalised
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ FTPoint GetNormal( const FTPoint &a, const FTPoint &b);
+
+
+ /**
+ * OpenGL display list
+ */
+ GLuint glList;
+
+ /**
+ * Distance to extrude the glyph
+ */
+ float depth;
+
+};
+
+
+#endif // __FTExtrdGlyph__
+
diff --git a/extern/bFTGL/include/FTFace.h b/extern/bFTGL/include/FTFace.h
new file mode 100755
index 00000000000..26bb3966462
--- /dev/null
+++ b/extern/bFTGL/include/FTFace.h
@@ -0,0 +1,149 @@
+#ifndef __FTFace__
+#define __FTFace__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+#include "FTPoint.h"
+#include "FTSize.h"
+
+/**
+ * FTFace class provides an abstraction layer for the Freetype Face.
+ *
+ * @see "Freetype 2 Documentation"
+ *
+ */
+class FTGL_EXPORT FTFace
+{
+ public:
+ /**
+ * Opens and reads a face file. Error is set.
+ *
+ * @param filename font file name.
+ */
+ FTFace( const char* filename);
+
+ /**
+ * Read face data from an in-memory buffer. Error is set.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ */
+ FTFace( const unsigned char *pBufferBytes, size_t bufferSizeInBytes );
+
+ /**
+ * Destructor
+ *
+ * Disposes of the current Freetype Face.
+ */
+ virtual ~FTFace();
+
+ /**
+ * Attach auxilliary file to font (e.g., font metrics).
+ *
+ * @param filename auxilliary font file name.
+ * @return <code>true</code> if file has opened
+ * successfully.
+ */
+ bool Attach( const char* filename);
+
+ /**
+ * Attach auxilliary data to font (e.g., font metrics) from memory
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ * @return <code>true</code> if file has opened
+ * successfully.
+ */
+ 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.
+ */
+ FT_Face* Face() const { return ftFace;}
+
+ /**
+ * Sets the char size for the current face.
+ *
+ * This doesn't guarantee that the size was set correctly. Clients
+ * should check errors.
+ *
+ * @param size the face size in points (1/72 inch)
+ * @param res the resolution of the target device.
+ * @return <code>FTSize</code> object
+ */
+ const FTSize& Size( const unsigned int size, const unsigned int res);
+
+ unsigned int UnitsPerEM() const;
+
+ /**
+ * Get the number of character maps in this face.
+ *
+ * @return character map count.
+ */
+ unsigned int CharMapCount();
+
+ /**
+ * Get a list of character maps in this face.
+ *
+ * @return pointer to the first encoding.
+ */
+ FT_Encoding* CharMapList();
+
+ /**
+ * Gets the kerning vector between two glyphs
+ */
+ FTPoint KernAdvance( unsigned int index1, unsigned int index2);
+
+ /**
+ * Loads and creates a Freetype glyph.
+ */
+ FT_GlyphSlot Glyph( unsigned int index, FT_Int load_flags);
+
+ /**
+ * Gets the number of glyphs in the current face.
+ */
+ unsigned int GlyphCount() const { return numGlyphs;}
+
+ /**
+ * Queries for errors.
+ *
+ * @return The current error code.
+ */
+ FT_Error Error() const { return err; }
+
+ private:
+ /**
+ * The Freetype face
+ */
+ FT_Face* ftFace;
+
+ /**
+ * The size object associated with this face
+ */
+ FTSize charSize;
+
+ /**
+ * The number of glyphs in this face
+ */
+ int numGlyphs;
+
+ FT_Encoding* fontEncodingList;
+
+ /**
+ * Current error code. Zero means no error.
+ */
+ FT_Error err;
+};
+
+
+#endif // __FTFace__
diff --git a/extern/bFTGL/include/FTFont.h b/extern/bFTGL/include/FTFont.h
new file mode 100755
index 00000000000..5b3d9e46f68
--- /dev/null
+++ b/extern/bFTGL/include/FTFont.h
@@ -0,0 +1,260 @@
+#ifndef __FTFont__
+#define __FTFont__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#include "FTFace.h"
+#include "FTGL.h"
+
+class FTGlyphContainer;
+class FTGlyph;
+
+
+/**
+ * FTFont is the public interface for the FTGL library.
+ *
+ * Specific font classes are derived from this class. It uses the helper
+ * classes FTFace and FTSize to access the Freetype library. This class
+ * is abstract and deriving classes must implement the protected
+ * <code>MakeGlyph</code> function to create glyphs of the
+ * appropriate type.
+ *
+ * It is good practice after using these functions to test the error
+ * code returned. <code>FT_Error Error()</code>
+ *
+ * @see FTFace
+ * @see FTSize
+ * @see FTGlyphContainer
+ * @see FTGlyph
+ */
+class FTGL_EXPORT FTFont
+{
+ public:
+ /**
+ * Open and read a font file. Sets Error flag.
+ *
+ * @param fontname font file name.
+ */
+ FTFont( const char* fontname);
+
+ /**
+ * Open and read a font from a buffer in memory. Sets Error flag.
+ * The buffer is owned by the client and is NOT copied by FTGL. The
+ * pointer must be valid while using FTGL.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ */
+ FTFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTFont();
+
+ /**
+ * Attach auxilliary file to font e.g font metrics.
+ *
+ * Note: not all font formats implement this function.
+ *
+ * @param filename auxilliary font file name.
+ * @return <code>true</code> if file has been attached
+ * successfully.
+ */
+ bool Attach( const char* filename);
+
+ /**
+ * Attach auxilliary data to font e.g font metrics, from memory
+ *
+ * Note: not all font formats implement this function.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ * @return <code>true</code> if file has been attached
+ * successfully.
+ */
+ bool Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
+
+ /**
+ * Set the character map for the face.
+ *
+ * @param encoding Freetype enumerate for char map code.
+ * @return <code>true</code> if charmap was valid and
+ * set correctly
+ */
+ bool CharMap( FT_Encoding encoding );
+
+ /**
+ * Get the number of character maps in this face.
+ *
+ * @return character map count.
+ */
+ unsigned int CharMapCount();
+
+ /**
+ * Get a list of character maps in this face.
+ *
+ * @return pointer to the first encoding.
+ */
+ FT_Encoding* CharMapList();
+
+ /**
+ * Set the char size for the current face.
+ *
+ * @param size the face size in points (1/72 inch)
+ * @param res the resolution of the target device.
+ * @return <code>true</code> if size was set correctly
+ */
+ virtual bool FaceSize( const unsigned int size, const unsigned int res = 72);
+
+ /**
+ * Get the current face size in points.
+ *
+ * @return face size
+ */
+ unsigned int FaceSize() const;
+
+ /**
+ * Set the extrusion distance for the font. Only implemented by
+ * FTGLExtrdFont
+ *
+ * @param d The extrusion distance.
+ */
+ virtual void Depth( float d){}
+
+ /**
+ * Get the global ascender height for the face.
+ *
+ * @return Ascender height
+ */
+ float Ascender() const;
+
+ /**
+ * Gets the global descender height for the face.
+ *
+ * @return Descender height
+ */
+ float Descender() const;
+
+ /**
+ * Get the bounding box for a string.
+ *
+ * @param string a char string
+ * @param llx lower left near x coord
+ * @param lly lower left near y coord
+ * @param llz lower left near z coord
+ * @param urx upper right far x coord
+ * @param ury upper right far y coord
+ * @param urz upper right far z coord
+ */
+ void BBox( const char* string, float& llx, float& lly, float& llz, float& urx, float& ury, float& urz);
+
+ /**
+ * Get the bounding box for a string.
+ *
+ * @param string a wchar_t string
+ * @param llx lower left near x coord
+ * @param lly lower left near y coord
+ * @param llz lower left near z coord
+ * @param urx upper right far x coord
+ * @param ury upper right far y coord
+ * @param urz upper right far z coord
+ */
+ void BBox( const wchar_t* string, float& llx, float& lly, float& llz, float& urx, float& ury, float& urz);
+
+ /**
+ * Get the advance width for a string.
+ *
+ * @param string a wchar_t string
+ * @return advance width
+ */
+ float Advance( const wchar_t* string);
+
+ /**
+ * Get the advance width for a string.
+ *
+ * @param string a char string
+ * @return advance width
+ */
+ float Advance( const char* string);
+
+ /**
+ * Render a string of characters
+ *
+ * @param string 'C' style string to be output.
+ */
+ virtual void Render( const char* string );
+
+ /**
+ * Render a string of characters
+ *
+ * @param string wchar_t string to be output.
+ */
+ virtual void Render( const wchar_t* string );
+
+ /**
+ * Queries the Font for errors.
+ *
+ * @return The current error code.
+ */
+ FT_Error Error() const { return err;}
+
+ protected:
+ /**
+ * Construct a glyph of the correct type.
+ *
+ * Clients must overide the function and return their specialised
+ * FTGlyph.
+ *
+ * @param g The glyph index NOT the char code.
+ * @return An FT****Glyph or <code>null</code> on failure.
+ */
+ virtual FTGlyph* MakeGlyph( unsigned int g) = 0;
+
+ /**
+ * Current face object
+ */
+ FTFace face;
+
+ /**
+ * Current size object
+ */
+ FTSize charSize;
+
+ /**
+ * Current error code. Zero means no error.
+ */
+ FT_Error err;
+
+ private:
+ /**
+ * Render a character
+ * This function does an implicit conversion on it's arguments.
+ *
+ * @param chr current character
+ * @param nextChr next character
+ */
+ inline void DoRender( const unsigned int chr, const unsigned int nextChr);
+
+ /**
+ * Check that the glyph at <code>chr</code> exist. If not load it.
+ *
+ * @param chr character index
+ */
+ inline void CheckGlyph( const unsigned int chr);
+
+ /**
+ * An object that holds a list of glyphs
+ */
+ FTGlyphContainer* glyphList;
+
+ /**
+ * Current pen or cursor position;
+ */
+ FTPoint pen;
+};
+
+
+#endif // __FTFont__
+
diff --git a/extern/bFTGL/include/FTGL.h b/extern/bFTGL/include/FTGL.h
new file mode 100755
index 00000000000..e92bd526012
--- /dev/null
+++ b/extern/bFTGL/include/FTGL.h
@@ -0,0 +1,96 @@
+#ifndef __FTGL__
+#define __FTGL__
+
+
+typedef double FTGL_DOUBLE;
+typedef float FTGL_FLOAT;
+
+// Fixes for deprecated identifiers in 2.1.5
+#ifndef FT_OPEN_MEMORY
+ #define FT_OPEN_MEMORY (FT_Open_Flags)1
+#endif
+
+#ifndef FT_RENDER_MODE_MONO
+ #define FT_RENDER_MODE_MONO ft_render_mode_mono
+#endif
+
+#ifndef FT_RENDER_MODE_NORMAL
+ #define FT_RENDER_MODE_NORMAL ft_render_mode_normal
+#endif
+
+
+#ifdef WIN32
+
+ // Under windows avoid including <windows.h> is overrated.
+ // Sure, it can be avoided and "name space pollution" can be
+ // avoided, but why? It really doesn't make that much difference
+ // these days.
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+
+ #ifndef __gl_h_
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+ #endif
+
+#else
+
+ // Non windows platforms - don't require nonsense as seen above :-)
+ #ifndef __gl_h_
+ #ifdef __APPLE_CC__
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glu.h>
+ #else
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+ #endif
+
+ #endif
+
+ // Required for compatibility with glext.h style function definitions of
+ // OpenGL extensions, such as in src/osg/Point.cpp.
+ #ifndef APIENTRY
+ #define APIENTRY
+ #endif
+#endif
+
+// Compiler-specific conditional compilation
+#ifdef _MSC_VER // MS Visual C++
+
+ // Disable various warning.
+ // 4786: template name too long
+ #pragma warning( disable : 4251 )
+ #pragma warning( disable : 4275 )
+ #pragma warning( disable : 4786 )
+
+ // The following definitions control how symbols are exported.
+ // If the target is a static library ensure that FTGL_LIBRARY_STATIC
+ // is defined. If building a dynamic library (ie DLL) ensure the
+ // FTGL_LIBRARY macro is defined, as it will mark symbols for
+ // export. If compiling a project to _use_ the _dynamic_ library
+ // version of the library, no definition is required.
+ #ifdef FTGL_LIBRARY_STATIC // static lib - no special export required
+ # define FTGL_EXPORT
+ #elif FTGL_LIBRARY // dynamic lib - must export/import symbols appropriately.
+ # define FTGL_EXPORT __declspec(dllexport)
+ #else
+ # define FTGL_EXPORT __declspec(dllimport)
+ #endif
+
+#else
+ // Compiler that is not MS Visual C++.
+ // Ensure that the export symbol is defined (and blank)
+ #define FTGL_EXPORT
+#endif
+
+
+// lifted from glext.h, to remove dependancy on glext.h
+#ifndef GL_EXT_texture_object
+ #define GL_TEXTURE_PRIORITY_EXT 0x8066
+ #define GL_TEXTURE_RESIDENT_EXT 0x8067
+ #define GL_TEXTURE_1D_BINDING_EXT 0x8068
+ #define GL_TEXTURE_2D_BINDING_EXT 0x8069
+ #define GL_TEXTURE_3D_BINDING_EXT 0x806A
+#endif
+
+#endif // __FTGL__
diff --git a/extern/bFTGL/include/FTGLBitmapFont.h b/extern/bFTGL/include/FTGLBitmapFont.h
new file mode 100755
index 00000000000..12feae00cb6
--- /dev/null
+++ b/extern/bFTGL/include/FTGLBitmapFont.h
@@ -0,0 +1,65 @@
+#ifndef __FTGLBitmapFont__
+#define __FTGLBitmapFont__
+
+#include "FTFont.h"
+#include "FTGL.h"
+
+
+class FTGlyph;
+
+/**
+ * FTGLBitmapFont is a specialisation of the FTFont class for handling
+ * Bitmap fonts
+ *
+ * @see FTFont
+ */
+class FTGL_EXPORT FTGLBitmapFont : public FTFont
+{
+ public:
+ /**
+ * Open and read a font file. Sets Error flag.
+ *
+ * @param fontname font file name.
+ */
+ FTGLBitmapFont( const char* fontname);
+
+ /**
+ * Open and read a font from a buffer in memory. Sets Error flag.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ */
+ FTGLBitmapFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
+
+ /**
+ * Destructor
+ */
+ ~FTGLBitmapFont();
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string 'C' style string to be output.
+ */
+ void Render( const char* string);
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string 'C' style wide string to be output.
+ */
+ void Render( const wchar_t* string);
+
+ // attributes
+
+ private:
+ /**
+ * Construct a FTBitmapGlyph.
+ *
+ * @param g The glyph index NOT the char code.
+ * @return An FTBitmapGlyph or <code>null</code> on failure.
+ */
+ inline virtual FTGlyph* MakeGlyph( unsigned int g);
+
+};
+#endif // __FTGLBitmapFont__
diff --git a/extern/bFTGL/include/FTGLBufferFont.h b/extern/bFTGL/include/FTGLBufferFont.h
new file mode 100755
index 00000000000..2f74b5cdef9
--- /dev/null
+++ b/extern/bFTGL/include/FTGLBufferFont.h
@@ -0,0 +1,76 @@
+#ifndef __FTGLBufferFont__
+#define __FTGLBufferFont__
+
+
+#include "FTFont.h"
+#include "FTGL.h"
+
+
+class FTGlyph;
+
+
+/**
+ * FTGLBufferFont is a specialisation of the FTFont class for handling
+ * Pixmap (Grey Scale) fonts
+ *
+ * @see FTFont
+ */
+class FTGL_EXPORT FTGLBufferFont : public FTFont
+{
+ public:
+ /**
+ * Open and read a font file. Sets Error flag.
+ *
+ * @param fontname font file name.
+ */
+ FTGLBufferFont( const char* fontname);
+
+ /**
+ * Open and read a font from a buffer in memory. Sets Error flag.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ */
+ FTGLBufferFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
+
+
+ void SetClientBuffer( unsigned char* b)
+ {
+ buffer = b;
+ }
+
+
+ /**
+ * Destructor
+ */
+ ~FTGLBufferFont();
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string 'C' style string to be output.
+ */
+ void Render( const char* string);
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string wchar_t string to be output.
+ */
+ void Render( const wchar_t* string);
+
+ private:
+ /**
+ * Construct a FTBufferGlyph.
+ *
+ * @param g The glyph index NOT the char code.
+ * @return An FTBufferGlyph or <code>null</code> on failure.
+ */
+ inline virtual FTGlyph* MakeGlyph( unsigned int g);
+
+ unsigned char* buffer;
+};
+
+
+#endif // __FTGLBufferFont__
+
diff --git a/extern/bFTGL/include/FTGLExtrdFont.h b/extern/bFTGL/include/FTGLExtrdFont.h
new file mode 100644
index 00000000000..dc784bbb5b0
--- /dev/null
+++ b/extern/bFTGL/include/FTGLExtrdFont.h
@@ -0,0 +1,55 @@
+#ifndef __FTGLExtrdFont__
+#define __FTGLExtrdFont__
+
+#include "FTFont.h"
+#include "FTGL.h"
+
+class FTGlyph;
+
+/**
+ * FTGLExtrdFont is a specialisation of the FTFont class for handling
+ * extruded Polygon fonts
+ *
+ * @see FTFont
+ * @see FTGLPolygonFont
+ */
+class FTGL_EXPORT FTGLExtrdFont : public FTFont
+{
+ public:
+ /**
+ * Open and read a font file. Sets Error flag.
+ *
+ * @param fontname font file name.
+ */
+ FTGLExtrdFont( const char* fontname);
+
+ /**
+ * Open and read a font from a buffer in memory. Sets Error flag.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ */
+ FTGLExtrdFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
+
+ /**
+ * Destructor
+ */
+ ~FTGLExtrdFont();
+
+ void Depth( float d) { depth = d;}
+
+ private:
+ /**
+ * Construct a FTPolyGlyph.
+ *
+ * @param glyphIndex The glyph index NOT the char code.
+ * @return An FTExtrdGlyph or <code>null</code> on failure.
+ */
+ inline virtual FTGlyph* MakeGlyph( unsigned int glyphIndex);
+
+ float depth;
+};
+
+
+#endif // __FTGLExtrdFont__
+
diff --git a/extern/bFTGL/include/FTGLOutlineFont.h b/extern/bFTGL/include/FTGLOutlineFont.h
new file mode 100755
index 00000000000..a7f4b23092d
--- /dev/null
+++ b/extern/bFTGL/include/FTGLOutlineFont.h
@@ -0,0 +1,64 @@
+#ifndef __FTGLOutlineFont__
+#define __FTGLOutlineFont__
+
+
+#include "FTFont.h"
+#include "FTGL.h"
+
+class FTGlyph;
+
+
+/**
+ * FTGLOutlineFont is a specialisation of the FTFont class for handling
+ * Vector Outline fonts
+ *
+ * @see FTFont
+ */
+class FTGL_EXPORT FTGLOutlineFont : public FTFont
+{
+ public:
+ /**
+ * Open and read a font file. Sets Error flag.
+ *
+ * @param fontname font file name.
+ */
+ FTGLOutlineFont( const char* fontname);
+
+ /**
+ * Open and read a font from a buffer in memory. Sets Error flag.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ */
+ FTGLOutlineFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
+
+ /**
+ * Destructor
+ */
+ ~FTGLOutlineFont();
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string 'C' style string to be output.
+ */
+ void Render( const char* string);
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string wchar_t string to be output.
+ */
+ void Render( const wchar_t* string);
+
+ private:
+ /**
+ * Construct a FTOutlineGlyph.
+ *
+ * @param g The glyph index NOT the char code.
+ * @return An FTOutlineGlyph or <code>null</code> on failure.
+ */
+ inline virtual FTGlyph* MakeGlyph( unsigned int g);
+
+};
+#endif // __FTGLOutlineFont__
diff --git a/extern/bFTGL/include/FTGLPixmapFont.h b/extern/bFTGL/include/FTGLPixmapFont.h
new file mode 100755
index 00000000000..f781ddf68dd
--- /dev/null
+++ b/extern/bFTGL/include/FTGLPixmapFont.h
@@ -0,0 +1,68 @@
+#ifndef __FTGLPixmapFont__
+#define __FTGLPixmapFont__
+
+
+#include "FTFont.h"
+#include "FTGL.h"
+
+
+class FTGlyph;
+
+
+/**
+ * FTGLPixmapFont is a specialisation of the FTFont class for handling
+ * Pixmap (Grey Scale) fonts
+ *
+ * @see FTFont
+ */
+class FTGL_EXPORT FTGLPixmapFont : public FTFont
+{
+ public:
+ /**
+ * Open and read a font file. Sets Error flag.
+ *
+ * @param fontname font file name.
+ */
+ FTGLPixmapFont( const char* fontname);
+
+ /**
+ * Open and read a font from a buffer in memory. Sets Error flag.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ */
+ FTGLPixmapFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
+
+ /**
+ * Destructor
+ */
+ ~FTGLPixmapFont();
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string 'C' style string to be output.
+ */
+ void Render( const char* string);
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string wchar_t string to be output.
+ */
+ void Render( const wchar_t* string);
+
+ private:
+ /**
+ * Construct a FTPixmapGlyph.
+ *
+ * @param g The glyph index NOT the char code.
+ * @return An FTPixmapGlyph or <code>null</code> on failure.
+ */
+ inline virtual FTGlyph* MakeGlyph( unsigned int g);
+
+};
+
+
+#endif // __FTGLPixmapFont__
+
diff --git a/extern/bFTGL/include/FTGLPolygonFont.h b/extern/bFTGL/include/FTGLPolygonFont.h
new file mode 100755
index 00000000000..54e624a1893
--- /dev/null
+++ b/extern/bFTGL/include/FTGLPolygonFont.h
@@ -0,0 +1,53 @@
+#ifndef __FTGLPolygonFont__
+#define __FTGLPolygonFont__
+
+
+#include "FTFont.h"
+#include "FTGL.h"
+
+class FTGlyph;
+
+
+/**
+ * FTGLPolygonFont is a specialisation of the FTFont class for handling
+ * tesselated Polygon Mesh fonts
+ *
+ * @see FTFont
+ */
+class FTGL_EXPORT FTGLPolygonFont : public FTFont
+{
+ public:
+ /**
+ * Open and read a font file. Sets Error flag.
+ *
+ * @param fontname font file name.
+ */
+ FTGLPolygonFont( const char* fontname);
+
+ /**
+ * Open and read a font from a buffer in memory. Sets Error flag.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ */
+ FTGLPolygonFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
+
+ /**
+ * Destructor
+ */
+ ~FTGLPolygonFont();
+
+ private:
+ /**
+ * Construct a FTPolyGlyph.
+ *
+ * @param g The glyph index NOT the char code.
+ * @return An FTPolyGlyph or <code>null</code> on failure.
+ */
+ inline virtual FTGlyph* MakeGlyph( unsigned int g);
+
+};
+
+
+#endif // __FTGLPolygonFont__
+
diff --git a/extern/bFTGL/include/FTGLTextureFont.h b/extern/bFTGL/include/FTGLTextureFont.h
new file mode 100755
index 00000000000..f0575143f4b
--- /dev/null
+++ b/extern/bFTGL/include/FTGLTextureFont.h
@@ -0,0 +1,151 @@
+#ifndef __FTGLTextureFont__
+#define __FTGLTextureFont__
+
+#include "FTFont.h"
+#include "FTVector.h"
+#include "FTGL.h"
+
+class FTTextureGlyph;
+
+
+/**
+ * FTGLTextureFont is a specialisation of the FTFont class for handling
+ * Texture mapped fonts
+ *
+ * @see FTFont
+ */
+class FTGL_EXPORT FTGLTextureFont : public FTFont
+{
+ public:
+ /**
+ * Open and read a font file. Sets Error flag.
+ *
+ * @param fontname font file name.
+ */
+ FTGLTextureFont( const char* fontname);
+
+ /**
+ * Open and read a font from a buffer in memory. Sets Error flag.
+ *
+ * @param pBufferBytes the in-memory buffer
+ * @param bufferSizeInBytes the length of the buffer in bytes
+ */
+ FTGLTextureFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTGLTextureFont();
+
+ /**
+ * Set the char size for the current face.
+ *
+ * @param size the face size in points (1/72 inch)
+ * @param res the resolution of the target device.
+ * @return <code>true</code> if size was set correctly
+ */
+ virtual bool FaceSize( const unsigned int size, const unsigned int res = 72);
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string 'C' style string to be output.
+ */
+ virtual void Render( const char* string);
+
+ /**
+ * Renders a string of characters
+ *
+ * @param string wchar_t string to be output.
+ */
+ virtual void Render( const wchar_t* string);
+
+
+ private:
+ /**
+ * Construct a FTTextureGlyph.
+ *
+ * @param glyphIndex The glyph index NOT the char code.
+ * @return An FTTextureGlyph or <code>null</code> on failure.
+ */
+ inline virtual FTGlyph* MakeGlyph( unsigned int glyphIndex);
+
+ /**
+ * Get the size of a block of memory required to layout the glyphs
+ *
+ * Calculates a width and height based on the glyph sizes and the
+ * number of glyphs. It over estimates.
+ */
+ inline void CalculateTextureSize();
+
+ /**
+ * Creates a 'blank' OpenGL texture object.
+ *
+ * The format is GL_ALPHA and the params are
+ * GL_TEXTURE_WRAP_S = GL_CLAMP
+ * GL_TEXTURE_WRAP_T = GL_CLAMP
+ * GL_TEXTURE_MAG_FILTER = GL_LINEAR
+ * GL_TEXTURE_MIN_FILTER = GL_LINEAR
+ * Note that mipmapping is NOT used
+ */
+ inline GLuint CreateTexture();
+
+ /**
+ * The maximum texture dimension on this OpenGL implemetation
+ */
+ GLsizei maxTextSize;
+
+ /**
+ * The minimum texture width required to hold the glyphs
+ */
+ GLsizei textureWidth;
+
+ /**
+ * The minimum texture height required to hold the glyphs
+ */
+ GLsizei textureHeight;
+
+ /**
+ *An array of texture ids
+ */
+ FTVector<GLuint> textureIDList;
+
+ /**
+ * The max height for glyphs in the current font
+ */
+ int glyphHeight;
+
+ /**
+ * The max width for glyphs in the current font
+ */
+ int glyphWidth;
+
+ /**
+ * A value to be added to the height and width to ensure that
+ * glyphs don't overlap in the texture
+ */
+ unsigned int padding;
+
+ /**
+ *
+ */
+ unsigned int numGlyphs;
+
+ /**
+ */
+ unsigned int remGlyphs;
+
+ /**
+ */
+ int xOffset;
+
+ /**
+ */
+ int yOffset;
+
+};
+
+
+#endif // __FTGLTextureFont__
+
+
diff --git a/extern/bFTGL/include/FTGlyph.h b/extern/bFTGL/include/FTGlyph.h
new file mode 100755
index 00000000000..c38d51e728e
--- /dev/null
+++ b/extern/bFTGL/include/FTGlyph.h
@@ -0,0 +1,89 @@
+#ifndef __FTGlyph__
+#define __FTGlyph__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTBBox.h"
+#include "FTPoint.h"
+#include "FTGL.h"
+
+
+/**
+ * FTGlyph is the base class for FTGL glyphs.
+ *
+ * It provides the interface between Freetype glyphs and their openGL
+ * renderable counterparts. This is an abstract class and derived classes
+ * must implement the <code>render</code> function.
+ *
+ * @see FTGlyphContainer
+ * @see FTBBox
+ * @see FTPoint
+ *
+ */
+class FTGL_EXPORT FTGlyph
+{
+ public:
+ /**
+ * Constructor
+ */
+ FTGlyph( FT_GlyphSlot glyph);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTGlyph();
+
+ /**
+ * Renders this glyph at the current pen position.
+ *
+ * @param pen The current pen position.
+ * @return The advance distance for this glyph.
+ */
+ virtual float Render( const FTPoint& pen) = 0;
+
+ /**
+ * Return the advance width for this glyph.
+ *
+ * @return advance width.
+ */
+ float Advance() const { return advance;}
+
+ /**
+ * Return the bounding box for this glyph.
+ *
+ * @return bounding box.
+ */
+ const FTBBox& BBox() const { return bBox;}
+
+ /**
+ * Queries for errors.
+ *
+ * @return The current error code.
+ */
+ FT_Error Error() const { return err;}
+
+ protected:
+ /**
+ * The advance distance for this glyph
+ */
+ float advance;
+
+ /**
+ * The bounding box of this glyph.
+ */
+ FTBBox bBox;
+
+ /**
+ * Current error code. Zero means no error.
+ */
+ FT_Error err;
+
+ private:
+
+};
+
+
+#endif // __FTGlyph__
+
diff --git a/extern/bFTGL/include/FTGlyphContainer.h b/extern/bFTGL/include/FTGlyphContainer.h
new file mode 100755
index 00000000000..de668b61dbd
--- /dev/null
+++ b/extern/bFTGL/include/FTGlyphContainer.h
@@ -0,0 +1,127 @@
+#ifndef __FTGlyphContainer__
+#define __FTGlyphContainer__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+#include "FTBBox.h"
+#include "FTPoint.h"
+#include "FTVector.h"
+
+class FTFace;
+class FTGlyph;
+class FTCharmap;
+
+/**
+ * FTGlyphContainer holds the post processed FTGlyph objects.
+ *
+ * @see FTGlyph
+ */
+class FTGL_EXPORT FTGlyphContainer
+{
+ typedef FTVector<FTGlyph*> GlyphVector;
+ public:
+ /**
+ * Constructor
+ *
+ * @param face The Freetype face
+ */
+ FTGlyphContainer( FTFace* face);
+
+ /**
+ * Destructor
+ */
+ ~FTGlyphContainer();
+
+ /**
+ * Sets the character map for the face.
+ *
+ * @param encoding the Freetype encoding symbol. See above.
+ * @return <code>true</code> if charmap was valid
+ * and set correctly
+ */
+ bool CharMap( FT_Encoding encoding);
+
+ /**
+ * Get the font index of the input character.
+ *
+ * @param characterCode The character code of the requested glyph in the
+ * current encoding eg apple roman.
+ * @return The font index for the character.
+ */
+ unsigned int FontIndex( const unsigned int characterCode ) const;
+
+ /**
+ * Adds a glyph to this glyph list.
+ *
+ * @param glyph The FTGlyph to be inserted into the container
+ * @param characterCode The char code of the glyph NOT the glyph index.
+ */
+ void Add( FTGlyph* glyph, const unsigned int characterCode);
+
+ /**
+ * Get a glyph from the glyph list
+ *
+ * @param characterCode The char code of the glyph NOT the glyph index
+ * @return An FTGlyph or <code>null</code> is it hasn't been
+ * loaded.
+ */
+ const FTGlyph* const Glyph( const unsigned int characterCode) const;
+
+ /**
+ * Get the bounding box for a character.
+ * @param characterCode The char code of the glyph NOT the glyph index
+ */
+ FTBBox BBox( const unsigned int characterCode) const;
+
+ /**
+ * Returns the kerned advance width for a glyph.
+ *
+ * @param characterCode glyph index of the character
+ * @param nextCharacterCode the next glyph in a string
+ * @return advance width
+ */
+ float Advance( const unsigned int characterCode, const unsigned int nextCharacterCode);
+
+ /**
+ * Renders a character
+ * @param characterCode the glyph to be Rendered
+ * @param nextCharacterCode the next glyph in the string. Used for kerning.
+ * @param penPosition the position to Render the glyph
+ * @return The distance to advance the pen position after Rendering
+ */
+ FTPoint Render( const unsigned int characterCode, const unsigned int nextCharacterCode, FTPoint penPosition);
+
+ /**
+ * Queries the Font for errors.
+ *
+ * @return The current error code.
+ */
+ FT_Error Error() const { return err;}
+
+ private:
+ /**
+ * The FTGL face
+ */
+ FTFace* face;
+
+ /**
+ * The Character Map object associated with the current face
+ */
+ FTCharmap* charMap;
+
+ /**
+ * A structure to hold the glyphs
+ */
+ GlyphVector glyphs;
+
+ /**
+ * Current error code. Zero means no error.
+ */
+ FT_Error err;
+};
+
+
+#endif // __FTGlyphContainer__
diff --git a/extern/bFTGL/include/FTLibrary.h b/extern/bFTGL/include/FTLibrary.h
new file mode 100755
index 00000000000..1e5ed6b1a08
--- /dev/null
+++ b/extern/bFTGL/include/FTLibrary.h
@@ -0,0 +1,97 @@
+#ifndef __FTLibrary__
+#define __FTLibrary__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+//#include FT_CACHE_H
+
+#include "FTGL.h"
+
+
+/**
+ * FTLibrary class is the global accessor for the Freetype library.
+ *
+ * This class encapsulates the Freetype Library. This is a singleton class
+ * and ensures that only one FT_Library is in existence at any one time.
+ * All constructors are private therefore clients cannot create or
+ * instantiate this class themselves and must access it's methods via the
+ * static <code>FTLibrary::Instance()</code> function.
+ *
+ * Just because this class returns a valid <code>FTLibrary</code> object
+ * doesn't mean that the Freetype Library has been successfully initialised.
+ * Clients should check for errors. You can initialse the library AND check
+ * for errors using the following code...
+ * <code>err = FTLibrary::Instance().Error();</code>
+ *
+ * @see "Freetype 2 Documentation"
+ *
+ */
+class FTGL_EXPORT FTLibrary
+{
+ public:
+ /**
+ * Global acces point to the single FTLibrary object.
+ *
+ * @return The global <code>FTLibrary</code> object.
+ */
+ static FTLibrary& Instance();
+
+ /**
+ * Gets a pointer to the native Freetype library.
+ *
+ * @return A handle to a FreeType library instance.
+ */
+ const FT_Library* const GetLibrary() const { return library;}
+
+ /**
+ * Queries the library for errors.
+ *
+ * @return The current error code.
+ */
+ FT_Error Error() const { return err;}
+
+ /**
+ * Destructor
+ *
+ * Disposes of the Freetype library
+ */
+ ~FTLibrary();
+
+ private:
+ /**
+ * Default constructors.
+ *
+ * Made private to stop clients creating there own FTLibrary
+ * objects.
+ */
+ FTLibrary();
+ FTLibrary( const FT_Library&){}
+ FTLibrary& operator=( const FT_Library&) { return *this; }
+
+ /**
+ * Initialises the Freetype library
+ *
+ * Even though this function indicates success via the return value,
+ * clients can't see this so must check the error codes. This function
+ * is only ever called by the default c_stor
+ *
+ * @return <code>true</code> if the Freetype library was
+ * successfully initialised, <code>false</code>
+ * otherwise.
+ */
+ bool Initialise();
+
+ /**
+ * Freetype library handle.
+ */
+ FT_Library* library;
+// FTC_Manager* manager;
+
+ /**
+ * Current error code. Zero means no error.
+ */
+ FT_Error err;
+
+};
+
+#endif // __FTLibrary__
diff --git a/extern/bFTGL/include/FTList.h b/extern/bFTGL/include/FTList.h
new file mode 100644
index 00000000000..34992168103
--- /dev/null
+++ b/extern/bFTGL/include/FTList.h
@@ -0,0 +1,112 @@
+#ifndef __FTList__
+#define __FTList__
+
+#include "FTGL.h"
+
+/**
+* Provides a non-STL alternative to the STL list
+ */
+template <typename FT_LIST_ITEM_TYPE>
+class FTGL_EXPORT FTList
+{
+ public:
+ typedef FT_LIST_ITEM_TYPE value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+
+ /**
+ * Constructor
+ */
+ FTList()
+ : listSize(0),
+ tail(0)
+ {
+ tail = NULL;
+ head = new Node;
+ }
+
+ /**
+ * Destructor
+ */
+ ~FTList()
+ {
+ Node* next;
+
+ for( Node *walk = head; walk; walk = next)
+ {
+ next = walk->next;
+ delete walk;
+ }
+ }
+
+ /**
+ * Get the number of items in the list
+ */
+ size_type size() const
+ {
+ return listSize;
+ }
+
+ /**
+ * Add an item to the end of the list
+ */
+ void push_back( const value_type& item)
+ {
+ Node* node = new Node( item);
+
+ if( head->next == NULL)
+ {
+ head->next = node;
+ }
+
+ if( tail)
+ {
+ tail->next = node;
+ }
+ tail = node;
+ ++listSize;
+ }
+
+ /**
+ * Get the item at the front of the list
+ */
+ reference front() const
+ {
+ return head->next->payload;
+ }
+
+ /**
+ * Get the item at the end of the list
+ */
+ reference back() const
+ {
+ return tail->payload;
+ }
+
+ private:
+ struct Node
+ {
+ Node()
+ : next(NULL)
+ {}
+
+ Node( const value_type& item)
+ : next(NULL)
+ {
+ payload = item;
+ }
+
+ Node* next;
+
+ value_type payload;
+ };
+
+ size_type listSize;
+
+ Node* head;
+ Node* tail;
+};
+
+#endif // __FTList__
+
diff --git a/extern/bFTGL/include/FTOutlineGlyph.h b/extern/bFTGL/include/FTOutlineGlyph.h
new file mode 100644
index 00000000000..7dd0ba042b9
--- /dev/null
+++ b/extern/bFTGL/include/FTOutlineGlyph.h
@@ -0,0 +1,54 @@
+#ifndef __FTOutlineGlyph__
+#define __FTOutlineGlyph__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+#include "FTGlyph.h"
+
+class FTVectoriser;
+
+
+/**
+ * FTOutlineGlyph is a specialisation of FTGlyph for creating outlines.
+ *
+ * @see FTGlyphContainer
+ * @see FTVectoriser
+ *
+ */
+class FTGL_EXPORT FTOutlineGlyph : public FTGlyph
+{
+ public:
+ /**
+ * Constructor. Sets the Error to Invalid_Outline if the glyphs isn't an outline.
+ *
+ * @param glyph The Freetype glyph to be processed
+ */
+ FTOutlineGlyph( FT_GlyphSlot glyph);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTOutlineGlyph();
+
+ /**
+ * Renders this glyph at the current pen position.
+ *
+ * @param pen The current pen position.
+ * @return The advance distance for this glyph.
+ */
+ virtual float Render( const FTPoint& pen);
+
+ private:
+ /**
+ * OpenGL display list
+ */
+ GLuint glList;
+
+};
+
+
+#endif // __FTOutlineGlyph__
+
diff --git a/extern/bFTGL/include/FTPixmapGlyph.h b/extern/bFTGL/include/FTPixmapGlyph.h
new file mode 100755
index 00000000000..9d43d6c58b3
--- /dev/null
+++ b/extern/bFTGL/include/FTPixmapGlyph.h
@@ -0,0 +1,68 @@
+#ifndef __FTPixmapGlyph__
+#define __FTPixmapGlyph__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+#include "FTGlyph.h"
+
+
+/**
+ * FTPixmapGlyph is a specialisation of FTGlyph for creating pixmaps.
+ *
+ * @see FTGlyphContainer
+ *
+ */
+class FTGL_EXPORT FTPixmapGlyph : public FTGlyph
+{
+ public:
+ /**
+ * Constructor
+ *
+ * @param glyph The Freetype glyph to be processed
+ */
+ FTPixmapGlyph( FT_GlyphSlot glyph);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTPixmapGlyph();
+
+ /**
+ * Renders this glyph at the current pen position.
+ *
+ * @param pen The current pen position.
+ * @return The advance distance for this glyph.
+ */
+ virtual float Render( const FTPoint& pen);
+
+ // attributes
+
+ private:
+ /**
+ * The width of the glyph 'image'
+ */
+ int destWidth;
+
+ /**
+ * The height of the glyph 'image'
+ */
+ int destHeight;
+
+ /**
+ * Vector from the pen position to the topleft corner of the pixmap
+ */
+ FTPoint pos;
+
+ /**
+ * Pointer to the 'image' data
+ */
+ unsigned char* data;
+
+};
+
+
+#endif // __FTPixmapGlyph__
diff --git a/extern/bFTGL/include/FTPoint.h b/extern/bFTGL/include/FTPoint.h
new file mode 100755
index 00000000000..bb1772c4c18
--- /dev/null
+++ b/extern/bFTGL/include/FTPoint.h
@@ -0,0 +1,85 @@
+#ifndef __FTPoint__
+#define __FTPoint__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+
+/**
+ * FTPoint class is a basic 3 dimensional point or vector.
+ */
+class FTGL_EXPORT FTPoint
+{
+ public:
+ /**
+ * Default constructor. Point is set to zero.
+ */
+ FTPoint()
+ : x(0), y(0), z(0)
+ {}
+
+ /**
+ * Constructor.
+ *
+ * @param X
+ * @param Y
+ * @param Z
+ */
+ FTPoint( const FTGL_DOUBLE X, const FTGL_DOUBLE Y, const FTGL_DOUBLE Z)
+ : x(X), y(Y), z(Z)
+ {}
+
+ /**
+ * Constructor. This converts an FT_Vector to an FT_Point
+ *
+ * @param ft_vector A freetype vector
+ */
+ FTPoint( const FT_Vector& ft_vector)
+ : x(ft_vector.x), y(ft_vector.y), z(0)
+ {}
+
+ /**
+ * Operator +=
+ *
+ * @param point
+ * @return this plus point.
+ */
+ FTPoint& operator += ( const FTPoint& point)
+ {
+ x += point.x;
+ y += point.y;
+ z += point.z;
+
+ return *this;
+ }
+
+ /**
+ * Operator == Tests for eqaulity
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ friend bool operator == ( const FTPoint &a, const FTPoint &b);
+
+ /**
+ * Operator != Tests for non equality
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ friend bool operator != ( const FTPoint &a, const FTPoint &b);
+
+ /**
+ * The point data
+ */
+ FTGL_DOUBLE x, y, z; // FIXME make private
+
+ private:
+};
+
+#endif // __FTPoint__
+
diff --git a/extern/bFTGL/include/FTPolyGlyph.h b/extern/bFTGL/include/FTPolyGlyph.h
new file mode 100644
index 00000000000..c8faeffceb6
--- /dev/null
+++ b/extern/bFTGL/include/FTPolyGlyph.h
@@ -0,0 +1,55 @@
+#ifndef __FTPolyGlyph__
+#define __FTPolyGlyph__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+#include "FTGlyph.h"
+
+class FTVectoriser;
+
+/**
+ * FTPolyGlyph is a specialisation of FTGlyph for creating tessellated
+ * polygon glyphs.
+ *
+ * @see FTGlyphContainer
+ * @see FTVectoriser
+ *
+ */
+class FTGL_EXPORT FTPolyGlyph : public FTGlyph
+{
+ public:
+ /**
+ * Constructor. Sets the Error to Invalid_Outline if the glyphs isn't an outline.
+ *
+ * @param glyph The Freetype glyph to be processed
+ */
+ FTPolyGlyph( FT_GlyphSlot glyph);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTPolyGlyph();
+
+ /**
+ * Renders this glyph at the current pen position.
+ *
+ * @param pen The current pen position.
+ * @return The advance distance for this glyph.
+ */
+ virtual float Render( const FTPoint& pen);
+
+ private:
+ /**
+ * OpenGL display list
+ */
+ GLuint glList;
+
+};
+
+
+#endif // __FTPolyGlyph__
+
diff --git a/extern/bFTGL/include/FTSize.h b/extern/bFTGL/include/FTSize.h
new file mode 100755
index 00000000000..31f6bb66db1
--- /dev/null
+++ b/extern/bFTGL/include/FTSize.h
@@ -0,0 +1,132 @@
+#ifndef __FTSize__
+#define __FTSize__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#include "FTGL.h"
+
+
+
+/**
+ * FTSize class provides an abstraction layer for the Freetype Size.
+ *
+ * @see "Freetype 2 Documentation"
+ *
+ */
+class FTGL_EXPORT FTSize
+{
+ public:
+ /**
+ * Default Constructor
+ */
+ FTSize();
+
+ /**
+ * Destructor
+ */
+ virtual ~FTSize();
+
+ /**
+ * Sets the char size for the current face.
+ *
+ * This doesn't guarantee that the size was set correctly. Clients
+ * should check errors.
+ *
+ * @param face Parent face for this size object
+ * @param point_size the face size in points (1/72 inch)
+ * @param x_resolution the horizontal resolution of the target device.
+ * @param y_resolution the vertical resolution of the target device.
+ * @return <code>true</code> if the size has been set. Clients should check Error() for more information if this function returns false()
+ */
+ bool CharSize( FT_Face* face, unsigned int point_size, unsigned int x_resolution, unsigned int y_resolution);
+
+ /**
+ * get the char size for the current face.
+ *
+ * @return The char size in points
+ */
+ unsigned int CharSize() const;
+
+ /**
+ * Gets the global ascender height for the face in pixels.
+ *
+ * @return Ascender height
+ */
+ float Ascender() const;
+
+ /**
+ * Gets the global descender height for the face in pixels.
+ *
+ * @return Ascender height
+ */
+ float Descender() const;
+
+ /**
+ * Gets the global face height for the face.
+ *
+ * If the face is scalable this returns the height of the global
+ * bounding box which ensures that any glyph will be less than or
+ * equal to this height. If the font isn't scalable there is no
+ * guarantee that glyphs will not be taller than this value.
+ *
+ * @return height in pixels.
+ */
+ float Height() const;
+
+ /**
+ * Gets the global face width for the face.
+ *
+ * If the face is scalable this returns the width of the global
+ * bounding box which ensures that any glyph will be less than or
+ * equal to this width. If the font isn't scalable this value is
+ * the max_advance for the face.
+ *
+ * @return width in pixels.
+ */
+ float Width() const;
+
+ /**
+ * Gets the underline position for the face.
+ *
+ * @return underline position in pixels
+ */
+ float Underline() const;
+
+ unsigned int XPixelsPerEm() const;
+
+ unsigned int YPixelsPerEm() const;
+
+ /**
+ * Queries for errors.
+ *
+ * @return The current error code.
+ */
+ FT_Error Error() const { return err; }
+
+ private:
+ /**
+ * The current Freetype face that this FTSize object relates to.
+ */
+ FT_Face* ftFace;
+
+ /**
+ * The Freetype size.
+ */
+ FT_Size ftSize;
+
+ /**
+ * The size in points.
+ */
+ unsigned int size;
+
+ /**
+ * Current error code. Zero means no error.
+ */
+ FT_Error err;
+
+};
+
+#endif // __FTSize__
+
diff --git a/extern/bFTGL/include/FTTextureGlyph.h b/extern/bFTGL/include/FTTextureGlyph.h
new file mode 100755
index 00000000000..389e6f778da
--- /dev/null
+++ b/extern/bFTGL/include/FTTextureGlyph.h
@@ -0,0 +1,89 @@
+#ifndef __FTTextureGlyph__
+#define __FTTextureGlyph__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "FTGL.h"
+#include "FTGlyph.h"
+
+
+/**
+ * FTTextureGlyph is a specialisation of FTGlyph for creating texture
+ * glyphs.
+ *
+ * @see FTGlyphContainer
+ *
+ */
+class FTGL_EXPORT FTTextureGlyph : public FTGlyph
+{
+ public:
+ /**
+ * Constructor
+ *
+ * @param glyph The Freetype glyph to be processed
+ * @param id The id of the texture that this glyph will be
+ * drawn in
+ * @param xOffset The x offset into the parent texture to draw
+ * this glyph
+ * @param yOffset The y offset into the parent texture to draw
+ * this glyph
+ * @param width The width of the parent texture
+ * @param height The height (number of rows) of the parent texture
+ */
+ FTTextureGlyph( FT_GlyphSlot glyph, int id, int xOffset, int yOffset, GLsizei width, GLsizei height);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTTextureGlyph();
+
+ /**
+ * Renders this glyph at the current pen position.
+ *
+ * @param pen The current pen position.
+ * @return The advance distance for this glyph.
+ */
+ virtual float Render( const FTPoint& pen);
+
+ private:
+ /**
+ * The width of the glyph 'image'
+ */
+ int destWidth;
+
+ /**
+ * The height of the glyph 'image'
+ */
+ int destHeight;
+
+ /**
+ * Vector from the pen position to the topleft corner of the pixmap
+ */
+ FTPoint pos;
+
+ /**
+ * The texture co-ords of this glyph within the texture.
+ */
+ FTPoint uv[2];
+
+ /**
+ * The texture index that this glyph is contained in.
+ */
+ int glTextureID;
+
+ /**
+ * The texture index of the currently active texture
+ *
+ * We call glGetIntegerv( GL_TEXTURE_2D_BINDING, activeTextureID);
+ * to get the currently active texture to try to reduce the number
+ * of texture bind operations
+ */
+ GLint activeTextureID;
+
+};
+
+
+#endif // __FTTextureGlyph__
diff --git a/extern/bFTGL/include/FTVector.h b/extern/bFTGL/include/FTVector.h
new file mode 100644
index 00000000000..6147f522c08
--- /dev/null
+++ b/extern/bFTGL/include/FTVector.h
@@ -0,0 +1,190 @@
+#ifndef __FTVector__
+#define __FTVector__
+
+#include "FTGL.h"
+
+/**
+ * Provides a non-STL alternative to the STL vector
+ */
+template <typename FT_VECTOR_ITEM_TYPE>
+class FTGL_EXPORT FTVector
+{
+ public:
+ typedef FT_VECTOR_ITEM_TYPE value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef size_t size_type;
+
+ FTVector()
+ {
+ Capacity = Size = 0;
+ Items = 0;
+ }
+
+
+ virtual ~FTVector()
+ {
+ clear();
+ }
+
+ FTVector& operator =(const FTVector& v)
+ {
+ reserve(v.capacity());
+
+ iterator ptr = begin();
+ const_iterator vbegin = v.begin();
+ const_iterator vend = v.end();
+
+ while( vbegin != vend)
+ {
+ *ptr++ = *vbegin++;
+ }
+
+ Size = v.size();
+ return *this;
+ }
+
+ size_type size() const
+ {
+ return Size;
+ }
+
+ size_type capacity() const
+ {
+ return Capacity;
+ }
+
+ iterator begin()
+ {
+ return Items;
+ }
+
+ const_iterator begin() const
+ {
+ return Items;
+ }
+
+ iterator end()
+ {
+ return begin() + size();
+ }
+
+ const_iterator end() const
+ {
+ return begin() + size();
+ }
+
+ bool empty() const
+ {
+ return size() == 0;
+ }
+
+ reference operator [](size_type pos)
+ {
+ return( *(begin() + pos));
+ }
+
+ const_reference operator []( size_type pos) const
+ {
+ return( *(begin() + pos));
+ }
+
+ void clear()
+ {
+ if( Capacity)
+ {
+ delete [] Items;
+ Capacity = Size = 0;
+ Items = 0;
+ }
+ }
+
+ void reserve( size_type n)
+ {
+ if( capacity() < n)
+ {
+ expand(n);
+ }
+ }
+
+ void push_back(const value_type& x)
+ {
+ if( size() == capacity())
+ {
+ expand();
+ }
+
+ ( *this)[size()] = x;
+ ++Size;
+ }
+
+ void resize(size_type n, value_type x)
+ {
+ if( n == size())
+ {
+ return;
+ }
+
+ reserve(n);
+ iterator begin, end;
+
+ if( n >= Size)
+ {
+ begin = this->end();
+ end = this->begin() + n;
+ }
+ else
+ {
+ begin = this->begin() + n;
+ end = this->end();
+ }
+
+ while( begin != end)
+ {
+ *begin++ = x;
+ }
+
+ Size = n;
+ }
+
+
+ private:
+ void expand(size_type capacity_hint = 0)
+ {
+ size_type new_capacity =( capacity() == 0) ? 256 : capacity()* 2;
+ if( capacity_hint)
+ {
+ while( new_capacity < capacity_hint)
+ {
+ new_capacity *= 2;
+ }
+ }
+
+ value_type *new_items = new value_type[new_capacity];
+
+ iterator begin = this->begin();
+ iterator end = this->end();
+ value_type *ptr = new_items;
+
+ while( begin != end)
+ {
+ *ptr++ = *begin++;
+ }
+
+ if( Capacity)
+ {
+ delete [] Items;
+ }
+
+ Items = new_items;
+ Capacity = new_capacity;
+ }
+
+ size_type Capacity;
+ size_type Size;
+ value_type* Items;
+};
+
+#endif // __FTVector__
diff --git a/extern/bFTGL/include/FTVectoriser.h b/extern/bFTGL/include/FTVectoriser.h
new file mode 100644
index 00000000000..7150560ce07
--- /dev/null
+++ b/extern/bFTGL/include/FTVectoriser.h
@@ -0,0 +1,275 @@
+#ifndef __FTVectoriser__
+#define __FTVectoriser__
+
+
+#include "FTContour.h"
+#include "FTList.h"
+#include "FTPoint.h"
+#include "FTVector.h"
+#include "FTGL.h"
+
+
+#ifndef CALLBACK
+#define CALLBACK
+#endif
+
+
+/**
+ * FTTesselation captures points that are output by OpenGL's gluTesselator.
+ */
+class FTGL_EXPORT FTTesselation
+{
+ public:
+ /**
+ * Default constructor
+ */
+ FTTesselation( GLenum m)
+ : meshType(m)
+ {
+ pointList.reserve( 128);
+ }
+
+ /**
+ * Destructor
+ */
+ ~FTTesselation()
+ {
+ pointList.clear();
+ }
+
+ /**
+ * Add a point to the mesh.
+ */
+ void AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z)
+ {
+ pointList.push_back( FTPoint( x, y, z));
+ }
+
+ /**
+ * The number of points in this mesh
+ */
+ size_t PointCount() const { return pointList.size();}
+
+ /**
+ *
+ */
+ const FTPoint& Point( unsigned int index) const { return pointList[index];}
+
+ /**
+ * Return the OpenGL polygon type.
+ */
+ GLenum PolygonType() const { return meshType;}
+
+ private:
+ /**
+ * Points generated by gluTesselator.
+ */
+ typedef FTVector<FTPoint> PointVector;
+ PointVector pointList;
+
+ /**
+ * OpenGL primitive type from gluTesselator.
+ */
+ GLenum meshType;
+};
+
+
+/**
+ * FTMesh is a container of FTTesselation's that make up a polygon glyph
+ */
+class FTGL_EXPORT FTMesh
+{
+ typedef FTVector<FTTesselation*> TesselationVector;
+ typedef FTList<FTPoint> PointList;
+
+ public:
+ /**
+ * Default constructor
+ */
+ FTMesh();
+
+ /**
+ * Destructor
+ */
+ ~FTMesh();
+
+ /**
+ *
+ */
+ void AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
+
+ /**
+ *
+ */
+ FTGL_DOUBLE* Combine( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
+
+ /**
+ *
+ */
+ void Begin( GLenum meshType);
+
+ /**
+ *
+ */
+ void End();
+
+ /**
+ *
+ */
+ void Error( GLenum e) { err = e;}
+
+ /**
+ *
+ */
+ unsigned int TesselationCount() const { return tesselationList.size();}
+
+ /**
+ *
+ */
+ const FTTesselation* const Tesselation( unsigned int index) const;
+
+ /**
+ *
+ */
+ const PointList& TempPointList() const { return tempPointList;}
+
+ /**
+ * Get the GL ERROR returned by the glu tesselator
+ */
+ GLenum Error() const { return err;}
+
+ private:
+ /**
+ * The current sub mesh that we are constructing.
+ */
+ FTTesselation* currentTesselation;
+
+ /**
+ * Holds each sub mesh that comprises this glyph.
+ */
+ TesselationVector tesselationList;
+
+ /**
+ * Holds extra points created by gluTesselator. See ftglCombine.
+ */
+ PointList tempPointList;
+
+ /**
+ * GL ERROR returned by the glu tesselator
+ */
+ GLenum err;
+
+};
+
+const FTGL_DOUBLE FTGL_FRONT_FACING = 1.0;
+const FTGL_DOUBLE FTGL_BACK_FACING = -1.0;
+
+/**
+ * FTVectoriser class is a helper class that converts font outlines into
+ * point data.
+ *
+ * @see FTExtrdGlyph
+ * @see FTOutlineGlyph
+ * @see FTPolyGlyph
+ * @see FTContour
+ * @see FTPoint
+ *
+ */
+class FTGL_EXPORT FTVectoriser
+{
+ public:
+ /**
+ * Constructor
+ *
+ * @param glyph The freetype glyph to be processed
+ */
+ FTVectoriser( const FT_GlyphSlot glyph);
+
+ /**
+ * Destructor
+ */
+ virtual ~FTVectoriser();
+
+ /**
+ * Build an FTMesh from the vector outline data.
+ *
+ * @param zNormal The direction of the z axis of the normal
+ * for this mesh
+ */
+ void MakeMesh( FTGL_DOUBLE zNormal = FTGL_FRONT_FACING);
+
+ /**
+ * Get the current mesh.
+ */
+ const FTMesh* const GetMesh() const { return mesh;}
+
+ /**
+ * Get the total count of points in this outline
+ *
+ * @return the number of points
+ */
+ size_t PointCount();
+
+ /**
+ * Get the count of contours in this outline
+ *
+ * @return the number of contours
+ */
+ size_t ContourCount() const { return ftContourCount;}
+
+ /**
+ * Return a contour at index
+ *
+ * @return the number of contours
+ */
+ const FTContour* const Contour( unsigned int index) const;
+
+ /**
+ * Get the number of points in a specific contour in this outline
+ *
+ * @param c The contour index
+ * @return the number of points in contour[c]
+ */
+ size_t ContourSize( int c) const { return contourList[c]->PointCount();}
+
+ /**
+ * Get the flag for the tesselation rule for this outline
+ *
+ * @return The contour flag
+ */
+ int ContourFlag() const { return contourFlag;}
+
+ private:
+ /**
+ * Process the freetype outline data into contours of points
+ */
+ void ProcessContours();
+
+ /**
+ * The list of contours in the glyph
+ */
+ FTContour** contourList;
+
+ /**
+ * A Mesh for tesselations
+ */
+ FTMesh* mesh;
+
+ /**
+ * The number of contours reported by Freetype
+ */
+ short ftContourCount;
+
+ /**
+ * A flag indicating the tesselation rule for the glyph
+ */
+ int contourFlag;
+
+ /**
+ * A Freetype outline
+ */
+ FT_Outline outline;
+};
+
+
+#endif // __FTVectoriser__