Commit f9ca2bb58a3c8e70cf5e0e0d2580c50385c48df0

David Turner 2000-06-30T23:12:55

managed to re-design entirely the API in <freetype/ftglyph.h> It is now really the "glyph factory" that Stefan was probably dreaming about.. fixed some recent formatting errors from Werner ;-) cleaned up the demonstration programs from most of the rust that they had, though I'm sure someone is going to re-format them really soon !! "ftstring" now uses the new ftglyph.h API, and is now faster and smaller.. yep..

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
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
diff --git a/demos/src/ftmulti.c b/demos/src/ftmulti.c
index ebc19dc..7cca053 100644
--- a/demos/src/ftmulti.c
+++ b/demos/src/ftmulti.c
@@ -152,83 +152,51 @@
   char  bit_buffer[MAX_BUFFER];
 
 
-  /* Render a single glyph with the "grays" component */
+  /* Render a single glyph with the `grays' component */
   static
   FT_Error  Render_Glyph( int  x_offset,
                           int  y_offset )
   {
-    FT_Bitmap  bit2;
-    grBitmap   bit3;
-    int        width, height, pitch, size;
-    int        left, right, top, bottom;
-    int        x_top, y_top;
-
-    /* first, render the glyph into an intermediate buffer */
-
-    left  = FLOOR( glyph->metrics.horiBearingX );
-    right = CEIL( glyph->metrics.horiBearingX + glyph->metrics.width );
-    width = TRUNC( right - left );
-
-    top    = CEIL( glyph->metrics.horiBearingY );
-    bottom = FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height );
-    height = TRUNC( top - bottom );
-
-    if ( glyph->format == ft_glyph_format_outline )
+    grBitmap  bit3;
+    FT_Pos    x_top, y_top;
+    
+    /* first, render the glyph image into a bitmap */
+    if (glyph->format != ft_glyph_format_bitmap)
     {
-      pitch = antialias ? ( width + 3 ) & -4
-                        : ( width + 7 ) >> 3;
-      size  = pitch * height;
-
-      if ( size > MAX_BUFFER )
-        return FT_Err_Out_Of_Memory;
-
-      bit2.width      = width;
-      bit2.rows       = height;
-      bit2.pitch      = pitch;
-      bit2.pixel_mode = antialias ? ft_pixel_mode_grays : ft_pixel_mode_mono;
-      bit2.buffer     = bit_buffer;
-
-      bit3.rows   = bit2.rows;
-      bit3.width  = bit2.width;
-      bit3.pitch  = bit2.pitch;
-      bit3.mode   = antialias ? bit.mode : gr_pixel_mode_mono;
-      bit3.buffer = bit_buffer;
-      bit3.grays  = 256;
-
-      FT_Outline_Translate( &glyph->outline, -left, -bottom );
-      memset( bit_buffer, 0, size );
-
-      if ( low_prec )
-        glyph->outline.flags &= ~ft_outline_high_precision;
-
-      error = FT_Outline_Get_Bitmap( library, &glyph->outline, &bit2 );
+      error = FT_Render_Glyph( glyph, antialias ? ft_render_mode_normal : ft_render_mode_mono );
+      if (error) return error;                               
+                               
     }
-    else
+    
+    /* now blit it to our display screen */
+    bit3.rows   = glyph->bitmap.rows;
+    bit3.width  = glyph->bitmap.width;
+    bit3.pitch  = glyph->bitmap.pitch;
+    bit3.buffer = glyph->bitmap.buffer;
+
+    switch (glyph->bitmap.pixel_mode)
     {
-      bit3.rows   = glyph->bitmap.rows;
-      bit3.width  = glyph->bitmap.width;
-      bit3.pitch  = glyph->bitmap.pitch;
-      bit3.mode   = gr_pixel_mode_mono;
-      bit3.buffer = glyph->bitmap.buffer;
-      bit3.grays  = 0;
+      case ft_pixel_mode_mono:
+         bit3.mode   = gr_pixel_mode_mono;
+         bit3.grays  = 0;
+         break;
+         
+      case ft_pixel_mode_grays:
+         bit3.mode   = gr_pixel_mode_gray;
+         bit3.grays  = glyph->bitmap.num_grays;
     }
 
-    /* then, blit the image to the target surface */
-
-    x_top = x_offset + TRUNC( left );
-    y_top = y_offset - TRUNC( top );
-
-#if 0
-    if ( bit.pitch < 0 )
-      y_top = bit.rows - y_top;
-#endif
+    /* Then, blit the image to the target surface */
+    x_top = x_offset + glyph->bitmap_left;
+    y_top = y_offset - glyph->bitmap_top;
 
     grBlitGlyphToBitmap( &bit, &bit3, x_top, y_top, fore_color );
 
-    return FT_Err_Ok;
+    return 0;
   }
 
 
+
   static
   FT_Error  Reset_Scale( int  pointSize )
   {
@@ -239,11 +207,6 @@
                                     pointSize << 6,
                                     res,
                                     res );
-    if ( error )
-    {
-      /* to be written */
-    }
-
     return FT_Err_Ok;
   }
 
diff --git a/demos/src/ftstring.c b/demos/src/ftstring.c
index 3478f5c..61c7c75 100644
--- a/demos/src/ftstring.c
+++ b/demos/src/ftstring.c
@@ -209,10 +209,12 @@
 
       if (!glyph->image) continue;
 
-      x = glyph->pos.x >> 6;
-      y = glyph->pos.y >> 6;
+      x = glyph->pos.x;
+      y = glyph->pos.y;
 
-      FT_Glyph_Get_Box( glyph->image, &cbox );
+      FT_Glyph_Get_CBox( glyph->image,
+                         ft_glyph_bbox_gridfit,
+                         &cbox );
 
       cbox.xMin += x;
       cbox.yMin += y;
@@ -230,7 +232,7 @@
 
  /**************************************************************
   *
-  *  Layout a string of glyphs
+  *  Layout a string of glyphs, the glyphs are untransformed..
   *
   */
   static void  layout_glyphs( void )
@@ -261,9 +263,9 @@
         {
           FT_Vector  kern;
 
-          FT_Get_Kerning( face, prev_index, glyph->glyph_index, &kern );
-          kern.x = FT_MulFix( kern.x, face->size->metrics.x_scale );
-          if (hinted) kern.x = (kern.x+32) & -64;
+          FT_Get_Kerning( face, prev_index, glyph->glyph_index,
+                          hinted ? ft_kerning_default : ft_kerning_unfitted,
+                          &kern );
 
           origin_x += kern.x;
         }
@@ -273,28 +275,24 @@
       origin.x = origin_x;
       origin.y = 0;
 
-      if (transform)
-        FT_Vector_Transform( &origin, &trans_matrix );
-
       /* clear existing image if there is one */
       if (glyph->image)
         FT_Done_Glyph(glyph->image);
 
-      /* load the glyph image                       */
-      /* for now, we take a monochrome glyph bitmap */
-      error = FT_Get_Glyph_Bitmap( face, glyph->glyph_index,
-                                   load_flags,
-                                   num_grays,
-                                   &origin,
-                                   (FT_BitmapGlyph*)&glyph->image );
+      /* load the glyph image (in its native format) */
+      /* for now, we take a monochrome glyph bitmap  */
+      error = FT_Load_Glyph( face, glyph->glyph_index,
+                             hinted ? FT_LOAD_DEFAULT : FT_LOAD_NO_HINTING ) ||
+              FT_Get_Glyph ( face->glyph, &glyph->image );
       if (error) continue;
 
       glyph->pos = origin;
 
-      origin_x  += glyph->image->advance;
+      origin_x  += face->glyph->advance.x;
     }
     string_center.x = origin_x / 2;
     string_center.y = 0;
+    
     if (transform)
       FT_Vector_Transform( &string_center, &trans_matrix );
   }
@@ -309,62 +307,81 @@
     PGlyph    glyph = glyphs;
     grBitmap  bit3;
     int       n;
+    FT_Vector delta;
+
+    /* first of all, we must compute the general delta for the glyph */
+    /* set..                                                         */
+    delta.x = (x << 6) - string_center.x;
+    delta.y = ((bit.rows-y) << 6) - string_center.y;
 
     for ( n = 0; n < num_glyphs; n++, glyph++ )
     {
+      FT_Glyph   image;
+      FT_Vector  vec;
+      
       if (!glyph->image)
         continue;
 
-      switch (glyph->image->glyph_type)
+     /* copy image */
+      error = FT_Glyph_Copy( glyph->image, &image );
+      if (error) continue;
+      
+     /* transform it */
+      vec = glyph->pos;
+      FT_Vector_Transform( &vec, &trans_matrix );
+      vec.x += delta.x;
+      vec.y += delta.y;
+      error = FT_Glyph_Transform( image, &trans_matrix, &vec );
+      if (!error)
       {
-        case ft_glyph_type_bitmap:
+        FT_BBox  bbox;
+        
+        /* check bounding box, if it's not within the display surface, we */
+        /* don't need to render it..                                      */
+        
+        FT_Glyph_Get_CBox( image, ft_glyph_bbox_pixels, &bbox );
+        
+        if ( bbox.xMax > 0         && bbox.yMax > 0        &&
+             bbox.xMin < bit.width && bbox.yMin < bit.rows )
+        {             
+          /* convert to a bitmap - destroy native image */
+          error = FT_Glyph_To_Bitmap( &image,
+                                      ft_render_mode_normal,
+                                      0, 1 );
+          if (!error)
           {
-            /* this is a bitmap, we simply blit it to our target surface */
-            FT_BitmapGlyph  bitm   = (FT_BitmapGlyph)glyph->image;
-            FT_Bitmap*      source = &bitm->bitmap;
+            FT_BitmapGlyph  bitmap = (FT_BitmapGlyph)image;
+            FT_Bitmap*      source = &bitmap->bitmap;
             FT_Pos          x_top, y_top;
-
+    
             bit3.rows   = source->rows;
             bit3.width  = source->width;
             bit3.pitch  = source->pitch;
             bit3.buffer = source->buffer;
-
+    
             switch (source->pixel_mode)
             {
               case ft_pixel_mode_mono:
                 bit3.mode  = gr_pixel_mode_mono;
                 break;
-
+    
               case ft_pixel_mode_grays:
                 bit3.mode  = gr_pixel_mode_gray;
                 bit3.grays = source->num_grays;
                 break;
-
+    
               default:
                 continue;
             }
-
+    
             /* now render the bitmap into the display surface */
-            x_top = x + (glyph->pos.x >> 6) + bitm->left;
-            y_top = y - (glyph->pos.y >> 6) - bitm->top;
+            x_top = bitmap->left;
+            y_top = bit.rows - bitmap->top;
             grBlitGlyphToBitmap( &bit, &bit3, x_top, y_top, fore_color );
           }
-          break;
-#if 0
-        case ft_glyph_type_outline:
-          {
-            /* in the case of outlines, we directly render it into the */
-            /* target surface with the smooth renderer..               */
-            FT_OutlineGlyph  out = (FT_OutlineGlyph)glyph->image;
-
-            FT_Outline_Translate( (x+pen_pos[n]) << 6, (y+
-            error = FT_Outline_Render(
-          }
-          break;
-#endif
-        default:
-          ;
+        }
       }
+      FT_Done_Glyph( image );
     }
   }
 
@@ -407,8 +424,6 @@
     trans_matrix.xy = -sinus;
     trans_matrix.yx = sinus;
     trans_matrix.yy = cosinus;
-
-    FT_Set_Transform(face,&trans_matrix, 0);
   }
 
 /****************************************************************************/
@@ -723,8 +738,7 @@
           reset_transform();
           layout_glyphs();
           compute_bbox( &bbox );
-          render_string( (bit.width-(string_center.x >> 5))/2,
-                         (bit.rows +(string_center.y >> 5))/2 );
+          render_string( bit.width/2, bit.rows/2 );
         }
 
         sprintf( Header, "%s %s (file %s)",
diff --git a/demos/src/fttimer.c b/demos/src/fttimer.c
index 77d1367..b8a5ed1 100644
--- a/demos/src/fttimer.c
+++ b/demos/src/fttimer.c
@@ -20,15 +20,13 @@
 /****************************************************************************/
 
 #include <freetype/freetype.h>
-#include <freetype/ftrender.h>
+#include <freetype/ftglyph.h>
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>    /* for clock() */
 
-#include "graph.h"
-
 /* SunOS 4.1.* does not define CLOCKS_PER_SEC, so include <sys/param.h> */
 /* to get the HZ macro which is the equivalent.                         */
 #if defined(__sun__) && !defined(SVR4) && !defined(__SVR4)
@@ -45,51 +43,28 @@
   FT_Library    library;
 
   FT_Face       face;
-  FT_Size       size;
-  FT_GlyphSlot  glyph;
-
-  FT_Outline    outline;
-
-  FT_Pos*   cur_x;
-  FT_Pos*   cur_y;
-
-  unsigned short*  cur_endContour;
-  unsigned char*   cur_touch;
-
-  FT_Outline  outlines[MAX_GLYPHS];
 
   int             num_glyphs;
+  FT_Glyph        glyphs[MAX_GLYPHS];
+  
   int             tab_glyphs;
   int             cur_glyph;
-  int             cur_point;
-  unsigned short  cur_contour;
 
   int             pixel_size   = CHARSIZE;
   int             repeat_count = 1;
-  int             use_grays    = 0;
-
-  FT_Bitmap      Bit;
-  grBitmap       bit;
 
   int  Fail;
   int  Num;
 
-  int  vio_Height, vio_Width;
-
-  short  visual;      /* display glyphs while rendering */
-  short  antialias; /* smooth fonts with gray levels  */
+  short  antialias = 1; /* smooth fonts with gray levels  */
   short  force_low;
 
 
-#define RASTER_BUFF_SIZE   128000
-  char     raster_buff[ RASTER_BUFF_SIZE ];
-
-
-  static void Clear_Buffer();
-
-  static void Panic( const char* message )
+  static
+  void  Panic( const char*  message )
   {
-    fprintf( stderr, "%s\n  error code = 0x%04x\n", message, error );
+    fprintf( stderr, "%s\n", message );
+    exit(1);
   }
 
 /*******************************************************************/
@@ -106,45 +81,10 @@
   }
 
 
-/*******************************************************************/
-/*                                                                 */
-/*  Init_Engine:                                                   */
-/*                                                                 */
-/*    Allocates bitmap, render pool and other structs...           */
-/*                                                                 */
-/*******************************************************************/
-
-  void  Init_Engine( void )
-  {
-    Bit.rows       = bit.rows;
-    Bit.width      = bit.width;
-    Bit.pitch      = bit.pitch;
-    Bit.buffer     = bit.buffer;
-    Bit.pixel_mode = antialias ? ft_pixel_mode_grays : ft_pixel_mode_mono;
-    Bit.num_grays  = bit.grays;
-    Clear_Buffer();
-  }
-
 
 /*******************************************************************/
 /*                                                                 */
-/*  Clear_Buffer:                                                  */
-/*                                                                 */
-/*    Clears current bitmap.                                       */
-/*                                                                 */
-/*******************************************************************/
-
-  static void  Clear_Buffer( void )
-  {
-    long size = Bit.rows * Bit.pitch;
-
-    memset( Bit.buffer, 0, size );
-  }
-
-
-/*******************************************************************/
-/*                                                                 */
-/*  LoadTrueTypeChar:                                              */
+/*  LoadChar:                                                      */
 /*                                                                 */
 /*    Loads a glyph into memory.                                   */
 /*                                                                 */
