Commit f7d0017882321606d9fdb9e2899e226254d5cc69

sammy 2008-05-19T15:45:47

* Starting the buffer font class revival. For now, it just consists in empty FTBuffer, FTBufferGlyph and FTBufferFont classes.

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
diff --git a/src/FTBuffer.cpp b/src/FTBuffer.cpp
new file mode 100644
index 0000000..339298c
--- /dev/null
+++ b/src/FTBuffer.cpp
@@ -0,0 +1,37 @@
+/*
+ * FTGL - OpenGL font library
+ *
+ * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "config.h"
+
+#include "FTGL/ftgl.h"
+
+FTBuffer::FTBuffer()
+{
+}
+
+FTBuffer::~FTBuffer()
+{
+}
+
diff --git a/src/FTFont/FTBufferFont.cpp b/src/FTFont/FTBufferFont.cpp
new file mode 100644
index 0000000..7e8e6bb
--- /dev/null
+++ b/src/FTFont/FTBufferFont.cpp
@@ -0,0 +1,88 @@
+/*
+ * FTGL - OpenGL font library
+ *
+ * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "config.h"
+
+#include "FTGL/ftgl.h"
+
+#include "FTInternals.h"
+#include "FTBufferFontImpl.h"
+
+
+//
+//  FTBufferFont
+//
+
+
+FTBufferFont::FTBufferFont(char const *fontFilePath) :
+    FTFont(new FTBufferFontImpl(this, fontFilePath))
+{}
+
+
+FTBufferFont::FTBufferFont(unsigned char const *pBufferBytes,
+                           size_t bufferSizeInBytes) :
+    FTFont(new FTBufferFontImpl(this, pBufferBytes, bufferSizeInBytes))
+{}
+
+
+FTBufferFont::~FTBufferFont()
+{}
+
+
+FTGlyph* FTBufferFont::MakeGlyph(FT_GlyphSlot ftGlyph)
+{
+    return new FTBufferGlyph(ftGlyph);
+}
+
+
+//
+//  FTBufferFontImpl
+//
+
+
+template <typename T>
+inline FTPoint FTBufferFontImpl::RenderI(const T* string, const int len,
+                                         FTPoint position, FTPoint spacing,
+                                         int renderMode)
+{
+    return position;
+}
+
+
+FTPoint FTBufferFontImpl::Render(const char * string, const int len,
+                                 FTPoint position, FTPoint spacing,
+                                 int renderMode)
+{
+    return RenderI(string, len, position, spacing, renderMode);
+}
+
+
+FTPoint FTBufferFontImpl::Render(const wchar_t * string, const int len,
+                                 FTPoint position, FTPoint spacing,
+                                 int renderMode)
+{
+    return RenderI(string, len, position, spacing, renderMode);
+}
+
diff --git a/src/FTFont/FTBufferFontImpl.h b/src/FTFont/FTBufferFontImpl.h
new file mode 100644
index 0000000..6352926
--- /dev/null
+++ b/src/FTFont/FTBufferFontImpl.h
@@ -0,0 +1,61 @@
+/*
+ * FTGL - OpenGL font library
+ *
+ * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __FTBufferFontImpl__
+#define __FTBufferFontImpl__
+
+#include "FTFontImpl.h"
+
+class FTGlyph;
+
+class FTBufferFontImpl : public FTFontImpl
+{
+    friend class FTBufferFont;
+
+    protected:
+        FTBufferFontImpl(FTFont *ftFont, const char* fontFilePath) :
+            FTFontImpl(ftFont, fontFilePath) {};
+
+        FTBufferFontImpl(FTFont *ftFont, const unsigned char *pBufferBytes,
+                         size_t bufferSizeInBytes) :
+            FTFontImpl(ftFont, pBufferBytes, bufferSizeInBytes) {};
+
+        virtual FTPoint Render(const char *s, const int len,
+                               FTPoint position, FTPoint spacing,
+                               int renderMode);
+
+        virtual FTPoint Render(const wchar_t *s, const int len,
+                               FTPoint position, FTPoint spacing,
+                               int renderMode);
+
+    private:
+        /* Internal generic Render() implementation */
+        template <typename T>
+        inline FTPoint RenderI(const T *s, const int len,
+                               FTPoint position, FTPoint spacing, int mode);
+};
+
+#endif  //  __FTBufferFontImpl__
+
diff --git a/src/FTFont/FTFontGlue.cpp b/src/FTFont/FTFontGlue.cpp
index 774ada7..9abd7d0 100644
--- a/src/FTFont/FTFontGlue.cpp
+++ b/src/FTFont/FTFontGlue.cpp
@@ -52,6 +52,10 @@ FTGL_BEGIN_C_DECLS
 C_TOR(ftglCreateBitmapFont, (const char *fontname),
       FTBitmapFont, (fontname), FONT_BITMAP);
 
