Commit 66cbc209785593cc6080389fac3f0ae5f7b46b6b

David Turner 2003-03-20T07:04:40

* docs/*: serious rewriting of the documentation * include/freetype/internal/ftobjs.h, src/base/ftobjs.c, src/bdf/bdfdrivr.c, src/pcf/pcfdriver.c, src/pfr/pfrsbit.c, src/sfnt/ttsbit.c, src/type42/t42objs.c, src/winfonts/winfnt.c: introduced three new functions to deal with glyph bitmaps within FT_GlyphSlot objects. these are: ft_glyphslot_free_bitmap ft_glyphslot_alloc_bitmap ft_glyphslot_set_bitmap these are much more convenient to use than managing the FT_GLYPH_OWN_BITMAP flag manually. the font drivers have been modified to use them as well. * src/cache/ftlru.c: fixed an invalid assertion check

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
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
diff --git a/ChangeLog b/ChangeLog
index f8c12ae..f2e130b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-20  David Turner  <david@freetype.org>
+
+    * docs/*: serious rewriting of the documentation
+
+
 2003-03-15  David Turner  <david@freetype.org>
 
     * src/truetyoe/ttdriver.c (Set_Char_Sizes): fixed a small rounding bug.
diff --git a/Jamfile b/Jamfile
index 2ba53bd..3ba645f 100644
--- a/Jamfile
+++ b/Jamfile
@@ -103,10 +103,9 @@ if $(DEBUG_HINTER)
 HDRS += $(FT2_INCLUDE) ;
 
 
-#SubDirHdr += $(FT2_INCLUDE) ;
-
 # Uncomment the following line if you want to build individual source files
-# for each FreeType 2 module.
+# for each FreeType 2 module. this is only useful during development, and
+# is better defined as an environment variable anyway !
 #
 # FT2_MULTI = true ;
 
diff --git a/docs/BUGS b/docs/BUGS
deleted file mode 100644
index bb68c68..0000000
--- a/docs/BUGS
+++ /dev/null
@@ -1,275 +0,0 @@
-List of known FreeType 2 Bugs
------------------------------
-
-"Identifier" is a string to uniquely identify the bug.  A more detailed
-description of the bug is found below the table of opened bugs.
-
-"Date" is the date when the bug was first reported or entered in this
-document.  Dates are in _European_ format, i.e day/month/year.
-
-"Opened By" is the name of the person who first spotted the bug.  Note that
-we can use abbreviations here, like:
-
-  "David" for David Turner
-  "Werner" for Werner Lemberg
-  etc.
-
-"Reproduceable" indicates whether the bug could be reproduced by the
-development team or not (it can be specific to a given platform), whether it
-always happens, or only sporadically, etc.
-
-
-
-I. Open bugs
-============
-
-
-Identifier                 Date       Opened by                Reproduceable
-------------------------------------------------------------------------------
-NO-CID-CMAPS            13-09-2001     David                     always
-BAD-TT-RENDERING        12-09-2001     Paul Pedriana             ?
-BAD-THIN-LINES          13-09-2001     David                     ?
-NOT-WINDOWS-METRICS     07-10-2001     David                     always
-ADVANCED-COMPOSITES     25-10-2001     George Williams           always
-
---------------------END-OF-OPENED-BUGS-TABLE----------------------------------
-
-
-
-II. Closed bugs
-===============
-
-
-Identifier                Date         Closed by                Closure date
-------------------------------------------------------------------------------
-BAD-TTNAMEID.H          12-09-2001     Antoine                   N/A
-BAD-T1-CHARMAP          15-06-2001     David                     2.0.5
-BAD-UNIXXXX-NAMES       30-07-2001     David                     2.0.5
-GLYPH_TO_BITMAP-BUG     05-12-2001     David                     05-12-2001
-AUTOHINT-NO-SBITS       13-09-2001     David                     2.0.6
-TT-GLYPH-CRASH          01-01-2002     David                     2.0.6
-T1-FONT-CRASH           01-01-2002     David                     2.0.6
-BAD-ADVANCES            30-11-2001     David                     2.0.6
-GLYPH-TO-BITMAP-BUG     15-12-2001     David                     2.0.6
---------------------END-OF-CLOSED-BUGS-TABLE----------------------------------
-
-
-
-III. Bug descriptions
-=====================
-
-
---- START OF OPEN BUGS ---
-
-
-NO-CID-CMAPS
-
-  Not exactly a bug, but the CFF font driver doesn't build a Unicode charmap
-  from the contents of font files, which prevents efficiently using fonts in
-  this format.
-
-
-
-BAD-TT-RENDERING
-
-  According to Paul Pedriana <PPedriana@maxis.com>, there is a rather
-  important difference between the rendering of TrueType-hinted glyphs of
-  current FT2 and old betas.
-
-  Tests and comparisons show a _major_ discrepancy of monochrome truetype
-  bytecode-hinted glyphs!  Something seems to be really broken here!
-
-  Some of this has been fixed in 2.0.6; there was a bug in the TrueType
-  loader that prevented it from loading composites correctly.  However,
-  there are still _subtle_ differences between FT1 and FT2 when it comes to
-  monochrome TrueType-hinted glyphs (the major differences are gone though).
-
-
-
-BAD-THIN-LINES
-
-  It seems that the anti-aliased renderer in FreeType has problems rendering
-  extremely thin straight lines correctly, at least when using the
-  FT_Outline_Render() function.
-
-
-
-NOT-WINDOWS-METRICS
-
-  FreeType doesn't always return the same metrics as Windows for ascender,
-  descender, and text height, depending on character pixel sizes.  A lot of
-  testing on Windows is needed to debug this properly.  It might be due to a
-  rounding bug when computing the "x_scale" and "y_scale" values.
-
-
-
-ADVANCED-COMPOSITES
-
-  Provided by George Williams <pfaedit@users.sourceforge.net>:
-
-    I notice that truetype/ttgload.c only supports Apple's definition of
-    offsets for composite glyphs.  Apple and Microsoft behave differently if
-    there is a scale factor.  OpenType defines some bits to disambiguate.
-    
-    (A problem in both 2.0.4 and 2.0.5.)
-    
-    Apple says (http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html) that if
-    flags&ARGS_ARE_XY is set then the offsets should be scaled by the scale
-    factors (as you have done), but they also say something very cryptic
-    about what happens when the component is rotated at 45° (which you do
-    not support) -- See the "Important" note at the bottom.
-    
-    The old truetype spec from Microsoft did not mention this.  The OpenType
-    spec (http://www.microsoft.com/typography/otspec/glyf.htm,
-    http://partners.adobe.com/asn/developer/opentype/glyf.html) defines two
-    new bits to disambiguate:
-
-      SCALED_COMPONENT_OFFSET 11 
-      Composite designed to have the component offset scaled (designed for
-      Apple rasterizer)
-
-      UNSCALED_COMPONENT_OFFSET 12 
-      Composite designed not to have the component offset scaled (designed
-      for the Microsoft TrueType rasterizer)
-    
-    Perhaps you could add a load_flag to allow the user to define the
-    default setting?
-
-  David says:
-  
-    Wow, I was not even aware of this, it will probably take a little time
-    to implement since I don't have any font that implement these
-    "features", and also because I believe that we're running out of bits
-    for "load_flag", some other way to set preferences is probably needed.
-
-
-
---- END OF OPEN BUGS ---
-
-
-
-BAD-TTNAMEID.H
-
-  The file "ttnameid.h" contains various constant macro definitions
-  corresponding to important values defined by the TrueType specification.
-
-  Joe Man <trmetal@yahoo.com.hk> reports that:
-
-    According to the information from TrueType v1.66:
-
-      Platform ID = 3 (Microsoft)
-      the Encoding ID of GB2312 = 4
-      the Encoding ID of big5 = 3
-
-    However, I have found that in ttnameid.h:
-
-      TT_MS_ID_GB2312 = 3
-      TT_MS_ID_BIG_5 = 4
-
-    Which one is correct?
-
-  Antoine replied that this was a bug in the TT 1.66 specification, and that
-  FreeType followed the most recent TrueType/OpenType specification here.
-
-
-
-AUTOHINT-SBITS
-
-  When trying to load a glyph, with the auto-hinter activated (i.e., when
-  using FT_LOAD_FORCE_AUTOHINT, or when the font driver doesn't provide its
-  own hinter), embedded bitmaps are _never_ loaded, unlike the default
-  behaviour described by the API specification.
-
-  This seems to be a bug in FT_Load_Glyph(), but there is no way to solve it
-  efficiently without making a few important internal changes to the
-  library's design (more importantly, to the font driver interface).
-
-  This has been corrected with a hack in FT_Load_Glyph().  More important
-  internal changes should help get rid of it with a clean solution in a
-  further release like FreeType 2.1.
-
-
-
-BAD-T1-CHARMAP
-
-  Type1 driver doesn't read "cacute" and "lslash" characters from iso8859-2
-  charset.  Those characters are mapped as MAC-one in glnames.py, so they
-  cannot be shown in Adobe Type1 fonts.
-
-  (This was due to a bug in the "glnames.py" script used to generate the
-  table of glyph names in 'src/psaux/pstables.h'.)
-
-
-
-BAD-UNIXXXX-NAMES
-
-  Glyph names like uniXXXX are not recognized as they should be.  It seems
-  that code in psmodule.c for uniXXXX glyph names was never tested.  The
-  patch is very simple.
-  
-  (A simple bug that was left un-noticed due to the fact that I don't have
-  any Postscript font that use this convention, unfortunately.)
-
-
-
-GLYPH_TO_BITMAP-BUG
-
-  Calling FT_Glyph_To_Bitmap() sometimes modifies the original glyph
-  outline, creating weird alignment artefacts.
-  
-  This subtle bug was really in the file `src/smooth/ftsmooth.c'. 
-  Basically, the outline was shifted before rendering it into a new bitmap
-  buffer.  However, it wasn't properly un-shifted after that operation.
-
-  This was only noticeable with certain glyphs or certain fonts; it crept in
-  a long time ago.
-                  
-  The same bug has been fixed in src/raster/ftrender1.c also.
-                  
-
-
-TT-GLYPH-CRASH
-
-  The library crashed when trying to load certain glyphs from an
-  automatically generated TrueType file (tt1095m_.ttf submitted by Scott
-  Long).
-  
-  It turned out that the font contained invalid glyph data (i.e. was
-  broken), but the TrueType glyph loader in FreeType wasn't paranoid enough,
-  which resulted in nasty memory overwrites all over the place.
-
-
-
-T1-FONT-CRASH
-
-  The library crashed when trying to load the "Stalingrad Regular" face from
-  the "sadn.pfb" font file provided by Anthony Fok (and the Gnome-Print team
-  I believe).
-  
-  This was due to the fact that the font missed a full font name entry,
-  though boasted a family name and postscript name.  The Type 1 face loader
-  didn't check for these pathetic cases and seg-faulted.
-
-
-
-BAD-ADVANCES
-
-  All scalable font drivers returned un-fitted glyph advances when
-  FT_LOAD_DEFAULT was used, which was incorrect.  This problem was pretty
-  old but hadn't been spotted because all test programs actually explicitly
-  or implicitly (i.e. through the cache) rounded the advance widths of
-  glyphs.
-  
-  This resulted in poor rendering of a number of client applications however
-  (it is strange to see they took so long to notify the FreeType team).
-
-
-
-GLYPH-TO-BITMAP-BUG
-
-  FT_Glyph_To_Bitmap() did incorrectly modify the source glyph in certain
-  cases, which resulted in random behaviour and bad text rendering.  This
-  was spotted to bugs in both the monochrome and smooth rasterizer.
-
-
-=== end of file ===
diff --git a/docs/BUILD b/docs/BUILD
deleted file mode 100644
index b257c4a..0000000
--- a/docs/BUILD
+++ /dev/null
@@ -1,276 +0,0 @@
-
-                    FreeType 2 compilation how-to
-                    =============================
-
-
-Introduction
-------------
-
-Welcome  to the  FreeType 2  library.   You'll find  in this  document
-instructions on how to compile the library on your favorite platform.
-
-
-I. QUICK COMMAND-LINE GUIDE
----------------------------
-
-  THE FOLLOWING WILL  ONLY WORK WITH GNU MAKE,  IT WILL FAIL MISERABLY
-  WITH OTHER MAKE TOOLS, FOR EXAMPLE "BSD MAKE".
-
-  Install GNU Make  (version 3.78.1 or newer), then  try the following
-  on Unix or Cygwin:
-
-      ./configure <youroptions>  // this will setup the build
-      make                       // this will build the library
-
-  or even:
-
-      make setup unix
-      make
-
-  On Win32 + Visual C++:
-
-      make setup visualc    // setup the build for VisualC++ on Win32
-      make                  // build the library
-
-  Then, go to the `demos' directory and type
-
-      make
-
-
-
-  If this doesn't work, read the following.
-
-
-II. COMMAND-LINE COMPILATION
-----------------------------
-
-  Note that  if you do not want  to compile FreeType 2  from a command
-  line shell, please skip to section III below (DETAILED COMPILATION).
-
-  FreeType 2 includes a powerful and flexible build system that allows
-  you to  easily compile it on  a great variety of  platforms from the
-  command line.  To do so, just follow these simple instructions:
-
-  a. Install GNU Make
-
-    Because  GNU Make  is  the  only Make  tool  supported to  compile
-    FreeType 2, you should install it on your machine.
-
-    The FreeType 2 build system relies on many features special to GNU
-    Make -- trying to build the  library with any other Make tool will
-    *fail*.
-
-    NEARLY ALL OTHER MAKE TOOLS WILL FAIL, INCLUDING "BSD MAKE", SO
-    REALLY INSTALL A RECENT VERSION OF GNU MAKE ON YOUR SYSTEM!
-
-    Make sure that you are invoking GNU Make from the command line, by
-    typing something like:
-
-        make -v
-
-    to display its version number.
-
-    VERSION 3.78.1 OR NEWER IS NEEDED!
-
-  b. Invoke `make'
-
-    Go to  the root  directory of FreeType  2, then simply  invoke GNU
-    Make from the command line.   This will launch the FreeType 2 host
-    platform  detection routines.   A summary  will be  displayed, for
-    example, on Win32:
-
-
-        ==============================================================
-        FreeType build system -- automatic system detection
-
-        The following settings are used:
-
-          platform                     win32
-          compiler                     gcc
-          configuration directory      ./builds/win32
-          configuration rules          ./builds/win32/w32-gcc.mk
-
-        If this does not correspond to your system or settings please
-        remove the file 'config.mk' from this directory then read the
-        INSTALL file for help.
-
-        Otherwise, simply type 'make' again to build the library.
-        =============================================================
-
-
-    If the detected settings correspond to your platform and compiler,
-    skip to step e.  Note that if your platform is completely alien to
-    the build system, the detected platform will be `ansi'.
-
-
-  c. Configure the build system for a different compiler
-
-    If the build system correctly detected your platform, but you want
-    to use a different compiler  than the one specified in the summary
-    (for most platforms, gcc is  the defaut compiler), invoke GNU Make
-    with
-
-         make setup <compiler>
-
-    For example:
-
-        to use Visual C++ on Win32, type: "make setup visualc"
-        to use LCC-Win32 on Win32, type:  "make setup lcc"
-        to use Cygwin on Win32, type      "make setup unix"
-
-    The  <compiler> name to  use is  platform-dependent.  The  list of
-    available  compilers for  your  system is  available  in the  file
-    `builds/<system>/detect.mk' (note  that we  hope to make  the list
-    displayed at user demand in the final release).
-
-    If you  are satisfied  by the new  configuration summary,  skip to
-    step e.
-
-  d. Configure the build system for an unknown platform/compiler
-
-    The auto-detection/setup  phase of the build system  copies a file
-    to the current directory under the name `config.mk'.
-
-    For    example,    on    OS/2+gcc,    it   would    simply    copy
-    `builds/os2/os2-gcc.mk' to `./config.mk'.
-
-    If for  some reason your  platform isn't correctly  detected, copy
-    manually the configuration sub-makefile to `./config.mk' and go to
-    step e.
-
-    Note  that  this file  is  a  sub-Makefile  used to  specify  Make
-    variables  for compiler  and linker  invocation during  the build.
-    You can  easily create your own  version from one  of the existing
-    configuration files,  then copy it to the  current directory under
-    the name `./config.mk'.
-
-  e. Build the library
-
-    The auto-detection/setup  phase should have  copied a file  in the
-    current  directory,  called   `./config.mk'.  This  file  contains
-    definitions of various Make  variables used to invoke the compiler
-    and linker during the build.
-
-    To  launch  the build,  simply  invoke  GNU  Make again:  The  top
-    Makefile will detect the configuration file and run the build with
-    it.
-
-  f. Build the demonstration programs
-
-
-III. DETAILED COMPILATION PROCEDURE
------------------------------------
-
-  If you don't  want to compile FreeType 2  from the command-line (for
-  example if  you use a graphical IDE  on a Mac or  Windows), you will
-  need to understand how the FreeType files are organized.
-
-  FreeType 2  has a  very modular  design, and it  is made  of several
-  components.  Each component must be compiled as a stand-alone object
-  file, even  if it  is really  made of several  C source  files.  For
-  example,  the `base  layer' component  is  made of  the following  C
-  files:
-
-    src/
-      base/
-        ftcalc.c    - computations
-        ftextend.c  - extensions support
-        ftlist.c    - simple list management
-        ftobjs.c    - object management
-        ftoutln.c   - simple outline processing
-        ftstream.c  - stream input
-
-  However, you can  create a single object file  by compiling the file
-  `src/base/ftbase.c', which basically contains
-
-      #include "ftcalc.c"
-      #include "ftobjs.c"
-      #include "ftstream.c"
-      #include "ftlist.c"
-      #include "ftoutln.c"
-      #include "ftextend.c"
-
-  Similarly, each component has a single `englobing' C file to compile
-  it as a stand-alone object:
-
-    src/autohint/autohint.c   - the autohinting module
-    src/base/ftbase.c         - the base layer, high-level interface
-    src/cache/ftcache.c       - a glyph and image caching system
-                                (still experimental)
-    src/cff/cff.c             - the OpenType font driver
-    src/cid/type1cid.c        - the CID-keyed font driver
-    src/psaux/psaux.c         - the PS support module
-    src/psnames/psnames.c     - a support module to handle PS glyph
-                                names
-    src/raster1/raster1.c     - the monochrome raster module
-    src/sfnt/sfnt.c           - the `sfnt' module
-    src/smooth/smooth.c       - the anti-aliasing raster module
-    src/truetype/truetype.c   - the TrueType font driver
-    src/type1/type1.c         - the Type 1 font driver
-
-  The last module of  FreeType 2, `winfonts' (implementing support for
-  Windows FNT format), is a single file.
-
-  To compile one component, do the following:
-
-    - Add  the  top-level  `include'  directory  to  your  compilation
-      include path
-
-    - Add the `src/<component>'  directory to your compilation include
-      path, or simply `cd' to the component's source directory.
-
-    - Compile the component `source'  file (see list below); you don't
-      need  to   be  in  the   component's  directory  if   you  added
-      `src/<component>' to your include path.
-
-  For example, the following line  can be used to compile the truetype
-  driver on Unix:
-
-     cd freetype2/
-     cc -c -Iinclude -Isrc/truetype src/truetype/truetype.c
-
-  Alternatively:
-
-     cd freetype2/src/truetype
-     cc -c -I../../include truetype.c
-
-  Finally, FreeType 2 contains some other components:
-
-     src/base/ftsystem.c  - system-specific memory and i/o support
-     src/base/ftinit.c    - initialization layer
-     src/base/ftdebug.c   - debugging component (empty in release
-                            build)
-     src/base/ftglyph.c   - optional convenience functions
-
-  All font  drivers are optional.  The `sfnt',  `psaux', and `psnames'
-  modules are mandatory for certain drivers.  However, you may need to
-  update  the  list of  drivers  that  are  statically linked  to  the
-  library,    which   is   located    in   the    configuration   file
-  `include/freetype/config/ftmodule.h'.
-
-
-IV. Support for flat-directory compilation
-------------------------------------------
-
-  It is  possible to  put all  FreeType 2 source  files into  a single
-  directory, with the exception of the `include' hierarchy.
-
-    1. Copy all files in current directory:
-
-        cp freetype2/src/base/*.[hc] .
-        cp freetype2/src/raster1/*.[hc] .
-        cp freetype2/src/smooth/*.[hc] .
-        etc.
-
-    2. Compile sources:
-
-        cc -c -Ifreetype2/include ftsystem.c
-        cc -c -Ifreetype2/include ftinit.c
-        cc -c -Ifreetype2/include ftdebug.c
-        cc -c -Ifreetype2/include ftbase.c
-        etc.
-
-   You don't need to define the FT_FLAT_COMPILATION macro (as this was
-   required in previous releases of FreeType 2).
-
-End of file
diff --git a/docs/CHANGES b/docs/CHANGES
index 673a5e9..0a8e3f8 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -33,6 +33,11 @@ LATEST CHANGES BETWEEN 2.1.4 and 2.1.3
     - the CMap cache is now capable of managing UCS-4 character codes that
       are mapped through extended charmaps in recent TrueType/OpenType fonts
 
+    - the cache sub-system now properly manages out-of-memory conditions,
+      instead of blindly reporting them to the caller. This means that it
+      will try to empty the cache before restarting its allocations to see
+      if that can help.
+
     - the PFR driver didn't return the list of available embedded bitmaps
       properly.
 
@@ -72,6 +77,9 @@ LATEST CHANGES BETWEEN 2.1.4 and 2.1.3
       with FreeType (i.e. comparing release/libtool/so numbers, and how
       to use them in Autoconf scripts)
 
+    - the installation documentation has been seriously revamped. Everything
+      is now in the "docs" directory.
+
 ==============================================================================
 LATEST CHANGES BETWEEN 2.1.3 and 2.1.2
 
diff --git a/docs/CUSTOMIZE b/docs/CUSTOMIZE
new file mode 100644
index 0000000..397c2c3
--- /dev/null
+++ b/docs/CUSTOMIZE
@@ -0,0 +1,117 @@
+How to customize the compilation of the library:
+================================================
+
+ FreeType is highly customizable to fit various needs, and this document
+ details how it is possible to select options and components at compilation
+ time.
+
+
+I. Configuration macros:
+
+  the file found in "include/freetype/config/ftoption.h" contains a list
+  of commented configuration macros that can be toggled by developers to
+  indicate which features to activate in their build of the library.
+  
+  these options range from debug level to availability of certain
+  features, like native TrueType hinting through a bytecode interpreter.
+  
+  we invite you to read this file for more information. You can change
+  the file's content to suit your needs, or override it with one of the
+  techniques described below..
+
+  
+II. Modules list:
+
+  the file found in "include/freetype/config/ftmodule.h" contains a list
+  of names corresponding to the modules / font drivers to be statically
+  compiled in the FreeType library during the build.
+
+  you can change it to suit your own preferences. Be aware that certain
+  modules depend on others, as described by the file "modules.txt" in
+  this directory.
+
+  you can modify the file's content to suit your needs, or override it
+  at compile time with one of the methods described below
+
+
+III. System interface:
+
+  FreeType's default interface to the system (i.e. the parts that deal with
+  memory management and i/o streams) is located in "src/base/ftsystem.c".
+  
+  the current implementation uses standard C library calls to manage
+  memory and read font files. It is however possible to write custom
+  implementations to suit specific systems.
+
+  to tell the GNU Make-based build system to use a custom system interface,
+  you'll need to define the environment variable FTSYS_SRC to point to
+  the relevant implementation, like in:
+  
+      on Unix:
+        ./configure <youroptions>
+        export FTSYS_SRC=foo/my_ftsystem.c
+        make
+        make install
+   
+      on Windows:
+        make setup <compiler>
+        set FTSYS_SRC=foo/my_ftsystem.c
+        make
+     
+     
+IV. Overriding default  configuration and module headers:
+
+  it is possible to over-ride the default configuration and module headers
+  without changing the original files. There are two ways to do that:
+
+  1. Using the C include path:
+  
+    use the C include path to ensure that your own versions of the
+    files are used at compile time when the lines:
+    
+       #include FT_CONFIG_OPTIONS_H
+       #include FT_CONFIG_MODULES_H
+
+    are compiled. Their default values being <freetype/config/ftoption.h>
+    and <freetype/config/ftmodule.h>, you can do something like:
+
+       custom/
+         freetype/
+           config/
+             ftoption.h    => custom options header
+             ftmodule.h    => custom modules list
+             
+       include/            => normal FreeType 2 include
+          freetype/
+            ...
+
+   then change the C include path to always give the path to "custom"
+   before the FreeType 2 "include"
+
+
+  2. Re-defining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
+  
+   another way to do the same thing is to re-define the macros used
+   to name the configuration headers. To do so, you'll need a custom
+   "ft2build.h", whose content can be as simple as:
+   
+          #ifndef __FT2_BUILD_GENERIC_H__
+          #define __FT2_BUILD_GENERIC_H__
+
+          #define  FT_CONFIG_OPTIONS_H   <custom/my-ftoption.h>
+          #define  FT_CONFIG_MACROS_H    <custom/my-ftmodule.h>
+
+          #include <freetype/config/ftheader.h>
+
+          #endif /* __FT2_BUILD_GENERIC_H__ */
+   
+   place them in:
+   
+       custom/
+          ft2build.h           => custom version described above
+          my-ftoption.h        => custom options header
+          my-ftmodule.h        => custom modules list header
+
+   and change the C include path to ensure that "custom" is always placed
+   before the FT2 "include" during compilation.
+
diff --git a/docs/DEBUG b/docs/DEBUG
new file mode 100644
index 0000000..03ed703
--- /dev/null
+++ b/docs/DEBUG
@@ -0,0 +1,183 @@
+Debugging within the FreeType sources:
+======================================
+
+I. Configuration macros
+-----------------------
+
+There  are several ways  to enable  debugging features  in a  FreeType 2
+builds.   This is controlled  through the  definition of  special macros
+located in the file "ftoptions.h".  The macros are:
+
+
+  FT_DEBUG_LEVEL_ERROR
+
+    #define this macro  if you want to compile  the FT_ERROR macro calls
+    used to  print error messages  during program execution.   This will
+    not  stop the  program, but  is very  useful to  spot  invalid fonts
+    during development and code workarounds for them.
+
+  FT_DEBUG_LEVEL_TRACE
+
+    #define this  macro if you want  to compile both  the FT_ERROR macro
+    and the  FT_TRACE one.  This  also includes the  variants FT_TRACE0,
+    FT_TRACE1, FT_TRACE2, ..., FT_TRACE6.
+
+    The  trace  macros are  used  to  send  debugging messages  when  an
+    appropriate  "debug  level" is  configured  at  runtime through  the
+    FT2_DEBUG environment variable (more on this later).
+
+  FT_DEBUG_MEMORY
+
+    If this  macro is  #defined, the FreeType  engines is linked  with a
+    small  but  effective  debugging  memory  manager  that  tracks  all
+    allocations and frees that are performed within the font engine.
+
+    When  the  FT2_DEBUG_MEMORY   environment  variable  is  defined  at
+    runtime,  a call  to FT_Done_FreeType  will dump  memory statistics,
+    including the list of leaked memory blocks with the source locations
+    where these were allocated.  It's  always a very good idea to define
+    this in development builds.  This works with _any_ program linked to
+    FreeType, but  requires a big  deal of memory (the  debugging memory
+    manager never frees the blocks to the heap in order to detect double
+    frees).
+
+    When FT2_DEBUG_MEMORY isn't defined at runtime, the debugging memory
+    manager is ignored, and performance is un-affected.
+
+
+II. Debugging macros
+--------------------
+
+Several macros can be used within the FreeType sources to help debugging
+its code:
+
+  1. FT_ERROR(( ... ))
+
+    This macro is  used to send debug messages  that indicate relatively
+    serious  errors (like  broken font  files),  but will  not stop  the
+    execution of  the running program.   Its code is compiled  only when
+    either FT_DEBUG_LEVEL_ERROR  or FT_DEBUG_LEVEL_TRACE are  defined in
+    "ftoption.h".
+
+    Note that you must use with a printf-like signature, but with double
+    parentheses, like in:
+
+      FT_ERROR(( "your %s is not %s\n", "foo", "bar" ));
+
+
+  2. FT_ASSERT( condition )
+
+    This macro  is used to check  strong assertions at  runtime.  If its
+    condition isn't TRUE,  the program will abort with  a panic message.
+    Its   code   is  compiled   when   either  FT_DEBUG_LEVEL_ERROR   or
+    FT_DEBUG_LEVEL_TRACE are defined.  You don't need double-parentheses
+    here.  For example:
+
+      FT_ASSERT( ptr != NULL );
+
+
+  3. FT_TRACE( level, (message...) )
+
+    The  FT_TRACE  macro  is  used  to  send  general-purpose  debugging
+    messages during  program execution.   This macro uses  an *implicit*
+    macro named FT_COMPONENT used to name the current FreeType component
+    being run.
+
+    The developer should always  define FT_COMPONENT as appropriate, for
+    example as in:
+
+      #undef  FT_COMPONENT
+      #define FT_COMPONENT  trace_io
+
+    The  value  of  the  FT_COMPONENT  macro  is  an  enumeration  named
+    trace_XXXX where XXXX  is one of the component  names defined in the
+    internal file <freetype/internal/fttrace.h>.
+
+    Each such component is assigned a "debug level", ranging from 0 to 6
+    when a program  linked with FreeType starts, through  the use of the
+    FT2_DEBUG environment variable, described later.
+
+    When FT_TRACE  is called, its  level is compared  to the one  of the
+    corresponding component.   Messages with trace  levels *higher* than
+    the corresponding component level are filtered and never printed.
+
+    This  means that  trace messages  with level  0 are  always printed,
+    those with level 2 are only  printed when the component level is *at
+    least* 2.
+
+    The  second  parameter  to  FT_TRACE must  contain  parentheses  and
+    correspond to a print-like call, as in:
+
+      FT_TRACE( 2, ( "your %s is not %s\n", "foo", "bar" ) )
+
+    The shortcut macros  FT_TRACE0, FT_TRACE1, FT_TRACE2_, ... FT_TRACE6
+    can be  used with  constant level indices,  and are much  cleaner to
+    use, as in
+
+     FT_TRACE2(( "your %s is not %s\n", "foo", "bar" ));
+
+
+III. Environment variables
+--------------------------
+
+The  following  environment   variables  control  debugging  output  and
+behaviour of FreeType at runtime:
+
+
+  FT2_DEBUG
+
+    This   variable  is   only  used   when  FreeType   is   built  with
+    FT_DEBUG_LEVEL_TRACE defined.  It contains a list of component level
+    definitions, following this format:
+
+       component1:level1 component2:level2 component3:level3 ...
+
+    where "componentX" is the name of a tracing component, as defined in
+    "fttrace.h", but  without the "trace_"  prefix, and "levelX"  is the
+    corresponding level to use at runtime.
+
+    "any"  is a  special  component  name that  will  be interpreted  as
+    "any/all components".  For example, the following definitions
+
+       set FT2_DEBUG=any:2 memory:5 io:4        (on Windows)
+       export FT2_DEBUG="any:2 memory:5 io:4"   (on Linux)
+
+    both stipulate that  all components should have level  2, except for
+    the memory and io components which will be set to trace levels 5 and
+    4 respectively.
+
+  FT2_DEBUG_MEMORY
+
+    This  environment variable, when  defined, tells  FreeType to  use a
+    debugging  memory manager that  will track  leaked memory  blocks as
+    well as other  common errors like double frees.   It is also capable
+    of  reporting  _where_  the  leaked  blocks  were  allocated,  which
+    considerably saves time when debugging new additions to the library.
+
+    This  code  is  only  compiled  when  FreeType  is  built  with  the
+    FT_DEBUG_MEMORY macro  #defined in  "ftoption.h" though, it  will be
+    ignored in other builds.
+
+
+  FT2_ALLOC_TOTAL_MAX
+
+    this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
+    you to specify a maximum heap size for all memory allocations performed
+    by FreeType. This is very useful to test the robustness of the font
+    engine and programs that use it in tight memory conditions.
+    
+    If it is undefined, or if its value is not strictly positive, then no
+    allocation bounds are checked at runtime.
+
+
+  FT2_ALLOC_COUNT_MAX
+  
+    this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
+    you to sepcify a maximum number of memory allocations performed by
+    FreeType before returning the error FT_Err_Out_Of_Memory. This is
+    useful for debugging and testing the engine's robustness.
+    
+    If it is undefined, or if its value is not strictly positive, then no
+    allocation bounsd are checked at runtime.
+
+End of file
diff --git a/docs/DEBUG.TXT b/docs/DEBUG.TXT
deleted file mode 100644
index 8996d66..0000000
--- a/docs/DEBUG.TXT
+++ /dev/null
@@ -1,183 +0,0 @@
-Debugging within the FreeType sources:
-======================================
-
-I. Configuration macros
------------------------
-
-There  are several ways  to enable  debugging features  in a  FreeType 2
-builds.   This is controlled  through the  definition of  special macros
-located in the file "ftoptions.h".  The macros are:
-
-
-  FT_DEBUG_LEVEL_ERROR
-
-    #define this macro  if you want to compile  the FT_ERROR macro calls
-    used to  print error messages  during program execution.   This will
-    not  stop the  program, but  is very  useful to  spot  invalid fonts
-    during development and code wordarounds for them.
-
-  FT_DEBUG_LEVEL_TRACE
-
-    #define this  macro if you want  to compile both  the FT_ERROR macro
-    and the  FT_TRACE one.  This  also includes the  variants FT_TRACE0,
-    FT_TRACE1, FT_TRACE2, ..., FT_TRACE6.
-
-    The  trace  macros are  used  to  send  debugging messages  when  an
-    appropriate  "debug  level" is  configured  at  runtime through  the
-    FT2_DEBUG environment variable (more on this later).
-
-  FT_DEBUG_MEMORY
-
-    If this  macro is  #defined, the FreeType  engines is linked  with a
-    small  but  effective  debugging  memory  manager  that  tracks  all
-    allocations and frees that are performed within the font engine.
-
-    When  the  FT2_DEBUG_MEMORY   environment  variable  is  defined  at
-    runtime,  a call  to FT_Done_FreeType  will dump  memory statistics,
-    including the list of leaked memory blocks with the source locations
-    where these were allocated.  It's  always a very good idea to define
-    this in development builds.  This works with _any_ program linked to
-    FreeType, but  requires a big  deal of memory (the  debugging memory
-    manager never frees the blocks to the heap in order to detect double
-    frees).
-
-    When FT2_DEBUG_MEMORY isn't defined at runtime, the debugging memory
-    manager is ignored, and performance is un-affected.
-
-
-II. Debugging macros
---------------------
-
-Several macros can be used within the FreeType sources to help debugging
-its code:
-
-  1. FT_ERROR(( ... ))
-
-    This macro is  used to send debug messages  that indicate relatively
-    serious  errors (like  broken font  files),  but will  not stop  the
-    execution of  the running program.   Its code is compiled  only when
-    either FT_DEBUG_LEVEL_ERROR  or FT_DEBUG_LEVEL_TRACE are  defined in
-    "ftoption.h".
-
-    Note that you must use with a printf-like signature, but with double
-    parentheses, like in:
-
-      FT_ERROR(( "your %s is not %s\n", "foo", "bar" ));
-
-
-  2. FT_ASSERT( condition )
-
-    This macro  is used to check  strong assertions at  runtime.  If its
-    condition isn't TRUE,  the program will abort with  a panic message.
-    Its   code   is  compiled   when   either  FT_DEBUG_LEVEL_ERROR   or
-    FT_DEBUG_LEVEL_TRACE are defined.  You don't need double-parentheses
-    here.  For example:
-
-      FT_ASSERT( ptr != NULL );
-
-
-  3. FT_TRACE( level, (message...) )
-
-    The  FT_TRACE  macro  is  used  to  send  general-purpose  debugging
-    messages during  program execution.   This macro uses  an *implicit*
-    macro named FT_COMPONENT used to name the current FreeType component
-    being run.
-
-    The developer should always  define FT_COMPONENT as appropriate, for
-    example as in:
-
-      #undef  FT_COMPONENT
-      #define FT_COMPONENT  trace_io
-
-    The  value  of  the  FT_COMPONENT  macro  is  an  enumeration  named
-    trace_XXXX where XXXX  is one of the component  names defined in the
-    internal file <freetype/internal/fttrace.h>.
-
-    Each such component is assigned a "debug level", ranging from 0 to 6
-    when a program  linked with FreeType starts, through  the use of the
-    FT2_DEBUG environment variable, described later.
-
-    When FT_TRACE  is called, its  level is compared  to the one  of the
-    corresponding component.   Messages with trace  levels *higher* than
-    the corresponding component level are filtered and never printed.
-
-    This  means that  trace messages  with level  0 are  always printed,
-    those with level 2 are only  printed when the component level is *at
-    least* 2.
-
-    The  second  parameter  to  FT_TRACE must  contain  parentheses  and
-    correspond to a print-like call, as in:
-
-      FT_TRACE( 2, ( "your %s is not %s\n", "foo", "bar" ) )
-
-    The shortcut macros  FT_TRACE0, FT_TRACE1, FT_TRACE2_, ... FT_TRACE6
-    can be  used with  constant level indices,  and are much  cleaner to
-    use, as in
-
-     FT_TRACE2(( "your %s is not %s\n", "foo", "bar" ));
-
-
-III. Environment variables
---------------------------
-
-The  following  environment   variables  control  debugging  output  and
-behaviour of FreeType at runtime:
-
-
-  FT2_DEBUG
-
-    This   variable  is   only  used   when  FreeType   is   built  with
-    FT_DEBUG_LEVEL_TRACE defined.  It contains a list of component level
-    definitions, following this format:
-
-       component1:level1 component2:level2 component3:level3 ...
-
-    where "componentX" is the name of a tracing component, as defined in
-    "fttrace.h", but  without the "trace_"  prefix, and "levelX"  is the
-    corresponding level to use at runtime.
-
-    "any"  is a  special  component  name that  will  be interpreted  as
-    "any/all components".  For example, the following definitions
-
-       set FT2_DEBUG=any:2 memory:5 io:4        (on Windows)
-       export FT2_DEBUG="any:2 memory:5 io:4"   (on Linux)
-
-    both stipulate that  all components should have level  2, except for
-    the memory and io components which will be set to trace levels 5 and
-    4 respectively.
-
-  FT2_DEBUG_MEMORY
-
-    This  environment variable, when  defined, tells  FreeType to  use a
-    debugging  memory manager that  will track  leaked memory  blocks as
-    well as other  common errors like double frees.   It is also capable
-    of  reporting  _where_  the  leaked  blocks  were  allocated,  which
-    considerably saves time when debugging new additions to the library.
-
-    This  code  is  only  compiled  when  FreeType  is  built  with  the
-    FT_DEBUG_MEMORY macro  #defined in  "ftoption.h" though, it  will be
-    ignored in other builds.
-
-
-  FT2_ALLOC_TOTAL_MAX
-
-    this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
-    you to specify a maximum heap size for all memory allocations performed
-    by FreeType. This is very useful to test the robustness of the font
-    engine and programs that use it in tight memory conditions.
-    
-    If it is undefined, or if its value is not strictly positive, then no
-    allocation bounds are checked at runtime.
-
-
-  FT2_ALLOC_COUNT_MAX
-  
-    this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
-    you to sepcify a maximum number of memory allocations performed by
-    FreeType before returning the error FT_Err_Out_Of_Memory. This is
-    useful for debugging and testing the engine's robustness.
-    
-    If it is undefined, or if its value is not strictly positive, then no
-    allocation bounsd are checked at runtime.
-
-End of file
diff --git a/docs/INSTALL b/docs/INSTALL
index 22207e3..8f5bc32 100644
--- a/docs/INSTALL
+++ b/docs/INSTALL
@@ -1,185 +1,65 @@
-In order to build the library, read the `BUILD' document in the `docs'
-directory.  This is only a quick starter.
+Welcome
 
