Commit f7b79437006b4fdb3cd3b01d4af4f71e56f7ff9e

sammy 2008-05-05T14:55:11

* Refactor FTGlyph, FTFont and FTLayout so that client applications can hopefully subclass them.

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
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
diff --git a/src/FTFont/FTBitmapFont.cpp b/src/FTFont/FTBitmapFont.cpp
index 475ae20..da86613 100644
--- a/src/FTFont/FTBitmapFont.cpp
+++ b/src/FTFont/FTBitmapFont.cpp
@@ -36,23 +36,19 @@
 //
 
 
-FTBitmapFont::FTBitmapFont(char const *fontFilePath)
-{
-    impl = new FTBitmapFontImpl(this, fontFilePath);
-}
+FTBitmapFont::FTBitmapFont(char const *fontFilePath) :
+    FTFont(new FTBitmapFontImpl(this, fontFilePath))
+{}
 
 
 FTBitmapFont::FTBitmapFont(unsigned char const *pBufferBytes,
-                           size_t bufferSizeInBytes)
-{
-    impl = new FTBitmapFontImpl(this, pBufferBytes, bufferSizeInBytes);
-}
+                           size_t bufferSizeInBytes) :
+    FTFont(new FTBitmapFontImpl(this, pBufferBytes, bufferSizeInBytes))
+{}
 
 
 FTBitmapFont::~FTBitmapFont()
-{
-    ;
-}
+{}
 
 
 FTGlyph* FTBitmapFont::MakeGlyph(FT_GlyphSlot ftGlyph)
diff --git a/src/FTFont/FTExtrudeFont.cpp b/src/FTFont/FTExtrudeFont.cpp
index 7f251dc..497af7e 100644
--- a/src/FTFont/FTExtrudeFont.cpp
+++ b/src/FTFont/FTExtrudeFont.cpp
@@ -36,23 +36,20 @@
 //
 
 
-FTExtrudeFont::FTExtrudeFont(char const *fontFilePath)
-{
-    impl = new FTExtrudeFontImpl(this, fontFilePath);
-}
+FTExtrudeFont::FTExtrudeFont(char const *fontFilePath) :
+    FTFont(new FTExtrudeFontImpl(this, fontFilePath))
+{}
 
 
 FTExtrudeFont::FTExtrudeFont(const unsigned char *pBufferBytes,
-                             size_t bufferSizeInBytes)
-{
-    impl = new FTExtrudeFontImpl(this, pBufferBytes, bufferSizeInBytes);
-}
+                             size_t bufferSizeInBytes) :
+    FTFont(new FTExtrudeFontImpl(this, pBufferBytes, bufferSizeInBytes))
+
+{}
 
 
 FTExtrudeFont::~FTExtrudeFont()
-{
-    ;
-}
+{}
 
 
 FTGlyph* FTExtrudeFont::MakeGlyph(FT_GlyphSlot ftGlyph)
diff --git a/src/FTFont/FTFont.cpp b/src/FTFont/FTFont.cpp
index c8c9819..a971030 100644
--- a/src/FTFont/FTFont.cpp
+++ b/src/FTFont/FTFont.cpp
@@ -45,17 +45,26 @@
 //
 
 
-FTFont::FTFont()
+FTFont::FTFont(char const *fontFilePath)
 {
-    /* impl is set by the child class */
-    impl = NULL;
+    impl = new FTFontImpl(this, fontFilePath);
+}
+
+
+FTFont::FTFont(const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
+{
+    impl = new FTFontImpl(this, pBufferBytes, bufferSizeInBytes);
+}
+
+
+FTFont::FTFont(FTFontImpl *pImpl)
+{
+    impl = pImpl;
 }
 
 
 FTFont::~FTFont()
 {
-    /* Only the top class should be allowed to destroy impl, because
-     * we do not know how many levels of inheritance there are. */
     delete impl;
 }
 
@@ -339,6 +348,12 @@ bool FTFontImpl::Attach(const unsigned char *pBufferBytes,
 
 bool FTFontImpl::FaceSize(const unsigned int size, const unsigned int res)
 {
+    if(glyphList != NULL)
+    {
+        delete glyphList;
+        glyphList = NULL;
+    }
+
     charSize = face.Size(size, res);
     err = face.Error();
 
@@ -347,11 +362,6 @@ bool FTFontImpl::FaceSize(const unsigned int size, const unsigned int res)
         return false;
     }
 
-    if(glyphList != NULL)
-    {
-        delete glyphList;
-    }
-
     glyphList = new FTGlyphContainer(&face);
     return true;
 }
diff --git a/src/FTFont/FTOutlineFont.cpp b/src/FTFont/FTOutlineFont.cpp
index 0d7a582..05a7ed8 100644
--- a/src/FTFont/FTOutlineFont.cpp
+++ b/src/FTFont/FTOutlineFont.cpp
@@ -36,23 +36,19 @@
 //
 
 
-FTOutlineFont::FTOutlineFont(char const *fontFilePath)
-{
-    impl = new FTOutlineFontImpl(this, fontFilePath);
-}
+FTOutlineFont::FTOutlineFont(char const *fontFilePath) :
+    FTFont(new FTOutlineFontImpl(this, fontFilePath))
+{}
 
 
 FTOutlineFont::FTOutlineFont(const unsigned char *pBufferBytes,
-                             size_t bufferSizeInBytes)
-{
-    impl = new FTOutlineFontImpl(this, pBufferBytes, bufferSizeInBytes);
-}
+                             size_t bufferSizeInBytes) :
+    FTFont(new FTOutlineFontImpl(this, pBufferBytes, bufferSizeInBytes))
+{}
 
 
 FTOutlineFont::~FTOutlineFont()
