Commit 59a0780e7c90cdb36e7735afd6d0e339cf4acd2e

henry 2003-09-25T03:55:19

Changed to use FTGlyphSlot internally instead of FTGlyph

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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
diff --git a/include/FTBBox.h b/include/FTBBox.h
index 4c524b7..5e68f14 100755
--- a/include/FTBBox.h
+++ b/include/FTBBox.h
@@ -45,10 +45,12 @@ class FTGL_EXPORT FTBBox
          *
          * @param glyph A freetype glyph
          */
-        FTBBox( FT_Glyph glyph)
+        FTBBox( FT_GlyphSlot glyph)
         {
             FT_BBox bbox;
-            FT_Glyph_Get_CBox( glyph, ft_glyph_bbox_subpixels, &bbox );
+            FT_Glyph glyphImage;
+            FT_Get_Glyph( glyph, &glyphImage ); // FIXME err
+            FT_Glyph_Get_CBox( glyphImage, ft_glyph_bbox_subpixels, &bbox );
             
             lowerX = static_cast<float>( bbox.xMin) / 64.0f;
             lowerY = static_cast<float>( bbox.yMin) / 64.0f;
diff --git a/include/FTBitmapGlyph.h b/include/FTBitmapGlyph.h
index ad88b00..89154a9 100755
--- a/include/FTBitmapGlyph.h
+++ b/include/FTBitmapGlyph.h
@@ -28,7 +28,7 @@ class FTGL_EXPORT FTBitmapGlyph : public FTGlyph
          *
          * @param glyph The Freetype glyph to be processed
          */
-        FTBitmapGlyph( FT_Glyph glyph);
+        FTBitmapGlyph( FT_GlyphSlot glyph);
 
         /**
          * Destructor
diff --git a/include/FTExtrdGlyph.h b/include/FTExtrdGlyph.h
index 15c3db1..01e7c9e 100644
--- a/include/FTExtrdGlyph.h
+++ b/include/FTExtrdGlyph.h
@@ -22,12 +22,12 @@ class FTGL_EXPORT FTExtrdGlyph : public FTGlyph
 {
     public:
         /**
-         * Constructor
+         * 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_Glyph glyph, float depth);
+        FTExtrdGlyph( FT_GlyphSlot glyph, float depth);
 
         /**
          * Destructor
diff --git a/include/FTFace.h b/include/FTFace.h
index 8c66f3e..e80963f 100755
--- a/include/FTFace.h
+++ b/include/FTFace.h
@@ -89,7 +89,7 @@ class FTGL_EXPORT FTFace
         /**
          * Loads and creates a Freetype glyph.
          */
-        FT_Glyph* Glyph( unsigned int index, FT_Int load_flags);
+        FT_GlyphSlot Glyph( unsigned int index, FT_Int load_flags);
 
         /**
          * Gets the number of glyphs in the current face.
@@ -115,11 +115,6 @@ class FTGL_EXPORT FTFace
         FTSize  charSize;
         
         /**
-         * Temporary variable to hold a glyph
-         */
-        FT_Glyph ftGlyph;
-
-        /**
          * The number of glyphs in this face
          */
         int numGlyphs;
diff --git a/include/FTGlyph.h b/include/FTGlyph.h
index ab2ec43..c38d51e 100755
--- a/include/FTGlyph.h
+++ b/include/FTGlyph.h
@@ -28,7 +28,7 @@ class FTGL_EXPORT FTGlyph
         /**
          * Constructor
          */
-        FTGlyph( FT_Glyph glyph);
+        FTGlyph( FT_GlyphSlot glyph);
 
         /**
          * Destructor
diff --git a/include/FTOutlineGlyph.h b/include/FTOutlineGlyph.h
index ba7aae1..7dd0ba0 100644
--- a/include/FTOutlineGlyph.h
+++ b/include/FTOutlineGlyph.h
@@ -20,32 +20,32 @@ class FTVectoriser;
  */
 class FTGL_EXPORT FTOutlineGlyph : public FTGlyph
 {
-	public:
-		/**
-		 * Constructor
-		 *
-		 * @param glyph The Freetype glyph to be processed
-		 */
-		FTOutlineGlyph( FT_Glyph 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;
+    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;
 	
 };
 
diff --git a/include/FTPixmapGlyph.h b/include/FTPixmapGlyph.h
index 52e9df9..9d43d6c 100755
--- a/include/FTPixmapGlyph.h
+++ b/include/FTPixmapGlyph.h
@@ -24,7 +24,7 @@ class  FTGL_EXPORT FTPixmapGlyph : public FTGlyph
          *
          * @param glyph The Freetype glyph to be processed
          */
-        FTPixmapGlyph( FT_Glyph glyph);
+        FTPixmapGlyph( FT_GlyphSlot glyph);
 
         /**
          * Destructor
diff --git a/include/FTPolyGlyph.h b/include/FTPolyGlyph.h
index d6229af..c8faeff 100644
--- a/include/FTPolyGlyph.h
+++ b/include/FTPolyGlyph.h
@@ -23,11 +23,11 @@ class FTGL_EXPORT FTPolyGlyph : public FTGlyph
 {
     public:
         /**
-         * Constructor
+         * Constructor. Sets the Error to Invalid_Outline if the glyphs isn't an outline.
          *
          * @param glyph The Freetype glyph to be processed
          */
-        FTPolyGlyph( FT_Glyph glyph);
+        FTPolyGlyph( FT_GlyphSlot glyph);
 
         /**
          * Destructor
diff --git a/include/FTTextureGlyph.h b/include/FTTextureGlyph.h
index 34be239..389e6f7 100755
--- a/include/FTTextureGlyph.h
+++ b/include/FTTextureGlyph.h
@@ -33,7 +33,7 @@ class FTGL_EXPORT FTTextureGlyph : public FTGlyph
          * @param width     The width of the parent texture
          * @param height    The height (number of rows) of the parent texture
          */
-        FTTextureGlyph( FT_Glyph glyph, int id, int xOffset, int yOffset, GLsizei width, GLsizei height);
+        FTTextureGlyph( FT_GlyphSlot glyph, int id, int xOffset, int yOffset, GLsizei width, GLsizei height);
 
         /**
          * Destructor
diff --git a/include/FTVectoriser.h b/include/FTVectoriser.h
index 4223d1c..3dde245 100644
--- a/include/FTVectoriser.h
+++ b/include/FTVectoriser.h
@@ -182,7 +182,7 @@ class FTGL_EXPORT FTVectoriser
          *
          * @param glyph The freetype glyph to be processed
          */
-        FTVectoriser( const FT_Glyph glyph);
+        FTVectoriser( const FT_GlyphSlot glyph);
 
         /**
          *  Destructor
@@ -267,7 +267,7 @@ class FTGL_EXPORT FTVectoriser
         /**
          * A Freetype outline
          */
-        FT_Outline ftOutline;
+        FT_Outline outline;
 };
 
 
diff --git a/src/FTBitmapGlyph.cpp b/src/FTBitmapGlyph.cpp
index 247ee21..5db33f1 100755
--- a/src/FTBitmapGlyph.cpp
+++ b/src/FTBitmapGlyph.cpp
@@ -2,24 +2,23 @@
 
 #include "FTBitmapGlyph.h"
 
-FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
+FTBitmapGlyph::FTBitmapGlyph( FT_GlyphSlot glyph)
 :   FTGlyph( glyph),
     destWidth(0),
     destHeight(0),
     data(0)
 {
-    err = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_MONO, 0, 1);
+    err = FT_Render_Glyph( glyph, FT_RENDER_MODE_MONO);
     if( err || ft_glyph_format_bitmap != glyph->format)
     {
         return;
     }
 
-    FT_BitmapGlyph  bitmap = (FT_BitmapGlyph)glyph;
-    FT_Bitmap*      source = &bitmap->bitmap;
+    FT_Bitmap bitmap = glyph->bitmap;
 
-    unsigned int srcWidth = source->width;
-    unsigned int srcHeight = source->rows;
-    unsigned int srcPitch = source->pitch;
+    unsigned int srcWidth = bitmap.width;
+    unsigned int srcHeight = bitmap.rows;
+    unsigned int srcPitch = bitmap.pitch;
     
     destWidth = srcWidth;
     destHeight = srcHeight;
@@ -30,7 +29,7 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
         data = new unsigned char[destPitch * destHeight];
         unsigned char* dest = data + (( destHeight - 1) * destPitch);
 
-        unsigned char* src = source->buffer;
+        unsigned char* src = bitmap.buffer;
 
         for( unsigned int y = 0; y < srcHeight; ++y)
         {
@@ -40,10 +39,8 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
         }
     }
     
