Commit e2d12842e1e2717545643faa2a8b8f0ccb22b9ba

David Turner 2003-09-21T17:15:55

* include/freetype/internal/fnttypes.h, include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c, src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c, src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c, src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,: simplification of service lookup macros, updating the PFR and WINFNT font drivers to new services

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
diff --git a/ChangeLog b/ChangeLog
index 18a0550..6b927fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,15 @@
           removing various compiler warnings
 
 
+        * include/freetype/internal/fnttypes.h,
+        include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
+        src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
+        src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
+        src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:
+
+          simplification of service lookup macros, updating the PFR and
+          WINFNT font drivers to new services
+
 
 2003-09-19  David Bevan  <dbevan@emtex.com>
 
diff --git a/include/freetype/internal/fnttypes.h b/include/freetype/internal/fnttypes.h
deleted file mode 100644
index 3efa860..0000000
--- a/include/freetype/internal/fnttypes.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  fnttypes.h                                                             */
-/*                                                                         */
-/*    Basic Windows FNT/FON type definitions and interface (specification  */
-/*    only).                                                               */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 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 __FNTTYPES_H__
-#define __FNTTYPES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_WINFONTS_H
-
-
-FT_BEGIN_HEADER
-
-
-  typedef struct  WinMZ_HeaderRec_
-  {
-    FT_UShort  magic;
-    /* skipped content */
-    FT_UShort  lfanew;
-
-  } WinMZ_HeaderRec;
-
-
-  typedef struct  WinNE_HeaderRec_
-  {
-    FT_UShort  magic;
-    /* skipped content */
-    FT_UShort  resource_tab_offset;
-    FT_UShort  rname_tab_offset;
-
-  } WinNE_HeaderRec;
-
-
-  typedef struct  WinNameInfoRec_
-  {
-    FT_UShort  offset;
-    FT_UShort  length;
-    FT_UShort  flags;
-    FT_UShort  id;
-    FT_UShort  handle;
-    FT_UShort  usage;
-
-  } WinNameInfoRec;
-
-
-  typedef struct  WinResourceInfoRec_
-  {
-    FT_UShort  type_id;
-    FT_UShort  count;
-
-  } WinResourceInfoRec;
-
-
-#define WINFNT_MZ_MAGIC  0x5A4D
-#define WINFNT_NE_MAGIC  0x454E
-
-
-  typedef struct  FNT_FontRec_
-  {
-    FT_ULong             offset;
-    FT_Int               size_shift;
-
-    FT_WinFNT_HeaderRec  header;
-
-    FT_Byte*             fnt_frame;
-    FT_ULong             fnt_size;
-
-  } FNT_FontRec, *FNT_Font;
-
-
-  typedef struct  FNT_FaceRec_
-  {
-    FT_FaceRec     root;
-    FNT_Font       font;
-
-    FT_CharMap     charmap_handle;
-    FT_CharMapRec  charmap;  /* a single charmap per face */
-
-  } FNT_FaceRec, *FNT_Face;
-
-
-FT_END_HEADER
-
-#endif /* __FNTTYPES_H__ */
-
-
-/* END */
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index f02a1c6..8faf681 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -46,7 +46,7 @@ FT_BEGIN_HEADER
    *   id ::
    *     A string describing the service as defined in the service's
    *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
-   *     `multi-masters').
+   *     `multi-masters'). It will be prefixed with "FT_SERVICE_ID_" !!
    *
    *   face ::
    *     The source face handle.
@@ -60,17 +60,17 @@ FT_BEGIN_HEADER
    *     A variable that receives the service pointer.  Will be NULL
    *     if not found.
    */