+There are several ways to build the FreeType library, depending on your
+system and the level of customization you need. Here's a short overview
+of the documentation available:
 
-I. Unix systems
----------------
+I. Normal installation and upgrades:
 
-  If you have GNU Make installed, simply type
+  1. Native TrueType Hinting:
+  
+    Native TrueType hinting is disabled by default[1]. If you really need it,
+    read the file "TRUETYPE" for information.
 
-    ./configure
-    make
-    make install
+      
+  2. Unix Systems (as well as Cygwin or MSys on Windows):
 
-  on the command line to configure, build and install FreeType on your
-  system.  Note that the default installation path is "/usr/local".
+    Please read *both* UPGRADE.UNX and INSTALL.UNX to install or upgrade
+    FreeType 2 on a Unix system. Note that you *will* need GNU Make, since
+    other make tools won't work (this includes BSD Make !!)
 
-  Please read the file  README.UNX, it contains _critical_ information
-  regarding the installation of FreeType on many Unix systems.
+  3. On VMS with the "mms" build tool:
+  
+    see INSTALL.VMS for installation instructions on this platform
 
+  4. Other systems using GNU Make:
+  
+    on non-Unix platforms, it's possible to build the library using
+    GNU Make utility. Note that *NO OTHER MAKE TOOL WILL WORK* !!
+    This methods supports several compilers on Windows, OS/2 and BeOS,
+    including Mingw, Visual C++, Borland C++, and more.
 
