Commit e793092d0a9f4d4d383315bcefd485dcbe4804b3

Werner Lemberg 2005-03-01T02:13:50

Formatting. * src/truetype/ttpload.c (tt_face_load_loca): Fix typo. * src/sfnt/ttkern.c: Include `ttkern.h'. (FT_COMPONENT): Updated. * include/freetype/internal/fttrace.h: Add entry for `ttkern'. * src/sfnt/ttsbit0.c: s/FT_Err_/SFNT_Err_/. Decorate constants with `U' and `L' where necessary. * src/sfnt/ttcmap.c (tt_cmap4_next): Remove unused variable.

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
diff --git a/ChangeLog b/ChangeLog
index 673c8be..dc0b1e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,45 +1,163 @@
+2005-02-28  Werner Lemberg  <wl@gnu.org>
+
+	* src/truetype/ttpload.c (tt_face_load_loca): Fix typo.
+
+	* src/sfnt/ttkern.c: Include `ttkern.h'.
+	(FT_COMPONENT): Updated.
+
+	* include/freetype/internal/fttrace.h: Add entry for `ttkern'.
+
+	* src/sfnt/ttsbit0.c: s/FT_Err_/SFNT_Err_/.
+	Decorate constants with `U' and `L' where necessary.
+
+	* src/sfnt/ttcmap.c (tt_cmap4_next): Remove unused variable.
+
 2005-02-28  David Turner  <david@freetype.org>
 
-  * src/base/ftdbgmem.c (FT_DumpMemory): added sorting of memory sources
-  according to decreasing maximum cumulative allocations.
-  
-  * include/freetype/internal/tttypes.h, src/sfnt/ttsbit.c, src/sfnt/ttsbit0.c,
-  src/truetype/ttobjs.c, src/cff/cffobjs.c, src/sfnt/sfobjs.c: implementing new
-  heap-optimized embedded bitmap loader. This one also fixes bug #12107
-  
-  * src/sfnt/sfobjs.c: fixed bug that prevented loading SFNT fonts without
-  a 'kern' table.
-  
+	* src/base/ftdbgmem.c (FT_DumpMemory): Added sorting of memory
+	sources according to decreasing maximum cumulative allocations.
+	(ft_mem_source_compare): New auxiliary function.
+
+	* src/sfnt/ttsbit0.c: New file, implementing a heap-optimized
+	embedded bitmap loader.
+
+	* src/sfnt/ttsbit.c: Include `ft2build.h', FT_INTERNAL_DEBUG_H,
+	FT_INTERNAL_STREAM_H, FT_TRUETYPE_TAGS_H.
+	Load `ttsbit0.c' if FT_OPTIMIZE_MEMORY is set, otherwise use
+	file contents.
+	(tt_face_load_sbit_strikes): Set up root fields to indicate the
+	strikes.  This fixes Savannah bug #12107.
+	Use `static' keyword for `sbit_line_metrics_field',
+	`strike_start_fields', `strike_end_fields'.
+
+	* include/freetype/internal/tttypes.h (TT_FaceRec): Define
+	`sbit_table', `sbit_table_size', `sbit_num_strikes' if
+	FT_OPTIMIZE_MEMORY is set.
+	Don't define `num_sbit_strikes' and `sbit_strikes' if
+	FT_OPTIMIZE_MEMORY is set.
+
+	* src/cff/cffobjs.c (sbit_size_reset): Handle FT_OPTIMIZE_MEMORY.
+
+	* src/sfnt/sfobjs.c (sfnt_load_face): Fixed bug that prevented
+	loading SFNT fonts without a `kern' table.
+	Properly pass root->face_flags.
+	Remove code for TT_CONFIG_OPTION_EMBEDDED_BITMAPS.
+
+	* src/sfnt/sfdriver.c (sfnt_interface)
+	[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Don't use `tt_find_sbit_image'
+	and `tt_load_sbit_metrics'.
+
+	* src/sfnt/ttcmap.c: Optimize linear charmap scanning for Format 4.
+	(OPT_CMAP4): New macro.
+	(TT_CMap4Rec) [OPT_CMAP4]: New structure.
+	(tt_cmap4_init, tt_cmap4_set_range, tt_cmap4_next, tt_cmap4_reset)
+	[OPT_CMAP4]: New functions.
+	(tt_cmap4_char_next) [OPT_CMAP4]: Use `tt_cmap4_next' and
+	`tt_cmap4_reset'.
+	(tt_cmap4_class_rec) [OPT_CMAP4]: Use `TT_CMap4Rec' and
+	`tt_cmap4_init'.
+
+	* src/truetype/ttobjs.c (Reset_SBit_Size): Handle
+	FT_OPTIMIZE_MEMORY.
+
+	* src/autofit/afhints.h (AF_PointRec, AF_SegmentRec, AF_EdgeRec):
+	Optimize member types.
+
+	* src/autofit/afloader.c (af_loader_done): Call
+	`af_glyph_hints_done'.
 
 2005-02-27  David Turner  <david@freetype.org>
 
-  * src/sfnt/ttkern.c (tt_face_load_kern): fixing a small bug which returned
-  invalid (random) values for the horizontal kerning
+	* src/sfnt/ttkern.c (tt_face_load_kern): Fix a small bug which
+	caused invalid (random) return values for the horizontal kerning.
 
 2005-02-25  David Turner  <david@freetype.org>
 
-  * many, many files: several memory optimizations were implemented to
-  drastically reduce the heap usage of FreeType, especially in the case
-  of memory-mapped files. The idea is to avoid loading and decoding tables
-  in the heap, and instead access the raw data whenever possible (i.e.
-  when it doesn't compromise performance).
-  
-  This had several impacts: first, opening vera.ttf uses a ridiculous amount
-  of memory (when the FT_Library footprint is accounted for), until you start
-  loading glyphs. Even then, you'll save at least 20 Kb compared to the non
-  optimized case. performance of various operations, including open/close
-  has also been dramatically improved.
-  
-  More optimisations to come. The auto-hinter eats memory like crazy? This
-  must be stopped...
+	Implement several memory optimizations to drastically reduce the
+	heap usage of FreeType, especially in the case of memory-mapped
+	files.  The idea is to avoid loading and decoding tables in the
+	heap, and instead access the raw data whenever possible (i.e., when
+	it doesn't compromise performance).
+
+	This has several benefits: For example, opening vera.ttf now uses
+	just a small amount of memory (even when the FT_Library footprint is
+	accounted for), until you start loading glyphs.  Even then, you save
+	at least 20KB compared to the non-optimized case.  Performance of
+	various operations, including open and close, has also been
+	dramatically improved.
+
+	More optimizations to come, especially for the auto-hinter.
+
+	* include/freetype/internal/sfnt.h (TT_Face_GetKerningFunc): New
+	function type.
+	(SFNT_Interface): Add it.
+
+	* include/freetype/internal/tttypes.h (TT_HdmxEntryRec, TT_HdmxRec,
+	TT_Kern0_PairRec): Don't define if FT_OPTIMIZE_MEMORY is set.
+	(TT_FaceRec): Define `horz_metrics', `horz_metrics_size',
+	`vert_metrics', `vert_metrics_size', `hdmx_table',
+	`hdmx_table_size', `hdmx_record_count', `hdmx_record_size',
+	`hdmx_record_sizes', `kern_table', `kern_table_size,
+	`num_kern_tables', `kern_avail_bits', `kern_order_bits' if
+	FT_OPTIMIZE_MEMORY is set.
+	Don't define `hdmx', `num_kern_pairs', `kern_table_index',
+	`kern_pairs' if FT_OPTIMIZE_MEMORY is set.
+
+	* src/base/ftdbgmem.c (ft_mem_table_set): Don't shadow variable.
+	Fix compiler warning.
+
+	* src/cff/cffdrivr.c (Get_Kerning): Renamed to...
+	(cff_get_kerning): This.  Simplify.
+	(cff_driver_class): Updated.
+
+	* src/sfnt/Jamfile (_sources): Add `ttkern'.
+	* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttkern.c'.
+
+	* src/sfnt/sfdriver.c (sfnt_interface): Add `tt_face_get_kerning'.
+
+	* src/sfnt/sfnt.c: Include `ttkern.c'.
+
+	* src/sfnt/sfobjs.c: Include `ttkern.h'.
+	(sfnt_load_face): Consider the `kern' and `gasp' table as optional.
+	(sfnt_done_face): Call `tt_face_done_kern'.
+	Handle horizontal metrics for FT_OPTIMIZE_MEMORY.
+
+	* src/sfnt/ttkern.c, src/sfnt/ttkern.h: New files.  Code has been
+	taken from `ttload.c' and `ttload.h'.
+	Provide special versions of `tt_face_load_kern',
+	`tt_face_get_kerning', and `tt_face_done_kern' for
+	FT_OPTIMIZE_MEMORY.
+
+	* src/sfnt/ttload.c (tt_face_load_metrics, tt_face_load_hdmx,
+	tt_face_free_hdmx): Provide version for FT_OPTIMIZE_MEMORY.
+	(tt_face_load_kern, tt_kern_pair_compare, TT_KERN_INDEX): Moved to
+	`ttkern.c'.
+
+	* src/sfnt/ttload.h: Updated.
+
+	* src/sfnt/ttsbit.c (sbit_metrics_field): Add `static' keyword.
+
+	* src/truetype/ttdriver.c (Get_Kerning): Renamed to...
+	(tt_get_kerning): This.  Simplify.
+	(tt_driver_class): Updated.
+
+	* src/truetype/ttgload.c (TT_Get_Metrics): Renamed to...
+	(tt_face_get_metrics): This. Provide version for FT_OPTIMIZE_MEMORY.
+	Update all callers.
+	(Get_Advance_Widths): Replaced with...
+	(Get_Advance_WidthPtr): This.  Provide version for
+	FT_OPTIMIZE_MEMORY.
+	Update all callers.
+
+	* src/truetype/ttgload.h: Updated.
 
 2005-02-22  David Turner  <david@freetype.org>
 
-	* src/base/ftdbgmem.c: adding the ability to list all allocation sites
-	in the memory debugger. Also a new function FT_DumpMemory() was added.
-	It is only available in builds with FT_DEBUG_MEMORY defined, and you
-	must declare it in your own code to use it, i.e. with something
-	like:
+	* src/base/ftdbgmem.c: Partly rewritten.  Added the ability to list
+	all allocation sites in the memory debugger.  Also a new function
+	FT_DumpMemory() was added.  It is only available in builds with
+	FT_DEBUG_MEMORY defined, and you must declare it in your own code to
+	use it, i.e., with something like:
 
 	  extern void FT_DumpMemory( FT_Memory );
 
@@ -47,26 +165,39 @@
 
 	  FT_DumpMemory( memory );
 
-	* include/freetype/config/ftoptions.h: disabling TrueType bytecode
-	interpreter !
+	* include/freetype/config/ftoption.h
+	(TT_CONFIG_OPTION_BYTECODE_INTERPRETER): Comment out definition --
+	again.
+	(FT_OPTIMIZE_MEMORY): New configuration macro to control various
+	optimizations for reducing the heap footprint of memory-mapped
+	TrueType files.
 
-	* include/freetype/internal/ftmemory.h: adding FT_ARRAY_ZERO, as a
+	* include/freetype/internal/ftmemory.h (FT_ARRAY_ZERO): New
 	convenience macro.
 
-    * include/freetype/config/ftoption.h, include/freetype/internal/ttypes.h,
-    src/truetype/ttpload.c, src/truetype/ttpload.h, src/truetype/ttgload.c:
-    added the temporary configuration FT_OPTIMIZE_MEMORY to control various
-    optimizations used to reduce the heap footprint of memory-mapped TrueType
-    files.
+	* include/freetype/internal/tttypes.h (TT_FaceRec)
+	[FT_OPTIMIZE_MEMORY]: Use optimized types for `num_locations' and
+	`glyph_locations'.
+
+	* src/truetype/ttgload.c (load_truetype_glyph): Call
+	`tt_face_get_location'.
+
+	* src/truetype/ttobjs.c (tt_face_init)
+	[FT_CONFIG_OPTION_INCREMENTAL]: Improve error handling.
+	(tt_face_done): Call `tt_face_done_loca'.
 
-    * src/truetype/ttpload.c (tt_face_load_loca, tt_face_get_location,
-    tt_face_done_loca): when FT_OPTIMIZE_MEMORY is set, the locations table
-    is read directly from memory-mapped streams, instead of being decoded
-    into the heap.
+	* src/truetype/ttpload.c (tt_face_get_location, tt_face_done_loca):
+	New functions.  If FT_OPTIMIZE_MEMORY is set, the locations table is
+	read directly from memory-mapped streams, instead of being decoded
+	into the heap.
+	(tt_face_load_loca) [FT_OPTIMIZE_MEMORY]: New implementation.
+	(tt_face_load_cvt, tt_face_load_fpgm): Only load table if the
+	bytecode interpreter is compiled in.
 
-    * src/truetype/ttpload.c: only load the CVT and fpgm tables when the
-    bytecode interpreter is compiled in.
+	* src/truetype/ttpload.h: Updated.
 
+	* src/autohint/ahglyph.c (ah_outline_load): Improve allocation
+	logic.
 
 2005-02-20  Werner Lemberg  <wl@gnu.org>
 
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index c3d06c4..7c162cc 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    User-selectable configuration macros (specification only).           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -568,7 +568,12 @@ FT_BEGIN_HEADER
 
 #endif /* FT_CONFIG_OPTION_CHESTER_HINTS */
 
-#define FT_OPTIMIZE_MEMORY
+/*
+ * This temporary macro is used to control various optimizations for
+ * reducing the heap footprint of memory-mapped TrueType files.
+ *
+ */
+#define  FT_OPTIMIZE_MEMORY
 
 FT_END_HEADER
 
diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
index e945f76..6308061 100644
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType memory management macros (specification).               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004 by                                     */
+/*  Copyright 1996-2001, 2002, 2004, 2005 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg                       */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -260,14 +260,14 @@ FT_BEGIN_HEADER
 
 #define FT_ZERO( p )                FT_MEM_ZERO( p, sizeof ( *(p) ) )
 
-#define FT_ARRAY_ZERO( dest, count )                               \
-          FT_MEM_ZERO( dest, (count)*sizeof( *(dest) ) )
+#define FT_ARRAY_ZERO( dest, count )                        \
+          FT_MEM_ZERO( dest, (count) * sizeof ( *(dest) ) )
 
-#define FT_ARRAY_COPY( dest, source, count )                       \
-          FT_MEM_COPY( dest, source, (count) * sizeof( *(dest) ) )
+#define FT_ARRAY_COPY( dest, source, count )                        \
+          FT_MEM_COPY( dest, source, (count) * sizeof ( *(dest) ) )
 
-#define FT_ARRAY_MOVE( dest, source, count )                       \
-          FT_MEM_MOVE( dest, source, (count) * sizeof( *(dest) ) )
+#define FT_ARRAY_MOVE( dest, source, count )                        \
+          FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) )
 
 
   /*************************************************************************/
diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h
index 556a994..1267e16 100644
--- a/include/freetype/internal/fttrace.h
+++ b/include/freetype/internal/fttrace.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Tracing handling (specification only).                               */
 /*                                                                         */
-/*  Copyright 2002, 2004 by                                                */
+/*  Copyright 2002, 2004, 2005 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -43,6 +43,7 @@ FT_TRACE_DEF( cache )     /* cache sub-system        (ftcache.c, etc.) */
   /* SFNT driver components */
 FT_TRACE_DEF( sfobjs )    /* SFNT object handler     (sfobjs.c)   */
 FT_TRACE_DEF( ttcmap )    /* charmap handler         (ttcmap.c)   */
+FT_TRACE_DEF( ttkern )    /* kerning handler         (ttkern.c)   */
 FT_TRACE_DEF( ttload )    /* basic TrueType tables   (ttload.c)   */
 FT_TRACE_DEF( ttpost )    /* PS table processing     (ttpost.c)   */
 FT_TRACE_DEF( ttsbit )    /* TrueType sbit handling  (ttsbit.c)   */
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
index bcab145..7b58263 100644
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    High-level `sfnt' driver interface (specification).                  */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -477,24 +477,27 @@ FT_BEGIN_HEADER
   typedef void
   (*TT_Free_Table_Func)( TT_Face  face );
 
- /**
-  * @functype: TT_Face_GetKerningFunc
-  *
-  * @description:
-  *   return the horizontal kerning value between two glyphs
-  *
-  * @input:
-  *    face        :: handle to source face object
-  *    left_glyph  :: left glyph index
-  *    right_glyph :: right glyph index
-  *
-  * @return:
-  *    kerning value in font units.
-  */
+
+  /*
+   * @functype:
+   *    TT_Face_GetKerningFunc
+   *
+   * @description:
+   *    Return the horizontal kerning value between two glyphs.
+   *
+   * @input:
+   *    face        :: A handle to the source face object.
+   *    left_glyph  :: The left glyph index.
+   *    right_glyph :: The right glyph index.
+   *
+   * @return:
+   *    The kerning value in font units.
+   */
   typedef FT_Int
-  (*TT_Face_GetKerningFunc)( TT_Face   face,
-                             FT_UInt   left_glyph,
-                             FT_UInt   right_glyph );
+  (*TT_Face_GetKerningFunc)( TT_Face  face,
+                             FT_UInt  left_glyph,
+                             FT_UInt  right_glyph );
+
 
   /*************************************************************************/
   /*                                                                       */
@@ -552,7 +555,7 @@ FT_BEGIN_HEADER
     TT_Load_SBit_Image_Func      load_sbit_image;
     TT_Free_Table_Func           free_sbits;
 
-    /* sett `ttkern.h' */
+    /* see `ttkern.h' */
     TT_Face_GetKerningFunc       get_kerning;
     
     /* see `ttpost.h' */
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index b06aa63..79e6e84 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -5,7 +5,7 @@
 /*    Basic SFNT/TrueType type definitions and interface (specification    */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004 by                                     */
+/*  Copyright 1996-2001, 2002, 2004, 2005 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -310,7 +310,9 @@ FT_BEGIN_HEADER
 
   } TT_GaspRec;
 
+
 #ifndef FT_OPTIMIZE_MEMORY
+
   /*************************************************************************/
   /*                                                                       */
   /* <Struct>                                                              */
@@ -360,6 +362,7 @@ FT_BEGIN_HEADER
 
   } TT_HdmxRec, *TT_Hdmx;
 