@@ -152,60 +92,20 @@
 
   FT_Error  LoadChar( int  idx )
   {
-    error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT );
-    if ( error )
-      return error;
-
-    glyph->outline.flags |= ft_outline_single_pass |
-                                    ft_outline_ignore_dropouts;
-
-    if (force_low)
-      glyph->outline.flags &= ~ft_outline_high_precision;
-
-    /* debugging */
-#if 0
-    if ( idx == 0 && !visual )
-    {
-      printf( "points = %d\n", outline.points );
-      for ( j = 0; j < outline.points; j++ )
-        printf( "%02x  (%01hx,%01hx)\n",
-                 j, outline.xCoord[j], outline.yCoord[j] );
-      printf( "\n" );
-    }
-#endif
-
-    /* create a new outline */
-    FT_Outline_New( library,
-                    glyph->outline.n_points,
-                    glyph->outline.n_contours,
-                    &outlines[cur_glyph] );
-
-    /* copy the glyph outline into it */
-    glyph->outline.flags |= ft_outline_single_pass;
-    if (force_low)
-      glyph->outline.flags &= ~ft_outline_high_precision;
-
-    FT_Outline_Copy( &glyph->outline, &outlines[cur_glyph] );
-
-    /* center outline around 0 */
+    FT_Glyph  glyph;
+    
+    /* loads the glyph in the glyph slot */
+    error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||
+            FT_Get_Glyph ( face->glyph, &glyph );
+    if ( !error )
     {
-      FT_BBox  bbox;
-
-      FT_Outline_Get_CBox( &glyph->outline, &bbox );
-      FT_Outline_Translate( &outlines[cur_glyph],
-                            - ( bbox.xMax - bbox.xMin )/2,
-                            - ( bbox.yMax - bbox.yMin )/2 );
+      glyphs[cur_glyph++] = glyph;
     }
-    /* translate it */
-    FT_Outline_Translate( &outlines[cur_glyph],
-                          Bit.width * 32 ,
-                          Bit.rows  * 32 );
-    cur_glyph++;
-
-    return FT_Err_Ok;
+    return error;
   }
 
 
+
 /*******************************************************************/
 /*                                                                 */
 /*  ConvertRaster:                                                 */
@@ -216,8 +116,19 @@
 
   FT_Error  ConvertRaster( int  index )
   {
-    outlines[index].flags |= ~ft_outline_single_pass;
-    return FT_Outline_Get_Bitmap( library, &outlines[index], &Bit );
+    FT_Glyph  bitmap;
+    FT_Error  error;
+    
+    bitmap = glyphs[index];
+    error = FT_Glyph_To_Bitmap( &bitmap,
+                                antialias ? ft_render_mode_normal
+                                          : ft_render_mode_mono,
+                                0,
+                                0 );
+    if (!error)
+      FT_Done_Glyph( bitmap );
+      
+    return error;
   }
 
 
@@ -229,8 +140,7 @@
       fprintf( stderr, "options:\n");
       fprintf( stderr, "   -r : repeat count to be used (default is 1)\n" );
       fprintf( stderr, "   -s : character pixel size (default is 600)\n" );
-      fprintf( stderr, "   -v : display results..\n" );
-      fprintf( stderr, "   -g : render anti-aliased glyphs\n" );
+      fprintf( stderr, "   -m : render monochrome glyphs (default is anti-aliased)\n" );
       fprintf( stderr, "   -a : use smooth anti-aliaser\n" );
       fprintf( stderr, "   -l : force low quality even at small sizes\n" );
       exit(1);
@@ -243,37 +153,27 @@
     char   filename[128 + 4];
     char   alt_filename[128 + 4];
     char*  execname;
-    grSurface*  surface = 0;
 
     long   t, t0, tz0;
 
 
     execname    = argv[0];
 
-    antialias = 0;
-    visual      = 0;
-    force_low   = 0;
+    antialias = 1;
+    force_low = 0;
 
     while ( argc > 1 && argv[1][0] == '-' )
     {
       switch ( argv[1][1] )
       {
-      case 'g':
-        antialias = 1;
-        break;
-
-      case 'a':
-        use_grays = 1;
+      case 'm':
+        antialias = 0;
         break;
 
       case 'l':
         force_low = 1;
         break;
 
-      case 'v':
-        visual = 1;
-        break;
-
       case 's':
         argc--;
         argv++;
@@ -328,17 +228,6 @@
     if ( (error = FT_Init_FreeType( &library )) )
       Panic( "Error while initializing engine" );
 
-    /* set-up smooth anti-aliaser */
-    if (use_grays)
-    {
-      FT_Renderer  smooth;
-      
-      smooth = (FT_Renderer)FT_Get_Module( library, "smooth renderer" );
-      if (!smooth) Panic( "Could not initialize smooth anti-aliasing renderer" );
-      
-      FT_Set_Renderer( library, smooth, 0, 0 );
-    }
-
     /* Load face */
 
     error = FT_New_Face( library, filename, 0, &face );
@@ -350,7 +239,6 @@
     /* get face properties and allocate preload arrays */
 
     num_glyphs = face->num_glyphs;
-    glyph      = face->glyph;
 
     tab_glyphs = MAX_GLYPHS;
     if ( tab_glyphs > num_glyphs )
@@ -361,32 +249,6 @@
     error = FT_Set_Pixel_Sizes( face, pixel_size, pixel_size );
     if ( error ) Panic( "Could not reset instance" );
 
-    bit.mode  = antialias ? gr_pixel_mode_gray : gr_pixel_mode_mono;
-    bit.width = 640;
-    bit.rows  = 480;
-    bit.grays = 128;
-
-    if ( visual )
-    {
-      if ( !grInitDevices() )
-        Panic( "Could not initialize graphics.\n" );
-
-      surface = grNewSurface( 0, &bit );
-      if (!surface)
-        Panic( "Could not open graphics window/screen.\n" );
-    }
-    else
-    {
-      if ( grNewBitmap( bit.mode,
-                        bit.grays,
-                        bit.width,
-                        bit.rows,
-                       &bit ) )
-        Panic( "Could not create rendering buffer.\n" );
-    }
-
-    Init_Engine();
-
     Num  = 0;
     Fail = 0;
 
@@ -405,8 +267,6 @@
 
       /* First, preload 'tab_glyphs' in memory */
       cur_glyph   = 0;
-      cur_point   = 0;
-      cur_contour = 0;
 
       printf( "loading %d glyphs", tab_glyphs );
 
@@ -440,14 +300,6 @@
           else
   	  {
             rendered_glyphs ++;
-
-            if ( Num == 0 && visual )
-            {
-              sprintf( Header, "Glyph: %5d", Num );
-              grSetTitle( surface, Header );
-              grRefreshSurface( surface );
-              Clear_Buffer();
-            }
 	  }
         }
       }
@@ -461,7 +313,7 @@
 
       /* Now free all loaded outlines */
       for ( Num = 0; Num < cur_glyph; Num++ )
-        FT_Outline_Done( library, &outlines[Num] );
+        FT_Done_Glyph( glyphs[Num] );
     }
 
     tz0 = Get_Time() - tz0;
diff --git a/demos/src/ftview.c b/demos/src/ftview.c
index e1e2690..074a62a 100644
--- a/demos/src/ftview.c
+++ b/demos/src/ftview.c
@@ -158,7 +158,7 @@
     /* first, render the glyph image into a bitmap */
     if (glyph->format != ft_glyph_format_bitmap)
     {
-      error = FT_Render_Glyph( glyph, antialias ? 1 : 0 );
+      error = FT_Render_Glyph( glyph, antialias ? ft_render_mode_normal : ft_render_mode_mono );
       if (error) return error;                               
                                
     }
diff --git a/demos/src/memtest.c b/demos/src/memtest.c
index b37afb7..ad60059 100644
--- a/demos/src/memtest.c
+++ b/demos/src/memtest.c
@@ -1,16 +1,15 @@
 /* memtest.c */
 
 #include <freetype/freetype.h>
-#include <freetype/internal/ftobjs.h>
+#include <freetype/ftmodule.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
   FT_Error      error;
 
   FT_Library    library;
   FT_Face       face;
-  FT_Size       size;
-  FT_GlyphSlot  slot;
 
   unsigned int  num_glyphs;
   int           ptsize;
@@ -18,7 +17,6 @@
   int  Fail;
   int  Num;
 
-  extern void FT_Add_Default_Modules( FT_Library  library );
 
 
 
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 884089a..bc101ca 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -39,18 +39,7 @@
 #define FREETYPE_MINOR 0
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* To make freetype.h independent from configuration files we check      */
-  /* whether FT_EXPORT_DEF has been defined already.                          */
-  /*                                                                       */
-  /* On some systems and compilers (Win32 mostly), an extra keyword is     */
-  /* necessary to compile the library as a DLL.                            */
-  /*                                                                       */
-#ifndef FT_EXPORT_DEF
-#define FT_EXPORT_DEF(x)  extern  x
-#endif
-
+#include <freetype/config/ftconfig.h>   /* read configuration information */
 #include <freetype/fterrors.h>
 #include <freetype/fttypes.h>
 