-#define FT_FACE_FIND_SERVICE( ptrtype, ptr, face, id )             \
-  FT_BEGIN_STMNT                                                   \
-    FT_Module  module = FT_MODULE( FT_FACE(face)->driver );        \
-                                                                   \
-                                                                   \
-    (ptr) = NULL;                                                  \
-    if ( module->clazz->get_interface )                            \
-      (ptr) = (ptrtype)module->clazz->get_interface( module, id ); \
+#define FT_FACE_FIND_SERVICE( ptr, face, id )                               \
+  FT_BEGIN_STMNT                                                            \
+    FT_Module    module = FT_MODULE( FT_FACE(face)->driver );               \
+    FT_Pointer*  pptr   = (FT_Pointer*) &(ptr);                             \
+                                                                            \
+    /* the strange cast is to allow C++ compilation */                      \
+    *pptr = NULL;                                                           \
+    if ( module->clazz->get_interface )                                     \
+      *pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
   FT_END_STMNT
 
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -122,13 +122,19 @@ FT_BEGIN_HEADER
    *
    *  All fields should have the type FT_Pointer to relax compilation
    *  dependencies.  We assume the developer isn't completely stupid.
+   *
+   *  Each field must be named service_XXXX where XXX correspond to
+   *  the correct FT_SERVICE_ID_XXXX macro. see the definition of
+   *  FT_FACE_LOOKUP_SERVICE below to see why
+   *
    */
   typedef struct  FT_ServiceCacheRec_
   {
-    FT_Pointer  postscript_name;
-    FT_Pointer  multi_masters;
-    FT_Pointer  glyph_dict;
-    FT_Pointer  pfr_metrics;
+    FT_Pointer  service_POSTSCRIPT_NAME;
+    FT_Pointer  service_MULTI_MASTERS;
+    FT_Pointer  service_GLYPH_DICT;
+    FT_Pointer  service_PFR_METRICS;
+    FT_Pointer  service_WINFNT;
 
   } FT_ServiceCacheRec, *FT_ServiceCache;
 
@@ -165,22 +171,27 @@ FT_BEGIN_HEADER
    *   ptr ::
    *     A variable receiving the service data.  NULL if not available.
    */
-#define FT_FACE_LOOKUP_SERVICE( face, ptrtype, ptr, field, id ) \
-  FT_BEGIN_STMNT                                                \
-    (ptr) = (ptrtype)FT_FACE(face)->internal->services.field ;  \
-    if ( (ptr) == FT_SERVICE_UNAVAILABLE )                      \
-      (ptr) = NULL;                                             \
-    else if ( (ptr) == NULL )                                   \
-    {                                                           \
-      FT_FACE_FIND_SERVICE( ptrtype, ptr, face, id );           \
-                                                                \
-      FT_FACE(face)->internal->services.field =                 \
-        (FT_Pointer)( (ptr) != NULL ? (ptr)                     \
-                                    : FT_SERVICE_UNAVAILABLE ); \
-    }                                                           \
+#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                  \
+  FT_BEGIN_STMNT                                                 \
+    FT_Pointer*  pptr = (FT_Pointer*)&(ptr);                     \
+    FT_Pointer   svc;                                            \
+                                                                 \
+    /* the strange cast is to allow C++ compilation */           \
+                                                                 \
+    svc = FT_FACE(face)->internal->services. service_ ## id ;    \
+    if ( svc == FT_SERVICE_UNAVAILABLE )                         \
+      svc = NULL;                                                \
+    else if ( svc == NULL )                                      \
+    {                                                            \
+      FT_FACE_FIND_SERVICE( svc, face, id );                     \
+                                                                 \
+      FT_FACE(face)->internal->services. service_ ## id =        \
+        (FT_Pointer)( svc != NULL ? svc                          \
+                                  : FT_SERVICE_UNAVAILABLE );    \
+      *pptr = svc;                                               \
+    }                                                            \
   FT_END_STMNT
 
-
   /*
    *  A macro used to define new service structure types.
    */
@@ -205,7 +216,9 @@ FT_BEGIN_HEADER
 #define FT_SERVICE_XFREE86_NAME_H      <freetype/internal/services/svxf86nm.h>
 #define FT_SERVICE_SFNT_H              <freetype/internal/services/svsfnt.h>
 #define FT_SERVICE_PFR_H               <freetype/internal/services/svpfr.h>
+#define FT_SERVICE_WINFNT_H            <freetype/internal/services/svwinfnt.h>
 
+ /* */
 
 FT_END_HEADER
 
