Commit b72d8a85212e1dc2dc103c28e19a4f4a2d71767e

David Turner 2003-09-29T20:33:37

* include/freetype/internal/services/svpsname.h (added), include/freetype/internal/psnames.h (removed), include/freetype/internal/internal.h (FT_SERVICE_POSTSCRIPT_NAMES): added new service to handle glyph name dictionaries, replacing the old internal header named "psnames.h" by "services/svpsname.h" note that this is different from "services/svpostnm.h" which only handles the retrieval of Postscript font name for a given face. (should we merge these two services into a single header ??) * include/freetype/internal/ftserv.h: adding FT_FACE_FIND_GLOBAL_SERVICE (used to lookup a service globally, instead of only within the current module) * include/freetype/internal/ftobjs.h, src/base/ftobjs.c: adding the new base function ft_module_get_service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
diff --git a/ChangeLog b/ChangeLog
index 7445aba..e7a7901 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2003-09-29  David Turner  <david@freetype.org>
+
+        * include/freetype/internal/services/svpsname.h (added),
+        include/freetype/internal/psnames.h (removed),
+        include/freetype/internal/internal.h (FT_SERVICE_POSTSCRIPT_NAMES):
+
+          added new service to handle glyph name dictionaries, replacing
+          the old internal header named "psnames.h" by "services/svpsname.h"
+          note that this is different from "services/svpostnm.h" which only
+          handles the retrieval of Postscript font name for a given face.
+          (should we merge these two services into a single header ??)
+
+
+        * include/freetype/internal/ftserv.h: adding
+        FT_FACE_FIND_GLOBAL_SERVICE (used to lookup a service globally,
+        instead of only within the current module)
+
+        * include/freetype/internal/ftobjs.h, src/base/ftobjs.c: adding
+        the new base function ft_module_get_service
+
+
+
 2003-09-21  Werner Lemberg  <wl@gnu.org>
 
 	* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE):
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 6260843..fa1b29f 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -467,6 +467,10 @@ FT_BEGIN_HEADER
   FT_Get_Module_Interface( FT_Library   library,
                            const char*  mod_name );
 
+  FT_BASE( FT_Pointer )
+  ft_module_get_service( FT_Module    module,
+                         const char*  service_id );
+
  /* */
 
 
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index 5819940..bf17497 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -57,19 +57,26 @@ FT_BEGIN_HEADER
    *     A variable that receives the service pointer.  Will be NULL
    *     if not found.
    */
-#define FT_FACE_FIND_SERVICE( ptr, face, id )                               \
+#define FT_FACE_FIND_SERVICE( face, ptr, 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 */                      \
-    FT_Pointer*  Pptr = (FT_Pointer*)&(ptr);                                \
-                                                                            \
-                                                                            \
     *Pptr = NULL;                                                           \
     if ( module->clazz->get_interface )                                     \
       *Pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
   FT_END_STMNT
 
 
