Commit b7b163cb077edd6b6355dd465cc9dc1d4d4d7b53

Werner Lemberg 2002-03-31T18:48:24

* src/sfnt/ttcmap.c: 16bit fixes (0xFFFF -> 0xFFFFU). * src/sfnt/ttcmap0.c: 16bit fixes. (TT_Build_CMaps): Simplify debug messages. (tt_cmap12_char_next): Fix offset. * src/sfnt/ttload.c (TT_Load_Names, TT_Load_CMap): Fix debug messages. (TT_Load_OS2): 16bit fix.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
diff --git a/ChangeLog b/ChangeLog
index 05c5f8e..dc10196 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,12 +6,23 @@
 
 	* src/otlayout/otlcommn.c, src/otlayout/otlcommn.h: s/index/idx/.
 	* src/psaux/t1cmap.c: Ditto.
+	* src/sfnt/ttcmap0.c: Ditto.
 
 	* include/freetype/internal/tttypes.h,
 	include/freetype/internal/sfnt.h (TT_Goto_Table_Func): Renamed to ...
 	(TT_Loader_GotoTableFunc): This.
 	* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Fix debug
 	messages.
+	* src/psnames/psmodule.c (psnames_interface)
+	[!FT_CONFIG_OPTION_ADOBE_GLYPH_LIST]: Fix typo.
+	* src/sfnt/sfdriver.c (get_sfnt_table): 16bit fix.
+	* src/sfnt/ttcmap.c: 16bit fixes (0xFFFF -> 0xFFFFU).
+	* src/sfnt/ttcmap0.c: 16bit fixes.
+	(TT_Build_CMaps): Simplify debug messages.
+	(tt_cmap12_char_next): Fix offset.
+	* src/sfnt/ttload.c (TT_Load_Names, TT_Load_CMap): Fix debug
+	messages.
+	(TT_Load_OS2): 16bit fix.
 
 2002-03-30  David Turner  <david@freetype.org>
 
@@ -439,8 +450,8 @@
 	* src/type1/t1cmap.h, src/type1/t1cmap.c: Adding (still
 	experimental) code for Type 1 charmap processing.
 
-	* src/sfnt/ttcmap0.c: Completing the experimental SFNT charmap
-	processing.
+	* src/sfnt/ttcmap0.c: New file.  It contains a new, still
+	experimental SFNT charmap processing support.
 
 	* include/freetype/internal/ftobjs.h: Adding validation support as
 	well as internal charmap object definitions (FT_CMap != FT_CharMap).
diff --git a/src/pshinter/descrip.mms b/src/pshinter/descrip.mms
index 3bdb8a0..205d6cf 100644
--- a/src/pshinter/descrip.mms
+++ b/src/pshinter/descrip.mms
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 2001 by
+# Copyright 2001, 2002 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/pshinter/pshalgo1.c b/src/pshinter/pshalgo1.c
index faca381..67c159e 100644
--- a/src/pshinter/pshalgo1.c
+++ b/src/pshinter/pshalgo1.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PostScript hinting algorithm 1 (body).                               */
 /*                                                                         */
-/*  Copyright 2001 by                                                      */
+/*  Copyright 2001, 2002 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/pshinter/pshalgo2.c b/src/pshinter/pshalgo2.c
index 1ddce48..8509d87 100644
--- a/src/pshinter/pshalgo2.c
+++ b/src/pshinter/pshalgo2.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PostScript hinting algorithm 2 (body).                               */
 /*                                                                         */
-/*  Copyright 2001 by                                                      */
+/*  Copyright 2001, 2002 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/pshinter/pshglob.c b/src/pshinter/pshglob.c
index 21bd2a2..9b32e9f 100644
--- a/src/pshinter/pshglob.c
+++ b/src/pshinter/pshglob.c
@@ -5,7 +5,7 @@
 /*    PostScript hinter global hinting management (body).                  */
 /*    Inspired by the new auto-hinter module.                              */
 /*                                                                         */
-/*  Copyright 2001 by                                                      */
+/*  Copyright 2001, 2002 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/pshinter/pshglob.h b/src/pshinter/pshglob.h
index bdb5e12..fcda9da 100644
--- a/src/pshinter/pshglob.h
+++ b/src/pshinter/pshglob.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PostScript hinter global hinting management.                         */
 /*                                                                         */
-/*  Copyright 2001 by                                                      */
+/*  Copyright 2001, 2002 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/pshinter/pshmod.c b/src/pshinter/pshmod.c
index afaf73a..5b18684 100644
--- a/src/pshinter/pshmod.c
+++ b/src/pshinter/pshmod.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PostScript hinter module implementation (body).             */
 /*                                                                         */
-/*  Copyright 2001 by                                                      */
+/*  Copyright 2001, 2002 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/pshinter/pshrec.c b/src/pshinter/pshrec.c
index a678966..ad0485e 100644
--- a/src/pshinter/pshrec.c
+++ b/src/pshinter/pshrec.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PostScript hints recorder (body).                           */
 /*                                                                         */
-/*  Copyright 2001 by                                                      */
+/*  Copyright 2001, 2002 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/pshinter/pshrec.h b/src/pshinter/pshrec.h
index 7345eb6..884aa5c 100644
--- a/src/pshinter/pshrec.h
+++ b/src/pshinter/pshrec.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Postscript (Type1/Type2) hints recorder (specification).             */
 /*                                                                         */
-/*  Copyright 2001 by                                                      */
+/*  Copyright 2001, 2002 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/psnames/descrip.mms b/src/psnames/descrip.mms
index ba8b26f..6a66b9f 100644
--- a/src/psnames/descrip.mms
+++ b/src/psnames/descrip.mms
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 2001 by
+# Copyright 2001, 2002 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/psnames/psmodule.c b/src/psnames/psmodule.c
index e5c0769..58b7de6 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    PSNames module implementation (body).                                */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -186,8 +186,8 @@
       count = (FT_UInt)( map - table->maps );
 
       if ( count > 0 && FT_REALLOC( table->maps,
-                                 num_glyphs * sizeof ( PS_UniMap ),
-                                 count * sizeof ( PS_UniMap ) ) )
+                                    num_glyphs * sizeof ( PS_UniMap ),
+                                    count * sizeof ( PS_UniMap ) ) )
         count = 0;
 
       if ( count == 0 )
@@ -314,7 +314,6 @@
     0,
     0,
     0,
-    0,
 
 #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
 
diff --git a/src/psnames/rules.mk b/src/psnames/rules.mk
index cb51272..4a4b82e 100644
--- a/src/psnames/rules.mk
+++ b/src/psnames/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2001 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/raster/ftraster.c b/src/raster/ftraster.c
index 298675e..28475f7 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType glyph rasterizer (body).                                */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -3211,9 +3211,9 @@
 
 
   static void