-{
-    ;
-}
+{}
 
 
 FTGlyph* FTOutlineFont::MakeGlyph(FT_GlyphSlot ftGlyph)
diff --git a/src/FTFont/FTPixmapFont.cpp b/src/FTFont/FTPixmapFont.cpp
index 4c62f13..58ca566 100644
--- a/src/FTFont/FTPixmapFont.cpp
+++ b/src/FTFont/FTPixmapFont.cpp
@@ -36,23 +36,19 @@
 //
 
 
-FTPixmapFont::FTPixmapFont(char const *fontFilePath)
-{
-    impl = new FTPixmapFontImpl(this, fontFilePath);
-}
+FTPixmapFont::FTPixmapFont(char const *fontFilePath) :
+    FTFont(new FTPixmapFontImpl(this, fontFilePath))
+{}
 
 
 FTPixmapFont::FTPixmapFont(const unsigned char *pBufferBytes,
-                           size_t bufferSizeInBytes)
-{
-    impl = new FTPixmapFontImpl(this, pBufferBytes, bufferSizeInBytes);
-}
+                           size_t bufferSizeInBytes) :
+    FTFont(new FTPixmapFontImpl(this, pBufferBytes, bufferSizeInBytes))
+{}
 
 
 FTPixmapFont::~FTPixmapFont()
-{
-    ;
-}
+{}
 
 
 FTGlyph* FTPixmapFont::MakeGlyph(FT_GlyphSlot ftGlyph)
diff --git a/src/FTFont/FTPolygonFont.cpp b/src/FTFont/FTPolygonFont.cpp
index 7ab7726..271455a 100644
--- a/src/FTFont/FTPolygonFont.cpp
+++ b/src/FTFont/FTPolygonFont.cpp
@@ -36,23 +36,19 @@
 //
 
 
-FTPolygonFont::FTPolygonFont(char const *fontFilePath)
-{
-    impl = new FTPolygonFontImpl(this, fontFilePath);
-}
+FTPolygonFont::FTPolygonFont(char const *fontFilePath) :
+    FTFont(new FTPolygonFontImpl(this, fontFilePath))
+{}
 
 
 FTPolygonFont::FTPolygonFont(const unsigned char *pBufferBytes,
-                             size_t bufferSizeInBytes)
-{
-    impl = new FTPolygonFontImpl(this, pBufferBytes, bufferSizeInBytes);
-}
+                             size_t bufferSizeInBytes) :
+    FTFont(new FTPolygonFontImpl(this, pBufferBytes, bufferSizeInBytes))
+{}
 
 
 FTPolygonFont::~FTPolygonFont()
-{
-    ;
-}
+{}
 
 
 FTGlyph* FTPolygonFont::MakeGlyph(FT_GlyphSlot ftGlyph)
diff --git a/src/FTFont/FTTextureFont.cpp b/src/FTFont/FTTextureFont.cpp
index e74f624..33ceae4 100644
--- a/src/FTFont/FTTextureFont.cpp
+++ b/src/FTFont/FTTextureFont.cpp
@@ -41,23 +41,19 @@
 //
 
 
-FTTextureFont::FTTextureFont(char const *fontFilePath)
-{
-    impl = new FTTextureFontImpl(this, fontFilePath);
-}
+FTTextureFont::FTTextureFont(char const *fontFilePath) :
+    FTFont(new FTTextureFontImpl(this, fontFilePath))
+{}
 
 
 FTTextureFont::FTTextureFont(const unsigned char *pBufferBytes,
-                             size_t bufferSizeInBytes)
-{
-    impl = new FTTextureFontImpl(this, pBufferBytes, bufferSizeInBytes);
-}
+                             size_t bufferSizeInBytes) :
+    FTFont(new FTTextureFontImpl(this, pBufferBytes, bufferSizeInBytes))
+{}
 
 
 FTTextureFont::~FTTextureFont()
-{
-    ;
-}
+{}
 
 
 FTGlyph* FTTextureFont::MakeGlyph(FT_GlyphSlot ftGlyph)
diff --git a/src/FTGL/FTBitmapGlyph.h b/src/FTGL/FTBitmapGlyph.h
index d522dc9..f8ef87f 100644
--- a/src/FTGL/FTBitmapGlyph.h
+++ b/src/FTGL/FTBitmapGlyph.h
@@ -38,8 +38,6 @@
 
 /**
  * FTBitmapGlyph is a specialisation of FTGlyph for creating bitmaps.
- *
- * @see FTGlyphContainer
  */
 class FTGL_EXPORT FTBitmapGlyph : public FTGlyph
 {
@@ -55,6 +53,15 @@ class FTGL_EXPORT FTBitmapGlyph : public FTGlyph
          * Destructor
          */
         virtual ~FTBitmapGlyph();
+
+        /**
+         * Render this glyph at the current pen position.
+         *
+         * @param pen  The current pen position.
+         * @param renderMode  Render mode to display
+         * @return  The advance distance for this glyph.
+         */
+        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
 };
 
 #endif //__cplusplus
diff --git a/src/FTGL/FTExtrdGlyph.h b/src/FTGL/FTExtrdGlyph.h
index 7f0ad73..c1eaa54 100644
--- a/src/FTGL/FTExtrdGlyph.h
+++ b/src/FTGL/FTExtrdGlyph.h
@@ -39,10 +39,6 @@
 /**
  * FTExtrudeGlyph is a specialisation of FTGlyph for creating tessellated
  * extruded polygon glyphs.
- *
- * @see FTGlyphContainer
- * @see FTVectoriser
- *
  */
 class FTGL_EXPORT FTExtrudeGlyph : public FTGlyph
 {
@@ -67,6 +63,15 @@ class FTGL_EXPORT FTExtrudeGlyph : public FTGlyph
          * Destructor
          */
         virtual ~FTExtrudeGlyph();
+
+        /**
+         * Render this glyph at the current pen position.
+         *
+         * @param pen  The current pen position.
+         * @param renderMode  Render mode to display
+         * @return  The advance distance for this glyph.
+         */
+        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
 };
 
 #define FTExtrdGlyph FTExtrudeGlyph