+#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, 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 = ft_module_get_service( module, FT_SERVICE_ID_ ## id );          \
+  FT_END_STMNT
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -129,7 +136,7 @@ FT_BEGIN_HEADER
    */
   typedef struct  FT_ServiceCacheRec_
   {
-    FT_Pointer  service_POSTSCRIPT_NAME;
+    FT_Pointer  service_POSTSCRIPT_FONT_NAME;
     FT_Pointer  service_MULTI_MASTERS;
     FT_Pointer  service_GLYPH_DICT;
     FT_Pointer  service_PFR_METRICS;
@@ -178,7 +185,7 @@ FT_BEGIN_HEADER
       svc = NULL;                                                \
     else if ( svc == NULL )                                      \
     {                                                            \
-      FT_FACE_FIND_SERVICE( svc, face, id );                     \
+      FT_FACE_FIND_SERVICE( face, svc, id );                     \
                                                                  \
       FT_FACE(face)->internal->services. service_ ## id =        \
         (FT_Pointer)( svc != NULL ? svc                          \
@@ -207,6 +214,7 @@ FT_BEGIN_HEADER
 
 #define FT_SERVICE_MULTIPLE_MASTERS_H  <freetype/internal/services/svmm.h>
 #define FT_SERVICE_POSTSCRIPT_NAME_H   <freetype/internal/services/svpostnm.h>
+#define FT_SERVICE_POSTSCRIPT_NAMES_H  <freetype/internal/services/svpsname.h>
 #define FT_SERVICE_GLYPH_DICT_H        <freetype/internal/services/svgldict.h>
 #define FT_SERVICE_BDF_H               <freetype/internal/services/svbdf.h>
 #define FT_SERVICE_XFREE86_NAME_H      <freetype/internal/services/svxf86nm.h>
diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h
index 6ce543c..3b030cf 100644
--- a/include/freetype/internal/internal.h
+++ b/include/freetype/internal/internal.h
@@ -41,7 +41,6 @@
 #define FT_INTERNAL_CFF_TYPES_H           <freetype/internal/cfftypes.h>
 #define FT_INTERNAL_BDF_TYPES_H           <freetype/internal/bdftypes.h>
 
-#define FT_INTERNAL_POSTSCRIPT_NAMES_H    <freetype/internal/psnames.h>
 #define FT_INTERNAL_POSTSCRIPT_AUX_H      <freetype/internal/psaux.h>
 #define FT_INTERNAL_POSTSCRIPT_HINTS_H    <freetype/internal/pshints.h>
 #define FT_INTERNAL_POSTSCRIPT_GLOBALS_H  <freetype/internal/psglobal.h>
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index c7093fe..48bda92 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -24,6 +24,7 @@
 #include <ft2build.h>
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 
 FT_BEGIN_HEADER
@@ -648,7 +649,7 @@ FT_BEGIN_HEADER
     T1_Decoder_ZoneRec   zones[T1_MAX_SUBRS_CALLS + 1];
     T1_Decoder_Zone      zone;
 
-    PSNames_Service      psnames;      /* for seac */
+    FT_Service_PsNames   psnames;      /* for seac */
     FT_UInt              num_glyphs;
     FT_Byte**            glyph_names;
 
diff --git a/include/freetype/internal/psnames.h b/include/freetype/internal/psnames.h
deleted file mode 100644
index 0f4ec86..0000000
--- a/include/freetype/internal/psnames.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/***************************************************************************/
-/*                                                                         */
-/*  psnames.h                                                              */
-/*                                                                         */
-/*    High-level interface for the `PSNames' module (in charge of          */
-/*    various functions related to Postscript glyph names conversion).     */
-/*                                                                         */
-/*  Copyright 1996-2001, 2002 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 __PSNAMES_H__
-#define __PSNAMES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    PS_Unicode_Value_Func                                              */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A function used to return the Unicode index corresponding to a     */
-  /*    given glyph name.                                                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    glyph_name :: The glyph name.                                      */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The Unicode character index resp. the non-Unicode value 0xFFFF if  */
-  /*    the glyph name has no known Unicode meaning.                       */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function is able to map several different glyph names to the  */
-  /*    same Unicode value, according to the rules defined in the Adobe    */
-  /*    Glyph List table.                                                  */
-  /*                                                                       */
-  /*    This function will not be compiled if the configuration macro      */
-  /*    FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined.                    */
-  /*                                                                       */
-  typedef FT_UInt32
-  (*PS_Unicode_Value_Func)( const char*  glyph_name );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    PS_Unicode_Index_Func                                              */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A function used to return the glyph index corresponding to a given */
-  /*    Unicode value.                                                     */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    num_glyphs  :: The number of glyphs in the face.                   */
-  /*                                                                       */
-  /*    glyph_names :: An array of glyph name pointers.                    */
-  /*                                                                       */
-  /*    unicode     :: The Unicode value.                                  */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The glyph index resp. 0xFFFF if no glyph corresponds to this       */
-  /*    Unicode value.                                                     */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function is able to recognize several glyph names per Unicode */
-  /*    value, according to the Adobe Glyph List.                          */
-  /*                                                                       */
-  /*    This function will not be compiled if the configuration macro      */
-  /*    FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined.                    */
-  /*                                                                       */
-  typedef FT_UInt
-  (*PS_Unicode_Index_Func)( FT_UInt       num_glyphs,
-                            const char**  glyph_names,
-                            FT_ULong      unicode );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <FuncType>                                                            */
-  /*    PS_Macintosh_Name_Func                                             */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A function used to return the glyph name corresponding to an Apple */
-  /*    glyph name index.                                                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    name_index :: The index of the Mac name.                           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The glyph name, or 0 if the index is invalid.                      */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function will not be compiled if the configuration macro      */
-  /*    FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined.                    */
-  /*                                                                       */
-  typedef const char*
-  (*PS_Macintosh_Name_Func)( FT_UInt  name_index );
-
-
-  typedef const char*
-  (*PS_Adobe_Std_Strings_Func)( FT_UInt  string_index );
-
-
-  typedef struct  PS_UniMap_
-  {
-    FT_UInt  unicode;
-    FT_UInt  glyph_index;
-
-  } PS_UniMap;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    PS_Unicodes                                                        */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A simple table used to map Unicode values to glyph indices.  It is */
-  /*    built by the PS_Build_Unicodes table according to the glyphs       */
-  /*    present in a font file.                                            */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    num_codes :: The number of glyphs in the font that match a given   */
-  /*                 Unicode value.                                        */
-  /*                                                                       */
-  /*    unicodes  :: An array of unicode values, sorted in increasing      */
-  /*                 order.                                                */
-  /*                                                                       */
-  /*    gindex    :: An array of glyph indices, corresponding to each      */
-  /*                 Unicode value.                                        */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    Use the function PS_Lookup_Unicode() to retrieve the glyph index   */
-  /*    corresponding to a given Unicode character code.                   */
-  /*                                                                       */
-  typedef struct  PS_Unicodes_
-  {
-    FT_UInt     num_maps;
-    PS_UniMap*  maps;
-
-  } PS_Unicodes;
-
-
-  typedef FT_Error
-  (*PS_Build_Unicodes_Func)( FT_Memory     memory,
-                             FT_UInt       num_glyphs,
-                             const char**  glyph_names,
-                             PS_Unicodes*  unicodes );
-
-  typedef FT_UInt
-  (*PS_Lookup_Unicode_Func)( PS_Unicodes*  unicodes,
-                             FT_UInt       unicode );
-
-  typedef FT_ULong
-  (*PS_Next_Unicode_Func)( PS_Unicodes*  unicodes,
-                           FT_ULong      unicode );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    PSNames_Interface                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    This structure defines the PSNames interface.                      */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    unicode_value         :: A function used to convert a glyph name   */
-  /*                             into a Unicode character code.            */
-  /*                                                                       */
-  /*    build_unicodes        :: A function which builds up the Unicode    */
-  /*                             mapping table.                            */
-  /*                                                                       */
-  /*    lookup_unicode        :: A function used to return the glyph index */
-  /*                             corresponding to a given Unicode          */
-  /*                             character.                                */
-  /*                                                                       */
-  /*    macintosh_name        :: A function used to return the standard    */
-  /*                             Apple glyph Postscript name corresponding */
-  /*                             to a given string index (used by the      */
-  /*                             TrueType `post' table).                   */
-  /*                                                                       */
-  /*    adobe_std_strings     :: A function that returns a pointer to a    */
-  /*                             Adobe Standard String for a given SID.    */
-  /*                                                                       */
-  /*    adobe_std_encoding    :: A table of 256 unsigned shorts that maps  */
-  /*                             character codes in the Adobe Standard     */
-  /*                             Encoding to SIDs.                         */
-  /*                                                                       */
-  /*    adobe_expert_encoding :: A table of 256 unsigned shorts that maps  */
-  /*                             character codes in the Adobe Expert       */
-  /*                             Encoding to SIDs.                         */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    `unicode_value' and `unicode_index' will be set to 0 if the        */
-  /*    configuration macro FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is           */
-  /*    undefined.                                                         */
-  /*                                                                       */
-  /*    `macintosh_name' will be set to 0 if the configuration macro       */
-  /*    FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined.                    */
-  /*                                                                       */
-  typedef struct  PSNames_Interface_
-  {
-    PS_Unicode_Value_Func      unicode_value;
-    PS_Build_Unicodes_Func     build_unicodes;
-    PS_Lookup_Unicode_Func     lookup_unicode;
-    PS_Macintosh_Name_Func     macintosh_name;
-
-    PS_Adobe_Std_Strings_Func  adobe_std_strings;
-    const unsigned short*      adobe_std_encoding;
-    const unsigned short*      adobe_expert_encoding;
-
-    PS_Next_Unicode_Func       next_unicode;
-
-  } PSNames_Interface;
-
-
-  typedef PSNames_Interface*  PSNames_Service;
-
-
-FT_END_HEADER
-
-#endif /* __PSNAMES_H__ */
-
-
-/* END */
diff --git a/include/freetype/internal/services/svpostnm.h b/include/freetype/internal/services/svpostnm.h
index 405eba8..7f1700a 100644
--- a/include/freetype/internal/services/svpostnm.h
+++ b/include/freetype/internal/services/svpostnm.h
@@ -34,16 +34,16 @@ FT_BEGIN_HEADER
    *  The name is owned by the face and will be destroyed with it.
    */
 
-#define FT_SERVICE_ID_POSTSCRIPT_NAME  "postscript-name"
+#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME  "postscript-font-name"
 
 
   typedef const char*
   (*FT_PsName_GetFunc)( FT_Face  face );
-  
 
-  FT_DEFINE_SERVICE( PsName )
+
+  FT_DEFINE_SERVICE( PsFontName )
   {
-    FT_PsName_GetFunc  get_ps_name;
+    FT_PsName_GetFunc  get_ps_font_name;
   };
 
   /* */
diff --git a/include/freetype/internal/services/svpsname.h b/include/freetype/internal/services/svpsname.h
new file mode 100644
index 0000000..5a56179
--- /dev/null
+++ b/include/freetype/internal/services/svpsname.h
@@ -0,0 +1,82 @@
+#ifndef __SVPSNAME_H__
+#define __SVPSNAME_H__
+
+FT_BEGIN_HEADER
+
+#define  FT_SERVICE_ID_POSTSCRIPT_NAMES  "postscript-names"
+
+ /*  Adobe glyph name to unicode value
+  */
+  typedef FT_UInt32
+  (*PS_Unicode_ValueFunc)( const char*  glyph_name );
+
+ /*  Unicode value to Adobe glyph name index. 0xFFFF if not found
+  */
+  typedef FT_UInt
+  (*PS_Unicode_Index_Func)( FT_UInt       num_glyphs,
+                            const char**  glyph_names,
+                            FT_ULong      unicode );
+
+ /* Macintosh name id to glyph name, NULL if invalid index
+  */
+  typedef const char*
+  (*PS_Macintosh_Name_Func)( FT_UInt  name_index );
+
+ /* Adobe standard string id to glyph name, NULL if invalid index
+  */
+  typedef const char*
+  (*PS_Adobe_Std_Strings_Func)( FT_UInt  string_index );
+
+
+ /* Simple unicode -> glyph index charmap built from font glyph names
+  * table
+  */
+  typedef struct  PS_UniMap_
+  {
+    FT_UInt  unicode;
+    FT_UInt  glyph_index;
+
+  } PS_UniMap;
+
+
+  typedef struct  PS_Unicodes_
+  {
+    FT_UInt     num_maps;
+    PS_UniMap*  maps;
+
+  } PS_Unicodes;
+
+
+  typedef FT_Error
+  (*PS_Unicodes_InitFunc)( FT_Memory     memory,
+                           FT_UInt       num_glyphs,
+                           const char**  glyph_names,
+                           PS_Unicodes*  unicodes );
+
+  typedef FT_UInt
+  (*PS_Unicodes_CharIndexFunc)( PS_Unicodes*  unicodes,
+                                FT_UInt       unicode );
+
+  typedef FT_ULong
+  (*PS_Unicodes_CharNextFunc)( PS_Unicodes*  unicodes,
+                               FT_ULong      unicode );
+
+  FT_DEFINE_SERVICE( PsNames )
+  {
+    PS_Unicode_ValueFunc       unicode_value;
+
+    PS_Unicodes_InitFunc       unicodes_init;
+    PS_Unicodes_CharIndexFunc  unicodes_char_index;
+    PS_Unicodes_CharNextFunc   unicodes_char_next;
+
+    PS_Macintosh_Name_Func     macintosh_name;
+    PS_Adobe_Std_Strings_Func  adobe_std_strings;
+    const unsigned short*      adobe_std_encoding;
+    const unsigned short*      adobe_expert_encoding;
+  };
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __SVPSNAME_H__ */
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
index f6f68f4..851baa8 100644
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -23,8 +23,9 @@
 
 #include <ft2build.h>
 #include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 
 FT_BEGIN_HEADER
@@ -169,7 +170,7 @@ FT_BEGIN_HEADER
 
     /* support for Multiple Masters fonts */
     PS_Blend       blend;
-    
+
     /* since FT 2.1 - interface to PostScript hinter */
     const void*    pshinter;
 
@@ -184,7 +185,7 @@ FT_BEGIN_HEADER
     CID_FaceInfoRec  cid;
     void*            afm_data;
     CID_Subrs        subrs;
-    
+
     /* since FT 2.1 - interface to PostScript hinter */
     void*            pshinter;
 
diff --git a/include/freetype/internal/t42types.h b/include/freetype/internal/t42types.h
index 7562252..9e612d5 100644
--- a/include/freetype/internal/t42types.h
+++ b/include/freetype/internal/t42types.h
@@ -23,7 +23,6 @@
 #include FT_FREETYPE_H
 #include FT_TYPE1_TABLES_H
 #include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 
 
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index d002703..7e9db90 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1377,9 +1377,6 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    sfnt                 :: A pointer to the SFNT `driver' interface.  */
   /*                                                                       */
-  /*    psnames              :: A pointer to the `PSNames' module          */
-  /*                            interface.                                 */
-  /*                                                                       */
   /*    hdmx                 :: The face's horizontal device metrics       */
   /*                            (`hdmx' table).  This table is optional in */
   /*                            TrueType/OpenType fonts.                   */
@@ -1501,7 +1498,7 @@ FT_BEGIN_HEADER
     /* the basic TrueType tables in the face object                    */
     void*                 sfnt;
 
-    /* a typeless pointer to the PSNames_Interface table used to       */
+    /* a typeless pointer to the FT_Service_PsNamesRec table used to       */
     /* handle glyph names <-> unicode & Mac values                     */
     void*                 psnames;
 
diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c
index 96a6911..59e5d20 100644
--- a/src/base/ftbdf.c
+++ b/src/base/ftbdf.c
@@ -39,9 +39,7 @@
       FT_Service_BDF  service;
 
 
-      FT_FACE_FIND_SERVICE( service,
-                            face,
-                            BDF );
+      FT_FACE_FIND_SERVICE( face, service, BDF );
 
       if ( service && service->get_charset_id )
         error = service->get_charset_id( face, &encoding, &registry );
@@ -74,9 +72,7 @@
       FT_Service_BDF  service;
 
 
-      FT_FACE_FIND_SERVICE( service,
-                            face,
-                            BDF );
+      FT_FACE_FIND_SERVICE( face, service, BDF );
 
       if ( service && service->get_property )
         error = service->get_property( face, prop_name, aproperty );
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index c6d60d3..7665b54 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2458,15 +2458,15 @@
 
     if ( !result )
     {
-      FT_Service_PsName  service;
+      FT_Service_PsFontName  service;
 
 
       FT_FACE_LOOKUP_SERVICE( face,
                               service,
-                              POSTSCRIPT_NAME );
+                              POSTSCRIPT_FONT_NAME );
 
-      if ( service && service->get_ps_name )
-        result = service->get_ps_name( face );
+      if ( service && service->get_ps_font_name )
+        result = service->get_ps_font_name( face );
     }
 
   Exit:
@@ -2486,9 +2486,7 @@
 
     if ( face && FT_IS_SFNT( face ) )
     {
-      FT_FACE_FIND_SERVICE( service,
-                            face,
-                            SFNT_TABLE );
+      FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
       if ( service != NULL )
         table = service->get_table( face, tag );
     }
@@ -2512,9 +2510,7 @@
     if ( !face || !FT_IS_SFNT( face ) )
       return FT_Err_Invalid_Face_Handle;
 
-    FT_FACE_FIND_SERVICE( service,
-                          face,
-                          SFNT_TABLE );
+    FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
     if ( service == NULL )
       return FT_Err_Unimplemented_Feature;
 
@@ -3068,6 +3064,50 @@
   }
 
 
+  FT_BASE_DEF( FT_Pointer )
+  ft_module_get_service( FT_Module    module,
+                         const char*  service_id )
+  {
+    FT_Pointer  result = NULL;
+
+    if ( module )
+    {
+      FT_ASSERT( module->clazz && module->clazz->get_interface );
+
+     /* first, look for the service in the module
+      */
+      if ( module->clazz->get_interface )
+        result = module->clazz->get_interface( module, service_id );
+
+      if ( result == NULL )
+      {
+       /* we didn't find it, look in all other modules then
+        */
+        FT_Library  library = module->library;
+        FT_Module*  cur     = library->modules;
+        FT_Module*  limit   = cur + library->num_modules;
+
+        for ( ; cur < limit; cur++ )
+        {
+          if ( cur[0] != module )
+          {
+            FT_ASSERT( cur[0]->clazz );
+
+            if ( cur[0]->clazz->get_interface )
+            {
+              result = cur[0]->clazz->get_interface( cur[0], service_id );
+              if ( result != NULL )
+                break;
+            }
+          }
+        }
+      }
+    }
+
+    return result;
+  }
+
+
   /* documentation is in ftmodule.h */
 
   FT_EXPORT_DEF( FT_Error )
diff --git a/src/base/ftxf86.c b/src/base/ftxf86.c
index 7cb03ff..8238ed0 100644
--- a/src/base/ftxf86.c
+++ b/src/base/ftxf86.c
@@ -28,9 +28,7 @@
 
 
     if ( face )
-      FT_FACE_FIND_SERVICE( result,
-                            face,
-                            XF86_NAME );
+      FT_FACE_FIND_SERVICE( face, result, XF86_NAME );
 
     return result;
   }
diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c
index ef1735a..46f9594 100644
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -39,7 +39,7 @@
 
 
     cmap->gids  = encoding->codes;
-    
+
     return 0;
   }
 
@@ -60,7 +60,7 @@
 
     if ( char_code < 256 )
       result = cmap->gids[char_code];
-    
+
     return result;
   }
 
@@ -71,27 +71,27 @@
   {
     FT_UInt    result    = 0;
     FT_UInt32  char_code = *pchar_code;
-    
+
 
     *pchar_code = 0;
 
     if ( char_code < 255 )
     {
       FT_UInt  code = (FT_UInt)(char_code + 1);
-      
+
 
       for (;;)
       {
         if ( code >= 256 )
           break;
-          
+
         result = cmap->gids[code];
         if ( result != 0 )
         {
           *pchar_code = code;
           break;
         }
-          
+
         code++;
       }
     }
@@ -125,28 +125,28 @@
   {
     FT_UInt32  u1 = ((CFF_CMapUniPair)pair1)->unicode;
     FT_UInt32  u2 = ((CFF_CMapUniPair)pair2)->unicode;
-    
+
 
     if ( u1 < u2 )
       return -1;
-      
+
     if ( u1 > u2 )
       return +1;
-      
+
     return 0;
-  }                            
+  }
 
 
   FT_CALLBACK_DEF( FT_Error )
   cff_cmap_unicode_init( CFF_CMapUnicode  cmap )
   {
-    FT_Error         error;
-    FT_UInt          count;
-    TT_Face          face    = (TT_Face)FT_CMAP_FACE( cmap );
-    FT_Memory        memory  = FT_FACE_MEMORY( face );
-    CFF_Font         cff     = (CFF_Font)face->extra.data;
-    CFF_Charset      charset = &cff->charset;
-    PSNames_Service  psnames = (PSNames_Service)cff->psnames;
+    FT_Error            error;
+    FT_UInt             count;
+    TT_Face             face    = (TT_Face)FT_CMAP_FACE( cmap );
+    FT_Memory           memory  = FT_FACE_MEMORY( face );
+    CFF_Font            cff     = (CFF_Font)face->extra.data;
+    CFF_Charset         charset = &cff->charset;
+    FT_Service_PsNames  psnames = (FT_Service_PsNames)cff->psnames;
 
 
     cmap->num_pairs = 0;
@@ -169,7 +169,7 @@
 
 
         gname = cff_index_get_sid_string( &cff->string_index, sid, psnames );
-         
+
         /* build unsorted pair table by matching glyph names */
         if ( gname )
         {
@@ -181,7 +181,7 @@
             pair->gindex  = n;
             pair++;
           }
-          
+
           FT_FREE( gname );
         }
       }
