Commit f11669c0ad155be2af3fa65a1421c757f0a715b8

henry 2002-11-28T08:00:02

Changed FT_Vector to FTPoint

diff --git a/include/FTBitmapGlyph.h b/include/FTBitmapGlyph.h
index 87cba9d..a06727e 100755
--- a/include/FTBitmapGlyph.h
+++ b/include/FTBitmapGlyph.h
@@ -7,7 +7,7 @@
 #include FT_GLYPH_H
 
 #include "FTGL.h"
-#include    "FTGlyph.h"
+#include "FTGlyph.h"
 
 
 /**
@@ -41,7 +41,7 @@ class FTGL_EXPORT FTBitmapGlyph : public FTGlyph
          * @param pen   The current pen position.
          * @return      The advance distance for this glyph.
          */
-        virtual float Render( const FT_Vector& pen);
+        virtual float Render( const FTPoint& pen);
         
     private:
         /**
diff --git a/include/FTExtrdGlyph.h b/include/FTExtrdGlyph.h
index 3609b5b..28d607e 100644
--- a/include/FTExtrdGlyph.h
+++ b/include/FTExtrdGlyph.h
@@ -40,7 +40,7 @@ class FTGL_EXPORT FTExtrdGlyph : public FTGlyph
          * @param pen   The current pen position.
          * @return      The advance distance for this glyph.
          */
-        virtual float Render( const FT_Vector& pen);
+        virtual float Render( const FTPoint& pen);
         
     private:
         /**
diff --git a/include/FTGlyph.h b/include/FTGlyph.h
index 0ab2272..c2cd741 100755
--- a/include/FTGlyph.h
+++ b/include/FTGlyph.h
@@ -5,62 +5,12 @@
 #include FT_FREETYPE_H
 #include FT_GLYPH_H
 
+#include "FTBBox.h"
+#include "FTPoint.h"
 #include "FTGL.h"
 
 
 /**
- * FTBBox
- *
- *
- */
-class FTGL_EXPORT FTBBox
-{
-    public:
-        FTBBox()
-        :   x1(0),
-            y1(0),
-            z1(0),
-            x2(0),
-            y2(0),
-            z2(0)
-        {}
-        
-        FTBBox( FT_Glyph glyph)
-        {
-            FT_BBox bbox;
-            FT_Glyph_Get_CBox( glyph, ft_glyph_bbox_subpixels, &bbox );
-            
-            x1 = bbox.xMin >> 6;
-            y1 = bbox.yMin >> 6;
-            z1 = 0;
-            x2 = bbox.xMax >> 6;
-            y2 = bbox.yMax >> 6;
-            z2 = 0; 
-        }       
-        
-        FTBBox( int a, int b, int c, int d, int e, int f)
-        :   x1(a),
-            y1(b),
-            z1(c),
-            x2(d),
-            y2(e),
-            z2(f)
-        {}
-
-        ~FTBBox()
-        {}
-    
-        // Make these ftPoints
-        float x1, y1, z1, x2, y2, z2;
-
-    protected:
-    
-    
-    private:
-};
-
-
-/**
  * FTGlyph is the base class for FTGL glyphs.
  *
  * It provides the interface between Freetype glyphs and their openGL
@@ -89,7 +39,7 @@ class FTGL_EXPORT FTGlyph
          * @param pen   The current pen position.
          * @return      The advance distance for this glyph.
          */
-        virtual float Render( const FT_Vector& pen) = 0;
+        virtual float Render( const FTPoint& pen) = 0;
         
         /**
          * Return the advance width for this glyph.
@@ -122,7 +72,6 @@ class FTGL_EXPORT FTGlyph
          * Vector from the pen position to the topleft corner of the glyph
          */
         FT_Vector pos;
-
         
         /**
          * A freetype bounding box
diff --git a/include/FTOutlineGlyph.h b/include/FTOutlineGlyph.h
index bcc3e67..d5b9ec8 100644
--- a/include/FTOutlineGlyph.h
+++ b/include/FTOutlineGlyph.h
@@ -39,7 +39,7 @@ class FTGL_EXPORT FTOutlineGlyph : public FTGlyph
 		 * @param pen	The current pen position.
 		 * @return		The advance distance for this glyph.
 		 */