diff --git a/include/freetype/internal/services/svwinfnt.h b/include/freetype/internal/services/svwinfnt.h
new file mode 100644
index 0000000..3c0b1d2
--- /dev/null
+++ b/include/freetype/internal/services/svwinfnt.h
@@ -0,0 +1,47 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svwinfnt.h                                                             */
+/*                                                                         */
+/*    The FreeType Windows FNT/FONT service                                */
+/*                                                                         */
+/*  Copyright 2003 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 __SVWINFNT_H__
+#define __SVWINFNT_H__
+
+
+#include FT_INTERNAL_SERVICE_H
+#include FT_WINFONTS_H
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_WINFNT  "winfonts"
+
+  typedef FT_Error  (*FT_WinFnt_GetHeaderFunc)( FT_Face               face,
+                                                FT_WinFNT_HeaderRec  *aheader );
+
+  FT_DEFINE_SERVICE( WinFnt )
+  {
+    FT_WinFnt_GetHeaderFunc  get_header;
+  };
+
+  /* */
+
+FT_END_HEADER
+
+
+#endif /* __SVWINFNT_H__ */
+
+
+/* END */
diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c
index 9b59787..96a6911 100644
--- a/src/base/ftbdf.c
+++ b/src/base/ftbdf.c
@@ -37,19 +37,19 @@
     if ( face )
     {
       FT_Service_BDF  service;
-      
 
-      FT_FACE_FIND_SERVICE( FT_Service_BDF, service,
+
+      FT_FACE_FIND_SERVICE( service,
                             face,
-                            FT_SERVICE_ID_BDF );
-      
+                            BDF );
+
       if ( service && service->get_charset_id )
         error = service->get_charset_id( face, &encoding, &registry );
     }
 
     if ( acharset_encoding )
       *acharset_encoding = encoding;
-    
+
     if ( acharset_registry )
       *acharset_registry = registry;
 
@@ -72,12 +72,12 @@
     if ( face )
     {
       FT_Service_BDF  service;
-      
 
-      FT_FACE_FIND_SERVICE( FT_Service_BDF, service,
+
+      FT_FACE_FIND_SERVICE( service,
                             face,
-                            FT_SERVICE_ID_BDF );
-      
+                            BDF );
+
       if ( service && service->get_property )
         error = service->get_property( face, prop_name, aproperty );
     }
diff --git a/src/base/ftmm.c b/src/base/ftmm.c
index a11c934..039a850 100644
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -37,21 +37,20 @@
                           FT_Service_MultiMasters  *aservice )
   {
     FT_Error  error;
-    
+
 
     *aservice = NULL;
-    
+
     if ( !face )
       return FT_Err_Invalid_Face_Handle;
-    
+
     error = FT_Err_Invalid_Argument;
-    
+
     if ( FT_HAS_MULTIPLE_MASTERS( face ) )
     {
       FT_FACE_LOOKUP_SERVICE( face,
-                              FT_Service_MultiMasters, *aservice,
-                              multi_masters,
-                              FT_SERVICE_ID_MULTI_MASTERS );
+                              *aservice,
+                              MULTI_MASTERS );
     }
 
     return error;
@@ -75,7 +74,7 @@
       if ( service->get_mm )
         error = service->get_mm( face, amaster );
     }
-      
+
     return error;
   }
 
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 11b17a6..c6d60d3 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -38,7 +38,7 @@
   {
     FT_Pointer      result = NULL;
     FT_ServiceDesc  desc   = service_descriptors;
-    
+
 
     if ( desc && service_id )
     {
@@ -53,7 +53,7 @@
     }
 
     return result;
-  }                          
+  }
 
 
   FT_BASE_DEF( void )
@@ -1188,7 +1188,7 @@
     pfb_data[4] = 0;
     pfb_data[5] = 0;
     pfb_pos     = 7;
-    pfb_lenpos  = 2;      
+    pfb_lenpos  = 2;
 
     len = 0;
     type = 1;
@@ -1527,12 +1527,12 @@
 
 #ifdef FT_MACINTOSH
     /*
-       I know this section is within code which is normally turned off 
+       I know this section is within code which is normally turned off
        for the Mac.  It provides an alternative approach to reading the
        mac resource forks on OS/X in the event that a user does not wish
        to compile ftmac.c.
      */