@@ -223,7 +223,7 @@
     FT_Face    face   = FT_CMAP_FACE( cmap );
     FT_Memory  memory = FT_FACE_MEMORY( face );
 
- 
+
     FT_FREE( cmap->pairs );
     cmap->num_pairs = 0;
   }
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 181c0d6..e029e27 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -22,7 +22,7 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_SFNT_H
 #include FT_TRUETYPE_IDS_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 #include "cffdrivr.h"
 #include "cffgload.h"
@@ -223,17 +223,15 @@
                       FT_Pointer  buffer,
                       FT_UInt     buffer_max )
   {
-    CFF_Font         font   = (CFF_Font)face->extra.data;
-    FT_Memory        memory = FT_FACE_MEMORY( face );
-    FT_String*       gname;
-    FT_UShort        sid;
-    PSNames_Service  psnames;
-    FT_Error         error;
+    CFF_Font            font   = (CFF_Font)face->extra.data;
+    FT_Memory           memory = FT_FACE_MEMORY( face );
+    FT_String*          gname;
+    FT_UShort           sid;
+    FT_Service_PsNames  psnames;
+    FT_Error            error;
 
 
-    psnames = (PSNames_Service)FT_Get_Module_Interface(
-                face->root.driver->root.library, "psnames" );
-
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES );
     if ( !psnames )
     {
       FT_ERROR(( "cff_get_glyph_name:" ));
@@ -274,22 +272,20 @@
   cff_get_name_index( CFF_Face    face,
                       FT_String*  glyph_name )
   {
-    CFF_Font         cff;
-    CFF_Charset      charset;
-    PSNames_Service  psnames;
-    FT_Memory        memory = FT_FACE_MEMORY( face );
-    FT_String*       name;
-    FT_UShort        sid;
-    FT_UInt          i;
-    FT_Int           result;
+    CFF_Font            cff;
+    CFF_Charset         charset;
+    FT_Service_PsNames  psnames;
+    FT_Memory           memory = FT_FACE_MEMORY( face );
+    FT_String*          name;
+    FT_UShort           sid;
+    FT_UInt             i;
+    FT_Int              result;
 
 
     cff     = (CFF_FontRec *)face->extra.data;
     charset = &cff->charset;
 
-    psnames = (PSNames_Service)FT_Get_Module_Interface(
-                face->root.driver->root.library, "psnames" );
-
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES );
     for ( i = 0; i < cff->num_glyphs; i++ )
     {
       sid = charset->sids[i];
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index cc95e79..205b7ec 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -20,7 +20,7 @@
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 #include FT_TRUETYPE_TAGS_H
 
 #include "cffload.h"
@@ -1312,9 +1312,9 @@
 
 
   FT_LOCAL_DEF( FT_String* )
-  cff_index_get_sid_string( CFF_Index        idx,
-                            FT_UInt          sid,
-                            PSNames_Service  psnames_service )
+  cff_index_get_sid_string( CFF_Index           idx,
+                            FT_UInt             sid,
+                            FT_Service_PsNames  psnames )
   {
     /* if it is not a standard string, return it */
     if ( sid > 390 )
@@ -1323,7 +1323,7 @@
     /* that's a standard string, fetch a copy from the PSName module */
     {
       FT_String*   name       = 0;
-      const char*  adobe_name = psnames_service->adobe_std_strings( sid );
+      const char*  adobe_name = psnames->adobe_std_strings( sid );
       FT_UInt      len;
 
 
diff --git a/src/cff/cffload.h b/src/cff/cffload.h
index 4cadfe6..e5f1274 100644
--- a/src/cff/cffload.h
+++ b/src/cff/cffload.h
@@ -22,7 +22,7 @@
 
 #include <ft2build.h>
 #include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 
 FT_BEGIN_HEADER
@@ -36,9 +36,9 @@ FT_BEGIN_HEADER
                       FT_UInt    element );
 
   FT_LOCAL( FT_String* )
-  cff_index_get_sid_string( CFF_Index        idx,
-                            FT_UInt          sid,
-                            PSNames_Service  psnames_interface );
+  cff_index_get_sid_string( CFF_Index          idx,
+                            FT_UInt            sid,
+                            FT_Service_PsNames psnames );
 
 
   FT_LOCAL( FT_Error )
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index c0fdc05..e32731f 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -24,7 +24,7 @@
 #include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 #include "cffobjs.h"
 #include "cffload.h"
@@ -253,24 +253,31 @@
                  FT_Int         num_params,
                  FT_Parameter*  params )
   {
-    FT_Error          error;
-    SFNT_Service      sfnt;
-    PSNames_Service   psnames;
-    PSHinter_Service  pshinter;
-    FT_Bool           pure_cff    = 1;
-    FT_Bool           sfnt_format = 0;
+    FT_Error            error;
+    SFNT_Service        sfnt;
+    FT_Service_PsNames  psnames;
+    PSHinter_Service    pshinter;
+    FT_Bool             pure_cff    = 1;
+    FT_Bool             sfnt_format = 0;
 
+#if 0
+    FT_FACE_FIND_GLOBAL_SERVICE( face, sfnt,     SFNT );
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames,  POSTSCRIPT_NAMES );
+    FT_FACE_FIND_GLOBAL_SERVICE( face, pshinter, POSTSCRIPT_HINTER );
 
+    if ( !sfnt )
+      goto Bad_Format;
+#else
     sfnt = (SFNT_Service)FT_Get_Module_Interface(
              face->root.driver->root.library, "sfnt" );
     if ( !sfnt )
       goto Bad_Format;
 
-    psnames = (PSNames_Service)FT_Get_Module_Interface(
-                face->root.driver->root.library, "psnames" );
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES );
 
     pshinter = (PSHinter_Service)FT_Get_Module_Interface(
                  face->root.driver->root.library, "pshinter" );
+#endif
 
     /* create input stream from resource */
     if ( FT_STREAM_SEEK( 0 ) )
@@ -347,7 +354,7 @@
         goto Exit;
 
       cff->pshinter = pshinter;
-      cff->psnames  = psnames;
+      cff->psnames  = (void*)psnames;
 
       /* Complement the root flags with some interesting information. */
       /* Note that this is only necessary for pure CFF and CEF fonts. */
diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h
index cf60ecf..317b607 100644
--- a/src/cff/cffobjs.h
+++ b/src/cff/cffobjs.h
@@ -24,7 +24,7 @@
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_CFF_TYPES_H
 #include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 
 FT_BEGIN_HEADER
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 5834cd8..5081231 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -23,7 +23,7 @@
 #include "cidgload.h"
 #include "cidload.h"
 
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
 
@@ -268,10 +268,10 @@
                  FT_Int         num_params,
                  FT_Parameter*  params )
   {
-    FT_Error          error;
-    PSNames_Service   psnames;
-    PSAux_Service     psaux;
-    PSHinter_Service  pshinter;
+    FT_Error            error;
+    FT_Service_PsNames  psnames;
+    PSAux_Service       psaux;
+    PSHinter_Service    pshinter;
 
     FT_UNUSED( num_params );
     FT_UNUSED( params );
@@ -281,14 +281,7 @@
 
     face->root.num_faces = 1;
 
-    psnames = (PSNames_Service)face->psnames;
-    if ( !psnames )
-    {
-      psnames = (PSNames_Service)FT_Get_Module_Interface(
-                  FT_FACE_LIBRARY( face ), "psnames" );
-
-      face->psnames = psnames;
-    }
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES );
 
     psaux = (PSAux_Service)face->psaux;
     if ( !psaux )
diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c
index 704d47d..d0d0843 100644
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -21,7 +21,6 @@
 #include "cidgload.h"
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
 #include "ciderrs.h"
 
@@ -42,7 +41,7 @@
   *  POSTSCRIPT NAME SERVICE
   *
   */
-  
+
   static const char*
   cid_get_postscript_name( CID_Face  face )
   {
@@ -55,8 +54,8 @@
     return result;
   }
 
- 
-  static const FT_Service_PsNameRec  cid_service_ps_name =
+
+  static const FT_Service_PsFontNameRec  cid_service_ps_name =
   {
     (FT_PsName_GetFunc) cid_get_postscript_name
   };
@@ -66,10 +65,10 @@
   *  SERVICE LIST
   *
   */
-  
+
   static const FT_ServiceDescRec  cid_services[] =
   {
-    { FT_SERVICE_ID_POSTSCRIPT_NAME, &cid_service_ps_name },
+    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },
     { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CID },
     { NULL, NULL }
   };
diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c
index 3fdf2ee..630f577 100644
--- a/src/psaux/t1cmap.c
+++ b/src/psaux/t1cmap.c
@@ -35,8 +35,8 @@
   t1_cmap_std_init( T1_CMapStd  cmap,
                     FT_Int      is_expert )
   {
-    T1_Face          face    = (T1_Face)FT_CMAP_FACE( cmap );
-    PSNames_Service  psnames = (PSNames_Service)face->psnames;
+    T1_Face             face    = (T1_Face)FT_CMAP_FACE( cmap );
+    FT_Service_PsNames  psnames = (FT_Service_PsNames)face->psnames;
 
 
     cmap->num_glyphs    = face->type1.num_glyphs;
@@ -263,26 +263,26 @@
   {
     FT_UInt32  u1 = ((T1_CMapUniPair)pair1)->unicode;
     FT_UInt32  u2 = ((T1_CMapUniPair)pair2)->unicode;
-    
+
 
     if ( u1 < u2 )
       return -1;
-      
+
     if ( u1 > u2 )
       return +1;
-      
+
     return 0;
-  }                            
+  }
 
 
   FT_CALLBACK_DEF( FT_Error )
   t1_cmap_unicode_init( T1_CMapUnicode  cmap )
   {
-    FT_Error         error;
-    FT_UInt          count;
-    T1_Face          face    = (T1_Face)FT_CMAP_FACE( cmap );
-    FT_Memory        memory  = FT_FACE_MEMORY( face );
-    PSNames_Service  psnames = (PSNames_Service)face->psnames;
+    FT_Error            error;
+    FT_UInt             count;
+    T1_Face             face    = (T1_Face)FT_CMAP_FACE( cmap );
+    FT_Memory           memory  = FT_FACE_MEMORY( face );
+    FT_Service_PsNames  psnames = (FT_Service_PsNames)face->psnames;
 
 
     cmap->num_pairs = 0;
@@ -316,7 +316,7 @@
           }
         }
       }