-    pos.x = bitmap->left;
-    pos.y = static_cast<int>(srcHeight) - bitmap->top;
-    
-    FT_Done_Glyph( glyph );
+    pos.x = glyph->bitmap_left;
+    pos.y = static_cast<int>(srcHeight) - glyph->bitmap_top;
 }
 
 
diff --git a/src/FTExtrdGlyph.cpp b/src/FTExtrdGlyph.cpp
index bbcc08c..767f127 100644
--- a/src/FTExtrdGlyph.cpp
+++ b/src/FTExtrdGlyph.cpp
@@ -4,7 +4,7 @@
 #include    "FTVectoriser.h"
 
 
-FTExtrdGlyph::FTExtrdGlyph( FT_Glyph glyph, float d)
+FTExtrdGlyph::FTExtrdGlyph( FT_GlyphSlot glyph, float d)
 :   FTGlyph( glyph),
     glList(0),
     depth(d)
@@ -13,6 +13,7 @@ FTExtrdGlyph::FTExtrdGlyph( FT_Glyph glyph, float d)
         
     if( ft_glyph_format_outline != glyph->format)
     {
+        err = 0x14; // Invalid_Outline
         return;
     }
 
@@ -95,8 +96,6 @@ FTExtrdGlyph::FTExtrdGlyph( FT_Glyph glyph, float d)
         }
         
     glEndList();
