Commit 60b32e16e75cd3387160487693a24b61b08684b6

David Turner 2002-11-06T22:32:54

2002-11-05 David Turner <david@freetype.org> * include/freetype/config/ftoption.h, src/gzip/ftgzip.c: added support for the FT_CONFIG_OPTION_SYSTEM_ZLIB option, used to specify the use of system-wide zlib. Note that this macro, as well as FT_CONFIG_OPTION_BYTECODE_INTERPRETER, is not #undef-ed anymore. This allows the build system to define them depending on the configuration (typically by adding -D flags at compile time). * src/sfnt/ttcmap0.c (tt_face_build_cmaps): removed compiler warnings in optimized mode relative to the "volatile" local variables. This was not a compiler bug after all, but the fact that a pointer to a volatile variable is not the same than a volatile pointer to a variable :-) the fix was to change "volatile FT_Byte* p" into "FT_Byte* volatile p" * src/pfr/pfrload.c, src/pfr/pfrdrivr.c, src/gzip/inftrees.c: removed compiler warnings in optimized modes * src/gzip/*.[hc]: modified our ZLib copy in order to prevent exporting any zlib function names outside of the component. This prevents linking problems on some platforms, when applications want to link FreeType _and_ ZLib together. 2002-11-05 Juliusz <jch@pps.jussieu.fr> * src/psaux/psobjs.c (ps_table_add): modified increment loop in order to implement exponential behaviour

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
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
diff --git a/ChangeLog b/ChangeLog
index 43a5121..2994a3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2002-11-05  David Turner  <david@freetype.org>
+
+        * include/freetype/config/ftoption.h, src/gzip/ftgzip.c: added
+        support for the FT_CONFIG_OPTION_SYSTEM_ZLIB option, used to specify
+        the use of system-wide zlib.
+
+        Note that this macro, as well as FT_CONFIG_OPTION_BYTECODE_INTERPRETER,
+        is not #undef-ed anymore. This allows the build system to define them
+        depending on the configuration (typically by adding -D flags at
+        compile time).
+
+        * src/sfnt/ttcmap0.c (tt_face_build_cmaps): removed compiler warnings
+        in optimized mode relative to the "volatile" local variables. This was
+        not a compiler bug after all, but the fact that a pointer to a volatile
+        variable is not the same than a volatile pointer to a variable :-)
+
+        the fix was to change  "volatile FT_Byte*  p"
+        into                   "FT_Byte* volatile  p"
+
+        * src/pfr/pfrload.c, src/pfr/pfrdrivr.c, src/gzip/inftrees.c: removed
+        compiler warnings in optimized modes
+
+        * src/gzip/*.[hc]: modified our ZLib copy in order to prevent exporting
+        any zlib function names outside of the component. This prevents linking
+        problems on some platforms, when applications want to link FreeType
+        _and_ ZLib together.
+
+
+2002-11-05  Juliusz  <jch@pps.jussieu.fr>
+
+        * src/psaux/psobjs.c (ps_table_add): modified increment loop in
+        order to implement exponential behaviour
+
 2002-10-31  David Turner  <david@freetype.org>
 
         * include/freetype/ftgzip.h, src/gzip/ftgzip.c:
@@ -132,7 +165,7 @@
 	ft_smooth_render_lcd_v): Ditto.
 	(ft_smooth_render_generic): Change third and fifth parameter to
 	`FT_Render_Mode'.
-	
+
 	* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
 	include/freetype/ftglyph.h: Updated.
 
diff --git a/Jamfile b/Jamfile
index 724b712..b6d4af0 100644
--- a/Jamfile
+++ b/Jamfile
@@ -1,6 +1,21 @@
-# FreeType 2 top Jamfile (c) 2001 David Turner
+# FreeType 2 top Jamfile (c) 2001-2002 David Turner
 #
 
+# The HDRMACRO is already defined in FTJam and is used to add
+# the content of certain macros to the list of included header
+# files.
+#
+# we can compile FreeType 2 with classic Jam however thanks to
+# the following code
+#
+if ! $(JAM_TOOLSET)
+{
+  rule HDRMACRO
+  {
+    # nothing !!
+  }
+}
+
 # We need to invoke a SubDir rule if the FT2 source directory top is not the
 # current directory.  This allows us to build FreeType 2 as part of a larger
 # project easily.
@@ -10,11 +25,72 @@ if $(FT2_TOP) != $(DOT)
   SubDir  FT2_TOP ;
 }
 
-FT2_INCLUDE = [ FT2_SubDir include ] ;
-FT2_SRC     = [ FT2_SubDir src ] ;
+#
+# The following macros define the include directory, the source directory
+# and the final library name (without library extensions). They can be
+# replaced by other definitions when the library is compiled as part of
+# a larger project.
+#
+
+# name of FreeType include directory during compilation.
+# relative to FT2_TOP
+#
+FT2_INCLUDE_DIR ?= include ;
+
+# name of FreeType source directory during compilation.
+# relative to FT2_TOP
+#
+FT2_SRC_DIR ?= src ;
 
-FT2_LIB     = $(LIBPREFIX)freetype ;
+# name of final library, without extension
+#
+FT2_LIB ?= $(LIBPREFIX)freetype ;
 
+
+# define FT2_BUILD_INCLUDE to point to your build-specific directory
+# this is prepended to FT2_INCLUDE_DIR. This can be used to specify
+# the location of a custom <ft2build.h> which will point to custom
+# versions of "ftmodule.h" and "ftoption.h", for example
+#
+FT2_BUILD_INCLUDE ?= ;
+
+# the list of modules to compile on any given build of the library
+# by default, this will contain _all_ modules defined in FT2_SRC_DIR
+#
+# IMPORTANT: You'll need to change the content of "ftmodule.h" as well
+#            if you modify this list or provide your own.
+#
+FT2_COMPONENTS ?= gzip       # support for gzip-compressed files.
+                  autohint   # auto-hinter
+                  base       # base component (public APIs)
+                  bdf        # BDF font driver
+                  cache      # cache sub-system
+                  cff        # CFF/CEF font driver
+                  cid        # Postscript CID-keyed font driver
+                  pcf        # PCF font driver
+                  pfr        # PFR/TrueDoc font driver
+                  psaux      # Common Postscript routines module
+                  pshinter   # Postscript hinter module
+                  psnames    # Postscript names handling
+                  raster     # Monochrome rasterizer
+                  smooth     # Anti-aliased rasterizer
+                  sfnt       # SFNT-based format support routines
+                  truetype   # TrueType font driver
+                  type1      # Postscript Type 1 font driver
+                  type42     # Postscript Type 42 (embedded TrueType) driver
+                  winfonts   # Windows FON/FNT font driver
+                  ;
+
+
+# don't touch
+#
+FT2_INCLUDE  = $(FT2_BUILD_INCLUDE)
+               [ FT2_SubDir $(FT2_INCLUDE_DIR) ] ;
+
+FT2_SRC      = [ FT2_SubDir $(FT2_SRC_DIR) ] ;
+
+# only used by FreeType developers
+#
 if $(DEBUG_HINTER)
 {
   CCFLAGS += -DDEBUG_HINTER ;
@@ -24,7 +100,7 @@ if $(DEBUG_HINTER)
 # We need "freetype2/include" in the current include path in order to
 # compile any part of FreeType 2.
 #
-SubDirHdr  += $(FT2_INCLUDE) ;
+SubDirHdr += $(FT2_INCLUDE) ;
 
 # Uncomment the following line if you want to build individual source files
 # for each FreeType 2 module.
@@ -41,10 +117,10 @@ HDRMACRO  [ FT2_SubDir  include freetype internal internal.h ] ;
 # Now include the Jamfile in "freetype2/src", used to drive the compilation
 # of each FreeType 2 component and/or module.
 #
-SubInclude  FT2_TOP src ;
+SubInclude  FT2_TOP $(FT2_SRC_DIR) ;
 
 
-# tests files (hinter debugging)
+# tests files (hinter debugging). only used by FreeType developers
 #
 if $(DEBUG_HINTER)
 {
diff --git a/Jamfile.in b/Jamfile.in
index f12c13f..65dd064 100644
--- a/Jamfile.in
+++ b/Jamfile.in
@@ -48,7 +48,7 @@ HDRMACRO  [ FT2_SubDir  include freetype internal internal.h ] ;
 # Now include the Jamfile in "freetype2/src", used to drive the compilation
 # of each FreeType 2 component and/or module.
 #
-SubInclude  FT2_TOP src ;
+SubInclude  FT2_TOP $(FT2_SRC_DIR) ;
 
 
 # tests files (hinter debugging)
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index c00a402..85c9e45 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -92,7 +92,7 @@ FT_BEGIN_HEADER
   /*         file "ftconfig.h" either statically, or through Autoconf      */
   /*         on platforms that support it.                                 */
   /*                                                                       */