-      
+
       new_count = (FT_UInt)( pair - cmap->pairs );
       if ( new_count == 0 )
       {
diff --git a/src/psaux/t1cmap.h b/src/psaux/t1cmap.h
index 0d68c99..0b8c4fc 100644
--- a/src/psaux/t1cmap.h
+++ b/src/psaux/t1cmap.h
@@ -22,7 +22,6 @@
 #include <ft2build.h>
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
 FT_BEGIN_HEADER
 
@@ -47,16 +46,16 @@ FT_BEGIN_HEADER
 
     FT_UInt                    num_glyphs;
     const char* const*         glyph_names;
-    
+
   } T1_CMapStdRec;
 
 
   FT_CALLBACK_TABLE const FT_CMap_ClassRec
   t1_cmap_standard_class_rec;
-  
+
   FT_CALLBACK_TABLE const FT_CMap_ClassRec
   t1_cmap_expert_class_rec;
-  
+
 
   /*************************************************************************/
   /*************************************************************************/
@@ -67,20 +66,20 @@ FT_BEGIN_HEADER
   /*************************************************************************/
 
   typedef struct T1_CMapCustomRec_*  T1_CMapCustom;
-  
+
   typedef struct  T1_CMapCustomRec_
   {
     FT_CMapRec  cmap;
     FT_UInt     first;
     FT_UInt     count;
     FT_UShort*  indices;
-  
+
   } T1_CMapCustomRec;
 
 
   FT_CALLBACK_TABLE const FT_CMap_ClassRec
   t1_cmap_custom_class_rec;