@@ -335,7 +324,7 @@
   typedef enum  FT_Encoding_
   {
     ft_encoding_none    = 0,
-    ft_encoding_symbol  = 0,
+    ft_encoding_symbol  = FT_MAKE_TAG('s','y','m','b'),
     ft_encoding_unicode = FT_MAKE_TAG('u','n','i','c'),
     ft_encoding_latin_2 = FT_MAKE_TAG('l','a','t','2'),
     ft_encoding_sjis    = FT_MAKE_TAG('s','j','i','s'),
@@ -344,9 +333,9 @@
     ft_encoding_wansung = FT_MAKE_TAG('w','a','n','s'),
     ft_encoding_johab   = FT_MAKE_TAG('j','o','h','a'),
 
-    ft_encoding_adobe_standard = FT_MAKE_TAG('a','d','o','b'),
-    ft_encoding_adobe_expert   = FT_MAKE_TAG('a','d','b','e'),
-    ft_encoding_adobe_custom   = FT_MAKE_TAG('a','d','b','c'),
+    ft_encoding_adobe_standard = FT_MAKE_TAG('A','D','O','B'),
+    ft_encoding_adobe_expert   = FT_MAKE_TAG('A','D','B','E'),
+    ft_encoding_adobe_custom   = FT_MAKE_TAG('A','D','B','C'),
 
     ft_encoding_apple_roman    = FT_MAKE_TAG('a','r','m','n')
 
@@ -995,6 +984,9 @@
   /*    vectorial or bitmap/graymaps..                                     */
   /*                                                                       */
   /* <Fields>                                                              */
+  /*    library  :: a handle to the FreeType library instance this slot    */
+  /*                belongs to.                                            */
+  /*                                                                       */
   /*    face     :: A handle to the parent face object.                    */
   /*                                                                       */
   /*    next     :: In some cases (like some font tools), several glyph    */
@@ -1111,6 +1103,7 @@
 
   typedef struct  FT_GlyphSlotRec_
   {
+    FT_Library        library;
     FT_Face           face;
     FT_GlyphSlot      next;
     FT_UInt           flags;
@@ -1813,8 +1806,23 @@
   /*    glyph loader to use 'ft_render_mode_antialias' when calling        */
   /*    FT_Render_Glyph.                                                   */
   /*                                                                       */
+  /*    THIS IS NOW 0, AS ANTI-ALIASED RENDERING IS NOW THE DEFAULT..      */
+  /*                                                                       */
+#define FT_LOAD_ANTI_ALIAS  0  /* this is the default */
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Constant>                                                            */
+  /*    FT_LOAD_MONOCHROME                                                 */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Only used with FT_LOAD_RENDER set, indicates that the returned     */
+  /*    glyph image should be 1-bit monochrome. This really tells the      */
+  /*    glyph loader to use 'ft_render_mode_mono' when calling             */
+  /*    FT_Render_Glyph.                                                   */
+  /*                                                                       */
   /*                                                                       */
-#define FT_LOAD_ANTI_ALIAS  4096
+#define FT_LOAD_MONOCHROME  0  /* this is the default */
 
 
   /*************************************************************************/
@@ -1867,6 +1875,11 @@
   /* <Note>                                                                */
   /*    The transformation is only applied to scalable image formats.      */
   /*                                                                       */
+  /*    The transformation is simply applied to the glyph after it is      */
+  /*    loaded. It means that hinting is unaltered by the transform and    */
+  /*    is performed on the character size given in the last call to       */
+  /*    FT_Set_Char_Sizes or FT_Set_Pixel_Sizes                            */
+  /*                                                                       */
   FT_EXPORT_DEF( void )  FT_Set_Transform( FT_Face     face,
                                            FT_Matrix*  matrix,
                                            FT_Vector*  delta );
@@ -1874,6 +1887,46 @@
 
  /*************************************************************************
   *
+  *  <Enum>
+  *     FT_Render_Mode
+  *
+  *  <Description>
+  *     An enumeration type that lists the render modes supported by the  
+  *     FreeType 2 renderer(s). A renderer is in charge of converting a
+  *     glyph image into a bitmap..
+  *
+  *  <Fields>
+  *     ft_render_mode_normal   :: this is the default render mode,
+  *                                it corresponds to 8-bit anti-aliased
+  *                                bitmaps, using 256 levels of gray.
+  *
+  *     ft_render_mode_mono     :: this render mode is used to produce
+  *                                1-bit monochrome bitmaps
+  *
+  *  <Note>
+  *     There is no render mode to produce 8-bit "monochrome" bitmaps,
+  *     you'll have to make the conversion yourself if you need such
+  *     things (besides, FreeType is not a graphics library..)
+  *
+  *     More modes might appear later for specific display modes (e.g.
+  *     TV, LCDs, etc..). They will be supported through the simple
+  *     addition of a renderer module, with no changes to the rest of
+  *     the engine..
+  *
+  *
+  *************************************************************************/
+  
+  typedef enum FT_Render_Mode_
+  {
+    ft_render_mode_normal = 0,
+    ft_render_mode_mono   = 1
+    
+  } FT_Render_Mode;
+
+  
+
+ /*************************************************************************
+  *
   *  <Function>
   *     FT_Render_Glyph
   *
@@ -1885,29 +1938,46 @@
   *     slot        :: handle to the glyph slot containing the image to
   *                    convert
   *
-  *     render_mode :: a set of bit flags indicating which kind of bitmap
-  *                    to render. For now, only 'ft_render_mode_anti_alias'
-  *                    is supported by the available renderers, but others
-  *                    could appear later (e.g. LCD or TV optimised)
+  *     render_mode :: this is the render mode used to render the glyph image
+  *                    into a bitmap. See FT_Render_Mode for possible values.
   *
   *  <Return>
   *     Error code. 0 means success.
   *
-  *  <Note>
-  *     in case of success, the renderer will be used to convert glyph
-  *     images in the renderer's known format into bitmaps.
-  *
-  *     This doesn't change the current renderer for other formats..
-  *
-  *     The slot's native image should be considered lost after the
-  *     conversion..
-  *
   *************************************************************************/
   
   FT_EXPORT_DEF(FT_Error)  FT_Render_Glyph( FT_GlyphSlot  slot,
                                             FT_UInt       render_mode );
 
-                                            
+
+ /**************************************************************************
+  *
+  *  <Enum>
+  *     FT_Kerning_Mode
+  *
+  *  <Description>
+  *     A list of enumerations used to specify which kerning values to
+  *     return in FT_Get_Kerning
+  *
+  *  <Field>
+  *     ft_kerning_default  :: used to returned scaled and grid-fitted kerning
+  *                            distances. (value is 0)
+  *
+  *     ft_kerning_unfitted :: used to returned scaled by un-grid-fitted
+  *                            kerning distances.
+  *
+  *     ft_kerning_unscaled :: used to return the kerning vector in original
+  *                            font units..
+  *
+  **************************************************************************/
+  typedef enum FT_Kerning_Mode_
+  {
+    ft_kerning_default  = 0,
+    ft_kerning_unfitted,
+    ft_kerning_unscaled
+    
+  } FT_Kerning_Mode;
+
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -1923,6 +1993,9 @@
   /*                                                                       */
   /*    right_glyph :: The index of the right glyph in the kern pair.      */
   /*                                                                       */
+  /*    kern_mode   :: see FT_Kerning_Mode for more info. Determines the   */
+  /*                   scale/dimension of the returned kerning vector      */
+  /*                                                                       */
   /* <Output>                                                              */
   /*    kerning     :: The kerning vector.  This is in font units for      */
   /*                   scalable formats, and in pixels for fixed-sizes     */
@@ -1940,6 +2013,7 @@
   FT_EXPORT_DEF(FT_Error)  FT_Get_Kerning( FT_Face     face,
                                            FT_UInt     left_glyph,
                                            FT_UInt     right_glyph,
+                                           FT_UInt     kern_mode,
                                            FT_Vector*  kerning );
 
 
@@ -2120,468 +2194,6 @@
                                             FT_Matrix*  matrix );
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Get_Bitmap                                              */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Renders an outline within a bitmap.  The outline's image is simply */
-  /*    or-ed to the target bitmap.                                        */
-  /*                                                                       */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    library :: A handle to a FreeType library object.                  */
-  /*    outline :: A pointer to the source outline descriptor.             */
-  /*    map     :: A pointer to the target bitmap descriptor.              */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    YES.  Rendering is synchronized, so that concurrent calls to the   */
-  /*    scan-line converter will be serialized.                            */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function does NOT CREATE the bitmap, it only renders an       */
-  /*    outline image within the one you pass to it!                       */
-  /*                                                                       */
-  /*    It will use the raster correponding to the default glyph format.   */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Outline_Get_Bitmap( FT_Library   library,
-                                                  FT_Outline*  outline,
-                                                  FT_Bitmap*   bitmap );
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Render                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Renders an outline within a bitmap using the current scan-convert  */
-  /*    This functions uses a FT_Raster_Params as argument, allowing       */
-  /*    advanced features like direct composition/translucency, etc..      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    library :: A handle to a FreeType library object.                  */
-  /*    outline :: A pointer to the source outline descriptor.             */
-  /*    params  :: A pointer to a FT_Raster_Params used to describe        */
-  /*               the rendering operation                                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    YES.  Rendering is synchronized, so that concurrent calls to the   */
-  /*    scan-line converter will be serialized.                            */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    You should know what you're doing and the role of FT_Raster_Params */
-  /*    to use this function.                                              */
-  /*                                                                       */
-  /*    the field "params.source" will be set to "outline" before the      */
-  /*    scan converter is called, which means that the value you give it   */
-  /*    is actually ignored..                                              */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Outline_Render( FT_Library        library,
-                                              FT_Outline*       outline,
-                                              FT_Raster_Params* params );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Decompose                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Walks over an outline's structure to decompose it into individual  */
-  /*    segments and Bezier arcs.  This function is also able to emit      */
-  /*    `move to' and `close to' operations to indicate the start and end  */
-  /*    of new contours in the outline.                                    */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    outline   :: A pointer to the source target.                       */
-  /*                                                                       */
-  /*    funcs     :: A table of `emitters', i.e,. function pointers called */
-  /*                 during decomposition to indicate path operations.     */
-  /*                                                                       */
-  /*    user      :: A typeless pointer which is passed to each emitter    */
-  /*                 during the decomposition.  It can be used to store    */
-  /*                 the state during the decomposition.                   */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means sucess.                              */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Outline_Decompose( FT_Outline*        outline,
-                                                 FT_Outline_Funcs*  funcs,
-                                                 void*              user );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_New                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Creates a new outline of a given size.                             */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    library     :: A handle to the library object from where the       */
-  /*                   outline is allocated.  Note however that the new    */
-  /*                   outline will NOT necessarily be FREED when          */
-  /*                   destroying the library, by FT_Done_FreeType().      */
-  /*                                                                       */
-  /*    numPoints   :: The maximal number of points within the outline.    */
-  /*                                                                       */
-  /*    numContours :: The maximal number of contours within the outline.  */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    outline     :: A handle to the new outline.  NULL in case of       */
-  /*                   error.                                              */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    No.                                                                */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The reason why this function takes a `library' parameter is simply */
-  /*    to use the library's memory allocator.  You can copy the source    */
-  /*    code of this function, replacing allocations with `malloc()' if    */
-  /*    you want to control where the objects go.                          */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Outline_New( FT_Library   library,
-                                           FT_UInt      numPoints,
-                                           FT_Int       numContours,
-                                           FT_Outline*  outline );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Done                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Destroys an outline created with FT_Outline_New().                 */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    library :: A handle of the library object used to allocate the     */
-  /*               outline.                                                */
-  /*                                                                       */
-  /*    outline :: A pointer to the outline object to be discarded.        */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    No.                                                                */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    If the outline's `owner' field is not set, only the outline        */
-  /*    descriptor will be released.                                       */
-  /*                                                                       */
-  /*    The reason why this function takes an `outline' parameter is       */
-  /*    simply to use FT_Alloc()/FT_Free().  You can copy the source code  */
-  /*    of this function, replacing allocations with `malloc()' in your    */
-  /*    application if you want something simpler.                         */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Outline_Done( FT_Library   library,
-                                            FT_Outline*  outline );
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Get_CBox                                                */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Returns an outline's `control box'.  The control box encloses all  */
-  /*    the outline's points, including Bezier control points.  Though it  */
-  /*    coincides with the exact bounding box for most glyphs, it can be   */
-  /*    slightly larger in some situations (like when rotating an outline  */
-  /*    which contains Bezier outside arcs).                               */
-  /*                                                                       */
-  /*    Computing the control box is very fast, while getting the bounding */
-  /*    box can take much more time as it needs to walk over all segments  */
-  /*    and arcs in the outline.  To get the latter, you can use the       */
-  /*    `ftbbox' component which is dedicated to this single task.         */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    outline :: A pointer to the source outline descriptor.             */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    cbox    :: The outline's control box.                              */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    Yes.                                                               */
-  /*                                                                       */
-  FT_EXPORT_DEF(void)  FT_Outline_Get_CBox( FT_Outline*  outline,
-                                            FT_BBox*     cbox );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Translate                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Applies a simple translation to the points of an outline.          */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    outline :: A pointer to the target outline descriptor.             */
-  /*    xOffset :: The horizontal offset.                                  */
-  /*    yOffset :: The vertical offset.                                    */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    Yes.                                                               */
-  /*                                                                       */
-  FT_EXPORT_DEF(void)  FT_Outline_Translate( FT_Outline*  outline,
-                                             FT_Pos       xOffset,
-                                             FT_Pos       yOffset );
-
-
-#if 0
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Set_Raster                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Register a given raster to the library.                            */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    library      :: A handle to a target library object.               */
-  /*    raster_funcs :: pointer to the raster's interface                  */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function will do the following:                               */
-  /*                                                                       */
-  /*    - a new raster object is created through raster_func.raster_new    */
-  /*      if this fails, then the function returns                         */
-  /*                                                                       */
-  /*    - if a raster is already registered for the glyph format           */
-  /*      specified in raster_funcs, it will be destroyed                  */
-  /*                                                                       */
-  /*    - the new raster is registered for the glyph format                */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Set_Raster( FT_Library        library,
-                                          FT_Raster_Funcs*  raster_funcs );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Unset_Raster                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Removes a given raster from the library.                           */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    library      :: A handle to a target library object.               */
-  /*    raster_funcs :: pointer to the raster's interface                  */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function should never be used by a normal client application  */
-  /*    as FT_Set_Raster unregisters the previous raster for a given       */
-  /*    glyph format..                                                     */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Unset_Raster( FT_Library        library,
-                                            FT_Raster_Funcs*  raster_funcs );
-
-
- /*************************************************************************
-  *
-  * <Function>
-  *   FT_Get_Raster
-  *
-  * <Description>
-  *   Return a pointer to the raster corresponding to a given glyph
-  *   format tag.
-  *
-  * <Input>
-  *   library      :: handle to source library object
-  *   glyph_format :: glyph format tag
-  *
-  * <Output>
-  *   raster_funcs :: if this field is not 0, returns a pointer to the
-  *                   raster's interface/descriptor..
-  *
-  * <Return>
-  *   a pointer to the corresponding raster object.
-  *
-  *************************************************************************/
-
-  FT_EXPORT_DEF(FT_Raster)  FT_Get_Raster( FT_Library        library,
-                                           FT_Glyph_Format   glyph_format,
-                                           FT_Raster_Funcs  *raster_funcs );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Set_Raster_Mode                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Set a raster-specific mode.                                        */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    library :: A handle to a target library object.                    */
-  /*    format  :: the glyph format used to select the raster              */
-  /*    mode    :: the raster-specific mode descriptor                     */
-  /*    args    :: the mode arguments                                      */
-  /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Set_Raster_Mode( FT_Library      library,
-                                               FT_Glyph_Format format,
-                                               unsigned long   mode,
-                                               void*           args );
-#endif
-
- /***************************************************************************/
- /***************************************************************************/
- /***************************************************************************/
- /*****                                                                 *****/
- /*****       C O N V E N I E N C E   F U N C T I O N S                 *****/
- /*****                                                                 *****/
- /*****                                                                 *****/
- /*****    The following functions are provided as a convenience        *****/
- /*****    to client applications. However, their compilation might     *****/
- /*****    be discarded if FT_CONFIG_OPTION_NO_CONVENIENCE_FUNCS        *****/
- /*****    is defined in "config/ftoption.h".                           *****/
- /*****                                                                 *****/
- /***************************************************************************/
- /***************************************************************************/
- /***************************************************************************/
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Copy                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Copies an outline into another one.  Both objects must have the    */
-  /*    same sizes (number of points & number of contours) when this       */
-  /*    function is called.                                                */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    source :: A handle to the source outline.                          */
-  /*    target :: A handle to the target outline.                          */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Outline_Copy( FT_Outline*  source,
-                                            FT_Outline*  target );
-
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Transform                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Applies a simple 2x2 matrix to all of an outline's points.  Useful */
-  /*    for applying rotations, slanting, flipping, etc.                   */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    outline :: A pointer to the target outline descriptor.             */
-  /*    matrix  :: A pointer to the transformation matrix.                 */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    Yes.                                                               */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    You can use FT_Outline_Translate() if you need to translate the    */
-  /*    outline's points.                                                  */
-  /*                                                                       */
-  FT_EXPORT_DEF(void)  FT_Outline_Transform( FT_Outline*  outline,
-                                             FT_Matrix*   matrix );
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Reverse                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Reverse the drawing direction of an outline. This is used to       */
-  /*    ensure consistent fill conventions for mirrored glyphs..           */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    outline :: A pointer to the target outline descriptor.             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This functions toggles the bit flag ft_outline_reverse_fill in     */
-  /*    the outline's "flags" field..                                      */
-  /*                                                                       */
-  /*    It shouldn't be used by a normal client application, unless it     */
-  /*    knows what it's doing..                                            */
-  /*                                                                       */
-  FT_EXPORT_DEF(void)  FT_Outline_Reverse( FT_Outline*  outline );
-
-
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Matrix_Multiply                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Performs the matrix operation `b = a*b'.                           */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    a :: A pointer to matrix `a'.                                      */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    b :: A pointer to matrix `b'.                                      */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    Yes.                                                               */
-  /*                                                                       */
-  FT_EXPORT_DEF(void)  FT_Matrix_Multiply( FT_Matrix*  a,
-                                           FT_Matrix*  b );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Matrix_Invert                                                   */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Inverts a 2x2 matrix.  Returns an error if it can't be inverted.   */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    matrix :: A pointer to the target matrix.  Remains untouched in    */
-  /*              case of error.                                           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    Yes.                                                               */
-  /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)   FT_Matrix_Invert( FT_Matrix*  matrix );
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Default_Drivers                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Adds the set of default drivers to a given library object.         */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    library :: A handle to a new library object.                       */
-  /*                                                                       */
-  FT_EXPORT_DEF(void)  FT_Default_Drivers( FT_Library  library );
 
 #ifdef __cplusplus
   }
diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h
index 3c7c760..078babe 100644
--- a/include/freetype/fterrors.h
+++ b/include/freetype/fterrors.h
@@ -54,7 +54,7 @@ FT_ERROR_START_LIST
   FT_ERRORDEF( FT_Err_Invalid_Character_Code,  0x0013, "invalid character code" )
 
   FT_ERRORDEF( FT_Err_Unimplemented_Feature,   0x0020, "unimplemented feature" )
-  FT_ERRORDEF( FT_Err_Invalid_Glyph_Format,    0x0021, "invalid glyph image format" )
+  FT_ERRORDEF( FT_Err_Invalid_Glyph_Format,    0x0021, "unsupported glyph image format" )
   FT_ERRORDEF( FT_Err_Cannot_Render_Glyph,     0x0022, "cannot render this glyph format" )
 
   FT_ERRORDEF( FT_Err_Invalid_Library_Handle,  0x0030, "invalid library handle" )
diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h
index c441224..51cb1cc 100644
--- a/include/freetype/ftglyph.h
+++ b/include/freetype/ftglyph.h
@@ -32,13 +32,8 @@
   extern "C" {
 #endif
 
-  typedef enum {
-
-    ft_glyph_type_none    = 0,
-    ft_glyph_type_bitmap  = 1,
-    ft_glyph_type_outline = 2
-
-  } FT_GlyphType;
+  /* forward declaration to a private type */
+  typedef struct FT_Glyph_Class_  FT_Glyph_Class;
 
  /***********************************************************************
   *
@@ -46,45 +41,23 @@
   *    FT_GlyphRec
   *
   * <Description>
-  *    The root glyph structure contains a given glyph image's metrics.
-  *    Note that the FT_Glyph type is a pointer to FT_GlyphRec
+  *    The root glyph structure contains a given glyph image plus its
+  *    advance width in 16.16 fixed float format..
   *
   * <Field>
-  *    memory   :: a handle to the memory allocator that is used to
-  *                create/clone/destroy this glyph..
-  *
-  *    glyph_type :: the glyph type..
-  *
-  *    height   :: height of glyph image
-  *    width    :: width of glyph image
-  *
-  *    bearingX :: horizontal bearing, this is the distance from the
-  *                the current pen position to the left of the glyph
-  *
-  *    bearingY :: vertical bearing, this is the distance from the
-  *                current pen position to the top of the glyph
-  *
-  *    advance  :: this is the horizontal or vertical advance for the
-  *                glyph
-  *
-  * <Note>
-  *    the distances expressed in the metrics are expressed in 26.6 fixed
-  *    float sub-pixels (i.e. 1/64th of pixels).
-  *
-  *    the vertical bearing has a positive value when the glyph top is
-  *    above the baseline, and negative when it is under..
+  *    library  :: a handle to the FreeType library object.
+  *    clazz    :: a pointer to the glyph's class. Private.
+  *    format   :: the format of the glyph's image
+  *    advance  :: a 16.16 vector that gives the glyph's advance width
   *
   ***********************************************************************/
 
   typedef struct FT_GlyphRec_
   {
-    FT_Memory     memory;
-    FT_GlyphType  glyph_type;
-    FT_Int        height;
-    FT_Int        width;
-    FT_Int        bearingX;
-    FT_Int        bearingY;
-    FT_Int        advance;
+    FT_Library             library;
+    const FT_Glyph_Class*  clazz;
+    FT_Glyph_Format        format;
+    FT_Vector              advance;
 
   } FT_GlyphRec, *FT_Glyph;
 
@@ -95,41 +68,37 @@
   *    FT_BitmapGlyphRec
   *
   * <Description>
-  *    A structure used to describe a bitmap glyph image..
-  *    Note that the FT_BitmapGlyph type is a pointer to FT_BitmapGlyphRec
+  *    A structure used for bitmap glyph images.. This really is
+  *    a "sub-class" of "FT_GlyphRec".
   *
   * <Field>
-  *    metrics  :: the corresponding glyph metrics
-  *    bitmap   :: a descriptor for the bitmap.
+  *    root     :: the root FT_Glyph fields
   *    left     :: left-side bearing, i.e. the horizontal distance from
   *                the current pen position to the left border of the glyph
   *                bitmap.
   *    top      :: top-side bearing, i.e. the vertical distance from the
   *                current pen position to the top border of the glyph bitmap
   *                this distance is positive for upwards-y !!
+  *    bitmap   :: a descriptor for the bitmap.
   *
   * <Note>
-  *    the "width" and "height" fields of the metrics are expressed in
-  *    26.6 sub-pixels. However, the width and height in pixels can be
-  *    read directly from "bitmap.width" and "bitmap.height"
-  *
-  *    this structure is used for both monochrome and anti-aliased
-  *    bitmaps (the bitmap descriptor contains field describing the
-  *    format of the pixel buffer)
+  *    You can typecast a FT_Glyph to FT_BitmapGlyph when you have
+  *    glyph->format == ft_glyph_format_bitmap. This lets you access
+  *    the bitmap's content easily..
   *
   *    the corresponding pixel buffer is always owned by the BitmapGlyph
-  *    and is thus creatde and destroyed with it..
+  *    and is thus created and destroyed with it..
   *
   ***********************************************************************/
 
   typedef struct FT_BitmapGlyphRec_
   {
-    FT_GlyphRec  metrics;
+    FT_GlyphRec  root;
     FT_Int       left;
     FT_Int       top;
     FT_Bitmap    bitmap;
 
-  } FT_BitmapGlyphRec_, *FT_BitmapGlyph;
+  } FT_BitmapGlyphRec, *FT_BitmapGlyph;
 
 
  /***********************************************************************
@@ -138,189 +107,297 @@
   *    FT_OutlineGlyphRec
   *
   * <Description>
-  *    A structure used to describe a vectorial outline glyph image..
-  *    Note that the FT_OutlineGlyph type is a pointer to FT_OutlineGlyphRec
+  *    A structure used for outline (vectorial) glyph images..     
+  *    This really is a "sub-class" of FT_GlyphRec.
   *
   * <Field>
-  *    metrics  :: the corresponding glyph metrics
+  *    root     :: the root FT_Glyph fields.
   *    outline  :: a descriptor for the outline
   *
   * <Note>
-  *    the "width" and "height" fields of the metrics are expressed in
-  *    26.6 sub-pixels. However, the width and height in pixels can be
-  *    read directly from "bitmap.width" and "bitmap.rows"
+  *    You can typecast a FT_Glyph to FT_OutlineGlyph when you have
+  *    glyph->format == ft_glyph_format_outline. This lets you access
+  *    the outline's content easily..
   *
-  *    the corresponding outline points tables is always owned by the
-  *    object and are destroyed with it..
+  *    As the outline is extracted from a glyph slot, its coordinates
+  *    are expressed normally in 26.6 pixels, unless the flag
+  *    FT_LOAD_NO_SCALE was used in FT_Load_Glyph / FT_Load_Char..
   *
-  *    an OutlineGlyph can be used to generate a BitmapGlyph with the
-  *    function FT_OutlineGlyph_Render()
+  *    the outline's tables are always owned by the object and are
+  *    destroyed with it..
   *
   ***********************************************************************/
 
   typedef struct FT_OutlineGlyphRec_
   {
-    FT_GlyphRec  metrics;
+    FT_GlyphRec  root;
     FT_Outline   outline;
 
-  } FT_OutlineGlyphRec_, *FT_OutlineGlyph;
+  } FT_OutlineGlyphRec, *FT_OutlineGlyph;
+
 
 
  /***********************************************************************
   *
   * <Function>
-  *    FT_Get_Glyph_Bitmap
+  *    FT_Get_Glyph
   *
   * <Description>
-  *    A function used to directly return a bitmap glyph image
-  *    from a face.
+  *    A function used to extract one glyph image from a slot..
   *
   * <Input>
-  *    face        :: handle to source face object
-  *    glyph_index :: glyph index in face
-  *    load_flags  :: load flags, see FT_LOAD_FLAG_XXXX constants..
-  *    grays       :: number of gray levels for anti-aliased bitmaps,
-  *                   set to 0 if you want to render a monochrome bitmap
-  *    origin      :: a pointer to the origin's position. Set to 0
-  *                   if the current transform is the identity..
+  *    slot    :: handle to source glyph slot.
   *
   * <Output>
-  *    bitglyph :: pointer to the new bitmap glyph
+  *    aglyph  :: handle to the glyph object.
   *
   * <Return>
   *    Error code. 0 means success.
   *
   * <Note>
-  *    If the font contains glyph outlines, these will be automatically
-  *    converted to a bitmap according to the value of "grays"
-  *
-  *    If "grays" is set to 0, the result is a 1-bit monochrome bitmap
-  *    otherwise, it is an 8-bit gray-level bitmap
-  *
-  *    The number of gray levels in the result anti-aliased bitmap might
-  *    not be "grays", depending on the current scan-converter implementation
   *
-  *    Note that it is not possible to generate 8-bit monochrome bitmaps
-  *    with this function. Rather, use FT_Get_Glyph_Outline, then
-  *    FT_Glyph_Render_Outline and provide your own span callbacks..
-  *
-  *    When the face doesn't contain scalable outlines, this function will
-  *    fail if the current transform is not the identity, or if the glyph
-  *    origin's phase to the pixel grid is not 0 in both directions !!
   *
   ***********************************************************************/
 
-  FT_EXPORT_DEF(FT_Error)  FT_Get_Glyph_Bitmap( FT_Face         face,
-                                                FT_UInt         glyph_index,
-                                                FT_UInt         load_flags,
-                                                FT_Int          grays,
-                                                FT_Vector*      origin,
-                                                FT_BitmapGlyph  *abitglyph );
-
+  FT_EXPORT_DEF(FT_Error)  FT_Get_Glyph( FT_GlyphSlot   slot,
+                                         FT_Glyph      *aglyph );
 
  /***********************************************************************
   *
   * <Function>
-  *    FT_Get_Glyph_Outline
+  *    FT_Glyph_Copy
   *
   * <Description>
-  *    A function used to directly return an outline glyph image from a
-  *    face. This is faster than calling FT_Load_Glyph+FT_Get_Outline_Bitmap..
+  *    A function used to copy one glyph image.
   *
   * <Input>
-  *    face        :: handle to source face object
-  *    glyph_index :: glyph index in face
-  *    load_flags  :: load flags, see FT_LOAD_FLAG_XXXX constants..
+  *    source  :: handle to source glyph object
   *
   * <Output>
-  *    vecglyph :: pointer to the new outline glyph
+  *    target  :: handle to target glyph object. 0 in case of error
   *
   * <Return>
   *    Error code. 0 means success.
   *
-  * <Note>
-  *    If the glyph is not an outline in the face, this function will
-  *    fail..
-  *
-  *    This function will fail if the load flags FT_LOAD_NO_OUTLINE and
-  *    FT_LOAD_NO_RECURSE are set..
-  *
   ***********************************************************************/
 
-  FT_EXPORT_DEF(FT_Error)  FT_Get_Glyph_Outline( FT_Face           face,
-                                                 FT_UInt           glyph_index,
-                                                 FT_UInt           load_flags,
-                                                 FT_OutlineGlyph  *vecglyph );
+  FT_EXPORT_DEF(FT_Error)  FT_Glyph_Copy( FT_Glyph   source,
+                                          FT_Glyph  *target );
 
 
  /***********************************************************************
   *
   * <Function>
-  *    FT_Set_Transform
+  *    FT_Glyph_Transform
   *
   * <Description>
-  *    A function used to set the transform that is applied to glyph images
-  *    just after they're loaded in the face's glyph slot, and before they're
-  *    returned by either FT_Get_Glyph_Bitmap or FT_Get_Glyph_Outline
+  *    Transforms a glyph image, when it's format is scalable
   *
   * <Input>
-  *    face   :: handle to source face object
-  *    matrix :: pointer to the transform's 2x2 matrix. 0 for identity
-  *    delta  :: pointer to the transform's translation. 0 for null vector
+  *    glyph  :: handle to target glyph object
+  *
+  *    matrix :: pointer to 2x2 matrix to apply
+  *
+  *    delta  :: pointer to a 2d vector to apply. coordinates are
+  *              expressed in 1/64th of a pixel..
+  *
+  * <Return>
+  *    error code (is not 0, the glyph format is not scalable).
   *
   * <Note>
-  *    The transform is only applied to glyph outlines when they are found
-  *    in a font face. It is unable to transform embedded glyph bitmaps
+  *    the 2x2 transform matrix is also applied to the glyph's
+  *    advance vector
   *
   ***********************************************************************/
 
-  FT_EXPORT_DEF(void)  FT_Set_Transform( FT_Face     face,
-                                         FT_Matrix*  matrix,
-                                         FT_Vector*  delta );
-
-
+  FT_EXPORT_DEF(FT_Error)  FT_Glyph_Transform( FT_Glyph    glyph,
+                                               FT_Matrix*  matrix,
+                                               FT_Vector*  delta );
+   
  /***********************************************************************
   *
   * <Function>
-  *    FT_Done_Glyph
+  *    FT_Glyph_Get_CBox
   *
   * <Description>
-  *    Destroys a given glyph..
+  *    Returns the glyph image's bounding box.
   *
   * <Input>
-  *    glyph  :: handle to target glyph object
+  *    glyph :: handle to source glyph object
+  *    mode  :: a set of bit flags that indicate how to interpret
+  *             the meaning of the box's coordinates
+  *
+  * <Output>
+  *    box   :: the glyph bounding box. Coordinates are expressed in
+  *             1/64th of pixels, it is grid-fitted..
+  *
+  * <Note>
+  *    Coordinates are relative to the glyph origin, using the Y-upwards
+  *    convention..
+  *
+  *    if 'ft_glyph_bbox_subpixels' is set in "mode", the bbox coordinates
+  *    are returned in 26.6 pixels (i.e. 1/64th of pixels).
+  *
+  *    otherwise, coordinates are in integer pixels.
+  *
+  *    note that the maximum coordinates are exclusive, which means that
+  *    once can compute the width and height of the glyph image (be it
+  *    in integer or 26.6 pixels) as:
+  *
+  *        width  = bbox.xMax - bbox.xMin;
+  *        height = bbox.yMax - bbox.yMin;
+  *
+  *    Note also that for 26.6 coordinates, if the 'ft_glyph_bbox_gridfit'
+  *    flag is set in "mode", the coordinates will also be grid-fitted,
+  *    which corresponds to:
+  *
+  *        bbox.xMin = FLOOR(bbox.xMin);
+  *        bbox.yMin = FLOOR(bbox.yMin);
+  *        bbox.xMax = CEILING(bbox.xMax);
+  *        bbox.yMax = CEILING(bbox.yMax);
   *
   ***********************************************************************/
 
-  FT_EXPORT_DEF(void)  FT_Done_Glyph( FT_Glyph  glyph );
+  enum
+  {
+    ft_glyph_bbox_pixels    = 0,
+    ft_glyph_bbox_subpixels = 1,
+    ft_glyph_bbox_gridfit   = 2
+  };
+
+  FT_EXPORT_DEF(void)  FT_Glyph_Get_CBox( FT_Glyph  glyph,
+                                          FT_UInt   bbox_mode,
+                                          FT_BBox  *cbox );
 
 
  /***********************************************************************
   *
   * <Function>
-  *    FT_Glyph_Get_Box
+  *    FT_Glyph_To_Bitmap
   *
   * <Description>
-  *    Returns the glyph image's bounding box in pixels.
+  *    converts a given glyph object to a bitmap glyph object
+  *
+  * <InOut>
+  *    glyph  :: pointer to a handle to the target glyph
   *
   * <Input>
-  *    glyph :: handle to target glyph object
+  *    render_mode :: a set of bit flags that describe how
   *
-  * <Output>
-  *    box   :: the glyph bounding box. Coordinates are expressed in
-  *             _integer_ pixels, with exclusive max bounds
+  *    origin      :: pointer to a vector used to translate the glyph image
+  *                   before rendering. Can be 0 (for no translation). The
+  *                   origin is expressed in 26.6 pixels..
+  *
+  *    destroy     :: a boolean that indicates that the original glyph image
+  *                   should be destroyed by this function. The glyph is
+  *                   never destroyed in case of error..
+  *
+  * <Return>
+  *    Error code. 0 means success
   *
   * <Note>
-  *    Coordinates are relative to the glyph origin, using the Y-upwards
-  *    convention..
+  *    the glyph image is translated with the "origin" vector before
+  *    rendering.. In case of error, it it translated back to its original
+  *    position and the glyph is untouched..
+  *
+  *    The first parameter is a pointer to a FT_Glyph handle, that
+  *    will be replaced by this function. Typically, you would use:
+  *
+  *    {
+  *        FT_Glyph        glyph;
+  *        FT_BitmapGlyph  glyph_bitmap;
+  *
+  *        // load glyph
+  *        error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT );
+  *
+  *        // extract glyph image
+  *        error = FT_Get_Glyph( face->glyph, &glyph );
+  *
+  *        // convert to a bitmap (default render mode + destroy old)
+  *        if (glyph->format != ft_glyph_format_bitmap)
+  *        {
+  *          error = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_default, 0, 1 );
+  *          if (error) // glyph unchanged..
+  *        }
+  *
+  *        // access bitmap content by typecasting
+  *        glyph_bitmap = (FT_BitmapGlyph)glyph;
   *
-  *    The width of the box in pixels is box.xMax-box.xMin
-  *    The height is box.yMax - box.yMin
+  *        // do funny stuff with it, like blitting/drawing
+  *        ....
+  *
+  *        // discard glyph image (bitmap or not)
+  *        FT_Done_Glyph( glyph );
+  *
+  *
+  *    This function will always fail if the glyph's format isn't scalable
+  *
+  ***********************************************************************/
+
+  FT_EXPORT_DEF(FT_Error)  FT_Glyph_To_Bitmap( FT_Glyph   *the_glyph,
+                                               FT_ULong    render_mode,
+                                               FT_Vector*  origin,
+                                               FT_Bool     destroy );
+                                               
+ /***********************************************************************
+  *
+  * <Function>
+  *    FT_Done_Glyph
+  *
+  * <Description>
+  *    Destroys a given glyph..
+  *
+  * <Input>
+  *    glyph  :: handle to target glyph object
   *
   ***********************************************************************/
 