-
-    FT_Done_Glyph( glyph); // Why does this have to be HERE
 }
 
 
diff --git a/src/FTFace.cpp b/src/FTFace.cpp
index 3d46a1f..d018144 100755
--- a/src/FTFace.cpp
+++ b/src/FTFace.cpp
@@ -119,20 +119,14 @@ FTPoint FTFace::KernAdvance( unsigned int index1, unsigned int index2)
 }
 
 
-FT_Glyph* FTFace::Glyph( unsigned int index, FT_Int load_flags)
+FT_GlyphSlot FTFace::Glyph( unsigned int index, FT_Int load_flags)
 {
     err = FT_Load_Glyph( *ftFace, index, load_flags);
     if( err)
     {
         return NULL;
     }
-    
-    err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
-    if( err)
-    {
-        return NULL;
-    }
 
-    return &ftGlyph;
+    return (*ftFace)->glyph;
 }
 
diff --git a/src/FTGLBitmapFont.cpp b/src/FTGLBitmapFont.cpp
index ddca168..7e982a6 100755
--- a/src/FTGLBitmapFont.cpp
+++ b/src/FTGLBitmapFont.cpp
@@ -18,11 +18,11 @@ FTGLBitmapFont::~FTGLBitmapFont()
 
 FTGlyph* FTGLBitmapFont::MakeGlyph( unsigned int g)
 {
-    FT_Glyph* ftGlyph = face.Glyph( g, FT_LOAD_DEFAULT);
+    FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_DEFAULT);
 
     if( ftGlyph)
     {
-        FTBitmapGlyph* tempGlyph = new FTBitmapGlyph( *ftGlyph);
+        FTBitmapGlyph* tempGlyph = new FTBitmapGlyph( ftGlyph);
         return tempGlyph;
     }
 