-  
+
 
   /*************************************************************************/
   /*************************************************************************/
@@ -97,7 +96,7 @@ FT_BEGIN_HEADER
   {
     FT_UInt32  unicode;
     FT_UInt    gindex;
-  
+
   } T1_CMapUniPairRec, *T1_CMapUniPair;
 
 
@@ -115,7 +114,7 @@ FT_BEGIN_HEADER
 
  /* */
 
- 
+
 FT_END_HEADER
 
 #endif /* __T1CMAP_H__ */
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index dd8719f..76b688f 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -125,9 +125,9 @@
   t1_lookup_glyph_by_stdcharcode( T1_Decoder  decoder,
                                   FT_Int      charcode )
   {
-    FT_UInt           n;
-    const FT_String*  glyph_name;
-    PSNames_Service   psnames = decoder->psnames;
+    FT_UInt             n;
+    const FT_String*    glyph_name;
+    FT_Service_PsNames  psnames = decoder->psnames;
 
 
     /* check range of standard char code */
@@ -1129,11 +1129,10 @@
 
     /* retrieve PSNames interface from list of current modules */
     {
-      PSNames_Service  psnames = 0;
+      FT_Service_PsNames  psnames = 0;
 
 
-      psnames = (PSNames_Service)FT_Get_Module_Interface(
-                  FT_FACE_LIBRARY(face), "psnames" );
+      FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES );
       if ( !psnames )
       {
         FT_ERROR(( "t1_decoder_init: " ));
diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h
index fcb853c..4c71421 100644
--- a/src/psaux/t1decode.h
+++ b/src/psaux/t1decode.h
@@ -22,7 +22,6 @@
 
 #include <ft2build.h>
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_TYPE1_TYPES_H
 
 
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index af36428..258b6d1 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -17,8 +17,8 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_OBJECTS_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 #include "psmodule.h"
 #include "pstables.h"
@@ -176,10 +176,10 @@
 
   /* Builds a table that maps Unicode values to glyph indices */
   static FT_Error
-  ps_build_unicode_table( FT_Memory     memory,
-                          FT_UInt       num_glyphs,
-                          const char**  glyph_names,
-                          PS_Unicodes*  table )
+  ps_unicodes_init( FT_Memory     memory,
+                    FT_UInt       num_glyphs,
+                    const char**  glyph_names,
+                    PS_Unicodes*  table )
   {
     FT_Error  error;
 
@@ -242,8 +242,8 @@
 
 
   static FT_UInt
-  ps_lookup_unicode( PS_Unicodes*  table,
-                     FT_ULong      unicode )
+  ps_unicodes_char_index( PS_Unicodes*  table,
+                          FT_ULong      unicode )
   {
     PS_UniMap  *min, *max, *mid;
 
@@ -273,8 +273,8 @@
 
 
   static FT_ULong
-  ps_next_unicode( PS_Unicodes*  table,
-                   FT_ULong      unicode )
+  ps_unicodes_char_next( PS_Unicodes*  table,
+                         FT_ULong      unicode )
   {
     PS_UniMap  *min, *max, *mid;
 
@@ -335,19 +335,21 @@
 
 
   static
-  const PSNames_Interface  psnames_interface =
+  const FT_Service_PsNamesRec  psnames_interface =
   {
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
 
-    (PS_Unicode_Value_Func)    ps_unicode_value,
-    (PS_Build_Unicodes_Func)   ps_build_unicode_table,
-    (PS_Lookup_Unicode_Func)   ps_lookup_unicode,
+    (PS_Unicode_ValueFunc)          ps_unicode_value,
+    (PS_Unicodes_InitFunc)          ps_unicodes_init,
+    (PS_Unicodes_CharIndexFunc)     ps_unicodes_char_index,
+    (PS_Unicodes_CharNextFunc)      ps_unicodes_char_next,
 
 #else
 
     0,
     0,
     0,
+    0,
 
 #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
 
@@ -355,20 +357,29 @@
     (PS_Adobe_Std_Strings_Func) ps_get_standard_strings,
 
     t1_standard_encoding,
-    t1_expert_encoding,
+    t1_expert_encoding
+  };
 
-#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
-    (PS_Next_Unicode_Func)     ps_next_unicode
-#else
-    0
-#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
 
+  static const FT_ServiceDescRec  psnames_services[] =
+  {
+    { FT_SERVICE_ID_POSTSCRIPT_NAMES, & psnames_interface },
+    { NULL, NULL }
   };
 
+  static FT_Pointer
+  psnames_get_service( FT_Module    module,
+                       const char*  service_id )
+  {
+    FT_UNUSED( module );
+
+    return ft_service_list_lookup( psnames_services, service_id );
+  }
 
 #endif /* !FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES */
 
 
+
   FT_CALLBACK_TABLE_DEF
   const FT_Module_Class  psnames_module_class =
   {
@@ -381,13 +392,15 @@
 
 #ifdef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES
     0,
+    (FT_Module_Constructor)0,
+    (FT_Module_Destructor) 0,
+    (FT_Module_Requester)  0
 #else
     (void*)&psnames_interface,   /* module specific interface */
-#endif
-
     (FT_Module_Constructor)0,
     (FT_Module_Destructor) 0,
-    (FT_Module_Requester)  0
+    (FT_Module_Requester)  psnames_get_service
+#endif
   };
 
 
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index cc186a6..36b3b6b 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -241,7 +241,7 @@
     return result;
   }
 
-  static const FT_Service_PsNameRec   sfnt_service_ps_name =
+  static const FT_Service_PsFontNameRec   sfnt_service_ps_name =
   {
     (FT_PsName_GetFunc) sfnt_get_ps_name
   };
@@ -255,7 +255,7 @@
 
   static const FT_ServiceDescRec  sfnt_services[] =
   {
-    { FT_SERVICE_ID_POSTSCRIPT_NAME, & sfnt_service_ps_name },
+    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, & sfnt_service_ps_name },
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
     { FT_SERVICE_ID_GLYPH_DICT,      & sfnt_service_glyph_dict },
 #endif
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 64d8afb..e9f172f 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -21,10 +21,9 @@
 #include "ttload.h"
 #include "ttcmap0.h"
 #include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 #include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
-
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 #include "sferrors.h"
 
 
@@ -365,11 +364,7 @@
       face->goto_table = sfnt->goto_table;
     }
 
-    if ( !face->psnames )
-    {
-      face->psnames = (PSNames_Service)
-                        FT_Get_Module_Interface( library, "psnames" );
-    }
+    FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_NAMES );
 
     /* check that we have a valid TrueType file */
     error = sfnt->load_sfnt_header( face, stream, face_index, &sfnt_header );
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index 486ba3d..6647586 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -50,7 +50,7 @@
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
 
 
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 #define MAC_NAME( x )  ( (FT_String*)psnames->macintosh_name( x ) )
 
@@ -441,7 +441,7 @@
     FT_Fixed         format;
 
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-    PSNames_Service  psnames;
+    FT_Service_PsNames  psnames;
 #endif
 
 
@@ -452,7 +452,7 @@
       return SFNT_Err_Invalid_Glyph_Index;
 
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-    psnames = (PSNames_Service)face->psnames;
+    psnames = (FT_Service_PsNames)face->psnames;
     if ( !psnames )
       return SFNT_Err_Unimplemented_Feature;
 #endif
@@ -510,7 +510,7 @@
         *PSname = MAC_NAME( idx );
       }
     }