-#undef FT_CONFIG_OPTION_FORCE_INT64
+#undef  FT_CONFIG_OPTION_FORCE_INT64
 
 
   /*************************************************************************/
@@ -110,6 +110,28 @@ FT_BEGIN_HEADER
   /*                                                                       */
 #define FT_CONFIG_OPTION_USE_ZLIB
 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* ZLib library selection                                                */
+  /*                                                                       */
+  /*   This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined.  */
+  /*   It allows FreeType's "ftgzip" component to link to the system's     */
+  /*   installation of the ZLib library. This is useful on systems like    */
+  /*   Unix or VMS where it generally is already available.                */
+  /*                                                                       */
+  /*   If you let it undefined, the component will use its own copy        */
+  /*   of the zlib sources instead. These have been modified to be         */
+  /*   included directly within the component and *not* export external    */
+  /*   function names. This allows you to link any program with FreeType   */
+  /*   _and_ ZLib without linking conflicts.                               */
+  /*                                                                       */
+  /*   do not #undef this macro here, since the build system might         */
+  /*   define for certain configurations                                   */
+  /*                                                                       */
+/* #define  FT_CONFIG_OPTION_SYSTEM_ZLIB */
+
+
   /*************************************************************************/
   /*                                                                       */
   /* DLL export compilation                                                */
@@ -145,8 +167,8 @@ FT_BEGIN_HEADER
   /*   will be later automatically defined as `extern return_type' to      */
   /*   allow normal compilation.                                           */
   /*                                                                       */
-#undef FT_EXPORT
-#undef FT_EXPORT_DEF
+/* #define  FT_EXPORT(x)       extern x */
+/* #define  FT_EXPORT_DEF(x)   x */
 
 
   /*************************************************************************/
@@ -199,7 +221,7 @@ FT_BEGIN_HEADER
   /* This allows FreeType to be used with the PostScript language, using   */
   /* the GhostScript interpreter.                                          */
   /*                                                                       */
-#undef FT_CONFIG_OPTION_INCREMENTAL
+/* #define  FT_CONFIG_OPTION_INCREMENTAL */
 
 
   /*************************************************************************/
@@ -236,8 +258,8 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*   Don't define any of these macros to compile in `release' mode!      */
   /*                                                                       */
-#undef  FT_DEBUG_LEVEL_ERROR
-#undef  FT_DEBUG_LEVEL_TRACE
+/* #define  FT_DEBUG_LEVEL_ERROR */
+/* #define  FT_DEBUG_LEVEL_TRACE */
 
 
   /*************************************************************************/
@@ -252,7 +274,7 @@ FT_BEGIN_HEADER
   /*   Note that the memory debugger is only activated at runtime when     */
   /*   when the _environment_ variable "FT_DEBUG_MEMORY" is also defined!  */
   /*                                                                       */
-#undef  FT_DEBUG_MEMORY
+/* #define  FT_DEBUG_MEMORY */
 
 
 
@@ -353,7 +375,10 @@ FT_BEGIN_HEADER
   /* By undefining this, you will only compile the code necessary to load  */
   /* TrueType glyphs without hinting.                                      */
   /*                                                                       */
-#undef  TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+  /*   do not #undef this macro here, since the build system might         */
+  /*   define for certain configurations                                   */
+  /*                                                                       */
+/* #define  TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
 
   /*************************************************************************/
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 82a5de4..4e7b03b 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -2037,7 +2037,7 @@ FT_BEGIN_HEADER
   *     when you want to retrieve the original glyph outlines in font units.
   *
   *   FT_LOAD_NO_HINTING ::
-  *     Don't hint glyph outlines after their scaling to device pixels. 
+  *     Don't hint glyph outlines after their scaling to device pixels.
   *     This generally generates "blurrier" glyphs in anti-aliased modes.
   *
   *     This flag is ignored if @FT_LOAD_NO_SCALE is set.
@@ -2143,10 +2143,11 @@ FT_BEGIN_HEADER
 
   /* */
 
-#define FT_LOAD_TARGET_( x )      ( (FT_Int32)( (x) & 7 ) << 16 )
-#define FT_LOAD_TARGET_MODE( x )  ( (FT_Render_Mode)( ( (x) >> 16 ) & 7 ) )
+#define FT_LOAD_TARGET_( x )      ( (FT_Int32)( (x) & 15 ) << 16 )
+#define FT_LOAD_TARGET_MODE( x )  ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
 
 #define FT_LOAD_TARGET_NORMAL     FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
+#define FT_LOAD_TARGET_LIGHT      FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT  )
 #define FT_LOAD_TARGET_MONO       FT_LOAD_TARGET_( FT_RENDER_MODE_MONO   )
 #define FT_LOAD_TARGET_LCD        FT_LOAD_TARGET_( FT_RENDER_MODE_LCD    )
 #define FT_LOAD_TARGET_LCD_V      FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V  )
@@ -2201,6 +2202,13 @@ FT_BEGIN_HEADER
   /*      This is the default render mode; it corresponds to 8-bit         */
   /*      anti-aliased bitmaps, using 256 levels of opacity.               */
   /*                                                                       */
+  /*    FT_RENDER_MODE_LIGHT ::                                            */
+  /*      This is similar to @FT_RENDER_MODE_NORMAL, except that this      */
+  /*      changes the hinting to prevent stem width quantization. This     */
+  /*      results in glyph shapes that are more similar to the original,   */
+  /*      while being a bit more fuzzy ("better shapes", instead of        */
+  /*      "better contrast" if you want :-)                                */
+  /*                                                                       */
   /*    FT_RENDER_MODE_MONO ::                                             */
   /*      This mode corresponds to 1-bit bitmaps.                          */
   /*                                                                       */