diff --git a/src/FTGL/FTFont.h b/src/FTGL/FTFont.h
index 14e2e01..3ba7c0f 100644
--- a/src/FTGL/FTFont.h
+++ b/src/FTGL/FTFont.h
@@ -55,12 +55,40 @@ class FTFontImpl;
  */
 class FTGL_EXPORT FTFont
 {
-        /* Allow FTLayout classes to access this->impl. */
-        friend class FTLayoutImpl;
-        friend class FTFontImpl;
-
     protected:
-        FTFont();
+        /**
+         * Open and read a font file. Sets Error flag.
+         *
+         * @param fontFilePath  font file path.
+         */
+        FTFont(char const *fontFilePath);
+
+        /**
+         * 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);
+
+    private:
+        /* Allow our internal subclasses to access the private constructor */
+        friend class FTBitmapFont;
+        friend class FTExtrudeFont;
+        friend class FTOutlineFont;
+        friend class FTPixmapFont;
+        friend class FTPolygonFont;
+        friend class FTTextureFont;
+
+        /**
+         * Internal FTGL FTFont constructor. For private use only.
+         *
+         * @param pImpl  Internal implementation object. Will be destroyed
+         *               upon FTFont deletion.
+         */
+        FTFont(FTFontImpl *pImpl);
 
     public:
         virtual ~FTFont();
@@ -304,6 +332,9 @@ class FTGL_EXPORT FTFont
         FT_Error Error() const;
 
     protected:
+        /* Allow impl to access MakeGlyph */
+        friend class FTFontImpl;
+
         /**
          * Construct a glyph of the correct type.
          *
@@ -315,6 +346,13 @@ class FTGL_EXPORT FTFont
          */
         virtual FTGlyph* MakeGlyph(FT_GlyphSlot slot) = 0;
 
+    private:
+        /* Allow FTLayout classes to access this->impl. */
+        friend class FTLayoutImpl;
+
+        /**
+         * Internal FTGL FTFont implementation object. For private use only.
+         */
         FTFontImpl *impl;
 };
 
diff --git a/src/FTGL/FTGlyph.h b/src/FTGL/FTGlyph.h
index 7b7c0f1..26ca5d1 100644
--- a/src/FTGL/FTGlyph.h
+++ b/src/FTGL/FTGlyph.h
@@ -42,31 +42,52 @@ class FTGlyphImpl;
  *
  * 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.
+ * must implement the <code>Render</code> function.
  *
- * @see FTGlyphContainer
  * @see FTBBox
  * @see FTPoint
- *
  */
 class FTGL_EXPORT FTGlyph
 {
-    friend class FTGlyphContainer;
-
     protected:
-        FTGlyph();
+        /**
+         * Create a glyph.
+         *
+         * @param glyph  The Freetype glyph to be processed
+         */
+        FTGlyph(FT_GlyphSlot glyph);
+
+    private:
+        /**
+         * Internal FTGL FTGlyph constructor. For private use only.
+         *
+         * @param pImpl  Internal implementation object. Will be destroyed
+         *               upon FTGlyph deletion.
+         */
+        FTGlyph(FTGlyphImpl *pImpl);
+
+        /* Allow our internal subclasses to access the private constructor */
+        friend class FTBitmapGlyph;
+        friend class FTExtrudeGlyph;
+        friend class FTOutlineGlyph;
+        friend class FTPixmapGlyph;
+        friend class FTPolygonGlyph;
+        friend class FTTextureGlyph;
 
     public:
+        /**
+          * Destructor
+          */
         virtual ~FTGlyph();
 
         /**
          * Renders this glyph at the current pen position.
          *
-         * @param pen   The current pen position.
-         * @param renderMode Render mode to display
-         * @return      The advance distance for this glyph.
+         * @param pen  The current pen position.
+         * @param renderMode  Render mode to display
+         * @return  The advance distance for this glyph.
          */
-        const FTPoint& Render(const FTPoint& pen, int renderMode);
+        virtual const FTPoint& Render(const FTPoint& pen, int renderMode) = 0;
 
         /**
          * Return the advance width for this glyph.
@@ -89,7 +110,10 @@ class FTGL_EXPORT FTGlyph
          */
         FT_Error Error() const;
 
-    protected:
+    private:
+        /**
+         * Internal FTGL FTGlyph implementation object. For private use only.
+         */
         FTGlyphImpl *impl;
 };
 
diff --git a/src/FTGL/FTLayout.h b/src/FTGL/FTLayout.h
index a5b88aa..a207b0e 100644
--- a/src/FTGL/FTLayout.h
+++ b/src/FTGL/FTLayout.h
@@ -53,26 +53,93 @@ class FTGL_EXPORT FTLayout
     protected:
         FTLayout();
 
+    private:
+        /**
+         * Internal FTGL FTLayout constructor. For private use only.
+         *
+         * @param pImpl  Internal implementation object. Will be destroyed
+         *               upon FTLayout deletion.
+         */
+        FTLayout(FTLayoutImpl *pImpl);
+
+        /* Allow our internal subclasses to access the private constructor */
+        friend class FTSimpleLayout;
+
     public:
+        /**
+         * Destructor
+         */
         virtual ~FTLayout();
 
-        void BBox(const char* string, float& llx, float& lly,
-                  float& llz, float& urx, float& ury, float& urz);
-
-        void BBox(const wchar_t* string, float& llx, float& lly,
-                  float& llz, float& urx, float& ury, float& urz);
-
-        void Render(const char *string);
-
-        void Render(const char *string, int renderMode);
-
-        void Render(const wchar_t *string);
-
-        void Render(const wchar_t *string, int renderMode);
-
+        /**
+         * Get the bounding box for a formatted 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
+         */
+        virtual void BBox(const char* string, float& llx, float& lly,
+                          float& llz, float& urx, float& ury, float& urz) = 0;
+
+        /**
+         * Get the bounding box for a formatted 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
+         */
+        virtual void BBox(const wchar_t* string, float& llx, float& lly,
+                          float& llz, float& urx, float& ury, float& urz) = 0;
+
+        /**
+         * Render a string of characters
+         *
+         * @param string    'C' style string to be output.
+         */
+        virtual void Render(const char *string) = 0;
+
+        /**
+         * Render a string of characters
+         *
+         * @param string    'C' style string to be output.
+         * @param renderMode  Render mode to diplay
+         */
+        virtual void Render(const char *string, int renderMode) = 0;
+
+        /**
+         * Render a string of characters
+         *
+         * @param string    wchar_t string to be output.
+         */
+        virtual void Render(const wchar_t *string) = 0;
+
+        /**
+         * Render a string of characters
+         *
+         * @param string    wchar_t string to be output.
+         * @param renderMode  Render mode to diplay
+         */
+        virtual void Render(const wchar_t *string, int renderMode) = 0;
+
+        /**
+         * Queries the Layout for errors.
+         *
+         * @return  The current error code.
+         */
         FT_Error Error() const;
 
-    protected:
+    private:
+        /**
+         * Internal FTGL FTLayout implementation object. For private use only.
+         */
         FTLayoutImpl *impl;
 };
 
diff --git a/src/FTGL/FTOutlineGlyph.h b/src/FTGL/FTOutlineGlyph.h
index 03e0438..2919139 100644
--- a/src/FTGL/FTOutlineGlyph.h
+++ b/src/FTGL/FTOutlineGlyph.h
@@ -38,10 +38,6 @@
 
 /**
  * FTOutlineGlyph is a specialisation of FTGlyph for creating outlines.
- *
- * @see FTGlyphContainer
- * @see FTVectoriser
- *
  */
 class FTGL_EXPORT FTOutlineGlyph : public FTGlyph
 {
@@ -63,6 +59,15 @@ class FTGL_EXPORT FTOutlineGlyph : public FTGlyph
          * Destructor
          */
         virtual ~FTOutlineGlyph();
+
+        /**
+         * Render this glyph at the current pen position.
+         *
+         * @param pen  The current pen position.
+         * @param renderMode  Render mode to display
+         * @return  The advance distance for this glyph.
+         */
+        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
 };
 
 #endif //__cplusplus
diff --git a/src/FTGL/FTPixmapGlyph.h b/src/FTGL/FTPixmapGlyph.h
index 672f0d5..d9a317f 100644
--- a/src/FTGL/FTPixmapGlyph.h
+++ b/src/FTGL/FTPixmapGlyph.h
@@ -38,9 +38,6 @@
 
 /**
  * FTPixmapGlyph is a specialisation of FTGlyph for creating pixmaps.
- *
- * @see FTGlyphContainer
- *
  */
 class  FTGL_EXPORT FTPixmapGlyph : public FTGlyph
 {
@@ -56,6 +53,15 @@ class  FTGL_EXPORT FTPixmapGlyph : public FTGlyph
          * Destructor
          */
         virtual ~FTPixmapGlyph();
+
+        /**
+         * Render this glyph at the current pen position.
+         *
+         * @param pen  The current pen position.
+         * @param renderMode  Render mode to display
+         * @return  The advance distance for this glyph.
+         */
+        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
 };
 
 #endif //__cplusplus
diff --git a/src/FTGL/FTPolyGlyph.h b/src/FTGL/FTPolyGlyph.h
index 41f1601..315972f 100644
--- a/src/FTGL/FTPolyGlyph.h
+++ b/src/FTGL/FTPolyGlyph.h
@@ -39,10 +39,6 @@
 /**
  * FTPolygonGlyph is a specialisation of FTGlyph for creating tessellated
  * polygon glyphs.
- *
- * @see FTGlyphContainer
- * @see FTVectoriser
- *
  */
 class FTGL_EXPORT FTPolygonGlyph : public FTGlyph
 {
@@ -64,6 +60,15 @@ class FTGL_EXPORT FTPolygonGlyph : public FTGlyph
          * Destructor
          */
         virtual ~FTPolygonGlyph();
+
+        /**
+         * Render this glyph at the current pen position.
+         *
+         * @param pen  The current pen position.
+         * @param renderMode  Render mode to display
+         * @return  The advance distance for this glyph.
+         */
+        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
 };
 
 #define FTPolyGlyph FTPolygonGlyph
diff --git a/src/FTGL/FTSimpleLayout.h b/src/FTGL/FTSimpleLayout.h
index 646da63..7396190 100644
--- a/src/FTGL/FTSimpleLayout.h
+++ b/src/FTGL/FTSimpleLayout.h
@@ -58,7 +58,65 @@ class FTGL_EXPORT FTSimpleLayout : public FTLayout
         /**
          * Destructor
          */