-  FT_EXPORT_DEF(void)  FT_Glyph_Get_Box( FT_Glyph  glyph,
-                                         FT_BBox  *box );
+  FT_EXPORT_DEF(void)  FT_Done_Glyph( FT_Glyph  glyph );
+
+
+  /* other helpful functions */
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Matrix_Multiply                                                 */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Performs the matrix operation `b = a*b'.                           */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    a :: A pointer to matrix `a'.                                      */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    b :: A pointer to matrix `b'.                                      */
+  /*                                                                       */
+  /* <MT-Note>                                                             */
+  /*    Yes.                                                               */
+  /*                                                                       */
+  FT_EXPORT_DEF(void)  FT_Matrix_Multiply( FT_Matrix*  a,
+                                           FT_Matrix*  b );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Matrix_Invert                                                   */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Inverts a 2x2 matrix.  Returns an error if it can't be inverted.   */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    matrix :: A pointer to the target matrix.  Remains untouched in    */
+  /*              case of error.                                           */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  /* <MT-Note>                                                             */
+  /*    Yes.                                                               */
+  /*                                                                       */
+  FT_EXPORT_DEF(FT_Error)   FT_Matrix_Invert( FT_Matrix*  matrix );
+
 
 #ifdef __cplusplus
   }
diff --git a/include/freetype/ftmodule.h b/include/freetype/ftmodule.h
index 6175b2a..2e611bc 100644
--- a/include/freetype/ftmodule.h
+++ b/include/freetype/ftmodule.h
@@ -192,6 +192,93 @@
                                              FT_Module   module );
 
 
+ /*************************************************************************
+  *
+  *  <Function>
+  *     FT_New_Library
+  *
+  *  <Description>
+  *     Creates a new "virgin" library that uses a custom memory manager.
+  *     The library has no registered driver, those can be added with a
+  *     call to FT_Add_Default_Modules
+  *
+  *  <Input>
+  *     memory   :: handle to custom memory manager
+  *
+  *  <Output>
+  *     library  :: handle to fresh new library object
+  *
+  *  <Return>
+  *     Error code (module not listed)
+  *
+  *************************************************************************/
+  
+  FT_EXPORT_DEF(FT_Error)  FT_New_Library( FT_Memory    memory,
+                                           FT_Library*  library );
+
+
+ /*************************************************************************
+  *
+  *  <Function>
+  *     FT_Done_Library
+  *
+  *  <Description>
+  *     Destroys a given library, and all child objects, except the
+  *     memory manager.
+  *
+  *  <Input>
+  *     library  :: handle to target library object
+  *
+  *  <Return>
+  *     Error code (module not listed)
+  *
+  *************************************************************************/
+  
+  FT_EXPORT_DEF(FT_Error)  FT_Done_Library( FT_Library  library );
+
+
+
+ /*************************************************************************
+  *
+  *  <Function>
+  *     FT_Set_Debug_Hook
+  *
+  *  <Description>
+  *     Used only by the TrueType debugger. This function is private and
+  *     should never be called by normal applications..
+  *
+  *  <Input>
+  *     library    :: handle to target library object
+  *     hook_index :: hook index
+  *     debug_hook :: debug hook functions
+  *
+  *************************************************************************/
+  
+  typedef  void  (*FT_DebugHook_Func)( void* arg );
+  
+  FT_EXPORT_DEF(void)      FT_Set_Debug_Hook( FT_Library         library,
+                                              FT_UInt            hook_index,
+                                              FT_DebugHook_Func  debug_hook );
+
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Add_Default_Modules                                             */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Adds the set of default modules to a given library object.         */
+  /*    This is only useful when you create a library object with          */
+  /*    FT_New_Library (usually to plug a custom memory manager)           */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    library :: A handle to a new library object.                       */
+  /*                                                                       */
+  FT_EXPORT_DEF(void)  FT_Add_Default_Modules( FT_Library  library );
+
+
+
 #endif /* FTMODULE_H */
 
 
diff --git a/include/freetype/ftrender.h b/include/freetype/ftrender.h
index f7d6295..2853927 100644
--- a/include/freetype/ftrender.h
+++ b/include/freetype/ftrender.h
@@ -19,6 +19,41 @@
 #define FTRENDER_H
 
 #include <freetype/ftmodule.h>
+#include <freetype/ftglyph.h>
+
+ /* create a new glyph object */
+  typedef  FT_Error  (*FT_Glyph_Init_Func)( FT_Glyph      glyph,
+                                            FT_GlyphSlot  slot );
+
+ /* destroys a given glyph object */
+  typedef  void      (*FT_Glyph_Done_Func)( FT_Glyph   glyph );
+
+  typedef  void      (*FT_Glyph_Transform_Func)( FT_Glyph    glyph,
+                                                 FT_Matrix*  matrix,
+                                                 FT_Vector*  delta );
+                                                 
+  typedef  void      (*FT_Glyph_BBox_Func)( FT_Glyph    glyph,
+                                            FT_BBox    *abbox );
+
+  typedef  FT_Error  (*FT_Glyph_Copy_Func)( FT_Glyph   source,
+                                            FT_Glyph   target );
+                                       
+  typedef  FT_Error  (*FT_Glyph_Prepare_Func)( FT_Glyph      glyph,
+                                               FT_GlyphSlot  slot );
+
+  struct FT_Glyph_Class_
+  {
+    FT_UInt                  glyph_size;
+    FT_Glyph_Format          glyph_format;
+    FT_Glyph_Init_Func       glyph_init;
+    FT_Glyph_Done_Func       glyph_done;
+    FT_Glyph_Copy_Func       glyph_copy;
+    FT_Glyph_Transform_Func  glyph_transform;
+    FT_Glyph_BBox_Func       glyph_bbox;
+    FT_Glyph_Prepare_Func    glyph_prepare;
+
+  };
+
 
  /*************************************************************************
   *
@@ -81,11 +116,6 @@
   } FT_Renderer_Class;
 
 
-  enum
-  {
-    ft_render_mode_antialias = 1
-  };
-
  /*************************************************************************
   *
   *  <Function>
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index bb8c24c..187596c 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -257,13 +257,17 @@
   /*************************************************************************/
   /*************************************************************************/
 
-#define FT_RENDERER(x)  ((FT_Renderer)(x))
+#define FT_RENDERER(x)      ((FT_Renderer)(x))
+#define FT_GLYPH(x)         ((FT_Glyph)(x))
+#define FT_BITMAP_GLYPH(x)  ((FT_BitmapGlyph)(x))
+#define FT_OUTLINE_GLYPH(x) ((FT_OutlineGlyph)(x))
 
   typedef struct FT_RendererRec_
   {
     FT_ModuleRec           root;
     FT_Renderer_Class*     clazz;
     FT_Glyph_Format        glyph_format;
+    const FT_Glyph_Class   glyph_class;
 
     FT_Raster              raster;
     FT_Raster_Render_Func  raster_render;
@@ -384,7 +388,6 @@
   /*                                                                       */
   /*                                                                       */
   /*                                                                       */
-  typedef  void  (*FT_DebugHook_Func)( void* arg );
 
 
   typedef struct  FT_LibraryRec_
@@ -408,19 +411,6 @@
   } FT_LibraryRec;
 
 
-  FT_EXPORT_DEF(FT_Error)  FT_New_Library( FT_Memory    memory,
-                                           FT_Library*  library );
-
-
-  FT_EXPORT_DEF(FT_Error)  FT_Done_Library( FT_Library  library );
-
-
-
-  FT_EXPORT_DEF(void)      FT_Set_Debug_Hook( FT_Library         library,
-                                              FT_UInt            hook_index,
-                                              FT_DebugHook_Func  debug_hook );
-
-
   BASE_DEF(FT_Renderer)  FT_Lookup_Renderer( FT_Library       library,
                                              FT_Glyph_Format  format,
                                              FT_ListNode     *node );
@@ -430,7 +420,6 @@
                                                   FT_UInt       render_mode );
 
 
-
 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
 
   FT_EXPORT_DEF(FT_Error)   FT_New_Stream( const char*  filepathname,
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 7d9f443..e25dbe7 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -29,6 +29,7 @@
 
 
 #include <freetype/ftglyph.h>
+#include <freetype/ftoutln.h>
 #include <freetype/internal/ftobjs.h>
 
 
@@ -41,449 +42,777 @@
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_glyph
 
+  /*************************************************************************/
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****   Convenience functions                                         ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+  /*************************************************************************/
 
-  /* a helper function to avoid duplication of code */
-  static
-  void  ft_prepare_glyph( FT_Glyph  glyph,
-                          FT_Face   face,
-                          FT_Bool   vertical )
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Matrix_Multiply                                                 */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Performs the matrix operation `b = a*b'.                           */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    a :: A pointer to matrix `a'.                                      */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    b :: A pointer to matrix `b'.                                      */
+  /*                                                                       */
+  /* <MT-Note>                                                             */
+  /*    Yes.                                                               */
+  /*                                                                       */
+  FT_EXPORT_FUNC( void )  FT_Matrix_Multiply( FT_Matrix*  a,
+                                              FT_Matrix*  b )
   {
-    FT_Glyph_Metrics*  metrics = &face->glyph->metrics;
+    FT_Fixed  xx, xy, yx, yy;
 
 
-    glyph->memory = face->memory;
-    glyph->width  = metrics->width;
-    glyph->height = metrics->height;
+    xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
+    xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
+    yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
+    yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
 
-    if ( vertical )
-    {
-      glyph->bearingX = metrics->vertBearingX;
-      glyph->bearingY = metrics->vertBearingY;
-      glyph->advance  = metrics->vertAdvance;
-    }
-    else
-    {
-      glyph->bearingX = metrics->horiBearingX;
-      glyph->bearingY = metrics->horiBearingY;
-      glyph->advance  = metrics->horiAdvance;
-    }
+    b->xx = xx;  b->xy = xy;
+    b->yx = yx;  b->yy = yy;
   }
 
 
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    FT_Get_Glyph_Bitmap                                                */
+  /*    FT_Matrix_Invert                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    A function used to directly return a monochrome bitmap glyph image */
-  /*    from a face.                                                       */
+  /*    Inverts a 2x2 matrix.  Returns an error if it can't be inverted.   */
   /*                                                                       */
-  /* <Input>                                                               */
-  /*    face        :: A handle to source face object.                     */
-  /*    glyph_index :: A glyph index into the face.                        */
-  /*    load_flags  :: Load flags (see FT_LOAD_FLAG_XXXX constants).       */
-  /*    grays       :: The number of gray levels for anti-aliased bitmaps. */
-  /*                   Set it to 0 if you want to render a monochrome      */
-  /*                   bitmap.                                             */
-  /*    origin      :: A pointer to the origin's position.  Set it to 0    */
-  /*                   if the current transform is the identity.           */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    abitglyph   :: A pointer to the new bitmap glyph.                  */
+  /* <InOut>                                                               */
+  /*    matrix :: A pointer to the target matrix.  Remains untouched in    */
+  /*              case of error.                                           */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
-  /* <Note>                                                                */
-  /*    If the font contains glyph outlines, these will be automatically   */
-  /*    converted to a bitmap according to the value of `grays'.           */
-  /*                                                                       */
-  /*    If `grays' is set to 0, the result is a 1-bit monochrome bitmap    */
-  /*    otherwise, it is an 8-bit gray-level bitmap.                       */
+  /* <MT-Note>                                                             */
+  /*    Yes.                                                               */
   /*                                                                       */
-  /*    The number of gray levels in the result anti-aliased bitmap might  */
-  /*    not be `grays', depending on the current scan-converter            */
-  /*    implementation.                                                    */
-  /*                                                                       */
-  /*    Note that it is not possible to generate 8-bit monochrome bitmaps  */
-  /*    with this function.  Rather, use FT_Get_Glyph_Outline(), then      */
-  /*    FT_Glyph_Render_Outline(), and provide your own span callbacks.    */
-  /*                                                                       */
-  /*    If the face doesn't contain scalable outlines, this function will  */
-  /*    fail if the current transformation is not the identity, or if the  */
-  /*    glyph origin's phase to the pixel grid is not 0 in both            */
-  /*    directions!                                                        */
-  /*                                                                       */
-  FT_EXPORT_FUNC( FT_Error )  FT_Get_Glyph_Bitmap(
-                                FT_Face          face,
-                                FT_UInt          glyph_index,
-                                FT_UInt          load_flags,
-                                FT_Int           grays,
-                                FT_Vector*       origin,
-                                FT_BitmapGlyph*  abitglyph )
+  FT_EXPORT_FUNC( FT_Error )  FT_Matrix_Invert( FT_Matrix*  matrix )
   {
-    FT_Error        error;
-    FT_Memory       memory;
+    FT_Pos  delta, xx, yy;
 
-    FT_BitmapGlyph  bitglyph;
-    FT_Glyph        glyph;
-    FT_Pos          origin_x = 0;
-    FT_Pos          origin_y = 0;
 
+    /* compute discriminant */
+    delta = FT_MulFix( matrix->xx, matrix->yy ) -
+            FT_MulFix( matrix->xy, matrix->yx );
 
-    if ( !face )
-      return FT_Err_Invalid_Face_Handle;
+    if ( !delta )
+      return FT_Err_Invalid_Argument;  /* matrix can't be inverted */
 
-    if ( !abitglyph )
-      return FT_Err_Invalid_Argument;
+    matrix->xy = - FT_DivFix( matrix->xy, delta );
+    matrix->yx = - FT_DivFix( matrix->yx, delta );
 
-    *abitglyph = 0;
+    xx = matrix->xx;
+    yy = matrix->yy;
+
+    matrix->xx = FT_DivFix( yy, delta );
+    matrix->yy = FT_DivFix( xx, delta );
+
+    return FT_Err_Ok;
+  }
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****   FT_BitmapGlyph support                                        ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  static
+  FT_Error   ft_bitmap_copy( FT_Memory  memory,
+                             FT_Bitmap* source,
+                             FT_Bitmap* target )
+  {
+    FT_Error  error;
+    FT_Int    pitch = source->pitch;
+    FT_ULong  size;
+    
+    *target = *source;
+    if (pitch < 0) pitch = -pitch;
+    size = (FT_ULong)(pitch * source->rows);
+    
+    if ( !ALLOC( target->buffer, size ) )
+      MEM_Copy( source->buffer, target->buffer, size );
+      
+    return error;
+  }                                    
 
-    if ( origin )
-    {
-      origin_x = origin->x & 63;
-      origin_y = origin->y & 63;
-    }
 
-    /* check arguments whether the face's format is not scalable */
-    if ( !( face->face_flags & FT_FACE_FLAG_SCALABLE ) &&
-         face->transform_flags )
+  static
+  FT_Error   ft_bitmap_glyph_init( FT_BitmapGlyph  glyph,
+                                   FT_GlyphSlot    slot )
+  {
+    FT_Error       error    = FT_Err_Ok;
+    FT_Library     library  = FT_GLYPH(glyph)->library;
+    FT_Memory      memory   = library->memory;
+    
+    if (slot->format != ft_glyph_format_bitmap)
     {
-      /* we can't transform bitmaps, so return an error */
-      error = FT_Err_Unimplemented_Feature;
+      error = FT_Err_Invalid_Glyph_Format;
       goto Exit;
     }
-
-    /* check that NO_SCALE and NO_RECURSE are not set */
-    if ( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_RECURSE ) )
+    
+    /* grab the bitmap in the slot - do lazy copying whenever possible */
+    glyph->bitmap = slot->bitmap;
+    glyph->left   = slot->bitmap_left;
+    glyph->top    = slot->bitmap_top;
+    
+    if ( slot->flags & ft_glyph_own_bitmap )
     {
-      error = FT_Err_Invalid_Argument;
-      goto Exit;
+      slot->flags &= ~ft_glyph_own_bitmap;
     }
+    else
+    {
+      /* copy the bitmap into a new buffer */
+      error = ft_bitmap_copy( memory, &slot->bitmap, &glyph->bitmap );
+    }
+    
+  Exit:
+    return error;
+  }                                  
 