diff --git a/src/FTGLExtrdFont.cpp b/src/FTGLExtrdFont.cpp
index c29f158..37d8933 100644
--- a/src/FTGLExtrdFont.cpp
+++ b/src/FTGLExtrdFont.cpp
@@ -20,11 +20,11 @@ FTGLExtrdFont::~FTGLExtrdFont()
 
 FTGlyph* FTGLExtrdFont::MakeGlyph( unsigned int glyphIndex)
 {
-    FT_Glyph* ftGlyph = face.Glyph( glyphIndex, FT_LOAD_NO_HINTING);
+    FT_GlyphSlot ftGlyph = face.Glyph( glyphIndex, FT_LOAD_NO_HINTING);
 
     if( ftGlyph)
     {
-        FTExtrdGlyph* tempGlyph = new FTExtrdGlyph( *ftGlyph, depth);
+        FTExtrdGlyph* tempGlyph = new FTExtrdGlyph( ftGlyph, depth);
         return tempGlyph;
     }
 
diff --git a/src/FTGLOutlineFont.cpp b/src/FTGLOutlineFont.cpp
index f787b9c..b9fd187 100755
--- a/src/FTGLOutlineFont.cpp
+++ b/src/FTGLOutlineFont.cpp
@@ -18,11 +18,11 @@ FTGLOutlineFont::~FTGLOutlineFont()
 
 FTGlyph* FTGLOutlineFont::MakeGlyph( unsigned int g)
 {
-    FT_Glyph* ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
+    FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
 
     if( ftGlyph)
     {
-        FTOutlineGlyph* tempGlyph = new FTOutlineGlyph( *ftGlyph);
+        FTOutlineGlyph* tempGlyph = new FTOutlineGlyph( ftGlyph);
         return tempGlyph;
     }
 
diff --git a/src/FTGLPixmapFont.cpp b/src/FTGLPixmapFont.cpp
index a12208b..b287951 100755
--- a/src/FTGLPixmapFont.cpp
+++ b/src/FTGLPixmapFont.cpp
@@ -18,11 +18,11 @@ FTGLPixmapFont::~FTGLPixmapFont()
 
 FTGlyph* FTGLPixmapFont::MakeGlyph( unsigned int g)
 {
-    FT_Glyph* ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
+    FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
 
     if( ftGlyph)
     {
-        FTPixmapGlyph* tempGlyph = new FTPixmapGlyph( *ftGlyph);
+        FTPixmapGlyph* tempGlyph = new FTPixmapGlyph( ftGlyph);
         return tempGlyph;
     }
 
@@ -34,6 +34,7 @@ FTGlyph* FTGLPixmapFont::MakeGlyph( unsigned int g)
 void FTGLPixmapFont::Render( const char* string)
 {   
     glPushAttrib( GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
+    glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
 
     glEnable(GL_BLEND);
     glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -42,8 +43,8 @@ void FTGLPixmapFont::Render( const char* string)
 
     FTFont::Render( string);
 
+    glPopClientAttrib();
     glPopAttrib();
-
 }
 
 
@@ -61,7 +62,6 @@ void FTGLPixmapFont::Render( const wchar_t* string)
 
     glPopClientAttrib();
     glPopAttrib();
-
 }
 
 
diff --git a/src/FTGLPolygonFont.cpp b/src/FTGLPolygonFont.cpp
index 8fe9a0e..2d4dfa1 100755
--- a/src/FTGLPolygonFont.cpp
+++ b/src/FTGLPolygonFont.cpp
@@ -18,11 +18,11 @@ FTGLPolygonFont::~FTGLPolygonFont()
 
 FTGlyph* FTGLPolygonFont::MakeGlyph( unsigned int g)
 {
-    FT_Glyph* ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
+    FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
 
     if( ftGlyph)
     {
-        FTPolyGlyph* tempGlyph = new FTPolyGlyph( *ftGlyph);
+        FTPolyGlyph* tempGlyph = new FTPolyGlyph( ftGlyph);
         return tempGlyph;
     }
 
diff --git a/src/FTGLTextureFont.cpp b/src/FTGLTextureFont.cpp
index 5f2233d..fe7335e 100755
--- a/src/FTGLTextureFont.cpp
+++ b/src/FTGLTextureFont.cpp
@@ -58,7 +58,7 @@ FTGLTextureFont::~FTGLTextureFont()
 
 FTGlyph* FTGLTextureFont::MakeGlyph( unsigned int glyphIndex)
 {
-    FT_Glyph* ftGlyph = face.Glyph( glyphIndex, FT_LOAD_NO_HINTING);
+    FT_GlyphSlot ftGlyph = face.Glyph( glyphIndex, FT_LOAD_NO_HINTING);
     
     if( ftGlyph)
     {
@@ -85,7 +85,7 @@ FTGlyph* FTGLTextureFont::MakeGlyph( unsigned int glyphIndex)
             }
         }
         
-        FTTextureGlyph* tempGlyph = new FTTextureGlyph( *ftGlyph, glTextureID[numTextures - 1],
+        FTTextureGlyph* tempGlyph = new FTTextureGlyph( ftGlyph, glTextureID[numTextures - 1],
                                                         xOffset, yOffset, textureWidth, textureHeight);
         xOffset += static_cast<int>( tempGlyph->BBox().upperX - tempGlyph->BBox().lowerX + padding);
         
diff --git a/src/FTGlyph.cpp b/src/FTGlyph.cpp
index aa8a51e..c686329 100755
--- a/src/FTGlyph.cpp
+++ b/src/FTGlyph.cpp
@@ -1,14 +1,14 @@
 #include    "FTGlyph.h"
 
 
-FTGlyph::FTGlyph( FT_Glyph glyph)
+FTGlyph::FTGlyph( FT_GlyphSlot glyph)
 :   advance(0.0f),
     err(0)  
 {
     if( glyph)
     {
         bBox = FTBBox( glyph);
-        advance = static_cast<float>( glyph->advance.x) / 65536.0f;
+        advance = static_cast<float>( glyph->advance.x) / 64.0f;
     }
 }
 
diff --git a/src/FTOutlineGlyph.cpp b/src/FTOutlineGlyph.cpp
index c1fe64c..340c780 100644
--- a/src/FTOutlineGlyph.cpp
+++ b/src/FTOutlineGlyph.cpp
@@ -2,12 +2,13 @@
 #include    "FTVectoriser.h"
 
 
-FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph)
+FTOutlineGlyph::FTOutlineGlyph( FT_GlyphSlot glyph)
 :   FTGlyph( glyph),
     glList(0)
 {
     if( ft_glyph_format_outline != glyph->format)
     {
+        err = 0x14; // Invalid_Outline
         return;
     }
 
@@ -33,10 +34,6 @@ FTOutlineGlyph::FTOutlineGlyph( FT_Glyph glyph)
             glEnd();
         }
     glEndList();
-
-
-    // discard glyph image (bitmap or not)
-    FT_Done_Glyph( glyph); // Why does this have to be HERE
 }
 
 
diff --git a/src/FTPixmapGlyph.cpp b/src/FTPixmapGlyph.cpp
index 3daf57c..5b565b5 100755
--- a/src/FTPixmapGlyph.cpp
+++ b/src/FTPixmapGlyph.cpp
@@ -1,25 +1,24 @@
 #include    "FTPixmapGlyph.h"
 
-FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph)
+FTPixmapGlyph::FTPixmapGlyph( FT_GlyphSlot glyph)
 :   FTGlyph( glyph),
     destWidth(0),
     destHeight(0),
     data(0)
 {
-    err = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, 0, 1);
+    err = FT_Render_Glyph( glyph, FT_RENDER_MODE_NORMAL);
     if( err || ft_glyph_format_bitmap != glyph->format)
     {
         return;
     }
 
-    FT_BitmapGlyph  bitmap = (FT_BitmapGlyph)glyph;
-    FT_Bitmap*      source = &bitmap->bitmap;
+    FT_Bitmap bitmap = glyph->bitmap;
 
     //check the pixel mode
     //ft_pixel_mode_grays
         
-    int srcWidth = source->width;
-    int srcHeight = source->rows;
+    int srcWidth = bitmap.width;
+    int srcHeight = bitmap.rows;
     
    // FIXME What about dest alignment?
     destWidth = srcWidth;
@@ -37,7 +36,7 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph)
         unsigned char greenComponent = static_cast<unsigned char>( ftglColour[1] * 255.0f);
         unsigned char blueComponent =  static_cast<unsigned char>( ftglColour[2] * 255.0f);
 
-        unsigned char* src = source->buffer;
+        unsigned char* src = bitmap.buffer;
 
         unsigned char* dest = data + ((destHeight - 1) * destWidth) * 4;
         size_t destStep = destWidth * 4 * 2;
@@ -74,10 +73,8 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph)
         destHeight = srcHeight;
     }
 