-        ~FTSimpleLayout() {}
+        ~FTSimpleLayout();
+
+        /**
+         * Get the bounding box for a formatted 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
+         */
+        virtual void BBox(const char* string, float& llx, float& lly,
+                          float& llz, float& urx, float& ury, float& urz);
+
+        /**
+         * Get the bounding box for a formatted 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
+         */
+        virtual void BBox(const wchar_t* string, float& llx, float& lly,
+                          float& llz, float& urx, float& ury, float& urz);
+
+        /**
+         * 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    'C' style string to be output.
+         * @param renderMode  Render mode to diplay
+         */
+        virtual void Render(const char *string, int renderMode);
+
+        /**
+         * Render a string of characters
+         *
+         * @param string    wchar_t string to be output.
+         */
+        virtual void Render(const wchar_t *string);
+
+        /**
+         * Render a string of characters
+         *
+         * @param string    wchar_t string to be output.
+         * @param renderMode  Render mode to diplay
+         */
+        virtual void Render(const wchar_t *string, int renderMode);
 
         /**
          * Set the font to use for rendering the text.
diff --git a/src/FTGL/FTTextureGlyph.h b/src/FTGL/FTTextureGlyph.h
index 1e4956a..ec545f3 100644
--- a/src/FTGL/FTTextureGlyph.h
+++ b/src/FTGL/FTTextureGlyph.h
@@ -39,9 +39,6 @@
 /**
  * FTTextureGlyph is a specialisation of FTGlyph for creating texture
  * glyphs.
- *
- * @see FTGlyphContainer
- *
  */
 class FTGL_EXPORT FTTextureGlyph : public FTGlyph
 {
@@ -66,6 +63,15 @@ class FTGL_EXPORT FTTextureGlyph : public FTGlyph
          * Destructor
          */
         virtual ~FTTextureGlyph();
+
+        /**
+         * Render this glyph at the current pen position.
+         *
+         * @param pen  The current pen position.
+         * @param renderMode  Render mode to display
+         * @return  The advance distance for this glyph.
+         */
+        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
 };
 
 #endif //__cplusplus
diff --git a/src/FTGlyph/FTBitmapGlyph.cpp b/src/FTGlyph/FTBitmapGlyph.cpp
index 4981586..cda8ac8 100644
--- a/src/FTGlyph/FTBitmapGlyph.cpp
+++ b/src/FTGlyph/FTBitmapGlyph.cpp
@@ -38,15 +38,19 @@
 //
 
 
-FTBitmapGlyph::FTBitmapGlyph(FT_GlyphSlot glyph)
-{
-    impl = new FTBitmapGlyphImpl(glyph);
-}
+FTBitmapGlyph::FTBitmapGlyph(FT_GlyphSlot glyph) :
+    FTGlyph(new FTBitmapGlyphImpl(glyph))
+{}
 
 
 FTBitmapGlyph::~FTBitmapGlyph()
+{}
+
+
+const FTPoint& FTBitmapGlyph::Render(const FTPoint& pen, int renderMode)
 {
-    ;
+    FTBitmapGlyphImpl *myimpl = dynamic_cast<FTBitmapGlyphImpl *>(impl);
+    return myimpl->RenderImpl(pen, renderMode);
 }
 
 
@@ -102,7 +106,7 @@ FTBitmapGlyphImpl::~FTBitmapGlyphImpl()
 }
 
 