-II. From the command line
--------------------------
+    instructions are provided in the file "INSTALL.GNU"
 
-  If  you are  not using  Unix, there  are two  ways to  quickly build
-  FreeType 2 from the command line.
 
-  The first, and favorite one, is to use the "Jam" build tool.  Jam is
-  a highly  portable replacement for  Make whose control files  do not
-  depend on the current platform or compiler toolset.
+  5. With an IDE Project File  (e.g. for Visual Studio or CodeWarrior):
+  
+    we provide a small number of "project files" for various IDEs to
+    automatically build the library as well. Note that these files are
+    not supported and sporadically maintained by FreeType developers,
+    so don't expect them to work in each release.
+    
+    to find them, have a look at the content of the "builds/<system>"
+    directory, where <system> stands for your OS or environment.
 
-  For more information, please see:
 
-    http://www.freetype.org/jam/index.html
+  6. From you own IDE, or own Makefiles:
+  
+    If you want to create your own project file, follow the instructions
+    given in the "INSTALL.ANY" document of this directory.
 
-  The second one is to use "GNU Make" (and NO OTHER MAKE TOOL).
 
+II. Custom builds of the library:
 
-  1. Building FT2 with "Jam"
-  --------------------------
+  Customizing the compilation of FreeType is easy, and allows you to select
+  only the components of the font engine that you really need. For more details
+  read the file "CUSTOMIZE"
 