-    pos.x = bitmap->left;
-    pos.y = srcHeight - bitmap->top;
-    
-    FT_Done_Glyph( glyph );
+    pos.x = glyph->bitmap_left;
+    pos.y = srcHeight - glyph->bitmap_top;
 }
 
 
diff --git a/src/FTPolyGlyph.cpp b/src/FTPolyGlyph.cpp
index fbd7cb2..7e0d695 100644
--- a/src/FTPolyGlyph.cpp
+++ b/src/FTPolyGlyph.cpp
@@ -2,12 +2,13 @@
 #include "FTVectoriser.h"
 
 
-FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph)
+FTPolyGlyph::FTPolyGlyph( FT_GlyphSlot glyph)
 :   FTGlyph( glyph),
     glList(0)
 {
     if( ft_glyph_format_outline != glyph->format)
     {
+        err = 0x14; // Invalid_Outline
         return;
     }
 
@@ -39,8 +40,6 @@ FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph)
             glEnd();
         }
     glEndList();
-
-    FT_Done_Glyph( glyph);
 }
 
 
diff --git a/src/FTTextureGlyph.cpp b/src/FTTextureGlyph.cpp
index ac044a3..4b29268 100755
--- a/src/FTTextureGlyph.cpp
+++ b/src/FTTextureGlyph.cpp
@@ -1,24 +1,23 @@
 #include    "FTTextureGlyph.h"
 
 
-FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, int id, int xOffset, int yOffset, GLsizei width, GLsizei height)
+FTTextureGlyph::FTTextureGlyph( FT_GlyphSlot glyph, int id, int xOffset, int yOffset, GLsizei width, GLsizei height)
 :   FTGlyph( glyph),
     destWidth(0),
     destHeight(0),
     glTextureID(id),
     activeTextureID(0)
 {
-    err = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, 0, 1);
+    err = FT_Render_Glyph( glyph, FT_RENDER_MODE_NORMAL);
     if( err || glyph->format != ft_glyph_format_bitmap)
     {
         return;
     }
 
-    FT_BitmapGlyph  bitmap = ( FT_BitmapGlyph)glyph;
-    FT_Bitmap*      source = &bitmap->bitmap;
+    FT_Bitmap      bitmap = glyph->bitmap;
 
-    destWidth  = source->width;
-    destHeight = source->rows;
+    destWidth  = bitmap.width;
+    destHeight = bitmap.rows;
     
     if( destWidth && destHeight)
     {
@@ -28,7 +27,7 @@ FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, int id, int xOffset, int yOffset
         glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
 
         glBindTexture( GL_TEXTURE_2D, glTextureID);
-        glTexSubImage2D( GL_TEXTURE_2D, 0, xOffset, yOffset, destWidth, destHeight, GL_ALPHA, GL_UNSIGNED_BYTE, source->buffer);
+        glTexSubImage2D( GL_TEXTURE_2D, 0, xOffset, yOffset, destWidth, destHeight, GL_ALPHA, GL_UNSIGNED_BYTE, bitmap.buffer);
 
         glPopClientAttrib();
     }