-         
+
     if ( ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format      ||
            FT_ERROR_BASE( error ) == FT_Err_Invalid_Stream_Operation )  &&
            ( args->flags & FT_OPEN_PATHNAME )                           )
@@ -2399,33 +2399,9 @@
       FT_Service_GlyphDict  service;
 
 
-#if 0
-
       FT_FACE_LOOKUP_SERVICE( face,
-                              FT_Service_GlyphDict, service,
-                              glyph_dict,
-                              FT_SERVICE_ID_GLYPH_DICT );
-
-#else
-
-      service = (FT_Service_GlyphDict)face->internal->services.glyph_dict;
-      if ( service == FT_SERVICE_UNAVAILABLE )
-        service = NULL;
-      else if ( service == NULL )
-      {
-        FT_Module  module = FT_MODULE( face->driver );
-
-       
-        if ( module->clazz->get_interface )
-          service = (FT_Service_GlyphDict)module->clazz->get_interface(
-                      module, FT_SERVICE_ID_GLYPH_DICT );
-     
-        face->internal->services.glyph_dict =
-          service != NULL ? (FT_Pointer)service
-                          : FT_SERVICE_UNAVAILABLE;
-      }
-
-#endif /* 1 */
+                              service,
+                              GLYPH_DICT );
 
       if ( service && service->name_index )
         result = service->name_index( face, glyph_name );
@@ -2458,9 +2434,8 @@
 
 
       FT_FACE_LOOKUP_SERVICE( face,
-                              FT_Service_GlyphDict, service,
-                              glyph_dict,
-                              FT_SERVICE_ID_GLYPH_DICT );
+                              service,
+                              GLYPH_DICT );
 
       if ( service && service->get_name )
         error = service->get_name( face, glyph_index, buffer, buffer_max );
@@ -2487,9 +2462,8 @@
 
 
       FT_FACE_LOOKUP_SERVICE( face,
-                              FT_Service_PsName, service,
-                              postscript_name,
-                              FT_SERVICE_ID_POSTSCRIPT_NAME );
+                              service,
+                              POSTSCRIPT_NAME );
 
       if ( service && service->get_ps_name )
         result = service->get_ps_name( face );
@@ -2512,13 +2486,13 @@
 
     if ( face && FT_IS_SFNT( face ) )
     {
-      FT_FACE_FIND_SERVICE( FT_Service_SFNT_Table, service,
+      FT_FACE_FIND_SERVICE( service,
                             face,
-                            FT_SERVICE_ID_SFNT_TABLE );
+                            SFNT_TABLE );
       if ( service != NULL )
         table = service->get_table( face, tag );
     }
-      
+
     return table;
   }
 
@@ -2538,12 +2512,12 @@
     if ( !face || !FT_IS_SFNT( face ) )
       return FT_Err_Invalid_Face_Handle;
 
-    FT_FACE_FIND_SERVICE( FT_Service_SFNT_Table, service,
+    FT_FACE_FIND_SERVICE( service,
                           face,
-                          FT_SERVICE_ID_SFNT_TABLE );
+                          SFNT_TABLE );
     if ( service == NULL )
       return FT_Err_Unimplemented_Feature;
-      
+
     return service->load_table( face, tag, offset, buffer, length );
   }
 
diff --git a/src/base/ftpfr.c b/src/base/ftpfr.c
index 57e21eb..f49fab5 100644
--- a/src/base/ftpfr.c
+++ b/src/base/ftpfr.c
@@ -26,8 +26,7 @@
   {
     FT_Service_PfrMetrics  service;
 
-    FT_FACE_LOOKUP_SERVICE( face, FT_Service_PfrMetrics, service,
-                            pfr_metrics, FT_SERVICE_ID_PFR_METRICS );
+    FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
 
     return service;
   }
diff --git a/src/base/ftwinfnt.c b/src/base/ftwinfnt.c
index 2cbe343..b7eda1d 100644
--- a/src/base/ftwinfnt.c
+++ b/src/base/ftwinfnt.c
@@ -18,40 +18,29 @@
 
 #include <ft2build.h>
 #include FT_WINFONTS_H