-    Once you've  got *our version* of  the Jam tool  installed on your
-    system, simply go to the top-level FT2 directory, then type
 
-      "jam"
+--------------------------------------------------------------------
 
-    on the command line.  This will  build the library and place it in
-    the "objs" directory.
+[1] More details on:  http://www.freetype.org/patents.html
 
-    By default,  a static  library is built.   On Unix systems,  it is
-    possible to  build a shared library through  the "libtool" script.
-    You need to have libtool  installed on your system, then re-define
-    a few environment variables before invoking Jam, as in
+End of file
 
-       export CC="libtool --mode=compile cc"
-       export LINK="libtool --mode=link cc"
-       jam
-
-    In  later releases  of  FT2, building  shared  libraries with  Jam
-    should become automatic on Unix systems.
-
-
-  2. Building FT2 with "GNU Make"
-  -------------------------------
-
-  You need  to have  GNU Make (version  3.78.1 or newer)  installed on
-  your system to compile the library from the command line.  This will
-  _NOT_ work with other make tools (including BSD make)!
-
-  [Well, this is not  really correct.  Recently, a perl implementation
-  of make called `makepp' has appeared which can also build FreeType 2
-  successfully on  Unix platforms.   See http://makepp.sourceforge.net
-  for more details.]
-
-  - Go to the `freetype2' directory.
-
-  - Unix (any C compiler should work):
-
-      - make setup (don't worry, this will invoke a configure script)
-      - make
-      - make install
-
-    Alternatively,  you can  pass parameters  to the  configure script
-    within the CFG variable, as in:
-
-      - make setup CFG="--prefix=/usr"
-      - make
-      - make install
-
-    If the  configure script isn't run,  try to add `unix' as a target
-    on the command line, e.g.:
-
-      - make setup unix CFG="--prefix=/opt/experimental"
-
-
-  - Windows:
-
-    We provide a  version of GNU Make for Win32  on the FreeType site.
-    See http://www.freetype.org/download.html for details.
-
-    - gcc (Mingw, _not_ CygWin):
-
-        - make setup
-        - make
-
-
-    - Visual C++:
-
-        - make setup visualc
-        - make
-
-
-    - other compilers:
-
-        - make setup bcc32    -> Borland C++ 32 bits
-        - make setup intelc   -> Intel C++
-        - make setup watcom   -> Watcom C++
-        - make setup lcc      -> Win32-LCC
-
-
-  If you want  to build FreeType 2 in another  directory, you must set
-  two  environment  variables,  `OJB_DIR'  and  `TOP_DIR'.  The former
-  gives the directory where the object files and the library should  be
-  created (this directory must exist), the latter the top directory of
-  the FreeType 2 source tree.  Example:
-
-    OBJ_DIR=~/freetype2.compiled TOP_DIR=~/freetype2 \
-      make -f$TOP_DIR/Makefile setup ansi
-    OBJ_DIR=~/freetype2.compiled TOP_DIR=~/freetype2 \
-      make -f$TOP_DIR/Makefile
-
-  On  Unix boxes,  calling  `configure' from  the  build directory  is
-  sufficient;  it  will  build  a  small   Makefile  which  calls  the
-  FreeType 2 Makefile with the necessary parameters.
-
-
-III. In your own environment (IDE)
-----------------------------------
-
-  You need to add  the directories "freetype2/include" to your include
-  path when compiling the library.
-
-  FreeType  2 is  made  of several  components;  each one  of them  is
-  located   in  a  subdirectory   of  "freetype2/src".   For  example,
-  `freetype2/src/truetype/' contains the TrueType font driver.
-
-  DO NOT COMPILE ALL C FILES!  Rather, compile the following ones:
-
-    -- base components (required)
-
-      src/base/ftsystem.c
-      src/base/ftinit.c
-      src/base/ftdebug.c
-      src/base/ftbase.c
-      src/base/ftglyph.c
-      src/base/ftbbox.c
-      src/base/ftmm.c
-
-      src/base/ftmac.c        -- only on the Macintosh
-
-    -- other components are optional
-
-      src/autohint/autohint.c -- auto hinting module
-      src/cache/ftcache.c     -- cache sub-system (in beta)
-      src/sfnt/sfnt.c         -- SFNT files support
-                                 (TrueType & OpenType)
-      src/cff/cff.c           -- CFF/OpenType font driver
-      src/psnames/psnames.c   -- Postscript glyph names support
-      src/psaux/psaux.c       -- Postscript Type 1 parsing
-      src/truetype/truetype.c -- TrueType font driver
-      src/type1/type1.c       -- Type 1 font driver
-      src/cid/type1cid.c      -- Type 1 CID-keyed font driver
-      src/winfonts/winfonts.c -- Windows FONT / FNT font driver
-
-    Note:
-
-       `truetype.c' needs `sfnt.c' and `psnames.c'
-       `type1.c'    needs `psaux.c' and `psnames.c'
-       `type1cid.c' needs `psaux.c' and `psnames.c'
-       `cff.c'      needs `sfnt.c', `psaux.c', and `psnames.c'
-
-       etc.
-
-For more information, please consult "docs/BUILD".
-
---- end of INSTALL --
+     
\ No newline at end of file
diff --git a/docs/INSTALL.ANY b/docs/INSTALL.ANY
new file mode 100644
index 0000000..5e2cf0e
--- /dev/null
+++ b/docs/INSTALL.ANY
@@ -0,0 +1,96 @@
+Instructions on how to build FreeType with your own build tool:
+
+  see the file "CUSTOMIZE" to learn how to customize FreeType to
+  specific environments.
+
+  follow these simple steps:
+
+I. Normal way:
+--------------
+
+  * DISABLE PRE-COMPILED HEADERS ! This is very important for Visual
+    C++, because FreeType uses lines like:
+    
+       #include FT_FREETYPE_H
+    
+    which are not correctly supported by this compiler, while being
+    ISO C compliant !!
+
+  * You need to add  the directories "freetype2/include" to your include
+    path when compiling the library.
+
+  * FreeType  2 is  made  of several  components;  each one  of them  is
+    located   in  a  subdirectory   of  "freetype2/src".   For  example,
+    'freetype2/src/truetype/' contains the TrueType font driver.
+
+  * DO NOT COMPILE ALL C FILES!  Rather, compile the following ones:
+
+      -- base components (required)
+
+        src/base/ftsystem.c
+        src/base/ftinit.c
+        src/base/ftdebug.c
+        src/base/ftbase.c
+        src/base/ftglyph.c
+        src/base/ftbbox.c
+        src/base/ftmm.c
+        src/base/ftpfr.c        -- optional, see <freetype/ftpfr.h>
+        src/base/ftbdf.c        -- optional, see <freetype/ftbdf.h>
+        src/base/ftwinfnt.c     -- optional, see <freetype/ftwinfnt.h>
+
+        src/base/ftmac.c        -- only on the Macintosh
+
+     -- other components are optional
+
+        src/autohint/autohint.c -- auto hinting module
+        src/cache/ftcache.c     -- cache sub-system (in beta)
+        src/sfnt/sfnt.c         -- SFNT files support
+                                   (TrueType & OpenType)
+        src/cff/cff.c           -- CFF/OpenType font driver
+        src/pfr/pfr.c           -- PFR/TrueDoc font driver
+        src/bdf/bdf.c           -- BDF font driver
+        src/pcf/pcf.c           -- PCF font driver
+        src/psnames/psnames.c   -- Postscript glyph names support
+        src/psaux/psaux.c       -- Postscript Type 1 parsing
+        src/truetype/truetype.c -- TrueType font driver
+        src/type1/type1.c       -- Type 1 font driver
+        src/cid/type1cid.c      -- Type 1 CID-keyed font driver
+        src/winfonts/winfonts.c -- Windows FONT / FNT font driver
+        src/raster1/raster1.c   -- monochrome rasterizer
+        src/smooth/smooth.c     -- anti-aliasing rasterizer
+
+    Note:
+
+      `truetype.c' needs `sfnt.c' and `psnames.c'
+      `type1.c'    needs `psaux.c' and `psnames.c'
+      `type1cid.c' needs `psaux.c' and `psnames.c'
+      `cff.c'      needs `sfnt.c', `psaux.c', and `psnames.c'
+
+  that should be it ! in case of problems, see the archives of
+  the FreeType development mailing list.
+
+
+II. Support for flat-directory compilation
+------------------------------------------
+
+  It is  possible to  put all  FreeType 2 source  files into  a single
+  directory, with the *exception* of the `include' hierarchy.
+
+    1. Copy all files in current directory:
+
+        cp freetype2/src/base/*.[hc] .
+        cp freetype2/src/raster1/*.[hc] .
+        cp freetype2/src/smooth/*.[hc] .
+        etc.
+
+    2. Compile sources:
+
+        cc -c -Ifreetype2/include ftsystem.c
+        cc -c -Ifreetype2/include ftinit.c
+        cc -c -Ifreetype2/include ftdebug.c
+        cc -c -Ifreetype2/include ftbase.c
+        etc.
+
+   You don't need to define the FT_FLAT_COMPILATION macro (as this was
+   required in previous releases of FreeType 2).
+
diff --git a/docs/INSTALL.GNU b/docs/INSTALL.GNU
new file mode 100644
index 0000000..df6f012
--- /dev/null
+++ b/docs/INSTALL.GNU
@@ -0,0 +1,128 @@
+This document contains instructions on how to build the FreeType library
+on non-Unix systems with the help of GNU Make. Note that if you're running
+Cygwin or MSys in Windows, you should follow the instructions of INSTALL.UNX
+instead.
+
+
+  FreeType 2 includes a powerful and flexible build system that allows
+  you to  easily compile it on  a great variety of  platforms from the
+  command line.  To do so, just follow these simple instructions:
+
+  a. Install GNU Make
+
+    Because  GNU Make  is  the  only Make  tool  supported to  compile
+    FreeType 2, you should install it on your machine.
+
+    The FreeType 2 build system relies on many features special to GNU
+    Make -- trying to build the  library with any other Make tool will
+    *fail*.
+
+    NEARLY ALL OTHER MAKE TOOLS WILL FAIL, INCLUDING "BSD MAKE", SO
+    REALLY INSTALL A RECENT VERSION OF GNU MAKE ON YOUR SYSTEM!
+
+    Make sure that you are invoking GNU Make from the command line, by
+    typing something like:
+
+        make -v
+
+    to display its version number.
+
+    VERSION 3.78.1 OR NEWER IS NEEDED!
+
+
+
+  b. Invoke 'make'
+
+    Go to  the root  directory of FreeType  2, then simply  invoke GNU
+    Make from the command line.   This will launch the FreeType 2 host
+    platform  detection routines.   A summary  will be  displayed, for
+    example, on Win32:
+
+
+        ==============================================================
+        FreeType build system -- automatic system detection
+
+        The following settings are used:
+
+          platform                     win32
+          compiler                     gcc
+          configuration directory      ./builds/win32
+          configuration rules          ./builds/win32/w32-gcc.mk
+
+        If this does not correspond to your system or settings please
+        remove the file 'config.mk' from this directory then read the
+        INSTALL file for help.
+
+        Otherwise, simply type 'make' again to build the library.
+        =============================================================
+
+
+    If the detected settings correspond to your platform and compiler,
+    skip to step e.  Note that if your platform is completely alien to
+    the build system, the detected platform will be 'ansi'.
+
+
+  c. Configure the build system for a different compiler
+
+    If the build system correctly detected your platform, but you want
+    to use a different compiler  than the one specified in the summary
+    (for most platforms, gcc is  the defaut compiler), invoke GNU Make
+    with
+
+         make setup <compiler>
+
+    For example:
+
+        to use Visual C++ on Win32, type:  "make setup visualc"
+        to use Borland C++ on Win32, type  "make setup bcc32"
+        to use Watcom C++ on Win32, type   "make setup watcom"
+        to use Intel C++ on Win32, type    "make setup intelc"
+        to use LCC-Win32 on Win32, type:   "make setup lcc"
+        to use Watcom C++ on OS/2, type    "make setup watcom"
+        to use VisualAge C++ on OS/2, type "make setup visualage"
+
+    The  <compiler> name to  use is  platform-dependent.  The  list of
+    available  compilers for  your  system is  available  in the  file
+    `builds/<system>/detect.mk'
+
+    If you  are satisfied  by the new  configuration summary,  skip to
+    step e.
+
+  d. Configure the build system for an unknown platform/compiler
+
+    The auto-detection/setup  phase of the build system  copies a file
+    to the current directory under the name `config.mk'.
+
+    For    example,    on    OS/2+gcc,    it   would    simply    copy
+    `builds/os2/os2-gcc.mk' to `./config.mk'.
+
+    If for  some reason your  platform isn't correctly  detected, copy
+    manually the configuration sub-makefile to `./config.mk' and go to
+    step e.
+
+    Note  that  this file  is  a  sub-Makefile  used to  specify  Make
+    variables  for compiler  and linker  invocation during  the build.
+    You can  easily create your own  version from one  of the existing
+    configuration files,  then copy it to the  current directory under
+    the name `./config.mk'.
+
+  e. Build the library
+
+    The auto-detection/setup  phase should have  copied a file  in the
+    current  directory,  called   `./config.mk'.  This  file  contains
+    definitions of various Make  variables used to invoke the compiler
+    and linker during the build.
+
+    To  launch  the build,  simply  invoke  GNU  Make again:  The  top
+    Makefile will detect the configuration file and run the build with
+    it.
+
+
+
+  Final note:
+  
+    the build system builds a statically linked library of the font engine
+    in the "objs" directory. It does _not_ support the build of DLLs on
+    Windows and OS/2, if you need these, you'll have to either use
+    a IDE-specific project file, or follow the instructions in
+    "INSTALL.ANY" to create your own Makefiles.
diff --git a/docs/INSTALL.UNX b/docs/INSTALL.UNX
new file mode 100644
index 0000000..6af176d
--- /dev/null
+++ b/docs/INSTALL.UNX
@@ -0,0 +1,181 @@
+This document contains instructions on how to build the FreeType library
+on Unix systems. This also works for emulations like Cygwin or MSys on
+Win32:
+
+
+  I. Ensure that you are using GNU Make
+  -------------------------------------
+
+    The FreeType build system  _exclusively_ works with GNU Make.  You
+    will  not be  able to  compile the  library with  the instructions
+    below using any other alternative (including BSD Make).
+
+    Trying  to compile  the library  with a  different Make  tool will
+    print a message like:
+
+      Sorry, GNU make is required to build FreeType2.
+
+    and the build  process will be aborted.  If  this happens, install
+    GNU Make on your system,  and use the GNUMAKE environment variable
+    to name it.
+
+
+
+  IV. Build and install the library
+  ---------------------------------
+
+    The following  should work  on all Unix  systems where  the 'make'
+    command invokes GNU Make:
+
+      ./configure --prefix=<yourprefix>
+      make
+      make install           (as root)
+
+    where "<yourprefix>"  must be replaced  by the prefix  returned by
+    the "freetype-config" command.
+
+    When using a different command to invoke GNU Make, use the GNUMAKE
+    variable.  For example,  if `gmake' is the command  to use on your
+    system, do something like:
+
+       GNUMAKE=gmake ./configure --prefix=<yourprefix>
+       gmake
+       gmake install            (as root)
+
+    If  this  still  doesn't   work,  something's rotten on your system(
+    (e.g. you're using a very old version of GNU Make)
+
+
+
+I. Unix systems
+---------------
+
+  If you have GNU Make installed, simply type
+
+    ./configure
+    make
+    make install
+
+  on the command line to configure, build and install FreeType on your
+  system.  Note that the default installation path is "/usr/local".
+
+  Please read the file  README.UNX, it contains _critical_ information
+  regarding the installation of FreeType on many Unix systems.
+
+
+II. From the command line
+-------------------------
+
+  If  you are  not using  Unix, there  are two  ways to  quickly build
+  FreeType 2 from the command line.
+
+  The first, and favorite one, is to use the "Jam" build tool.  Jam is
+  a highly  portable replacement for  Make whose control files  do not
+  depend on the current platform or compiler toolset.
+
+  For more information, please see:
+
+    http://www.freetype.org/jam/index.html
+
+  The second one is to use "GNU Make" (and NO OTHER MAKE TOOL).
+
+
+  1. Building FT2 with "Jam"
+  --------------------------
+
+    Once you've  got *our version* of  the Jam tool  installed on your
+    system, simply go to the top-level FT2 directory, then type
+
+      "jam"
+
+    on the command line.  This will  build the library and place it in
+    the "objs" directory.
+
+    By default,  a static  library is built.   On Unix systems,  it is
+    possible to  build a shared library through  the "libtool" script.
+    You need to have libtool  installed on your system, then re-define
+    a few environment variables before invoking Jam, as in
+
+       export CC="libtool --mode=compile cc"
+       export LINK="libtool --mode=link cc"
+       jam
+
+    In  later releases  of  FT2, building  shared  libraries with  Jam
+    should become automatic on Unix systems.
+
+
+  2. Building FT2 with "GNU Make"
+  -------------------------------
+
+  You need  to have  GNU Make (version  3.78.1 or newer)  installed on
+  your system to compile the library from the command line.  This will
+  _NOT_ work with other make tools (including BSD make)!
+
+  [Well, this is not  really correct.  Recently, a perl implementation
+  of make called `makepp' has appeared which can also build FreeType 2
+  successfully on  Unix platforms.   See http://makepp.sourceforge.net
+  for more details.]
+
+  - Go to the `freetype2' directory.
+
+  - Unix (any C compiler should work):
+
+      - make setup (don't worry, this will invoke a configure script)
+      - make
+      - make install
+
+    Alternatively,  you can  pass parameters  to the  configure script
+    within the CFG variable, as in:
+
+      - make setup CFG="--prefix=/usr"
+      - make
+      - make install
+
+    If the  configure script isn't run,  try to add `unix' as a target
+    on the command line, e.g.:
+
+      - make setup unix CFG="--prefix=/opt/experimental"
+
+
+  - Windows:
+
+    We provide a  version of GNU Make for Win32  on the FreeType site.
+    See http://www.freetype.org/download.html for details.
+
+    - gcc (Mingw, _not_ CygWin):
+
+        - make setup
+        - make
+
+
+    - Visual C++:
+
+        - make setup visualc
+        - make
+
+
+    - other compilers:
+
+        - make setup bcc32    -> Borland C++ 32 bits
+        - make setup intelc   -> Intel C++
+        - make setup watcom   -> Watcom C++
+        - make setup lcc      -> Win32-LCC
+
+
+  If you want  to build FreeType 2 in another  directory, you must set
+  two  environment  variables,  `OJB_DIR'  and  `TOP_DIR'.  The former
+  gives the directory where the object files and the library should  be
+  created (this directory must exist), the latter the top directory of
+  the FreeType 2 source tree.  Example:
+
+    OBJ_DIR=~/freetype2.compiled TOP_DIR=~/freetype2 \
+      make -f$TOP_DIR/Makefile setup ansi
+    OBJ_DIR=~/freetype2.compiled TOP_DIR=~/freetype2 \
+      make -f$TOP_DIR/Makefile
+
+  On  Unix boxes,  calling  `configure' from  the  build directory  is
+  sufficient;  it  will  build  a  small   Makefile  which  calls  the
+  FreeType 2 Makefile with the necessary parameters.
+
+
+--- end of INSTALL --
diff --git a/docs/INSTALL.VMS b/docs/INSTALL.VMS
new file mode 100644
index 0000000..a82b9fd
--- /dev/null
+++ b/docs/INSTALL.VMS
@@ -0,0 +1,35 @@
+How to build the freetype2 library on VMS
+-----------------------------------------
+
+Just type one of the following depending on the type of external entries you
+want:
+
+  mms
+
+or
+
+  mms/macro=("COMP_FLAGS=/name=(as_is,short)")
+
+The library is avalaible in the directory
+
+  [.LIB]
+
+To compile applications using freetype2 you'll need to define the logical
+FREETYPE pointing to the directory
+
+  [.INCLUDE.FREETYPE]
+
+(i.e., if the directory in which this README.VMS file is located is
+$disk:[freetype] then define the logical with
+
+  define freetype $disk:[freetype.include.freetype]
+
+This version has been tested with Compaq C V6.2-006 on OpenVMS Alpha V7.2-1.
+
+
+  Any problems can be reported to
+
+    joukj@hrem.stm.tudelft.nl
+
+
+      Jouk Jansen
diff --git a/docs/TRUETYPE b/docs/TRUETYPE
new file mode 100644
index 0000000..4ec4001
--- /dev/null
+++ b/docs/TRUETYPE
@@ -0,0 +1,23 @@
+How to enable the TrueType native hinter if you need it
+--------------------------------------------------------
+
+  The  TrueType  bytecode  interpreter  is disabled  in  all  public
+  releases  of  the  FreeType  packages  for  patents  reasons  (see
+  http://www.freetype.org/patents.html for more details).
+
+  However, many Linux distributions do enable the interpreter in the
+  FreeType packages (DEB/RPM/etc.) they produce for their platforms.
+  If you are using TrueType  fonts on your system, you most probably
+  want to enable it manually by doing the following:
+
+    - open the file "include/freetype/config/ftoption.h"
+
+    - locate a line that says:
+
+          #undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+    - change it to:
+
+          #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+    of course, this must be done _before_ compiling the library
diff --git a/docs/UPGRADE.UNX b/docs/UPGRADE.UNX
new file mode 100644
index 0000000..0e67f90
--- /dev/null
+++ b/docs/UPGRADE.UNX
@@ -0,0 +1,124 @@
+
+SPECIAL NOTE FOR UNIX USERS
+===========================
+
+  If  you are installing  this release  of FreeType  on a  system that
+  already uses release  2.0.5 (or even an older  version), you have to
+  perform a few special steps to ensure that everything goes well.
+
+
+  I. Enable the TrueType bytecode hinter if you need it
+  -----------------------------------------------------
+
+    See the instructions in the file "TRUETYPE" of this directory.
+   
+    Note that FreeType supports TrueType fonts without the bytecode
+    interpreter through its auto-hinter, which now generate relatively good
+    results with most fonts.
+
+
+  II. Determine the correct installation path
+  --------------------------------------------
+
+    By  default,  the  source  package  will install  the  library  in
+    "/usr/local".   However, many Unix  distributions now  install the
+    library in  "/usr", since FreeType  is becoming a  critical system
+    component.
+
+    If FreeType is already installed on your system, type
+
+      freetype-config --prefix
+
+    on the command line.  This  should return the installation path to
+    use below  (e.g. "/usr"  or "/usr/local").  Otherwise,  simply use
+    "/usr" (or what you think is adequate for your installation).
+
+
+
+  III. Ensure that you are using GNU Make
+  ---------------------------------------
+
+    The FreeType build system  _exclusively_ works with GNU Make.  You
+    will  not be  able to  compile the  library with  the instructions
+    below using any other alternative (including BSD Make).
+
+    Trying  to compile  the library  with a  different Make  tool will
+    print a message like:
+
+      Sorry, GNU make is required to build FreeType2.
+
+    and the build  process will be aborted.  If  this happens, install
+    GNU Make on your system,  and use the GNUMAKE environment variable
+    to name it.
+
+
+
+  IV. Build and install the library
+  ---------------------------------
+
+    The following  should work  on all Unix  systems where  the `make'
+    command invokes GNU Make:
+
+      ./configure --prefix=<yourprefix>
+      make
+      make install           (as root)
+
+    where "<yourprefix>"  must be replaced  by the prefix  returned by
+    the "freetype-config" command.
+
+    When using a different command to invoke GNU Make, use the GNUMAKE
+    variable.  For example,  if `gmake' is the command  to use on your
+    system, do something like:
+
+       GNUMAKE=gmake ./configure --prefix=<yourprefix>
+       gmake
+       gmake install            (as root)
+
+    If  this  still  doesn't   work,  read  the  detailed  compilation
+    procedure available in the file "docs/BUILD" for troubleshooting.
+
+
+  V. Take care of XFree86 version 4
+  ---------------------------------
+
+    Certain recent Linux distributions will install _several_ versions
+    of FreeType on your system.   For example, on a fresh Mandrake 8.1
+    system, you can find the following files:
+
+      /usr/lib/libfreetype.so             which links to
+      /usr/lib/libfreetype.6.1.0.so
+
+    and
+
+      /usr/X11R6/lib/libfreetype.so       which links to
+      /usr/X11R6/lib/libfreetype.6.0.so
+
+    Note that these  files correspond to two distinct  versions of the
+    library!   It seems  that  this  surprising issue  is  due to  the
+    install  scripts  of recent  XFree86  servers  (from 4.1.0)  which
+    irremediably install  their own (dated) version of  the library in
+    "/usr/X11R6/lib".
+
+    In certain _rare_  cases you may experience minor  problems if you
+    install this release  of the library in "/usr"  only, namely, that
+    certain  applications will  not  benefit from  the  bug fixes  and
+    rendering improvements you'd expect.
+
+    There are two good ways to deal with this situation:
+
+      - Install  the library  _twice_, in  "/usr" and  in "/usr/X11R6"
+        (you  have to do  that each  time you  install a  new FreeType
+        release though).
+
+      - Change the link in /usr/X11R6/lib/libfreetype.so to point to
+
+          /usr/lib/libfreetype.so,
+
+        and get rid of
+
+          /usr/X11R6/lib/libfreetype.6.0.so
+
+    The FreeType Team  is not responsible for this  problem, so please
+    contact  either  the  XFree86   development  team  or  your  Linux
+    distributor to help clear this issue in case the information given
+    here doesn't help.
diff --git a/docs/license.txt b/docs/license.txt
index c95318d..51b52bf 100644
--- a/docs/license.txt
+++ b/docs/license.txt
@@ -1,11 +1,28 @@
 
-FreeType comes with two licenses from which you can choose the one which
-fits your needs best:
+   The FreeType   2 font   engine  is   copyrighted work,   and cannot   be
+   used  legally  without a   software license.   In order   to make   this
+   project  usable  to  a  vast majority  of developers,  we distribute  it
+   under two dual licenses.
 
-  . The FreeType License, in file `docs/FTL.txt'.
+   What this  means is  that *you*  must choose  *one* license among  those
+   described below,  then obey  all  its  terms and  conditions when  using
+   FreeType 2 in any of your projects or products:
 
-  . The GNU General Public License, in file `docs/GPL.txt'.
 
-The contributed PCF driver comes with a license similar to that of X Window
-System which is compatible to the above two licenses (see file
-src/pcf/readme).
+     - The  FreeType License,  found in  the file  "FTL.TXT", which  is
+       an     BSD-style  open-source   license *with*  an   advertising
+       clause   that      forces   you   to   explicitely   cite    the
+       FreeType   project   in  your      product's  documentation. All
+       details are in the license file
+
+
+     - The GNU General Public   License, found in "GPL.TXT",  which  is
+       the      traditionnal   and    "viral"   GPL    license,    that
+       forces  you   to     redistribute the _complete_ sources of  all
+       your products that simply     use FreeType 2.
+
+
+   Note that  the contributed  PCF driver  comes with  a license similar to
+   that  of   X Window   System  which  is  compatible   to the  above  two
+   licenses (see file src/pcf/readme).
+
diff --git a/docs/readme.vms b/docs/readme.vms
deleted file mode 100644
index a82b9fd..0000000
--- a/docs/readme.vms
+++ /dev/null
@@ -1,35 +0,0 @@
-How to build the freetype2 library on VMS
------------------------------------------
-
-Just type one of the following depending on the type of external entries you
-want:
-
-  mms
-
-or
-
-  mms/macro=("COMP_FLAGS=/name=(as_is,short)")
-
-The library is avalaible in the directory
-
-  [.LIB]
-
-To compile applications using freetype2 you'll need to define the logical
-FREETYPE pointing to the directory
-
-  [.INCLUDE.FREETYPE]
-
-(i.e., if the directory in which this README.VMS file is located is
-$disk:[freetype] then define the logical with
-
-  define freetype $disk:[freetype.include.freetype]
-
-This version has been tested with Compaq C V6.2-006 on OpenVMS Alpha V7.2-1.
-
-
-  Any problems can be reported to
-
-    joukj@hrem.stm.tudelft.nl
-
-
-      Jouk Jansen
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 759d121..9276150 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -536,6 +536,30 @@ FT_BEGIN_HEADER
   FT_BASE( void )
   FT_Done_GlyphSlot( FT_GlyphSlot  slot );
 
+ /* */
+ 
+ /*
+  * free the bitmap of a given glyphslot when needed
+  * (i.e. only when it was allocated with ft_glyphslot_alloc_bitmap)
+  */
+  FT_BASE( void )
+  ft_glyphslot_free_bitmap( FT_GlyphSlot  slot );
+ 
+ /*
+  * allocate a new bitmap buffer in a glyph slot
+  */
+  FT_BASE( FT_Error )
+  ft_glyphslot_alloc_bitmap( FT_GlyphSlot  slot,
+                             FT_ULong      size );
+
+ /*
+  * set the bitmap buffer in a glyph slot to a given pointer.
+  * the buffer will not be freed by a later call to ft_glyphslot_free_bitmap
+  */
+  FT_BASE( void )
+  ft_glyphslot_set_bitmap( FT_GlyphSlot   slot,
+                           FT_Pointer     buffer );
+
 
   /*************************************************************************/
   /*************************************************************************/
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 433ebdb..32ae99b 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -198,19 +198,59 @@
     return error;
   }
 
-
-  static void
-  ft_glyphslot_clear( FT_GlyphSlot  slot )
+  FT_BASE_DEF( void )
+  ft_glyphslot_free_bitmap( FT_GlyphSlot  slot )
   {
-    /* free bitmap if needed */
     if ( slot->flags & FT_GLYPH_OWN_BITMAP )
     {
       FT_Memory  memory = FT_FACE_MEMORY( slot->face );
-
-
+      
+      
       FT_FREE( slot->bitmap.buffer );
       slot->flags &= ~FT_GLYPH_OWN_BITMAP;
     }
+    else
+    {
+      /* assume that the bitmap buffer was stolen or not */
+      /* allocated from the heap                         */
+      slot->bitmap.buffer = NULL;
+    }
+  }
+
+
+  FT_BASE_DEF( void )
+  ft_glyphslot_set_bitmap( FT_GlyphSlot  slot,
+                           FT_Pointer    buffer )
+  {
+    ft_glyphslot_free_bitmap( slot );
+    
+    slot->bitmap.buffer = buffer;
+    
+    FT_ASSERT( (slot->flags & FT_GLYPH_OWN_BITMAP) == 0 );
+  }                           
+
+
+  FT_BASE_DEF( FT_Error )
+  ft_glyphslot_alloc_bitmap( FT_GlyphSlot  slot,
+                             FT_ULong      size )
+  {
+    FT_Memory  memory = FT_FACE_MEMORY( slot->face );
+    
+    
+    if ( slot->flags & FT_GLYPH_OWN_BITMAP )
+      FT_FREE( slot->bitmap.buffer );
+    else
+      slot->flags |= FT_GLYPH_OWN_BITMAP;
+    
+    return FT_MEM_ALLOC( slot->bitmap.buffer, size );
+  }                             
+
+
+  static void
+  ft_glyphslot_clear( FT_GlyphSlot  slot )
+  {
+    /* free bitmap if needed */
+    ft_glyphslot_free_bitmap( slot );
 
     /* clear all public fields in the glyph slot */
     FT_ZERO( &slot->metrics );
@@ -248,8 +288,7 @@
       clazz->done_slot( slot );
 
     /* free bitmap buffer if needed */
-    if ( slot->flags & FT_GLYPH_OWN_BITMAP )
-      FT_FREE( slot->bitmap.buffer );
+    ft_glyphslot_free_bitmap( slot );
 
     /* free glyph loader */
     if ( FT_DRIVER_USES_OUTLINES( driver ) )
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index c156bd8..4f60266 100644
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -489,8 +489,6 @@ THE SOFTWARE.
     int             i, j, count;
     unsigned char   *p, *pp;
 
-    FT_Memory       memory = face->bdffont->memory;
-
     FT_UNUSED( load_flags );
 
 
@@ -514,9 +512,9 @@ THE SOFTWARE.
       bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
       bitmap->pitch      = glyph.bpr;
 
-      if ( FT_NEW_ARRAY( bitmap->buffer, glyph.bytes ) )
-        goto Exit;
-      FT_MEM_COPY( bitmap->buffer, glyph.bitmap, glyph.bytes );
+     /* note: we don't allocate a new array to hold the bitmap, we */
+     /*       can simply point to it                               */
+      ft_glyphslot_set_bitmap( slot, glyph.bitmap );
     }
     else
     {
@@ -524,7 +522,8 @@ THE SOFTWARE.
       bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
       bitmap->pitch      = bitmap->width;
 
-      if ( FT_NEW_ARRAY( bitmap->buffer, bitmap->rows * bitmap->pitch ) )
+      error = ft_glyphslot_alloc_bitmap( slot, bitmap->rows * bitmap->pitch );
+      if ( error )
         goto Exit;
 
       switch ( bpp )
@@ -625,7 +624,6 @@ THE SOFTWARE.
 
     slot->linearHoriAdvance = (FT_Fixed)glyph.dwidth << 16;
     slot->format            = FT_GLYPH_FORMAT_BITMAP;
-    slot->flags             = FT_GLYPH_OWN_BITMAP;
 
   Exit:
     return error;
diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c
index 47d6562..4eab0d9 100644
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -236,7 +236,7 @@
             goto Exit;
           }
 
-          FT_ASSERT( list->nodes > 0 );
+          FT_ASSERT( list->num_nodes > 0 );
 
           while ( node->next )
           {
diff --git a/src/pcf/pcfdriver.c b/src/pcf/pcfdriver.c
index ab2fef5..6f0b9e1 100644
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -355,7 +355,6 @@ THE SOFTWARE.
     PCF_Face    face   = (PCF_Face)FT_SIZE_FACE( size );
     FT_Stream   stream = face->root.stream;
     FT_Error    error  = PCF_Err_Ok;
-    FT_Memory   memory = FT_FACE( face )->memory;
     FT_Bitmap*  bitmap = &slot->bitmap;
     PCF_Metric  metric;
     int         bytes;
@@ -411,7 +410,8 @@ THE SOFTWARE.
     /* XXX: to do: are there cases that need repadding the bitmap? */
     bytes = bitmap->pitch * bitmap->rows;
 
-    if ( FT_ALLOC( bitmap->buffer, bytes ) )
+    error = ft_glyphslot_alloc_bitmap( slot, bytes );
+    if ( error )
       goto Exit;
 
     if ( FT_STREAM_SEEK( metric->bits )          ||
@@ -451,7 +451,6 @@ THE SOFTWARE.
 
     slot->linearHoriAdvance = (FT_Fixed)bitmap->width << 16;
     slot->format            = FT_GLYPH_FORMAT_BITMAP;
-    slot->flags             = FT_GLYPH_OWN_BITMAP;
 
     FT_TRACE4(( " --- ok\n" ));
 
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index 3a6e235..408b063 100644
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -645,11 +645,10 @@
 
         /* Allocate and read bitmap data */
         {
-          FT_Memory  memory = face->root.memory;
-          FT_Long    len    = glyph->root.bitmap.pitch * ysize;
+          FT_ULong    len    = glyph->root.bitmap.pitch * ysize;
 
-
-          if ( !FT_ALLOC( glyph->root.bitmap.buffer, len ) )
+          error = ft_glyphslot_alloc_bitmap( &glyph->root, len );
+          if ( !error )
           {
             error = pfr_load_bitmap_bits( p,
                                           stream->limit,
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index a554060..9cfa92b 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -1212,14 +1212,16 @@
                    TT_SBit_Range    range,
                    FT_ULong         ebdt_pos,
                    FT_ULong         glyph_offset,
-                   FT_Bitmap*       map,
+                   FT_GlyphSlot     slot,
                    FT_Int           x_offset,
                    FT_Int           y_offset,
                    FT_Stream        stream,
-                   TT_SBit_Metrics  metrics )
+                   TT_SBit_Metrics  metrics,
+                   FT_Int           depth )
   {
-    FT_Memory  memory = stream->memory;
-    FT_Error   error;
+    FT_Memory   memory = stream->memory;
+    FT_Bitmap*  map    = &slot->bitmap;
+    FT_Error    error;
 
 
     /* place stream at beginning of glyph data and read metrics */
@@ -1230,11 +1232,10 @@
     if ( error )
       goto Exit;
 
-    /* this function is recursive.  At the top-level call, the */
-    /* field map.buffer is NULL.  We thus begin by finding the */
-    /* dimensions of the higher-level glyph to allocate the    */
-    /* final pixmap buffer                                     */
-    if ( map->buffer == 0 )
+    /* this function is recursive.  At the top-level call, we  */
+    /* compute the dimensions of the higher-level glyph to     */
+    /* allocate the final pixmap buffer                        */
+    if ( depth == 0 )
     {
       FT_Long  size;
 
@@ -1274,7 +1275,8 @@
       if ( size == 0 )
         goto Exit;     /* exit successfully! */
 
-      if ( FT_ALLOC( map->buffer, size ) )
+      error = ft_glyphslot_alloc_bitmap( slot, size );
+      if (error)
         goto Exit;
     }
 
@@ -1348,11 +1350,12 @@
                                  elem_range,
                                  ebdt_pos,
                                  elem_offset,
-                                 map,
+                                 slot,
                                  x_offset + comp->x_offset,
                                  y_offset + comp->y_offset,
                                  stream,
-                                 &elem_metrics );
+                                 &elem_metrics,
+                                 depth+1 );
         if ( error )
           goto Fail_Memory;
       }
@@ -1409,7 +1412,6 @@
                            TT_SBit_MetricsRec  *metrics )
   {
     FT_Error        error;
-    FT_Memory       memory = stream->memory;
     FT_ULong        ebdt_pos, glyph_offset;
 
     TT_SBit_Strike  strike;
@@ -1432,20 +1434,11 @@
 
     ebdt_pos = FT_STREAM_POS();
 
-    /* clear the bitmap & load the bitmap */
-    if ( face->root.glyph->flags & FT_GLYPH_OWN_BITMAP )
-      FT_FREE( map->buffer );
-
-    map->rows = map->pitch = map->width = 0;
-
     error = Load_SBit_Image( strike, range, ebdt_pos, glyph_offset,
-                             map, 0, 0, stream, metrics );
+                             face->root.glyph, 0, 0, stream, metrics, 0 );
     if ( error )
       goto Exit;
 
-    /* the glyph slot owns this bitmap buffer */
-    face->root.glyph->flags |= FT_GLYPH_OWN_BITMAP;
-
     /* setup vertical metrics if needed */
     if ( strike->flags & 1 )
     {
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index dcc8077..c485634 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -560,17 +560,10 @@
 
 
   static void
-  ft_glyphslot_clear( FT_GlyphSlot  slot )
+  t42_glyphslot_clear( FT_GlyphSlot  slot )
   {
     /* free bitmap if needed */
-    if ( slot->flags & FT_GLYPH_OWN_BITMAP )
-    {
-      FT_Memory  memory = FT_FACE_MEMORY( slot->face );
-
-
-      FT_FREE( slot->bitmap.buffer );
-      slot->flags &= ~FT_GLYPH_OWN_BITMAP;
-    }
+    ft_glyphslot_free_bitmap( slot );
 
     /* clear all public fields in the glyph slot */
     FT_ZERO( &slot->metrics );
@@ -603,7 +596,7 @@
     FT_Driver_Class  ttclazz = ((T42_Driver)glyph->face->driver)->ttclazz;
 
 
-    ft_glyphslot_clear( t42slot->ttslot );
+    t42_glyphslot_clear( t42slot->ttslot );
     error = ttclazz->load_glyph( t42slot->ttslot,
                                  t42size->ttsize,
                                  glyph_index,
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 7b2a0e4..a82f5eb 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -618,32 +618,18 @@
 
     /* allocate and build bitmap */
     {
-      FT_Memory  memory = FT_FACE_MEMORY( slot->face );
       FT_Int     pitch  = ( bitmap->width + 7 ) >> 3;
-      FT_Byte*   column;
-      FT_Byte*   write;
 
 
       bitmap->pitch      = pitch;
       bitmap->rows       = font->header.pixel_height;
       bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
 
-      if ( FT_ALLOC( bitmap->buffer, pitch * bitmap->rows ) )
-        goto Exit;
-
-      column = (FT_Byte*)bitmap->buffer;
-
-      for ( ; pitch > 0; pitch--, column++ )
-      {
-        FT_Byte*  limit = p + bitmap->rows;
-
-
-        for ( write = column; p < limit; p++, write += bitmap->pitch )
-          write[0] = p[0];
-      }
+      /* note: we don't allocate a new buffer for the bitmap since we */
+      /*       already store the images in the FT_Face                */
+      ft_glyphslot_set_bitmap( slot, p );
     }
 
-    slot->flags       = FT_GLYPH_OWN_BITMAP;
     slot->bitmap_left = 0;
     slot->bitmap_top  = font->header.ascent;
     slot->format      = FT_GLYPH_FORMAT_BITMAP;