-const FTPoint& FTBitmapGlyphImpl::Render(const FTPoint& pen, int renderMode)
+const FTPoint& FTBitmapGlyphImpl::RenderImpl(const FTPoint& pen, int renderMode)
 {
     if(data)
     {
diff --git a/src/FTGlyph/FTBitmapGlyphImpl.h b/src/FTGlyph/FTBitmapGlyphImpl.h
index 3178834..3601f44 100644
--- a/src/FTGlyph/FTBitmapGlyphImpl.h
+++ b/src/FTGlyph/FTBitmapGlyphImpl.h
@@ -37,7 +37,7 @@ class FTBitmapGlyphImpl : public FTGlyphImpl
 
         virtual ~FTBitmapGlyphImpl();
 
-        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
+        virtual const FTPoint& RenderImpl(const FTPoint& pen, int renderMode);
 
     private:
         /**
diff --git a/src/FTGlyph/FTExtrudeGlyph.cpp b/src/FTGlyph/FTExtrudeGlyph.cpp
index 563d30d..5d6e4cc 100644
--- a/src/FTGlyph/FTExtrudeGlyph.cpp
+++ b/src/FTGlyph/FTExtrudeGlyph.cpp
@@ -41,16 +41,20 @@
 
 FTExtrudeGlyph::FTExtrudeGlyph(FT_GlyphSlot glyph, float depth,
                                float frontOutset, float backOutset,
-                               bool useDisplayList)
-{
-    impl = new FTExtrudeGlyphImpl(glyph, depth, frontOutset, backOutset,
-                                  useDisplayList);
-}
+                               bool useDisplayList) :
+    FTGlyph(new FTExtrudeGlyphImpl(glyph, depth, frontOutset, backOutset,
+                                   useDisplayList))
+{}
 
 
 FTExtrudeGlyph::~FTExtrudeGlyph()
+{}
+
+
+const FTPoint& FTExtrudeGlyph::Render(const FTPoint& pen, int renderMode)
 {
-    ;
+    FTExtrudeGlyphImpl *myimpl = dynamic_cast<FTExtrudeGlyphImpl *>(impl);
+    return myimpl->RenderImpl(pen, renderMode);
 }
 
 
@@ -126,7 +130,8 @@ FTExtrudeGlyphImpl::~FTExtrudeGlyphImpl()
 }
 
 
-const FTPoint& FTExtrudeGlyphImpl::Render(const FTPoint& pen, int renderMode)
+const FTPoint& FTExtrudeGlyphImpl::RenderImpl(const FTPoint& pen,
+                                              int renderMode)
 {
     glTranslatef(pen.X(), pen.Y(), 0);
     if(glList)
diff --git a/src/FTGlyph/FTExtrudeGlyphImpl.h b/src/FTGlyph/FTExtrudeGlyphImpl.h
index 22ea196..c604ade 100644
--- a/src/FTGlyph/FTExtrudeGlyphImpl.h
+++ b/src/FTGlyph/FTExtrudeGlyphImpl.h
@@ -40,7 +40,7 @@ class FTExtrudeGlyphImpl : public FTGlyphImpl
 
         virtual ~FTExtrudeGlyphImpl();
 
-        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
+        virtual const FTPoint& RenderImpl(const FTPoint& pen, int renderMode);
 
     private:
         /**
diff --git a/src/FTGlyph/FTGlyph.cpp b/src/FTGlyph/FTGlyph.cpp
index 3e5c4fc..8c3eab7 100644
--- a/src/FTGlyph/FTGlyph.cpp
+++ b/src/FTGlyph/FTGlyph.cpp
@@ -36,24 +36,21 @@
 //
 
 
-FTGlyph::FTGlyph()
+FTGlyph::FTGlyph(FT_GlyphSlot glyph)
 {
-    /* impl is set by the child class */
-    impl = NULL;
+    impl = new FTGlyphImpl(glyph);
 }
 
 
-FTGlyph::~FTGlyph()
+FTGlyph::FTGlyph(FTGlyphImpl *pImpl)
 {
-    /* Only the top class should be allowed to destroy impl, because
-     * we do not know how many levels of inheritance there are. */
-    delete impl;
+    impl = pImpl;
 }
 
 
-const FTPoint& FTGlyph::Render(const FTPoint& pen, int renderMode)
+FTGlyph::~FTGlyph()
 {
-    return impl->Render(pen, renderMode);
+    delete impl;
 }
 
 
diff --git a/src/FTGlyph/FTGlyphImpl.h b/src/FTGlyph/FTGlyphImpl.h
index 26b07fb..e25ad40 100644
--- a/src/FTGlyph/FTGlyphImpl.h
+++ b/src/FTGlyph/FTGlyphImpl.h
@@ -37,8 +37,6 @@ class FTGlyphImpl
 
         virtual ~FTGlyphImpl();
 
-        virtual const FTPoint& Render(const FTPoint& pen, int renderMode) = 0;
-
         const FTPoint& Advance() const;
 
         const FTBBox& BBox() const;
diff --git a/src/FTGlyph/FTOutlineGlyph.cpp b/src/FTGlyph/FTOutlineGlyph.cpp
index caf3167..5cd4704 100644
--- a/src/FTGlyph/FTOutlineGlyph.cpp
+++ b/src/FTGlyph/FTOutlineGlyph.cpp
@@ -39,15 +39,19 @@
 
 
 FTOutlineGlyph::FTOutlineGlyph(FT_GlyphSlot glyph, float outset,
-                               bool useDisplayList)
-{
-    impl = new FTOutlineGlyphImpl(glyph, outset, useDisplayList);
-}
+                               bool useDisplayList) :
+    FTGlyph(new FTOutlineGlyphImpl(glyph, outset, useDisplayList))
+{}
 
 
 FTOutlineGlyph::~FTOutlineGlyph()
+{}
+
+
+const FTPoint& FTOutlineGlyph::Render(const FTPoint& pen, int renderMode)
 {
-    ;
+    FTOutlineGlyphImpl *myimpl = dynamic_cast<FTOutlineGlyphImpl *>(impl);
+    return myimpl->RenderImpl(pen, renderMode);
 }
 
 
@@ -106,7 +110,8 @@ FTOutlineGlyphImpl::~FTOutlineGlyphImpl()
 }
 
 