-    /* disable embedded bitmaps for transformed images */
-    if ( face->face_flags & FT_FACE_FLAG_SCALABLE && face->transform_flags )
-      load_flags |= FT_LOAD_NO_BITMAP;
-
-    error = FT_Load_Glyph( face, glyph_index, load_flags );
-    if ( error )
-      goto Exit;
 
-    /* now, handle bitmap and outline glyph images */
-    memory = face->memory;
+  static
+  FT_Error  ft_bitmap_glyph_copy( FT_BitmapGlyph  source,
+                                  FT_BitmapGlyph  target )
+  {
+    FT_Memory  memory = source->root.library->memory;
+    
+    target->left   = source->left;
+    target->top    = source->top;
+    
+    return ft_bitmap_copy( memory, &source->bitmap, &target->bitmap );
+  }                                  
 
-    switch ( face->glyph->format )
-    {
-    case ft_glyph_format_bitmap:
-      {
-        FT_Long     size;
-        FT_Bitmap*  source;
 
+  static
+  void   ft_bitmap_glyph_done( FT_BitmapGlyph  glyph )
+  {
+    FT_Memory  memory = FT_GLYPH(glyph)->library->memory;
+   
+    FREE( glyph->bitmap.buffer );
+  }
 
-        if ( ALLOC( bitglyph, sizeof ( *bitglyph ) ) )
-          goto Exit;
 
-        glyph             = (FT_Glyph)bitglyph;
-        glyph->glyph_type = ft_glyph_type_bitmap;
-        ft_prepare_glyph( glyph, face, 0 );
+  static
+  void   ft_bitmap_glyph_bbox( FT_BitmapGlyph  glyph,
+                               FT_BBox        *cbox )
+  {
+    cbox->xMin = glyph->left << 6;
+    cbox->xMax = cbox->xMin + (glyph->bitmap.width << 6);
+    cbox->yMax = glyph->top << 6;
+    cbox->yMin = cbox->xMax - (glyph->bitmap.rows << 6);
+  }  
 
-        source = &face->glyph->bitmap;
-        size   = source->rows * source->pitch;
-        if ( size < 0 )
-          size = -size;
 
-        bitglyph->bitmap = *source;
-        if ( ALLOC( bitglyph->bitmap.buffer, size ) )
-          goto Fail;
+  const FT_Glyph_Class      ft_bitmap_glyph_class =
+  {
+    sizeof( FT_BitmapGlyphRec ),
+    ft_glyph_format_bitmap,
+    (FT_Glyph_Init_Func)       ft_bitmap_glyph_init,
+    (FT_Glyph_Done_Func)       ft_bitmap_glyph_done,
+    (FT_Glyph_Copy_Func)       ft_bitmap_glyph_copy,
+    (FT_Glyph_Transform_Func)  0,
+    (FT_Glyph_BBox_Func)       ft_bitmap_glyph_bbox,
+    (FT_Glyph_Prepare_Func)    0
+  };
 
-        /* copy the content of the source glyph */
-        MEM_Copy( bitglyph->bitmap.buffer, source->buffer, size );
-      }
-      break;
+  /*************************************************************************/
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****   FT_OutlineGlyph support                                       ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+  /*************************************************************************/
 
-    case ft_glyph_format_outline:
-      {
-        FT_BBox  cbox;
-        FT_Int   width, height, pitch;
-        FT_Long  size;
-
-
-        /* transform the outline -- note that the original metrics are NOT */
-        /* transformed by this, only the outline points themselves...      */
-        FT_Outline_Translate( &face->glyph->outline,
-                              origin_x,
-                              origin_y );
-
-        /* compute the size in pixels of the outline */
-        FT_Outline_Get_CBox( &face->glyph->outline, &cbox );
-        cbox.xMin &= -64;
-        cbox.yMin &= -64;
-        cbox.xMax  = ( cbox.xMax + 63 ) & -64;
-        cbox.yMax  = ( cbox.yMax + 63 ) & -64;
-
-        width  = ( cbox.xMax - cbox.xMin ) >> 6;
-        height = ( cbox.yMax - cbox.yMin ) >> 6;
-
-        /* allocate the pixel buffer for the glyph bitmap */
-        if ( grays )
-          /* some raster implementation need this */
-          pitch = ( width + 3 ) & -4;
-        else
-          pitch = ( width + 7 ) >> 3;
-
-        size = pitch * height;
-        if ( ALLOC( bitglyph, sizeof ( *bitglyph ) ) )
-          goto Exit;
-
-        glyph             = (FT_Glyph)bitglyph;
-        glyph->glyph_type = ft_glyph_type_bitmap;
-        ft_prepare_glyph( glyph, face, 0 );
-
-        if ( ALLOC( bitglyph->bitmap.buffer, size ) )
-          goto Fail;
-
-        bitglyph->bitmap.width      = width;
-        bitglyph->bitmap.rows       = height;
-        bitglyph->bitmap.pitch      = pitch;
-        bitglyph->bitmap.pixel_mode = grays ? ft_pixel_mode_grays
-                                            : ft_pixel_mode_mono;
-        bitglyph->bitmap.num_grays  = (short)grays;
-
-        bitglyph->left = cbox.xMin >> 6;
-        bitglyph->top  = cbox.yMax >> 6;
-
-        /* render the monochrome outline into the target buffer */
-        FT_Outline_Translate( &face->glyph->outline,
-                              -cbox.xMin,
-                              -cbox.yMin );
-        error = FT_Outline_Get_Bitmap( face->driver->root.library,
-                                       &face->glyph->outline,
-                                       &bitglyph->bitmap );
-        if ( error )
-        {
-          FREE( bitglyph->bitmap.buffer );
-          goto Fail;
-        }
-      }
-      break;
+                        
 
-    default:
-      error = FT_Err_Invalid_Glyph_Index;
+  static
+  FT_Error  ft_outline_glyph_init( FT_OutlineGlyph glyph,
+                                   FT_GlyphSlot    slot )
+  {
+    FT_Error    error   = FT_Err_Ok;
+    FT_Library  library = FT_GLYPH(glyph)->library;
+    FT_Outline* source  = &slot->outline;
+    FT_Outline* target  = &glyph->outline;
+    
+    /* check format in glyph slot */
+    if (slot->format != ft_glyph_format_outline)
+    {
+      error = FT_Err_Invalid_Glyph_Format;
       goto Exit;
     }
+    
+    /* allocate new outline */
+    error = FT_Outline_New( library, source->n_points, source->n_contours,
+                            &glyph->outline );
+    if (error) goto Exit;
+
+    /* copy it.. */
+    MEM_Copy( target->points, source->points,
+              source->n_points * sizeof ( FT_Vector ) );
 
-    *abitglyph = bitglyph;
+    MEM_Copy( target->tags, source->tags,
+              source->n_points * sizeof ( FT_Byte ) );
+
+    MEM_Copy( target->contours, source->contours,
+              source->n_contours * sizeof ( FT_Short ) );
+
+    /* copy all flags, except the `ft_outline_owner' one */
+    target->flags = source->flags | ft_outline_owner;
 
   Exit:
     return error;
+  }                                   
 
-  Fail:
-    FREE( glyph );
-    goto Exit;
+  static
+  void  ft_outline_glyph_done( FT_OutlineGlyph  glyph )
+  {
+    FT_Outline_Done( FT_GLYPH(glyph)->library, &glyph->outline );
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Get_Glyph_Outline                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A function used to directly return a bitmap glyph image from a     */
-  /*    face.  This is faster than calling FT_Load_Glyph() +               */
-  /*    FT_Get_Outline_Bitmap().                                           */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face        :: A handle to the source face object.                 */
-  /*    glyph_index :: A glyph index into face                             */
-  /*    load_flags  :: Load flags (see FT_LOAD_FLAG_XXXX constants).       */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    vecglyph    :: A pointer to the new outline glyph.                 */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This function will fail if the load flags FT_LOAD_NO_OUTLINE and   */
-  /*    FT_LOAD_NO_RECURSE are set.                                        */
-  /*                                                                       */
-  FT_EXPORT_FUNC( FT_Error )  FT_Get_Glyph_Outline(
-                                FT_Face           face,
-                                FT_UInt           glyph_index,
-                                FT_UInt           load_flags,
-                                FT_OutlineGlyph*  vecglyph )
+  static
+  FT_Error  ft_outline_glyph_copy( FT_OutlineGlyph  source,
+                                   FT_OutlineGlyph  target )
   {
-    FT_Error         error;
-    FT_Memory        memory;
-    FT_OutlineGlyph  glyph;
+    FT_Error    error;
+    FT_Library  library = FT_GLYPH(source)->library;
+    
+    error = FT_Outline_New( library, source->outline.n_points,
+                            source->outline.n_contours, &target->outline );
+    if (!error)
+      FT_Outline_Copy( &source->outline, &target->outline );
+      
+    return error;
+  }
 
+  static
+  void  ft_outline_glyph_transform( FT_OutlineGlyph  glyph,
+                                    FT_Matrix*       matrix,
+                                    FT_Vector*       delta )
+  {
+    if (matrix)
+      FT_Outline_Transform( &glyph->outline, matrix );
+    if (delta)
+      FT_Outline_Translate( &glyph->outline, delta->x, delta->y );
+  }
 
-    /* test for valid `face' delayed to FT_Load_Glyph() */
+  static
+  void  ft_outline_glyph_bbox( FT_OutlineGlyph  glyph,
+                               FT_BBox         *bbox )
+  {
+    FT_Outline_Get_CBox( &glyph->outline, bbox );
+  }                               
+
+  static
+  FT_Error  ft_outline_glyph_prepare( FT_OutlineGlyph  glyph,
+                                      FT_GlyphSlot     slot )
+  {
+    slot->format         = ft_glyph_format_outline;
+    slot->outline        = glyph->outline;
+    slot->outline.flags &= ~ft_outline_owner;
+    return FT_Err_Ok;
+  }                                      
 
-    if ( !vecglyph )
-      return FT_Err_Invalid_Argument;
+  const FT_Glyph_Class   ft_outline_glyph_class =
+  {
+    sizeof( FT_OutlineGlyphRec ),
+    ft_glyph_format_outline,
+    (FT_Glyph_Init_Func)      ft_outline_glyph_init,
+    (FT_Glyph_Done_Func)      ft_outline_glyph_done,
+    (FT_Glyph_Copy_Func)      ft_outline_glyph_copy,
+    (FT_Glyph_Transform_Func) ft_outline_glyph_transform,
+    (FT_Glyph_BBox_Func)      ft_outline_glyph_bbox,
+    (FT_Glyph_Prepare_Func)   ft_outline_glyph_prepare
+  };
 
-    *vecglyph = 0;
+  /*************************************************************************/
+  /*************************************************************************/
+  /****                                                                 ****/
+  /****   FT_Glyph class and API                                        ****/
+  /****                                                                 ****/
+  /*************************************************************************/
+  /*************************************************************************/
 
-    /* check that RENDER and NO_RECURSE are not set */
-    if ( load_flags & ( FT_LOAD_RENDER | FT_LOAD_NO_RECURSE ) )
+   static
+   FT_Error    ft_new_glyph( FT_Library             library,
+                             const FT_Glyph_Class*  clazz,
+                             FT_Glyph              *aglyph )
+   {
+     FT_Memory  memory = library->memory;
+     FT_Error   error;
+     FT_Glyph   glyph;
+     
+     *aglyph = 0;
+     if ( !ALLOC( glyph, clazz->glyph_size ) )
+     {
+       glyph->library = library;
+       glyph->clazz   = clazz;
+       glyph->format  = clazz->glyph_format;
+       
+       *aglyph = glyph;
+     }
+     return error;
+   }                             
+
+
+ /***********************************************************************
+  *
+  * <Function>
+  *    FT_Glyph_Copy
+  *
+  * <Description>
+  *    A function used to copy one glyph image.
+  *
+  * <Input>
+  *    source  :: handle to source glyph object
+  *
+  * <Output>
+  *    target  :: handle to target glyph object. 0 in case of error
+  *
+  * <Return>
+  *    Error code. 0 means success.
+  *
+  ***********************************************************************/
+
+  FT_EXPORT_FUNC(FT_Error)  FT_Glyph_Copy( FT_Glyph   source,
+                                           FT_Glyph  *target )
+  {
+    FT_Glyph               copy;
+    FT_Error               error;
+    const FT_Glyph_Class*  clazz;
+
+    *target = 0;
+        
+    /* check arguments */
+    if (!source || !source->clazz)
     {
       error = FT_Err_Invalid_Argument;
       goto Exit;
     }
-
-    /* disable the loading of embedded bitmaps */
-    load_flags |= FT_LOAD_NO_BITMAP;
-
-    error = FT_Load_Glyph( face, glyph_index, load_flags );
-    if ( error )
-      goto Exit;
-
-    /* check that we really loaded an outline */
-    if ( face->glyph->format != ft_glyph_format_outline )
+    
+    clazz = source->clazz;
+    error = ft_new_glyph( source->library, clazz, &copy );
+    if (error) goto Exit;
+
+    if (clazz->glyph_copy)
+      error = clazz->glyph_copy( source, copy );
+    
+    if (error)
+      FT_Done_Glyph( copy );
+    else
+      *target = copy;
+      
+  Exit:
+    return error;
+  }                                           
+
+
+ /***********************************************************************
+  *
+  * <Function>
+  *    FT_Get_Glyph
+  *
+  * <Description>
+  *    A function used to extract one glyph image from a slot..
+  *
+  * <Input>
+  *    slot    :: handle to source glyph slot.
+  *
+  * <Output>
+  *    aglyph  :: handle to the glyph object.
+  *
+  * <Return>
+  *    Error code. 0 means success.
+  *
+  * <Note>
+  *
+  *
+  ***********************************************************************/
+
+  FT_EXPORT_FUNC(FT_Error)  FT_Get_Glyph( FT_GlyphSlot   slot,
+                                          FT_Glyph      *aglyph )
+  {
+    FT_Library  library = slot->library;
+    FT_Error    error;
+    FT_Glyph    glyph;
+    
+    const FT_Glyph_Class*  clazz = 0;
+    
+    /* if it's a bitmap, that's easy :-) */
+    if (slot->format == ft_glyph_format_bitmap)
+      clazz = &ft_bitmap_glyph_class;
+
+    /* it it's an outline too */      
+    else if (slot->format == ft_glyph_format_outline)
+      clazz = &ft_outline_glyph_class;
+      
+    else
     {
-      error = FT_Err_Invalid_Glyph_Index;
-      goto Exit;
+      /* try to find a renderer that supports the glyph image format */
+      FT_Renderer  render = FT_Lookup_Renderer( library, slot->format, 0 );
+      if (render)
+        clazz = &render->glyph_class;
     }
-
-    /* now, create a new outline glyph and copy everything */
-    memory = face->memory;
-    if ( ALLOC( glyph, sizeof ( *glyph ) ) )
+    
+    if (!clazz)
+    {
+      error = FT_Err_Invalid_Glyph_Format;
       goto Exit;
-
-    ft_prepare_glyph( (FT_Glyph)glyph, face, 0 );
-    glyph->metrics.glyph_type = ft_glyph_type_outline;
-
-    error = FT_Outline_New( face->driver->root.library,
-                            face->glyph->outline.n_points,
-                            face->glyph->outline.n_contours,
-                            &glyph->outline );
-    if ( !error )
-      error = FT_Outline_Copy( &face->glyph->outline, &glyph->outline );
-    if ( error )
-      goto Fail;
-
-    *vecglyph = glyph;
-
+    }
+    
+    /* create FT_Glyph object */
+    error = ft_new_glyph( library, clazz, &glyph );
+    if (error) goto Exit;
+    
+    /* copy advance while convert it to 16.16 format */
+    glyph->advance.x = slot->advance.x << 10;
+    glyph->advance.y = slot->advance.y << 10;
+    
+    /* now import the image from the glyph slot */
+    error = clazz->glyph_init( glyph, slot );
+    
+    /* if an error occured, destroy the glyph */
+    if (error)
+      FT_Done_Glyph( glyph );
+    else
+      *aglyph = glyph;
+      
   Exit:
     return error;
-
-  Fail:
-    FREE( glyph );
-    goto Exit;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Done_Glyph                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Destroys a given glyph.                                            */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    glyph :: A handle to the target glyph object.                      */
-  /*                                                                       */
-  FT_EXPORT_FUNC( void )  FT_Done_Glyph( FT_Glyph  glyph )
+  }                                          
+
+
+
+
+ /***********************************************************************
+  *
+  * <Function>
+  *    FT_Glyph_Transform
+  *
+  * <Description>
+  *    Transforms a glyph image, when it's format is scalable
+  *
+  * <Input>
+  *    glyph  :: handle to target glyph object
+  *
+  *    matrix :: pointer to 2x2 matrix to apply
+  *
+  *    delta  :: pointer to a 2d vector to apply. coordinates are
+  *              expressed in 1/64th of a pixel..
+  *
+  * <Return>
+  *    error code (is not 0, the glyph format is not scalable).
+  *
+  * <Note>
+  *    the 2x2 transform matrix is also applied to the glyph's
+  *    advance vector
+  *
+  ***********************************************************************/
+
+  FT_EXPORT_FUNC(FT_Error)  FT_Glyph_Transform( FT_Glyph    glyph,
+                                                FT_Matrix*  matrix,
+                                                FT_Vector*  delta )
   {
-    if ( glyph )
+    const FT_Glyph_Class*  clazz;
+    FT_Error               error = FT_Err_Ok;
+    
+    if (!glyph || !glyph->clazz)
+      error = FT_Err_Invalid_Argument;
+    else
     {
-      FT_Memory  memory = glyph->memory;
-
-
-      if ( glyph->glyph_type == ft_glyph_type_bitmap )
+      clazz = glyph->clazz;
+      if (clazz->glyph_transform)
       {
-        FT_BitmapGlyph  bit = (FT_BitmapGlyph)glyph;
-
-
-        FREE( bit->bitmap.buffer );
+        /* transform glyph image */
+        clazz->glyph_transform( glyph, matrix, delta );
+        
+        /* transform advance vector */
+        if (matrix)
+          FT_Vector_Transform( &glyph->advance, matrix );
       }
-      else if ( glyph->glyph_type == ft_glyph_type_outline )
+      else
+        error = FT_Err_Invalid_Glyph_Format;
+    }
+    return error;
+  }                                               
+   
+ /***********************************************************************
+  *
+  * <Function>
+  *    FT_Glyph_Get_CBox
+  *
+  * <Description>
+  *    Returns the glyph image's bounding box.
+  *
+  * <Input>
+  *    glyph :: handle to source glyph object
+  *    mode  :: a set of bit flags that indicate how to interpret
+  *             the meaning of the box's coordinates
+  *
+  * <Output>
+  *    box   :: the glyph bounding box. Coordinates are expressed in
+  *             1/64th of pixels, it is grid-fitted..
+  *
+  * <Note>
+  *    Coordinates are relative to the glyph origin, using the Y-upwards
+  *    convention..
+  *
+  *    if 'ft_glyph_bbox_subpixels' is set in "mode", the bbox coordinates
+  *    are returned in 26.6 pixels (i.e. 1/64th of pixels).
+  *
+  *    otherwise, coordinates are in integer pixels.
+  *
+  *    note that the maximum coordinates are exclusive, which means that
+  *    once can compute the width and height of the glyph image (be it
+  *    in integer or 26.6 pixels) as:
+  *
+  *        width  = bbox.xMax - bbox.xMin;
+  *        height = bbox.yMax - bbox.yMin;
+  *
+  *    Note also that for 26.6 coordinates, if the 'ft_glyph_bbox_gridfit'
+  *    flag is set in "mode", the coordinates will also be grid-fitted,
+  *    which corresponds to:
+  *
+  *        bbox.xMin = FLOOR(bbox.xMin);
+  *        bbox.yMin = FLOOR(bbox.yMin);
+  *        bbox.xMax = CEILING(bbox.xMax);
+  *        bbox.yMax = CEILING(bbox.yMax);
+  *
+  ***********************************************************************/
+
+  FT_EXPORT_FUNC(void)  FT_Glyph_Get_CBox( FT_Glyph  glyph,
+                                           FT_UInt   bbox_mode,
+                                           FT_BBox  *cbox )
+  {                                          
+    const FT_Glyph_Class*  clazz;
+    FT_Error               error = FT_Err_Ok;
+    
+    if (!glyph || !glyph->clazz)
+      error = FT_Err_Invalid_Argument;
+    else
+    {
+      clazz = glyph->clazz;
+      if (!clazz->glyph_bbox)
+        error = FT_Err_Invalid_Glyph_Format;
+      else
       {
-        FT_OutlineGlyph  out = (FT_OutlineGlyph)glyph;
-
-
-        if ( out->outline.flags & ft_outline_owner )
+        /* retrieve bbox in 26.6 coordinates */
+        clazz->glyph_bbox( glyph, cbox );
+        
+        /* perform grid fitting if needed */
+        if (bbox_mode & ft_glyph_bbox_gridfit)
+        {
+          cbox->xMin &= -64;
+          cbox->yMin &= -64;
+          cbox->xMax  = (cbox->xMax+63) & -64;
+          cbox->yMax  = (cbox->yMax+63) & -64;
+        }
+        /* convert to integer pixels if needed */
+        if (!(bbox_mode & ft_glyph_bbox_subpixels))
         {
-          FREE( out->outline.points );
-          FREE( out->outline.contours );
-          FREE( out->outline.tags );
+          cbox->xMin >>= 6;
+          cbox->yMin >>= 6;
+          cbox->xMax >>= 6;
+          cbox->yMax >>= 6;
         }
       }
-
-      FREE( glyph );
     }
+    return;
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Glyph_Get_Box                                                   */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Returns the glyph image's bounding box in pixels.                  */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    glyph :: A handle to the target glyph object.                      */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    box   :: The glyph bounding box.  Coordinates are expressed in     */
-  /*             _integer_ pixels, with exclusive maximal bounding values. */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    Coordinates are relative to the glyph origin, using the Y-upwards  */
-  /*    convention.                                                        */
-  /*                                                                       */
-  /*    The width of the box in pixels is `box.xMax-box.xMin'; the height  */
-  /*    is `box.yMax-box.yMin'.                                            */
-  /*                                                                       */
-  FT_EXPORT_FUNC( void )  FT_Glyph_Get_Box( FT_Glyph  glyph,
-                                            FT_BBox*  box )
+ /***********************************************************************
+  *
+  * <Function>
+  *    FT_Glyph_To_Bitmap
+  *
+  * <Description>
+  *    converts a given glyph object to a bitmap glyph object
+  *
+  * <InOut>
+  *    glyph  :: pointer to a handle to the target glyph
+  *
+  * <Input>
+  *    render_mode :: a set of bit flags that describe how
+  *
+  *    origin      :: pointer to a vector used to translate the glyph image
+  *                   before rendering. Can be 0 (for no translation). The
+  *                   origin is expressed in 26.6 pixels..
+  *
+  *    destroy     :: a boolean that indicates that the original glyph image
+  *                   should be destroyed by this function. The glyph is
+  *                   never destroyed in case of error..
+  *
+  * <Return>
+  *    Error code. 0 means success
+  *
+  * <Note>
+  *    the glyph image is translated with the "origin" vector before
+  *    rendering.. In case of error, it it translated back to its original
+  *    position and the glyph is untouched..
+  *
+  *    The first parameter is a pointer to a FT_Glyph handle, that
+  *    will be replaced by this function. Typically, you would use:
+  *
+  *    {
+  *        FT_Glyph        glyph;
+  *        FT_BitmapGlyph  glyph_bitmap;
+  *
+  *        // load glyph
+  *        error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT );
+  *
+  *        // extract glyph image
+  *        error = FT_Get_Glyph( face->glyph, &glyph );
+  *
+  *        // convert to a bitmap (default render mode + destroy old)
+  *        if (glyph->format != ft_glyph_format_bitmap)
+  *        {
+  *          error = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_default, 0, 1 );
+  *          if (error) // glyph unchanged..
+  *        }
+  *
+  *        // access bitmap content by typecasting
+  *        glyph_bitmap = (FT_BitmapGlyph)glyph;
+  *
+  *        // do funny stuff with it, like blitting/drawing
+  *        ....
+  *
+  *        // discard glyph image (bitmap or not)
+  *        FT_Done_Glyph( glyph );
+  *
+  *
+  *    This function will always fail if the glyph's format isn't scalable
+  *
+  ***********************************************************************/
+
+  FT_EXPORT_FUNC(FT_Error)  FT_Glyph_To_Bitmap( FT_Glyph   *the_glyph,
+                                                FT_ULong    render_mode,
+                                                FT_Vector*  origin,
+                                                FT_Bool     destroy )
   {
-    if ( !box )
-      return;
-
-    box->xMin = box->xMax = 0;
-    box->yMin = box->yMax = 0;
+    FT_GlyphSlotRec  dummy;
+    FT_Error         error;
+    FT_Glyph         glyph;
+    FT_BitmapGlyph   bitmap;
+    
+    const FT_Glyph_Class*  clazz;
+    
+    /* check arguments */
+    if (!the_glyph || !*the_glyph)
+      goto Bad;
+    
+    /* we render the glyph into a glyph bitmap using a "dummy" glyph slot */
+    /* then calling FT_Render_Glyph_Internal..                            */
+    
+    glyph = *the_glyph;
+    if (!glyph)
+      goto Bad;
+    
+    clazz = glyph->clazz;
+    if (!clazz || !clazz->glyph_prepare)
+      goto Bad;
+    
+    MEM_Set( &dummy, 0, sizeof(dummy) );
+    dummy.library = glyph->library;
+    dummy.format  = clazz->glyph_format;
+    
+    /* if "origin" is set, translate the glyph image */
+    if (origin)
+      FT_Glyph_Transform( glyph, 0, origin );
+
+    /* create result bitmap glyph */    
+    error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class,
+                          (FT_Glyph*)&bitmap );
+    if (error) goto Exit;
+    
+    /* prepare dummy slot for rendering */
+    error = clazz->glyph_prepare( glyph, &dummy ) ||
+            FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );
+    
+    if (!destroy && origin)
+    {
+      FT_Vector  v;
+      
+      v.x = -origin->x;
+      v.y = -origin->y;
+      FT_Glyph_Transform( glyph, 0, &v );
+    }
 
-    if ( glyph )
-      switch ( glyph->glyph_type )
+    /* in case of succes, copy the bitmap to the glyph bitmap */
+    if (!error)
+    {
+      error = ft_bitmap_glyph_init( bitmap, &dummy );
+      if (error)
       {
-      case ft_glyph_type_bitmap:
-        {
-          FT_BitmapGlyph  bit = (FT_BitmapGlyph)glyph;
-
-
-          box->xMin = bit->left;
-          box->xMax = box->xMin + bit->bitmap.width;
-          box->yMax = bit->top;
-          box->yMin = box->yMax - bit->bitmap.rows;
-        }
-        break;
-
-      case ft_glyph_type_outline:
-        {
-          FT_OutlineGlyph  out = (FT_OutlineGlyph)glyph;
-
-
-          FT_Outline_Get_CBox( &out->outline, box );
-          box->xMin >>= 6;
-          box->yMin >>= 6;
-          box->xMax  = ( box->xMax + 63 ) >> 6;
-          box->yMax  = ( box->yMax + 63 ) >> 6;
-        }
-        break;
-
-      default:
-        ;
+        /* thus should never happen, but let's be safe.. */
+        FT_Done_Glyph( FT_GLYPH(bitmap) );
+        goto Exit;
       }
+      
+      if (destroy)
+        FT_Done_Glyph( glyph );
+        
+      *the_glyph = FT_GLYPH(bitmap);
+    }
+    
+  Exit:
+    return error;
+    
+  Bad:
+    error = FT_Err_Invalid_Argument;
+    goto Exit;
+  }                                                
+
+ /***********************************************************************
+  *
+  * <Function>
+  *    FT_Done_Glyph
+  *
+  * <Description>
+  *    Destroys a given glyph..
+  *
+  * <Input>
+  *    glyph  :: handle to target glyph object
+  *
+  ***********************************************************************/
+
+  FT_EXPORT_FUNC(void)  FT_Done_Glyph( FT_Glyph  glyph )
+  {
+    if (glyph)
+    {
+      FT_Memory              memory = glyph->library->memory;
+      const FT_Glyph_Class*  clazz  = glyph->clazz;
+
+      if (clazz->glyph_done)
+        clazz->glyph_done( glyph );
+        
+      FREE( glyph );
+    }
   }
 
 
+  
+
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index e64236d..cd2ca4a 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -664,7 +664,8 @@
     FT_Memory         memory = driver->root.memory;
     FT_Error          error  = FT_Err_Ok;
 
-
+    slot->library = driver->root.library;
+    
     if ( FT_DRIVER_USES_OUTLINES( driver ) )
       error = FT_GlyphLoader_New( memory, &slot->loader );
 
@@ -1023,10 +1024,10 @@
          load_flags & FT_LOAD_RENDER )
     {
       error = FT_Render_Glyph( slot,
-                               ( load_flags & FT_LOAD_ANTI_ALIAS )
-                                  ? ft_render_mode_antialias
-                                  : 0 );
-    } 
+                               ( load_flags & FT_LOAD_MONOCHROME )
+                                  ? ft_render_mode_mono
+                                  : ft_render_mode_normal );
+    }	 
 
   Exit:
     return error;