-#include FT_INTERNAL_FNT_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_WINFNT_H
 
 
   FT_EXPORT_DEF( FT_Error )
   FT_Get_WinFNT_Header( FT_Face               face,
                         FT_WinFNT_HeaderRec  *header )
   {
-    FT_Error  error;
-
+    FT_Service_WinFnt  service;
+    FT_Error           error;
 
     error = FT_Err_Invalid_Argument;
 
-    if ( face != NULL && face->driver != NULL )
+    if ( face != NULL )
     {
-      FT_Module  driver = (FT_Module) face->driver;
-
+      FT_FACE_LOOKUP_SERVICE( face, service, WINFNT );
 
-      if ( driver->clazz && driver->clazz->module_name              &&
-           ft_strcmp( driver->clazz->module_name, "winfonts" ) == 0 )
+      if ( service != NULL )
       {
-        FNT_Face  fnt_face = (FNT_Face)face;
-        FNT_Font  font     = fnt_face->font;
-
-
-        if ( font )
-        {
-          FT_MEM_COPY( header, &font->header, sizeof ( *header ) );
-          error = FT_Err_Ok;
-        }
+        error = service->get_header( face, header );
       }
     }
-    return error;
+    return  error;
   }
 
-
 /* END */
diff --git a/src/base/ftxf86.c b/src/base/ftxf86.c
index e9188e1..7cb03ff 100644
--- a/src/base/ftxf86.c
+++ b/src/base/ftxf86.c
@@ -28,8 +28,9 @@
 
 
     if ( face )
-      FT_FACE_FIND_SERVICE( const char*, result,
-                            face, FT_SERVICE_ID_XF86_NAME );
+      FT_FACE_FIND_SERVICE( result,
+                            face,
+                            XF86_NAME );
 
     return result;
   }
diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c
index 4d8980c..4653f72 100644
--- a/src/pfr/pfrdrivr.c
+++ b/src/pfr/pfrdrivr.c
@@ -19,13 +19,13 @@
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_PFR_H
+#include FT_SERVICE_PFR_H
+#include FT_SERVICE_XFREE86_NAME_H
 #include "pfrdrivr.h"
 #include "pfrobjs.h"
 
 #include "pfrerror.h"
 
-
   static FT_Error
   pfr_get_kerning( PFR_Face    face,
                    FT_UInt     left,
@@ -52,6 +52,10 @@
     return PFR_Err_Ok;
   }
 
+ /*
+  *  PFR METRICS SERVICE
+  *
+  */
 
   static FT_Error
   pfr_get_advance( PFR_Face   face,
@@ -119,13 +123,35 @@
 
 
   FT_CALLBACK_TABLE_DEF
-  const FT_PFR_ServiceRec  pfr_service_rec =
+  const FT_Service_PfrMetricsRec  pfr_metrics_service_rec =
   {
     (FT_PFR_GetMetricsFunc)  pfr_get_metrics,
-    (FT_PFR_GetKerningFunc)  pfr_get_kerning,
+    (FT_PFR_GetKerningFunc)  pfr_face_get_kerning,
     (FT_PFR_GetAdvanceFunc)  pfr_get_advance
   };
 
+ /*
+  *  SERVICE LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  pfr_services[] =
+  {
+    { FT_SERVICE_ID_PFR_METRICS,  & pfr_metrics_service_rec },
+    { FT_SERVICE_ID_XF86_NAME,    FT_XF86_FORMAT_PFR },
+    { NULL, NULL }
+  };
+
+
+  static FT_Module_Interface
+  pfr_get_service( FT_Driver         driver,
+                   const FT_String*  service_id )
+  {
+    FT_UNUSED( driver );
+
+    return ft_service_list_lookup( pfr_services, service_id );
+  }
+
 
   FT_CALLBACK_TABLE_DEF
   const FT_Driver_ClassRec  pfr_driver_class =
@@ -140,11 +166,11 @@
       0x10000L,
       0x20000L,
 
-      (FT_PFR_Service)  &pfr_service_rec,   /* format interface */
+      NULL,
 
       (FT_Module_Constructor)NULL,
       (FT_Module_Destructor) NULL,
-      (FT_Module_Requester)  NULL
+      (FT_Module_Requester)  pfr_get_service
     },
 
     sizeof( PFR_FaceRec ),
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index ebbabe8..6bc2eac 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -21,12 +21,11 @@
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_FNT_TYPES_H
 
 #include "winfnt.h"