-		virtual float Render( const FT_Vector& pen);
+		virtual float Render( const FTPoint& pen);
 		
 	private:
 		/**
diff --git a/include/FTPixmapGlyph.h b/include/FTPixmapGlyph.h
index abbee4f..550e874 100755
--- a/include/FTPixmapGlyph.h
+++ b/include/FTPixmapGlyph.h
@@ -37,7 +37,7 @@ class  FTGL_EXPORT FTPixmapGlyph : public FTGlyph
          * @param pen   The current pen position.
          * @return      The advance distance for this glyph.
          */
-        virtual float Render( const FT_Vector& pen);
+        virtual float Render( const FTPoint& pen);
         
         // attributes
 
diff --git a/include/FTPolyGlyph.h b/include/FTPolyGlyph.h
index 2a38eb2..cdb6547 100644
--- a/include/FTPolyGlyph.h
+++ b/include/FTPolyGlyph.h
@@ -40,7 +40,7 @@ class FTGL_EXPORT FTPolyGlyph : public FTGlyph
          * @param pen   The current pen position.
          * @return      The advance distance for this glyph.
          */
-        virtual float Render( const FT_Vector& pen);
+        virtual float Render( const FTPoint& pen);
         
     private:
         /**
diff --git a/include/FTTextureGlyph.h b/include/FTTextureGlyph.h
index 15038b8..0dfd9d3 100755
--- a/include/FTTextureGlyph.h
+++ b/include/FTTextureGlyph.h
@@ -24,7 +24,7 @@ class FTGL_EXPORT FTTextureGlyph : public FTGlyph
          * Constructor
          *
          * @param glyph     The Freetype glyph to be processed
-         * @param id        The id the texture that this glyph will be
+         * @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
@@ -46,7 +46,7 @@ class FTGL_EXPORT FTTextureGlyph : public FTGlyph
          * @param pen   The current pen position.
          * @return      The advance distance for this glyph.
          */
-        virtual float Render( const FT_Vector& pen);
+        virtual float Render( const FTPoint& pen);
         
     private:
         /**
@@ -65,15 +65,6 @@ class FTGL_EXPORT FTTextureGlyph : public FTGlyph
         int numGreys;
         
         /**
-         * A structure to hold the uv co-ords.
-         */
-        struct FTPoint
-        {
-            float x;
-            float y;
-        };
-
-        /**
          * The texture co-ords of this glyph within the texture.
          */
         FTPoint uv[2];
diff --git a/src/FTBitmapGlyph.cpp b/src/FTBitmapGlyph.cpp
index 612f60e..a75af68 100755
--- a/src/FTBitmapGlyph.cpp
+++ b/src/FTBitmapGlyph.cpp
@@ -58,12 +58,11 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
 
 FTBitmapGlyph::~FTBitmapGlyph()
 {
-    if( data)
-        delete [] data;
+    delete [] data;
 }
 
 