+// FTBufferFont::FTBufferFont();
+C_TOR(ftglCreateBufferFont, (const char *fontname),
+      FTBufferFont, (fontname), FONT_BUFFER);
+
 // FTExtrudeFont::FTExtrudeFont();
 C_TOR(ftglCreateExtrudeFont, (const char *fontname),
       FTExtrudeFont, (fontname), FONT_EXTRUDE);
diff --git a/src/FTGL/FTBuffer.h b/src/FTGL/FTBuffer.h
new file mode 100644
index 0000000..a23b469
--- /dev/null
+++ b/src/FTGL/FTBuffer.h
@@ -0,0 +1,57 @@
+/*
+ * FTGL - OpenGL font library
+ *
+ * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __ftgl__
+#   warning Please use <FTGL/ftgl.h> instead of <FTBuffer.h>.
+#   include <FTGL/ftgl.h>
+#endif
+
+#ifndef __FTBuffer__
+#define __FTBuffer__
+
+#ifdef __cplusplus
+
+/**
+ * FTBuffer is a helper class for pixel buffers.
+ *
+ * It provides the interface between FTBufferFont and FTBufferGlyph to
+ * optimise rendering operations.
+ *
+ * @see FTBufferGlyph
+ * @see FTBufferFont
+ */
+class FTGL_EXPORT FTBuffer
+{
+    public:
+        FTBuffer();
+        ~FTBuffer();
+        int width, height, pitch, x, y;
+        void *pixels;
+};
+
+#endif //__cplusplus
+
+#endif // __FTBuffer__
+
diff --git a/src/FTGL/FTBufferFont.h b/src/FTGL/FTBufferFont.h
new file mode 100644
index 0000000..15d358d
--- /dev/null
+++ b/src/FTGL/FTBufferFont.h
@@ -0,0 +1,99 @@
+/*
+ * FTGL - OpenGL font library
+ *
+ * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __ftgl__
+#   warning Please use <FTGL/ftgl.h> instead of <FTBufferFont.h>.
+#   include <FTGL/ftgl.h>
+#endif
+
+#ifndef __FTBufferFont__
+#define __FTBufferFont__
+
+#ifdef __cplusplus
+
+
+/**
+ * FTBufferFont is a specialisation of the FTFont class for handling
+ * memory buffer fonts.
+ *
+ * @see     FTFont
+ */
+class FTGL_EXPORT FTBufferFont : public FTFont
+{
+    public:
+        /**
+         * Open and read a font file. Sets Error flag.
+         *
+         * @param fontFilePath  font file path.
+         */
+        FTBufferFont(const char* 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
+         */
+        FTBufferFont(const unsigned char *pBufferBytes,
+                     size_t bufferSizeInBytes);
+
+        /**
+         * Destructor
+         */
+        ~FTBufferFont();
+
+    protected:
+        /**
+         * Construct a glyph of the correct type.
+         *
+         * Clients must override the function and return their specialised
+         * FTGlyph.
+         *
+         * @param slot  A FreeType glyph slot.
+         * @return  An FT****Glyph or <code>null</code> on failure.
+         */
+        virtual FTGlyph* MakeGlyph(FT_GlyphSlot slot);
+};
+
+#endif //__cplusplus
+
+FTGL_BEGIN_C_DECLS
+
+/**
+ * Create a specialised FTGLfont object for handling memory buffer fonts.
+ *
+ * @param file  The font file name.
+ * @return  An FTGLfont* object.
+ *
+ * @see  FTGLfont
+ */
+FTGL_EXPORT FTGLfont *ftglCreateBufferFont(const char *file);
+
+FTGL_END_C_DECLS
+
+#endif  //  __FTBufferFont__
+
diff --git a/src/FTGL/FTBufferGlyph.h b/src/FTGL/FTBufferGlyph.h
new file mode 100644
index 0000000..f4db52b
--- /dev/null
+++ b/src/FTGL/FTBufferGlyph.h
@@ -0,0 +1,80 @@
+/*
+ * FTGL - OpenGL font library
+ *
+ * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __ftgl__
+#   warning Please use <FTGL/ftgl.h> instead of <FTBufferGlyph.h>.
+#   include <FTGL/ftgl.h>
+#endif
+
+#ifndef __FTBufferGlyph__
+#define __FTBufferGlyph__
+
+#ifdef __cplusplus
+
+
+/**
+ * FTBufferGlyph is a specialisation of FTGlyph for memory buffer rendering.
+ */
+class FTGL_EXPORT FTBufferGlyph : public FTGlyph
+{
+    public:
+        /**
+         * Constructor
+         *
+         * @param glyph The Freetype glyph to be processed
+         */
+        FTBufferGlyph(FT_GlyphSlot glyph);
+
+        /**
+         * Destructor
+         */
+        virtual ~FTBufferGlyph();
+
+        /**
+         * 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
+
+FTGL_BEGIN_C_DECLS
+
+/**
+ * Create a specialisation of FTGLglyph for memory buffer rendering.
+ *
+ * @param glyph The Freetype glyph to be processed
+ * @return  An FTGLglyph* object.
+ */
+FTGL_EXPORT FTGLglyph *ftglCreateBufferGlyph(FT_GlyphSlot glyph);
+
+FTGL_END_C_DECLS
+
+#endif  //  __FTBufferGlyph__
+
diff --git a/src/FTGL/FTFont.h b/src/FTGL/FTFont.h
index 515ab82..9887600 100644
--- a/src/FTGL/FTFont.h
+++ b/src/FTGL/FTFont.h
@@ -76,6 +76,7 @@ class FTGL_EXPORT FTFont
     private:
         /* Allow our internal subclasses to access the private constructor */
         friend class FTBitmapFont;
+        friend class FTBufferFont;
         friend class FTExtrudeFont;
         friend class FTOutlineFont;
         friend class FTPixmapFont;
diff --git a/src/FTGL/FTGlyph.h b/src/FTGL/FTGlyph.h
index ff8e437..bffe244 100644
--- a/src/FTGL/FTGlyph.h
+++ b/src/FTGL/FTGlyph.h
@@ -68,6 +68,7 @@ class FTGL_EXPORT FTGlyph
 
         /* Allow our internal subclasses to access the private constructor */
         friend class FTBitmapGlyph;
+        friend class FTBufferGlyph;
         friend class FTExtrudeGlyph;
         friend class FTOutlineGlyph;
         friend class FTPixmapGlyph;
diff --git a/src/FTGL/ftgl.h b/src/FTGL/ftgl.h
index 67b0237..f5d043c 100644
--- a/src/FTGL/ftgl.h
+++ b/src/FTGL/ftgl.h
@@ -109,9 +109,11 @@ namespace FTGL
 
 #include <FTGL/FTPoint.h>
 #include <FTGL/FTBBox.h>
+#include <FTGL/FTBuffer.h>
 
 #include <FTGL/FTGlyph.h>
 #include <FTGL/FTBitmapGlyph.h>
+#include <FTGL/FTBufferGlyph.h>
 #include <FTGL/FTExtrdGlyph.h>
 #include <FTGL/FTOutlineGlyph.h>
 #include <FTGL/FTPixmapGlyph.h>
@@ -120,6 +122,7 @@ namespace FTGL
 
 #include <FTGL/FTFont.h>
 #include <FTGL/FTGLBitmapFont.h>
+#include <FTGL/FTBufferFont.h>
 #include <FTGL/FTGLExtrdFont.h>
 #include <FTGL/FTGLOutlineFont.h>
 #include <FTGL/FTGLPixmapFont.h>
diff --git a/src/FTGlyph/FTBufferGlyph.cpp b/src/FTGlyph/FTBufferGlyph.cpp
new file mode 100644
index 0000000..7cab0c6
--- /dev/null
+++ b/src/FTGlyph/FTBufferGlyph.cpp
@@ -0,0 +1,75 @@
+/*
+ * FTGL - OpenGL font library
+ *
+ * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "config.h"
+
+#include <string>
+
+#include "FTGL/ftgl.h"
+
+#include "FTInternals.h"
+#include "FTBufferGlyphImpl.h"
+
+
+//
+//  FTGLBufferGlyph
+//
+
+
+FTBufferGlyph::FTBufferGlyph(FT_GlyphSlot glyph) :
+    FTGlyph(new FTBufferGlyphImpl(glyph))
+{}
+
+
+FTBufferGlyph::~FTBufferGlyph()
+{}
+
+
+const FTPoint& FTBufferGlyph::Render(const FTPoint& pen, int renderMode)
+{
+    FTBufferGlyphImpl *myimpl = dynamic_cast<FTBufferGlyphImpl *>(impl);
+    return myimpl->RenderImpl(pen, renderMode);
+}
+
+
+//
+//  FTGLBufferGlyphImpl
+//
+
+
+FTBufferGlyphImpl::FTBufferGlyphImpl(FT_GlyphSlot glyph)
+:   FTGlyphImpl(glyph)
+{}
+
+
+FTBufferGlyphImpl::~FTBufferGlyphImpl()
+{}
+
+
+const FTPoint& FTBufferGlyphImpl::RenderImpl(const FTPoint& pen, int renderMode)
+{
+    return pen;
+}
+
diff --git a/src/FTGlyph/FTBufferGlyphImpl.h b/src/FTGlyph/FTBufferGlyphImpl.h
new file mode 100644
index 0000000..ba9cc8d
--- /dev/null
+++ b/src/FTGlyph/FTBufferGlyphImpl.h
@@ -0,0 +1,44 @@
+/*
+ * FTGL - OpenGL font library
+ *
+ * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __FTBufferGlyphImpl__
+#define __FTBufferGlyphImpl__
+
+#include "FTGlyphImpl.h"
+
+class FTBufferGlyphImpl : public FTGlyphImpl
+{
+    friend class FTBufferGlyph;
+
+    protected:
+        FTBufferGlyphImpl(FT_GlyphSlot glyph);
+
+        virtual ~FTBufferGlyphImpl();
+
+        virtual const FTPoint& RenderImpl(const FTPoint& pen, int renderMode);
+};
+
+#endif  //  __FTBufferGlyphImpl__
+
diff --git a/src/FTGlyph/FTGlyphGlue.cpp b/src/FTGlyph/FTGlyphGlue.cpp
index f140ed0..7c1ee29 100644
--- a/src/FTGlyph/FTGlyphGlue.cpp
+++ b/src/FTGlyph/FTGlyphGlue.cpp
@@ -54,6 +54,10 @@ FTGL_BEGIN_C_DECLS
 C_TOR(ftglCreateBitmapGlyph, (FT_GlyphSlot glyph),
       FTBitmapGlyph, (glyph), GLYPH_BITMAP);
 
+// FTBufferGlyph::FTBufferGlyph();
+C_TOR(ftglCreateBufferGlyph, (FT_GlyphSlot glyph),
+      FTBufferGlyph, (glyph), GLYPH_BUFFER);
+
 // FTExtrudeGlyph::FTExtrudeGlyph();
 C_TOR(ftglCreateExtrudeGlyph, (FT_GlyphSlot glyph, float depth,
                    float frontOutset, float backOutset, int useDisplayList),
diff --git a/src/FTInternals.h b/src/FTInternals.h
index 310da24..a4ef22e 100644
--- a/src/FTInternals.h
+++ b/src/FTInternals.h
@@ -94,6 +94,7 @@ typedef enum
 {
     GLYPH_CUSTOM,
     GLYPH_BITMAP,
+    GLYPH_BUFFER,
     GLYPH_PIXMAP,
     GLYPH_OUTLINE,
     GLYPH_POLYGON,
@@ -111,6 +112,7 @@ typedef enum
 {
     FONT_CUSTOM,
     FONT_BITMAP,
+    FONT_BUFFER,
     FONT_PIXMAP,
     FONT_OUTLINE,
     FONT_POLYGON,
diff --git a/src/Makefile.am b/src/Makefile.am
index bf4abd7..47dea29 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,6 +2,7 @@
 lib_LTLIBRARIES = libftgl.la
 
 libftgl_la_SOURCES = \
+    FTBuffer.cpp \
     FTCharmap.cpp \
     FTCharmap.h \
     FTCharToGlyphIndexMap.h \
@@ -39,9 +40,11 @@ ftgl_HEADERS = $(ftgl_headers)
 ftgl_headers = \
     FTGL/ftgl.h \
     FTGL/FTBBox.h \
+    FTGL/FTBuffer.h \
     FTGL/FTPoint.h \
     FTGL/FTGlyph.h \
     FTGL/FTBitmapGlyph.h \
+    FTGL/FTBufferGlyph.h \
     FTGL/FTExtrdGlyph.h \
     FTGL/FTOutlineGlyph.h \
     FTGL/FTPixmapGlyph.h \
@@ -49,6 +52,7 @@ ftgl_headers = \
     FTGL/FTTextureGlyph.h \
     FTGL/FTFont.h \
     FTGL/FTGLBitmapFont.h \
+    FTGL/FTBufferFont.h \
     FTGL/FTGLExtrdFont.h \
     FTGL/FTGLOutlineFont.h \
     FTGL/FTGLPixmapFont.h \
@@ -64,6 +68,8 @@ ftglyph_sources = \
     FTGlyph/FTGlyphGlue.cpp \
     FTGlyph/FTBitmapGlyph.cpp \
     FTGlyph/FTBitmapGlyphImpl.h \
+    FTGlyph/FTBufferGlyph.cpp \
+    FTGlyph/FTBufferGlyphImpl.h \
     FTGlyph/FTExtrudeGlyph.cpp \
     FTGlyph/FTExtrudeGlyphImpl.h \
     FTGlyph/FTOutlineGlyph.cpp \
@@ -82,6 +88,8 @@ ftfont_sources = \
     FTFont/FTFontGlue.cpp \
     FTFont/FTBitmapFont.cpp \
     FTFont/FTBitmapFontImpl.h \
+    FTFont/FTBufferFont.cpp \
+    FTFont/FTBufferFontImpl.h \
     FTFont/FTExtrudeFont.cpp \
     FTFont/FTExtrudeFontImpl.h \
     FTFont/FTOutlineFont.cpp \