-
 #include "fnterrs.h"
-
+#include FT_SERVICE_WINFNT_H
+#include FT_SERVICE_XFREE86_NAME_H
 
   /*************************************************************************/
   /*                                                                       */
@@ -632,6 +631,47 @@
   }
 
 
+  static FT_Error
+  winfnt_get_header( FT_Face               face,
+                     FT_WinFNT_HeaderRec  *aheader )
+  {
+    FNT_Font  font = ((FNT_Face)face)->font;
+
+    *aheader = font->header;
+
+    return 0;
+  }
+
+  static const FT_Service_WinFntRec  winfnt_service_rec =
+  {
+    winfnt_get_header
+  };
+
+ /*
+  *  SERVICE LIST
+  *
+  */
+
+  static const FT_ServiceDescRec  winfnt_services[] =
+  {
+    { FT_SERVICE_ID_XF86_NAME,    FT_XF86_FORMAT_WINFNT },
+    { FT_SERVICE_ID_WINFNT,       & winfnt_service_rec },
+    { NULL, NULL }
+  };
+
+
+  static FT_Module_Interface
+  winfnt_get_service( FT_Driver         driver,
+                      const FT_String*  service_id )
+  {
+    FT_UNUSED( driver );
+
+    return ft_service_list_lookup( winfnt_services, service_id );
+  }
+
+
+
+
   FT_CALLBACK_TABLE_DEF
   const FT_Driver_ClassRec  winfnt_driver_class =
   {
@@ -648,7 +688,7 @@
 
       (FT_Module_Constructor)0,
       (FT_Module_Destructor) 0,
-      (FT_Module_Requester)  0
+      (FT_Module_Requester)  winfnt_get_service
     },
 
     sizeof( FNT_FaceRec ),
diff --git a/src/winfonts/winfnt.h b/src/winfonts/winfnt.h
index 4ba85e0..5b2016a 100644
--- a/src/winfonts/winfnt.h
+++ b/src/winfonts/winfnt.h
@@ -21,11 +21,78 @@
 
 
 #include <ft2build.h>
+#include FT_WINFONTS_H
 #include FT_INTERNAL_DRIVER_H
 
 
 FT_BEGIN_HEADER
 
+  typedef struct  WinMZ_HeaderRec_
+  {
+    FT_UShort  magic;
+    /* skipped content */
+    FT_UShort  lfanew;
+
+  } WinMZ_HeaderRec;
+
+
+  typedef struct  WinNE_HeaderRec_
+  {
+    FT_UShort  magic;
+    /* skipped content */
+    FT_UShort  resource_tab_offset;
+    FT_UShort  rname_tab_offset;
+
+  } WinNE_HeaderRec;
+
+
+  typedef struct  WinNameInfoRec_
+  {
+    FT_UShort  offset;
+    FT_UShort  length;
+    FT_UShort  flags;
+    FT_UShort  id;
+    FT_UShort  handle;
+    FT_UShort  usage;
+
+  } WinNameInfoRec;
+
+
+  typedef struct  WinResourceInfoRec_
+  {
+    FT_UShort  type_id;
+    FT_UShort  count;
+
+  } WinResourceInfoRec;
+
+
+#define WINFNT_MZ_MAGIC  0x5A4D
+#define WINFNT_NE_MAGIC  0x454E
+
+
+  typedef struct  FNT_FontRec_
+  {
+    FT_ULong             offset;
+    FT_Int               size_shift;
+
+    FT_WinFNT_HeaderRec  header;
+
+    FT_Byte*             fnt_frame;
+    FT_ULong             fnt_size;
+
+  } FNT_FontRec, *FNT_Font;
+
+
+  typedef struct  FNT_FaceRec_
+  {
+    FT_FaceRec     root;
+    FNT_Font       font;
+
+    FT_CharMap     charmap_handle;
+    FT_CharMapRec  charmap;  /* a single charmap per face */
+
+  } FNT_FaceRec, *FNT_Face;
+
 
   FT_EXPORT_VAR( const FT_Driver_ClassRec )  winfnt_driver_class;