@@ -2224,6 +2232,7 @@ FT_BEGIN_HEADER
   typedef enum  FT_Render_Mode_
   {
     FT_RENDER_MODE_NORMAL = 0,
+    FT_RENDER_MODE_LIGHT,
     FT_RENDER_MODE_MONO,
     FT_RENDER_MODE_LCD,
     FT_RENDER_MODE_LCD_V,
diff --git a/src/Jamfile b/src/Jamfile
index bbaa4b7..e4d3575 100644
--- a/src/Jamfile
+++ b/src/Jamfile
@@ -1,37 +1,17 @@
 # FreeType 2 src Jamfile (c) 2001, 2002 David Turner
 #
 
-SubDir  FT2_TOP src ;
-
-# We need to add "freetype/src" to the current include path in order to
-# compile any part of FreeType 2.
-#
-SubDirHdrs  [ FT2_SubDir  src ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) ;
 
 # The file <freetype/internal/internal.h> is used to define macros that are
 # later used in #include statements.  It needs to be parsed in order to
 # record these definitions.
 #
-HDRMACRO  [ FT2_SubDir  include internal internal.h ] ;
+HDRMACRO  [ FT2_SubDir $(FT2_INCLUDE_DIR) internal internal.h ] ;
 
-SubInclude  FT2_TOP src gzip ;
-SubInclude  FT2_TOP src autohint ;
-SubInclude  FT2_TOP src base ;
-SubInclude  FT2_TOP src bdf ;
-SubInclude  FT2_TOP src cache ;
-SubInclude  FT2_TOP src cff ;
-SubInclude  FT2_TOP src cid ;
-SubInclude  FT2_TOP src pcf ;
-SubInclude  FT2_TOP src pfr ;
-SubInclude  FT2_TOP src psaux ;
-SubInclude  FT2_TOP src pshinter ;
-SubInclude  FT2_TOP src psnames ;
-SubInclude  FT2_TOP src raster ;
-SubInclude  FT2_TOP src sfnt ;
-SubInclude  FT2_TOP src smooth ;
-SubInclude  FT2_TOP src truetype ;
-SubInclude  FT2_TOP src type1 ;
-SubInclude  FT2_TOP src type42 ;
-SubInclude  FT2_TOP src winfonts ;
+for xx in $(FT2_COMPONENTS)
+{
+  SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ;
+}
 
 # end of src Jamfile
diff --git a/src/autohint/Jamfile b/src/autohint/Jamfile
index ed2da3a..a129e5e 100644
--- a/src/autohint/Jamfile
+++ b/src/autohint/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/autohint Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src autohint ;
-
-SubDirHdrs  [ FT2_SubDir  src autohint ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) autohint ;
 
 {
   local  _sources ;
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c
index 1498112..dacde6e 100644
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -233,11 +233,8 @@
       sign = -1;
     }
 
+    /* do not touch serifs widths !! */
 #if 0
-    if ( dist < 32 )
-      dist = 32;
-#else
-    /* do not strengthen serifs */
     if ( base->flags & AH_EDGE_DONE )
     {
       if ( dist >= 64 )
@@ -360,77 +357,50 @@
         if ( edge2->blue_edge || edge2 < edge )
         {
 
-#if 0
-          printf( "strange blue alignment, edge %d to %d\n",
-                  edge - edges, edge2 - edges );
-#endif
-
           ah_align_linked_edge( hinter, edge2, edge, dimension );
           edge->flags |= AH_EDGE_DONE;
           continue;
         }
 
+        if ( !anchor )
         {
-#if 0
-          FT_Bool  min = 0;
-#endif
-
-
-          if ( !anchor )
-          {
-            edge->pos = ( edge->opos + 32 ) & -64;
-            anchor    = edge;
-
-            edge->flags |= AH_EDGE_DONE;
-
-            ah_align_linked_edge( hinter, edge, edge2, dimension );
-          }
-          else
-          {
-            FT_Pos   org_pos, org_len, org_center, cur_len;
-            FT_Pos   cur_pos1, cur_pos2, delta1, delta2;
+          edge->pos = ( edge->opos + 32 ) & -64;
+          anchor    = edge;
 
+          edge->flags |= AH_EDGE_DONE;
 
-            org_pos    = anchor->pos + (edge->opos - anchor->opos);
-            org_len    = edge2->opos - edge->opos;
-            org_center = org_pos + ( org_len >> 1 );
+          ah_align_linked_edge( hinter, edge, edge2, dimension );
+        }
+        else
+        {
+          FT_Pos   org_pos, org_len, org_center, cur_len;
+          FT_Pos   cur_pos1, cur_pos2, delta1, delta2;
 
-            cur_len    = ah_compute_stem_width( hinter, dimension, org_len );
 
-            cur_pos1   = ( org_pos + 32 ) & -64;
-            delta1     = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
-            if ( delta1 < 0 )
-              delta1 = -delta1;
+          org_pos    = anchor->pos + (edge->opos - anchor->opos);
+          org_len    = edge2->opos - edge->opos;
+          org_center = org_pos + ( org_len >> 1 );
 
-            cur_pos2   = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len;
-            delta2     = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
-            if ( delta2 < 0 )
-              delta2 = -delta2;
+          cur_len    = ah_compute_stem_width( hinter, dimension, org_len );
 
-            edge->pos  = ( delta1 <= delta2 ) ? cur_pos1 : cur_pos2;
-            edge2->pos = edge->pos + cur_len;
+          cur_pos1   = ( org_pos + 32 ) & -64;
+          delta1     = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
+          if ( delta1 < 0 )
+            delta1 = -delta1;
 
-            edge->flags  |= AH_EDGE_DONE;
-            edge2->flags |= AH_EDGE_DONE;
+          cur_pos2   = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len;
+          delta2     = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
+          if ( delta2 < 0 )
+            delta2 = -delta2;
 
-            if ( edge > edges && edge->pos < edge[-1].pos )
-              edge->pos = edge[-1].pos;
+          edge->pos  = ( delta1 <= delta2 ) ? cur_pos1 : cur_pos2;
+          edge2->pos = edge->pos + cur_len;
 
-#if 0
-            delta = 0;
-            if ( edge2 + 1 < edge_limit        &&
-                 edge2[1].flags & AH_EDGE_DONE )
-              delta = edge2[1].pos - edge2->pos;
+          edge->flags  |= AH_EDGE_DONE;
+          edge2->flags |= AH_EDGE_DONE;
 
-            if ( delta < 0 )
-            {
-              edge2->pos += delta;
-              if ( !min )
-                edge->pos += delta;
-            }
-            edge2->flags |= AH_EDGE_DONE;
-#endif
-          }
+          if ( edge > edges && edge->pos < edge[-1].pos )
+            edge->pos = edge[-1].pos;
         }
       }
 
diff --git a/src/base/Jamfile b/src/base/Jamfile
index 956fb09..8e52df6 100644
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/base Jamfile (c) 2001, 2002 David Turner
 #
 
-SubDir  FT2_TOP src base ;
-
-SubDirHdrs  [ FT2_SubDir  src base ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) base ;
 
 {
   local  _sources ;
diff --git a/src/bdf/Jamfile b/src/bdf/Jamfile
index 6fe3a7e..8b1714d 100644
--- a/src/bdf/Jamfile
+++ b/src/bdf/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/bdf Jamfile (c) 2002 David Turner
 #
 
-SubDir  FT2_TOP src bdf ;
-
-SubDirHdrs  [ FT2_SubDir  src bdf ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) bdf ;
 
 {
   local  _sources ;
diff --git a/src/cache/Jamfile b/src/cache/Jamfile
index 3148f55..099fd5e 100644
--- a/src/cache/Jamfile
+++ b/src/cache/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/cache Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src cache ;
-
-SubDirHdrs  [ FT2_SubDir  src cache ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) cache ;
 
 # The file <freetype/ftcache.h> contains some macro definitions that are
 # later used in #include statements related to the cache sub-system.  It
diff --git a/src/cff/Jamfile b/src/cff/Jamfile
index 0c46ec7..cf7cf63 100644
--- a/src/cff/Jamfile
+++ b/src/cff/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/cff Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src cff ;
-
-SubDirHdrs  [ FT2_SubDir  src cff ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) cff ;
 
 {
   local  _sources ;
diff --git a/src/cid/Jamfile b/src/cid/Jamfile
index 87c580d..a505e3c 100644
--- a/src/cid/Jamfile
+++ b/src/cid/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/cid Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src cid ;
-
-SubDirHdrs  [ FT2_SubDir  src cid ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) cid ;
 
 {
   local  _sources ;
diff --git a/src/gzip/Jamfile b/src/gzip/Jamfile
index 0824ee8..e461cf1 100644
--- a/src/gzip/Jamfile
+++ b/src/gzip/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/gzip Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src gzip ;
-
-SubDirHdrs  [ FT2_SubDir  src gzip ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) gzip ;
 
 Library  $(FT2_LIB) : ftgzip.c ;
 
diff --git a/src/gzip/adler32.c b/src/gzip/adler32.c
index fae88b6..f6bf324 100644
--- a/src/gzip/adler32.c
+++ b/src/gzip/adler32.c
@@ -1,6 +1,6 @@
 /* adler32.c -- compute the Adler-32 checksum of a data stream
  * Copyright (C) 1995-2002 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h 
+ * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
 /* @(#) $Id$ */
@@ -18,7 +18,7 @@
 #define DO16(buf)   DO8(buf,0); DO8(buf,8);
 
 /* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
+ZEXTERNDEF uLong ZEXPORT adler32(adler, buf, len)
     uLong adler;
     const Bytef *buf;
     uInt len;
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index 22896b3..91c0cd4 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -27,13 +27,24 @@
 
 #ifdef FT_CONFIG_OPTION_USE_ZLIB
 
-#  define  NO_DUMMY_DECL
-#  define  BUILDFIXED  /* save code size */
+#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
 
 #  include "zlib.h"
 
-#  if 1  /* we choose to include directly the zlib sources in this component */
-         /* this is done to avoid ugly library dependencies                  */
+#else /* !SYSTEM_ZLIB */
+
+ /* in this case, we include our own modified sources of the ZLib   */
+ /* within the "ftgzip" component. The modifications were necessary */
+ /* to #include all files without conflicts, as well as preventing  */
+ /* the definition of "extern" functions that may cause linking     */
+ /* conflicts when a program is linked with both FreeType and the   */
+ /* original ZLib                                                   */
+
+#  define  NO_DUMMY_DECL
+#  define  BUILDFIXED    /* save code size */
+#  define  MY_ZCALLOC
+
+#  include "zlib.h"
 
 #    undef   SLOW
 #    define  SLOW  1  /* we can't use asm-optimized sources here !! */
@@ -46,7 +57,7 @@
 #    include "inflate.c"
 #    include "adler32.c"
 
-#  endif  /* 1 */
+#endif /* !SYSTEM_ZLIB */
 
 
 /***************************************************************************/
@@ -82,6 +93,27 @@
  }
 
 
+#ifndef FT_CONFIG_OPTION_SYSTEM_ZLIB
+
+ local voidpf
+ zcalloc (opaque, items, size)
+    voidpf opaque;
+    unsigned items;
+    unsigned size;
+ {
+   return ft_gzip_alloc( opaque, items, size );
+ }
+
+ local void
+ zcfree( voidpf  opaque,
+         voidpf  ptr )
+ {
+   ft_gzip_free( opaque, ptr );
+ }
+
+#endif /* !SYSTEM_ZLIB */
+
+
 /***************************************************************************/
 /***************************************************************************/
 /*****                                                                 *****/
diff --git a/src/gzip/infblock.c b/src/gzip/infblock.c
index e286712..423af81 100644
--- a/src/gzip/infblock.c
+++ b/src/gzip/infblock.c
@@ -64,7 +64,7 @@ local const uInt border[] = { /* Order of the bit length code lengths */
  */
 
 
-void inflate_blocks_reset(s, z, c)
+local void inflate_blocks_reset(s, z, c)
 inflate_blocks_statef *s;
 z_streamp z;
 uLongf *c;
@@ -85,7 +85,7 @@ uLongf *c;
 }
 
 
-inflate_blocks_statef *inflate_blocks_new(z, c, w)
+local inflate_blocks_statef *inflate_blocks_new(z, c, w)
 z_streamp z;
 check_func c;
 uInt w;
@@ -116,7 +116,7 @@ uInt w;
 }
 
 
-int inflate_blocks(s, z, r)
+local int inflate_blocks(s, z, r)
 inflate_blocks_statef *s;
 z_streamp z;
 int r;
@@ -368,7 +368,7 @@ int r;
 }
 
 
-int inflate_blocks_free(s, z)
+local int inflate_blocks_free(s, z)
 inflate_blocks_statef *s;
 z_streamp z;
 {
@@ -381,22 +381,3 @@ z_streamp z;
 }
 
 
-void inflate_set_dictionary(s, d, n)
-inflate_blocks_statef *s;
-const Bytef *d;
-uInt  n;
-{
-  zmemcpy(s->window, d, n);
-  s->read = s->write = s->window + n;
-}
-
-
-/* Returns true if inflate is currently at the end of a block generated
- * by Z_SYNC_FLUSH or Z_FULL_FLUSH.
- * IN assertion: s != Z_NULL
- */
-int inflate_blocks_sync_point(s)
-inflate_blocks_statef *s;
-{
-  return s->mode == LENS;
-}
diff --git a/src/gzip/infblock.h b/src/gzip/infblock.h
index ddd7a03..c2535a1 100644
--- a/src/gzip/infblock.h
+++ b/src/gzip/infblock.h
@@ -14,31 +14,23 @@
 struct inflate_blocks_state;
 typedef struct inflate_blocks_state FAR inflate_blocks_statef;
 
-extern inflate_blocks_statef * inflate_blocks_new OF((
+local  inflate_blocks_statef * inflate_blocks_new OF((
     z_streamp z,
     check_func c,               /* check function */
     uInt w));                   /* window size */
 
-extern int inflate_blocks OF((
+local  int inflate_blocks OF((
     inflate_blocks_statef *,
     z_streamp ,
     int));                      /* initial return code */
 
-extern void inflate_blocks_reset OF((
+local  void inflate_blocks_reset OF((
     inflate_blocks_statef *,
     z_streamp ,
     uLongf *));                  /* check value on output */
 
-extern int inflate_blocks_free OF((
+local  int inflate_blocks_free OF((
     inflate_blocks_statef *,
     z_streamp));
 
-extern void inflate_set_dictionary OF((
-    inflate_blocks_statef *s,
-    const Bytef *d,  /* dictionary */
-    uInt  n));       /* dictionary length */
-
-extern int inflate_blocks_sync_point OF((
-    inflate_blocks_statef *s));
-
 #endif /* _INFBLOCK_H */
diff --git a/src/gzip/infcodes.c b/src/gzip/infcodes.c
index 9f87f52..0347fc2 100644
--- a/src/gzip/infcodes.c
+++ b/src/gzip/infcodes.c
@@ -55,7 +55,7 @@ struct inflate_codes_state {
 };
 
 
-inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
+local inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
 uInt bl, bd;
 inflate_huft *tl;
 inflate_huft *td; /* need separate declaration for Borland C++ */
@@ -77,7 +77,7 @@ z_streamp z;
 }
 
 
-int inflate_codes(s, z, r)
+local int inflate_codes(s, z, r)
 inflate_blocks_statef *s;
 z_streamp z;
 int r;
@@ -241,7 +241,7 @@ int r;
 }
 
 
-void inflate_codes_free(c, z)
+local void inflate_codes_free(c, z)
 inflate_codes_statef *c;
 z_streamp z;
 {
diff --git a/src/gzip/infcodes.h b/src/gzip/infcodes.h
index 9b4fa32..154d7f8 100644
--- a/src/gzip/infcodes.h
+++ b/src/gzip/infcodes.h
@@ -14,17 +14,17 @@
 struct inflate_codes_state;
 typedef struct inflate_codes_state FAR inflate_codes_statef;
 
-extern inflate_codes_statef *inflate_codes_new OF((
+local inflate_codes_statef *inflate_codes_new OF((
     uInt, uInt,
     inflate_huft *, inflate_huft *,
     z_streamp ));
 
-extern int inflate_codes OF((
+local int inflate_codes OF((
     inflate_blocks_statef *,
     z_streamp ,
     int));
 
-extern void inflate_codes_free OF((
+local void inflate_codes_free OF((
     inflate_codes_statef *,
     z_streamp ));
 
diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c
index cc62554..72b01a9 100644
--- a/src/gzip/inflate.c
+++ b/src/gzip/inflate.c
@@ -136,14 +136,6 @@ int stream_size;
 }
 
 
-int ZEXPORT inflateInit_(z, version, stream_size)
-z_streamp z;
-const char *version;
-int stream_size;
-{
-  return inflateInit2_(z, DEF_WBITS, version, stream_size);
-}
-
 
 #undef  NEEDBYTE
 #define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
@@ -279,93 +271,3 @@ int f;
 #endif
 }
 
-
-int ZEXPORT inflateSetDictionary(z, dictionary, dictLength)
-z_streamp z;
-const Bytef *dictionary;
-uInt  dictLength;
-{
-  uInt length = dictLength;
-
-  if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0)
-    return Z_STREAM_ERROR;
-
-  if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR;
-  z->adler = 1L;
-
-  if (length >= ((uInt)1<<z->state->wbits))
-  {
-    length = (1<<z->state->wbits)-1;
-    dictionary += dictLength - length;
-  }
-  inflate_set_dictionary(z->state->blocks, dictionary, length);
-  z->state->mode = BLOCKS;
-  return Z_OK;
-}
-
-
-int ZEXPORT inflateSync(z)
-z_streamp z;
-{
-  uInt n;       /* number of bytes to look at */
-  Bytef *p;     /* pointer to bytes */
-  uInt m;       /* number of marker bytes found in a row */
-  uLong r, w;   /* temporaries to save total_in and total_out */
-
-  /* set up */
-  if (z == Z_NULL || z->state == Z_NULL)
-    return Z_STREAM_ERROR;
-  if (z->state->mode != BAD)
-  {
-    z->state->mode = BAD;
-    z->state->sub.marker = 0;
-  }
-  if ((n = z->avail_in) == 0)
-    return Z_BUF_ERROR;
-  p = z->next_in;
-  m = z->state->sub.marker;
-
-  /* search */
-  while (n && m < 4)
-  {
-    static const Byte mark[4] = {0, 0, 0xff, 0xff};
-    if (*p == mark[m])
-      m++;
-    else if (*p)
-      m = 0;
-    else
-      m = 4 - m;
-    p++, n--;
-  }
-
-  /* restore */
-  z->total_in += p - z->next_in;
-  z->next_in = p;
-  z->avail_in = n;
-  z->state->sub.marker = m;
-
-  /* return no joy or set up to restart on a new block */
-  if (m != 4)
-    return Z_DATA_ERROR;
-  r = z->total_in;  w = z->total_out;
-  inflateReset(z);
-  z->total_in = r;  z->total_out = w;
-  z->state->mode = BLOCKS;
-  return Z_OK;
-}
-
-
-/* Returns true if inflate is currently at the end of a block generated
- * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
- * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH
- * but removes the length bytes of the resulting empty stored block. When
- * decompressing, PPP checks that at the end of input packet, inflate is
- * waiting for these length bytes.
- */
-int ZEXPORT inflateSyncPoint(z)
-z_streamp z;
-{
-  if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
-    return Z_STREAM_ERROR;
-  return inflate_blocks_sync_point(z->state->blocks);
-}
diff --git a/src/gzip/inftrees.c b/src/gzip/inftrees.c
index d7946a8..ec57d39 100644
--- a/src/gzip/inftrees.c
+++ b/src/gzip/inftrees.c
@@ -10,7 +10,7 @@
 #  define BUILDFIXED   /* non ANSI compilers may not accept inffixed.h */
 #endif
 
-const char inflate_copyright[] =
+local const char inflate_copyright[] =
    " inflate 1.1.4 Copyright 1995-2002 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
@@ -212,7 +212,7 @@ uIntf *v;               /* working area: values in order of bit length */
 
         /* compute minimum size table less than or equal to l bits */
         z = g - w;
-        z = z > (uInt)l ? l : z;        /* table size upper limit */
+        z = z > (uInt)l ? (uInt)l : z;        /* table size upper limit */
         if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */
         {                       /* too few codes for k-w bit table */
           f -= a + 1;           /* deduct codes from patterns left */
@@ -289,7 +289,7 @@ uIntf *v;               /* working area: values in order of bit length */
 }
 
 
-int inflate_trees_bits(c, bb, tb, hp, z)
+local int inflate_trees_bits(c, bb, tb, hp, z)
 uIntf *c;               /* 19 code lengths */
 uIntf *bb;              /* bits tree desired/actual depth */
 inflate_huft * FAR *tb; /* bits tree result */
@@ -316,7 +316,7 @@ z_streamp z;            /* for messages */
 }
 
 
-int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
+local int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
 uInt nl;                /* number of literal/length codes */
 uInt nd;                /* number of distance codes */
 uIntf *c;               /* that many (total) code lengths */
@@ -394,7 +394,7 @@ local inflate_huft *fixed_td;
 #endif
 
 
-int inflate_trees_fixed(bl, bd, tl, td, z)
+local int inflate_trees_fixed(bl, bd, tl, td, z)
 uIntf *bl;               /* literal desired/actual bit depth */
 uIntf *bd;               /* distance desired/actual bit depth */
 inflate_huft * FAR *tl;  /* literal/length tree result */
diff --git a/src/gzip/inftrees.h b/src/gzip/inftrees.h
index 17cbd83..92d2f28 100644
--- a/src/gzip/inftrees.h
+++ b/src/gzip/inftrees.h
@@ -35,14 +35,14 @@ struct inflate_huft_s {
    value below is more than safe. */
 #define MANY 1440
 
-extern int inflate_trees_bits OF((
+local  int inflate_trees_bits OF((
     uIntf *,                    /* 19 code lengths */
     uIntf *,                    /* bits tree desired/actual depth */
     inflate_huft * FAR *,       /* bits tree result */
     inflate_huft *,             /* space for trees */
     z_streamp));                /* for messages */
 
-extern int inflate_trees_dynamic OF((
+local  int inflate_trees_dynamic OF((
     uInt,                       /* number of literal/length codes */
     uInt,                       /* number of distance codes */
     uIntf *,                    /* that many (total) code lengths */
@@ -53,7 +53,7 @@ extern int inflate_trees_dynamic OF((
     inflate_huft *,             /* space for trees */
     z_streamp));                /* for messages */
 
-extern int inflate_trees_fixed OF((
+local  int inflate_trees_fixed OF((
     uIntf *,                    /* literal desired/actual bit depth */
     uIntf *,                    /* distance desired/actual bit depth */
     inflate_huft * FAR *,       /* literal/length tree result */
diff --git a/src/gzip/infutil.c b/src/gzip/infutil.c
index 52f7c82..9a6b92f 100644
--- a/src/gzip/infutil.c
+++ b/src/gzip/infutil.c
@@ -11,7 +11,7 @@
 
 
 /* And'ing with mask[n] masks the lower n bits */
-uInt inflate_mask[17] = {
+local uInt inflate_mask[17] = {
     0x0000,
     0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
     0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -19,7 +19,7 @@ uInt inflate_mask[17] = {
 
 
 /* copy as much as possible from the sliding window to the output area */
-int inflate_flush(s, z, r)
+local int inflate_flush(s, z, r)
 inflate_blocks_statef *s;
 z_streamp z;
 int r;
diff --git a/src/gzip/infutil.h b/src/gzip/infutil.h
index de4e773..820dcd3 100644
--- a/src/gzip/infutil.h
+++ b/src/gzip/infutil.h
@@ -85,10 +85,10 @@ struct inflate_blocks_state {
 #define LOAD {LOADIN LOADOUT}
 
 /* masks for lower bits (size given to avoid silly warnings with Visual C++) */
-extern uInt inflate_mask[17];
+local uInt inflate_mask[17];
 
 /* copy as much as possible from the sliding window to the output area */
-extern int inflate_flush OF((
+local int inflate_flush OF((
     inflate_blocks_statef *,
     z_streamp ,
     int));
diff --git a/src/gzip/zconf.h b/src/gzip/zconf.h
index eb0ae2e..2e66fb3 100644
--- a/src/gzip/zconf.h
+++ b/src/gzip/zconf.h
@@ -1,6 +1,6 @@
 /* zconf.h -- configuration of the zlib compression library
  * Copyright (C) 1995-2002 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h 
+ * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
 /* @(#) $Id$ */
@@ -188,13 +188,6 @@
 #  endif
 #endif
 
-#if defined (__BEOS__)
-#  if defined (ZLIB_DLL)
-#    define ZEXTERN extern __declspec(dllexport)
-#  else
-#    define ZEXTERN extern __declspec(dllimport)
-#  endif
-#endif
 
 #ifndef ZEXPORT
 #  define ZEXPORT
@@ -203,7 +196,10 @@
 #  define ZEXPORTVA
 #endif
 #ifndef ZEXTERN
-#  define ZEXTERN extern
+#  define ZEXTERN static
+#endif
+#ifndef ZEXTERNDEF
+#  define ZEXTERNDEF  static
 #endif
 
 #ifndef FAR
diff --git a/src/gzip/zlib.h b/src/gzip/zlib.h
index a2814cf..e0c899b 100644
--- a/src/gzip/zlib.h
+++ b/src/gzip/zlib.h
@@ -163,12 +163,9 @@ typedef z_stream FAR *z_streamp;
 
 #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
 
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
 
                         /* basic functions */
 
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
 /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
    If the first character differs, the library code actually used is
    not compatible with the zlib.h header file used by the application.
@@ -198,7 +195,6 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
 */
 
 
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
 /*
     deflate compresses as much data as possible, and stops when the input
   buffer becomes empty or the output buffer becomes full. It may introduce some
@@ -276,7 +272,6 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
 */
 
 
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
 /*
      All dynamically allocated data structures for this stream are freed.
    This function discards any unprocessed input and does not flush any
@@ -441,9 +436,6 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
    not perform any compression: this will be done by deflate().
 */
 
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
-                                             const Bytef *dictionary,
-                                             uInt  dictLength));
 /*
      Initializes the compression dictionary from the given byte sequence
    without producing any compressed output. This function must be called
@@ -477,8 +469,6 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
    perform any compression: this will be done by deflate().
 */
 
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
-                                    z_streamp source));
 /*
      Sets the destination stream as a complete copy of the source stream.
 
@@ -495,7 +485,6 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
    destination.
 */
 
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
 /*
      This function is equivalent to deflateEnd followed by deflateInit,
    but does not free and reallocate all the internal compression state.
@@ -506,9 +495,6 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
    stream state was inconsistent (such as zalloc or state being NULL).
 */
 
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
-				      int level,
-				      int strategy));
 /*
      Dynamically update the compression level and compression strategy.  The
    interpretation of level and strategy is as in deflateInit2.  This can be
@@ -550,9 +536,6 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
    modified, but next_out and avail_out are unchanged.)
 */
 
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
-                                             const Bytef *dictionary,
-                                             uInt  dictLength));
 /*
      Initializes the decompression dictionary from the given uncompressed byte
    sequence. This function must be called immediately after a call of inflate
@@ -569,7 +552,6 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
    inflate().
 */
 
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
 /*
     Skips invalid compressed data until a full flush point (see above the
   description of deflate with Z_FULL_FLUSH) can be found, or until all
@@ -605,8 +587,6 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
    utility functions can easily be modified if you need special options.
 */
 
-ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
-                                 const Bytef *source, uLong sourceLen));
 /*
      Compresses the source buffer into the destination buffer.  sourceLen is
    the byte length of the source buffer. Upon entry, destLen is the total
@@ -620,9 +600,6 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
    buffer.
 */
 
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
-                                  const Bytef *source, uLong sourceLen,
-                                  int level));
 /*
      Compresses the source buffer into the destination buffer. The level
    parameter has the same meaning as in deflateInit.  sourceLen is the byte
@@ -635,8 +612,6 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
    Z_STREAM_ERROR if the level parameter is invalid.
 */
 
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
-                                   const Bytef *source, uLong sourceLen));
 /*
      Decompresses the source buffer into the destination buffer.  sourceLen is
    the byte length of the source buffer. Upon entry, destLen is the total
@@ -654,9 +629,6 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
 */
 
 
-typedef voidp gzFile;
-
-ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
 /*
      Opens a gzip (.gz) file for reading or writing. The mode parameter
    is as in fopen ("rb" or "wb") but can also include a compression level
@@ -672,7 +644,6 @@ ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
    can be checked to distinguish the two cases (if errno is zero, the
    zlib error is Z_MEM_ERROR).  */
 
-ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
 /*
      gzdopen() associates a gzFile with the file descriptor fd.  File
    descriptors are obtained from calls like open, dup, creat, pipe or
@@ -685,7 +656,6 @@ ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
    the (de)compression state.
 */
 
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
 /*
      Dynamically update the compression level or strategy. See the description
    of deflateInit2 for the meaning of these parameters.
@@ -693,7 +663,6 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
    opened for writing.
 */
 
-ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
 /*
      Reads the given number of uncompressed bytes from the compressed file.
    If the input file was not in gzip format, gzread copies the given number
@@ -701,29 +670,24 @@ ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
      gzread returns the number of uncompressed bytes actually read (0 for
    end of file, -1 for error). */
 
-ZEXTERN int ZEXPORT    gzwrite OF((gzFile file,
-				   const voidp buf, unsigned len));
 /*
      Writes the given number of uncompressed bytes into the compressed file.
    gzwrite returns the number of uncompressed bytes actually written
    (0 in case of error).
 */
 
-ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
 /*
      Converts, formats, and writes the args to the compressed file under
    control of the format string, as in fprintf. gzprintf returns the number of
    uncompressed bytes actually written (0 in case of error).
 */
 
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
 /*
       Writes the given null-terminated string to the compressed file, excluding
    the terminating null character.
       gzputs returns the number of characters written, or -1 in case of error.
 */
 
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
 /*
       Reads bytes from the compressed file until len-1 characters are read, or
    a newline character is read and transferred to buf, or an end-of-file
@@ -732,19 +696,16 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
       gzgets returns buf, or Z_NULL in case of error.
 */
 
-ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
 /*
       Writes c, converted to an unsigned char, into the compressed file.
    gzputc returns the value that was written, or -1 in case of error.
 */
 
-ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
 /*
       Reads one byte from the compressed file. gzgetc returns this byte
    or -1 in case of end of file or error.
 */
 
-ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
 /*
      Flushes all pending output into the compressed file. The parameter
    flush is as in the deflate() function. The return value is the zlib
@@ -754,8 +715,6 @@ ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
    degrade compression.
 */
 
-ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
-				      z_off_t offset, int whence));
 /*
       Sets the starting position for the next gzread or gzwrite on the
    given compressed file. The offset represents a number of bytes in the
@@ -772,14 +731,12 @@ ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
    would be before the current position.
 */
 
-ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
 /*
      Rewinds the given file. This function is supported only for reading.
 
    gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
 */
 
-ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
 /*
      Returns the starting position for the next gzread or gzwrite on the
    given compressed file. This position represents a number of bytes in the
@@ -788,20 +745,17 @@ ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
    gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
 */
 
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
 /*
      Returns 1 when EOF has previously been detected reading the given
    input stream, otherwise zero.
 */
 
-ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
 /*
      Flushes all pending output if necessary, closes the compressed file
    and deallocates all the (de)compression state. The return value is the zlib
    error number (see function gzerror below).
 */
 
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
 /*
      Returns the error message for the last error which occurred on the
    given compressed file. errnum is set to zlib error number. If an
@@ -835,7 +789,6 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
      if (adler != original_adler) error();
 */
 
-ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
 /*
      Update a running crc with the bytes buf[0..len-1] and return the updated
    crc. If buf is NULL, this function returns the required initial value
@@ -857,14 +810,6 @@ ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
 /* deflateInit and inflateInit are macros to allow checking the zlib version
  * and the compiler's view of z_stream:
  */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
-                                     const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
-                                     const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
-                                      int windowBits, int memLevel,
-                                      int strategy, const char *version,
-                                      int stream_size));
 ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
                                       const char *version, int stream_size));
 #define deflateInit(strm, level) \
@@ -878,10 +823,6 @@ ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
         inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
 
 
-ZEXTERN const char   * ZEXPORT zError           OF((int err));
-ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
-ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gzip/zutil.c b/src/gzip/zutil.c
index 6e0eb23..5da9f98 100644
--- a/src/gzip/zutil.c
+++ b/src/gzip/zutil.c
@@ -11,48 +11,6 @@
 extern void exit OF((int));
 #endif
 
-const char *z_errmsg[10] = {
-"need dictionary",     /* Z_NEED_DICT       2  */
-"stream end",          /* Z_STREAM_END      1  */
-"",                    /* Z_OK              0  */
-"file error",          /* Z_ERRNO         (-1) */
-"stream error",        /* Z_STREAM_ERROR  (-2) */
-"data error",          /* Z_DATA_ERROR    (-3) */
-"insufficient memory", /* Z_MEM_ERROR     (-4) */
-"buffer error",        /* Z_BUF_ERROR     (-5) */
-"incompatible version",/* Z_VERSION_ERROR (-6) */
-""};
-
-
-const char * ZEXPORT zlibVersion()
-{
-    return ZLIB_VERSION;
-}
-
-#ifdef DEBUG
-
-#  ifndef verbose
-#    define verbose 0
-#  endif
-int z_verbose = verbose;
-
-void z_error (m)
-    char *m;
-{
-    fprintf(stderr, "%s\n", m);
-    exit(1);
-}
-#endif
-
-/* exported to allow conversion of error code to string for compress() and
- * uncompress()
- */
-const char * ZEXPORT zError(err)
-    int err;
-{
-    return ERR_MSG(err);
-}
-
 
 #ifndef HAVE_MEMCPY
 
diff --git a/src/gzip/zutil.h b/src/gzip/zutil.h
index 718ebc1..2210515 100644
--- a/src/gzip/zutil.h
+++ b/src/gzip/zutil.h
@@ -37,10 +37,6 @@ typedef unsigned short ush;
 typedef ush FAR ushf;
 typedef unsigned long  ulg;
 
-extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
-/* (size given to avoid silly warnings with Visual C++) */
-
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
 
 #define ERR_RETURN(strm,err) \
   return (strm->msg = (char*)ERR_MSG(err), (err))
@@ -176,7 +172,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
 #    define zmemcmp _fmemcmp
 #    define zmemzero(dest, len) _fmemset(dest, 0, len)
 #  else
-#    define zmemcpy memcpy
+#    define zmemcpy ft_memcpy
 #    define zmemcmp memcmp
 #    define zmemzero(dest, len) memset(dest, 0, len)
 #  endif
@@ -209,8 +205,8 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
 
 typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
 				       uInt len));
-voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
-void   zcfree  OF((voidpf opaque, voidpf ptr));
+local voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+local void   zcfree  OF((voidpf opaque, voidpf ptr));
 
 #define ZALLOC(strm, items, size) \
            (*((strm)->zalloc))((strm)->opaque, (items), (size))
diff --git a/src/pcf/Jamfile b/src/pcf/Jamfile
index 8625fa1..fd77625 100644
--- a/src/pcf/Jamfile
+++ b/src/pcf/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/pcf Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src pcf ;
-
-SubDirHdrs  [ FT2_SubDir  src pcf ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) pcf ;
 
 {
   local  _sources ;
diff --git a/src/pfr/Jamfile b/src/pfr/Jamfile
index 73ffe4b..3ba0ee9 100644
--- a/src/pfr/Jamfile
+++ b/src/pfr/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/pfr Jamfile (c) 2002 David Turner
 #
 
-SubDir  FT2_TOP src pfr ;
-
-SubDirHdrs  [ FT2_SubDir  src pfr ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) pfr ;
 
 {
   local  _sources ;
diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c
index c0697f5..07ba9b4 100644
--- a/src/pfr/pfrdrivr.c
+++ b/src/pfr/pfrdrivr.c
@@ -83,7 +83,6 @@
                    FT_Fixed  *ametrics_x_scale,
                    FT_Fixed  *ametrics_y_scale )
   {
-    FT_Error     error = 0;
     PFR_PhyFont  phys  = &face->phy_font;
     FT_Fixed     x_scale, y_scale;
     FT_Size      size = face->root.size;
@@ -111,6 +110,8 @@
 
     if ( ametrics_y_scale )
       *ametrics_y_scale = y_scale;
+
+    return 0;
   }
 
 
diff --git a/src/pfr/pfrload.c b/src/pfr/pfrload.c
index bd4d2a9..0cb32f4 100644
--- a/src/pfr/pfrload.c
+++ b/src/pfr/pfrload.c
@@ -860,7 +860,7 @@
 
         cur->advance   = ( flags & PFR_PHY_PROPORTIONAL )
                          ? PFR_NEXT_SHORT( p )
-                         : phy_font->standard_advance;
+                         : (FT_Int) phy_font->standard_advance;
 
 #if 0
         cur->ascii     = ( flags & PFR_PHY_ASCII_CODE )
diff --git a/src/psaux/Jamfile b/src/psaux/Jamfile
index e316069..fc834b3 100644
--- a/src/psaux/Jamfile
+++ b/src/psaux/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/psaux Jamfile (c) 2001, 2002 David Turner
 #
 
-SubDir  FT2_TOP src psaux ;
-
-SubDirHdrs  [ FT2_SubDir  src psaux ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) psaux ;
 
 {
   local  _sources ;
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index f1cea1e..6035950 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -174,7 +174,11 @@
         in_offset = -1;
 
       while ( new_size < table->cursor + length )
-        new_size += 1024;
+      {
+        /* increase size by 25% and round up to the nearest multiple of 1024 */
+        new_size += (new_size >> 2) + 1;
+        new_size  = ( new_size + 1023 ) & -1024;
+      }
 
       error = reallocate_t1_table( table, new_size );
       if ( error )
diff --git a/src/pshinter/Jamfile b/src/pshinter/Jamfile
index 9e40038..8eb3dea 100644
--- a/src/pshinter/Jamfile
+++ b/src/pshinter/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/pshinter Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src pshinter ;
-
-SubDirHdrs  [ FT2_SubDir  src pshinter ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) pshinter ;
 
 {
   local  _sources ;
diff --git a/src/psnames/Jamfile b/src/psnames/Jamfile
index e9e22ea..e75ae1e 100644
--- a/src/psnames/Jamfile
+++ b/src/psnames/Jamfile
@@ -1,13 +1,11 @@
 # FreeType 2 src/psnames Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src psnames ;
-
-SubDirHdrs  [ FT2_SubDir  src psnames ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) psnames ;
 
 {
   local  _sources ;
-  
+
   if $(FT2_MULTI)
   {
     _sources = psmodule ;
@@ -16,7 +14,7 @@ SubDirHdrs  [ FT2_SubDir  src psnames ] ;
   {
     _sources = psnames ;
   }
-  
+
   Library  $(FT2_LIB) : $(_sources).c ;
 }
 
diff --git a/src/raster/Jamfile b/src/raster/Jamfile
index 6c75e0d..01b5c0d 100644
--- a/src/raster/Jamfile
+++ b/src/raster/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/raster Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src raster ;
-
-SubDirHdrs  [ FT2_SubDir  src raster ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) raster ;
 
 {
   local  _sources ;
diff --git a/src/sfnt/Jamfile b/src/sfnt/Jamfile
index d7722e3..adddfb6 100644
--- a/src/sfnt/Jamfile
+++ b/src/sfnt/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/sfnt Jamfile (c) 2001, 2002 David Turner
 #
 
-SubDir  FT2_TOP src sfnt ;
-
-SubDirHdrs  [ FT2_SubDir  src sfnt ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) sfnt ;
 
 {
   local  _sources ;
diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c
index 93a7ddf..4053345 100644
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -1708,8 +1708,8 @@
   {
     FT_Byte*           table = face->cmap_table;
     FT_Byte*           limit = table + face->cmap_size;
-    volatile FT_UInt   num_cmaps;
-    volatile FT_Byte*  p     = table;
+    FT_UInt volatile   num_cmaps;
+    FT_Byte* volatile  p     = table;
 
 
     if ( p + 4 > limit )
@@ -1742,7 +1742,7 @@
       {
         FT_Byte*                       cmap   = table + offset;
         FT_UInt                        format = TT_PEEK_USHORT( cmap );
-        volatile const TT_CMap_Class*  pclazz = tt_cmap_classes;
+        const TT_CMap_Class* volatile  pclazz = tt_cmap_classes;
         TT_CMap_Class                  clazz;
 
 
diff --git a/src/smooth/Jamfile b/src/smooth/Jamfile
index 709c856..5ab9b60 100644
--- a/src/smooth/Jamfile
+++ b/src/smooth/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/smooth Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src smooth ;
-
-SubDirHdrs  [ FT2_SubDir  src smooth ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) smooth ;
 
 {
   local  _sources ;
diff --git a/src/truetype/Jamfile b/src/truetype/Jamfile
index 4d7a312..f847f6f 100644
--- a/src/truetype/Jamfile
+++ b/src/truetype/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/truetype Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src truetype ;
-
-SubDirHdrs  [ FT2_SubDir  src truetype ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) truetype ;
 
 {
   local  _sources ;
diff --git a/src/type1/Jamfile b/src/type1/Jamfile
index 1cbb78d..4d966f3 100644
--- a/src/type1/Jamfile
+++ b/src/type1/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/type1 Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src type1 ;
-
-SubDirHdrs  [ FT2_SubDir  src type1 ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) type1 ;
 
 {
   local  _sources ;
diff --git a/src/type42/Jamfile b/src/type42/Jamfile
index e133e6d..032ac71 100644
--- a/src/type42/Jamfile
+++ b/src/type42/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/type42 Jamfile (c) 2002 David Turner
 #
 
-SubDir  FT2_TOP src type42 ;
-
-SubDirHdrs  [ FT2_SubDir  src type42 ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) type42 ;
 
 {
   local  _sources ;
diff --git a/src/winfonts/Jamfile b/src/winfonts/Jamfile
index c45e107..a903f89 100644
--- a/src/winfonts/Jamfile
+++ b/src/winfonts/Jamfile
@@ -1,9 +1,7 @@
 # FreeType 2 src/winfonts Jamfile (c) 2001 David Turner
 #
 
-SubDir  FT2_TOP src winfonts ;
-
-SubDirHdrs  [ FT2_SubDir  src winfonts ] ;
+SubDir  FT2_TOP $(FT2_SRC_DIR) winfonts ;
 
 Library  $(FT2_LIB) : winfnt.c ;