@@ -47,10 +46,8 @@ FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, int id, int xOffset, int yOffset
     uv[1].x = static_cast<float>( xOffset + destWidth) / static_cast<float>(width);
     uv[1].y = static_cast<float>( yOffset + destHeight) / static_cast<float>(height);
     
-    pos.x = bitmap->left;
-    pos.y = bitmap->top;
-    
-    FT_Done_Glyph( glyph);
+    pos.x = glyph->bitmap_left;
+    pos.y = glyph->bitmap_top;
 }
 
 
diff --git a/src/FTVectoriser.cpp b/src/FTVectoriser.cpp
index 98778ab..2df8a11 100644
--- a/src/FTVectoriser.cpp
+++ b/src/FTVectoriser.cpp
@@ -98,7 +98,7 @@ const FTTesselation* const FTMesh::Tesselation( unsigned int index) const
 }
 
 
-FTVectoriser::FTVectoriser( const FT_Glyph glyph)
+FTVectoriser::FTVectoriser( const FT_GlyphSlot glyph)
 :   contourList(0),
     mesh(0),
     ftContourCount(0),
@@ -106,12 +106,11 @@ FTVectoriser::FTVectoriser( const FT_Glyph glyph)
 {
     if( glyph)
     {
-        FT_OutlineGlyph outline = (FT_OutlineGlyph)glyph;
-        ftOutline = outline->outline;
+        outline = glyph->outline;
         
-        ftContourCount = ftOutline.n_contours;;
+        ftContourCount = outline.n_contours;;
         contourList = 0;
-        contourFlag = ftOutline.flags;
+        contourFlag = outline.flags;
         
         ProcessContours();
     }
@@ -140,10 +139,10 @@ void FTVectoriser::ProcessContours()
     
     for( short contourIndex = 0; contourIndex < ftContourCount; ++contourIndex)
     {
-        FT_Vector* pointList = &ftOutline.points[startIndex];
-        char* tagList = &ftOutline.tags[startIndex];
+        FT_Vector* pointList = &outline.points[startIndex];
+        char* tagList = &outline.tags[startIndex];
         
-        endIndex = ftOutline.contours[contourIndex];
+        endIndex = outline.contours[contourIndex];
         contourLength =  ( endIndex - startIndex) + 1;
 
         FTContour* contour = new FTContour( pointList, tagList, contourLength);
diff --git a/test/FTBitmapGlyph-Test.cpp b/test/FTBitmapGlyph-Test.cpp
index b20c50b..6254924 100644
--- a/test/FTBitmapGlyph-Test.cpp
+++ b/test/FTBitmapGlyph-Test.cpp
@@ -28,7 +28,6 @@ class FTBitmapGlyphTest : public CppUnit::TestCase
         {
             FT_Library   library;
             FT_Face      face;
-            FT_Glyph     glyph;
             
             FT_Error error = FT_Init_FreeType( &library);
             assert(!error);
@@ -39,16 +38,12 @@ class FTBitmapGlyphTest : public CppUnit::TestCase
             
             error = FT_Load_Char( face, CHARACTER_CODE_A, FT_LOAD_DEFAULT);
             assert( !error);
-            error = FT_Get_Glyph( face->glyph, &glyph);
-            assert( !error);
-            assert( !error);
         
-            makeBitMap( glyph);
+//            makeBitMap( glyph);
             
-//            FTBitmapGlyph* bitmapGlyph = new FTBitmapGlyph( &glyph);            
-//            CPPUNIT_ASSERT( bitmapGlyph->Error() == 0);
+            FTBitmapGlyph* bitmapGlyph = new FTBitmapGlyph( face->glyph);            
+            CPPUNIT_ASSERT( bitmapGlyph->Error() == 0);
         
-            FT_Done_Glyph( glyph);
             FT_Done_Face( face);
             FT_Done_FreeType( library);
             
@@ -59,7 +54,6 @@ class FTBitmapGlyphTest : public CppUnit::TestCase
         {
             FT_Error error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_MONO, 0, 0);
             assert( !error);
-//            FT_Done_Glyph( glyph);
         }
         
         void setUp() 
diff --git a/test/FTFont-Test.cpp b/test/FTFont-Test.cpp
index 52a3d06..18eaf22 100755
--- a/test/FTFont-Test.cpp
+++ b/test/FTFont-Test.cpp
@@ -11,10 +11,10 @@
 class TestGlyph : public FTGlyph
 {
     public:
-        TestGlyph( FT_Glyph glyph)
+        TestGlyph( FT_GlyphSlot glyph)
         :   FTGlyph( glyph)
         {
-            FT_Done_Glyph( glyph );
+//            FT_Done_Glyph( glyph );
         }
         
         float Render( const FTPoint& pen){ return advance;}
@@ -34,11 +34,11 @@ class TestFont : public FTFont
 
         FTGlyph* MakeGlyph( unsigned int g)
         {
-            FT_Glyph* ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
+            FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
         
             if( ftGlyph)
             {
-                TestGlyph* tempGlyph = new TestGlyph( *ftGlyph);
+                TestGlyph* tempGlyph = new TestGlyph( ftGlyph);
                 return tempGlyph;
             }
         
diff --git a/test/FTVectoriser-Test.cpp b/test/FTVectoriser-Test.cpp
index ecf3613..0760009 100755
--- a/test/FTVectoriser-Test.cpp
+++ b/test/FTVectoriser-Test.cpp
@@ -305,7 +305,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( NULL_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser( glyph);
+            FTVectoriser vectoriser( face->glyph);
             CPPUNIT_ASSERT( vectoriser.ContourCount() == 0);
             
             tearDownFreetype();
@@ -316,7 +316,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( SIMPLE_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser( glyph);
+            FTVectoriser vectoriser( face->glyph);
 
             CPPUNIT_ASSERT( vectoriser.ContourCount() == 2);
             CPPUNIT_ASSERT( vectoriser.PointCount() == 8);
@@ -329,7 +329,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( COMPLEX_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser( glyph);
+            FTVectoriser vectoriser( face->glyph);
 
             CPPUNIT_ASSERT( vectoriser.ContourCount() == 2);
             CPPUNIT_ASSERT( vectoriser.PointCount() == 91);
@@ -342,7 +342,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( SIMPLE_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser( glyph);
+            FTVectoriser vectoriser( face->glyph);
 
             CPPUNIT_ASSERT( vectoriser.Contour(1));
             CPPUNIT_ASSERT( vectoriser.Contour(99) == NULL);
@@ -355,7 +355,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( COMPLEX_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser( glyph);
+            FTVectoriser vectoriser( face->glyph);
             
             unsigned int d = 0;
             for( size_t c = 0; c < vectoriser.ContourCount(); ++c)
@@ -378,7 +378,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( SIMPLE_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser( glyph);
+            FTVectoriser vectoriser( face->glyph);
             CPPUNIT_ASSERT( vectoriser.GetMesh() == NULL);
 
             vectoriser.MakeMesh(1.0);
@@ -391,7 +391,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         {
             setUpFreetype( COMPLEX_CHARACTER_INDEX);
             
-            FTVectoriser vectoriser( glyph);
+            FTVectoriser vectoriser( face->glyph);
 
             vectoriser.MakeMesh(1.0);
 
@@ -432,7 +432,6 @@ class FTVectoriserTest : public CppUnit::TestCase
     private:
         FT_Library   library;
         FT_Face      face;
-        FT_Glyph     glyph;
 
         void setUpFreetype( unsigned int characterIndex)
         {
@@ -452,13 +451,10 @@ class FTVectoriserTest : public CppUnit::TestCase
             
             FT_Error error = FT_Load_Glyph( face, glyphIndex, FT_LOAD_DEFAULT);
             assert(!error);
-            error = FT_Get_Glyph( face->glyph, &glyph);
-            assert(!error);
         }
         
         void tearDownFreetype()
         {
-            FT_Done_Glyph( glyph);
             FT_Done_Face( face);
             FT_Done_FreeType( library);
         }