@@ -2039,6 +2040,9 @@
   /*                                                                       */
   /*    right_glyph :: The index of the right glyph in the kern pair.      */
   /*                                                                       */
+  /*    kern_mode   :: see FT_Kerning_Mode for more info. Determines the   */
+  /*                   scale/dimension of the returned kerning vector      */
+  /*                                                                       */
   /* <Output>                                                              */
   /*    kerning     :: The kerning vector.  This is in font units for      */
   /*                   scalable formats, and in pixels for fixed-sizes     */
@@ -2053,16 +2057,16 @@
   /*    kernings, are out of the scope of this API function -- they can be */
   /*    implemented through format-specific interfaces.                    */
   /*                                                                       */
-  FT_EXPORT_FUNC( FT_Error )  FT_Get_Kerning( FT_Face     face,
-                                              FT_UInt     left_glyph,
-                                              FT_UInt     right_glyph,
-                                              FT_Vector*  kerning )
+  FT_EXPORT_FUNC(FT_Error)  FT_Get_Kerning( FT_Face     face,
+                                            FT_UInt     left_glyph,
+                                            FT_UInt     right_glyph,
+                                            FT_UInt     kern_mode,
+                                            FT_Vector*  kerning )
   {
     FT_Error   error = FT_Err_Ok;
     FT_Driver  driver;
     FT_Memory  memory;
 
-
     if ( !face )
       return FT_Err_Invalid_Face_Handle;
 
@@ -2079,6 +2083,20 @@
                                           right_glyph,
                                           kerning );
     }