+
   /*************************************************************************/
   /*                                                                       */
   /* <Struct>                                                              */
@@ -385,6 +388,7 @@ FT_BEGIN_HEADER
     FT_FWord   value;  /* kerning value                */
 
   } TT_Kern0_PairRec, *TT_Kern0_Pair;
+
 #endif /* !OPTIMIZE_MEMORY */
 
 
@@ -1285,11 +1289,11 @@ FT_BEGIN_HEADER
     /*                                                                     */
     /***********************************************************************/
 
+    /* the glyph locations */
 #ifdef FT_OPTIMIZE_MEMORY
     FT_UInt               num_locations;
     FT_Byte*              glyph_locations;
 #else
-    /* the glyph locations */
     FT_UShort             num_locations;
     FT_Long*              glyph_locations;
 #endif
diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c
index 7db7bb9..3997d70 100644
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -5,7 +5,7 @@
 /*    Routines used to load and analyze a given glyph before hinting       */
 /*    (body).                                                              */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc.        */
+/*  Copyright 2000-2001, 2002, 2003, 2004, 2005 Catharon Productions Inc.  */
 /*  Author: David Turner                                                   */
 /*                                                                         */
 /*  This file is part of the Catharon Typography Project and shall only    */
@@ -303,11 +303,11 @@
       FT_Int  max  = outline->max_points;
 
 
-      if ( FT_RENEW_ARRAY( outline->points,        max,     news     ) ||
-           FT_RENEW_ARRAY( outline->horz_edges,    max * 2, news * 2 ) )
+      if ( FT_RENEW_ARRAY( outline->points,     max,     news     ) ||
+           FT_RENEW_ARRAY( outline->horz_edges, max * 2, news * 2 ) )
         goto Exit;
 
-      outline->vert_edges    = outline->horz_edges    + news;
+      outline->vert_edges = outline->horz_edges + news;
 
       if ( FT_RENEW_ARRAY( outline->horz_segments, max * 2, news * 2 ) )
         goto Exit;
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 1afd757..b640604 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Memory debugger (body).                                              */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003, 2004 by                                    */
+/*  Copyright 2001, 2002, 2003, 2004, 2005 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -27,24 +27,28 @@
 
 #ifdef FT_DEBUG_MEMORY
 
-#define KEEPALIVE  /* keep-alive means that free-d blocks aren't released
-                    * to the heap. This is useful to detect double-frees
-                    * or weird heap corruption, but it will use gobs of
-                    * memory however.
+#define  KEEPALIVE /* `Keep alive' means that freed blocks aren't released
+                    * to the heap.  This is useful to detect double-frees
+                    * or weird heap corruption, but it uses large amounts of
+                    * memory, however.
                     */
 
 #include <stdio.h>
 #include <stdlib.h>
 
+
   extern void
   FT_DumpMemory( FT_Memory  memory );
 
+
   typedef struct FT_MemSourceRec_*  FT_MemSource;
   typedef struct FT_MemNodeRec_*    FT_MemNode;
   typedef struct FT_MemTableRec_*   FT_MemTable;
 
+
 #define FT_MEM_VAL( addr )  ((FT_ULong)(FT_Pointer)( addr ))
 
+
   typedef struct FT_MemSourceRec_
   {
     const char*   file_name;
@@ -65,10 +69,12 @@
 
   } FT_MemSourceRec;
 
-/* we don't need a resizable array for the memory sources, because
- * their number is pretty limited within FreeType.
+
+/*
+ *  We don't need a resizable array for the memory sources, because
+ *  their number is pretty limited within FreeType.
  */
-#define  FT_MEM_SOURCE_BUCKETS  128
+#define FT_MEM_SOURCE_BUCKETS  128
 
 
   typedef struct  FT_MemNodeRec_
@@ -105,7 +111,7 @@
     FT_Bool          bound_count;
     FT_ULong         alloc_count_max;
 
-    FT_MemSource     sources[ FT_MEM_SOURCE_BUCKETS ];
+    FT_MemSource     sources[FT_MEM_SOURCE_BUCKETS];
 
     const char*      file_name;
     FT_Long          line_no;
@@ -127,9 +133,9 @@
 #define FT_FILENAME( x )  ((x) ? (x) : "unknown file")
 
 
- /* I hate these prime numbers. I'd better implement L-Hashing
-  * which is 10% faster and doesn't require divisions, but
-  * I'm too lazy at the moment.
+ /*
+  *  Prime numbers are ugly to handle.  It would be better to implement
+  *  L-Hashing, which is 10% faster and doesn't require divisions.
   */
   static const FT_UInt  ft_mem_primes[] =
   {
@@ -186,9 +192,9 @@
   }
 
 
-
   extern void