-float FTBitmapGlyph::Render( const FT_Vector& pen)
+float FTBitmapGlyph::Render( const FTPoint& pen)
 {
     if( data)
     {
diff --git a/src/FTExtrdGlyph.cpp b/src/FTExtrdGlyph.cpp
index 3ec6226..2502aad 100644
--- a/src/FTExtrdGlyph.cpp
+++ b/src/FTExtrdGlyph.cpp
@@ -23,7 +23,7 @@ FTExtrdGlyph::FTExtrdGlyph( FT_Glyph glyph, float d)
     vectoriser->MakeMesh( 1.0);
     
     bBox = FTBBox( glyph);
-    bBox.z2 = -depth;
+    bBox.upperZ = -depth;
     advance = glyph->advance.x >> 16;
     
     int numPoints = vectoriser->MeshPoints();
@@ -204,13 +204,13 @@ bool FTExtrdGlyph::Winding( int numPoints, FTGL_DOUBLE *points)
 }
 
 
-float FTExtrdGlyph::Render( const FT_Vector& pen)
+float FTExtrdGlyph::Render( const FTPoint& pen)
 {
     if( glList)
     {
-        glTranslatef( pen.x, pen.y, 0.0f);
+        glTranslatef( pen.x, pen.y, 0);
             glCallList( glList);    
-        glTranslatef( -pen.x, -pen.y, 0.0f);
+        glTranslatef( -pen.x, -pen.y, 0);
     }
     
     return advance;
diff --git a/src/FTGlyph.cpp b/src/FTGlyph.cpp
index 8501d55..c3bf403 100755
--- a/src/FTGlyph.cpp
+++ b/src/FTGlyph.cpp
@@ -2,12 +2,9 @@
 
 
 FTGlyph::FTGlyph()
-:   advance(0),
+:   advance(0.0f),
     err(0)  
-{
-    pos.x = 0;
-    pos.y = 0;
-}
+{}
 
 
 FTGlyph::~FTGlyph()
diff --git a/src/FTOutlineGlyph.cpp b/src/FTOutlineGlyph.cpp
index 29dc9c9..b3766b4 100644
--- a/src/FTOutlineGlyph.cpp
+++ b/src/FTOutlineGlyph.cpp
@@ -73,13 +73,13 @@ FTOutlineGlyph::~FTOutlineGlyph()
 }
 
 
-float FTOutlineGlyph::Render( const FT_Vector& pen)
+float FTOutlineGlyph::Render( const FTPoint& pen)
 {
     if( glList)
     {
-        glTranslatef( pen.x, pen.y, 0.0f);
-        glCallList( glList);
-        glTranslatef( -pen.x, -pen.y, 0.0f);
+        glTranslatef( pen.x, pen.y, 0);
+            glCallList( glList);
+        glTranslatef( -pen.x, -pen.y, 0);
     }
     
     return advance;
diff --git a/src/FTPixmapGlyph.cpp b/src/FTPixmapGlyph.cpp
index dba7e6b..77c7a83 100755
--- a/src/FTPixmapGlyph.cpp
+++ b/src/FTPixmapGlyph.cpp
@@ -96,14 +96,14 @@ FTPixmapGlyph::~FTPixmapGlyph()
 }
 
 
-float FTPixmapGlyph::Render( const FT_Vector& pen)
+float FTPixmapGlyph::Render( const FTPoint& pen)
 {
     if( data)
     {
         // Move the glyph origin
         glBitmap( 0, 0, 0.0, 0.0, pen.x + pos.x, pen.y - pos.y, (const GLubyte*)0);
 
-        glPixelStorei( GL_UNPACK_ROW_LENGTH, destWidth);
+        glPixelStorei( GL_UNPACK_ROW_LENGTH, 0);
 
         glDrawPixels( destWidth, destHeight, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*)data);
         
diff --git a/src/FTPolyGlyph.cpp b/src/FTPolyGlyph.cpp
index 676b17a..d50a858 100644
--- a/src/FTPolyGlyph.cpp
+++ b/src/FTPolyGlyph.cpp
@@ -66,13 +66,13 @@ FTPolyGlyph::~FTPolyGlyph()
 {}
 
 
-float FTPolyGlyph::Render( const FT_Vector& pen)
+float FTPolyGlyph::Render( const FTPoint& pen)
 {
     if( glList)
     {
-        glTranslatef(  pen.x,  pen.y, 0.0f);
+        glTranslatef(  pen.x,  pen.y, 0);
         glCallList( glList);    
-        glTranslatef( -pen.x, -pen.y, 0.0f);
+        glTranslatef( -pen.x, -pen.y, 0);
     }
     
     return advance;
diff --git a/src/FTTextureGlyph.cpp b/src/FTTextureGlyph.cpp
index 9822308..f0c636b 100755
--- a/src/FTTextureGlyph.cpp
+++ b/src/FTTextureGlyph.cpp
@@ -27,8 +27,8 @@ FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, int id, int xOffset, int yOffset
     
     if( destWidth && destHeight)
     {
-        glPixelStorei( GL_UNPACK_ROW_LENGTH, 0);
         glBindTexture( GL_TEXTURE_2D, glTextureID);
+        glPixelStorei( GL_UNPACK_ROW_LENGTH, 0);
         glTexSubImage2D( GL_TEXTURE_2D, 0, xOffset, yOffset, destWidth, destHeight, GL_ALPHA, GL_UNSIGNED_BYTE, source->buffer);
     }
 
@@ -63,7 +63,7 @@ FTTextureGlyph::~FTTextureGlyph()
 {}
 
 
-float FTTextureGlyph::Render( const FT_Vector& pen)
+float FTTextureGlyph::Render( const FTPoint& pen)
 {
     glGetIntegerv( GL_TEXTURE_2D_BINDING_EXT, &activeTextureID);
     if( activeTextureID != glTextureID)