-const FTPoint& FTOutlineGlyphImpl::Render(const FTPoint& pen, int renderMode)
+const FTPoint& FTOutlineGlyphImpl::RenderImpl(const FTPoint& pen,
+                                              int renderMode)
 {
     glTranslatef(pen.X(), pen.Y(), 0.0f);
     if(glList)
diff --git a/src/FTGlyph/FTOutlineGlyphImpl.h b/src/FTGlyph/FTOutlineGlyphImpl.h
index 54a62ba..eb1a769 100644
--- a/src/FTGlyph/FTOutlineGlyphImpl.h
+++ b/src/FTGlyph/FTOutlineGlyphImpl.h
@@ -40,7 +40,7 @@ class FTOutlineGlyphImpl : public FTGlyphImpl
 
         virtual ~FTOutlineGlyphImpl();
 
-        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
+        virtual const FTPoint& RenderImpl(const FTPoint& pen, int renderMode);
 
     private:
         /**
diff --git a/src/FTGlyph/FTPixmapGlyph.cpp b/src/FTGlyph/FTPixmapGlyph.cpp
index d4cfd73..a1b9fc1 100644
--- a/src/FTGlyph/FTPixmapGlyph.cpp
+++ b/src/FTGlyph/FTPixmapGlyph.cpp
@@ -38,15 +38,19 @@
 //
 
 
-FTPixmapGlyph::FTPixmapGlyph(FT_GlyphSlot glyph)
-{
-    impl = new FTPixmapGlyphImpl(glyph);
-}
+FTPixmapGlyph::FTPixmapGlyph(FT_GlyphSlot glyph) :
+    FTGlyph(new FTPixmapGlyphImpl(glyph))
+{}
 
 
 FTPixmapGlyph::~FTPixmapGlyph()
+{}
+
+
+const FTPoint& FTPixmapGlyph::Render(const FTPoint& pen, int renderMode)
 {
-    ;
+    FTPixmapGlyphImpl *myimpl = dynamic_cast<FTPixmapGlyphImpl *>(impl);
+    return myimpl->RenderImpl(pen, renderMode);
 }
 
 
@@ -110,7 +114,8 @@ FTPixmapGlyphImpl::~FTPixmapGlyphImpl()
 }
 
 
-const FTPoint& FTPixmapGlyphImpl::Render(const FTPoint& pen, int renderMode)
+const FTPoint& FTPixmapGlyphImpl::RenderImpl(const FTPoint& pen,
+                                             int renderMode)
 {
     if(data)
     {
diff --git a/src/FTGlyph/FTPixmapGlyphImpl.h b/src/FTGlyph/FTPixmapGlyphImpl.h
index 93751dd..f642eab 100644
--- a/src/FTGlyph/FTPixmapGlyphImpl.h
+++ b/src/FTGlyph/FTPixmapGlyphImpl.h
@@ -37,7 +37,7 @@ class FTPixmapGlyphImpl : public FTGlyphImpl
 
         virtual ~FTPixmapGlyphImpl();
 
-        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
+        virtual const FTPoint& RenderImpl(const FTPoint& pen, int renderMode);
 
     private:
         /**
diff --git a/src/FTGlyph/FTPolygonGlyph.cpp b/src/FTGlyph/FTPolygonGlyph.cpp
index ef32b4e..2f8b7b1 100644
--- a/src/FTGlyph/FTPolygonGlyph.cpp
+++ b/src/FTGlyph/FTPolygonGlyph.cpp
@@ -39,15 +39,19 @@
 
 
 FTPolygonGlyph::FTPolygonGlyph(FT_GlyphSlot glyph, float outset,
-                               bool useDisplayList)
-{
-    impl = new FTPolygonGlyphImpl(glyph, outset, useDisplayList);
-}
+                               bool useDisplayList) :
+    FTGlyph(new FTPolygonGlyphImpl(glyph, outset, useDisplayList))
+{}
 
 
 FTPolygonGlyph::~FTPolygonGlyph()
+{}
+
+
+const FTPoint& FTPolygonGlyph::Render(const FTPoint& pen, int renderMode)
 {
-    ;
+    FTPolygonGlyphImpl *myimpl = dynamic_cast<FTPolygonGlyphImpl *>(impl);
+    return myimpl->RenderImpl(pen, renderMode);
 }
 
 
@@ -109,7 +113,8 @@ FTPolygonGlyphImpl::~FTPolygonGlyphImpl()
 }
 
 
-const FTPoint& FTPolygonGlyphImpl::Render(const FTPoint& pen, int renderMode)
+const FTPoint& FTPolygonGlyphImpl::RenderImpl(const FTPoint& pen,
+                                              int renderMode)
 {
     glTranslatef(pen.X(), pen.Y(), 0.0f);
     if(glList)
diff --git a/src/FTGlyph/FTPolygonGlyphImpl.h b/src/FTGlyph/FTPolygonGlyphImpl.h
index d40f495..b598c1c 100644
--- a/src/FTGlyph/FTPolygonGlyphImpl.h
+++ b/src/FTGlyph/FTPolygonGlyphImpl.h
@@ -40,7 +40,7 @@ class FTPolygonGlyphImpl : public FTGlyphImpl
 
         virtual ~FTPolygonGlyphImpl();
 
-        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
+        virtual const FTPoint& RenderImpl(const FTPoint& pen, int renderMode);
 
     private:
         /**
diff --git a/src/FTGlyph/FTTextureGlyph.cpp b/src/FTGlyph/FTTextureGlyph.cpp
index b547d6d..b283aa2 100644
--- a/src/FTGlyph/FTTextureGlyph.cpp
+++ b/src/FTGlyph/FTTextureGlyph.cpp
@@ -39,15 +39,19 @@
 
 
 FTTextureGlyph::FTTextureGlyph(FT_GlyphSlot glyph, int id, int xOffset,
-                               int yOffset, int width, int height)
-{
-    impl = new FTTextureGlyphImpl(glyph, id, xOffset, yOffset, width, height);
-}
+                               int yOffset, int width, int height) :
+    FTGlyph(new FTTextureGlyphImpl(glyph, id, xOffset, yOffset, width, height))
+{}
 
 
 FTTextureGlyph::~FTTextureGlyph()
+{}
+
+
+const FTPoint& FTTextureGlyph::Render(const FTPoint& pen, int renderMode)
 {
-    ;
+    FTTextureGlyphImpl *myimpl = dynamic_cast<FTTextureGlyphImpl *>(impl);
+    return myimpl->RenderImpl(pen, renderMode);
 }
 
 
@@ -116,7 +120,8 @@ FTTextureGlyphImpl::~FTTextureGlyphImpl()
 {}
 
 
-const FTPoint& FTTextureGlyphImpl::Render(const FTPoint& pen, int renderMode)
+const FTPoint& FTTextureGlyphImpl::RenderImpl(const FTPoint& pen,
+                                              int renderMode)
 {
     float dx, dy;
 
diff --git a/src/FTGlyph/FTTextureGlyphImpl.h b/src/FTGlyph/FTTextureGlyphImpl.h
index b5b2f24..0a8323f 100644
--- a/src/FTGlyph/FTTextureGlyphImpl.h
+++ b/src/FTGlyph/FTTextureGlyphImpl.h
@@ -39,7 +39,7 @@ class FTTextureGlyphImpl : public FTGlyphImpl
 
         virtual ~FTTextureGlyphImpl();
 
-        virtual const FTPoint& Render(const FTPoint& pen, int renderMode);
+        virtual const FTPoint& RenderImpl(const FTPoint& pen, int renderMode);
 
     private:
         /**
diff --git a/src/FTLayout/FTLayout.cpp b/src/FTLayout/FTLayout.cpp
index 4f144a8..8a33fa4 100644
--- a/src/FTLayout/FTLayout.cpp
+++ b/src/FTLayout/FTLayout.cpp
@@ -38,54 +38,19 @@
 
 FTLayout::FTLayout()
 {
-    /* impl is set by the child class */
-    impl = NULL;
+    impl = new FTLayoutImpl();
 }
 
 