-  ft_mem_debug_panic( const char*  fmt, ... )
+  ft_mem_debug_panic( const char*  fmt,
+                      ... )
   {
     va_list  ap;
 
@@ -242,13 +248,13 @@
     new_size = ft_mem_closest_prime( table->nodes );
     if ( new_size != table->size )
     {
-      FT_MemNode*  new_buckets ;
+      FT_MemNode*  new_buckets;
       FT_ULong     i;
 
 
       new_buckets = (FT_MemNode *)
-                    ft_mem_table_alloc( table,
-                                        new_size * sizeof ( FT_MemNode ) );
+                      ft_mem_table_alloc( table,
+                                          new_size * sizeof ( FT_MemNode ) );
       if ( new_buckets == NULL )
         return;
 
@@ -307,8 +313,8 @@
     table->free    = memory->free;
 
     table->buckets = (FT_MemNode *)
-                     memory->alloc( memory,
-                                    table->size * sizeof ( FT_MemNode ) );
+                       memory->alloc( memory,
+                                      table->size * sizeof ( FT_MemNode ) );
     if ( table->buckets )
       FT_ARRAY_ZERO( table->buckets, table->size );
     else
@@ -327,6 +333,7 @@
   {
     FT_ULong  i;
 
+
     FT_DumpMemory( table->memory );
 
     if ( table )
@@ -334,8 +341,7 @@
       FT_Long    leak_count = 0;
       FT_ULong   leaks = 0;
 
-     /* remove all blocks from the table, revealing leaked ones
-      */
+      /* remove all blocks from the table, revealing leaked ones */
       for ( i = 0; i < table->size; i++ )
       {
         FT_MemNode  *pnode = table->buckets + i, next, node = *pnode;
@@ -368,18 +374,19 @@
         }
         table->buckets[i] = 0;
       }
+
       ft_mem_table_free( table, table->buckets );
       table->buckets = NULL;
 
       table->size   = 0;
       table->nodes  = 0;
 
-     /* remove all sources
-      */
+      /* remove all sources */
       for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ )
       {
         FT_MemSource  source, next;
 
+
         for ( source = table->sources[i]; source != NULL; source = next )
         {
           next = source->link;
@@ -438,8 +445,11 @@
     FT_UInt32     hash;
     FT_MemSource  node, *pnode;
 
-    hash  = (FT_UInt32)(void*)table->file_name + (FT_UInt32)(5*table->line_no);
-    pnode = &table->sources[ hash % FT_MEM_SOURCE_BUCKETS ];
+
+    hash  = (FT_UInt32)(void*)table->file_name +
+              (FT_UInt32)( 5 * table->line_no );
+    pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];
+
     for ( ;; )
     {
       node = *pnode;
@@ -453,12 +463,11 @@
       pnode = &node->link;
     }
 
-    node = ft_mem_table_alloc( table, sizeof(*node) );
+    node = ft_mem_table_alloc( table, sizeof ( *node ) );
     if ( node == NULL )
       ft_mem_debug_panic(
         "not enough memory to perform memory debugging\n" );
 
-
     node->file_name = table->file_name;
     node->line_no   = table->line_no;
 
@@ -493,21 +502,22 @@
     {
       FT_MemSource  source;
 
+
       pnode = ft_mem_table_get_nodep( table, address );
       node  = *pnode;
       if ( node )
       {
         if ( node->size < 0 )
         {
-          /* this block was already freed.  This means that our memory is */
-          /* now completely corrupted!                                    */
-          /* this can only happen in keep-alive mode                      */
+          /* This block was already freed.  Our memory is now completely */
+          /* corrupted!                                                  */
+          /* This can only happen in keep-alive mode.                    */
           ft_mem_debug_panic(
             "memory heap corrupted (allocating freed block)" );
         }
         else
         {
-          /* this block was already allocated.  This means that our memory */
+          /* This block was already allocated.  This means that our memory */
           /* is also corrupted!                                            */
           ft_mem_debug_panic(
             "memory heap corrupted (re-allocating allocated block at"
@@ -577,6 +587,7 @@
       {
         FT_MemSource  source;
 
+
         if ( node->size < 0 )
           ft_mem_debug_panic(
             "freeing memory block at %p more than once at (%s:%ld)\n"
@@ -586,7 +597,7 @@
             FT_FILENAME( node->source->file_name ), node->source->line_no,
             FT_FILENAME( node->free_file_name ), node->free_line_no );
 
-        /* scramble the node's content for additionnals safety */
+        /* scramble the node's content for additional safety */
         FT_MEM_SET( address, 0xF3, node->size );
         table->alloc_current -= node->size;
 
@@ -599,13 +610,13 @@
         {
           /* we simply invert the node's size to indicate that the node */
           /* was freed.                                                 */
-          node->size            = -node->size;
-          node->free_file_name  = table->file_name;
-          node->free_line_no    = table->line_no;
+          node->size           = -node->size;
+          node->free_file_name = table->file_name;
+          node->free_line_no   = table->line_no;
         }
         else
         {
-          table->nodes --;
+          table->nodes--;
 
           *pnode = node->link;
 
@@ -640,12 +651,12 @@
       ft_mem_debug_panic( "negative block size allocation (%ld)", size );
 
     /* return NULL if the maximum number of allocations was reached */
-    if ( table->bound_count &&
+    if ( table->bound_count                           &&
          table->alloc_count >= table->alloc_count_max )
       return NULL;
 
     /* return NULL if this allocation would overflow the maximum heap size */
-    if ( table->bound_total &&
+    if ( table->bound_total                                             &&
          table->alloc_current + (FT_ULong)size > table->alloc_total_max )
       return NULL;
 
@@ -658,7 +669,7 @@
     table->file_name = NULL;
     table->line_no   = 0;
 
-    return (FT_Pointer) block;
+    return (FT_Pointer)block;
   }
 
 
@@ -714,7 +725,7 @@
         "trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)",
         block, cur_size, file_name, line_no );
 
-    /* check 'cur_size' value */
+    /* check `cur_size' value */
     pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block );
     node  = *pnode;
     if ( !node )
@@ -761,6 +772,7 @@
       {
         const char*  p;
 
+
         memory->user    = table;
         memory->alloc   = ft_mem_debug_alloc;
         memory->realloc = ft_mem_debug_realloc;
@@ -769,31 +781,34 @@
         p = getenv( "FT2_ALLOC_TOTAL_MAX" );
         if ( p != NULL )
         {
-          FT_Long   total_max = ft_atol(p);
+          FT_Long   total_max = ft_atol( p );
+
 
           if ( total_max > 0 )
           {
             table->bound_total     = 1;
-            table->alloc_total_max = (FT_ULong) total_max;
+            table->alloc_total_max = (FT_ULong)total_max;
           }
         }
 
         p = getenv( "FT2_ALLOC_COUNT_MAX" );
         if ( p != NULL )
         {
-          FT_Long  total_count = ft_atol(p);
+          FT_Long  total_count = ft_atol( p );
+
 
           if ( total_count > 0 )
           {
             table->bound_count     = 1;
-            table->alloc_count_max = (FT_ULong) total_count;
+            table->alloc_count_max = (FT_ULong)total_count;
           }
         }
 
         p = getenv( "FT2_KEEP_ALIVE" );
         if ( p != NULL )
         {
-          FT_Long  keep_alive = ft_atol(p);
+          FT_Long  keep_alive = ft_atol( p );
+
 
           if ( keep_alive > 0 )
             table->keep_alive = 1;
@@ -839,6 +854,7 @@
       table->file_name = file_name;
       table->line_no   = line_no;
     }
+
     return FT_Alloc( memory, size, P );
   }
 
@@ -859,6 +875,7 @@
       table->file_name = file_name;
       table->line_no   = line_no;
     }
+
     return FT_Realloc( memory, current, size, P );
   }
 
@@ -899,6 +916,7 @@
       table->file_name = file_name;
       table->line_no   = line_no;
     }
+
     return FT_QRealloc( memory, current, size, P );
   }
 
@@ -917,6 +935,7 @@
       table->file_name = file_name;
       table->line_no   = line_no;
     }
+
     FT_Free( memory, (void **)block );
   }
 
@@ -928,6 +947,7 @@
     FT_MemSource  s1 = *(FT_MemSource*)p1;
     FT_MemSource  s2 = *(FT_MemSource*)p2;
 
+
     if ( s2->max_size > s1->max_size )
       return 1;
     else if ( s2->max_size < s1->max_size )
@@ -945,48 +965,55 @@
 
     if ( table )
     {
-      FT_MemSource* bucket = table->sources;
-      FT_MemSource* limit  = bucket + FT_MEM_SOURCE_BUCKETS;
-      FT_MemSource* sources;
-      FT_UInt       nn, count;
-      const char*   fmt;
+      FT_MemSource*  bucket = table->sources;
+      FT_MemSource*  limit  = bucket + FT_MEM_SOURCE_BUCKETS;
+      FT_MemSource*  sources;
+      FT_UInt        nn, count;
+      const char*    fmt;
+
 
       count = 0;
       for ( ; bucket < limit; bucket++ )
       {
         FT_MemSource  source = *bucket;
 
+
         for ( ; source; source = source->link )
           count++;
       }
 
-      sources = ft_mem_table_alloc( table, sizeof(*sources) * count );
+      sources = ft_mem_table_alloc( table, sizeof ( *sources ) * count );
 
       count = 0;
       for ( bucket = table->sources; bucket < limit; bucket++ )
       {
         FT_MemSource  source = *bucket;
 
+
         for ( ; source; source = source->link )
           sources[count++] = source;
       }
 
-      ft_qsort( sources, count, sizeof(*sources), ft_mem_source_compare );
+      ft_qsort( sources, count, sizeof ( *sources ), ft_mem_source_compare );
 
-      printf( "FreeType Memory Dump: current=%ld max=%ld total=%ld count=%ld\n",
-              table->alloc_current, table->alloc_max, table->alloc_total, table->alloc_count );
+      printf( "FreeType Memory Dump: "
+              "current=%ld max=%ld total=%ld count=%ld\n",
+              table->alloc_current, table->alloc_max,
+              table->alloc_total, table->alloc_count );
       printf( " block  block    sizes    sizes    sizes   source\n" );
       printf( " count   high      sum  highsum      max   location\n" );
       printf( "-------------------------------------------------\n" );
+
       fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n";
 
       for ( nn = 0; nn < count; nn++ )
       {
         FT_MemSource  source = sources[nn];
 
+
         printf( fmt,
                 source->cur_blocks, source->max_blocks,
-                source->cur_size,   source->max_size, source->cur_max,
+                source->cur_size, source->max_size, source->cur_max,
                 FT_FILENAME( source->file_name ),
                 source->line_no );
       }
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index bc365dd..a971dc5 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType font driver implementation (body).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -105,13 +105,14 @@
     TT_Face       face = (TT_Face)ttface;
     SFNT_Service  sfnt = face->sfnt;
 
+
     kerning->x = 0;
     kerning->y = 0;
 
     if ( sfnt )
       kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
 
-    return 0;
+    return CFF_Err_Ok;
   }
 
 
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 6f167a0..fc0501a 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType objects manager (body).                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -81,19 +81,22 @@
     if ( !error )
     {
       /* XXX: TODO: move this code to the SFNT module where it belongs */
+
 #ifdef FT_OPTIMIZE_MEMORY
+
       FT_Byte*    strike = face->sbit_table + 8 + strike_index*48;
 
-      sbit_metrics->ascender  = (FT_Char)strike[16] << 6;  /* hori.ascender */
+      sbit_metrics->ascender  = (FT_Char)strike[16] << 6;  /* hori.ascender  */
       sbit_metrics->descender = (FT_Char)strike[17] << 6;  /* hori.descender */
 
       /* XXX: Is this correct? */
-      sbit_metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */
-                                             strike[18] + /* max_width */
+      sbit_metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB  */
+                                             strike[18] + /* max_width      */
                                     (FT_Char)strike[23]   /* min_advance_SB */
                                                         ) << 6;
 
 #else /* !OPTIMIZE_MEMORY */
+
       TT_SBit_Strike  strike = face->sbit_strikes + strike_index;
 
 
@@ -104,6 +107,7 @@
       sbit_metrics->max_advance = ( strike->hori.min_origin_SB  +
                                     strike->hori.max_width      +
                                     strike->hori.min_advance_SB ) << 6;
+
 #endif /* !OPTIMIZE_MEMORY */
 
       /* XXX: Is this correct? */
diff --git a/src/sfnt/Jamfile b/src/sfnt/Jamfile
index 256b63a..03c429a 100644
--- a/src/sfnt/Jamfile
+++ b/src/sfnt/Jamfile
@@ -1,4 +1,4 @@
-# FreeType 2 src/sfnt Jamfile (c) 2001, 2002, 2004 David Turner
+# FreeType 2 src/sfnt Jamfile (c) 2001, 2002, 2004, 2005 David Turner
 #
 
 SubDir  FT2_TOP $(FT2_SRC_DIR) sfnt ;
diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk
index 865eac1..e15681b 100644
--- a/src/sfnt/rules.mk
+++ b/src/sfnt/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2002, 2003, 2004 by
+# Copyright 1996-2000, 2002, 2003, 2004, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index ffb6870..2595c72 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    High-level SFNT driver interface (body).                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -366,8 +366,8 @@
     /* see `ttsbit.h' and `sfnt.h' */
     tt_face_set_sbit_strike,
     tt_face_load_sbit_strikes,
-    NULL /* tt_find_sbit_image */,
-    NULL /* tt_load_sbit_metrics */,
+    0 /* tt_find_sbit_image */,
+    0 /* tt_load_sbit_metrics */,
     tt_face_load_sbit_image,
     tt_face_free_sbit_strikes,
 
diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c
index 1102bcb..798f923 100644
--- a/src/sfnt/sfnt.c
+++ b/src/sfnt/sfnt.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Single object library component.                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 7d6a1a4..79e0e96 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    SFNT object management (base).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -511,7 +511,7 @@
     (void)LOAD_( gasp );
     (void)LOAD_( kerning );
 
-    error = 0;
+    error = SFNT_Err_Ok;
 
     face->root.family_name = tt_face_get_name( face,
                                                TT_NAME_ID_PREFERRED_FAMILY );
@@ -560,7 +560,7 @@
 
 #if 0
       /* kerning available ? */
-      if ( TT_FACE_HAS_KERNING(face) )
+      if ( TT_FACE_HAS_KERNING( face ) )
         flags |= FT_FACE_FLAG_KERNING;
 #endif
 
@@ -780,6 +780,7 @@
     {
       FT_Stream  stream = FT_FACE_STREAM( face );
 
+
       FT_FRAME_RELEASE( face->horz_metrics );
       FT_FRAME_RELEASE( face->vert_metrics );
       face->horz_metrics_size = 0;
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index 8193368..b4b8ef8 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType character mapping table (cmap) support (body).              */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004 by                                          */
+/*  Copyright 2002, 2003, 2004, 2005 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -627,18 +627,18 @@
 
   typedef struct TT_CMap4Rec_
   {
-    TT_CMapRec   cmap;
-    FT_UInt32    old_charcode;   /* old charcode */
-    FT_UInt32    cur_charcode;   /* current charcode */
-    FT_UInt      cur_gindex;     /* current glyph index */
-
-    FT_UInt      table_length;
-    FT_UInt      num_ranges;
-    FT_UInt      cur_range;
-    FT_UInt      cur_start;
-    FT_UInt      cur_end;
-    FT_Int       cur_delta;
-    FT_Byte*     cur_values;
+    TT_CMapRec  cmap;
+    FT_UInt32   old_charcode;   /* old charcode */
+    FT_UInt32   cur_charcode;   /* current charcode */
+    FT_UInt     cur_gindex;     /* current glyph index */
+
+    FT_UInt     table_length;
+    FT_UInt     num_ranges;
+    FT_UInt     cur_range;
+    FT_UInt     cur_start;
+    FT_UInt     cur_end;
+    FT_Int      cur_delta;
+    FT_Byte*    cur_values;
 
   } TT_CMap4Rec, *TT_CMap4;
 
@@ -647,15 +647,16 @@
   tt_cmap4_init( TT_CMap4  cmap,
                  FT_Byte*  table )
   {
-    FT_Byte*   p;
+    FT_Byte*  p;
+
 
     cmap->cmap.data = table;
 
     p                  = table + 2;
-    cmap->table_length = FT_PEEK_USHORT(p);
+    cmap->table_length = FT_PEEK_USHORT( p );
 
     p                  = table + 6;
-    cmap->num_ranges   = FT_PEEK_USHORT(p) >> 1;
+    cmap->num_ranges   = FT_PEEK_USHORT( p ) >> 1;
     cmap->cur_range    = cmap->num_ranges;
     cmap->old_charcode = 0xFFFFFFFFUL;
     cmap->cur_charcode = 0;
@@ -665,7 +666,6 @@
   }
 
 
-
   static FT_Int
   tt_cmap4_set_range( TT_CMap4  cmap,
                       FT_UInt   range_index )
@@ -674,23 +674,25 @@
     FT_Byte*  p;
     FT_UInt   num_ranges = cmap->num_ranges;
 
+
     while ( range_index < num_ranges )
     {
       FT_UInt  offset;
 
-      p             = table + 14 + range_index*2;
-      cmap->cur_end = FT_PEEK_USHORT(p);
 
-      p              += 2 + num_ranges*2;
-      cmap->cur_start = FT_PEEK_USHORT(p);
+      p             = table + 14 + range_index * 2;
+      cmap->cur_end = FT_PEEK_USHORT( p );
+
+      p              += 2 + num_ranges * 2;
+      cmap->cur_start = FT_PEEK_USHORT( p );
 
-      p += num_ranges*2;
-      cmap->cur_delta = FT_PEEK_SHORT(p);
+      p              += num_ranges * 2;
+      cmap->cur_delta = FT_PEEK_SHORT( p );
 
-      p += num_ranges*2;
-      offset = FT_PEEK_SHORT(p);
+      p     += num_ranges * 2;
+      offset = FT_PEEK_SHORT( p );
 
-      if ( offset != 0xFFFF )
+      if ( offset != 0xFFFFU )
       {
         cmap->cur_values = offset ? p + offset : NULL;
         cmap->cur_range  = range_index;
@@ -712,30 +714,33 @@
   static void
   tt_cmap4_next( TT_CMap4  cmap )
   {
-    FT_UInt  num_ranges = cmap->num_ranges;
     FT_UInt  charcode   = cmap->cur_charcode + 1;
 
+
     cmap->old_charcode = cmap->cur_charcode;
 
     for ( ;; )
     {
-      FT_Byte* values = cmap->cur_values;
-      FT_UInt  end    = cmap->cur_end;
-      FT_Int   delta  = cmap->cur_delta;
+      FT_Byte*  values = cmap->cur_values;
+      FT_UInt   end    = cmap->cur_end;
+      FT_Int    delta  = cmap->cur_delta;
+
 
       if ( charcode <= end )
       {
         if ( values )
         {
-          FT_Byte*  p = values + 2*(charcode-cmap->cur_start);
+          FT_Byte*  p = values + 2 * ( charcode - cmap->cur_start );
+
 
           do
           {
-            FT_UInt  gindex = FT_NEXT_USHORT(p);
+            FT_UInt  gindex = FT_NEXT_USHORT( p );
+
 
             if ( gindex != 0 )
             {
-              gindex = (FT_UInt)((gindex + delta) & 0xFFFF);
+              gindex = (FT_UInt)( ( gindex + delta ) & 0xFFFFU );
               if ( gindex != 0 )
               {
                 cmap->cur_charcode = charcode;
@@ -743,14 +748,14 @@
                 return;
               }
             }
-          }
-          while ( ++charcode <= end );
+          } while ( ++charcode <= end );
         }
         else
         {
           do
           {
-            FT_UInt  gindex = (FT_UInt)((charcode + delta) & 0xFFFFU);
+            FT_UInt  gindex = (FT_UInt)( ( charcode + delta ) & 0xFFFFU );
+
 
             if ( gindex != 0 )
             {
@@ -758,14 +763,12 @@
               cmap->cur_gindex   = gindex;
               return;
             }
-          }
-          while ( ++charcode <= end );
+          } while ( ++charcode <= end );
         }
       }
 
-     /* we need to find another range
-      */
-      if ( tt_cmap4_set_range( cmap, cmap->cur_range+1 ) < 0 )
+      /* we need to find another range */
+      if ( tt_cmap4_set_range( cmap, cmap->cur_range + 1 ) < 0 )
         break;
 
       charcode = cmap->cur_start;
@@ -1092,6 +1095,7 @@
       {
         TT_CMap4  cmap4 = (TT_CMap4)cmap;
 
+
         if ( char_code == cmap4->old_charcode )
         {
           result = cmap4->cur_charcode;
diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c
index f59dc03..a488404 100644
--- a/src/sfnt/ttkern.c
+++ b/src/sfnt/ttkern.c
@@ -1,11 +1,11 @@
 /***************************************************************************/
 /*                                                                         */
-/*  ttkern.h                                                               */
+/*  ttkern.c                                                               */
 /*                                                                         */
-/*    Load the basic TrueType kerning table. This doesn't handle           */
+/*    Load the basic TrueType kerning table.  This doesn't handle          */
 /*    kerning data within the GPOS table at the moment.                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,6 +21,7 @@
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 #include FT_TRUETYPE_TAGS_H
+#include "ttkern.h"
 #include "ttload.h"
 
 #include "sferrors.h"
@@ -33,7 +34,7 @@
   /* messages during execution.                                            */
   /*                                                                       */
 #undef  FT_COMPONENT
-#define FT_COMPONENT  trace_ttload
+#define FT_COMPONENT  trace_ttkern
 
 
 #undef  TT_KERN_INDEX
@@ -72,15 +73,15 @@
       FT_ERROR(( "could not extract kerning table\n" ));
       goto Exit;
     }
-      
+
     face->kern_table_size = table_size;
-    
+
     p       = face->kern_table;
     p_limit = p + table_size;
 
     p         += 2; /* skip version */
-    num_tables = FT_NEXT_USHORT(p);
-    
+    num_tables = FT_NEXT_USHORT( p );
+
     if ( num_tables > 32 ) /* we only support up to 32 sub-tables */
       num_tables = 32;
 
@@ -89,56 +90,61 @@
       FT_UInt    num_pairs, version, length, coverage;
       FT_Byte*   p_next;
       FT_UInt32  mask = 1UL << nn;
-      
+
+
       if ( p + 6 > p_limit )
         break;
 
       p_next = p;
-      
-      version  = FT_NEXT_USHORT(p);
-      length   = FT_NEXT_USHORT(p);
-      coverage = FT_NEXT_USHORT(p);
-      
+
+      version  = FT_NEXT_USHORT( p );
+      length   = FT_NEXT_USHORT( p );
+      coverage = FT_NEXT_USHORT( p );
+
       if ( length <= 6 )
         break;
 
       p_next += length;
-      
-      if ( (coverage & ~8) != 0x0001 ||  /* only use horizontal kerning tables */
-           p+8 > p_limit               )
+
+      /* only use horizontal kerning tables */
+      if ( ( coverage & ~8 ) != 0x0001 ||
+           p + 8 > p_limit             )
         goto NextTable;
 
-      num_pairs = FT_NEXT_USHORT(p);
+      num_pairs = FT_NEXT_USHORT( p );
       p        += 6;
-      
-      if ( p + 6*num_pairs > p_limit )
+
+      if ( p + 6 * num_pairs > p_limit )
         goto NextTable;
 
       avail |= mask;
-      
-     /* now, try to see if the pairs in this table are ordered.
-      * when they are, we'll be able to use binary search
-      */
+
+      /*
+       *  Now check whether the pairs in this table are ordered.
+       *  We then can use binary search.
+       */
       if ( num_pairs > 0 )
       {
-        FT_UInt    count;
-        FT_UInt    old_pair;
-        
-        old_pair = FT_NEXT_ULONG(p);
+        FT_UInt  count;
+        FT_UInt  old_pair;
+
+
+        old_pair = FT_NEXT_ULONG( p );
         p       += 2;
 
-        for ( count = num_pairs-1; count > 0; count-- )
+        for ( count = num_pairs - 1; count > 0; count-- )
         {
           FT_UInt32  cur_pair;
-          
-          cur_pair = FT_NEXT_ULONG(p);
+
+
+          cur_pair = FT_NEXT_ULONG( p );
           if ( cur_pair <= old_pair )
             break;
 
           p += 2;
           old_pair = cur_pair;
         }
-        
+
         if ( count == 0 )
           ordered |= mask;
       }
@@ -150,7 +156,7 @@
     face->num_kern_tables = nn;
     face->kern_avail_bits = avail;
     face->kern_order_bits = ordered;
-    
+
   Exit:
     return error;
   }
@@ -160,7 +166,8 @@
   tt_face_done_kern( TT_Face  face )
   {
     FT_Stream  stream = face->root.stream;
-    
+
+
     FT_FRAME_RELEASE( face->kern_table );
     face->kern_table_size = 0;
     face->num_kern_tables = 0;
@@ -179,6 +186,7 @@
     FT_Byte*  p       = face->kern_table;
     FT_Byte*  p_limit = p + face->kern_table_size;
 
+
     p   += 4;
     mask = 0x0001;
 
@@ -186,88 +194,95 @@
     {
       FT_Byte* base     = p;
       FT_Byte* next     = base;
-      FT_UInt  version  = FT_NEXT_USHORT(p);
-      FT_UInt  length   = FT_NEXT_USHORT(p);
-      FT_UInt  coverage = FT_NEXT_USHORT(p);
+      FT_UInt  version  = FT_NEXT_USHORT( p );
+      FT_UInt  length   = FT_NEXT_USHORT( p );
+      FT_UInt  coverage = FT_NEXT_USHORT( p );
       FT_Int   value    = 0;
-      
+
+
       next = base + length;
-      
-      if ( (face->kern_avail_bits & mask) == 0 )
+
+      if ( ( face->kern_avail_bits & mask ) == 0 )
         goto NextTable;
 
-      if ( p+8 > next )
+      if ( p + 8 > next )
         goto NextTable;
 
       switch ( coverage >> 8 )
       {
       case 0:
+        {
+          FT_UInt   num_pairs = FT_NEXT_USHORT( p );
+          FT_ULong  key0      = TT_KERN_INDEX( left_glyph, right_glyph );
+
+
+          p += 6;
+
+          if ( face->kern_order_bits & mask )   /* binary search */
           {
-            FT_UInt   num_pairs = FT_NEXT_USHORT(p);
-            FT_ULong  key0      = TT_KERN_INDEX(left_glyph,right_glyph);
+            FT_UInt   min = 0;
+            FT_UInt   max = num_pairs;
+            FT_Byte*  q;
 
-            p += 6;
-            
-            if ( face->kern_order_bits & mask )   /* binary search */
+
+            while ( min < max )
             {
-              FT_UInt   min = 0;
-              FT_UInt   max = num_pairs;
-              FT_Byte*  q;
-              
-              while ( min < max )
+              FT_UInt   mid = ( min + max ) >> 1;
+              FT_Byte*  q   = p + 6 * mid;
+              FT_ULong  key;
+
+
+              key = FT_NEXT_ULONG( q );
+
+              if ( key == key0 )
               {
-                FT_UInt   mid = (min+max) >> 1;
-                FT_Byte*  q = p + 6*mid;
-                FT_ULong   key;
-                
-                key   = FT_NEXT_ULONG(q);
-                
-                if ( key == key0 )
-                {
-                  value = FT_PEEK_SHORT(q);
-                  goto Found;
-                }
-                if ( key < key0 )
-                  min = mid+1;
-                else
-                  max = mid;
+                value = FT_PEEK_SHORT( q );
+                goto Found;
               }
+              if ( key < key0 )
+                min = mid + 1;
+              else
+                max = mid;
             }
-            else /* linear search */
+          }
+          else /* linear search */
+          {
+            FT_UInt  count = num_pairs;
+
+
+            for ( ; count > 0; count-- )
             {
-              FT_UInt  count = num_pairs;
+              FT_ULong  key = FT_NEXT_ULONG( p );
+
 
-              for ( ; count > 0; count-- )
+              if ( key == key0 )
               {
-                FT_ULong  key = FT_NEXT_ULONG(p);
-                
-                if ( key == key0 )
-                {
-                  value = FT_PEEK_SHORT(p);
-                  goto Found;
-                }
-                p += 2;
+                value = FT_PEEK_SHORT( p );
+                goto Found;
               }
+              p += 2;
             }
           }
-          break;
+        }
+        break;
 
-      /* we don't support format 2 because we've never seen a single font
-       * using it in real life...
-       */
+       /*
+        *  We don't support format 2 because we've never seen a single font
+        *  using it in real life...
+        */
 
       default:
-          ;
+        ;
       }
 
       goto NextTable;
-      
+
     Found:
-      if ( coverage & 8 ) /* overide or addition */
+      if ( coverage & 8 ) /* overide or add */
         result = value;
       else
         result += value;
-        
+
     NextTable:
       p = next;
     }
@@ -276,8 +291,7 @@
     return result;
   }
 
-  
-#else /* !OPTMIZE_MEMORY */
+#else /* !OPTIMIZE_MEMORY */
 
   FT_CALLBACK_DEF( int )
   tt_kern_pair_compare( const void*  a,
@@ -365,20 +379,20 @@
         {
           TT_Kern0_Pair  pair0 = face->kern_pairs;
           FT_ULong       prev  = TT_KERN_INDEX( pair0->left, pair0->right );
-          
+
 
           for ( pair0++; pair0 < limit; pair0++ )
           {
             FT_ULong  next = TT_KERN_INDEX( pair0->left, pair0->right );
-            
+
 
             if ( next < prev )
               goto SortIt;
-              
+
             prev = next;
           }
           goto Exit;
-          
+
         SortIt:
           ft_qsort( (void*)face->kern_pairs, (int)num_pairs,
                     sizeof ( TT_Kern0_PairRec ), tt_kern_pair_compare );
@@ -400,6 +414,7 @@
     return error;
   }
 
+
   FT_CALLBACK_DEF( int )
   tt_kern_pair_compare( const void*  a,
                         const void*  b )
@@ -410,9 +425,9 @@
     FT_ULong  index1 = TT_KERN_INDEX( pair1->left, pair1->right );
     FT_ULong  index2 = TT_KERN_INDEX( pair2->left, pair2->right );
 
-
-    return ( index1 < index2 ? -1 :
-           ( index1 > index2 ?  1 : 0 ));
+    return index1 < index2 ? -1
+                           : ( index1 > index2 ? 1
+                                               : 0 );
   }
 
 
@@ -420,17 +435,17 @@
   tt_face_done_kern( TT_Face  face )
   {
     FT_Memory  memory = face->root.stream->memory;
-    
+
+
     FT_FREE( face->kern_pairs );
     face->num_kern_pairs = 0;
   }
 
 
-
   FT_LOCAL_DEF( FT_Int )
-  tt_face_get_kerning( TT_Face     face,
-                       FT_UInt     left_glyph,
-                       FT_UInt     right_glyph )
+  tt_face_get_kerning( TT_Face  face,
+                       FT_UInt  left_glyph,
+                       FT_UInt  right_glyph )
   {
     FT_Int         result = 0;
     TT_Kern0_Pair  pair;
@@ -477,5 +492,5 @@
 
 
 #undef TT_KERN_INDEX
-  
+
 /* END */
diff --git a/src/sfnt/ttkern.h b/src/sfnt/ttkern.h
index f71849b..18b1381 100644
--- a/src/sfnt/ttkern.h
+++ b/src/sfnt/ttkern.h
@@ -2,10 +2,10 @@
 /*                                                                         */
 /*  ttkern.h                                                               */
 /*                                                                         */
-/*    Load the basic TrueType kerning table. This doesn't handle           */
+/*    Load the basic TrueType kerning table.  This doesn't handle          */
 /*    kerning data within the GPOS table at the moment.                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2005 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -42,11 +42,12 @@ FT_BEGIN_HEADER
                        FT_UInt     right_glyph );
 
 #ifdef FT_OPTIMIZE_MEMORY
-#  define  TT_FACE_HAS_KERNING(face)   ((face)->kern_avail_bits != 0)
+#  define TT_FACE_HAS_KERNING( face )  ( (face)->kern_avail_bits != 0 )
 #else
-#  define  TT_FACE_HAS_KERNING(face)   ((face)->kern_pairs != NULL)
+#  define TT_FACE_HAS_KERNING( face )  ( (face)->kern_pairs != NULL )
 #endif
 
+
 FT_END_HEADER
 
 #endif /* __TTKERN_H__ */
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index e7a45f7..f59ef40 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -5,7 +5,7 @@
 /*    Load the basic TrueType tables, i.e., tables that can be either in   */
 /*    TTF or OTF fonts (body).                                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -801,6 +801,7 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
 #ifdef FT_OPTIMIZE_MEMORY
+
   static FT_Error
   tt_face_load_metrics( TT_Face    face,
                         FT_Stream  stream,
@@ -822,7 +823,7 @@
       ptable      = &face->vert_metrics;
       ptable_size = &face->vert_metrics_size;
       
-      /* The table is optional, quit silently if it wasn't found       */
+      /* The table is optional, quit silently if it wasn't found.      */
       /*                                                               */
       /* XXX: Some fonts have a valid vertical header with a non-null  */
       /*      `number_of_VMetrics' fields, but no corresponding `vmtx' */
@@ -849,10 +850,10 @@
       {
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
         /* If this is an incrementally loaded font and there are */
-        /* overriding metrics tolerate a missing 'hmtx' table.   */
-        if ( face->root.internal->incremental_interface &&
+        /* overriding metrics, tolerate a missing `hmtx' table.  */
+        if ( face->root.internal->incremental_interface          &&
              face->root.internal->incremental_interface->funcs->
-               get_glyph_metrics )
+               get_glyph_metrics                                 )
         {
           face->horizontal.number_Of_HMetrics = 0;
           error = SFNT_Err_Ok;
@@ -876,6 +877,7 @@
   }
 
 #else /* !OPTIMIZE_MEMORY */
+
   static FT_Error
   tt_face_load_metrics( TT_Face    face,
                         FT_Stream  stream,
@@ -897,7 +899,7 @@
 
     if ( vertical )
     {
-      /* The table is optional, quit silently if it wasn't found       */
+      /* The table is optional, quit silently if it wasn't found.      */
       /*                                                               */
       /* XXX: Some fonts have a valid vertical header with a non-null  */
       /*      `number_of_VMetrics' fields, but no corresponding `vmtx' */
@@ -927,10 +929,10 @@
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
         /* If this is an incrementally loaded font and there are */
-        /* overriding metrics tolerate a missing 'hmtx' table.   */
-        if ( face->root.internal->incremental_interface &&
+        /* overriding metrics, tolerate a missing `hmtx' table.  */
+        if ( face->root.internal->incremental_interface          &&
              face->root.internal->incremental_interface->funcs->
-               get_glyph_metrics )
+               get_glyph_metrics                                 )
         {
           face->horizontal.number_Of_HMetrics = 0;
           error = SFNT_Err_Ok;
@@ -993,9 +995,9 @@
       for ( ; cur < limit; cur++ )
         *cur = FT_GET_SHORT();
 
-      /* we fill up the missing left side bearings with the     */
+      /* We fill up the missing left side bearings with the     */
       /* last valid value.  Since this will occur for buggy CJK */
-      /* fonts usually only, nothing serious will happen        */
+      /* fonts usually only, nothing serious will happen.       */
       if ( num_shorts > num_shorts_checked && num_shorts_checked > 0 )
       {
         FT_Short  val = (*shorts)[num_shorts_checked - 1];
@@ -1014,8 +1016,10 @@
   Exit:
     return error;
   }
+
 #endif /* !FT_OPTIMIZE_METRICS */
 
+
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -1704,6 +1708,7 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
 #ifdef FT_OPTIMIZE_MEMORY
+
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_hdmx( TT_Face    face,
                      FT_Stream  stream )
@@ -1715,6 +1720,7 @@
     FT_Byte*   p;
     FT_Byte*   limit;
 
+
     /* this table is optional */
     error = face->goto_table( face, TTAG_hdmx, stream, &table_size );
     if ( error || table_size < 8 )
@@ -1726,9 +1732,9 @@
     p     = face->hdmx_table;
     limit = p + table_size;
 
-    version     = FT_NEXT_USHORT(p);
-    num_records = FT_NEXT_USHORT(p);
-    record_size = FT_NEXT_ULONG(p);
+    version     = FT_NEXT_USHORT( p );
+    num_records = FT_NEXT_USHORT( p );
+    record_size = FT_NEXT_ULONG( p );
 
     if ( version != 0 || num_records > 255 || record_size > 0x40000 )
     {
@@ -1741,7 +1747,7 @@
 
     for ( nn = 0; nn < num_records; nn++ )
     {
-      if ( p+record_size > limit )
+      if ( p + record_size > limit )
         break;
         
       face->hdmx_record_sizes[nn] = p[0];
@@ -1767,11 +1773,13 @@
     FT_Stream  stream = face->root.stream;
     FT_Memory  memory = stream->memory;
     
+
     FT_FREE( face->hdmx_record_sizes );
     FT_FRAME_RELEASE( face->hdmx_table );
   }
 
 #else /* !FT_OPTIMIZE_MEMORY */
+
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_hdmx( TT_Face    face,
                      FT_Stream  stream )
@@ -1797,9 +1805,9 @@
     if ( FT_FRAME_ENTER( 8L ) )
       goto Exit;
 
-    hdmx->version     = FT_GET_USHORT();
-    num_records       = FT_GET_SHORT();
-    record_size       = FT_GET_LONG();
+    hdmx->version = FT_GET_USHORT();
+    num_records   = FT_GET_SHORT();
+    record_size   = FT_GET_LONG();
 
     FT_FRAME_EXIT();
 
@@ -1831,7 +1839,7 @@
              FT_READ_BYTE( cur->max_width ) )
           goto Exit;
 
-        if ( FT_QALLOC( cur->widths, num_glyphs )       ||
+        if ( FT_QALLOC( cur->widths, num_glyphs )      ||
              FT_STREAM_READ( cur->widths, num_glyphs ) )
           goto Exit;
 
diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h
index 439b4df..d1a61ca 100644
--- a/src/sfnt/ttload.h
+++ b/src/sfnt/ttload.h
@@ -5,7 +5,7 @@
 /*    Load the basic TrueType tables, i.e., tables that can be either in   */
 /*    TTF or OTF fonts (specification).                                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2005 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index c449ddd..610b63b 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (body).                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -584,12 +584,11 @@
       }
     }
 
-   /* now set up the root fields to indicate the strikes
-    */
+    /* now set up the root fields to indicate the strikes */
     if ( face->num_sbit_strikes )
     {
       FT_ULong  n;
-      FT_Face   root = FT_FACE(face);
+      FT_Face   root = FT_FACE( face );
 
 
       if ( FT_NEW_ARRAY( root->available_sizes, face->num_sbit_strikes ) )
@@ -608,9 +607,9 @@
 
         /* assume 72dpi */
         bsize->height =
-          (FT_Short)( ( height * strike->y_ppem + fupem/2 ) / fupem );
+          (FT_Short)( ( height * strike->y_ppem + fupem / 2 ) / fupem );
         bsize->width  =
-          (FT_Short)( ( avg * strike->y_ppem + fupem/2 ) / fupem );
+          (FT_Short)( ( avg * strike->y_ppem + fupem / 2 ) / fupem );
         bsize->size   = strike->y_ppem << 6;
         bsize->x_ppem = strike->x_ppem << 6;
         bsize->y_ppem = strike->y_ppem << 6;
@@ -1514,6 +1513,7 @@
     return error;
   }
 
+#endif /* !OPTIMIZE_MEMORY */
+
 
 /* END */
-#endif /* !OPTIMIZE_MEMORY */
diff --git a/src/sfnt/ttsbit0.c b/src/sfnt/ttsbit0.c
index 2f7095c..74bb789 100644
--- a/src/sfnt/ttsbit0.c
+++ b/src/sfnt/ttsbit0.c
@@ -1,10 +1,11 @@
 /***************************************************************************/
 /*                                                                         */
-/*  ttsbit.c                                                               */
+/*  ttsbit0.c                                                              */
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (body).                */
+/*    This is a heap-optimized version.                                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 2005 by                                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -84,12 +85,11 @@
     };
 
 
-
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_sbit_strikes( TT_Face    face,
                              FT_Stream  stream )
   {
-    FT_Error   error  = 0;
+    FT_Error   error  = SFNT_Err_Ok;
     FT_Memory  memory = stream->memory;
     FT_Fixed   version;
     FT_ULong   num_strikes, table_size;
@@ -98,6 +98,7 @@
     FT_Byte*   p_limit;
     FT_UInt    nn, count;
 
+
     face->sbit_num_strikes = 0;
 
     /* this table is optional */
@@ -109,7 +110,7 @@
 
     if ( table_size < 8 )
     {
-      FT_ERROR(( "%s: table too short !\n", "tt_face_load_sbit_strikes" ));
+      FT_ERROR(( "%s: table too short!\n", "tt_face_load_sbit_strikes" ));
       error = SFNT_Err_Invalid_File_Format;
       goto Exit;
     }
@@ -122,30 +123,32 @@
     p       = face->sbit_table;
     p_limit = p + table_size;
 
-    version     = FT_NEXT_ULONG(p);
-    num_strikes = FT_NEXT_ULONG(p);
+    version     = FT_NEXT_ULONG( p );
+    num_strikes = FT_NEXT_ULONG( p );
 
-    if ( version != 0x00020000 || num_strikes >= 0x10000UL )
+    if ( version != 0x00020000UL || num_strikes >= 0x10000UL )
     {
-      FT_ERROR(( "%s: invalid table version !\n", "tt_face_load_sbit_strikes" ));
+      FT_ERROR(( "%s: invalid table version!\n",
+                 "tt_face_load_sbit_strikes" ));
       error = SFNT_Err_Invalid_File_Format;
       goto Fail;
     }
 
-   /* count the number of strikes available in the table. we're a bit
-    * paranoid there and don't trust the data.
-    */
+    /*
+     *  Count the number of strikes available in the table.  We are a bit
+     *  paranoid there and don't trust the data.
+     */
     count = (FT_UInt)num_strikes;
-    if ( 8+48UL*count > table_size )
-      count = (FT_UInt)( (p_limit - p)/48 );
+    if ( 8 +48UL * count > table_size )
+      count = (FT_UInt)( ( p_limit - p ) / 48 );
 
     face->sbit_num_strikes = count;
 
-   /* now allocate the root array of F_Bitmap_Size records,
-    * populate them, and that's all there is to it. Unfortunately,
-    * it's not possible to indicate bit depths in the FT_Bitmap_Size
-    * record. What were we thinking ?
-    */
+    /*
+     *  Now allocate the root array of FT_Bitmap_Size records and
+     *  populate them.  Unfortunately, it isn't possible to indicate bit
+     *  depths in the FT_Bitmap_Size record.  This is a design error.
+     */
     {
       FT_Memory  memory  = face->root.stream->memory;
       FT_UInt    em_size = (FT_UInt) face->header.Units_Per_EM;
@@ -155,6 +158,7 @@
 
       FT_Short   avgwidth = face->os2.xAvgCharWidth;
 
+
       if ( FT_NEW_ARRAY( face->root.available_sizes, count ) )
         goto Fail;
 
@@ -163,14 +167,15 @@
         FT_Bitmap_Size*  bsize = face->root.available_sizes + nn;
         FT_UInt          x_ppem, y_ppem;
 
+
         x_ppem = p[44];
         y_ppem = p[45];
 
         bsize->x_ppem = (FT_Pos)(x_ppem << 6);
         bsize->y_ppem = (FT_Pos)(y_ppem << 6);
 
-        bsize->height = (FT_Short)( height*y_ppem   + em_size/2 ) / em_size;
-        bsize->width  = (FT_Short)( avgwidth*y_ppem + em_size/2 ) / em_size;
+        bsize->height = (FT_Short)( height*y_ppem   + em_size / 2 ) / em_size;
+        bsize->width  = (FT_Short)( avgwidth*y_ppem + em_size / 2 ) / em_size;
         bsize->size   = bsize->y_ppem;
 
         p += 48;
@@ -178,7 +183,6 @@
 
       face->root.face_flags     |= FT_FACE_FLAG_FIXED_SIZES;
       face->root.num_fixed_sizes = count;
-
     }
 
   Exit:
@@ -196,6 +200,7 @@
   {
     FT_Stream  stream = face->root.stream;
 
+
     FT_FRAME_RELEASE( face->sbit_table );
     face->sbit_table_size  = 0;
     face->sbit_num_strikes = 0;
@@ -212,13 +217,15 @@
     FT_Byte*  p;
     FT_Byte*  p_limit;
 
-    if ( x_ppem > 255 ||
+
+    if ( x_ppem > 255               ||
          y_ppem < 1 || y_ppem > 255 )
       return SFNT_Err_Invalid_PPem;
 
     p       = face->sbit_table + 8;
     p_limit = p + face->sbit_table_size;
     count   = face->sbit_num_strikes;
+
     for ( nn = 0; nn < count; nn++ )
     {
       if ( x_ppem == (FT_UInt)p[44] && y_ppem == (FT_UInt)p[45] )
@@ -233,7 +240,6 @@
   }
 
 
-
   typedef struct
   {
     TT_Face          face;
@@ -265,16 +271,17 @@
     FT_Stream  stream     = face->root.stream;
     FT_ULong   ebdt_size;
 
+
     error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size );
     if ( error )
       error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size );
-    if (error)
+    if ( error )
       goto Exit;
 
-    decoder->face       = face;
-    decoder->stream     = stream;
-    decoder->bitmap     = &face->root.glyph->bitmap;
-    decoder->metrics    = metrics;
+    decoder->face    = face;
+    decoder->stream  = stream;
+    decoder->bitmap  = &face->root.glyph->bitmap;
+    decoder->metrics = metrics;
 
     decoder->metrics_loaded   = 0;
     decoder->bitmap_allocated = 0;
@@ -285,14 +292,14 @@
     decoder->eblc_base  = face->sbit_table;
     decoder->eblc_limit = face->sbit_table + face->sbit_table_size;
 
-   /* now find the strike corresponding to the index
-    */
+    /* now find the strike corresponding to the index */
     {
-      FT_Byte*  p = decoder->eblc_base + 8 + 48*strike_index;
+      FT_Byte*  p = decoder->eblc_base + 8 + 48 * strike_index;
+
 
-      decoder->strike_index_array = FT_NEXT_ULONG(p);
+      decoder->strike_index_array = FT_NEXT_ULONG( p );
       p                          += 4;
-      decoder->strike_index_count = FT_NEXT_ULONG(p);
+      decoder->strike_index_count = FT_NEXT_ULONG( p );
       p                          += 34;
       decoder->bit_depth          = *p;
     }
@@ -305,52 +312,52 @@
   static void
   tt_sbit_decoder_done( TT_SBitDecoder  decoder )
   {
-    FT_UNUSED(decoder);
+    FT_UNUSED( decoder );
   }
 
 
-
   static FT_Error
   tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder  decoder )
   {
-    FT_Error    error = 0;
+    FT_Error    error = SFNT_Err_Ok;
     FT_UInt     width, height;
     FT_Bitmap*  map = decoder->bitmap;
     FT_Long     size;
 
+
     if ( !decoder->metrics_loaded )
     {
-      error = FT_Err_Invalid_Argument;
+      error = SFNT_Err_Invalid_Argument;
       goto Exit;
     }
 
     width  = decoder->metrics->width;
     height = decoder->metrics->height;
 
-    map->width = (int) width;
-    map->rows  = (int) height;
+    map->width = (int)width;
+    map->rows  = (int)height;
 
     switch ( decoder->bit_depth )
     {
     case 1:
-        map->pixel_mode = FT_PIXEL_MODE_MONO;
-        map->pitch      = ( map->width + 7 ) >> 3;
-        break;
+      map->pixel_mode = FT_PIXEL_MODE_MONO;
+      map->pitch      = ( map->width + 7 ) >> 3;
+      break;
 
     case 2:
-        map->pixel_mode = FT_PIXEL_MODE_GRAY2;
-        map->pitch      = ( map->width + 3 ) >> 2;
-        break;
+      map->pixel_mode = FT_PIXEL_MODE_GRAY2;
+      map->pitch      = ( map->width + 3 ) >> 2;
+      break;
 
     case 4:
-        map->pixel_mode = FT_PIXEL_MODE_GRAY4;
-        map->pitch      = ( map->width + 1 ) >> 1;
-        break;
+      map->pixel_mode = FT_PIXEL_MODE_GRAY4;
+      map->pitch      = ( map->width + 1 ) >> 1;
+      break;
 
     case 8:
-        map->pixel_mode = FT_PIXEL_MODE_GRAY;
-        map->pitch      = map->width;
-        break;
+      map->pixel_mode = FT_PIXEL_MODE_GRAY;
+      map->pitch      = map->width;
+      break;
 
     default:
       error = SFNT_Err_Invalid_File_Format;
@@ -364,7 +371,7 @@
       goto Exit;     /* exit successfully! */
 
     error = ft_glyphslot_alloc_bitmap( decoder->face->root.glyph, size );
-    if (error)
+    if ( error )
       goto Exit;
 
     decoder->bitmap_allocated = 1;
@@ -383,28 +390,29 @@
     FT_Byte*         p       = *pp;
     TT_SBit_Metrics  metrics = decoder->metrics;
 
-    if ( p+5 > limit )
+
+    if ( p + 5 > limit )
       goto Fail;
 
     if ( !decoder->metrics_loaded )
     {
       metrics->height       = p[0];
       metrics->width        = p[1];
-      metrics->horiBearingX = (FT_Char) p[2];
-      metrics->horiBearingY = (FT_Char) p[3];
+      metrics->horiBearingX = (FT_Char)p[2];
+      metrics->horiBearingY = (FT_Char)p[3];
       metrics->horiAdvance  = p[4];
     }
 
     p += 5;
     if ( big )
     {
-      if ( p+3 > limit )
+      if ( p + 3 > limit )
         goto Fail;
 
       if ( !decoder->metrics_loaded )
       {
-        metrics->vertBearingX = (FT_Char) p[0];
-        metrics->vertBearingY = (FT_Char) p[1];
+        metrics->vertBearingX = (FT_Char)p[0];
+        metrics->vertBearingY = (FT_Char)p[1];
         metrics->vertAdvance  = p[2];
       }
 
@@ -416,14 +424,11 @@
     return 0;
 
   Fail:
-    return FT_Err_Invalid_Argument;
+    return SFNT_Err_Invalid_Argument;
   }
 
 
-
-
-
- /* forward declaration */
+  /* forward declaration */
   static FT_Error
   tt_sbit_decoder_load_image( TT_SBitDecoder  decoder,
                               FT_UInt         glyph_index,
@@ -437,8 +442,6 @@
                                                 FT_Int          y_pos );
 
 
-
-
   static FT_Error
   tt_sbit_decoder_load_byte_aligned( TT_SBitDecoder  decoder,
                                      FT_Byte*        p,
@@ -446,21 +449,21 @@
                                      FT_Int          x_pos,
                                      FT_Int          y_pos )
   {
-    FT_Error    error = 0;
+    FT_Error    error = SFNT_Err_Ok;
     FT_Byte*    line;
     FT_Int      bit_height, bit_width, pitch, width, height, h;
     FT_Bitmap*  bitmap;
     FT_UInt     rval;
 
+
     if ( !decoder->bitmap_allocated )
     {
       error = tt_sbit_decoder_alloc_bitmap( decoder );
-      if (error)
+      if ( error )
         goto Exit;
     }
 
-   /* check that we can write the glyph into the bitmap
-    */
+    /* check that we can write the glyph into the bitmap */
     bitmap     = decoder->bitmap;
     bit_width  = bitmap->width;
     bit_height = bitmap->rows;
@@ -469,22 +472,21 @@
     width  = decoder->metrics->width;
     height = decoder->metrics->height;
 
-    if ( x_pos < 0 || x_pos+width > bit_width   ||
-         y_pos < 0 || y_pos+height > bit_height )
+    if ( x_pos < 0 || x_pos + width > bit_width   ||
+         y_pos < 0 || y_pos + height > bit_height )
     {
-      error = FT_Err_Invalid_File_Format;
+      error = SFNT_Err_Invalid_File_Format;
       goto Exit;
     }
 
-    if ( p+((width+7)>>3)*height > limit )
+    if ( p + ( ( width + 7 ) >> 3 ) * height > limit )
     {
-      error = FT_Err_Invalid_File_Format;
+      error = SFNT_Err_Invalid_File_Format;
       goto Exit;
     }
 
-   /* now do the blit
-    */
-    line  += y_pos*pitch + (x_pos >> 3);
+    /* now do the blit */
+    line  += y_pos * pitch + ( x_pos >> 3 );
     x_pos &= 7;
 
     if ( x_pos == 0 )  /* the easy one */
@@ -494,14 +496,15 @@
         FT_Byte*  write = line;
         FT_Int    w;
 
+
         for ( w = width; w >= 8; w -= 8 )
         {
-          write[0] = (FT_Byte)(write[0] | *p++);
+          write[0] = (FT_Byte)( write[0] | *p++ );
           write   += 1;
         }
 
         if ( w > 0 )
-          write[0] = (FT_Byte)(write[0] | (*p++ & (0xFF00 >> w)));
+          write[0] = (FT_Byte)( write[0] | ( *p++ & ( 0xFF00U >> w ) ) );
       }
     }
     else  /* x_pos > 0 */
@@ -512,18 +515,19 @@
         FT_Int    w;
         FT_UInt   wval = 0;
 
+
         for ( w = width; w >= 8; w -= 8 )
         {
-          wval      = (FT_UInt)(wval | *p++);
-          write[0]  = (FT_Byte)(write[0] | (wval >> x_pos));
+          wval      = (FT_UInt)( wval | *p++ );
+          write[0]  = (FT_Byte)( write[0] | ( wval >> x_pos ) );
           write    += 1;
           wval    <<= 8;
         }
 
         if ( w > 0 )
-          wval = (FT_UInt)(wval | (*p++ & (0xFF00 >> w)));
+          wval = (FT_UInt)(wval | ( *p++ & ( 0xFF00U >> w ) ) );
 
-        write[0] = (FT_Byte)(write[0] | (wval >> x_pos));
+        write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );
       }
     }
 
@@ -539,21 +543,21 @@
                                      FT_Int          x_pos,
                                      FT_Int          y_pos )
   {
-    FT_Error    error = 0;
+    FT_Error    error = SFNT_Err_Ok;
     FT_Byte*    line;
     FT_Int      bit_height, bit_width, pitch, width, height, h;
     FT_Bitmap*  bitmap;
     FT_UInt32   rval;
 
+
     if ( !decoder->bitmap_allocated )
     {
       error = tt_sbit_decoder_alloc_bitmap( decoder );
-      if (error)
+      if ( error )
         goto Exit;
     }
 
-   /* check that we can write the glyph into the bitmap
-    */
+    /* check that we can write the glyph into the bitmap */
     bitmap     = decoder->bitmap;
     bit_width  = bitmap->width;
     bit_height = bitmap->rows;
@@ -562,24 +566,23 @@
     width  = decoder->metrics->width;
     height = decoder->metrics->height;
 
-    if ( x_pos < 0 || x_pos+width  > bit_width  ||
-         y_pos < 0 || y_pos+height > bit_height )
+    if ( x_pos < 0 || x_pos + width  > bit_width  ||
+         y_pos < 0 || y_pos + height > bit_height )
     {
-      error = FT_Err_Invalid_File_Format;
+      error = SFNT_Err_Invalid_File_Format;
       goto Exit;
     }
 
-    if ( p+((width+7)>>3)*height > limit )
+    if ( p + ( ( width + 7 ) >> 3 ) * height > limit )
     {
-      error = FT_Err_Invalid_File_Format;
+      error = SFNT_Err_Invalid_File_Format;
       goto Exit;
     }
 
-   /* now do the blit
-    */
-    line  += y_pos*pitch + (x_pos >> 3);
+    /* now do the blit */
+    line  += y_pos * pitch + ( x_pos >> 3 );
     x_pos &= 7;
-    rval   = 0x10000;
+    rval   = 0x10000UL;
 
     for ( h = height; h > 0; h--, line += pitch )
     {
@@ -587,19 +590,20 @@
       FT_UInt32  wval  = 0x100 << x_pos;
       FT_Int     w;
 
+
       for ( w = width; w >= 8; w -= 8 )
       {
-        if ( rval & 0x10000 )
+        if ( rval & 0x10000UL )
           rval = 0x100 | *p++;
 
-        wval |= (rval & 0x80);
+        wval |= rval & 0x80;
 
         wval <<= 1;
         rval <<= 1;
 
-        if ( wval & 0x10000 )
+        if ( wval & 0x10000UL )
         {
-          write[0] = (FT_Byte)(write[0] | (wval >> 8));
+          write[0] = (FT_Byte)( write[0] | ( wval >> 8 ) );
           write   += 1;
           wval     = 0x100;
         }
@@ -610,7 +614,7 @@
         while ( wval > 0x1FF )
           wval >>= 1;
 
-        write[0] = (FT_Byte)(write[0] | wval);
+        write[0] = (FT_Byte)( write[0] | wval );
       }
     }
 
@@ -630,21 +634,23 @@
     FT_UInt   num_components, nn;
 
 
-    if ( p+2 > limit )
+    if ( p + 2 > limit )
       goto Fail;
 
-    num_components = FT_NEXT_USHORT(p);
-    if ( p+4*num_components > limit )
+    num_components = FT_NEXT_USHORT( p );
+    if ( p + 4 * num_components > limit )
       goto Fail;
 
     for ( nn = 0; nn < num_components; nn++ )
     {
-      FT_UInt   gindex = FT_NEXT_USHORT(p);
-      FT_Byte   dx     = FT_NEXT_BYTE(p);
-      FT_Byte   dy     = FT_NEXT_BYTE(p);
+      FT_UInt   gindex = FT_NEXT_USHORT( p );
+      FT_Byte   dx     = FT_NEXT_BYTE( p );
+      FT_Byte   dy     = FT_NEXT_BYTE( p );
+
 
       /* NB: a recursive call */
-      error = tt_sbit_decoder_load_image( decoder, gindex, x_pos+dx, y_pos+dy );
+      error = tt_sbit_decoder_load_image( decoder, gindex,
+                                          x_pos + dx, y_pos + dy );
       if ( error )
         break;
     }
@@ -653,7 +659,7 @@
     return error;
 
   Fail:
-    error = FT_Err_Invalid_File_Format;
+    error = SFNT_Err_Invalid_File_Format;
     goto Exit;
   }
 
@@ -672,35 +678,38 @@
     FT_Byte*   p_limit;
     FT_Byte*   data;
 
-   /* seek into the EBDT table now
-    */
+
+    /* seek into the EBDT table now */
     if ( glyph_start + glyph_size > decoder->ebdt_size )
     {
-      error = FT_Err_Invalid_Argument;
+      error = SFNT_Err_Invalid_Argument;
       goto Exit;
     }
 
     if ( FT_STREAM_SEEK( decoder->ebdt_start + glyph_start ) ||
-         FT_FRAME_EXTRACT( glyph_size, data )                 )
+         FT_FRAME_EXTRACT( glyph_size, data )                )
       goto Exit;
 
     p       = data;
     p_limit = p + glyph_size;
 
-   /* read the data, depending on the glyph format
-    */
+    /* read the data, depending on the glyph format */
     switch ( glyph_format )
     {
-    case 1: case 2: case 8:
+    case 1:
+    case 2:
+    case 8:
       error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 0 );
       break;
 
-    case 6: case 7: case 9:
+    case 6:
+    case 7:
+    case 9:
       error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 );
       break;
 
     default:
-      error = 0;
+      error = SFNT_Err_Ok;
     }
 
     if ( error )
@@ -709,29 +718,33 @@
     {
       TT_SBitDecoder_LoadFunc  loader;
 
+
       switch ( glyph_format )
       {
-      case 1: case 6:
-          loader = tt_sbit_decoder_load_byte_aligned;
-          break;
+      case 1:
+      case 6:
+        loader = tt_sbit_decoder_load_byte_aligned;
+        break;
 
-      case 2: case 5: case 7:
-          loader = tt_sbit_decoder_load_bit_aligned;
-          break;
+      case 2:
+      case 5:
+      case 7:
+        loader = tt_sbit_decoder_load_bit_aligned;
+        break;
 
       case 8:
-          if ( p+1 > p_limit )
-            goto Fail;
+        if ( p + 1 > p_limit )
+          goto Fail;
 
-          p += 1;  /* skip padding */
-          /* fall-through */
+        p += 1;  /* skip padding */
+        /* fall-through */
 
       case 9:
-          loader = tt_sbit_decoder_load_compound;
-          break;
+        loader = tt_sbit_decoder_load_compound;
+        break;
 
       default:
-          goto Fail;
+        goto Fail;
       }
 
       error = loader( decoder, p, p_limit, x_pos, y_pos );
@@ -751,22 +764,25 @@
                               FT_Int          x_pos,
                               FT_Int          y_pos )
   {
-   /* first, we find the correct strike range that applies to this
-    * glyph index.
-    */
+    /*
+     *  First, we find the correct strike range that applies to this
+     *  glyph index.
+     */
+
     FT_Byte*  p          = decoder->eblc_base + decoder->strike_index_array;
     FT_Byte*  p_limit    = decoder->eblc_limit;
     FT_ULong  num_ranges = decoder->strike_index_count;
     FT_UInt   start, end, offset, index_format, image_format;
     FT_ULong  image_start, image_end, image_offset;
 
-    if ( p+8*num_ranges > p_limit )
+
+    if ( p + 8 * num_ranges > p_limit )
       goto NoBitmap;
 
     for ( ; num_ranges > 0; num_ranges-- )
     {
-      start = FT_NEXT_USHORT(p);
-      end   = FT_NEXT_USHORT(p);
+      start = FT_NEXT_USHORT( p );
+      end   = FT_NEXT_USHORT( p );
 
       if ( glyph_index >= start && glyph_index <= end )
         goto FoundRange;
@@ -776,128 +792,131 @@
     goto NoBitmap;
 
   FoundRange:
-    p = decoder->eblc_base + decoder->strike_index_array + FT_NEXT_ULONG(p);
-    if ( p+8 > p_limit )
+    p = decoder->eblc_base + decoder->strike_index_array + FT_NEXT_ULONG( p );
+    if ( p + 8 > p_limit )
       goto NoBitmap;
 
-   /* now, we're going to find the glyph's location and extend within
-    * the ebdt table
-    */
-    index_format = FT_NEXT_USHORT(p);
-    image_format = FT_NEXT_USHORT(p);
-    image_offset = FT_NEXT_ULONG(p);
+    /* now find the glyph's location and extend within the ebdt table */
+    index_format = FT_NEXT_USHORT( p );
+    image_format = FT_NEXT_USHORT( p );
+    image_offset = FT_NEXT_ULONG ( p );
 
     switch ( index_format )
     {
-    case 1: /* 4-byte offsets relative to 'image_offset' */
-        {
-          p += 4*(glyph_index-start);
-          if ( p+8 > p_limit )
-            goto NoBitmap;
+    case 1: /* 4-byte offsets relative to `image_offset' */
+      {
+        p += 4 * ( glyph_index - start );
+        if ( p + 8 > p_limit )
+          goto NoBitmap;
 
-          image_start = FT_NEXT_ULONG(p);
-          image_end   = FT_NEXT_ULONG(p);
+        image_start = FT_NEXT_ULONG( p );
+        image_end   = FT_NEXT_ULONG( p );
 
-          if ( image_start == image_end )  /* missing glyph */
-            goto NoBitmap;
-        }
-        break;
+        if ( image_start == image_end )  /* missing glyph */
+          goto NoBitmap;
+      }
+      break;
 
     case 2: /* big metrics, constant image size */
-        {
-          FT_ULong  image_size;
+      {
+        FT_ULong  image_size;
 
-          if ( p+12 > p_limit )
-            goto NoBitmap;
 
-          image_size = FT_NEXT_ULONG(p);
+        if ( p + 12 > p_limit )
+          goto NoBitmap;
 
-          if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) )
-            goto NoBitmap;
+        image_size = FT_NEXT_ULONG( p );
 
-          image_start = image_offset + image_size*(glyph_index-start);
-          image_end   = image_start  + image_size;
-        }
-        break;
+        if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) )
+          goto NoBitmap;
+
+        image_start = image_offset + image_size * ( glyph_index - start );
+        image_end   = image_start  + image_size;
+      }
+      break;
 
     case 3: /* 2-byte offsets relative to 'image_offset' */
-        {
-          p += 2*(glyph_index-start);
-          if ( p+4 > p_limit )
-            goto NoBitmap;
+      {
+        p += 2 * ( glyph_index - start );
+        if ( p + 4 > p_limit )
+          goto NoBitmap;
 
-          image_start = FT_NEXT_USHORT(p);
-          image_end   = FT_NEXT_USHORT(p);
+        image_start = FT_NEXT_USHORT( p );
+        image_end   = FT_NEXT_USHORT( p );
 
-          if ( image_start == image_end )  /* missing glyph */
-            goto NoBitmap;
-        }
-        break;
+        if ( image_start == image_end )  /* missing glyph */
+          goto NoBitmap;
+      }
+      break;
 
     case 4: /* sparse glyph array with (glyph,offset) pairs */
-        {
-          FT_ULong  mm, num_glyphs;
+      {
+        FT_ULong  mm, num_glyphs;
+
 
-          if ( p+4 > p_limit )
-            goto NoBitmap;
+        if ( p + 4 > p_limit )
+          goto NoBitmap;
 
-          num_glyphs = FT_NEXT_ULONG(p);
-          if ( p+(num_glyphs+1)*4 > p_limit )
-            goto NoBitmap;
+        num_glyphs = FT_NEXT_ULONG( p );
+        if ( p + ( num_glyphs + 1 ) * 4 > p_limit )
+          goto NoBitmap;
 
-          for ( mm = 0; mm < num_glyphs; mm++ )
+        for ( mm = 0; mm < num_glyphs; mm++ )
+        {
+          FT_UInt  gindex = FT_NEXT_USHORT( p );
+
+
+          if ( gindex == glyph_index )
           {
-            FT_UInt  gindex = FT_NEXT_USHORT(p);
-
-            if ( gindex == glyph_index )
-            {
-              image_start = FT_NEXT_USHORT(p);
-              p          += 2;
-              image_end   = FT_PEEK_USHORT(p);
-              break;
-            }
-            p += 2;
+            image_start = FT_NEXT_USHORT( p );
+            p          += 2;
+            image_end   = FT_PEEK_USHORT( p );
+            break;
           }
-
-          if ( mm >= num_glyphs )
-            goto NoBitmap;
+          p += 2;
         }
-        break;
+
+        if ( mm >= num_glyphs )
+          goto NoBitmap;
+      }
+      break;
 
     case 5: /* constant metrics with sparse glyph codes */
-        {
-          FT_ULong  image_size, mm, num_glyphs;
+      {
+        FT_ULong  image_size, mm, num_glyphs;
 
-          if ( p+16 > p_limit )
-            goto NoBitmap;
 
-          image_size = FT_NEXT_ULONG(p);
+        if ( p + 16 > p_limit )
+          goto NoBitmap;
 
-          if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) )
-            goto NoBitmap;
+        image_size = FT_NEXT_ULONG( p );
 
-          num_glyphs = FT_NEXT_ULONG(p);
-          if ( p + 2*num_glyphs > p_limit )
-            goto NoBitmap;
+        if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) )
+          goto NoBitmap;
 
-          for ( mm = 0; mm < num_glyphs; mm++ )
-          {
-            FT_UInt  gindex = FT_NEXT_USHORT(p);
+        num_glyphs = FT_NEXT_ULONG( p );
+        if ( p + 2 * num_glyphs > p_limit )
+          goto NoBitmap;
 
-            if ( gindex == glyph_index )
-              break;
-          }
+        for ( mm = 0; mm < num_glyphs; mm++ )
+        {
+          FT_UInt  gindex = FT_NEXT_USHORT( p );
 
-          if ( mm >= num_glyphs )
-            goto NoBitmap;
 
-          image_start = image_offset + image_size*mm;
-          image_end   = image_start + image_size;
+          if ( gindex == glyph_index )
+            break;
         }
-        break;
+
+        if ( mm >= num_glyphs )
+          goto NoBitmap;
+
+        image_start = image_offset + image_size*mm;
+        image_end   = image_start + image_size;
+      }
+      break;
 
     default:
-        goto NoBitmap;
+      goto NoBitmap;
     }
 
     if ( image_start > image_end )
@@ -906,20 +925,18 @@
     image_end  -= image_start;
     image_start = image_offset + image_start;
 
-
     return tt_sbit_decoder_load_bitmap( decoder,
                                         image_format,
                                         image_offset + image_start,
                                         image_end,
                                         x_pos,
                                         y_pos );
+
   NoBitmap:
-    return FT_Err_Invalid_Argument;
+    return SFNT_Err_Invalid_Argument;
   }
 
 
-
-
   FT_LOCAL( FT_Error )
   tt_face_load_sbit_image( TT_Face              face,
                            FT_ULong             strike_index,
@@ -932,6 +949,7 @@
     TT_SBitDecoderRec  decoder[1];
     FT_Error           error;
 
+
     error = tt_sbit_decoder_init( decoder, face, strike_index, metrics );
     if ( !error )
     {
@@ -941,3 +959,5 @@
 
     return error;
   }
+
+/* EOF */
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 0e0396d..c981dfd 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType font driver implementation (body).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -100,12 +100,13 @@
   /*                                                                       */
   static FT_Error
   tt_get_kerning( FT_Face     ttface,          /* TT_Face */
-               FT_UInt     left_glyph,
-               FT_UInt     right_glyph,
-               FT_Vector*  kerning )
+                  FT_UInt     left_glyph,
+                  FT_UInt     right_glyph,
+                  FT_Vector*  kerning )
   {
     TT_Face       face = (TT_Face)ttface;
-    SFNT_Service  sfnt = (SFNT_Service) face->sfnt;
+    SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
+
 
     kerning->x = 0;
     kerning->y = 0;
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index ddf4c2a..05f24cc 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (body).                                        */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -97,18 +97,20 @@
   /*    near future, but I haven't decided which yet.                      */
   /*                                                                       */
 #ifdef FT_OPTIMIZE_MEMORY
+
   static void
-  tt_face_get_metrics( TT_Face       face,
-                       FT_Bool       vertical,
-                       FT_UInt       idx,
-                       FT_Short      *abearing,
-                       FT_UShort     *aadvance )
+  tt_face_get_metrics( TT_Face     face,
+                       FT_Bool     vertical,
+                       FT_UInt     idx,
+                       FT_Short   *abearing,
+                       FT_UShort  *aadvance )
   {
     TT_HoriHeader*  header;
     FT_Byte*        p;
     FT_Byte*        limit;
     FT_UShort       k;
 
+
     if ( vertical )
     {
       header = (TT_HoriHeader*)&face->vertical;
@@ -128,25 +130,25 @@
     {
       if ( idx < (FT_UInt)k )
       {
-        p += 4*idx;
-        if ( p+4 >= limit )
+        p += 4 * idx;
+        if ( p + 4 >= limit )
           goto NoData;
           
-        *aadvance = FT_NEXT_USHORT(p);
-        *abearing = FT_NEXT_SHORT(p);
+        *aadvance = FT_NEXT_USHORT( p );
+        *abearing = FT_NEXT_SHORT( p );
       }
       else
       {
-        p += 4*(k-1);
-        if ( p+4 > limit )
+        p += 4 * ( k - 1 );
+        if ( p + 4 > limit )
           goto NoData;
           
-        *aadvance = FT_NEXT_USHORT(p);
-        p += 2 + 2*(idx-k);
-        if ( p+2 > limit )
+        *aadvance = FT_NEXT_USHORT( p );
+        p += 2 + 2 * ( idx - k );
+        if ( p + 2 > limit )
           *abearing = 0;
         else
-          *abearing = FT_PEEK_SHORT(p);
+          *abearing = FT_PEEK_SHORT( p );
       }
     }
     else
@@ -156,18 +158,20 @@
       *aadvance = 0;
     }
   }
-#else
+
+#else /* !FT_OPTIMIZE_MEMORY */
+
   static void
-  tt_face_get_metrics( TT_Face       face,
-                       FT_Bool       vertical,
-                       FT_UInt       idx,
-                       FT_Short      *abearing,
-                       FT_UShort     *aadvance )
+  tt_face_get_metrics( TT_Face     face,
+                       FT_Bool     vertical,
+                       FT_UInt     idx,
+                       FT_Short   *abearing,
+                       FT_UShort  *aadvance )
   {
-    TT_HoriHeader*  header = (vertical ? (TT_HoriHeader*)&face->vertical
-                                       :                 &face->horizontal);
+    TT_HoriHeader*  header = vertical ? (TT_HoriHeader*)&face->vertical
+                                      :                 &face->horizontal;
     TT_LongMetrics  longs_m;
-    FT_UShort       k     = header->number_Of_HMetrics;
+    FT_UShort       k      = header->number_Of_HMetrics;
 
 
     if ( k == 0 )
@@ -178,17 +182,18 @@
 
     if ( idx < (FT_UInt)k )
     {
-      longs_m   = (TT_LongMetrics )header->long_metrics + idx;
+      longs_m   = (TT_LongMetrics)header->long_metrics + idx;
       *abearing = longs_m->bearing;
       *aadvance = longs_m->advance;
     }
     else
     {
       *abearing = ((TT_ShortMetrics*)header->short_metrics)[idx - k];
-      *aadvance = ((TT_LongMetrics )header->long_metrics)[k - 1].advance;
+      *aadvance = ((TT_LongMetrics)header->long_metrics)[k - 1].advance;
     }
   }
-#endif
+
+#endif /* !FT_OPTIMIZE_MEMORY */
 
 
   /*************************************************************************/
@@ -222,11 +227,13 @@
                         FT_UInt  gindex )
   {
 #ifdef FT_OPTIMIZE_MEMORY
+
     FT_UInt   nn;
-    FT_Byte*  result = NULL;
+    FT_Byte*  result      = NULL;
     FT_ULong  record_size = face->hdmx_record_size;
     FT_Byte*  record      = face->hdmx_table + 8;
     
+
     for ( nn = 0; nn < face->hdmx_record_count; nn++ )
       if ( face->hdmx_record_sizes[nn] == ppem )
       {
@@ -237,7 +244,9 @@
       }
 
     return result;
+
 #else
+
     FT_UShort  n;
 
 
@@ -246,6 +255,7 @@
         return &face->hdmx.records[n].widths[gindex];
 
     return NULL;
+
 #endif
   }
 
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index 27565ed..665c224 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (specification).                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 3b6b266..05e673d 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Objects manager (body).                                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -750,19 +750,21 @@
     if ( !error )
     {
       /* XXX: TODO: move this code to the SFNT module where it belongs */
+
 #ifdef FT_OPTIMIZE_MEMORY
       FT_Byte*    strike = face->sbit_table + 8 + strike_index*48;
 
-      sbit_metrics->ascender  = (FT_Char)strike[16] << 6;  /* hori.ascender */
+      sbit_metrics->ascender  = (FT_Char)strike[16] << 6;  /* hori.ascender  */
       sbit_metrics->descender = (FT_Char)strike[17] << 6;  /* hori.descender */
 
       /* XXX: Is this correct? */
-      sbit_metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */
-                                             strike[18] + /* max_width */
+      sbit_metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB  */
+                                             strike[18] + /* max_width      */
                                     (FT_Char)strike[23]   /* min_advance_SB */
                                                         ) << 6;
 