-    
+
     /* nothing to do for format == 0x00030000L */
 
   End:
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 3768dd6..e3a5c51 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -23,7 +23,7 @@
 #include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 #include "ttgload.h"
 #include "ttpload.h"
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 35cde03..5c597b6 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -29,12 +29,12 @@
 
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
 #include FT_SERVICE_MULTIPLE_MASTERS_H
 #include FT_SERVICE_GLYPH_DICT_H
 #include FT_SERVICE_XFREE86_NAME_H
 #include FT_SERVICE_POSTSCRIPT_NAME_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
   /*************************************************************************/
   /*                                                                       */
@@ -114,7 +114,7 @@
     return (const char*) face->type1.font_name;
   }
 
-  static const FT_Service_PsNameRec  t1_service_ps_name =
+  static const FT_Service_PsFontNameRec  t1_service_ps_name =
   {
     (FT_PsName_GetFunc)  t1_get_ps_name
   };
@@ -142,7 +142,7 @@
 
   static const FT_ServiceDescRec  t1_services[] =
   {
-    { FT_SERVICE_ID_POSTSCRIPT_NAME, &t1_service_ps_name },
+    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t1_service_ps_name },
     { FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict },
     { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TYPE_1 },
 
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 9f3bed6..94452f5 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -29,7 +29,7 @@
 #include "t1afm.h"
 #endif
 
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_POSTSCRIPT_AUX_H
 
 
@@ -279,7 +279,7 @@
                 FT_Parameter*  params )
   {
     FT_Error         error;
-    PSNames_Service  psnames;
+    FT_Service_PsNames  psnames;
     PSAux_Service    psaux;
     T1_Font          type1 = &face->type1;
     PS_FontInfo      info = &type1->font_info;
@@ -292,9 +292,8 @@
 
     face->root.num_faces = 1;
 
-    face->psnames = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
-                                             "psnames" );
-    psnames = (PSNames_Service)face->psnames;
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES );
+    face->psnames = psnames;
 
     face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
                                            "psaux" );
diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c
index a86cafc..faa891e 100644
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -54,7 +54,7 @@
   *  GLYPH DICT SERVICE
   *
   */
-  
+
   static FT_Error
   t42_get_glyph_name( T42_Face    face,
                       FT_UInt     glyph_index,
@@ -116,15 +116,15 @@
   */
 
   static const char*
-  t42_get_ps_name( T42_Face  face )
+  t42_get_ps_font_name( T42_Face  face )
   {
     return (const char*)face->type1.font_name;
   }
 
 
-  static FT_Service_PsNameRec  t42_service_ps_name =
+  static FT_Service_PsFontNameRec  t42_service_ps_font_name =
   {
-    (FT_PsName_GetFunc)t42_get_ps_name
+    (FT_PsName_GetFunc)t42_get_ps_font_name
   };
 
 
@@ -136,9 +136,9 @@
 
   static const FT_ServiceDescRec  t42_services[] =
   {
-    { FT_SERVICE_ID_GLYPH_DICT,      &t42_service_glyph_dict },
-    { FT_SERVICE_ID_POSTSCRIPT_NAME, &t42_service_ps_name    },
-    { FT_SERVICE_ID_XF86_NAME,       FT_XF86_FORMAT_TYPE_42   },
+    { FT_SERVICE_ID_GLYPH_DICT,           &t42_service_glyph_dict },
+    { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t42_service_ps_font_name },
+    { FT_SERVICE_ID_XF86_NAME,            FT_XF86_FORMAT_TYPE_42   },
     { NULL, NULL }
   };
 
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index 37a4553..e5a5748 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -150,7 +150,7 @@
                  FT_Parameter*  params )
   {
     FT_Error         error;
-    PSNames_Service  psnames;
+    FT_Service_PsNames  psnames;
     PSAux_Service    psaux;
     FT_Face          root  = (FT_Face)&face->root;
     T1_Font          type1 = &face->type1;
@@ -165,9 +165,8 @@
     face->ttf_face       = NULL;
     face->root.num_faces = 1;
 
-    face->psnames = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
-                                             "psnames" );
-    psnames = (PSNames_Service)face->psnames;
+    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES );
+    face->psnames = psnames;
 
     face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
                                            "psaux" );
diff --git a/src/type42/t42objs.h b/src/type42/t42objs.h
index 6fb1769..4867186 100644
--- a/src/type42/t42objs.h
+++ b/src/type42/t42objs.h
@@ -25,7 +25,7 @@
 #include FT_INTERNAL_TYPE42_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_SERVICE_POSTSCRIPT_NAMES_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H