+    if (!error)
+    {
+      if (kern_mode != ft_kerning_unscaled)
+      {
+        kerning->x = FT_MulFix( kerning->x, face->size->metrics.x_scale );
+        kerning->y = FT_MulFix( kerning->y, face->size->metrics.y_scale );
+        
+        if (kern_mode != ft_kerning_unfitted)
+        {
+          kerning->x = (kerning->x+32) & -64;
+          kerning->y = (kerning->y+32) & -64;
+        }
+      }
+    }
     else
     {
       kerning->x = 0;
@@ -2599,24 +2617,13 @@
   /*    slot        :: A handle to the glyph slot containing the image to  */
   /*                   convert.                                            */
   /*                                                                       */
-  /*    render_mode :: A set of bit flags indicating which kind of bitmap  */
-  /*                   to render.  For now, only                           */
-  /*                   `ft_render_mode_anti_alias' is supported by the     */
-  /*                   available renderers, but others could appear later  */
-  /*                   (e.g. optimized for TV or LCD).                     */
+  /*    render_mode :: this is the render mode used to render the glyph    */
+  /*                   image into a bitmap. See FT_Render_Mode for a list  */
+  /*                   of possible values.                                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
-  /* <Note>                                                                */
-  /*    In case of success, the renderer will be used to convert glyph     */
-  /*    images in the renderer's known format into bitmaps.                */
-  /*                                                                       */
-  /*    This doesn't change the current renderer for other formats.        */
-  /*                                                                       */
-  /*    The slot's native image should be considered lost after the        */
-  /*    conversion.                                                        */
-  /*                                                                       */
   FT_EXPORT_FUNC( FT_Error )  FT_Render_Glyph( FT_GlyphSlot  slot,
                                                FT_UInt       render_mode )
   {
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index 008a07b..e22e2cc 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -23,8 +23,7 @@
   /*************************************************************************/
 
 
-#include <freetype/freetype.h>
-#include <freetype/config/ftconfig.h>
+#include <freetype/ftoutln.h>
 #include <freetype/internal/ftobjs.h>
 
 
@@ -340,6 +339,57 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
+  /*    FT_Outline_Copy                                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Copies an outline into another one.  Both objects must have the    */
+  /*    same sizes (number of points & number of contours) when this       */
+  /*    function is called.                                                */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    source :: A handle to the source outline.                          */
+  /*                                                                       */
+  /* <Output>                                                              */
+  /*    target :: A handle to the target outline.                          */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0 means success.                             */
+  /*                                                                       */
+  FT_EXPORT_FUNC( FT_Error )  FT_Outline_Copy( FT_Outline*  source,
+                                               FT_Outline*  target )
+  {
+    FT_Int  is_owner;
+
+
+    if ( !source            || !target            ||
+         source->n_points   != target->n_points   ||
+         source->n_contours != target->n_contours )
+      return FT_Err_Invalid_Argument;
+
+    MEM_Copy( target->points, source->points,
+              source->n_points * sizeof ( FT_Vector ) );
+
+    MEM_Copy( target->tags, source->tags,
+              source->n_points * sizeof ( FT_Byte ) );
+
+    MEM_Copy( target->contours, source->contours,
+              source->n_contours * sizeof ( FT_Short ) );
+
+    /* copy all flags, except the `ft_outline_owner' one */
+    is_owner      = target->flags & ft_outline_owner;
+    target->flags = source->flags;
+
+    target->flags &= ~ft_outline_owner;
+    target->flags |= is_owner;
+
+    return FT_Err_Ok;
+  }
+
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
   /*    FT_Outline_Done                                                    */
   /*                                                                       */
   /* <Description>                                                         */
@@ -759,163 +809,14 @@
   /*    You can use FT_Outline_Translate() if you need to translate the    */
   /*    outline's points.                                                  */
   /*                                                                       */
-  BASE_FUNC( void )  FT_Outline_Transform( FT_Outline*  outline,
-                                           FT_Matrix*   matrix )
+  FT_EXPORT_FUNC( void )  FT_Outline_Transform( FT_Outline*  outline,
+                                                FT_Matrix*   matrix )
   {
     FT_Vector*  vec = outline->points;
     FT_Vector*  limit = vec + outline->n_points;
 
-
     for ( ; vec < limit; vec++ )
       FT_Vector_Transform( vec, matrix );
   }
 
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****    The following functions are not used by the font drivers     ****/
-  /****    but they are provided as a convenience for client            ****/
-  /****    applications.                                                ****/
-  /****                                                                 ****/
-  /****    Note that they will not be compiled if the configuration     ****/
-  /****    macro FT_CONFIG_OPTION_NO_CONVENIENCE_FUNCS is defined.      ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-#ifndef FT_CONFIG_OPTION_NO_CONVENIENCE_FUNCS
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Outline_Copy                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Copies an outline into another one.  Both objects must have the    */
-  /*    same sizes (number of points & number of contours) when this       */
-  /*    function is called.                                                */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    source :: A handle to the source outline.                          */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    target :: A handle to the target outline.                          */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT_FUNC( FT_Error )  FT_Outline_Copy( FT_Outline*  source,
-                                               FT_Outline*  target )
-  {
-    FT_Int  is_owner;
-
-
-    if ( !source            || !target            ||
-         source->n_points   != target->n_points   ||
-         source->n_contours != target->n_contours )
-      return FT_Err_Invalid_Argument;
-
-    MEM_Copy( target->points, source->points,
-              source->n_points * 2 * sizeof ( FT_Pos ) );
-
-    MEM_Copy( target->tags, source->tags,
-              source->n_points * sizeof ( FT_Byte ) );
-
-    MEM_Copy( target->contours, source->contours,
-              source->n_contours * sizeof ( FT_Short ) );
-
-    /* copy all flags, except the `ft_outline_owner' one */
-    is_owner      = target->flags & ft_outline_owner;
-    target->flags = source->flags;
-
-    target->flags &= ~ft_outline_owner;
-    target->flags |= is_owner;
-
-    return FT_Err_Ok;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Matrix_Multiply                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Performs the matrix operation `b = a*b'.                           */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    a :: A pointer to matrix `a'.                                      */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    b :: A pointer to matrix `b'.                                      */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    Yes.                                                               */
-  /*                                                                       */
-  FT_EXPORT_FUNC( void )  FT_Matrix_Multiply( FT_Matrix*  a,
-                                              FT_Matrix*  b )
-  {
-    FT_Fixed  xx, xy, yx, yy;
-
-
-    xx = FT_MulFix( a->xx, b->xx ) + FT_MulFix( a->xy, b->yx );
-    xy = FT_MulFix( a->xx, b->xy ) + FT_MulFix( a->xy, b->yy );
-    yx = FT_MulFix( a->yx, b->xx ) + FT_MulFix( a->yy, b->yx );
-    yy = FT_MulFix( a->yx, b->xy ) + FT_MulFix( a->yy, b->yy );
-
-    b->xx = xx;  b->xy = xy;
-    b->yx = yx;  b->yy = yy;
-  }
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Matrix_Invert                                                   */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Inverts a 2x2 matrix.  Returns an error if it can't be inverted.   */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    matrix :: A pointer to the target matrix.  Remains untouched in    */
-  /*              case of error.                                           */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <MT-Note>                                                             */
-  /*    Yes.                                                               */
-  /*                                                                       */
-  FT_EXPORT_FUNC( FT_Error )  FT_Matrix_Invert( FT_Matrix*  matrix )
-  {
-    FT_Pos  delta, xx, yy;
-
-
-    /* compute discriminant */
-    delta = FT_MulFix( matrix->xx, matrix->yy ) -
-            FT_MulFix( matrix->xy, matrix->yx );
-
-    if ( !delta )
-      return FT_Err_Invalid_Argument;  /* matrix can't be inverted */
-
-    matrix->xy = - FT_DivFix( matrix->xy, delta );
-    matrix->yx = - FT_DivFix( matrix->yx, delta );
-
-    xx = matrix->xx;
-    yy = matrix->yy;
-
-    matrix->xx = FT_DivFix( yy, delta );
-    matrix->yy = FT_DivFix( xx, delta );
-
-    return FT_Err_Ok;
-  }
-
-#endif /* FT_CONFIG_OPTION_NO_CONVENIENCE_FUNCS */
-
-
 /* END */
diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c
index dfde78b..f1a5a8d 100644
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -20,6 +20,7 @@
 #include <freetype/internal/ftcalc.h>
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/sfnt.h>
+#include <freetype/ftoutln.h>
 #include <freetype/tttags.h>
 
 #include <t2load.h>
diff --git a/src/cff/t2parse.c b/src/cff/t2parse.c
index 53f15e0..1af9795 100644
--- a/src/cff/t2parse.c
+++ b/src/cff/t2parse.c
@@ -583,7 +583,6 @@
                     *(FT_Int*)q = (FT_Int)val;
                     break;
 #endif
-
                   default:
                     *(FT_Long*)q = val;
                   }
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 3a38545..39c34da 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -20,7 +20,7 @@
 #include <cidgload.h>
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
-
+#include <freetype/ftoutln.h>
 
   /*************************************************************************/
   /*                                                                       */
@@ -459,7 +459,7 @@
 
     if ( bchar_index < 0 || achar_index < 0 )
     {
-      FT_ERROR(( "t1operator_seac: ));
+      FT_ERROR(( "t1operator_seac:" ));
       FT_ERROR(( " invalid seac character code arguments\n" ));
       return T1_Err_Syntax_Error;
     }
@@ -862,7 +862,7 @@
           if ( ip[0] != 12 || ip[1] != 17 )
           {
             FT_ERROR(( "CID_Parse_CharStrings:" ));
-            FT_ERROR(( " `pop' expected, found (%d %d)\n",
+            FT_ERROR(( " 'pop' expected, found (%d %d)\n",
                        ip[0], ip[1] ));
             goto Syntax_Error;
           }
diff --git a/src/raster1/ftrend1.c b/src/raster1/ftrend1.c
index 84fe38a..6793810 100644
--- a/src/raster1/ftrend1.c
+++ b/src/raster1/ftrend1.c
@@ -1,4 +1,5 @@
 #include <freetype/internal/ftobjs.h>
+#include <freetype/ftoutln.h>
 #include <raster1.h>
 #include <ftraster.h>
 
@@ -84,7 +85,7 @@
     }
 
     /* check rendering mode */
-    if ( mode & ft_render_mode_antialias )
+    if ( mode != ft_render_mode_mono )
     {
       /* raster1 is only capable of producing monochrome bitmaps */
       if (render->clazz == &ft_raster1_renderer_class)
@@ -124,7 +125,7 @@
     }
       
     /* allocate new one, depends on pixel format */
-    if ( mode & ft_render_mode_antialias )
+    if (!(mode & ft_render_mode_mono))
     {
       /* we pad to 32 bits, only for backwards compatibility with FT 1.x */
       pitch = (width+3) & -4;
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 06cdab9..458b045 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -126,7 +126,7 @@
 #include "ftgrays.h"
 #include <freetype/internal/ftobjs.h>  /* for UNUSED()                  */
 #include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
-#include <freetype/freetype.h>         /* for FT_Outline_Decompose()    */
+#include <freetype/ftoutln.h>          /* for FT_Outline_Decompose()    */
 
 #define ErrRaster_Invalid_Mode     FT_Err_Cannot_Render_Glyph
 
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 7cd4929..eed9246 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -1,4 +1,5 @@
 #include <freetype/internal/ftobjs.h>
+#include <freetype/ftoutln.h>
 #include <ftsmooth.h>
 #include <ftgrays.h>
 
@@ -51,8 +52,8 @@
 
  /* return the glyph's control box */
   static  void  ft_smooth_get_cbox( FT_Renderer   render,
-                                      FT_GlyphSlot  slot,
-                                      FT_BBox      *cbox )
+                                    FT_GlyphSlot  slot,
+                                    FT_BBox      *cbox )
   {
     MEM_Set( cbox, 0, sizeof(*cbox) );
 
@@ -84,7 +85,7 @@
     }
     
     /* check mode */
-    if ( mode != ft_render_mode_antialias )
+    if ( mode != ft_render_mode_normal )
       return FT_Err_Cannot_Render_Glyph;
       
     outline = &slot->outline;
@@ -104,7 +105,7 @@
     width  = (cbox.xMax - cbox.xMin) >> 6;
     height = (cbox.yMax - cbox.yMin) >> 6;
     bitmap = &slot->bitmap;
-    memory = slot->face->memory;
+    memory = render->root.memory;
     
     /* release old bitmap buffer */
     if ((slot->flags & ft_glyph_own_bitmap))
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 7ca8077..9f72cee 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -21,6 +21,7 @@
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/sfnt.h>
 #include <freetype/tttags.h>
+#include <freetype/ftoutln.h>
 
 
 #include <ttgload.h>
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index aa728a5..1b86b3f 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -19,6 +19,7 @@
 #include <t1gload.h>
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
+#include <freetype/ftoutln.h>
 
 #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
 #include <t1hinter.h>
diff --git a/src/type1z/z1gload.c b/src/type1z/z1gload.c
index 44d7d2b..a65fc16 100644
--- a/src/type1z/z1gload.c
+++ b/src/type1z/z1gload.c
@@ -18,6 +18,7 @@
 #include <z1gload.h>
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
+#include <freetype/ftoutln.h>
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_t1gload