-#else /* !OPTIMIZE_MEMORY */
+#else /* !FT_OPTIMIZE_MEMORY */
+
       TT_SBit_Strike  strike = face->sbit_strikes + strike_index;
 
 
@@ -773,7 +775,8 @@
       sbit_metrics->max_advance = ( strike->hori.min_origin_SB  +
                                     strike->hori.max_width      +
                                     strike->hori.min_advance_SB ) << 6;
-#endif /* !OPTIMIZE_MEMORY */
+
+#endif /* !FT_OPTIMIZE_MEMORY */
 
       /* XXX: Is this correct? */
       sbit_metrics->height = sbit_metrics->ascender -
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
index cc2eb61..ae3e4aa 100644
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType glyph data/program tables loader (body).                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2004 by                                     */
+/*  Copyright 1996-2001, 2002, 2004, 2005 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -79,29 +79,29 @@
 
     if ( face->header.Index_To_Loc_Format != 0 )
     {
-      if ( table_len >= 040000 )
+      if ( table_len >= 0x40000 )
       {
-        FT_TRACE2(( "table too large !!\n" ));
+        FT_TRACE2(( "table too large!\n" ));
         error = TT_Err_Invalid_Table;
         goto Exit;
       }
-      face->num_locations = (FT_UInt)(table_len >> 2);
+      face->num_locations = (FT_UInt)( table_len >> 2 );
     }
     else
     {
       if ( table_len >= 0x20000 )
       {
-        FT_TRACE2(( "table too large !!\n" ));
+        FT_TRACE2(( "table too large!\n" ));
         error = TT_Err_Invalid_Table;
         goto Exit;
       }
-      face->num_locations = (FT_UInt)(table_len >> 1);
+      face->num_locations = (FT_UInt)( table_len >> 1 );
     }
 
-
-   /* extract the frame. We don't need to decompress it since
-    * we'll be able to parse it directly
-    */
+    /*
+     * Extract the frame.  We don't need to decompress it since
+     * we are able to parse it directly.
+     */
     if ( FT_FRAME_EXTRACT( table_len, face->glyph_locations ) )
       goto Exit;
 
