Commit bef8de2a85616b7b7e90a712189a6f133a4c1b7b

Werner Lemberg 2017-12-08T10:02:12

Move `ftdriver.h' to `ftdrv.h'. * include/freetype/internal/ftdriver.h: Renamed to... * include/freetype/internal/ftdrv.h: ... this name. * include/freetype/internal/internal.h (FT_INTERNAL_DRIVER_H): Updated.

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
diff --git a/ChangeLog b/ChangeLog
index 1d59ec9..dd95e61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2017-12-08  Werner Lemberg  <wl@gnu.org>
 
+	Move `ftdriver.h' to `ftdrv.h'.
+
+	* include/freetype/internal/ftdriver.h: Renamed to...
+	* include/freetype/internal/ftdrv.h: ... this name.
+
+	* include/freetype/internal/internal.h (FT_INTERNAL_DRIVER_H):
+	Updated.
+
+2017-12-08  Werner Lemberg  <wl@gnu.org>
+
 	Fix access to uninitalized memory (#52613).
 
 	Also reported as
diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdriver.h
deleted file mode 100644
index e82fa8d..0000000
--- a/include/freetype/internal/ftdriver.h
+++ /dev/null
@@ -1,400 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ftdriver.h                                                             */
-/*                                                                         */
-/*    FreeType font driver interface (specification).                      */
-/*                                                                         */
-/*  Copyright 1996-2017 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
-
-
-#ifndef FTDRIVER_H_
-#define FTDRIVER_H_
-
-
-#include <ft2build.h>
-#include FT_MODULE_H
-
-
-FT_BEGIN_HEADER
-
-
-  typedef FT_Error
-  (*FT_Face_InitFunc)( FT_Stream      stream,
-                       FT_Face        face,
-                       FT_Int         typeface_index,
-                       FT_Int         num_params,
-                       FT_Parameter*  parameters );
-
-  typedef void
-  (*FT_Face_DoneFunc)( FT_Face  face );
-
-
-  typedef FT_Error
-  (*FT_Size_InitFunc)( FT_Size  size );
-
-  typedef void
-  (*FT_Size_DoneFunc)( FT_Size  size );
-
-
-  typedef FT_Error
-  (*FT_Slot_InitFunc)( FT_GlyphSlot  slot );
-
-  typedef void
-  (*FT_Slot_DoneFunc)( FT_GlyphSlot  slot );
-
-
-  typedef FT_Error
-  (*FT_Size_RequestFunc)( FT_Size          size,
-                          FT_Size_Request  req );
-
-  typedef FT_Error
-  (*FT_Size_SelectFunc)( FT_Size   size,
-                         FT_ULong  size_index );
-
-  typedef FT_Error
-  (*FT_Slot_LoadFunc)( FT_GlyphSlot  slot,
-                       FT_Size       size,
-                       FT_UInt       glyph_index,
-                       FT_Int32      load_flags );
-
-
-  typedef FT_Error
-  (*FT_Face_GetKerningFunc)( FT_Face     face,
-                             FT_UInt     left_glyph,
-                             FT_UInt     right_glyph,
-                             FT_Vector*  kerning );
-
-
-  typedef FT_Error
-  (*FT_Face_AttachFunc)( FT_Face    face,
-                         FT_Stream  stream );
-
-
-  typedef FT_Error
-  (*FT_Face_GetAdvancesFunc)( FT_Face    face,
-                              FT_UInt    first,
-                              FT_UInt    count,
-                              FT_Int32   flags,
-                              FT_Fixed*  advances );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    FT_Driver_ClassRec                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    The font driver class.  This structure mostly contains pointers to */
-  /*    driver methods.                                                    */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    root             :: The parent module.                             */
-  /*                                                                       */
-  /*    face_object_size :: The size of a face object in bytes.            */
-  /*                                                                       */
-  /*    size_object_size :: The size of a size object in bytes.            */
-  /*                                                                       */
-  /*    slot_object_size :: The size of a glyph object in bytes.           */
-  /*                                                                       */
-  /*    init_face        :: The format-specific face constructor.          */
-  /*                                                                       */
-  /*    done_face        :: The format-specific face destructor.           */
-  /*                                                                       */
-  /*    init_size        :: The format-specific size constructor.          */
-  /*                                                                       */
-  /*    done_size        :: The format-specific size destructor.           */
-  /*                                                                       */
-  /*    init_slot        :: The format-specific slot constructor.          */
-  /*                                                                       */
-  /*    done_slot        :: The format-specific slot destructor.           */
-  /*                                                                       */
-  /*                                                                       */
-  /*    load_glyph       :: A function handle to load a glyph to a slot.   */
-  /*                        This field is mandatory!                       */
-  /*                                                                       */
-  /*    get_kerning      :: A function handle to return the unscaled       */
-  /*                        kerning for a given pair of glyphs.  Can be    */
-  /*                        set to 0 if the format doesn't support         */
-  /*                        kerning.                                       */
-  /*                                                                       */
-  /*    attach_file      :: This function handle is used to read           */
-  /*                        additional data for a face from another        */
-  /*                        file/stream.  For example, this can be used to */
-  /*                        add data from AFM or PFM files on a Type 1     */
-  /*                        face, or a CIDMap on a CID-keyed face.         */
-  /*                                                                       */
-  /*    get_advances     :: A function handle used to return advance       */
-  /*                        widths of `count' glyphs (in font units),      */
-  /*                        starting at `first'.  The `vertical' flag must */
-  /*                        be set to get vertical advance heights.  The   */
-  /*                        `advances' buffer is caller-allocated.         */
-  /*                        The idea of this function is to be able to     */
-  /*                        perform device-independent text layout without */
-  /*                        loading a single glyph image.                  */
-  /*                                                                       */
-  /*    request_size     :: A handle to a function used to request the new */
-  /*                        character size.  Can be set to 0 if the        */
-  /*                        scaling done in the base layer suffices.       */
-  /*                                                                       */
-  /*    select_size      :: A handle to a function used to select a new    */
-  /*                        fixed size.  It is used only if                */
-  /*                        @FT_FACE_FLAG_FIXED_SIZES is set.  Can be set  */
-  /*                        to 0 if the scaling done in the base layer     */
-  /*                        suffices.                                      */
-  /* <Note>                                                                */
-  /*    Most function pointers, with the exception of `load_glyph', can be */
-  /*    set to 0 to indicate a default behaviour.                          */
-  /*                                                                       */
-  typedef struct  FT_Driver_ClassRec_
-  {
-    FT_Module_Class          root;
-
-    FT_Long                  face_object_size;
-    FT_Long                  size_object_size;
-    FT_Long                  slot_object_size;
-
-    FT_Face_InitFunc         init_face;
-    FT_Face_DoneFunc         done_face;
-
-    FT_Size_InitFunc         init_size;
-    FT_Size_DoneFunc         done_size;
-
-    FT_Slot_InitFunc         init_slot;
-    FT_Slot_DoneFunc         done_slot;
-
-    FT_Slot_LoadFunc         load_glyph;
-
-    FT_Face_GetKerningFunc   get_kerning;
-    FT_Face_AttachFunc       attach_file;
-    FT_Face_GetAdvancesFunc  get_advances;
-
-    /* since version 2.2 */
-    FT_Size_RequestFunc      request_size;
-    FT_Size_SelectFunc       select_size;
-
-  } FT_Driver_ClassRec, *FT_Driver_Class;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Macro>                                                               */
-  /*    FT_DECLARE_DRIVER                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Used to create a forward declaration of an FT_Driver_ClassRec      */
-  /*    struct instance.                                                   */
-  /*                                                                       */
-  /* <Macro>                                                               */
-  /*    FT_DEFINE_DRIVER                                                   */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Used to initialize an instance of FT_Driver_ClassRec struct.       */
-  /*                                                                       */
-  /*    When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */
-  /*    called with a pointer where the allocated structure is returned.   */
-  /*    And when it is no longer needed a `destroy' function needs to be   */
-  /*    called to release that allocation.                                 */
-  /*                                                                       */
-  /*    `ftinit.c' (ft_create_default_module_classes) already contains a   */
-  /*    mechanism to call these functions for the default modules          */
-  /*    described in `ftmodule.h'.                                         */
-  /*                                                                       */
-  /*    Notice that the created `create' and `destroy' functions call      */
-  /*    `pic_init' and `pic_free' to allow you to manually allocate and    */
-  /*    initialize any additional global data, like a module specific      */
-  /*    interface, and put them in the global pic container defined in     */
-  /*    `ftpic.h'.  If you don't need them just implement the functions as */
-  /*    empty to resolve the link error.  Also the `pic_init' and          */
-  /*    `pic_free' functions should be declared in `pic.h', to be referred */
-  /*    by driver definition calling `FT_DEFINE_DRIVER' in following.      */
-  /*                                                                       */
-  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
-  /*    allocated in the global scope (or the scope where the macro is     */
-  /*    used).                                                             */
-  /*                                                                       */
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define FT_DECLARE_DRIVER( class_ )  \
-  FT_CALLBACK_TABLE                  \
-  const FT_Driver_ClassRec  class_;
-
-#define FT_DEFINE_DRIVER(                    \
-          class_,                            \
-          flags_,                            \
-          size_,                             \
-          name_,                             \
-          version_,                          \
-          requires_,                         \
-          interface_,                        \
-          init_,                             \
-          done_,                             \
-          get_interface_,                    \
-          face_object_size_,                 \
-          size_object_size_,                 \
-          slot_object_size_,                 \
-          init_face_,                        \
-          done_face_,                        \
-          init_size_,                        \
-          done_size_,                        \
-          init_slot_,                        \
-          done_slot_,                        \
-          load_glyph_,                       \
-          get_kerning_,                      \
-          attach_file_,                      \
-          get_advances_,                     \
-          request_size_,                     \
-          select_size_ )                     \
-  FT_CALLBACK_TABLE_DEF                      \
-  const FT_Driver_ClassRec  class_ =         \
-  {                                          \
-    FT_DEFINE_ROOT_MODULE( flags_,           \
-                           size_,            \
-                           name_,            \
-                           version_,         \
-                           requires_,        \
-                           interface_,       \
-                           init_,            \
-                           done_,            \
-                           get_interface_ )  \
-                                             \
-    face_object_size_,                       \
-    size_object_size_,                       \
-    slot_object_size_,                       \
-                                             \
-    init_face_,                              \
-    done_face_,                              \
-                                             \
-    init_size_,                              \
-    done_size_,                              \
-                                             \
-    init_slot_,                              \
-    done_slot_,                              \
-                                             \
-    load_glyph_,                             \
-                                             \
-    get_kerning_,                            \
-    attach_file_,                            \
-    get_advances_,                           \
-                                             \
-    request_size_,                           \
-    select_size_                             \
-  };
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#define FT_DECLARE_DRIVER( class_ )  FT_DECLARE_MODULE( class_ )
-
-#define FT_DEFINE_DRIVER(                                        \
-          class_,                                                \
-          flags_,                                                \
-          size_,                                                 \
-          name_,                                                 \
-          version_,                                              \
-          requires_,                                             \
-          interface_,                                            \
-          init_,                                                 \
-          done_,                                                 \
-          get_interface_,                                        \
-          face_object_size_,                                     \
-          size_object_size_,                                     \
-          slot_object_size_,                                     \
-          init_face_,                                            \
-          done_face_,                                            \
-          init_size_,                                            \
-          done_size_,                                            \
-          init_slot_,                                            \
-          done_slot_,                                            \
-          load_glyph_,                                           \
-          get_kerning_,                                          \
-          attach_file_,                                          \
-          get_advances_,                                         \
-          request_size_,                                         \
-          select_size_ )                                         \
-  void                                                           \
-  FT_Destroy_Class_ ## class_( FT_Library        library,        \
-                               FT_Module_Class*  clazz )         \
-  {                                                              \
-    FT_Memory        memory = library->memory;                   \
-    FT_Driver_Class  dclazz = (FT_Driver_Class)clazz;            \
-                                                                 \
-                                                                 \
-    class_ ## _pic_free( library );                              \
-    if ( dclazz )                                                \
-      FT_FREE( dclazz );                                         \
-  }                                                              \
-                                                                 \
-                                                                 \
-  FT_Error                                                       \
-  FT_Create_Class_ ## class_( FT_Library         library,        \
-                              FT_Module_Class**  output_class )  \
-  {                                                              \
-    FT_Driver_Class  clazz  = NULL;                              \
-    FT_Error         error;                                      \
-    FT_Memory        memory = library->memory;                   \
-                                                                 \
-                                                                 \
-    if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) )                  \
-      return error;                                              \
-                                                                 \
-    error = class_ ## _pic_init( library );                      \
-    if ( error )                                                 \
-    {                                                            \
-      FT_FREE( clazz );                                          \
-      return error;                                              \
-    }                                                            \
-                                                                 \
-    FT_DEFINE_ROOT_MODULE( flags_,                               \
-                           size_,                                \
-                           name_,                                \
-                           version_,                             \
-                           requires_,                            \
-                           interface_,                           \
-                           init_,                                \
-                           done_,                                \
-                           get_interface_ )                      \
-                                                                 \
-    clazz->face_object_size = face_object_size_;                 \
-    clazz->size_object_size = size_object_size_;                 \
-    clazz->slot_object_size = slot_object_size_;                 \
-                                                                 \
-    clazz->init_face        = init_face_;                        \
-    clazz->done_face        = done_face_;                        \
-                                                                 \
-    clazz->init_size        = init_size_;                        \
-    clazz->done_size        = done_size_;                        \
-                                                                 \
-    clazz->init_slot        = init_slot_;                        \
-    clazz->done_slot        = done_slot_;                        \
-                                                                 \
-    clazz->load_glyph       = load_glyph_;                       \
-                                                                 \
-    clazz->get_kerning      = get_kerning_;                      \
-    clazz->attach_file      = attach_file_;                      \
-    clazz->get_advances     = get_advances_;                     \
-                                                                 \
-    clazz->request_size     = request_size_;                     \
-    clazz->select_size      = select_size_;                      \
-                                                                 \
-    *output_class = (FT_Module_Class*)clazz;                     \
-                                                                 \
-    return FT_Err_Ok;                                            \
-  }
-
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-FT_END_HEADER
-
-#endif /* FTDRIVER_H_ */
-
-
-/* END */
diff --git a/include/freetype/internal/ftdrv.h b/include/freetype/internal/ftdrv.h
new file mode 100644
index 0000000..fd8f1c7
--- /dev/null
+++ b/include/freetype/internal/ftdrv.h
@@ -0,0 +1,400 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftdrv.h                                                                */
+/*                                                                         */
+/*    FreeType internal font driver interface (specification).             */
+/*                                                                         */
+/*  Copyright 1996-2017 by                                                 */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef FTDRV_H_
+#define FTDRV_H_
+
+
+#include <ft2build.h>
+#include FT_MODULE_H
+
+
+FT_BEGIN_HEADER
+
+
+  typedef FT_Error
+  (*FT_Face_InitFunc)( FT_Stream      stream,
+                       FT_Face        face,
+                       FT_Int         typeface_index,
+                       FT_Int         num_params,
+                       FT_Parameter*  parameters );
+
+  typedef void
+  (*FT_Face_DoneFunc)( FT_Face  face );
+
+
+  typedef FT_Error
+  (*FT_Size_InitFunc)( FT_Size  size );
+
+  typedef void
+  (*FT_Size_DoneFunc)( FT_Size  size );
+
+
+  typedef FT_Error
+  (*FT_Slot_InitFunc)( FT_GlyphSlot  slot );
+
+  typedef void
+  (*FT_Slot_DoneFunc)( FT_GlyphSlot  slot );
+
+
+  typedef FT_Error
+  (*FT_Size_RequestFunc)( FT_Size          size,
+                          FT_Size_Request  req );
+
+  typedef FT_Error
+  (*FT_Size_SelectFunc)( FT_Size   size,
+                         FT_ULong  size_index );
+
+  typedef FT_Error
+  (*FT_Slot_LoadFunc)( FT_GlyphSlot  slot,
+                       FT_Size       size,
+                       FT_UInt       glyph_index,
+                       FT_Int32      load_flags );
+
+
+  typedef FT_Error
+  (*FT_Face_GetKerningFunc)( FT_Face     face,
+                             FT_UInt     left_glyph,
+                             FT_UInt     right_glyph,
+                             FT_Vector*  kerning );
+
+
+  typedef FT_Error
+  (*FT_Face_AttachFunc)( FT_Face    face,
+                         FT_Stream  stream );
+
+
+  typedef FT_Error
+  (*FT_Face_GetAdvancesFunc)( FT_Face    face,
+                              FT_UInt    first,
+                              FT_UInt    count,
+                              FT_Int32   flags,
+                              FT_Fixed*  advances );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    FT_Driver_ClassRec                                                 */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    The font driver class.  This structure mostly contains pointers to */
+  /*    driver methods.                                                    */
+  /*                                                                       */
+  /* <Fields>                                                              */
+  /*    root             :: The parent module.                             */
+  /*                                                                       */
+  /*    face_object_size :: The size of a face object in bytes.            */
+  /*                                                                       */
+  /*    size_object_size :: The size of a size object in bytes.            */
+  /*                                                                       */
+  /*    slot_object_size :: The size of a glyph object in bytes.           */
+  /*                                                                       */
+  /*    init_face        :: The format-specific face constructor.          */
+  /*                                                                       */
+  /*    done_face        :: The format-specific face destructor.           */
+  /*                                                                       */
+  /*    init_size        :: The format-specific size constructor.          */
+  /*                                                                       */
+  /*    done_size        :: The format-specific size destructor.           */
+  /*                                                                       */
+  /*    init_slot        :: The format-specific slot constructor.          */
+  /*                                                                       */
+  /*    done_slot        :: The format-specific slot destructor.           */
+  /*                                                                       */
+  /*                                                                       */
+  /*    load_glyph       :: A function handle to load a glyph to a slot.   */
+  /*                        This field is mandatory!                       */
+  /*                                                                       */
+  /*    get_kerning      :: A function handle to return the unscaled       */
+  /*                        kerning for a given pair of glyphs.  Can be    */
+  /*                        set to 0 if the format doesn't support         */
+  /*                        kerning.                                       */
+  /*                                                                       */
+  /*    attach_file      :: This function handle is used to read           */
+  /*                        additional data for a face from another        */
+  /*                        file/stream.  For example, this can be used to */
+  /*                        add data from AFM or PFM files on a Type 1     */
+  /*                        face, or a CIDMap on a CID-keyed face.         */
+  /*                                                                       */
+  /*    get_advances     :: A function handle used to return advance       */
+  /*                        widths of `count' glyphs (in font units),      */
+  /*                        starting at `first'.  The `vertical' flag must */
+  /*                        be set to get vertical advance heights.  The   */
+  /*                        `advances' buffer is caller-allocated.         */
+  /*                        The idea of this function is to be able to     */
+  /*                        perform device-independent text layout without */
+  /*                        loading a single glyph image.                  */
+  /*                                                                       */
+  /*    request_size     :: A handle to a function used to request the new */
+  /*                        character size.  Can be set to 0 if the        */
+  /*                        scaling done in the base layer suffices.       */
+  /*                                                                       */
+  /*    select_size      :: A handle to a function used to select a new    */
+  /*                        fixed size.  It is used only if                */
+  /*                        @FT_FACE_FLAG_FIXED_SIZES is set.  Can be set  */
+  /*                        to 0 if the scaling done in the base layer     */
+  /*                        suffices.                                      */
+  /* <Note>                                                                */
+  /*    Most function pointers, with the exception of `load_glyph', can be */
+  /*    set to 0 to indicate a default behaviour.                          */
+  /*                                                                       */
+  typedef struct  FT_Driver_ClassRec_
+  {
+    FT_Module_Class          root;
+
+    FT_Long                  face_object_size;
+    FT_Long                  size_object_size;
+    FT_Long                  slot_object_size;
+
+    FT_Face_InitFunc         init_face;
+    FT_Face_DoneFunc         done_face;
+
+    FT_Size_InitFunc         init_size;
+    FT_Size_DoneFunc         done_size;
+
+    FT_Slot_InitFunc         init_slot;
+    FT_Slot_DoneFunc         done_slot;
+
+    FT_Slot_LoadFunc         load_glyph;
+
+    FT_Face_GetKerningFunc   get_kerning;
+    FT_Face_AttachFunc       attach_file;
+    FT_Face_GetAdvancesFunc  get_advances;
+
+    /* since version 2.2 */
+    FT_Size_RequestFunc      request_size;
+    FT_Size_SelectFunc       select_size;
+
+  } FT_Driver_ClassRec, *FT_Driver_Class;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DECLARE_DRIVER                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to create a forward declaration of an FT_Driver_ClassRec      */
+  /*    struct instance.                                                   */
+  /*                                                                       */
+  /* <Macro>                                                               */
+  /*    FT_DEFINE_DRIVER                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Used to initialize an instance of FT_Driver_ClassRec struct.       */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */
+  /*    called with a pointer where the allocated structure is returned.   */
+  /*    And when it is no longer needed a `destroy' function needs to be   */
+  /*    called to release that allocation.                                 */
+  /*                                                                       */
+  /*    `ftinit.c' (ft_create_default_module_classes) already contains a   */
+  /*    mechanism to call these functions for the default modules          */
+  /*    described in `ftmodule.h'.                                         */
+  /*                                                                       */
+  /*    Notice that the created `create' and `destroy' functions call      */
+  /*    `pic_init' and `pic_free' to allow you to manually allocate and    */
+  /*    initialize any additional global data, like a module specific      */
+  /*    interface, and put them in the global pic container defined in     */
+  /*    `ftpic.h'.  If you don't need them just implement the functions as */
+  /*    empty to resolve the link error.  Also the `pic_init' and          */
+  /*    `pic_free' functions should be declared in `pic.h', to be referred */
+  /*    by driver definition calling `FT_DEFINE_DRIVER' in following.      */
+  /*                                                                       */
+  /*    When FT_CONFIG_OPTION_PIC is not defined the struct will be        */
+  /*    allocated in the global scope (or the scope where the macro is     */
+  /*    used).                                                             */
+  /*                                                                       */
+#ifndef FT_CONFIG_OPTION_PIC
+
+#define FT_DECLARE_DRIVER( class_ )  \
+  FT_CALLBACK_TABLE                  \
+  const FT_Driver_ClassRec  class_;
+
+#define FT_DEFINE_DRIVER(                    \
+          class_,                            \
+          flags_,                            \
+          size_,                             \
+          name_,                             \
+          version_,                          \
+          requires_,                         \
+          interface_,                        \
+          init_,                             \
+          done_,                             \
+          get_interface_,                    \
+          face_object_size_,                 \
+          size_object_size_,                 \
+          slot_object_size_,                 \
+          init_face_,                        \
+          done_face_,                        \
+          init_size_,                        \
+          done_size_,                        \
+          init_slot_,                        \
+          done_slot_,                        \
+          load_glyph_,                       \
+          get_kerning_,                      \
+          attach_file_,                      \
+          get_advances_,                     \
+          request_size_,                     \
+          select_size_ )                     \
+  FT_CALLBACK_TABLE_DEF                      \
+  const FT_Driver_ClassRec  class_ =         \
+  {                                          \
+    FT_DEFINE_ROOT_MODULE( flags_,           \
+                           size_,            \
+                           name_,            \
+                           version_,         \
+                           requires_,        \
+                           interface_,       \
+                           init_,            \
+                           done_,            \
+                           get_interface_ )  \
+                                             \
+    face_object_size_,                       \
+    size_object_size_,                       \
+    slot_object_size_,                       \
+                                             \
+    init_face_,                              \
+    done_face_,                              \
+                                             \
+    init_size_,                              \
+    done_size_,                              \
+                                             \
+    init_slot_,                              \
+    done_slot_,                              \
+                                             \
+    load_glyph_,                             \
+                                             \
+    get_kerning_,                            \
+    attach_file_,                            \
+    get_advances_,                           \
+                                             \
+    request_size_,                           \
+    select_size_                             \
+  };
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#define FT_DECLARE_DRIVER( class_ )  FT_DECLARE_MODULE( class_ )
+
+#define FT_DEFINE_DRIVER(                                        \
+          class_,                                                \
+          flags_,                                                \
+          size_,                                                 \
+          name_,                                                 \
+          version_,                                              \
+          requires_,                                             \
+          interface_,                                            \
+          init_,                                                 \
+          done_,                                                 \
+          get_interface_,                                        \
+          face_object_size_,                                     \
+          size_object_size_,                                     \
+          slot_object_size_,                                     \
+          init_face_,                                            \
+          done_face_,                                            \
+          init_size_,                                            \
+          done_size_,                                            \
+          init_slot_,                                            \
+          done_slot_,                                            \
+          load_glyph_,                                           \
+          get_kerning_,                                          \
+          attach_file_,                                          \
+          get_advances_,                                         \
+          request_size_,                                         \
+          select_size_ )                                         \
+  void                                                           \
+  FT_Destroy_Class_ ## class_( FT_Library        library,        \
+                               FT_Module_Class*  clazz )         \
+  {                                                              \
+    FT_Memory        memory = library->memory;                   \
+    FT_Driver_Class  dclazz = (FT_Driver_Class)clazz;            \
+                                                                 \
+                                                                 \
+    class_ ## _pic_free( library );                              \
+    if ( dclazz )                                                \
+      FT_FREE( dclazz );                                         \
+  }                                                              \
+                                                                 \
+                                                                 \
+  FT_Error                                                       \
+  FT_Create_Class_ ## class_( FT_Library         library,        \
+                              FT_Module_Class**  output_class )  \
+  {                                                              \
+    FT_Driver_Class  clazz  = NULL;                              \
+    FT_Error         error;                                      \
+    FT_Memory        memory = library->memory;                   \
+                                                                 \
+                                                                 \
+    if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) )                  \
+      return error;                                              \
+                                                                 \
+    error = class_ ## _pic_init( library );                      \
+    if ( error )                                                 \
+    {                                                            \
+      FT_FREE( clazz );                                          \
+      return error;                                              \
+    }                                                            \
+                                                                 \
+    FT_DEFINE_ROOT_MODULE( flags_,                               \
+                           size_,                                \
+                           name_,                                \
+                           version_,                             \
+                           requires_,                            \
+                           interface_,                           \
+                           init_,                                \
+                           done_,                                \
+                           get_interface_ )                      \
+                                                                 \
+    clazz->face_object_size = face_object_size_;                 \
+    clazz->size_object_size = size_object_size_;                 \
+    clazz->slot_object_size = slot_object_size_;                 \
+                                                                 \
+    clazz->init_face        = init_face_;                        \
+    clazz->done_face        = done_face_;                        \
+                                                                 \
+    clazz->init_size        = init_size_;                        \
+    clazz->done_size        = done_size_;                        \
+                                                                 \
+    clazz->init_slot        = init_slot_;                        \
+    clazz->done_slot        = done_slot_;                        \
+                                                                 \
+    clazz->load_glyph       = load_glyph_;                       \
+                                                                 \
+    clazz->get_kerning      = get_kerning_;                      \
+    clazz->attach_file      = attach_file_;                      \
+    clazz->get_advances     = get_advances_;                     \
+                                                                 \
+    clazz->request_size     = request_size_;                     \
+    clazz->select_size      = select_size_;                      \
+                                                                 \
+    *output_class = (FT_Module_Class*)clazz;                     \
+                                                                 \
+    return FT_Err_Ok;                                            \
+  }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+FT_END_HEADER
+
+#endif /* FTDRV_H_ */
+
+
+/* END */
diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h
index 23f84b4..45ae447 100644
--- a/include/freetype/internal/internal.h
+++ b/include/freetype/internal/internal.h
@@ -31,7 +31,7 @@
 #define FT_INTERNAL_DEBUG_H               <freetype/internal/ftdebug.h>
 #define FT_INTERNAL_CALC_H                <freetype/internal/ftcalc.h>
 #define FT_INTERNAL_HASH_H                <freetype/internal/fthash.h>
-#define FT_INTERNAL_DRIVER_H              <freetype/internal/ftdriver.h>
+#define FT_INTERNAL_DRIVER_H              <freetype/internal/ftdrv.h>
 #define FT_INTERNAL_TRACE_H               <freetype/internal/fttrace.h>
 #define FT_INTERNAL_GLYPH_LOADER_H        <freetype/internal/ftgloadr.h>
 #define FT_INTERNAL_SFNT_H                <freetype/internal/sfnt.h>