-  ft_black_set_mode( TRaster_Instance* raster,
-                     unsigned long     mode,
-                     const char*       palette )
+  ft_black_set_mode( TRaster_Instance*  raster,
+                     unsigned long      mode,
+                     const char*        palette )
   {
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
 
diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c
index 96e7980..05211e6 100644
--- a/src/raster/ftrend1.c
+++ b/src/raster/ftrend1.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType glyph rasterizer interface (body).                      */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/raster/rules.mk b/src/raster/rules.mk
index 7d3f65c..9fe4b8b 100644
--- a/src/raster/rules.mk
+++ b/src/raster/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2001 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/Jamfile b/src/sfnt/Jamfile
index dccfdb3..d7722e3 100644
--- a/src/sfnt/Jamfile
+++ b/src/sfnt/Jamfile
@@ -1,4 +1,4 @@
-# FreeType 2 src/sfnt Jamfile (c) 2001 David Turner
+# FreeType 2 src/sfnt Jamfile (c) 2001, 2002 David Turner
 #
 
 SubDir  FT2_TOP src sfnt ;
diff --git a/src/sfnt/descrip.mms b/src/sfnt/descrip.mms
index fb5c724..811c8b3 100644
--- a/src/sfnt/descrip.mms
+++ b/src/sfnt/descrip.mms
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 2001 by
+# Copyright 2001, 2002 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/rules.mk b/src/sfnt/rules.mk
index 833445f..c074a6a 100644
--- a/src/sfnt/rules.mk
+++ b/src/sfnt/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2002 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 8f29a2b..303498a 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    High-level SFNT driver interface (body).                             */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -58,7 +58,7 @@
       break;
 
     case ft_sfnt_os2:
-      table = face->os2.version == 0xFFFF ? 0 : &face->os2;
+      table = face->os2.version == 0xFFFFU ? 0 : &face->os2;
       break;
 
     case ft_sfnt_post:
@@ -114,7 +114,7 @@
   static const char*
   get_sfnt_postscript_name( TT_Face  face )
   {
-    FT_Int  n, found_win, found_apple;
+    FT_Int       n, found_win, found_apple;
     const char*  result = NULL;
 
 
@@ -124,8 +124,8 @@
 
     /* scan the name table to see whether we have a Postscript name here, */
     /* either in Macintosh or Windows platform encodings                  */
-    found_win     = -1;
-    found_apple   = -1;
+    found_win   = -1;
+    found_apple = -1;
     
     for ( n = 0; n < face->num_names; n++ )
     {
@@ -148,16 +148,18 @@
     
     if ( found_win != -1 )
     {
-      FT_Memory    memory = face->root.memory;
+      FT_Memory         memory = face->root.memory;
       TT_NameEntryRec*  name   = face->name_table.names + found_win;
-      FT_UInt      len    = name->stringLength/2;
-      FT_Error     error;
+      FT_UInt           len    = name->stringLength / 2;
+      FT_Error          error;
       
-      if ( !FT_ALLOC( result, len+1 ) )
+
+      if ( !FT_ALLOC( result, len + 1 ) )
       {
         FT_String*  r = (FT_String*)result;
-        FT_Byte*    p = (FT_Byte*) name->string;
+        FT_Byte*    p = (FT_Byte*)name->string;
         
+
         for ( ; len > 0; len--, p += 2 )
         {
           if ( p[0] == 0 && p[1] >= 32 && p[1] < 128 )
@@ -175,7 +177,8 @@
       FT_UInt           len    = name->stringLength;
       FT_Error          error;
 
-      if ( !FT_ALLOC( result, len+1 ) )
+
+      if ( !FT_ALLOC( result, len + 1 ) )
       {
         FT_MEM_COPY( (char*)result, name->string, len );
         ((char*)result)[len] = '\0';
diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c
index 15898bc..6e0757a 100644
--- a/src/sfnt/sfnt.c
+++ b/src/sfnt/sfnt.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Single object library component.                                     */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index a1c208f..2e6326d 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    SFNT object management (base).                                       */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -39,91 +39,94 @@
 
 
 
- /* convert a UTF-16 name entry to ASCII */
+  /* convert a UTF-16 name entry to ASCII */
   static FT_String*
-  tt_name_entry_ascii_from_utf16( TT_NameEntry   entry,
-                                  FT_Memory      memory )
+  tt_name_entry_ascii_from_utf16( TT_NameEntry  entry,
+                                  FT_Memory     memory )
   {
     FT_String*  string;
     FT_UInt     len, code, n;
-    FT_Byte*    read = (FT_Byte*) entry->string;
-    
-    len = (FT_UInt) entry->stringLength/2;
-    
-    if ( FT_MEM_NEW_ARRAY( string, len+1 ) )
+    FT_Byte*    read = (FT_Byte*)entry->string;
+
+
+    len = (FT_UInt)entry->stringLength / 2;
+
+    if ( FT_MEM_NEW_ARRAY( string, len + 1 ) )
       return NULL;
-    
+
     for ( n = 0; n < len; n++ )
     {
-      code = FT_NEXT_USHORT(read);
+      code = FT_NEXT_USHORT( read );
       if ( code < 32 || code > 127 )
         code = '?';
-        
+
       string[n] = (char)code;
     }
 
     string[len] = 0;
-    
+
     return string;
-  }                                   
+  }
 
 
- /* convert a UCS-4 name entry to ASCII */
+  /* convert a UCS-4 name entry to ASCII */
   static FT_String*
   tt_name_entry_ascii_from_ucs4( TT_NameEntry  entry,
                                  FT_Memory     memory )
   {
     FT_String*  string;
     FT_UInt     len, code, n;
-    FT_Byte*    read = (FT_Byte*) entry->string;
-    
-    len = (FT_UInt) entry->stringLength/4;
-    
-    if ( FT_MEM_NEW_ARRAY( string, len+1 ) )
+    FT_Byte*    read = (FT_Byte*)entry->string;
+
+
+    len = (FT_UInt)entry->stringLength / 4;
+
+    if ( FT_MEM_NEW_ARRAY( string, len + 1 ) )
       return NULL;
-    
+
     for ( n = 0; n < len; n++ )
     {
-      code = FT_NEXT_ULONG(read);
+      code = FT_NEXT_ULONG( read );
       if ( code < 32 || code > 127 )
         code = '?';
-        
+
       string[n] = (char)code;
     }
 
     string[len] = 0;
-    
+
     return string;
-  }                                 
+  }
 
 
- /* convert an Apple Roman or symbol name entry to ASCII */
+  /* convert an Apple Roman or symbol name entry to ASCII */
   static FT_String*
   tt_name_entry_ascii_from_other( TT_NameEntry  entry,
                                   FT_Memory     memory )
   {
     FT_String*  string;
     FT_UInt     len, code, n;
-    FT_Byte*    read = (FT_Byte*) entry->string;
-    
-    len = (FT_UInt) entry->stringLength;
-    
-    if ( FT_MEM_NEW_ARRAY( string, len+1 ) )
+    FT_Byte*    read = (FT_Byte*)entry->string;
+
+
+    len = (FT_UInt)entry->stringLength;
+
+    if ( FT_MEM_NEW_ARRAY( string, len + 1 ) )
       return NULL;
-    
+
     for ( n = 0; n < len; n++ )
     {
       code = *read++;
       if ( code < 32 || code > 127 )
         code = '?';
-        
+
       string[n] = (char)code;
     }
 
     string[len] = 0;
-    
+
     return string;
-  }                                  
+  }
 
 
   /*************************************************************************/
@@ -158,91 +161,79 @@
     rec = face->name_table.names;
     for ( n = 0; n < face->name_table.numNameRecords; n++, rec++ )
     {
-      /* according to the OpenType 1.3 specification, only Microsoft of */
-      /* Apple platform ids might be used in the 'name' table. The      */
-      /* 'Unicode' platform is reserved for the 'cmap' table, and       */
-      /* the 'Iso' one is deprecated                                    */
-
-      /* however the Apple TrueType specification doesn't says the same  */
-      /* thing and goes to suggest that all Unicode 'name' table entries */
-      /* should be coded in UTF-16 (in big-endian format I suppose)      */
+      /* According to the OpenType 1.3 specification, only Microsoft or  */
+      /* Apple platform IDs might be used in the `name' table.  The      */
+      /* `Unicode' platform is reserved for the `cmap' table, and the    */
+      /* `Iso' one is deprecated.                                        */
+      /*                                                                 */
+      /* However, the Apple TrueType specification doesn't say the same  */
+      /* thing and goes to suggest that all Unicode `name' table entries */
+      /* should be coded in UTF-16 (in big-endian format I suppose).     */
       /*                                                                 */
       if ( rec->nameID == nameid && rec->string )
       {
         switch ( rec->platformID )
         {
-
-          case TT_PLATFORM_APPLE_UNICODE:
-          case TT_PLATFORM_ISO:
-            {
-              /* there is 'languageID' to check there. We should use this */
-              /* field only as a last solution when nothing else is       */
-              /* available..                                              */
-              /*                                                          */
-              found_unicode = n;
-              break;
-            }
-          
-          case TT_PLATFORM_MACINTOSH:
-            {
-              if ( rec->languageID == TT_MAC_LANGID_ENGLISH )
-                found_apple = n;
-              
-              break;
-            }
-            
-          case TT_PLATFORM_MICROSOFT:
+        case TT_PLATFORM_APPLE_UNICODE:
+        case TT_PLATFORM_ISO:
+          /* there is `languageID' to check there.  We should use this */
+          /* field only as a last solution when nothing else is        */
+          /* available.                                                */
+          /*                                                           */
+          found_unicode = n;
+          break;
+
+        case TT_PLATFORM_MACINTOSH:
+          if ( rec->languageID == TT_MAC_LANGID_ENGLISH )
+            found_apple = n;
+
+          break;
+
+        case TT_PLATFORM_MICROSOFT:
+          /* we only take a non-English name when there is nothing */
+          /* else available in the font                            */
+          /*                                                       */
+          if ( found_win == -1 || ( rec->languageID & 0x3FF ) == 0x009 )
+          {
+            switch ( rec->encodingID )
             {
-              /* we only take a non-English name when there is nothing */
-              /* else available in the font..                          */
-              /*                                                       */
-              if ( found_win == -1 || (rec->languageID & 0x3FF) == 0x009 )
-              {
-                switch ( rec->encodingID )
-                {
-                  case TT_MS_ID_SYMBOL_CS:
-                  case TT_MS_ID_UNICODE_CS:
-                  case TT_MS_ID_UCS_4:
-                    found_win = n;
-                    break;
-                    
-                  default:
-                    ;
-                }
-              }
+            case TT_MS_ID_SYMBOL_CS:
+            case TT_MS_ID_UNICODE_CS:
+            case TT_MS_ID_UCS_4:
+              found_win = n;
               break;
+
+            default:
+              ;
             }
-          
-          default:
-            ;
+          }
+          break;
+
+        default:
+          ;
         }
       }
     }
 
-    /* some fonts contain invalid Unicode or Macintosh formatted entries */
-    /* we will thus favor name encoded in Windows formats when they're   */
-    /* available..                                                       */
-    /*                                                                   */
+    /* some fonts contain invalid Unicode or Macintosh formatted entries; */
+    /* we will thus favor names encoded in Windows formats if available   */
+    /*                                                                    */
     if ( found_win >= 0 )
     {
       rec = face->name_table.names + found_win;
       switch ( rec->encodingID )
       {
-        case TT_MS_ID_UNICODE_CS:
-        case TT_MS_ID_SYMBOL_CS:
-          {
-            result = tt_name_entry_ascii_from_utf16( rec, memory );
-            break;
-          }
-          
-        case TT_MS_ID_UCS_4:
-          {
-            result = tt_name_entry_ascii_from_ucs4( rec, memory );
-            break;
-          }
-        
-        default:
-          ;
+      case TT_MS_ID_UNICODE_CS:
+      case TT_MS_ID_SYMBOL_CS:
+        result = tt_name_entry_ascii_from_utf16( rec, memory );
+        break;
+
+      case TT_MS_ID_UCS_4:
+        result = tt_name_entry_ascii_from_ucs4( rec, memory );
+        break;
+
+      default:
+        ;
       }
     }
     else if ( found_apple >= 0 )
@@ -255,7 +246,7 @@
       rec    = face->name_table.names + found_unicode;
       result = tt_name_entry_ascii_from_utf16( rec, memory );
     }
-    
+
     return result;
   }
 
@@ -321,12 +312,13 @@
     FT_Error         error;
     FT_Library       library = face->root.driver->root.library;
     SFNT_Service     sfnt;
-    SFNT_HeaderRec      sfnt_header;
+    SFNT_HeaderRec   sfnt_header;
 
     /* for now, parameters are unused */
     FT_UNUSED( num_params );
     FT_UNUSED( params );
 
+
     sfnt = (SFNT_Service)face->sfnt;
     if ( !sfnt )
     {
@@ -344,7 +336,7 @@
     if ( !face->psnames )
     {
       face->psnames = (PSNames_Service)
-                       FT_Get_Module_Interface( library, "psnames" );
+                        FT_Get_Module_Interface( library, "psnames" );
     }
 
     /* check that we have a valid TrueType file */
@@ -381,9 +373,9 @@
                   FT_Int         num_params,
                   FT_Parameter*  params )
   {
-    FT_Error         error;
-    FT_Bool          has_outline;
-    FT_Bool          is_apple_sbit;
+    FT_Error      error;
+    FT_Bool       has_outline;
+    FT_Bool       is_apple_sbit;
 
     SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
 
@@ -433,7 +425,6 @@
     (void)LOAD_( max_profile );
     (void)LOAD_( charmaps );
 
-      
     /* the following tables are optional in PCL fonts -- */
     /* don't check for errors                            */
     (void)LOAD_( names );
@@ -470,6 +461,7 @@
       else
         goto Exit;
     }
+
 #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
 
     if ( LOAD_( hdmx )    ||
@@ -478,15 +470,17 @@
          LOAD_( pclt )    )
       goto Exit;
 
-    face->root.family_name = tt_face_get_name( face, TT_NAME_ID_FONT_FAMILY );
-    face->root.style_name  = tt_face_get_name( face, TT_NAME_ID_FONT_SUBFAMILY );
+    face->root.family_name = tt_face_get_name( face,
+                                               TT_NAME_ID_FONT_FAMILY );
+    face->root.style_name  = tt_face_get_name( face,
+                                               TT_NAME_ID_FONT_SUBFAMILY );
 
     /* now set up root fields */
     {
-      FT_Face     root = &face->root;
-      FT_Int      flags = 0;
-      FT_Int      n;
-      FT_Memory   memory;
+      FT_Face    root = &face->root;
+      FT_Int     flags = 0;
+      FT_Int     n;
+      FT_Memory  memory;
 
 
       memory = root->memory;
@@ -557,19 +551,21 @@
 #ifdef FT_CONFIG_OPTION_USE_CMAPS
 
       TT_Build_CMaps( face );  /* ignore errors */
-      
-      
+
+
       /* set the encoding fields */
       {
         FT_Int  m;
-        
+
+
         for ( m = 0; m < root->num_charmaps; m++ )
         {
           FT_CharMap  charmap = root->charmaps[m];
-          
+
+
           charmap->encoding = sfnt_find_encoding( charmap->platform_id,
                                                   charmap->encoding_id );
-                                             
+
           if ( root->charmap     == NULL &&
                charmap->encoding == ft_encoding_unicode )
           {
@@ -580,34 +576,35 @@
       }
 
 #else /* !FT_CONFIG_OPTION_USE_CMAPS */
-      
+
       {
         TT_CharMap  charmap = face->charmaps;
-        
+
+
         charmap            = face->charmaps;
         root->num_charmaps = face->num_charmaps;
-  
+
         /* allocate table of pointers */
         if ( FT_NEW_ARRAY( root->charmaps, root->num_charmaps ) )
           goto Exit;
-  
+
         for ( n = 0; n < root->num_charmaps; n++, charmap++ )
         {
           FT_Int  platform = charmap->cmap.platformID;
           FT_Int  encoding = charmap->cmap.platformEncodingID;
-  
-  
+
+
           charmap->root.face        = (FT_Face)face;
           charmap->root.platform_id = (FT_UShort)platform;
           charmap->root.encoding_id = (FT_UShort)encoding;
           charmap->root.encoding    = sfnt_find_encoding( platform, encoding );
-  
+
           /* now, set root->charmap with a unicode charmap */
           /* wherever available                            */
           if ( !root->charmap                                &&
                charmap->root.encoding == ft_encoding_unicode )
             root->charmap = (FT_CharMap)charmap;
-  
+
           root->charmaps[n] = (FT_CharMap)charmap;
         }
       }
@@ -622,7 +619,8 @@
         root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
 
 #if 0
-        /* I don't know criteria whether layout is horizontal or vertical */
+        /* XXX: I don't know criteria whether layout is horizontal */
+        /*      or vertical.                                       */
         if ( has_outline.... )
         {
           ...
@@ -753,7 +751,7 @@
   FT_LOCAL_DEF( void )
   SFNT_Done_Face( TT_Face  face )
   {
-    FT_Memory        memory = face->root.memory;
+    FT_Memory     memory = face->root.memory;
     SFNT_Service  sfnt   = (SFNT_Service)face->sfnt;
 
 
@@ -783,8 +781,9 @@
 #ifdef FT_CONFIG_OPTION_USE_CMAPS
 
     {
-      FT_Stream  stream = FT_FACE_STREAM(face);
-      
+      FT_Stream  stream = FT_FACE_STREAM( face );
+
+
       /* simply release the 'cmap' table frame */
       FT_FRAME_RELEASE( face->cmap_table );
       face->cmap_size = 0;
diff --git a/src/sfnt/sfobjs.h b/src/sfnt/sfobjs.h
index a935956..f30c198 100644
--- a/src/sfnt/sfobjs.h
+++ b/src/sfnt/sfobjs.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    SFNT object management (specification).                              */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index 7a58391..5d0a61a 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType character mapping table (cmap) support (body).              */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -35,52 +35,52 @@
 
 
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index0( TT_CMapTable   charmap,
-                  FT_ULong       char_code );
+  code_to_index0( TT_CMapTable  charmap,
+                  FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next0( TT_CMapTable   charmap,
-                 FT_ULong       char_code );
+  code_to_next0( TT_CMapTable  charmap,
+                 FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index2( TT_CMapTable   charmap,
-                  FT_ULong       char_code );
+  code_to_index2( TT_CMapTable  charmap,
+                  FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next2( TT_CMapTable   charmap,
-                 FT_ULong       char_code );
+  code_to_next2( TT_CMapTable  charmap,
+                 FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index4( TT_CMapTable   charmap,
-                  FT_ULong       char_code );
+  code_to_index4( TT_CMapTable  charmap,
+                  FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next4( TT_CMapTable   charmap,
-                 FT_ULong       char_code );
+  code_to_next4( TT_CMapTable  charmap,
+                 FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index6( TT_CMapTable   charmap,
-                  FT_ULong       char_code );
+  code_to_index6( TT_CMapTable  charmap,
+                  FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next6( TT_CMapTable   charmap,
-                 FT_ULong       char_code );
+  code_to_next6( TT_CMapTable  charmap,
+                 FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index8_12( TT_CMapTable   charmap,
-                     FT_ULong       char_code );
+  code_to_index8_12( TT_CMapTable  charmap,
+                     FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next8_12( TT_CMapTable   charmap,
-                    FT_ULong       char_code );
+  code_to_next8_12( TT_CMapTable  charmap,
+                    FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index10( TT_CMapTable   charmap,
-                   FT_ULong       char_code );
+  code_to_index10( TT_CMapTable  charmap,
+                   FT_ULong      char_code );
 
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next10( TT_CMapTable   charmap,
-                  FT_ULong       char_code );
+  code_to_next10( TT_CMapTable  charmap,
+                  FT_ULong      char_code );
 
 
   /*************************************************************************/
@@ -93,6 +93,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the parent face object.                      */
+  /*                                                                       */
   /*    stream :: A handle to the current stream object.                   */
   /*                                                                       */
   /* <InOut>                                                               */
@@ -107,27 +108,27 @@
   /*    released.                                                          */
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
-  TT_CharMap_Load( TT_Face        face,
-                   TT_CMapTable   cmap,
-                   FT_Stream      stream )
+  TT_CharMap_Load( TT_Face       face,
+                   TT_CMapTable  cmap,
+                   FT_Stream     stream )
   {
-    FT_Error      error;
-    FT_Memory     memory;
-    FT_UShort     num_SH, num_Seg, i;
-    FT_ULong      j, n;
+    FT_Error     error;
+    FT_Memory    memory;
+    FT_UShort    num_SH, num_Seg, i;
+    FT_ULong     j, n;
 
-    FT_UShort     u, l;
+    FT_UShort    u, l;
 
-    TT_CMap0      cmap0;
-    TT_CMap2      cmap2;
-    TT_CMap4      cmap4;
-    TT_CMap6      cmap6;
+    TT_CMap0     cmap0;
+    TT_CMap2     cmap2;
+    TT_CMap4     cmap4;
+    TT_CMap6     cmap6;
     TT_CMap8_12  cmap8_12;
     TT_CMap10    cmap10;
 
-    TT_CMap2SubHeader   cmap2sub;
-    TT_CMap4Segment     segments;
-    TT_CMapGroup        groups;
+    TT_CMap2SubHeader  cmap2sub;
+    TT_CMap4Segment    segments;
+    TT_CMapGroup       groups;
 
 
     if ( cmap->loaded )
@@ -143,12 +144,12 @@
     case 0:
       cmap0 = &cmap->c.cmap0;
 
-      if ( FT_READ_USHORT( cmap0->language )         ||
-           FT_ALLOC( cmap0->glyphIdArray, 256L )     ||
+      if ( FT_READ_USHORT( cmap0->language )           ||
+           FT_ALLOC( cmap0->glyphIdArray, 256L )       ||
            FT_STREAM_READ( cmap0->glyphIdArray, 256L ) )
         goto Fail;
 
-      cmap->get_index = code_to_index0;
+      cmap->get_index     = code_to_index0;
       cmap->get_next_char = code_to_next0;
       break;
 
@@ -159,7 +160,7 @@
       /* allocate subheader keys */
 
       if ( FT_NEW_ARRAY( cmap2->subHeaderKeys, 256 ) ||
-           FT_FRAME_ENTER( 2L + 512L )                           )
+           FT_FRAME_ENTER( 2L + 512L )               )
         goto Fail;
 
       cmap2->language = FT_GET_USHORT();
@@ -178,10 +179,10 @@
       /* load subheaders */
 
       cmap2->numGlyphId = l = (FT_UShort)(
-        ( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xFFFF ) / 2 );
+        ( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xFFFFU ) / 2 );
 
-      if ( FT_NEW_ARRAY( cmap2->subHeaders, num_SH + 1 )    ||
-           FT_FRAME_ENTER( ( num_SH + 1 ) * 8L )            )
+      if ( FT_NEW_ARRAY( cmap2->subHeaders, num_SH + 1 ) ||
+           FT_FRAME_ENTER( ( num_SH + 1 ) * 8L )         )
       {
         FT_FREE( cmap2->subHeaderKeys );
         goto Fail;
@@ -249,15 +250,15 @@
       segments = cmap4->segments;
 
       for ( i = 0; i < num_Seg; i++ )
-        segments[i].endCount      = FT_GET_USHORT();
+        segments[i].endCount = FT_GET_USHORT();
 
       (void)FT_GET_USHORT();
 
       for ( i = 0; i < num_Seg; i++ )
-        segments[i].startCount    = FT_GET_USHORT();
+        segments[i].startCount = FT_GET_USHORT();
 
       for ( i = 0; i < num_Seg; i++ )
-        segments[i].idDelta       = FT_GET_SHORT();
+        segments[i].idDelta = FT_GET_SHORT();
 
       for ( i = 0; i < num_Seg; i++ )
         segments[i].idRangeOffset = FT_GET_USHORT();
@@ -265,7 +266,7 @@
       FT_FRAME_EXIT();
 
       cmap4->numGlyphId = l = (FT_UShort)(
-        ( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFF ) / 2 );
+        ( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFFU ) / 2 );
 
       /* load IDs */
 
@@ -283,7 +284,7 @@
 
       cmap4->last_segment = cmap4->segments;
 
-      cmap->get_index = code_to_index4;
+      cmap->get_index     = code_to_index4;
       cmap->get_next_char = code_to_next4;
       break;
 
@@ -309,7 +310,7 @@
         cmap6->glyphIdArray[i] = FT_GET_USHORT();
 
       FT_FRAME_EXIT();
-      cmap->get_index = code_to_index6;
+      cmap->get_index     = code_to_index6;
       cmap->get_next_char = code_to_next6;
       break;
 
@@ -351,7 +352,7 @@
 
       cmap8_12->last_group = cmap8_12->groups;
 
-      cmap->get_index = code_to_index8_12;
+      cmap->get_index     = code_to_index8_12;
       cmap->get_next_char = code_to_next8_12;
       break;
 
@@ -378,7 +379,7 @@
         cmap10->glyphs[j] = FT_GET_USHORT();
 
       FT_FRAME_EXIT();
-      cmap->get_index = code_to_index10;
+      cmap->get_index     = code_to_index10;
       cmap->get_next_char = code_to_next10;
       break;
 
@@ -405,14 +406,15 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face :: A handle to the parent face object.                        */
+  /*                                                                       */
   /*    cmap :: A handle to a cmap object.                                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
-  TT_CharMap_Free( TT_Face        face,
-                   TT_CMapTable   cmap )
+  TT_CharMap_Free( TT_Face       face,
+                   TT_CMapTable  cmap )
   {
     FT_Memory  memory;
 
@@ -478,16 +480,17 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap0    :: A pointer to a cmap table in format 0.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index0( TT_CMapTable   cmap,
-                  FT_ULong       charCode )
+  code_to_index0( TT_CMapTable  cmap,
+                  FT_ULong      charCode )
   {
-    TT_CMap0   cmap0 = &cmap->c.cmap0;
+    TT_CMap0  cmap0 = &cmap->c.cmap0;
 
 
     return ( charCode <= 0xFF ? cmap0->glyphIdArray[charCode] : 0 );
@@ -506,16 +509,17 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap0    :: A pointer to a cmap table in format 0.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Next char code.  0 if no higher one is encoded.                    */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next0( TT_CMapTable   cmap,
-                 FT_ULong       charCode )
+  code_to_next0( TT_CMapTable  cmap,
+                 FT_ULong      charCode )
   {
-    TT_CMap0   cmap0 = &cmap->c.cmap0;
+    TT_CMap0  cmap0 = &cmap->c.cmap0;
 
 
     while ( ++charCode <= 0xFF )
@@ -535,20 +539,21 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap2    :: A pointer to a cmap table in format 2.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index2( TT_CMapTable   cmap,
-                  FT_ULong       charCode )
+  code_to_index2( TT_CMapTable  cmap,
+                  FT_ULong      charCode )
   {
-    FT_UInt             result, index1, offset;
-    FT_UInt             char_lo;
-    FT_ULong            char_hi;
-    TT_CMap2SubHeader   sh2;
-    TT_CMap2            cmap2;
+    FT_UInt            result, index1, offset;
+    FT_UInt            char_lo;
+    FT_ULong           char_hi;
+    TT_CMap2SubHeader  sh2;
+    TT_CMap2           cmap2;
 
 
     cmap2   = &cmap->c.cmap2;
@@ -582,7 +587,7 @@
       {
         result = cmap2->glyphIdArray[offset];
         if ( result )
-          result = ( result + sh2->idDelta ) & 0xFFFF;
+          result = ( result + sh2->idDelta ) & 0xFFFFU;
       }
     }
 
@@ -600,20 +605,21 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap2    :: A pointer to a cmap table in format 2.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Next encoded character.  0 if none exists.                         */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next2( TT_CMapTable   cmap,
-                 FT_ULong       charCode )
+  code_to_next2( TT_CMapTable  cmap,
+                 FT_ULong      charCode )
   {
-    FT_UInt             index1, offset;
-    FT_UInt             char_lo;
-    FT_ULong            char_hi;
-    TT_CMap2SubHeader   sh2;
-    TT_CMap2            cmap2;
+    FT_UInt            index1, offset;
+    FT_UInt            char_lo;
+    FT_ULong           char_hi;
+    TT_CMap2SubHeader  sh2;
+    TT_CMap2           cmap2;
 
 
     cmap2 = &cmap->c.cmap2;
@@ -683,17 +689,18 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap4    :: A pointer to a cmap table in format 4.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index4( TT_CMapTable   cmap,
-                  FT_ULong       charCode )
+  code_to_index4( TT_CMapTable  cmap,
+                  FT_ULong      charCode )
   {
-    FT_UInt          result, index1, segCount;
-    TT_CMap4         cmap4;
+    FT_UInt             result, index1, segCount;
+    TT_CMap4            cmap4;
     TT_CMap4SegmentRec  *seg4, *limit;
 
 
@@ -739,7 +746,7 @@
     /* directly                                                  */
 
     if ( seg4->idRangeOffset == 0 )
-      result = ( charCode + seg4->idDelta ) & 0xFFFF;
+      result = ( charCode + seg4->idDelta ) & 0xFFFFU;
     else
     {
       /* otherwise, we must use the glyphIdArray to do it */
@@ -750,7 +757,7 @@
 
       if ( index1 < (FT_UInt)cmap4->numGlyphId &&
            cmap4->glyphIdArray[index1] != 0    )
-        result = ( cmap4->glyphIdArray[index1] + seg4->idDelta ) & 0xFFFF;
+        result = ( cmap4->glyphIdArray[index1] + seg4->idDelta ) & 0xFFFFU;
     }
 
     return result;
@@ -767,17 +774,18 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap     :: A pointer to a cmap table in format 4.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Next encoded character.  0 if none exists.                         */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next4( TT_CMapTable   cmap,
-                 FT_ULong       charCode )
+  code_to_next4( TT_CMapTable  cmap,
+                 FT_ULong      charCode )
   {
-    FT_UInt          index1, segCount;
-    TT_CMap4         cmap4;
+    FT_UInt             index1, segCount;
+    TT_CMap4            cmap4;
     TT_CMap4SegmentRec  *seg4, *limit;
 
 
@@ -834,17 +842,18 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap6    :: A pointer to a cmap table in format 6.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index6( TT_CMapTable   cmap,
-                  FT_ULong       charCode )
+  code_to_index6( TT_CMapTable  cmap,
+                  FT_ULong      charCode )
   {
-    TT_CMap6   cmap6;
-    FT_UInt    result = 0;
+    TT_CMap6  cmap6;
+    FT_UInt   result = 0;
 
 
     cmap6     = &cmap->c.cmap6;
@@ -867,16 +876,17 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap     :: A pointer to a cmap table in format 6.                 */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Next encoded character.  0 if none exists.                         */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next6( TT_CMapTable   cmap,
-                 FT_ULong       charCode )
+  code_to_next6( TT_CMapTable  cmap,
+                 FT_ULong      charCode )
   {
-    TT_CMap6   cmap6;
+    TT_CMap6  cmap6;
 
 
     charCode++;
@@ -910,16 +920,17 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap8_12 :: A pointer to a cmap table in format 8 or 12.           */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index8_12( TT_CMapTable   cmap,
-                     FT_ULong       charCode )
+  code_to_index8_12( TT_CMapTable  cmap,
+                     FT_ULong      charCode )
   {
-    TT_CMap8_12  cmap8_12;
+    TT_CMap8_12      cmap8_12;
     TT_CMapGroupRec  *group, *limit;
 
 
@@ -974,16 +985,17 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap     :: A pointer to a cmap table in format 8 or 12.           */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Next encoded character.  0 if none exists.                         */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next8_12( TT_CMapTable   cmap,
-                    FT_ULong       charCode )
+  code_to_next8_12( TT_CMapTable  cmap,
+                    FT_ULong      charCode )
   {
-    TT_CMap8_12  cmap8_12;
+    TT_CMap8_12      cmap8_12;
     TT_CMapGroupRec  *group, *limit;
 
 
@@ -1020,17 +1032,18 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap10   :: A pointer to a cmap table in format 10.                */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Glyph index into the glyphs array.  0 if the glyph does not exist. */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_UInt )
-  code_to_index10( TT_CMapTable   cmap,
-                   FT_ULong       charCode )
+  code_to_index10( TT_CMapTable  cmap,
+                   FT_ULong      charCode )
   {
     TT_CMap10  cmap10;
-    FT_UInt     result = 0;
+    FT_UInt    result = 0;
 
 
     cmap10    = &cmap->c.cmap10;
@@ -1057,14 +1070,15 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    charCode :: The wanted character code.                             */
+  /*                                                                       */
   /*    cmap     :: A pointer to a cmap table in format 10.                */
   /*                                                                       */
   /* <Return>                                                              */
   /*    Next encoded character.  0 if none exists.                         */
   /*                                                                       */
   FT_CALLBACK_DEF( FT_ULong )
-  code_to_next10( TT_CMapTable   cmap,
-                  FT_ULong       charCode )
+  code_to_next10( TT_CMapTable  cmap,
+                  FT_ULong      charCode )
   {
     TT_CMap10  cmap10;
 
diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h
index b05aba6..6ddb79e 100644
--- a/src/sfnt/ttcmap.h
+++ b/src/sfnt/ttcmap.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType character mapping table (cmap) support (specification).     */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -28,13 +28,13 @@ FT_BEGIN_HEADER
 
 
   FT_LOCAL( FT_Error )
-  TT_CharMap_Load( TT_Face        face,
-                   TT_CMapTable   cmap,
-                   FT_Stream      input );
+  TT_CharMap_Load( TT_Face       face,
+                   TT_CMapTable  cmap,
+                   FT_Stream     input );
 
   FT_LOCAL( FT_Error )
-  TT_CharMap_Free( TT_Face        face,
-                   TT_CMapTable   cmap );
+  TT_CharMap_Free( TT_Face       face,
+                   TT_CMapTable  cmap );
 
 
 FT_END_HEADER
diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c
index b079693..ac0ba25 100644
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -1,10 +1,10 @@
 /***************************************************************************/
 /*                                                                         */
-/*  ttcmap.c                                                               */
+/*  ttcmap0.c                                                              */
 /*                                                                         */
-/*    TrueType character mapping table (cmap) support (body).              */
+/*    TrueType new character mapping table (cmap) support (body).          */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 2002 by                                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -35,48 +35,47 @@
 #define FT_COMPONENT  trace_ttcmap
 
 
+#define TT_PEEK_SHORT   FT_PEEK_SHORT
+#define TT_PEEK_USHORT  FT_PEEK_USHORT
+#define TT_PEEK_LONG    FT_PEEK_LONG
+#define TT_PEEK_ULONG   FT_PEEK_ULONG
 
-#define  TT_PEEK_SHORT   FT_PEEK_SHORT
-#define  TT_PEEK_USHORT  FT_PEEK_USHORT
-#define  TT_PEEK_LONG    FT_PEEK_LONG
-#define  TT_PEEK_ULONG   FT_PEEK_ULONG
-
-#define  TT_NEXT_SHORT   FT_NEXT_SHORT
-#define  TT_NEXT_USHORT  FT_NEXT_USHORT
-#define  TT_NEXT_LONG    FT_NEXT_LONG
-#define  TT_NEXT_ULONG   FT_NEXT_ULONG
+#define TT_NEXT_SHORT   FT_NEXT_SHORT
+#define TT_NEXT_USHORT  FT_NEXT_USHORT
+#define TT_NEXT_LONG    FT_NEXT_LONG
+#define TT_NEXT_ULONG   FT_NEXT_ULONG
 
 
   FT_CALLBACK_DEF( FT_Error )
-  tt_cmap_init( TT_CMap      cmap,
-                FT_Byte*     table )
+  tt_cmap_init( TT_CMap   cmap,
+                FT_Byte*  table )
   {
     cmap->data = table;
     return 0;
   }
 
 
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                          FORMAT 0                            *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*************************************************************************
-  *
-  *  TABLE OVERVIEW:
-  *  ---------------
-  *
-  *    NAME        OFFSET         TYPE          DESCRIPTION
-  *
-  *    format      0              USHORT        must be 0
-  *    length      2              USHORT        table length in bytes
-  *    language    4              USHORT        Mac language code
-  *    glyph_ids   6              BYTE[256]     array of glyph indices
-  *                262
-  */
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                           FORMAT 0                            *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* TABLE OVERVIEW                                                        */
+  /* --------------                                                        */
+  /*                                                                       */
+  /*   NAME        OFFSET         TYPE          DESCRIPTION                */
+  /*                                                                       */
+  /*   format      0              USHORT        must be 0                  */
+  /*   length      2              USHORT        table length in bytes      */
+  /*   language    4              USHORT        Mac language code          */
+  /*   glyph_ids   6              BYTE[256]     array of glyph indices     */
+  /*               262                                                     */
+  /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_0
 
@@ -85,7 +84,8 @@
                      FT_Validator  valid )
   {
     FT_Byte*  p      = table + 2;
-    FT_UInt   length = TT_NEXT_USHORT(p);
+    FT_UInt   length = TT_NEXT_USHORT( p );
+
 
     if ( table + length > valid->limit || length < 262 )
       FT_INVALID_TOO_SHORT;
@@ -93,13 +93,14 @@
     /* check glyph indices whenever necessary */
     if ( valid->level >= FT_VALIDATE_TIGHT )
     {
-      FT_UInt  n, index;
+      FT_UInt  n, idx;
+
 
       p = table + 6;
       for ( n = 0; n < 256; n++ )
       {
-        index = *p++;
-        if ( index >= TT_VALID_GLYPH_COUNT(valid) )
+        idx = *p++;
+        if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )
           FT_INVALID_GLYPH_ID;
       }
     }
@@ -112,19 +113,21 @@
   {
     FT_Byte*  table = cmap->data;
 
-    return  ( char_code < 256 ? table[6+char_code] : 0 );
+
+    return char_code < 256 ? table[6 + char_code] : 0;
   }
 
 
   FT_CALLBACK_DEF( FT_UInt )
-  tt_cmap0_char_next( TT_CMap    cmap,
-                      FT_UInt32 *pchar_code )
+  tt_cmap0_char_next( TT_CMap     cmap,
+                      FT_UInt32  *pchar_code )
   {
     FT_Byte*   table    = cmap->data;
     FT_UInt32  charcode = *pchar_code;
     FT_UInt32  result   = 0;
     FT_UInt    gindex   = 0;
 
+
     table += 6;  /* go to glyph ids */
     while ( ++charcode < 256 )
     {
@@ -141,107 +144,109 @@
   }
 
 
-  FT_CALLBACK_TABLE_DEF const TT_CMap_ClassRec  tt_cmap0_class_rec =
+  FT_CALLBACK_TABLE_DEF
+  const TT_CMap_ClassRec  tt_cmap0_class_rec =
   {
     {
       sizeof( TT_CMapRec ),
 
-      (FT_CMap_InitFunc)      tt_cmap_init,
-      (FT_CMap_DoneFunc)      NULL,
-      (FT_CMap_CharIndexFunc) tt_cmap0_char_index,
-      (FT_CMap_CharNextFunc)  tt_cmap0_char_next
+      (FT_CMap_InitFunc)     tt_cmap_init,
+      (FT_CMap_DoneFunc)     NULL,
+      (FT_CMap_CharIndexFunc)tt_cmap0_char_index,
+      (FT_CMap_CharNextFunc) tt_cmap0_char_next
     },
     0,
-    (TT_CMap_ValidateFunc)    tt_cmap0_validate
+    (TT_CMap_ValidateFunc)   tt_cmap0_validate
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_0 */
 
 
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                          FORMAT 2                            *****/
- /*****                                                              *****/
- /*****  This is used for certain CJK encodings that encode text     *****/
- /*****  in a mixed 8/16 bits along the following lines:             *****/
- /*****                                                              *****/
- /*****  * certain byte values correspond to an 8-bit character code *****/
- /*****    (typicall in the range 0..127 for ASCII compatibility)    *****/
- /*****                                                              *****/
- /*****  * certain byte values signal the first byte of a 2-byte     *****/
- /*****    character code (but these values are also valid as the    *****/
- /*****    second byte of a 2-byte character)                        *****/
- /*****                                                              *****/
- /*****  the following charmap lookup and iteration function all     *****/
- /*****  assume that the value "charcode" correspond to following:   *****/
- /*****                                                              *****/
- /*****     - for one byte characters, "charcode" is simply the      *****/
- /*****       character code                                         *****/
- /*****                                                              *****/
- /*****     - for two byte characters, "charcode" is the 2-byte      *****/
- /*****       character code in big endian format. More exactly:     *****/
- /*****                                                              *****/
- /*****           (charcode >> 8)    is the first byte value         *****/
- /*****           (charcode & 0xFF)  is the second byte value        *****/
- /*****                                                              *****/
- /*****   note that not all values of "charcode" are valid           *****/
- /*****   according to these rules, and the function moderately      *****/
- /*****   check the arguments..                                      *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*************************************************************************
-  *
-  *  TABLE OVERVIEW:
-  *  ---------------
-  *
-  *    NAME        OFFSET         TYPE            DESCRIPTION
-  *
-  *    format      0              USHORT          must be 2
-  *    length      2              USHORT          table length in bytes
-  *    language    4              USHORT          Mac language code
-  *    keys        6              USHORT[256]     sub-header keys
-  *    subs        518            SUBHEAD[NSUBS]  sub-headers array
-  *    glyph_ids   518+NSUB*8     USHORT[]        glyph id array
-  *
-  *   the 'keys' table is used to map charcode high-bytes to sub-headers.
-  *   the value of 'NSUBS' is the number of sub-headers defined in the
-  *   table and is computed by finding the maximum of the 'keys' table.
-  *
-  *   note that for any N, keys[n] is a byte offset within the subs table,
-  *   i.e. it is the corresponding sub-header index multiplied by 8.
-  *
-  *   each sub-header has the following format:
-  *
-  *    NAME        OFFSET         TYPE            DESCRIPTION
-  *
-  *    first       0              USHORT          first valid low-byte
-  *    count       2              USHORT          number of valid low-bytes
-  *    delta       4              SHORT           see below
-  *    offset      6              USHORT          see below
-  *
-  *  a sub-header defines, for each high-byte, the range of valid low-bytes
-  *  within the charmap. note that the range defined by 'first' and 'count'
-  *  must be completely included in the interval [0..255] according to the
-  *  specification
-  *
-  *  if a character code is contained within a given sub-header, then mapping
-  *  it to a glyph index is done as follows:
-  *
-  *  * the value of 'offset' is read. this is a _byte_ distance from the
-  *    location of the 'offset' field itself into a slice of the 'glyph_ids'
-  *    table. Let's call it 'slice' (it's a USHORT[] too)
-  *
-  *  * the value 'slice[ char.lo - first ]' is read. If it is 0, there is
-  *    no glyph for the charcode. Otherwise, the value of 'delta' is added
-  *    to it (modulo 65536) to form a new glyph index
-  *
-  *  it is up to the validation routine to check that all offsets fall within
-  *  the glyph ids table (and not within the 'subs' table itself or outside
-  *  of the CMap).
-  */
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                          FORMAT 2                             *****/
+  /*****                                                               *****/
+  /***** This is used for certain CJK encodings that encode text in a  *****/
+  /***** mixed 8/16 bits encoding along the following lines:           *****/
+  /*****                                                               *****/
+  /***** * Certain byte values correspond to an 8-bit character code   *****/
+  /*****   (typically in the range 0..127 for ASCII compatibility).    *****/
+  /*****                                                               *****/
+  /***** * Certain byte values signal the first byte of a 2-byte       *****/
+  /*****   character code (but these values are also valid as the      *****/
+  /*****   second byte of a 2-byte character).                         *****/
+  /*****                                                               *****/
+  /***** The following charmap lookup and iteration functions all      *****/
+  /***** assume that the value "charcode" correspond to following:     *****/
+  /*****                                                               *****/
+  /*****   - For one byte characters, "charcode" is simply the         *****/
+  /*****     character code.                                           *****/
+  /*****                                                               *****/
+  /*****   - For two byte characters, "charcode" is the 2-byte         *****/
+  /*****     character code in big endian format.  More exactly:       *****/
+  /*****                                                               *****/
+  /*****       (charcode >> 8)    is the first byte value              *****/
+  /*****       (charcode & 0xFF)  is the second byte value             *****/
+  /*****                                                               *****/
+  /***** Note that not all values of "charcode" are valid according    *****/
+  /***** to these rules, and the function moderately check the         *****/
+  /***** arguments.                                                    *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* TABLE OVERVIEW                                                        */
+  /* --------------                                                        */
+  /*                                                                       */
+  /*   NAME        OFFSET         TYPE            DESCRIPTION              */
+  /*                                                                       */
+  /*   format      0              USHORT          must be 2                */
+  /*   length      2              USHORT          table length in bytes    */
+  /*   language    4              USHORT          Mac language code        */
+  /*   keys        6              USHORT[256]     sub-header keys          */
+  /*   subs        518            SUBHEAD[NSUBS]  sub-headers array        */
+  /*   glyph_ids   518+NSUB*8     USHORT[]        glyph id array           */
+  /*                                                                       */
+  /* The `keys' table is used to map charcode high-bytes to sub-headers.   */
+  /* The value of `NSUBS' is the number of sub-headers defined in the      */
+  /* table and is computed by finding the maximum of the `keys' table.     */
+  /*                                                                       */
+  /* Note that for any n, `keys[n]' is a byte offset within the `subs'     */
+  /* table, i.e., it is the corresponding sub-header index multiplied      */
+  /* by 8.                                                                 */
+  /*                                                                       */
+  /* Each sub-header has the following format:                             */
+  /*                                                                       */
+  /*   NAME        OFFSET      TYPE            DESCRIPTION                 */
+  /*                                                                       */
+  /*   first       0           USHORT          first valid low-byte        */
+  /*   count       2           USHORT          number of valid low-bytes   */
+  /*   delta       4           SHORT           see below                   */
+  /*   offset      6           USHORT          see below                   */
+  /*                                                                       */
+  /* A sub-header defines, for each high-byte, the range of valid          */
+  /* low-bytes within the charmap.  Note that the range defined by `first' */
+  /* and `count' must be completely included in the interval [0..255]      */
+  /* according to the specification.                                       */
+  /*                                                                       */
+  /* If a character code is contained within a given sub-header, then      */
+  /* mapping it to a glyph index is done as follows:                       */
+  /*                                                                       */
+  /* * The value of `offset' is read.  This is a _byte_ distance from the  */
+  /*   location of the `offset' field itself into a slice of the           */
+  /*   `glyph_ids' table.  Let's call it `slice' (it's a USHORT[] too).    */
+  /*                                                                       */
+  /* * The value `slice[char.lo - first]' is read.  If it is 0, there is   */
+  /*   no glyph for the charcode.  Otherwise, the value of `delta' is      */
+  /*   added to it (modulo 65536) to form a new glyph index.               */
+  /*                                                                       */
+  /* It is up to the validation routine to check that all offsets fall     */
+  /* within the glyph ids table (and not within the `subs' table itself or */
+  /* outside of the CMap).                                                 */
+  /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_2
 
@@ -249,15 +254,15 @@
   tt_cmap2_validate( FT_Byte*      table,
                      FT_Validator  valid )
   {
-    FT_Byte*  p      = table + 2;  /* skip format */
-    FT_UInt   length = TT_PEEK_USHORT(p);
+    FT_Byte*  p      = table + 2;           /* skip format */
+    FT_UInt   length = TT_PEEK_USHORT( p );
     FT_UInt   n, max_subs;
-    FT_Byte*  keys;        /* keys table */
-    FT_Byte*  subs;        /* sub-headers */
-    FT_Byte*  glyph_ids;   /* glyph id array */
+    FT_Byte*  keys;                         /* keys table */
+    FT_Byte*  subs;                         /* sub-headers */
+    FT_Byte*  glyph_ids;                    /* glyph id array */
 
 
-    if ( table + length > valid->limit || length < 6+512 )
+    if ( table + length > valid->limit || length < 6 + 512 )
       FT_INVALID_TOO_SHORT;
 
     keys = table + 6;
@@ -267,22 +272,23 @@
     max_subs = 0;
     for ( n = 0; n < 256; n++ )
     {
-      FT_UInt  index = TT_NEXT_USHORT(p);
+      FT_UInt  idx = TT_NEXT_USHORT( p );
+
 
       /* value must be multiple of 8 */
-      if ( valid->level >= FT_VALIDATE_PARANOID && ( index & 7 ) != 0 )
+      if ( valid->level >= FT_VALIDATE_PARANOID && ( idx & 7 ) != 0 )
         FT_INVALID_DATA;
 
-      index >>= 3;
+      idx >>= 3;
 
-      if ( index > max_subs )
-        max_subs = index;
+      if ( idx > max_subs )
+        max_subs = idx;
     }
 
     FT_ASSERT( p == table + 518 );
 
     subs      = p;
-    glyph_ids = subs + (max_subs + 1)*8;
+    glyph_ids = subs + (max_subs + 1) * 8;
     if ( glyph_ids > valid->limit )
       FT_INVALID_TOO_SHORT;
 
@@ -294,10 +300,10 @@
       FT_Byte*  ids;
 
 
-      first_code = TT_NEXT_USHORT(p);
-      code_count = TT_NEXT_USHORT(p);
-      delta      = TT_NEXT_SHORT(p);
-      offset     = TT_NEXT_USHORT(p);
+      first_code = TT_NEXT_USHORT( p );
+      code_count = TT_NEXT_USHORT( p );
+      delta      = TT_NEXT_SHORT( p );
+      offset     = TT_NEXT_USHORT( p );
 
       /* check range within 0..255 */
       if ( valid->level >= FT_VALIDATE_PARANOID )
@@ -316,16 +322,17 @@
         /* check glyph ids */
         if ( valid->level >= FT_VALIDATE_TIGHT )
         {
-          FT_Byte*  limit = p + code_count*2;
-          FT_UInt   index;
+          FT_Byte*  limit = p + code_count * 2;
+          FT_UInt   idx;
+
 
           for ( ; p < limit; )
           {
-            index = TT_NEXT_USHORT(p);
-            if ( index != 0 )
+            idx = TT_NEXT_USHORT( p );
+            if ( idx != 0 )
             {
-              index = (index + delta) & 0xFFFFU;
-              if ( index >= TT_VALID_GLYPH_COUNT(valid) )
+              idx = ( idx + delta ) & 0xFFFFU;
+              if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )
                 FT_INVALID_GLYPH_ID;
             }
           }
@@ -336,26 +343,27 @@
 
 
   /* return sub header corresponding to a given character code */
-  /* NULL on invalid charcode..                                */
+  /* NULL on invalid charcode                                  */
   static FT_Byte*
   tt_cmap2_get_subheader( FT_Byte*   table,
                           FT_UInt32  char_code )
   {
     FT_Byte*  result = NULL;
 
-    if ( char_code < 0x10000 )
+
+    if ( char_code < 0x10000UL )
     {
-      FT_UInt  char_lo = (FT_UInt)( char_code & 0xFF );
-      FT_UInt  char_hi = (FT_UInt)( char_code >> 8 );
-      FT_Byte* p       = table + 6;    /* keys table */
-      FT_Byte* subs    = table + 518;  /* subheaders table */
-      FT_Byte* sub;
+      FT_UInt   char_lo = (FT_UInt)( char_code & 0xFF );
+      FT_UInt   char_hi = (FT_UInt)( char_code >> 8 );
+      FT_Byte*  p       = table + 6;    /* keys table */
+      FT_Byte*  subs    = table + 518;  /* subheaders table */
+      FT_Byte*  sub;
 
 
       if ( char_hi == 0 )
       {
         /* an 8-bit character code -- we use subHeader 0 in this case */
-        /* to test wheteher the character code is in the charmap      */
+        /* to test whether the character code is in the charmap       */
         /*                                                            */
         sub = subs;  /* jump to first sub-header */
 
@@ -363,15 +371,15 @@
         /* indicates that it's really a valid one-byte value   */
         /* Otherwise, return 0                                 */
         /*                                                     */
-        p  += char_lo*2;
-        if ( TT_PEEK_USHORT(p) != 0 )
+        p += char_lo * 2;
+        if ( TT_PEEK_USHORT( p ) != 0 )
           goto Exit;
       }
       else
       {
         /* a 16-bit character code */
-        p  += char_hi*2;                       /* jump to key entry */
-        sub = subs + ( TT_PEEK_USHORT(p) & -8 );  /* jump to sub-header */
+        p  += char_hi * 2;                          /* jump to key entry  */
+        sub = subs + ( TT_PEEK_USHORT( p ) & -8 );  /* jump to sub-header */
 
         /* check that the hi byte isn't a valid one-byte value */
         if ( sub == subs )
@@ -392,57 +400,60 @@
     FT_UInt   result  = 0;
     FT_Byte*  subheader;
 
+
     subheader = tt_cmap2_get_subheader( table, char_code );
     if ( subheader )
     {
-      FT_Byte*  p     = subheader;
-      FT_UInt   index = (FT_UInt)(char_code & 0xFF);
+      FT_Byte*  p   = subheader;
+      FT_UInt   idx = (FT_UInt)(char_code & 0xFF);
       FT_UInt   start, count;
       FT_Int    delta;
       FT_UInt   offset;
 
-      start  = TT_NEXT_USHORT(p);
-      count  = TT_NEXT_USHORT(p);
-      delta  = TT_NEXT_SHORT(p);
-      offset = TT_PEEK_USHORT(p);
 
-      index -= start;
-      if ( index < count && offset != 0 )
+      start  = TT_NEXT_USHORT( p );
+      count  = TT_NEXT_USHORT( p );
+      delta  = TT_NEXT_SHORT ( p );
+      offset = TT_PEEK_USHORT( p );
+
+      idx -= start;
+      if ( idx < count && offset != 0 )
       {
-        p    += offset + 2*index;
-        index = TT_PEEK_USHORT(p);
+        p  += offset + 2 * idx;
+        idx = TT_PEEK_USHORT( p );
 
-        if ( index != 0 )
-          result = (FT_UInt)( index + delta ) & 0xFFFFU;
+        if ( idx != 0 )
+          result = (FT_UInt)( idx + delta ) & 0xFFFFU;
       }
     }
     return result;
   }
 
 
-
   FT_CALLBACK_DEF( FT_UInt )
   tt_cmap2_char_next( TT_CMap     cmap,
                       FT_UInt32  *pcharcode )
   {
-    FT_Byte*  table     = cmap->data;
-    FT_UInt   gindex    = 0;
-    FT_UInt32 result    = 0;
-    FT_UInt32 charcode  = *pcharcode + 1;
-    FT_Byte*  subheader;
+    FT_Byte*   table    = cmap->data;
+    FT_UInt    gindex   = 0;
+    FT_UInt32  result   = 0;
+    FT_UInt32  charcode = *pcharcode + 1;
+    FT_Byte*   subheader;
 
-    while ( charcode < 0x10000U )
+
+    while ( charcode < 0x10000UL )
     {
       subheader = tt_cmap2_get_subheader( table, charcode );
       if ( subheader )
       {
         FT_Byte*  p       = subheader;
-        FT_UInt   start   = TT_NEXT_USHORT(p);
-        FT_UInt   count   = TT_NEXT_USHORT(p);
-        FT_Int    delta   = TT_NEXT_SHORT(p);
-        FT_UInt   offset  = TT_PEEK_USHORT(p);
+        FT_UInt   start   = TT_NEXT_USHORT( p );
+        FT_UInt   count   = TT_NEXT_USHORT( p );
+        FT_Int    delta   = TT_NEXT_SHORT ( p );
+        FT_UInt   offset  = TT_PEEK_USHORT( p );
         FT_UInt   char_lo = (FT_UInt)( charcode & 0xFF );
-        FT_UInt   pos, index;
+        FT_UInt   pos, idx;
+
 
         if ( offset == 0 )
           goto Next_SubHeader;
@@ -455,16 +466,16 @@
         else
           pos = (FT_UInt)( char_lo - start );
 
-        p       += offset + pos*2;
-        charcode = (charcode & -256) + char_lo;
+        p       += offset + pos * 2;
+        charcode = ( charcode & -256 ) + char_lo;
 
         for ( ; pos < count; pos++, charcode++ )
         {
-          index = TT_NEXT_USHORT(p);
+          idx = TT_NEXT_USHORT( p );
 
-          if ( index != 0 )
+          if ( idx != 0 )
           {
-            gindex = ( index + delta ) & 0xFFFFU;
+            gindex = ( idx + delta ) & 0xFFFFU;
             if ( gindex != 0 )
             {
               result = charcode;
@@ -476,7 +487,7 @@
 
       /* jump to next sub-header, i.e. higher byte value */
     Next_SubHeader:
-      charcode = (charcode & -256) + 256;
+      charcode = ( charcode & -256 ) + 256;
     }
 
   Exit:
@@ -485,82 +496,89 @@
     return gindex;
   }
 
-  FT_CALLBACK_TABLE_DEF const TT_CMap_ClassRec  tt_cmap2_class_rec =
+
+  FT_CALLBACK_TABLE_DEF
+  const TT_CMap_ClassRec  tt_cmap2_class_rec =
   {
     {
       sizeof( TT_CMapRec ),
 
-      (FT_CMap_InitFunc)      tt_cmap_init,
-      (FT_CMap_DoneFunc)      NULL,
-      (FT_CMap_CharIndexFunc) tt_cmap2_char_index,
-      (FT_CMap_CharNextFunc)  tt_cmap2_char_next
+      (FT_CMap_InitFunc)     tt_cmap_init,
+      (FT_CMap_DoneFunc)     NULL,
+      (FT_CMap_CharIndexFunc)tt_cmap2_char_index,
+      (FT_CMap_CharNextFunc) tt_cmap2_char_next
     },
     2,
-    (TT_CMap_ValidateFunc)    tt_cmap2_validate
+    (TT_CMap_ValidateFunc)   tt_cmap2_validate
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_2 */
 
 
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                          FORMAT 4                            *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*************************************************************************
-  *
-  *  TABLE OVERVIEW:
-  *  ---------------
-  *
-  *    NAME        OFFSET           TYPE               DESCRIPTION
-  *
-  *    format        0              USHORT             must be 4
-  *    length        2              USHORT             table length in bytes
-  *    language      4              USHORT             Mac language code
-  *
-  *    segCountX2    6              USHORT             2*NUM_SEGS
-  *    searchRange   8              USHORT             2*(1 << LOG_SEGS)
-  *    entrySelector 10             USHORT             LOG_SEGS
-  *    rangeShift    12             USHORT             segCountX2 - searchRange
-  *
-  *    endCount      14             USHORT[NUM_SEGS]   end charcode for each
-  *                                                    segment. last is 0xFFFF
-  *
-  *    pad           14+NUM_SEGS*2  USHORT             padding
-  *
-  *    startCount    16+NUM_SEGS*2  USHORT[NUM_SEGS]   first charcode for each
-  *                                                    segment
-  *
-  *    idDelta       16+NUM_SEGS*4  SHORT[NUM_SEGS]    delta for each segment
-  *
-  *    idOffset      16+NUM_SEGS*6  SHORT[NUM_SEGS]    range offset for each
-  *                                                    segment. can be 0
-  *
-  *    glyphIds      16+NUM_SEGS*8  USHORT[]           array og glyph id ranges
-  *
-  *
-  *  Charcodes are modelled by a series of ordered (increasing) intervals
-  *  called segments. Each segment has start and end codes, provided by
-  *  the 'startCount' and 'endCount' arrays. Segments must not be over-lapping
-  *  and the last segment should always contain the '0xFFFF' endCount.
-  *
-  *  The fields 'searchRange', 'entrySelector' and 'rangeShift' are better
-  *  ignored (they're traces of over-engineering in the TT specification)
-  *
-  *  Each segment also has a signed 'delta', as well as an optional offset
-  *  within the 'glyphIds' table.
-  *
-  *  if a segment's idOffset is 0, then the glyph index corresponding to
-  *  any charcode within the segment is obtained by adding the value of
-  *  'idDelta' directly to the charcode, modulo 65536
-  *
-  *  otherwise, a glyph index is taken from the glyph ids sub-array for the
-  *  segment, and the value of 'idDelta' is added to it..
-  */
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                           FORMAT 4                            *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* TABLE OVERVIEW                                                        */
+  /* --------------                                                        */
+  /*                                                                       */
+  /*   NAME          OFFSET         TYPE              DESCRIPTION          */
+  /*                                                                       */
+  /*   format        0              USHORT            must be 4            */
+  /*   length        2              USHORT            table length         */
+  /*                                                  in bytes             */
+  /*   language      4              USHORT            Mac language code    */
+  /*                                                                       */
+  /*   segCountX2    6              USHORT            2*NUM_SEGS           */
+  /*   searchRange   8              USHORT            2*(1 << LOG_SEGS)    */
+  /*   entrySelector 10             USHORT            LOG_SEGS             */
+  /*   rangeShift    12             USHORT            segCountX2 -         */
+  /*                                                    searchRange        */
+  /*                                                                       */
+  /*   endCount      14             USHORT[NUM_SEGS]  end charcode for     */
+  /*                                                  each segment; last   */
+  /*                                                  is 0xFFFF            */
+  /*                                                                       */
+  /*   pad           14+NUM_SEGS*2  USHORT            padding              */
+  /*                                                                       */
+  /*   startCount    16+NUM_SEGS*2  USHORT[NUM_SEGS]  first charcode for   */
+  /*                                                  each segment         */
+  /*                                                                       */
+  /*   idDelta       16+NUM_SEGS*4  SHORT[NUM_SEGS]   delta for each       */
+  /*                                                  segment              */
+  /*   idOffset      16+NUM_SEGS*6  SHORT[NUM_SEGS]   range offset for     */
+  /*                                                  each segment; can be */
+  /*                                                  zero                 */
+  /*                                                                       */
+  /*   glyphIds      16+NUM_SEGS*8  USHORT[]          array of glyph id    */
+  /*                                                  ranges               */
+  /*                                                                       */
+  /* Character codes are modelled by a series of ordered (increasing)      */
+  /* intervals called segments.  Each segment has start and end codes,     */
+  /* provided by the `startCount' and `endCount' arrays.  Segments must    */
+  /* not be overlapping and the last segment should always contain the     */
+  /* `0xFFFF' endCount.                                                    */
+  /*                                                                       */
+  /* The fields `searchRange', `entrySelector' and `rangeShift' are better */
+  /* ignored (they are traces of over-engineering in the TrueType          */
+  /* specification).                                                       */
+  /*                                                                       */
+  /* Each segment also has a signed `delta', as well as an optional offset */
+  /* within the `glyphIds' table.                                          */
+  /*                                                                       */
+  /* If a segment's idOffset is 0, the glyph index corresponding to any    */
+  /* charcode within the segment is obtained by adding the value of        */
+  /* `idDelta' directly to the charcode, modulo 65536.                     */
+  /*                                                                       */
+  /* Otherwise, a glyph index is taken from the glyph ids sub-array for    */
+  /* the segment, and the value of `idDelta' is added to it.               */
+  /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_4
 
@@ -568,16 +586,17 @@
   tt_cmap4_validate( FT_Byte*      table,
                      FT_Validator  valid )
   {
-    FT_Byte*  p      = table + 2;  /* skip format */
-    FT_UInt   length = TT_NEXT_USHORT(p);
+    FT_Byte*  p      = table + 2;               /* skip format */
+    FT_UInt   length = TT_NEXT_USHORT( p );
     FT_Byte   *ends, *starts, *offsets, *deltas, *glyph_ids;
     FT_UInt   num_segs;
 
+
     if ( table + length > valid->limit || length < 16 )
       FT_INVALID_TOO_SHORT;
 
     p        = table + 6;
-    num_segs = TT_NEXT_USHORT(p);   /* read segCountX2 */
+    num_segs = TT_NEXT_USHORT( p );   /* read segCountX2 */
 
     if ( valid->level >= FT_VALIDATE_PARANOID )
     {
@@ -593,30 +612,31 @@
     if ( valid->level >= FT_VALIDATE_PARANOID )
     {
       /* check the values of 'searchRange', 'entrySelector', 'rangeShift' */
-      FT_UInt  search_range   = TT_NEXT_USHORT(p);
-      FT_UInt  entry_selector = TT_NEXT_USHORT(p);
-      FT_UInt  range_shift    = TT_NEXT_USHORT(p);
+      FT_UInt  search_range   = TT_NEXT_USHORT( p );
+      FT_UInt  entry_selector = TT_NEXT_USHORT( p );
+      FT_UInt  range_shift    = TT_NEXT_USHORT( p );
+
 
-      if ( (search_range | range_shift) & 1 )  /* must be even values */
+      if ( ( search_range | range_shift ) & 1 )  /* must be even values */
         FT_INVALID_DATA;
 
       search_range /= 2;
       range_shift  /= 2;
 
-      /* 'search range' is the greatest power of 2 that is <= num_segs */
+      /* `search range' is the greatest power of 2 that is <= num_segs */
 
-      if ( search_range > num_segs                ||
-           search_range*2 < num_segs              ||
-           search_range + range_shift != num_segs ||
-           search_range != (1U << entry_selector)  )
+      if ( search_range                > num_segs                 ||
+           search_range * 2            < num_segs                 ||
+           search_range + range_shift != num_segs                 ||
+           search_range               != ( 1U << entry_selector ) )
         FT_INVALID_DATA;
     }
 
     ends      = table   + 14;
-    starts    = table   + 16 + num_segs*2;
-    deltas    = starts  + num_segs*2;
-    offsets   = deltas  + num_segs*2;
-    glyph_ids = offsets + num_segs*2;
+    starts    = table   + 16 + num_segs * 2;
+    deltas    = starts  + num_segs * 2;
+    offsets   = deltas  + num_segs * 2;
+    glyph_ids = offsets + num_segs * 2;
 
     if ( glyph_ids >= table + length )
       FT_INVALID_TOO_SHORT;
@@ -624,23 +644,28 @@
     /* check last segment, its end count must be FFFF */
     if ( valid->level >= FT_VALIDATE_PARANOID )
     {
-      p = ends + (num_segs-1)*2;
-      if ( TT_PEEK_USHORT(p) != 0xFFFFU )
+      p = ends + ( num_segs - 1 ) * 2;
+      if ( TT_PEEK_USHORT( p ) != 0xFFFFU )
         FT_INVALID_DATA;
     }
 
-    /* check that segments are sorted in increasing order and do not overlap */
-    /* check also the offsets..                                              */
+    /* check that segments are sorted in increasing order and do not */
+    /* overlap; check also the offsets                               */
     {
       FT_UInt  start, end, last = 0,offset, n;
       FT_Int   delta;
 
+
       for ( n = 0; n < num_segs; n++ )
       {
-        p = starts  + n*2;  start  = TT_PEEK_USHORT(p);
-        p = ends    + n*2;  end    = TT_PEEK_USHORT(p);
-        p = deltas  + n*2;  delta  = TT_PEEK_SHORT(p);
-        p = offsets + n*2;  offset = TT_PEEK_USHORT(p);
+        p = starts + n * 2;
+        start = TT_PEEK_USHORT( p );
+        p = ends + n * 2;
+        end = TT_PEEK_USHORT( p );
+        p = deltas + n * 2;
+        delta = TT_PEEK_SHORT( p );
+        p = offsets + n * 2;
+        offset = TT_PEEK_USHORT( p );
 
         if ( start > end )
           FT_INVALID_DATA;
@@ -653,34 +678,36 @@
           p += offset;  /* start of glyph id array */
 
           /* check that we point within the glyph ids table only */
-          if ( p < glyph_ids || p + (end - start + 1)*2 > table + length )
+          if ( p < glyph_ids                                ||
+               p + ( end - start + 1 ) * 2 > table + length )
             FT_INVALID_DATA;
 
           /* check glyph indices within the segment range */
           if ( valid->level >= FT_VALIDATE_TIGHT )
           {
-            FT_UInt   index;
+            FT_UInt  idx;
+
 
             for ( ; start < end; )
             {
-              index = FT_NEXT_USHORT(p);
-              if ( index != 0 )
+              idx = FT_NEXT_USHORT( p );
+              if ( idx != 0 )
               {
-                index = (FT_UInt)(index + delta) & 0xFFFFU;
+                idx = (FT_UInt)( idx + delta ) & 0xFFFFU;
 
-                if ( index >= TT_VALID_GLYPH_COUNT(valid) )
+                if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )
                   FT_INVALID_GLYPH_ID;
               }
             }
           }
         }
+
         last = end;
       }
     }
   }
 
 
-
   FT_CALLBACK_DEF( FT_UInt )
   tt_cmap4_char_index( TT_CMap    cmap,
                        FT_UInt32  char_code )
@@ -688,44 +715,49 @@
     FT_Byte*  table  = cmap->data;
     FT_UInt   result = 0;
 
-    if ( char_code < 0x10000U )
+
+    if ( char_code < 0x10000UL )
     {
       FT_Byte*  p;
       FT_Byte*  q;
-      FT_UInt   index, num_segs2;
+      FT_UInt   idx, num_segs2;
       FT_Int    delta;
       FT_UInt   n, code = (FT_UInt)char_code;
 
+
       p         = table + 6;
-      num_segs2 = TT_PEEK_USHORT(p) & -2;  /* be paranoid !! */
+      num_segs2 = TT_PEEK_USHORT( p ) & -2;  /* be paranoid! */
 
       p = table + 14;               /* ends table   */
       q = table + 16 + num_segs2;   /* starts table */
 
       for ( n = 0; n < num_segs2; n += 2 )
       {
-        FT_UInt  end   = TT_NEXT_USHORT(p);
-        FT_UInt  start = TT_NEXT_USHORT(q);
+        FT_UInt  end   = TT_NEXT_USHORT( p );
+        FT_UInt  start = TT_NEXT_USHORT( q );
         FT_UInt  offset;
 
+
         if ( code < start )
           break;
 
         if ( code <= end )
         {
-          index = code;
+          idx = code;
 
-          p  = q + num_segs2 - 2; delta  = TT_PEEK_SHORT(p);
-          p += num_segs2;         offset = TT_PEEK_USHORT(p);
+          p = q + num_segs2 - 2;
+          delta = TT_PEEK_SHORT( p );
+          p += num_segs2;
+          offset = TT_PEEK_USHORT( p );
 
           if ( offset != 0 )
           {
-            p    += offset + 2*(index - start);
-            index = TT_PEEK_USHORT(p);
+            p  += offset + 2 * ( idx - start );
+            idx = TT_PEEK_USHORT( p );
           }
 
-          if ( index != 0 )
-            result = (FT_UInt)( index + delta ) & 0xFFFFU;
+          if ( idx != 0 )
+            result = (FT_UInt)( idx + delta ) & 0xFFFFU;
         }
       }
     }
@@ -733,20 +765,20 @@
   }
 
 
-
   FT_CALLBACK_DEF( FT_UInt )
   tt_cmap4_char_next( TT_CMap     cmap,
                       FT_UInt32  *pchar_code )
   {
-    FT_Byte*  table     = cmap->data;
-    FT_UInt32 result    = 0;
-    FT_UInt32 char_code = *pchar_code + 1;
-    FT_UInt   gindex    = 0;
-    FT_Byte*  p;
-    FT_Byte*  q;
-    FT_UInt   code, num_segs2;
+    FT_Byte*   table     = cmap->data;
+    FT_UInt32  result    = 0;
+    FT_UInt32  char_code = *pchar_code + 1;
+    FT_UInt    gindex    = 0;
+    FT_Byte*   p;
+    FT_Byte*   q;
+    FT_UInt    code, num_segs2;
+
 
-    if ( char_code >= 0x10000U )
+    if ( char_code >= 0x10000UL )
       goto Exit;
 
     code      = (FT_UInt)char_code;
@@ -755,32 +787,36 @@
 
     for (;;)
     {
-      FT_UInt   offset, n;
-      FT_Int    delta;
+      FT_UInt  offset, n;
+      FT_Int   delta;
+
 
       p = table + 14;              /* ends table  */
       q = table + 16 + num_segs2;  /* starts table */
 
       for ( n = 0; n < num_segs2; n += 2 )
       {
-        FT_UInt  end   = TT_NEXT_USHORT(p);
-        FT_UInt  start = TT_NEXT_USHORT(q);
+        FT_UInt  end   = TT_NEXT_USHORT( p );
+        FT_UInt  start = TT_NEXT_USHORT( q );
+
 
         if ( code < start )
           code = start;
 
         if ( code <= end )
         {
-          p  = q + num_segs2 - 2; delta  = TT_PEEK_SHORT(p);
-          p += num_segs2;         offset = TT_PEEK_USHORT(p);
+          p = q + num_segs2 - 2;
+          delta = TT_PEEK_SHORT( p );
+          p += num_segs2;
+          offset = TT_PEEK_USHORT( p );
 
           if ( offset != 0 )
           {
             /* parse the glyph ids array for non-0 index */
-            p += offset + (code - start)*2;
+            p += offset + ( code - start ) * 2;
             while ( code <= end )
             {
-              gindex = TT_NEXT_USHORT(p);
+              gindex = TT_NEXT_USHORT( p );
               if ( gindex != 0 )
               {
                 gindex = (FT_UInt)( gindex + delta ) & 0xFFFFU;
@@ -814,48 +850,50 @@
     return gindex;
   }
 
-  FT_CALLBACK_TABLE_DEF const TT_CMap_ClassRec  tt_cmap4_class_rec =
+
+  FT_CALLBACK_TABLE_DEF
+  const TT_CMap_ClassRec  tt_cmap4_class_rec =
   {
     {
-      sizeof( TT_CMapRec ),
+      sizeof ( TT_CMapRec ),
 
-      (FT_CMap_InitFunc)      tt_cmap_init,
-      (FT_CMap_DoneFunc)      NULL,
-      (FT_CMap_CharIndexFunc) tt_cmap4_char_index,
-      (FT_CMap_CharNextFunc)  tt_cmap4_char_next
+      (FT_CMap_InitFunc)     tt_cmap_init,
+      (FT_CMap_DoneFunc)     NULL,
+      (FT_CMap_CharIndexFunc)tt_cmap4_char_index,
+      (FT_CMap_CharNextFunc) tt_cmap4_char_next
     },
     4,
-    (TT_CMap_ValidateFunc)    tt_cmap4_validate
+    (TT_CMap_ValidateFunc)   tt_cmap4_validate
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_4 */
 
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                          FORMAT 6                            *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*************************************************************************
-  *
-  *  TABLE OVERVIEW:
-  *  ---------------
-  *
-  *    NAME        OFFSET           TYPE               DESCRIPTION
-  *
-  *    format        0              USHORT             must be 4
-  *    length        2              USHORT             table length in bytes
-  *    language      4              USHORT             Mac language code
-  *
-  *    first         6              USHORT             first segment code
-  *    count         8              USHORT             segment size in chars
-  *    glyphIds      10             USHORT[count]      glyph ids
-  *
-  *
-  *  A very simplified segment mapping
-  */
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                          FORMAT 6                             *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* TABLE OVERVIEW                                                        */
+  /* --------------                                                        */
+  /*                                                                       */
+  /*   NAME        OFFSET          TYPE             DESCRIPTION            */
+  /*                                                                       */
+  /*   format       0              USHORT           must be 4              */
+  /*   length       2              USHORT           table length in bytes  */
+  /*   language     4              USHORT           Mac language code      */
+  /*                                                                       */
+  /*   first        6              USHORT           first segment code     */
+  /*   count        8              USHORT           segment size in chars  */
+  /*   glyphIds     10             USHORT[count]    glyph ids              */
+  /*                                                                       */
+  /* A very simplified segment mapping.                                    */
+  /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_6
 
@@ -866,17 +904,18 @@
     FT_Byte*  p;
     FT_UInt   length, start, count;
 
+
     if ( table + 10 > valid->limit )
       FT_INVALID_TOO_SHORT;
 
     p      = table + 2;
-    length = TT_NEXT_USHORT(p);
+    length = TT_NEXT_USHORT( p );
 
-    p      = table + 6;  /* skip language */
-    start  = TT_NEXT_USHORT(p);
-    count  = TT_NEXT_USHORT(p);
+    p      = table + 6;             /* skip language */
+    start  = TT_NEXT_USHORT( p );
+    count  = TT_NEXT_USHORT( p );
 
-    if ( table + length > valid->limit || length < 10 + count*2 )
+    if ( table + length > valid->limit || length < 10 + count * 2 )
       FT_INVALID_TOO_SHORT;
 
     /* check glyph indices */
@@ -884,10 +923,11 @@
     {
       FT_UInt  gindex;
 
+
       for ( ; count > 0; count-- )
       {
-        gindex = TT_NEXT_USHORT(p);
-        if ( gindex >= TT_VALID_GLYPH_COUNT(valid) )
+        gindex = TT_NEXT_USHORT( p );
+        if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) )
           FT_INVALID_GLYPH_ID;
       }
     }
@@ -901,45 +941,47 @@
     FT_Byte*  table  = cmap->data;
     FT_UInt   result = 0;
     FT_Byte*  p      = table + 6;
-    FT_UInt   start  = TT_NEXT_USHORT(p);
-    FT_UInt   count  = TT_NEXT_USHORT(p);
-    FT_UInt   index  = (FT_UInt)( char_code - start );
+    FT_UInt   start  = TT_NEXT_USHORT( p );
+    FT_UInt   count  = TT_NEXT_USHORT( p );
+    FT_UInt   idx    = (FT_UInt)( char_code - start );
+
 
-    if ( index < count )
+    if ( idx < count )
     {
-      p += 2*index;
-      result = TT_PEEK_USHORT(p);
+      p += 2 * idx;
+      result = TT_PEEK_USHORT( p );
     }
     return result;
   }
 
 
   FT_CALLBACK_DEF( FT_UInt )
-  tt_cmap6_char_next( TT_CMap    cmap,
-                      FT_UInt32 *pchar_code )
+  tt_cmap6_char_next( TT_CMap     cmap,
+                      FT_UInt32  *pchar_code )
   {
-    FT_Byte*  table     = cmap->data;
-    FT_UInt32 result    = 0;
-    FT_UInt32 char_code = *pchar_code + 1;
-    FT_UInt   gindex    = 0;
+    FT_Byte*   table     = cmap->data;
+    FT_UInt32  result    = 0;
+    FT_UInt32  char_code = *pchar_code + 1;
+    FT_UInt    gindex    = 0;
     
-    FT_Byte*  p      = table + 6;
-    FT_UInt   start  = TT_NEXT_USHORT(p);
-    FT_UInt   count  = TT_NEXT_USHORT(p);
-    FT_UInt   index;
+    FT_Byte*   p         = table + 6;
+    FT_UInt    start     = TT_NEXT_USHORT( p );
+    FT_UInt    count     = TT_NEXT_USHORT( p );
+    FT_UInt    idx;
 
-    if ( char_code >= 0x10000U )
+
+    if ( char_code >= 0x10000UL )
       goto Exit;
 
     if ( char_code < start )
       char_code = start;
 
-    index = (FT_UInt)( char_code - start );
-    p    += 2*index;
+    idx = (FT_UInt)( char_code - start );
+    p  += 2 * idx;
 
-    for ( ; index < count; index++ )
+    for ( ; idx < count; idx++ )
     {
-      gindex = TT_NEXT_USHORT(p);
+      gindex = TT_NEXT_USHORT( p );
       if ( gindex != 0 )
       {
         result = char_code;
@@ -954,79 +996,77 @@
   }
 
 
-  FT_CALLBACK_TABLE_DEF const TT_CMap_ClassRec  tt_cmap6_class_rec =
+  FT_CALLBACK_TABLE_DEF
+  const TT_CMap_ClassRec  tt_cmap6_class_rec =
   {
     {
-      sizeof( TT_CMapRec ),
+      sizeof ( TT_CMapRec ),
 
-      (FT_CMap_InitFunc)      tt_cmap_init,
-      (FT_CMap_DoneFunc)      NULL,
-      (FT_CMap_CharIndexFunc) tt_cmap6_char_index,
-      (FT_CMap_CharNextFunc)  tt_cmap6_char_next
+      (FT_CMap_InitFunc)     tt_cmap_init,
+      (FT_CMap_DoneFunc)     NULL,
+      (FT_CMap_CharIndexFunc)tt_cmap6_char_index,
+      (FT_CMap_CharNextFunc) tt_cmap6_char_next
     },
     6,
-    (TT_CMap_ValidateFunc)    tt_cmap6_validate
+    (TT_CMap_ValidateFunc)   tt_cmap6_validate
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_6 */
 
 
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                          FORMAT 8                            *****/
- /*****                                                              *****/
- /*****  It's hard to completely understand what the OpenType        *****/
- /*****  spec says about this format, but here are my conclusion     *****/
- /*****                                                              *****/
- /*****  the purpose of this format is to easily map UTF-16 text     *****/
- /*****  to glyph indices. Basically, the 'char_code' must be in     *****/
- /*****  one of the following formats:                               *****/
- /*****                                                              *****/
- /*****    - a 16-bit value that isn't part of the Unicode           *****/
- /*****      Surrogates Area (i.e. U+D800-U+DFFF)                    *****/
- /*****                                                              *****/
- /*****    - a 32-bit value, made of two surrogate values, i.e.      *****/
- /*****      if "char_code = (char_hi << 16) | char_lo", then        *****/
- /*****      both 'char_hi' and 'char_lo' must be in the Surrogates  *****/
- /*****      Area.                                                   *****/
- /*****                                                              *****/
- /*****  The 'is32' table embedded in the charmap indicates          *****/
- /*****  wether a given 16-bit value is in the surrogates area       *****/
- /*****  or not..                                                    *****/
- /*****                                                              *****/
- /*****  so, for any given "char_code", we can assert the following  *****/
- /*****                                                              *****/
- /*****   if 'char_hi == 0' then we must have 'is32[char_lo] == 0'   *****/
- /*****                                                              *****/
- /*****   if 'char_hi != 0' then we must have both                   *****/
- /*****   'is32[char_hi] != 0' and 'is32[char_lo] != 0'              *****/
- /*****                                                              *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*************************************************************************
-  *
-  *  TABLE OVERVIEW:
-  *  ---------------
-  *
-  *    NAME        OFFSET           TYPE               DESCRIPTION
-  *
-  *    format        0              USHORT             must be 8
-  *    reseved       2              USHORT             reserved
-  *    length        4              ULONG              length in bytes
-  *    language      8              ULONG              Mac language code
-  *    is32          12             BYTE[8192]         32-bitness bitmap
-  *    count         8204           ULONG              number of groups
-  *
-  *  this header is followed by 'count' groups of the following format:
-  *
-  *    start         0              ULONG              first charcode
-  *    end           4              ULONG              last charcode
-  *    startId       8              ULONG              start glyph id for
-  *                                                    the group
-  */
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                          FORMAT 8                             *****/
+  /*****                                                               *****/
+  /***** It's hard to completely understand what the OpenType spec     *****/
+  /***** says about this format, but here is my conclusion.            *****/
+  /*****                                                               *****/
+  /***** The purpose of this format is to easily map UTF-16 text to    *****/
+  /***** glyph indices.  Basically, the `char_code' must be in one of  *****/
+  /***** the following formats:                                        *****/
+  /*****                                                               *****/
+  /*****   - A 16-bit value that isn't part of the Unicode Surrogates  *****/
+  /*****     Area (i.e. U+D800-U+DFFF).                                *****/
+  /*****                                                               *****/
+  /*****   - A 32-bit value, made of two surrogate values, i.e.. if    *****/
+  /*****     `char_code = (char_hi << 16) | char_lo', then both        *****/
+  /*****     `char_hi' and `char_lo' must be in the Surrogates Area.   *****/
+  /*****      Area.                                                    *****/
+  /*****                                                               *****/
+  /***** The 'is32' table embedded in the charmap indicates whether a  *****/
+  /***** given 16-bit value is in the surrogates area or not.          *****/
+  /*****                                                               *****/
+  /***** So, for any given `char_code', we can assert the following:   *****/
+  /*****                                                               *****/
+  /*****   If `char_hi == 0' then we must have `is32[char_lo] == 0'.   *****/
+  /*****                                                               *****/
+  /*****   If `char_hi != 0' then we must have both                    *****/
+  /*****   `is32[char_hi] != 0' and `is32[char_lo] != 0'.              *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* TABLE OVERVIEW                                                        */
+  /* --------------                                                        */
+  /*                                                                       */
+  /*   NAME        OFFSET         TYPE        DESCRIPTION                  */
+  /*                                                                       */
+  /*   format      0              USHORT      must be 8                    */
+  /*   reseved     2              USHORT      reserved                     */
+  /*   length      4              ULONG       length in bytes              */
+  /*   language    8              ULONG       Mac language code            */
+  /*   is32        12             BYTE[8192]  32-bitness bitmap            */
+  /*   count       8204           ULONG       number of groups             */
+  /*                                                                       */
+  /* This header is followed by 'count' groups of the following format:    */
+  /*                                                                       */
+  /*   start       0              ULONG       first charcode               */
+  /*   end         4              ULONG       last charcode                */
+  /*   startId     8              ULONG       start glyph id for the group */
+  /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_8
 
@@ -1039,31 +1079,34 @@
     FT_UInt32  length;
     FT_UInt32  num_groups;
 
+
     if ( table + 16 + 8192 > valid->limit )
       FT_INVALID_TOO_SHORT;
 
-    length = TT_NEXT_ULONG(p);
+    length = TT_NEXT_ULONG( p );
     if ( table + length > valid->limit || length < 8208 )
       FT_INVALID_TOO_SHORT;
 
     is32       = table + 12;
-    p          = is32  + 8192;  /* skip 'is32' array */
-    num_groups = TT_NEXT_ULONG(p);
+    p          = is32  + 8192;          /* skip `is32' array */
+    num_groups = TT_NEXT_ULONG( p );
 
-    if ( p + num_groups*12 > valid->limit )
+    if ( p + num_groups * 12 > valid->limit )
       FT_INVALID_TOO_SHORT;
 
     /* check groups, they must be in increasing order */
     {
       FT_UInt32  n, start, end, start_id, count, last = 0;
 
+
       for ( n = 0; n < num_groups; n++ )
       {
         FT_UInt   hi, lo;
 
-        start    = TT_NEXT_ULONG(p);
-        end      = TT_NEXT_ULONG(p);
-        start_id = TT_NEXT_ULONG(p);
+
+        start    = TT_NEXT_ULONG( p );
+        end      = TT_NEXT_ULONG( p );
+        start_id = TT_NEXT_ULONG( p );
 
         if ( start > end )
           FT_INVALID_DATA;
@@ -1073,41 +1116,41 @@
 
         if ( valid->level >= FT_VALIDATE_TIGHT )
         {
-          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT(valid) )
+          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) )
             FT_INVALID_GLYPH_ID;
 
-          count = (FT_UInt32)(end - start + 1);
+          count = (FT_UInt32)( end - start + 1 );
 
           if ( start & ~0xFFFFU )
           {
-            /* start_hi != 0, check that is32[i] is 1 for each i in */
-            /* the 'hi' and 'lo' of the range [start..end]          */
+            /* start_hi != 0; check that is32[i] is 1 for each i in */
+            /* the `hi' and `lo' of the range [start..end]          */
             for ( ; count > 0; count--, start++ )
             {
-              hi = (FT_UInt)(start >> 16);
-              lo = (FT_UInt)(start & 0xFFFFU);
+              hi = (FT_UInt)( start >> 16 );
+              lo = (FT_UInt)( start & 0xFFFFU );
 
-              if ( (is32[ hi >> 3 ] & (0x80 >> (hi & 7))) == 0 )
+              if ( (is32[hi >> 3] & ( 0x80 >> ( hi & 7 ) ) ) == 0 )
                 FT_INVALID_DATA;
 
-              if ( (is32[ lo >> 3 ] & (0x80 >> (lo & 7))) == 0 )
+              if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) == 0 )
                 FT_INVALID_DATA;
             }
           }
           else
           {
-            /* start_hi == 0, check that is32[i] is 0 for each i in */
+            /* start_hi == 0; check that is32[i] is 0 for each i in */
             /* the range [start..end]                               */
 
-            /* end_hi cannot be != 0 !! */
+            /* end_hi cannot be != 0! */
             if ( end & ~0xFFFFU )
               FT_INVALID_DATA;
 
             for ( ; count > 0; count--, start++ )
             {
-              lo = (FT_UInt)(start & 0xFFFFU);
+              lo = (FT_UInt)( start & 0xFFFFU );
 
-              if ( (is32[ lo >> 3 ] & (0x80 >> (lo & 7))) != 0 )
+              if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) != 0 )
                 FT_INVALID_DATA;
             }
           }
@@ -1120,20 +1163,21 @@
 
 
   FT_CALLBACK_DEF( FT_UInt )
-  tt_cmap8_char_index( TT_CMap     cmap,
-                       FT_UInt32   char_code )
+  tt_cmap8_char_index( TT_CMap    cmap,
+                       FT_UInt32  char_code )
   {
     FT_Byte*   table      = cmap->data;
     FT_UInt    result     = 0;
     FT_Byte*   p          = table + 8204;
-    FT_UInt32  num_groups = TT_NEXT_ULONG(p);
+    FT_UInt32  num_groups = TT_NEXT_ULONG( p );
     FT_UInt32  start, end, start_id;
 
+
     for ( ; num_groups > 0; num_groups-- )
     {
-      start    = TT_NEXT_ULONG(p);
-      end      = TT_NEXT_ULONG(p);
-      start_id = TT_NEXT_ULONG(p);
+      start    = TT_NEXT_ULONG( p );
+      end      = TT_NEXT_ULONG( p );
+      start_id = TT_NEXT_ULONG( p );
 
       if ( char_code < start )
         break;
@@ -1149,31 +1193,32 @@
 
 
   FT_CALLBACK_DEF( FT_UInt )
-  tt_cmap8_char_next( TT_CMap    cmap,
-                      FT_UInt32 *pchar_code )
+  tt_cmap8_char_next( TT_CMap     cmap,
+                      FT_UInt32  *pchar_code )
   {
     FT_UInt32  result     = 0;
     FT_UInt32  char_code  = *pchar_code + 1;
     FT_UInt    gindex     = 0;
     FT_Byte*   table      = cmap->data;
     FT_Byte*   p          = table + 8204;
-    FT_UInt32  num_groups = TT_NEXT_ULONG(p);
+    FT_UInt32  num_groups = TT_NEXT_ULONG( p );
     FT_UInt32  n, start, end, start_id;
 
+
     p = table + 8208;
 
     for ( n = 0; n < num_groups++; n++ )
     {
-      start    = TT_NEXT_ULONG(p);
-      end      = TT_NEXT_ULONG(p);
-      start_id = TT_NEXT_ULONG(p);
+      start    = TT_NEXT_ULONG( p );
+      end      = TT_NEXT_ULONG( p );
+      start_id = TT_NEXT_ULONG( p );
 
       if ( char_code < start )
         char_code = start;
 
       if ( char_code <= end )
       {
-        gindex = (FT_UInt)(char_code - start + start_id);
+        gindex = (FT_UInt)( char_code - start + start_id );
         if ( gindex != 0 )
         {
           result = char_code;
@@ -1188,46 +1233,48 @@
   }
 
 
-  FT_CALLBACK_TABLE_DEF const TT_CMap_ClassRec  tt_cmap8_class_rec =
+  FT_CALLBACK_TABLE_DEF
+  const TT_CMap_ClassRec  tt_cmap8_class_rec =
   {
     {
-      sizeof( TT_CMapRec ),
+      sizeof ( TT_CMapRec ),
 
-      (FT_CMap_InitFunc)      tt_cmap_init,
-      (FT_CMap_DoneFunc)      NULL,
-      (FT_CMap_CharIndexFunc) tt_cmap8_char_index,
-      (FT_CMap_CharNextFunc)  tt_cmap8_char_next
+      (FT_CMap_InitFunc)     tt_cmap_init,
+      (FT_CMap_DoneFunc)     NULL,
+      (FT_CMap_CharIndexFunc)tt_cmap8_char_index,
+      (FT_CMap_CharNextFunc) tt_cmap8_char_next
     },
     8,
-    (TT_CMap_ValidateFunc)    tt_cmap8_validate
+    (TT_CMap_ValidateFunc)   tt_cmap8_validate
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_8 */
 
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                          FORMAT 10                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*************************************************************************
-  *
-  *  TABLE OVERVIEW:
-  *  ---------------
-  *
-  *    NAME        OFFSET           TYPE               DESCRIPTION
-  *
-  *    format        0              USHORT             must be 10
-  *    reseved       2              USHORT             reserved
-  *    length        4              ULONG              length in bytes
-  *    language      8              ULONG              Mac language code
-  *
-  *    start        12              ULONG              first char in range
-  *    count        16              ULONG              number of chars in range
-  *    glyphIds     20              USHORT[count]      glyph indices covered
-  */
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                          FORMAT 10                            *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* TABLE OVERVIEW                                                        */
+  /* --------------                                                        */
+  /*                                                                       */
+  /*   NAME      OFFSET  TYPE               DESCRIPTION                    */
+  /*                                                                       */
+  /*   format     0      USHORT             must be 10                     */
+  /*   reserved   2      USHORT             reserved                       */
+  /*   length     4      ULONG              length in bytes                */
+  /*   language   8      ULONG              Mac language code              */
+  /*                                                                       */
+  /*   start     12      ULONG              first char in range            */
+  /*   count     16      ULONG              number of chars in range       */
+  /*   glyphIds  20      USHORT[count]      glyph indices covered          */
+  /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_10
 
@@ -1238,15 +1285,16 @@
     FT_Byte*  p = table + 4;
     FT_ULong  length, start, count;
 
+
     if ( table + 20 > valid->limit )
       FT_INVALID_TOO_SHORT;
 
-    length = TT_NEXT_ULONG(p);
+    length = TT_NEXT_ULONG( p );
     p      = table + 12;
-    start  = TT_NEXT_ULONG(p);
-    count  = TT_NEXT_ULONG(p);
+    start  = TT_NEXT_ULONG( p );
+    count  = TT_NEXT_ULONG( p );
 
-    if ( table + length > valid->limit || length < 20 + count*2 )
+    if ( table + length > valid->limit || length < 20 + count * 2 )
       FT_INVALID_TOO_SHORT;
 
     /* check glyph indices */
@@ -1254,10 +1302,11 @@
     {
       FT_UInt  gindex;
 
+
       for ( ; count > 0; count-- )
       {
-        gindex = TT_NEXT_USHORT(p);
-        if ( gindex >= TT_VALID_GLYPH_COUNT(valid) )
+        gindex = TT_NEXT_USHORT( p );
+        if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) )
           FT_INVALID_GLYPH_ID;
       }
     }
@@ -1271,14 +1320,15 @@
     FT_Byte*   table  = cmap->data;
     FT_UInt    result = 0;
     FT_Byte*   p      = table + 12;
-    FT_UInt32  start  = TT_NEXT_ULONG(p);
-    FT_UInt32  count  = TT_NEXT_ULONG(p);
-    FT_UInt32  index  = (FT_ULong)( char_code - start );
+    FT_UInt32  start  = TT_NEXT_ULONG( p );
+    FT_UInt32  count  = TT_NEXT_ULONG( p );
+    FT_UInt32  idx    = (FT_ULong)( char_code - start );
+
 
-    if ( index < count )
+    if ( idx < count )
     {
-      p     += 2*index;
-      result = TT_PEEK_USHORT(p);
+      p     += 2 * idx;
+      result = TT_PEEK_USHORT( p );
     }
     return result;
   }
@@ -1293,19 +1343,20 @@
     FT_UInt32  char_code = *pchar_code + 1;
     FT_UInt    gindex    = 0;
     FT_Byte*   p         = table + 12;
-    FT_UInt32  start     = TT_NEXT_ULONG(p);
-    FT_UInt32  count     = TT_NEXT_ULONG(p);
-    FT_UInt32  index;
+    FT_UInt32  start     = TT_NEXT_ULONG( p );
+    FT_UInt32  count     = TT_NEXT_ULONG( p );
+    FT_UInt32  idx;
+
 
     if ( char_code < start )
       char_code = start;
 
-    index = (FT_UInt32)( char_code - start );
-    p    += 2*index;
+    idx = (FT_UInt32)( char_code - start );
+    p  += 2 * idx;
 
-    for ( ; index < count; index++ )
+    for ( ; idx < count; idx++ )
     {
-      gindex = TT_NEXT_USHORT(p);
+      gindex = TT_NEXT_USHORT( p );
       if ( gindex != 0 )
       {
         result = char_code;
@@ -1319,52 +1370,52 @@
   }
 
 
-  FT_CALLBACK_TABLE_DEF const TT_CMap_ClassRec  tt_cmap10_class_rec =
+  FT_CALLBACK_TABLE_DEF
+  const TT_CMap_ClassRec  tt_cmap10_class_rec =
   {
     {
-      sizeof( TT_CMapRec ),
+      sizeof ( TT_CMapRec ),
 
-      (FT_CMap_InitFunc)      tt_cmap_init,
-      (FT_CMap_DoneFunc)      NULL,
-      (FT_CMap_CharIndexFunc) tt_cmap10_char_index,
-      (FT_CMap_CharNextFunc)  tt_cmap10_char_next
+      (FT_CMap_InitFunc)     tt_cmap_init,
+      (FT_CMap_DoneFunc)     NULL,
+      (FT_CMap_CharIndexFunc)tt_cmap10_char_index,
+      (FT_CMap_CharNextFunc) tt_cmap10_char_next
     },
     10,
-    (TT_CMap_ValidateFunc)    tt_cmap10_validate
+    (TT_CMap_ValidateFunc)   tt_cmap10_validate
   };
 
 #endif /* TT_CONFIG_CMAP_FORMAT_10 */
 
 
- /************************************************************************/
- /************************************************************************/
- /*****                                                              *****/
- /*****                          FORMAT 12                           *****/
- /*****                                                              *****/
- /************************************************************************/
- /************************************************************************/
-
- /*************************************************************************
-  *
-  *  TABLE OVERVIEW:
-  *  ---------------
-  *
-  *    NAME        OFFSET           TYPE               DESCRIPTION
-  *
-  *    format        0              USHORT             must be 12
-  *    reseved       2              USHORT             reserved
-  *    length        4              ULONG              length in bytes
-  *    language      8              ULONG              Mac language code
-  *    count         12             ULONG              number of groups
-  *                  16
-  *
-  *  this header is followed by 'count' groups of the following format:
-  *
-  *    start         0              ULONG              first charcode
-  *    end           4              ULONG              last charcode
-  *    startId       8              ULONG              start glyph id for
-  *                                                    the group
-  */
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****                          FORMAT 12                            *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* TABLE OVERVIEW                                                        */
+  /* --------------                                                        */
+  /*                                                                       */
+  /*   NAME        OFFSET     TYPE       DESCRIPTION                       */
+  /*                                                                       */
+  /*   format      0          USHORT     must be 12                        */
+  /*   reserved    2          USHORT     reserved                          */
+  /*   length      4          ULONG      length in bytes                   */
+  /*   language    8          ULONG      Mac language code                 */
+  /*   count       12         ULONG      number of groups                  */
+  /*               16                                                      */
+  /*                                                                       */
+  /* This header is followed by `count' groups of the following format:    */
+  /*                                                                       */
+  /*   start       0          ULONG      first charcode                    */
+  /*   end         4          ULONG      last charcode                     */
+  /*   startId     8          ULONG      start glyph id for the group      */
+  /*                                                                       */
 
 #ifdef TT_CONFIG_CMAP_FORMAT_12
 
@@ -1376,27 +1427,29 @@
     FT_ULong   length;
     FT_ULong   num_groups;
 
+
     if ( table + 16 > valid->limit )
       FT_INVALID_TOO_SHORT;
 
     p      = table + 4;
-    length = TT_NEXT_ULONG(p);
+    length = TT_NEXT_ULONG( p );
 
     p          = table + 12;
-    num_groups =  TT_NEXT_ULONG(p);
+    num_groups = TT_NEXT_ULONG( p );
 
-    if ( table + length > valid->limit || length < 16 + 12*num_groups )
+    if ( table + length > valid->limit || length < 16 + 12 * num_groups )
       FT_INVALID_TOO_SHORT;
 
     /* check groups, they must be in increasing order */
     {
       FT_ULong  n, start, end, start_id, last = 0;
 
+
       for ( n = 0; n < num_groups; n++ )
       {
-        start    = TT_NEXT_ULONG(p);
-        end      = TT_NEXT_ULONG(p);
-        start_id = TT_NEXT_ULONG(p);
+        start    = TT_NEXT_ULONG( p );
+        end      = TT_NEXT_ULONG( p );
+        start_id = TT_NEXT_ULONG( p );
 
         if ( start > end )
           FT_INVALID_DATA;
@@ -1406,7 +1459,7 @@
 
         if ( valid->level >= FT_VALIDATE_TIGHT )
         {
-          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT(valid) )
+          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) )
             FT_INVALID_GLYPH_ID;
         }
 
@@ -1416,7 +1469,6 @@
   }
 
 
-
   FT_CALLBACK_DEF( FT_UInt )
   tt_cmap12_char_index( TT_CMap    cmap,
                         FT_UInt32  char_code )
@@ -1424,14 +1476,15 @@
     FT_UInt    result     = 0;
     FT_Byte*   table      = cmap->data;
     FT_Byte*   p          = table + 12;
-    FT_UInt32  num_groups = TT_NEXT_ULONG(p);
+    FT_UInt32  num_groups = TT_NEXT_ULONG( p );
     FT_UInt32  start, end, start_id;
 
+
     for ( ; num_groups > 0; num_groups-- )
     {
-      start    = TT_NEXT_ULONG(p);
-      end      = TT_NEXT_ULONG(p);
-      start_id = TT_NEXT_ULONG(p);
+      start    = TT_NEXT_ULONG( p );
+      end      = TT_NEXT_ULONG( p );
+      start_id = TT_NEXT_ULONG( p );
 
       if ( char_code < start )
         break;
@@ -1447,24 +1500,25 @@
 
 
   FT_CALLBACK_DEF( FT_UInt )
-  tt_cmap12_char_next( TT_CMap    cmap,
-                       FT_UInt32 *pchar_code )
+  tt_cmap12_char_next( TT_CMap     cmap,
+                       FT_UInt32  *pchar_code )
   {
     FT_Byte*   table      = cmap->data;
     FT_UInt32  result     = 0;
     FT_UInt32  char_code  = *pchar_code + 1;
     FT_UInt    gindex     = 0;
     FT_Byte*   p          = table + 12;
-    FT_UInt32  num_groups = TT_NEXT_ULONG(p);
+    FT_UInt32  num_groups = TT_NEXT_ULONG( p );
     FT_UInt32  n, start, end, start_id;
 
-    p = table + 8208;
+
+    p = table + 16;
 
     for ( n = 0; n < num_groups++; n++ )
     {
-      start    = TT_NEXT_ULONG(p);
-      end      = TT_NEXT_ULONG(p);
-      start_id = TT_NEXT_ULONG(p);
+      start    = TT_NEXT_ULONG( p );
+      end      = TT_NEXT_ULONG( p );
+      start_id = TT_NEXT_ULONG( p );
 
       if ( char_code < start )
         char_code = start;
@@ -1486,26 +1540,25 @@
   }
 
 
-  FT_CALLBACK_TABLE_DEF const TT_CMap_ClassRec  tt_cmap12_class_rec =
+  FT_CALLBACK_TABLE_DEF
+  const TT_CMap_ClassRec  tt_cmap12_class_rec =
   {
     {
-      sizeof( TT_CMapRec ),
+      sizeof ( TT_CMapRec ),
 
-      (FT_CMap_InitFunc)      tt_cmap_init,
-      (FT_CMap_DoneFunc)      NULL,
-      (FT_CMap_CharIndexFunc) tt_cmap12_char_index,
-      (FT_CMap_CharNextFunc)  tt_cmap12_char_next
+      (FT_CMap_InitFunc)     tt_cmap_init,
+      (FT_CMap_DoneFunc)     NULL,
+      (FT_CMap_CharIndexFunc)tt_cmap12_char_index,
+      (FT_CMap_CharNextFunc) tt_cmap12_char_next
     },
     12,
-    (TT_CMap_ValidateFunc)    tt_cmap12_validate
+    (TT_CMap_ValidateFunc)   tt_cmap12_validate
   };
 
 
 #endif /* TT_CONFIG_CMAP_FORMAT_12 */
 
 
-
-
 #ifdef FT_CONFIG_OPTION_USE_CMAPS
 
   static const TT_CMap_Class  tt_cmap_classes[] =
@@ -1542,9 +1595,9 @@
   };
 
 
- /* parse the 'cmap' table and build the corresponding TT_CMap objects */
- /* in the current face..                                              */
- /*                                                                    */
+  /* parse the `cmap' table and build the corresponding TT_CMap objects */
+  /* in the current face                                                */
+  /*                                                                    */
   FT_LOCAL_DEF( FT_Error )
   TT_Build_CMaps( TT_Face   face )
   {
@@ -1553,38 +1606,41 @@
     volatile FT_UInt   num_cmaps;
     volatile FT_Byte*  p     = table;
 
+
     if ( p + 4 > limit )
       return FT_Err_Invalid_Table;
 
     /* only recognize format 0 */
-    if ( TT_NEXT_USHORT(p) != 0 )
+    if ( TT_NEXT_USHORT( p ) != 0 )
     {
       p -= 2;
-      FT_ERROR(( "%s: unsupported 'cmap' table format = %d\n",
-                 "TT_Build_CMaps", TT_PEEK_USHORT(p) ));
+      FT_ERROR(( "TT_Build_CMaps: unsupported `cmap' table format = %d\n",
+                 TT_PEEK_USHORT( p ) ));
       return FT_Err_Invalid_Table;
     }
 
-    num_cmaps = TT_NEXT_USHORT(p);
+    num_cmaps = TT_NEXT_USHORT( p );
 
     for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )
     {
       FT_CharMapRec  charmap;
       FT_UInt32      offset;
 
-      charmap.platform_id = TT_NEXT_USHORT(p);
-      charmap.encoding_id = TT_NEXT_USHORT(p);
-      charmap.face        = FT_FACE(face);
+
+      charmap.platform_id = TT_NEXT_USHORT( p );
+      charmap.encoding_id = TT_NEXT_USHORT( p );
+      charmap.face        = FT_FACE( face );
       charmap.encoding    = ft_encoding_none;  /* will be filled later */
-      offset              = TT_NEXT_ULONG(p);
+      offset              = TT_NEXT_ULONG( p );
 
       if ( offset && table + offset + 2 < limit )
       {
         FT_Byte*                       cmap   = table + offset;
-        FT_UInt                        format = TT_PEEK_USHORT(cmap);
+        FT_UInt                        format = TT_PEEK_USHORT( cmap );
         volatile const TT_CMap_Class*  pclazz = tt_cmap_classes;
         TT_CMap_Class                  clazz;
 
+
         for ( ; *pclazz; pclazz++ )
         {
           clazz = *pclazz;
@@ -1592,22 +1648,25 @@
           {
             volatile TT_ValidatorRec  valid;
             
-            ft_validator_init( FT_VALIDATOR(&valid), cmap, limit,
+
+            ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,
                                FT_VALIDATE_DEFAULT );
                                
             valid.num_glyphs = face->root.num_glyphs;
 
-            if ( setjmp( FT_VALIDATOR(&valid)->jump_buffer ) == 0 )
+            if ( setjmp( FT_VALIDATOR( &valid )->jump_buffer ) == 0 )
             {
               /* validate this cmap sub-table */
-              clazz->validate( cmap, FT_VALIDATOR(&valid) );
+              clazz->validate( cmap, FT_VALIDATOR( &valid ) );
             }
 
             if ( valid.validator.error == 0 )
               (void)FT_CMap_New( (FT_CMap_Class)clazz, cmap, &charmap, NULL );
             else
-              FT_ERROR(( "%s: broken cmap sub-table ignored !!\n",
-                         "TT_Build_CMaps" ));
+            {
+              FT_ERROR(( "TT_Build_CMaps:" ));
+              FT_ERROR(( " broken cmap sub-table ignored!\n" ));
+            }
           }
         }
       }
@@ -1621,7 +1680,7 @@
   FT_LOCAL_DEF( FT_Error )
   TT_Build_CMaps( TT_Face  face )
   {
-    FT_ERROR(( "TT_Build_CMaps should _not_ be called !!\n" ));
+    FT_ERROR(( "No support for TT_Build_CMaps compiled\n" ));
     return 0;
   }
 
diff --git a/src/sfnt/ttcmap0.h b/src/sfnt/ttcmap0.h
index 7713885..7ce90c9 100644
--- a/src/sfnt/ttcmap0.h
+++ b/src/sfnt/ttcmap0.h
@@ -1,10 +1,10 @@
 /***************************************************************************/
 /*                                                                         */
-/*  ttcmap.h                                                               */
+/*  ttcmap0.h                                                              */
 /*                                                                         */
-/*    TrueType character mapping table (cmap) support (specification).     */
+/*    TrueType new character mapping table (cmap) support (specification). */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 2002 by                                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -27,19 +27,21 @@
 
 FT_BEGIN_HEADER
 
-  typedef struct TT_CMapRec_
+  typedef struct  TT_CMapRec_
   {
     FT_CMapRec  cmap;
-    FT_Byte*    data;  /* pointer to in-memory cmap table */
+    FT_Byte*    data;           /* pointer to in-memory cmap table */
 
   } TT_CMapRec, *TT_CMap;
 
-  typedef const struct TT_CMap_ClassRec_*   TT_CMap_Class;
+  typedef const struct TT_CMap_ClassRec_*  TT_CMap_Class;
 
-  typedef FT_Error  (*TT_CMap_ValidateFunc)( FT_Byte*      data,
-                                             FT_Validator  valid );
 
-  typedef struct TT_CMap_ClassRec_
+  typedef FT_Error
+  (*TT_CMap_ValidateFunc)( FT_Byte*      data,
+                           FT_Validator  valid );
+
+  typedef struct  TT_CMap_ClassRec_
   {
     FT_CMap_ClassRec      clazz;
     FT_UInt               format;
@@ -47,19 +49,21 @@ FT_BEGIN_HEADER
 
   } TT_CMap_ClassRec;
 
-  typedef struct TT_ValidatorRec_
+
+  typedef struct  TT_ValidatorRec_
   {
     FT_ValidatorRec  validator;
     FT_UInt          num_glyphs;
     
   } TT_ValidatorRec, *TT_Validator;
 
-#define  TT_VALIDATOR(x)          ((TT_Validator)(x))
-#define  TT_VALID_GLYPH_COUNT(v)  TT_VALIDATOR(v)->num_glyphs
+
+#define TT_VALIDATOR( x )          ((TT_Validator)( x ))
+#define TT_VALID_GLYPH_COUNT( x )  TT_VALIDATOR( x )->num_glyphs
 
 
   FT_LOCAL( FT_Error )
-  TT_Build_CMaps( TT_Face   face );
+  TT_Build_CMaps( TT_Face  face );
 
 
 FT_END_HEADER
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index c8ac9c0..dfa2948 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 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -28,6 +28,7 @@
 
 #include <stdlib.h>  /* for qsort */
 
+
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -48,6 +49,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face :: A face object handle.                                      */
+  /*                                                                       */
   /*    tag  :: The searched tag.                                          */
   /*                                                                       */
   /* <Return>                                                              */
@@ -57,8 +59,8 @@
   TT_LookUp_Table( TT_Face   face,
                    FT_ULong  tag  )
   {
-    TT_Table   entry;
-    TT_Table   limit;
+    TT_Table  entry;
+    TT_Table  limit;
 
 
     FT_TRACE3(( "TT_LookUp_Table: %08p, `%c%c%c%c' -- ",
@@ -95,7 +97,9 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A face object handle.                                    */
+  /*                                                                       */
   /*    tag    :: The searched tag.                                        */
+  /*                                                                       */
   /*    stream :: The stream to seek when the table is found.              */
   /*                                                                       */
   /* <Output>                                                              */
@@ -110,8 +114,8 @@
                  FT_Stream  stream,
                  FT_ULong*  length )
   {
-    TT_Table   table;
-    FT_Error   error;
+    TT_Table  table;
+    FT_Error  error;
 
 
     table = TT_LookUp_Table( face, tag );
@@ -134,14 +138,16 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    TT_Load_SFNT_HeaderRec                                                */
+  /*    TT_Load_SFNT_HeaderRec                                             */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Loads the header of a SFNT font file.  Supports collections.       */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face       :: A handle to the target face object.                  */
+  /*                                                                       */
   /*    stream     :: The input stream.                                    */
+  /*                                                                       */
   /*    face_index :: If the font is a collection, the number of the font  */
   /*                  in the collection, ignored otherwise.                */
   /*                                                                       */
@@ -161,9 +167,9 @@
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
   TT_Load_SFNT_HeaderRec( TT_Face       face,
-                       FT_Stream     stream,
-                       FT_Long       face_index,
-                       SFNT_Header   sfnt )
+                          FT_Stream     stream,
+                          FT_Long       face_index,
+                          SFNT_Header   sfnt )
   {
     FT_Error   error;
     FT_ULong   format_tag;
@@ -190,21 +196,23 @@
       FT_FRAME_START( 8 ),
         FT_FRAME_LONG( version ),
         FT_FRAME_LONG( count   ),
-      FT_FRAME_END };
+      FT_FRAME_END
+    };
 
 
     FT_TRACE2(( "TT_Load_SFNT_HeaderRec: %08p, %ld\n",
                 face, face_index ));
 
-    face->ttc_header.tag      = 0;
-    face->ttc_header.version  = 0;
-    face->ttc_header.count    = 0;
+    face->ttc_header.tag     = 0;
+    face->ttc_header.version = 0;
+    face->ttc_header.count   = 0;
 
     face->num_tables = 0;
 
     /* first of all, read the first 4 bytes.  If it is `ttcf', then the */
     /* file is a TrueType collection, otherwise it can be any other     */
     /* kind of font.                                                    */
+    /*                                                                  */
     if ( FT_READ_ULONG( format_tag ) )
       goto Exit;
 
@@ -215,8 +223,8 @@
 
       FT_TRACE3(( "TT_Load_SFNT_HeaderRec: file is a collection\n" ));
 
-      /* it's a TrueType collection, i.e. a file containing several */
-      /* font files.  Read the font directory now                   */
+      /* It is a TrueType collection, i.e. a file containing several */
+      /* font files.  Read the font directory now                    */
       if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) )
         goto Exit;
 
@@ -239,7 +247,7 @@
 
       /* seek to the appropriate TrueType file, then read tag */
       if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) ||
-           FT_READ_LONG( format_tag )                           )
+           FT_READ_LONG( format_tag )                             )
         goto Exit;
     }
 
@@ -284,6 +292,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    stream :: The input stream.                                        */
+  /*                                                                       */
   /*    sfnt   :: The SFNT directory header.                               */
   /*                                                                       */
   /* <Return>                                                              */
@@ -293,14 +302,14 @@
   /*    The stream cursor must be at the font file's origin.               */
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
-  TT_Load_Directory( TT_Face       face,
-                     FT_Stream     stream,
-                     SFNT_Header   sfnt )
+  TT_Load_Directory( TT_Face      face,
+                     FT_Stream    stream,
+                     SFNT_Header  sfnt )
   {
-    FT_Error   error;
-    FT_Memory  memory = stream->memory;
+    FT_Error     error;
+    FT_Memory    memory = stream->memory;
 
-    TT_TableRec *entry, *limit;
+    TT_TableRec  *entry, *limit;
 
 
     FT_TRACE2(( "TT_Load_Directory: %08p\n", face ));
@@ -444,6 +453,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: The input stream.                                        */
   /*                                                                       */
   /* <Return>                                                              */
@@ -545,6 +555,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: The input stream.                                        */
   /*                                                                       */
   /* <Return>                                                              */
@@ -666,7 +677,9 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face     :: A handle to the target face object.                    */
+  /*                                                                       */
   /*    stream   :: The input stream.                                      */
+  /*                                                                       */
   /*    vertical :: A boolean flag.  If set, load vertical metrics.        */
   /*                                                                       */
   /* <Return>                                                              */
@@ -694,6 +707,7 @@
     if ( vertical )
     {
       /* 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' */
       /*      table to get the metrics from (e.g. mingliu).            */
@@ -753,8 +767,8 @@
       goto Exit;
 
     {
-      TT_LongMetrics   cur   = *longs;
-      TT_LongMetrics   limit = cur + num_longs;
+      TT_LongMetrics  cur   = *longs;
+      TT_LongMetrics  limit = cur + num_longs;
 
 
       for ( ; cur < limit; cur++ )
@@ -806,7 +820,9 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face     :: A handle to the target face object.                    */
+  /*                                                                       */
   /*    stream   :: The input stream.                                      */
+  /*                                                                       */
   /*    vertical :: A boolean flag.  If set, load vertical metrics.        */
   /*                                                                       */
   /* <Return>                                                              */
@@ -906,6 +922,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: The input stream.                                        */
   /*                                                                       */
   /* <Return>                                                              */
@@ -915,14 +932,14 @@
   TT_Load_Names( TT_Face    face,
                  FT_Stream  stream )
   {
-    FT_Error   error;
-    FT_Memory  memory = stream->memory;
+    FT_Error      error;
+    FT_Memory     memory = stream->memory;
 
-    FT_ULong   table_pos, table_len;
-    FT_ULong   storageOffset, storageSize;
-    FT_Byte*   storage;
+    FT_ULong      table_pos, table_len;
+    FT_ULong      storageOffset, storageSize;
+    FT_Byte*      storage;
 
-    TT_NameTable   names;
+    TT_NameTable  names;
 
     const FT_Frame_Field  name_table_fields[] =
     {
@@ -972,10 +989,10 @@
 
     /* check the 'storageOffset' field */
     storageOffset = names->storageOffset;
-    if ( storageOffset <  (FT_ULong)(6 + 12*names->numNameRecords) ||
-         table_len     <= storageOffset                            )
+    if ( storageOffset <  (FT_ULong)( 6 + 12 * names->numNameRecords ) ||
+         table_len     <= storageOffset                                )
     {
-      FT_ERROR(( "TT.load_names: invalid 'name' table\n" ));
+      FT_ERROR(( "TT_Load_Names: invalid `name' table\n" ));
       error = SFNT_Err_Name_Table_Missing;
       goto Exit;
     }
@@ -984,11 +1001,12 @@
 
     /* Allocate the array of name records. */
     if ( FT_ALLOC( names->names,
-                names->numNameRecords*sizeof(TT_NameEntryRec) + storageSize )  ||
-         FT_FRAME_ENTER( names->numNameRecords * 12L ) )
+                   names->numNameRecords * sizeof ( TT_NameEntryRec ) +
+                     storageSize )                                      ||
+         FT_FRAME_ENTER( names->numNameRecords * 12L )                  )
       goto Exit;
 
-    storage = (FT_Byte*)(names->names + names->numNameRecords);
+    storage = (FT_Byte*)( names->names + names->numNameRecords );
 
     /* Load the name records and determine how much storage is needed */
     /* to hold the strings themselves.                                */
@@ -1002,8 +1020,8 @@
         if ( FT_STREAM_READ_FIELDS( name_record_fields, cur ) )
           break;
 
-        /* invalid name entries will have "cur->string" set to NULL !! */
-        if ( (FT_ULong)(cur->stringOffset + cur->stringLength) < storageSize )
+        /* invalid name entries will have "cur->string" set to NULL! */
+        if ( (FT_ULong)( cur->stringOffset + cur->stringLength ) < storageSize )
           cur->string = storage + cur->stringOffset;
         else
         {
@@ -1016,18 +1034,17 @@
 
     FT_FRAME_EXIT();
 
-    if (error)
+    if ( error )
       goto Exit;
 
-    storageOffset -= 6 + 12*names->numNameRecords;
+    storageOffset -= 6 + 12 * names->numNameRecords;
     if ( FT_STREAM_SKIP( storageOffset )        ||
          FT_STREAM_READ( storage, storageSize ) )
       goto Exit;
 
-
 #ifdef FT_DEBUG_LEVEL_TRACE
 
-      /* Print Name Record Table in case of debugging */
+      /* print Name Record Table in case of debugging */
       {
         TT_NameEntryRec*  cur   = names->names;
         TT_NameEntryRec*  limit = cur + names->numNameRecords;
@@ -1039,24 +1056,24 @@
 
 
           FT_TRACE3(( "(%2d %2d %4x %2d)  ",
-                       cur->platformID,
-                       cur->encodingID,
-                       cur->languageID,
-                       cur->nameID ));
+                      cur->platformID,
+                      cur->encodingID,
+                      cur->languageID,
+                      cur->nameID ));
 
           /* I know that M$ encoded strings are Unicode,            */
           /* but this works reasonable well for debugging purposes. */
           if ( cur->string )
             for ( j = 0; j < (FT_UInt)cur->stringLength; j++ )
             {
-              FT_Byte  c = *(FT_Byte*)(cur->string + j);
+              FT_Byte  c = *(FT_Byte*)( cur->string + j );
 
 
               if ( c >= 32 && c < 128 )
                 FT_TRACE3(( "%c", c ));
             }
           else
-            FT_TRACE3(( "INVALID ENTRY !!\n" ));
+            FT_TRACE3(( "Invalid entry!\n" ));
 
           FT_TRACE3(( "\n" ));
         }
@@ -1088,8 +1105,8 @@
   FT_LOCAL_DEF( void )
   TT_Free_Names( TT_Face  face )
   {
-    FT_Memory      memory = face->root.driver->root.memory;
-    TT_NameTable   names  = &face->name_table;
+    FT_Memory     memory = face->root.driver->root.memory;
+    TT_NameTable  names  = &face->name_table;
 
 
     /* free strings table */
@@ -1115,6 +1132,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: A handle to the input stream.                            */
   /*                                                                       */
   /* <Return>                                                              */
@@ -1127,21 +1145,22 @@
   TT_Load_CMap( TT_Face    face,
                 FT_Stream  stream )
   {
-    FT_Error       error;
+    FT_Error  error;
+
 
     error = face->goto_table( face, TTAG_cmap, stream, &face->cmap_size );
     if ( error )
     {
-      FT_TRACE2(( "No 'cmap' table in font !\n" ));
+      FT_TRACE2(( "No `cmap' table in font !\n" ));
       error = SFNT_Err_CMap_Table_Missing;
       goto Exit;
     }
     
     if ( !FT_FRAME_EXTRACT( face->cmap_size, face->cmap_table ) )
-      FT_TRACE2(( "'cmap' table loaded\n" ));
+      FT_TRACE2(( "`cmap' table loaded\n" ));
     else
     {
-      FT_ERROR(( "'cmap' table is too short !!\n" ));
+      FT_ERROR(( "`cmap' table is too short!\n" ));
       face->cmap_size = 0;
     }
     
@@ -1213,7 +1232,7 @@
 
       for ( ; charmap < limit; charmap++ )
       {
-        TT_CMapTable   cmap;
+        TT_CMapTable  cmap;
 
 
         charmap->root.face = (FT_Face)face;
@@ -1234,7 +1253,7 @@
 
 
         if ( FT_STREAM_SEEK( table_start + (FT_Long)cmap->offset ) ||
-             FT_STREAM_READ_FIELDS( cmap_rec_fields, cmap )             )
+             FT_STREAM_READ_FIELDS( cmap_rec_fields, cmap )        )
           goto Exit;
 
         cmap->offset = FT_STREAM_POS();
@@ -1249,6 +1268,7 @@
 
 #endif /* !FT_CONFIG_OPTION_USE_CMAPS */
 
+
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -1259,6 +1279,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: A handle to the input stream.                            */
   /*                                                                       */
   /* <Return>                                                              */
@@ -1352,7 +1373,7 @@
     if ( error )
     {
       FT_TRACE2(( "is missing!\n" ));
-      face->os2.version = 0xFFFF;
+      face->os2.version = 0xFFFFU;
       error = SFNT_Err_Ok;
       goto Exit;
     }
@@ -1401,6 +1422,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: A handle to the input stream.                            */
   /*                                                                       */
   /* <Return>                                                              */
@@ -1459,6 +1481,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: A handle to the input stream.                            */
   /*                                                                       */
   /* <Return>                                                              */
@@ -1526,6 +1549,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: The input stream.                                        */
   /*                                                                       */
   /* <Return>                                                              */
@@ -1603,6 +1627,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: The input stream.                                        */
   /*                                                                       */
   /* <Return>                                                              */
@@ -1648,7 +1673,7 @@
 
       if ( coverage == 0x0001 )
       {
-        FT_UInt          num_pairs;
+        FT_UInt        num_pairs;
         TT_Kern0_Pair  pair;
         TT_Kern0_Pair  limit;
 
@@ -1685,7 +1710,7 @@
         /* ensure that the kerning pair table is sorted (yes, some */
         /* fonts have unsorted tables!)                            */
         {
-          FT_UInt          i;
+          FT_UInt        i;
           TT_Kern0_Pair  pair0;
 
 
@@ -1722,6 +1747,7 @@
 #undef  TT_KERN_INDEX
 #define TT_KERN_INDEX( g1, g2 )  ( ( (FT_ULong)g1 << 16 ) | g2 )
 
+
   FT_CALLBACK_DEF( int )
   tt_kern_pair_compare( const void*  a,
                         const void*  b )
@@ -1737,6 +1763,7 @@
            ( index1 > index2 ?  1 : 0 ));
   }
 
+
 #undef TT_KERN_INDEX
 
 
@@ -1750,6 +1777,7 @@
   /*                                                                       */
   /* <Input>                                                               */
   /*    face   :: A handle to the target face object.                      */
+  /*                                                                       */
   /*    stream :: A handle to the input stream.                            */
   /*                                                                       */
   /* <Return>                                                              */
@@ -1759,12 +1787,12 @@
   TT_Load_Hdmx( TT_Face    face,
                 FT_Stream  stream )
   {
-    FT_Error  error;
-    FT_Memory memory = stream->memory;
+    FT_Error   error;
+    FT_Memory  memory = stream->memory;
 
-    TT_Hdmx   hdmx = &face->hdmx;
-    FT_Long   num_glyphs;
-    FT_Long   record_size;
+    TT_Hdmx    hdmx = &face->hdmx;
+    FT_Long    num_glyphs;
+    FT_Long    record_size;
 
 
     hdmx->version     = 0;
@@ -1807,7 +1835,7 @@
              FT_READ_BYTE( cur->max_width ) )
           goto Exit;
 
-        if ( FT_ALLOC( cur->widths, num_glyphs )     ||
+        if ( FT_ALLOC( 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 a4b0f6c..67ec052 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 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -42,9 +42,9 @@ FT_BEGIN_HEADER
 
   FT_LOCAL( FT_Error )
   TT_Load_SFNT_HeaderRec( TT_Face       face,
-                       FT_Stream     stream,
-                       FT_Long       face_index,
-                       SFNT_Header   sfnt );
+                          FT_Stream     stream,
+                          FT_Long       face_index,
+                          SFNT_Header   sfnt );
 
   FT_LOCAL( FT_Error )
   TT_Load_Directory( TT_Face       face,
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index 0743364..f6e2434 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -5,7 +5,7 @@
 /*    Postcript name table processing for TrueType and OpenType fonts      */
 /*    (body).                                                              */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -33,6 +33,7 @@
 
 #include "sferrors.h"
 
+
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -155,14 +156,14 @@
   Load_Format_20( TT_Face    face,
                   FT_Stream  stream )
   {
-    FT_Memory  memory = stream->memory;
-    FT_Error   error;
+    FT_Memory   memory = stream->memory;
+    FT_Error    error;
 
-    FT_Int     num_glyphs;
-    FT_UShort  num_names;
+    FT_Int      num_glyphs;
+    FT_UShort   num_names;
 
-    FT_UShort* glyph_indices = 0;
-    FT_Char**  name_strings  = 0;
+    FT_UShort*  glyph_indices = 0;
+    FT_Char**   name_strings  = 0;
 
 
     if ( FT_READ_USHORT( num_glyphs ) )
@@ -241,7 +242,7 @@
 
     /* all right, set table fields and exit successfuly */
     {
-      TT_Post_20   table = &face->postscript_names.names.format_20;
+      TT_Post_20  table = &face->postscript_names.names.format_20;
 
 
       table->num_glyphs    = (FT_UShort)num_glyphs;
@@ -251,7 +252,6 @@
     }
     return SFNT_Err_Ok;
 
-
   Fail1:
     {
       FT_UShort  n;
@@ -292,7 +292,7 @@
       goto Exit;
     }
 
-    if ( FT_ALLOC    ( offset_table, num_glyphs ) ||
+    if ( FT_ALLOC( offset_table, num_glyphs )       ||
          FT_STREAM_READ( offset_table, num_glyphs ) )
       goto Fail;
 
@@ -316,7 +316,7 @@
 
     /* OK, set table fields and exit successfuly */
     {
-      TT_Post_25   table = &face->postscript_names.names.format_25;
+      TT_Post_25  table = &face->postscript_names.names.format_25;
 
 
       table->num_glyphs = (FT_UShort)num_glyphs;
@@ -380,8 +380,8 @@
   FT_LOCAL_DEF( void )
   TT_Free_Post_Names( TT_Face  face )
   {
-    FT_Memory       memory = face->root.memory;
-    TT_Post_Names   names  = &face->postscript_names;
+    FT_Memory      memory = face->root.memory;
+    TT_Post_Names  names  = &face->postscript_names;
 
 
     if ( names->loaded )
@@ -390,8 +390,8 @@
       {
       case 0x00020000L:
         {
-          TT_Post_20   table = &names->names.format_20;
-          FT_UShort    n;
+          TT_Post_20  table = &names->names.format_20;
+          FT_UShort   n;
 
 
           FT_FREE( table->glyph_indices );
@@ -407,7 +407,7 @@
 
       case 0x00028000L:
         {
-          TT_Post_25   table = &names->names.format_25;
+          TT_Post_25  table = &names->names.format_25;
 
 
           FT_FREE( table->offsets );
@@ -446,8 +446,8 @@
                   FT_UInt      idx,
                   FT_String**  PSname )
   {
-    FT_Error            error;
-    TT_Post_Names       names;
+    FT_Error         error;
+    TT_Post_Names    names;
 
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
     PSNames_Service  psnames;
@@ -480,7 +480,7 @@
 
     case 0x00020000L:
       {
-        TT_Post_20   table = &names->names.format_20;
+        TT_Post_20  table = &names->names.format_20;
 
 
         if ( !names->loaded )
@@ -505,7 +505,7 @@
 
     case 0x00028000L:
       {
-        TT_Post_25   table = &names->names.format_25;
+        TT_Post_25  table = &names->names.format_25;
 
 
         if ( !names->loaded )
diff --git a/src/sfnt/ttpost.h b/src/sfnt/ttpost.h
index 3c42e36..fd7f2af 100644
--- a/src/sfnt/ttpost.h
+++ b/src/sfnt/ttpost.h
@@ -5,7 +5,7 @@
 /*    Postcript name table processing for TrueType and OpenType fonts      */
 /*    (specification).                                                     */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index cd8b130..d72c83d 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 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -222,8 +222,8 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   static FT_Error
-  Load_SBit_Const_Metrics( TT_SBit_Range   range,
-                           FT_Stream       stream )
+  Load_SBit_Const_Metrics( TT_SBit_Range  range,
+                           FT_Stream      stream )
   {
     FT_Error  error;
 
@@ -254,9 +254,9 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   static FT_Error
-  Load_SBit_Range_Codes( TT_SBit_Range   range,
-                         FT_Stream       stream,
-                         FT_Bool         load_offsets )
+  Load_SBit_Range_Codes( TT_SBit_Range  range,
+                         FT_Stream      stream,
+                         FT_Bool        load_offsets )
   {
     FT_Error   error;
     FT_ULong   count, n, size;
@@ -317,8 +317,8 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   static FT_Error
-  Load_SBit_Range( TT_SBit_Range   range,
-                   FT_Stream       stream )
+  Load_SBit_Range( TT_SBit_Range  range,
+                   FT_Stream      stream )
   {
     FT_Error   error;
     FT_Memory  memory = stream->memory;
@@ -346,8 +346,8 @@
 
         for ( n = 0; n < num_glyphs; n++ )
           range->glyph_offsets[n] = (FT_ULong)( range->image_offset +
-                                                  ( large ? FT_GET_ULONG()
-                                                          : FT_GET_USHORT() ) );
+                                                ( large ? FT_GET_ULONG()
+                                                        : FT_GET_USHORT() ) );
         FT_FRAME_EXIT();
       }
       break;
@@ -361,8 +361,8 @@
       break;
 
     case 5:
-      error = Load_SBit_Const_Metrics( range, stream ) ||
-              Load_SBit_Range_Codes( range, stream, 0  );
+      error = Load_SBit_Const_Metrics( range, stream )   ||
+              Load_SBit_Range_Codes( range, stream, 0 );
       break;
 
     default:
@@ -485,8 +485,8 @@
 
     /* now read each strike table separately */
     {
-      TT_SBit_Strike   strike = face->sbit_strikes;
-      FT_ULong         count  = num_strikes;
+      TT_SBit_Strike  strike = face->sbit_strikes;
+      FT_ULong        count  = num_strikes;
 
 
       if ( FT_FRAME_ENTER( 48L * num_strikes ) )
@@ -509,14 +509,14 @@
 
     /* allocate the index ranges for each strike table */
     {
-      TT_SBit_Strike   strike = face->sbit_strikes;
-      FT_ULong         count  = num_strikes;
+      TT_SBit_Strike  strike = face->sbit_strikes;
+      FT_ULong        count  = num_strikes;
 
 
       while ( count > 0 )
       {
-        TT_SBit_Range   range;
-        FT_ULong        count2 = strike->num_ranges;
+        TT_SBit_Range  range;
+        FT_ULong       count2 = strike->num_ranges;
 
 
         if ( FT_NEW_ARRAY( strike->sbit_ranges, strike->num_ranges ) )
@@ -524,7 +524,7 @@
 
         /* read each range */
         if ( FT_STREAM_SEEK( table_base + strike->ranges_offset ) ||
-             FT_FRAME_ENTER( strike->num_ranges * 8L )         )
+             FT_FRAME_ENTER( strike->num_ranges * 8L )            )
           goto Exit;
 
         range = strike->sbit_ranges;
@@ -532,8 +532,8 @@
         {
           range->first_glyph  = FT_GET_USHORT();
           range->last_glyph   = FT_GET_USHORT();
-          range->table_offset = table_base + strike->ranges_offset
-                                 + FT_GET_ULONG();
+          range->table_offset = table_base + strike->ranges_offset +
+                                  FT_GET_ULONG();
           count2--;
           range++;
         }
@@ -547,7 +547,7 @@
         {
           /* Read the header */
           if ( FT_STREAM_SEEK( range->table_offset ) ||
-               FT_FRAME_ENTER( 8L )               )
+               FT_FRAME_ENTER( 8L )                  )
             goto Exit;
 
           range->index_format = FT_GET_USHORT();
@@ -588,17 +588,17 @@
   FT_LOCAL_DEF( void )
   TT_Free_SBit_Strikes( TT_Face  face )
   {
-    FT_Memory        memory       = face->root.memory;
-    TT_SBit_Strike   strike       = face->sbit_strikes;
-    TT_SBit_Strike   strike_limit = strike + face->num_sbit_strikes;
+    FT_Memory       memory       = face->root.memory;
+    TT_SBit_Strike  strike       = face->sbit_strikes;
+    TT_SBit_Strike  strike_limit = strike + face->num_sbit_strikes;
 
 
     if ( strike )
     {
       for ( ; strike < strike_limit; strike++ )
       {
-        TT_SBit_Range   range       = strike->sbit_ranges;
-        TT_SBit_Range   range_limit = range + strike->num_ranges;
+        TT_SBit_Range  range       = strike->sbit_ranges;
+        TT_SBit_Range  range_limit = range + strike->num_ranges;
 
 
         if ( range )
@@ -635,8 +635,8 @@
 
     for ( i = 0; i < face->num_sbit_strikes; i++ )
     {
-      if ( ( face->sbit_strikes[i].y_ppem  == y_ppem )  &&
-           ( ( x_ppem == 0 ) ||
+      if ( ( face->sbit_strikes[i].y_ppem  == y_ppem )    &&
+           ( ( x_ppem == 0 )                            ||
              ( face->sbit_strikes[i].x_ppem == x_ppem ) ) )
       {
         *astrike_index = i;
@@ -673,8 +673,8 @@
   static FT_Error
   Find_SBit_Range( FT_UInt          glyph_index,
                    TT_SBit_Strike   strike,
-                   TT_SBit_Range *  arange,
-                   FT_ULong*        aglyph_offset )
+                   TT_SBit_Range   *arange,
+                   FT_ULong        *aglyph_offset )
   {
     TT_SBit_RangeRec  *range, *range_limit;
 
@@ -731,12 +731,12 @@
             }
           }
 
-          /* fall-through */
-          default:
-            goto Fail;
+        /* fall-through */
+        default:
+          goto Fail;
         }
 
-    Found:
+      Found:
         /* return successfully! */
         *arange  = range;
         return 0;
@@ -780,18 +780,18 @@
   /*    glyph.                                                             */
   /*                                                                       */
   static FT_Error
-  Find_SBit_Image( TT_Face           face,
-                   FT_UInt           glyph_index,
-                   FT_ULong          strike_index,
-                   TT_SBit_Range    *arange,
-                   TT_SBit_Strike   *astrike,
-                   FT_ULong         *aglyph_offset )
+  Find_SBit_Image( TT_Face          face,
+                   FT_UInt          glyph_index,
+                   FT_ULong         strike_index,
+                   TT_SBit_Range   *arange,
+                   TT_SBit_Strike  *astrike,
+                   FT_ULong        *aglyph_offset )
   {
-    FT_Error         error;
-    TT_SBit_Strike   strike;
+    FT_Error        error;
+    TT_SBit_Strike  strike;
 
 
-    if ( !face->sbit_strikes                              ||
+    if ( !face->sbit_strikes                                ||
          ( face->num_sbit_strikes <= (FT_Int)strike_index ) )
       goto Fail;
 
@@ -844,9 +844,9 @@
   /*    function exit.                                                     */
   /*                                                                       */
   static FT_Error
-  Load_SBit_Metrics( FT_Stream         stream,
-                     TT_SBit_Range     range,
-                     TT_SBit_Metrics   metrics )
+  Load_SBit_Metrics( FT_Stream        stream,
+                     TT_SBit_Range    range,
+                     TT_SBit_Metrics  metrics )
   {
     FT_Error  error = SFNT_Err_Ok;
 
@@ -930,8 +930,8 @@
   /*    metrics :: The corresponding metrics structure.                    */
   /*                                                                       */
   static void
-  Crop_Bitmap( FT_Bitmap*        map,
-               TT_SBit_Metrics   metrics )
+  Crop_Bitmap( FT_Bitmap*       map,
+               TT_SBit_Metrics  metrics )
   {
     /***********************************************************************/
     /*                                                                     */
@@ -991,7 +991,7 @@
         line = (FT_Byte*)map->buffer;
 
         FT_MEM_MOVE( line, line + count * line_len,
-                  ( rows - count ) * line_len );
+                     ( rows - count ) * line_len );
 
         metrics->height       = (FT_Byte)( metrics->height - count );
         metrics->horiBearingY = (FT_Char)( metrics->horiBearingY - count );
@@ -1121,13 +1121,13 @@
 
 
   static FT_Error
-  Load_SBit_Single( FT_Bitmap*        map,
-                    FT_Int            x_offset,
-                    FT_Int            y_offset,
-                    FT_Int            pix_bits,
-                    FT_UShort         image_format,
-                    TT_SBit_Metrics   metrics,
-                    FT_Stream         stream )
+  Load_SBit_Single( FT_Bitmap*       map,
+                    FT_Int           x_offset,
+                    FT_Int           y_offset,
+                    FT_Int           pix_bits,
+                    FT_UShort        image_format,
+                    TT_SBit_Metrics  metrics,
+                    FT_Stream        stream )
   {
     FT_Error  error;
 
@@ -1142,11 +1142,11 @@
     }
 
     {
-      FT_Int  glyph_width  = metrics->width;
-      FT_Int  glyph_height = metrics->height;
-      FT_Int  glyph_size;
-      FT_Int  line_bits    = pix_bits * glyph_width;
-      FT_Bool pad_bytes    = 0;
+      FT_Int   glyph_width  = metrics->width;
+      FT_Int   glyph_height = metrics->height;
+      FT_Int   glyph_size;
+      FT_Int   line_bits    = pix_bits * glyph_width;
+      FT_Bool  pad_bytes    = 0;
 
 
       /* compute size of glyph image */
@@ -1160,10 +1160,17 @@
 
           switch ( pix_bits )
           {
-          case 1:  line_length = ( glyph_width + 7 ) >> 3;   break;
-          case 2:  line_length = ( glyph_width + 3 ) >> 2;   break;
-          case 4:  line_length = ( glyph_width + 1 ) >> 1;   break;
-          default: line_length =   glyph_width;
+          case 1:
+            line_length = ( glyph_width + 7 ) >> 3;
+            break;
+          case 2:
+            line_length = ( glyph_width + 3 ) >> 2;
+            break;
+          case 4:
+            line_length = ( glyph_width + 1 ) >> 1;
+            break;
+          default:
+            line_length =   glyph_width;
           }
 
           glyph_size = glyph_height * line_length;
@@ -1201,15 +1208,15 @@
 
 
   static FT_Error
-  Load_SBit_Image( TT_SBit_Strike    strike,
-                   TT_SBit_Range     range,
-                   FT_ULong          ebdt_pos,
-                   FT_ULong          glyph_offset,
-                   FT_Bitmap*        map,
-                   FT_Int            x_offset,
-                   FT_Int            y_offset,
-                   FT_Stream         stream,
-                   TT_SBit_Metrics   metrics )
+  Load_SBit_Image( TT_SBit_Strike   strike,
+                   TT_SBit_Range    range,
+                   FT_ULong         ebdt_pos,
+                   FT_ULong         glyph_offset,
+                   FT_Bitmap*       map,
+                   FT_Int           x_offset,
+                   FT_Int           y_offset,
+                   FT_Stream        stream,
+                   TT_SBit_Metrics  metrics )
   {
     FT_Memory  memory = stream->memory;
     FT_Error   error;
@@ -1295,9 +1302,9 @@
     /* All right, we have a compound format.  First of all, read */
     /* the array of elements.                                    */
     {
-      TT_SBit_Component   components;
-      TT_SBit_Component   comp;
-      FT_UShort           num_components, count;
+      TT_SBit_Component  components;
+      TT_SBit_Component  comp;
+      FT_UShort          num_components, count;
 
 
       if ( FT_READ_USHORT( num_components )           ||
@@ -1323,9 +1330,9 @@
       comp  = components;
       for ( ; count > 0; count--, comp++ )
       {
-        TT_SBit_Range    elem_range;
+        TT_SBit_Range       elem_range;
         TT_SBit_MetricsRec  elem_metrics;
-        FT_ULong         elem_offset;
+        FT_ULong            elem_offset;
 
 
         /* find the range for this element */
@@ -1393,20 +1400,20 @@
   /*    The `map.buffer' field is always freed before the glyph is loaded. */
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
-  TT_Load_SBit_Image( TT_Face           face,
-                      FT_ULong          strike_index,
-                      FT_UInt           glyph_index,
-                      FT_UInt           load_flags,
-                      FT_Stream         stream,
-                      FT_Bitmap        *map,
+  TT_Load_SBit_Image( TT_Face              face,
+                      FT_ULong             strike_index,
+                      FT_UInt              glyph_index,
+                      FT_UInt              load_flags,
+                      FT_Stream            stream,
+                      FT_Bitmap           *map,
                       TT_SBit_MetricsRec  *metrics )
   {
-    FT_Error         error;
-    FT_Memory        memory = stream->memory;
-    FT_ULong         ebdt_pos, glyph_offset;
+    FT_Error        error;
+    FT_Memory       memory = stream->memory;
+    FT_ULong        ebdt_pos, glyph_offset;
 
-    TT_SBit_Strike   strike;
-    TT_SBit_Range    range;
+    TT_SBit_Strike  strike;
+    TT_SBit_Range   range;
 
 
     /* Check whether there is a glyph sbit for the current index */
diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h
index 07a52ba..f38123d 100644
--- a/src/sfnt/ttsbit.h
+++ b/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType and OpenType embedded bitmap support (specification).       */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -42,12 +42,12 @@ FT_BEGIN_HEADER
                       FT_ULong  *astrike_index );
 
   FT_LOCAL( FT_Error )
-  TT_Load_SBit_Image( TT_Face           face,
-                      FT_ULong          strike_index,
-                      FT_UInt           glyph_index,
-                      FT_UInt           load_flags,
-                      FT_Stream         stream,
-                      FT_Bitmap        *map,
+  TT_Load_SBit_Image( TT_Face              face,
+                      FT_ULong             strike_index,
+                      FT_UInt              glyph_index,
+                      FT_UInt              load_flags,
+                      FT_Stream            stream,
+                      FT_Bitmap           *map,
                       TT_SBit_MetricsRec  *metrics );