@@ -113,45 +113,47 @@
 
 
   FT_LOCAL_DEF( FT_ULong )
-  tt_face_get_location( TT_Face    face,
-                        FT_UInt    gindex,
-                        FT_UInt   *asize )
+  tt_face_get_location( TT_Face   face,
+                        FT_UInt   gindex,
+                        FT_UInt  *asize )
   {
     FT_ULong  pos1, pos2;
     FT_Byte*  p;
     FT_Byte*  p_limit;
 
+
     pos1 = pos2 = 0;
+
     if ( gindex < face->num_locations )
     {
       if ( face->header.Index_To_Loc_Format != 0 )
       {
-        p       = face->glyph_locations + gindex*4;
-        p_limit = face->glyph_locations + face->num_locations*4;
+        p       = face->glyph_locations + gindex * 4;
+        p_limit = face->glyph_locations + face->num_locations * 4;
 
-        pos1 = FT_NEXT_ULONG(p);
+        pos1 = FT_NEXT_ULONG( p );
         pos2 = pos1;
 
-        if ( p+4 <= p_limit )
-          pos2 = FT_NEXT_ULONG(p);
+        if ( p + 4 <= p_limit )
+          pos2 = FT_NEXT_ULONG( p );
       }
       else
       {
-        p       = face->glyph_locations + gindex*2;
-        p_limit = face->glyph_locations + face->num_locations*2;
+        p       = face->glyph_locations + gindex * 2;
+        p_limit = face->glyph_locations + face->num_locations * 2;
 
-        pos1 = FT_NEXT_USHORT(p);
+        pos1 = FT_NEXT_USHORT( p );
         pos2 = pos1;
 
-        if ( p+2 <= p_limit )
-          pos2 = FT_NEXT_USHORT(p);
+        if ( p + 2 <= p_limit )
+          pos2 = FT_NEXT_USHORT( p );
 
         pos1 <<= 1;
         pos2 <<= 1;
       }
     }
 
-    *asize = (FT_UInt)(pos2 - pos1);
+    *asize = (FT_UInt)( pos2 - pos1 );
 
     return pos1;
   }