-FTLayout::~FTLayout()
-{
-    /* Only the top class should be allowed to destroy impl, because
-     * we do not know how many levels of inheritance there are. */
-    delete impl;
-}
-
-
-void FTLayout::BBox(const char* string, float& llx, float& lly,
-                    float& llz, float& urx, float& ury, float& urz)
-{
-    impl->BBox(string, llx, lly, llz, urx, ury, urz);
-}
-
-
-void FTLayout::BBox(const wchar_t* string, float& llx, float& lly,
-                    float& llz, float& urx, float& ury, float& urz)
-{
-    impl->BBox(string, llx, lly, llz, urx, ury, urz);
-}
-
-
-void FTLayout::Render(const char *string)
-{
-    impl->Render(string);
-}
-
-
-void FTLayout::Render(const char *string, int renderMode)
+FTLayout::FTLayout(FTLayoutImpl *pImpl)
 {
-    impl->Render(string, renderMode);
+    impl = pImpl;
 }
 
 
-void FTLayout::Render(const wchar_t *string)
-{
-    impl->Render(string);
-}
-
-
-void FTLayout::Render(const wchar_t *string, int renderMode)
+FTLayout::~FTLayout()
 {
-    impl->Render(string, renderMode);
+    delete impl;
 }
 
 
diff --git a/src/FTLayout/FTLayoutImpl.h b/src/FTLayout/FTLayoutImpl.h
index 6d739d7..4bc0aa6 100644
--- a/src/FTLayout/FTLayoutImpl.h
+++ b/src/FTLayout/FTLayoutImpl.h
@@ -39,64 +39,6 @@ class FTLayoutImpl
 
         virtual ~FTLayoutImpl();
 
-        /**
-         * Get the bounding box for a formatted 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
-         */
-        virtual void BBox(const char* string, float& llx, float& lly,
-                          float& llz, float& urx, float& ury, float& urz) = 0;
-
-        /**
-         * Get the bounding box for a formatted 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
-         */
-        virtual void BBox(const wchar_t* string, float& llx, float& lly,
-                          float& llz, float& urx, float& ury, float& urz) = 0;
-
-        /**
-         * Render a string of characters
-         *
-         * @param string    'C' style string to be output.
-         */
-        virtual void Render(const char *string) = 0;
-
-        /**
-         * Render a string of characters
-         *
-         * @param string    'C' style string to be output.
-         * @param renderMode  Render mode to diplay
-         */
-        virtual void Render(const char *string, int renderMode) = 0;
-
-        /**
-         * Render a string of characters
-         *
-         * @param string    wchar_t string to be output.
-         */
-        virtual void Render(const wchar_t *string) = 0;
-
-        /**
-         * Render a string of characters
-         *
-         * @param string    wchar_t string to be output.
-         * @param renderMode  Render mode to diplay
-         */
-        virtual void Render(const wchar_t *string, int renderMode) = 0;
-
     protected:
         /**
          * Current pen or cursor position;
diff --git a/src/FTLayout/FTSimpleLayout.cpp b/src/FTLayout/FTSimpleLayout.cpp
index ea8529b..76ae367 100644
--- a/src/FTLayout/FTSimpleLayout.cpp
+++ b/src/FTLayout/FTSimpleLayout.cpp
@@ -38,9 +38,52 @@
 //
 
 
-FTSimpleLayout::FTSimpleLayout()
+FTSimpleLayout::FTSimpleLayout() :
+    FTLayout(new FTSimpleLayoutImpl())
+{}
+
+
+FTSimpleLayout::~FTSimpleLayout()
+{}
+
+
+void FTSimpleLayout::BBox(const char *string, float& llx, float& lly,
+                              float& llz, float& urx, float& ury, float& urz)
+{
+    dynamic_cast<FTSimpleLayoutImpl*>(impl)->BBox(string, llx, lly, llz,
+                                                  urx, ury, urz);
+}
+
+
+void FTSimpleLayout::BBox(const wchar_t *string, float& llx, float& lly,
+                              float& llz, float& urx, float& ury, float& urz)
+{
+    dynamic_cast<FTSimpleLayoutImpl*>(impl)->BBox(string, llx, lly, llz,
+                                                  urx, ury, urz);
+}
+
+
+void FTSimpleLayout::Render(const char *string)
+{
+    dynamic_cast<FTSimpleLayoutImpl*>(impl)->Render(string);
+}
+
+
+void FTSimpleLayout::Render(const wchar_t* string)
+{
+    dynamic_cast<FTSimpleLayoutImpl*>(impl)->Render(string);
+}
+
+
+void FTSimpleLayout::Render(const char *string, int renderMode)
+{
+    dynamic_cast<FTSimpleLayoutImpl*>(impl)->Render(string, renderMode);
+}
+
+
+void FTSimpleLayout::Render(const wchar_t* string, int renderMode)
 {
-    impl = new FTSimpleLayoutImpl();
+    dynamic_cast<FTSimpleLayoutImpl*>(impl)->Render(string, renderMode);
 }