Changed FT_Vector to FTPoint
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
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)