@@ -160,16 +162,17 @@
   FT_LOCAL_DEF( void )
   tt_face_done_loca( TT_Face  face )
   {
-    FT_Stream     stream = face->root.stream;
+    FT_Stream  stream = face->root.stream;
+
 
     FT_FRAME_RELEASE( face->glyph_locations );
     face->num_locations = 0;
   }
 
 
-
 #else /* !FT_OPTIMIZE_MEMORY */
 
+
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_loca( TT_Face    face,
                      FT_Stream  stream )
@@ -224,6 +227,7 @@
 
       if ( FT_FRAME_ENTER( face->num_locations * 2L ) )
         goto Exit;
+
       {
         FT_Long*  loc   = face->glyph_locations;
         FT_Long*  limit = loc + face->num_locations;
@@ -232,6 +236,7 @@
         for ( ; loc < limit; loc++ )
           *loc = (FT_Long)( (FT_ULong)FT_GET_USHORT() * 2 );
       }
+
       FT_FRAME_EXIT();
     }
 
@@ -243,13 +248,14 @@
 
 
   FT_LOCAL_DEF( FT_ULong )
-  tt_face_get_location( TT_Face    face,
-                        FT_UInt    gindex,
-                        FT_UInt   *asize )
+  tt_face_get_location( TT_Face   face,
+                        FT_UInt   gindex,
+                        FT_UInt  *asize )
   {
     FT_ULong  offset;
     FT_UInt   count;
 
+
     offset = face->glyph_locations[gindex];
     count  = 0;
 
@@ -264,14 +270,14 @@
   FT_LOCAL_DEF( void )
   tt_face_done_loca( TT_Face  face )
   {
-    FT_Memory     memory = face->root.memory;
+    FT_Memory  memory = face->root.memory;
+
 
     FT_FREE( face->glyph_locations );
     face->num_locations = 0;
   }
 
 
-
 #endif /* !FT_OPTIMIZE_MEMORY */
 
 
@@ -345,10 +351,13 @@
   Exit:
     return error;
 
-#else /* !BYTECODE_INTERPRETER */
-    FT_UNUSED(face);
-    FT_UNUSED(stream);
+#else /* !FT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+    FT_UNUSED( face   );
+    FT_UNUSED( stream );
+
     return 0;
+
 #endif
   }
 
@@ -423,10 +432,13 @@
   Exit:
     return error;
 
-#else /* !BYTECODE_INTERPRETER */
-    FT_UNUSED(face);
-    FT_UNUSED(stream);
+#else /* !FT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+    FT_UNUSED( face   );
+    FT_UNUSED( stream );
+
     return 0;
+
 #endif
   }
 
diff --git a/src/truetype/ttpload.h b/src/truetype/ttpload.h
index 1d14aec..2acb4b3 100644
--- a/src/truetype/ttpload.h
+++ b/src/truetype/ttpload.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType glyph data/program tables loader (specification).           */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2005 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -32,9 +32,9 @@ FT_BEGIN_HEADER
                      FT_Stream  stream );
 
   FT_LOCAL( FT_ULong )
-  tt_face_get_location( TT_Face    face,
-                        FT_UInt    gindex,
-                        FT_UInt   *asize );
+  tt_face_get_location( TT_Face   face,
+                        FT_UInt   gindex,
+                        FT_UInt  *asize );
 
   FT_LOCAL( void )
   tt_face_done_loca( TT_Face  face );