Commit 0b7b23edfde49948af83037d774d9edeb5f5b247

Werner Lemberg 2000-10-13T07:08:44

complete revision

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
diff --git a/docs/tutorial/step1.html b/docs/tutorial/step1.html
index 2468f1d..fc66b12 100644
--- a/docs/tutorial/step1.html
+++ b/docs/tutorial/step1.html
@@ -39,7 +39,7 @@
 
   <p>This is the first section of the FreeType&nbsp;2 tutorial.  It will
   teach you to do the following:</p>
-  
+
   <ul>
     <li>initialize the library</li>
     <li>open a font file by creating a new face object</li>
@@ -48,7 +48,7 @@
     <li>render a very simple string of text</li>
     <li>render a rotated string of text easily</li>
   </ul>
-    
+
   <hr>
 
     <h3>
@@ -343,13 +343,13 @@
     cousins), it <em>automatically</em> creates a new size object for the
     returned face.  This size object is directly accessible as
     <tt>face->size</tt>.</p>
-       
-    <p><em>NOTA BENE: A single face object can deal with one or more size
-    objects at a time; however, this is something that few programmers
-    really need to do.  We have thus have decided to simplify the API for
-    the most common use (i.e. one size per face), while keeping this feature
-    available through additional functions.</em></p>
-    
+
+    <p><em>A single face object can deal with one or more size objects at a
+    time; however, this is something that few programmers really need to do.
+    We have thus have decided to simplify the API for the most common use
+    (i.e. one size per face), while keeping this feature available through
+    additional functions.</em></p>
+
     <p>When a new face object is created, its size object defaults to the
     character size of 10&nbsp;pixels (both horizontally and vertically) for
     scalable formats.  For fixed-sizes formats, the size is more or less
@@ -374,7 +374,7 @@
 
     <ul>
       <li>
-        The character width and heights are specified in 1/64th of points. 
+        The character width and heights are specified in 1/64th of points.
         A point is a <em>physical</em> distance, equaling 1/72th of an inch;
         it's not a pixel.
       </li>
@@ -396,7 +396,7 @@
         means 72&nbsp;dpi, which is the default.
       </li>
       <li>
-        The first argument is a handle to a face object, not a size object. 
+        The first argument is a handle to a face object, not a size object.
         That's normal, and must be seen as a convenience.
       </li>
     </ul>
@@ -414,7 +414,7 @@
               16 );   /* pixel_height                     */</pre>
     </font>
 
-    <p>This example will set the character pixel sizes to 16x16&nbsp;pixels. 
+    <p>This example will set the character pixel sizes to 16x16&nbsp;pixels.
     As previously, a value of&nbsp;0 for one of the dimensions means
     <em>same as the other</em>.</p>
 
@@ -452,7 +452,7 @@
       Unicode character codes if it finds one.  Otherwise, it tries to find
       support for Latin-1, then ASCII.</p>
 
-      <p>We will describe later how to look for specific charmaps in a face. 
+      <p>We will describe later how to look for specific charmaps in a face.
       For now, we will assume that the face contains at least a Unicode
       charmap that was selected during <tt>FT_New_Face()</tt>.  To convert a
       Unicode character code to a font glyph index, we use
@@ -479,13 +479,13 @@
 
       <p>Once you have a glyph index, you can load the corresponding glyph
       image.  The latter can be stored in various formats within the font
-      file.  For fixed-size formats like FNT or PCF, each image is a bitmap. 
+      file.  For fixed-size formats like FNT or PCF, each image is a bitmap.
       Scalable formats like TrueType or Type&nbsp;1 use vectorial shapes,
       named <em>outlines</em> to describe each glyph.  Some formats may have
-      even more exotic ways of representing glyph (e.g. MetaFont). 
+      even more exotic ways of representing glyph (e.g. MetaFont).
       Fortunately, FreeType&nbsp;2 is flexible enough to support any kind of
       glyph format through a simple API.</p>
-       
+
       <p>The glyph image is always stored in a special object called a
       <em>glyph slot</em>.  As its name suggests, a glyph slot is a
       container that is able to hold one glyph image at a time, be it a
@@ -497,7 +497,7 @@
 
       <font color="blue">
       <pre>
-    error = FT_Load_Glyph( 
+    error = FT_Load_Glyph(
               face,          /* handle to face object */
               glyph_index,   /* glyph index           */
               load_flags );  /* load flags, see below */</pre>
@@ -506,10 +506,10 @@
       <p>The <tt>load_flags</tt> value is a set of bit flags used to
       indicate some special operations.  The default value
       <tt>FT_LOAD_DEFAULT</tt> is&nbsp;0.</p>
-      
+
       <p>This function will try to load the corresponding glyph image from
       the face.  Basically, this means that</p>
-     
+
       <ul>
         <li>
           <p>If a bitmap is found for the corresponding glyph and pixel
@@ -524,7 +524,7 @@
           for certain formats like TrueType and Type&nbsp;1.</p>
         </li>
       </ul>
-      
+
       <p>The field <tt>glyph->format</tt> describes the format used to store
       the glyph image in the slot.  If it is not
       <tt>ft_glyph_format_bitmap</tt>, it is possible to immedialy convert
@@ -536,7 +536,7 @@
              face->glyph,      /* glyph slot  */
              render_mode );    /* render mode */</pre>
       </font>
-     
+
       <p>The parameter <tt>render_mode</tt> specifies how to render the
       glyph image.  Set it <tt>ft_render_mode_normal</tt> to render a
       high-quality anti-aliased (256&nbsp;gray levels) bitmap.  You can
@@ -547,11 +547,11 @@
       through <tt>glyph->bitmap</tt> (a simple bitmap descriptor), and
       position it with <tt>glyph->bitmap_left</tt> and
       <tt>glyph->bitmap_top</tt>.</p>
-     
+
       <p>Note that <tt>bitmap_left</tt> is the horizontal distance from the
       current pen position to the left-most border of the glyph bitmap,
       while <tt>bitmap_top</tt> is the vertical distance from the pen
-      position (on the baseline) to the top-most border of the glyph bitmap. 
+      position (on the baseline) to the top-most border of the glyph bitmap.
       <em>It is positive to indicate an upwards distance</em>.</p>
 
       <p>The second part of the tutorial will describe the contents of a
@@ -572,23 +572,23 @@
       <p>There are two ways to select a different charmap with
       FreeType&nbsp;2.  The easiest is if the encoding you need already has
       a corresponding enumeration defined in
-      <tt>&lt;freetype/freetype.h&gt;</tt>, as <tt>ft_encoding_big5</tt>. 
+      <tt>&lt;freetype/freetype.h&gt;</tt>, as <tt>ft_encoding_big5</tt>.
       In this case, you can simply call <tt>FT_Select_CharMap()</tt> as
       in</p>
-     
+
       <font color="blue"><pre>
     error = FT_Select_CharMap(
               face,                 /* target face object */
               ft_encoding_big5 );   /* encoding           */</pre>
       </font>
-      
+
       <p>Another way is to manually parse the list of charmaps for the face,
       this is accessible through the fields <tt>num_charmaps</tt> and
       <tt>charmaps</tt> (notice the final 's') of the face object.  As you
       could expect, the first is the number of charmaps in the face, while
       the second is <em>a table of pointers to the charmaps</em> embedded in
       the face.</p>
-     
+
       <p>Each charmap has a few visible fields used to describe it more
       precisely.  Mainly, one will look at <tt>charmap->platform_id</tt> and
       <tt>charmap->encoding_id</tt> which define a pair of values that can
@@ -605,7 +605,7 @@
       list.  Bear in mind that some encodings correspond to several values
       pairs (yes, it's a real mess, but blame Apple and Microsoft on such
       stupidity).  Here some code to do it:</p>
-         
+
       <font color="blue">
       <pre>
     FT_CharMap  found = 0;
@@ -642,9 +642,9 @@
       <p>It is possible to specify an affine transformation to be applied to
       glyph images when they are loaded.  Of course, this will only work for
       scalable (vectorial) font formats.</p>
-     
+
       <p>To do that, simply call <tt>FT_Set_Transform()</tt>, as in</p>
-      
+
       <font color="blue">
       <pre>
     error = FT_Set_Transform(
@@ -652,22 +652,22 @@
               &amp;matrix,    /* pointer to 2x2 matrix */
               &amp;delta );   /* pointer to 2d vector  */</pre>
       </font>
-     
+
       <p>This function will set the current transformation for a given face
       object.  Its second parameter is a pointer to a <tt>FT_Matrix</tt>
       structure that describes a 2x2 affine matrix.  The third parameter is
       a pointer to a <tt>FT_Vector</tt> structure that describes a simple 2d
       vector that is used to translate the glyph image <em>after</em> the
       2x2 transformation.</p>
-     
+
       <p>Note that the matrix pointer can be set to NULL, in which case the
       identity transformation will be used.  Coefficients of the matrix are
       otherwise in 16.16 fixed float units.</p>
-     
+
       <p>The vector pointer can also be set to NULL in which case a delta
       vector of (0,0) will be used.  The vector coordinates are expressed in
       1/64th of a pixel (also known as 26.6 fixed floats).</p>
-     
+
       <p><em>The transformation is applied to every glyph that is loaded
       through <tt>FT_Load_Glyph()</tt> and is <b>completely independent of
       any hinting process.</b> This means that you won't get the same
@@ -682,7 +682,7 @@
       compute a new character pixel size, then the other one to call
       <tt>FT_Set_Transform()</tt>.  This is explained in details in a later
       section of this tutorial.</p>
-         
+
       <p>Note also that loading a glyph bitmap with a non-identity
       transformation will produce an error.</p>
 
@@ -695,7 +695,7 @@
     <p>We will now present you with a very simple example used to render a
     string of 8-bit Latin-1 text, assuming a face that contains a Unicode
     charmap</p>
-       
+
     <p>The idea is to create a loop that will, on each iteration, load one
     glyph image, convert it to an anti-aliased bitmap, draw it on the target
     surface, then increment the current pen position.</p>
@@ -706,7 +706,7 @@
 
       <p>The following code performs our simple text rendering with the
       functions previously described.</p>
-       
+
       <font color="blue">
       <pre>
     FT_GlyphSlot  slot = face->glyph;  /* a small shortcut */
@@ -716,37 +716,37 @@
     .. initialize library ..
     .. create face object ..
     .. set character size ..
-       
+
     pen_x = 300;
     pen_y = 200;
-       
+
     for ( n = 0; n &lt; num_chars; n++ )
     {
       FT_UInt  glyph_index;
-         
+
 
       /* retrieve glyph index from character code */
       glyph_index = FT_Get_Char_Index( face, text[n] );
-         
+
       /* load glyph image into the slot (erase previous one) */
       error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
       if ( error ) continue;  /* ignore errors */
-         
+
       /* convert to an anti-aliased bitmap */
       error = FT_Render_Glyph( face->glyph, ft_render_mode_normal );
       if ( error ) continue;
-         
+
       /* now, draw to our target surface */
       my_draw_bitmap( &slot->bitmap,
                       pen_x + slot->bitmap_left,
                       pen_y - slot->bitmap_top );
-                         
+
       /* increment pen position */
       pen_x += slot->advance.x >> 6;
       pen_y += slot->advance.y >> 6;   /* not useful for now */
     }</pre>
-      </font>   
-    
+      </font>
+
       <p>This code needs a few explanations:</p>
 
       <ul>
@@ -778,13 +778,13 @@
           to <tt>pen_y</tt> instead of adding it.
         </li>
       </ul>
-    
+
       <h4>b. refined code</h4>
-    
+
       <p>The following code is a refined version of the example above.  It
       uses features and functions of FreeType&nbsp;2 that have not yet been
       introduced, and which will be explained below.</p>
-       
+
       <font color="blue">
       <pre>
     FT_GlyphSlot  slot = face->glyph;  /* a small shortcut */
@@ -795,29 +795,29 @@
     .. initialize library ..
     .. create face object ..
     .. set character size ..
-       
+
     pen_x = 300;
     pen_y = 200;
-       
+
     for ( n = 0; n &lt; num_chars; n++ )
     {
       /* load glyph image into the slot (erase previous one) */
       error = FT_Load_Char( face, text[n], FT_LOAD_RENDER );
       if ( error ) continue;  /* ignore errors */
-         
+
       /* now, draw to our target surface */
       my_draw_bitmap( &amp;slot->bitmap,
                       pen_x + slot->bitmap_left,
                       pen_y - slot->bitmap_top );
-                         
+
       /* increment pen position */
       pen_x += slot->advance.x >> 6;
     }</pre>
-      </font>   
+      </font>
 
       <p>We have reduced the size of our code, but it does exactly the same
       thing.</p>
-       
+
       <ul>
         <li>
           <p>We use the function <tt>FT_Load_Char()</tt> instead of
@@ -828,20 +828,20 @@
         <li>
           <p>We do not use <tt>FT_LOAD_DEFAULT</tt> for the loading mode but
           the bit flag <tt>FT_LOAD_RENDER</tt>.  It indicates that the glyph
-          image must be immediately converted to an anti-aliased bitmap. 
+          image must be immediately converted to an anti-aliased bitmap.
           This is of course a shortcut that avoids calling
           <tt>FT_Render_Glyph()</tt> explicitly but is strictly
           equivalent.</p>
-          
+
           <p>Note that you can also specify that you want a monochrome
           bitmap instead by using the additional <tt>FT_LOAD_MONOCHROME</tt>
           load flag.</p>
         </li>
-      </ul>  
-    
+      </ul>
+
       <h4>c. more advanced rendering</h4>
-    
-      <p>We now render transformed text (for example through a rotation). 
+
+      <p>We now render transformed text (for example through a rotation).
       To do that we use <tt>FT_Set_Transform()</tt>:</p>
 
       <font color="blue">
@@ -862,30 +862,30 @@
     matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L );
     matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L );
     matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L );
-              
+
     /* the pen position in 26.6 cartesian space coordinates */
     pen.x = 300 * 64;
     pen.y = ( my_target_height - 200 ) * 64;
-       
+
     for ( n = 0; n &lt; num_chars; n++ )
     {
       /* set transformation */
       FT_Set_Transform( face, &amp;matrix, &pen );
-         
+
       /* load glyph image into the slot (erase previous one) */
       error = FT_Load_Char( face, text[n], FT_LOAD_RENDER );
       if ( error ) continue;  /* ignore errors */
-         
+
       /* now, draw to our target surface (convert position) */
       my_draw_bitmap( &amp;slot->bitmap,
                       slot->bitmap_left,
                       my_target_height - slot->bitmap_top );
-                         
+
       /* increment pen position */
       pen.x += slot->advance.x;
       pen.y += slot->advance.y;
     }</pre>
-      </font>   
+      </font>
 
       <p>Notes:</p>
 
@@ -916,7 +916,7 @@
           is <em>not</em> rounded this time.
         </li>
       </ul>
-    
+
       <p>It is important to note that, while this example is a bit more
       complex than the previous one, it is strictly equivalent for the case
       where the transformation is the identity.  Hence it can be used as a
@@ -934,11 +934,11 @@
     <p>In this first section, you have learned the basics of
     FreeType&nbsp;2, as well as sufficient knowledge how to render rotated
     text.</p>
-       
+
     <p>The next part will dive into more details of the API in order to let
     you access glyph metrics and images directly, as well as how to deal
     with scaling, hinting, kerning, etc.</p>
-       
+
     <p>The third part will discuss issues like modules, caching, and a few
     other advanced topics like how to use multiple size objects with a
     single face.</p>
diff --git a/docs/tutorial/step2.html b/docs/tutorial/step2.html
index d8cc150..2425463 100644
--- a/docs/tutorial/step2.html
+++ b/docs/tutorial/step2.html
@@ -1,4 +1,5 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
+          "http://www.w3.org/TR/REC-html40/loose.dtd">
 <html>
 <head>
   <meta http-equiv="Content-Type"
@@ -15,19 +16,19 @@
       alink="#FF0000">
 
 <h1 align=center>
-  FreeType 2.0 Tutorial<br>
-  Step 2 - managing glyphs
+  FreeType&nbsp;2.0 Tutorial<br>
+  Step&nbsp;2 -- managing glyphs
 </h1>
 
 <h3 align=center>
-  &copy; 2000 David Turner
+  &copy;&nbsp;2000 David Turner
     (<a href="mailto:david@freetype.org">david@freetype.org</a>)<br>
-  &copy; 2000 The FreeType Development Team
+  &copy;&nbsp;2000 The FreeType Development Team
     (<a href="http://www.freetype.org">www.freetype.org</a>)
 </h3>
 
 <center>
-<table width="70%">
+<table width="75%">
 <tr><td>
 
   <hr>
@@ -36,9 +37,9 @@
     Introduction
   </h2>
 
-  <p>This is the second section of the FreeType 2 tutorial. It will teach
-     you the following:</p>
-  
+  <p>This is the second section of the FreeType&nbsp;2 tutorial.  It will
+  teach you the following:</p>
+
   <ul>
     <li>how to retrieve glyph metrics</li>
     <li>how to easily manage glyph images</li>
@@ -46,1351 +47,1557 @@
     <li>how to render a simple string of text, with kerning</li>
     <li>how to render a centered string of text (with kerning)</li>
     <li>how to render a transformed string of text (with centering)</li>
-    <li>finally, how to access metrics in design font units when needed,
-        and how to scale them to device space.</li>
+    <li>finally, how to access metrics in design font units if needed,
+        and how to scale them to device space</li>
   </ul>
-    
-    <hr>
-    
+
+  <hr>
+
     <h3>
-      1. Glyph metrics:
+      1. Glyph metrics
     </h3>
 
-    <p>Glyph metrics are, as their name suggests, certain distances associated
-       to each glyph in order to describe how to use it to layout text.</p>
+    <p>Glyph metrics are, as their name suggests, certain distances
+    associated to each glyph in order to describe how to use it to layout
+    text.</p>
+
+    <p>There are usually two sets of metrics for a single glyph: those used
+    to layout the glyph in horizontal text layouts (like Latin, Cyrillic,
+    Arabic, Hebrew, etc.), and those used to layout the glyph in vertical
+    text layouts (like some layouts of Chinese, Japanese, Korean, and
+    others).</p>
 
-    <p>There are usually two sets of metrics for a single glyph: those used to
-       layout the glyph in horizontal text layouts (like latin, cyrillic,
-       arabic, hebrew, etc..), and those used to layout the glyph in vertical
-       text layouts (like some layouts of Chinese, Japanese, Korean, and
-       others..).</p>
+    <p>Note that only a few font formats provide vertical metrics.  You can
+    test wether a given face object contains them by using the macro
+    <tt>FT_HAS_VERTICAL(face)</tt>, which is true if has vertical
+    metrics.</p>
 
-    <p>Note that only a few font formats provide vertical metrics. You can
-       test wether a given face object contains them by using the macro
-       <tt><b>FT_HAS_VERTICAL(face)</b></tt>, which is true when appropriate.</p>
-       
     <p>Individual glyph metrics can be accessed by first loading the glyph
-       in a face's glyph slot, then accessing them through the
-       <tt><b>face->glyph->metrics</b></tt> structure. This will be detailed
-       later, for now, we'll see that it contains the following fields:</p>
-    
-    <center><table width="90%" cellpadding=5><tr valign=top><td>
-    <tt><b>width</b></tt>
-    </td><td>
-    <p>This is the width of the glyph image's bounding box. It is independent
-       of layout direction.</p>
-    </td></tr><tr valign=top><td>
-    <tt><b>height</b></tt>
-    </td><td>
-    <p>This is the height of the glyph image's bounding box. It is independent
-       of layout direction.</p>
-    </td></tr><tr valign=top><td>
-    <tt><b>horiBearingX</b></tt>
-    </td><td>
-    <p>For <em>horizontal text layouts</em>, this is the horizontal distance from
-       the current cursor position to the left-most border of the glyph image's
-       bounding box.</p>
-    </td></tr><tr valign=top><td>
-    <tt><b>horiBearingY</b></tt>
-    </td><td>
-    <p>For <em>horizontal text layouts</em>, this is the vertical distance from
-       the current cursor position (on the baseline) to the top-most border of
-       the glyph image's bounding box.</p>
-    </td></tr><tr valign=top><td>
-    <tt><b>horiAdvance</b></tt>
-    </td><td>
-    <p>For <em>horizontal text layouts</em>, this is the horizontal distance
-       used to increment the pen position when the glyph is drawn as part of
-       a string of text.</p>
-    </td></tr><tr valign=top><td>
-    <tt><b>vertBearingX</b></tt>
-    </td><td>
-    <p>For <em>vertical text layouts</em>, this is the horizontal distance from
-       the current cursor position to the left-most border of the glyph image's
-       bounding box.</p>
-    </td></tr><tr valign=top><td>
-    <tt><b>vertBearingY</b></tt>
-    </td><td>
-    <p>For <em>vertical text layouts</em>, this is the vertical distance from
-       the current cursor position (on the baseline) to the top-most border of
-       the glyph image's bounding box.</p>
-    </td></tr><tr valign=top><td>
-    <tt><b>vertAdvance</b></tt>
-    </td><td>
-    <p>For <em>vertical text layouts</em>, this is the vertical distance
-       used to increment the pen position when the glyph is drawn as part of
-       a string of text.</p>
-    </td></tr></table></center>
-
-    <p><font color="red">NOTA BENE: As all fonts do not contain vertical
-       metrics, the values of <tt>vertBearingX</tt>, <tt>vertBearingY</tt>
-       and <tt>vertAdvance</tt> should not be considered reliable when
-       <tt><b>FT_HAS_VERTICAL(face)</b></tt> is false.</font></p>
-
-    <p>The following graphics illustrate the metrics more clearly. First, for
-       horizontal metrics, where the baseline is the horizontal axis :</p>
-       
-    <center><img src="metrics.png" width=388 height=253></center>
-    
+    in a face's glyph slot, then using the <tt>face->glyph->metrics</tt>
+    structure.  This will be described later; for now, we observe that it
+    contains the following fields:</p>
+
+    <center>
+    <table width="90%" cellpadding=5>
+    <tr valign=top>
+      <td>
+        <tt>width</tt>
+      </td>
+      <td>
+        This is the width of the glyph image's bounding box.  It is
+        independent of layout direction.
+      </td>
+    </tr>
+    <tr valign=top>
+      <td>
+        <tt>height</tt>
+      </td>
+      <td>
+        This is the height of the glyph image's bounding box.  It is
+        independent of layout direction.
+      </td>
+    </tr>
+    <tr valign=top>
+      <td>
+        <tt>horiBearingX</tt>
+      </td>
+      <td>
+        For <em>horizontal text layouts</em>, this is the horizontal
+        distance from the current cursor position to the left-most border of
+        the glyph image's bounding box.
+      </td>
+    </tr>
+    <tr valign=top>
+      <td>
+        <tt>horiBearingY</tt>
+      </td>
+      <td>
+        For <em>horizontal text layouts</em>, this is the vertical distance
+        from the current cursor position (on the baseline) to the top-most
+        border of the glyph image's bounding box.
+      </td>
+    </tr>
+    <tr valign=top>
+      <td>
+        <tt>horiAdvance</tt>
+      </td>
+      <td>
+        For <em>horizontal text layouts</em>, this is the horizontal
+        distance used to increment the pen position when the glyph is drawn
+        as part of a string of text.
+      </td>
+    </tr>
+    <tr valign=top>
+      <td>
+        <tt>vertBearingX</tt>
+      </td>
+      <td>
+        For <em>vertical text layouts</em>, this is the horizontal distance
+        from the current cursor position to the left-most border of the
+        glyph image's bounding box.
+      </td>
+    </tr>
+    <tr valign=top>
+      <td>
+        <tt>vertBearingY</tt>
+      </td>
+      <td>
+        For <em>vertical text layouts</em>, this is the vertical distance
+        from the current cursor position (on the baseline) to the top-most
+        border of the glyph image's bounding box.
+      </td>
+    </tr>
+    <tr valign=top>
+      <td>
+        <tt>vertAdvance</tt>
+      </td>
+      <td>
+        For <em>vertical text layouts</em>, this is the vertical distance
+        used to increment the pen position when the glyph is drawn as part
+        of a string of text.
+      </td>
+    </tr>
+    </table>
+    </center>
+
+    <p><em>As not all fonts do contain vertical metrics, the values of
+    <tt>vertBearingX</tt>, <tt>vertBearingY</tt>, and <tt>vertAdvance</tt>
+    should not be considered reliable if <tt>FT_HAS_VERTICAL(face)</tt> is
+    false.</em></p>
+
+    <p>The following graphics illustrate the metrics more clearly.  First,
+    for horizontal metrics, where the baseline is the horizontal axis:</p>
+
+    <center>
+      <img src="metrics.png"
+           alt="horizontal metrics layout"
+           width=388 height=253>
+    </center>
+
     <p>For vertical text layouts, the baseline is vertical and is the
-       vertical axis:</p>
-                            
-    <center><img src="metrics2.png" width=294 height=278></center>
+    vertical axis:</p>
 
+    <center>
+      <img src="metrics2.png"
+           alt="vertical metrics layout"
+           width=294 height=278>
+    </center>
 
     <p>The metrics found in <tt>face->glyph->metrics</tt> are normally
-       expressed in 26.6 pixels (i.e 1/64th of pixels), unless you use
-       the <tt><b>FT_LOAD_NO_SCALE</b></tt> flag when calling
-       <tt>FT_Load_Glyph</tt> or <tt>FT_Load_Char</tt>. In this case,
-       the metrics will be expressed in original font units.</p>
-           
-    <p>The glyph slot object has also a few other interesting fields
-       that will ease a developer's work. You can access them though
-       <tt><b>face->glyph->???</b></tt> :</p>
-
-    <center><table width="90%" cellpadding=5><tr valign=top><td>
-    <b><tt>advance</tt></b>
-    </td><td>
-    <p>This field is a <tt>FT_Vector</tt> which holds the transformed
-    advance for the glyph. That's useful when you're using a transform
-    through <tt>FT_Set_Transform</tt>, as shown in the rotated text
-    example of section I. Other than that, its value is
-    by default (metrics.horiAdvance,0), unless you specify
-    <tt><b>FT_LOAD_VERTICAL</b></tt> when loading the glyph image;
-    it will then be (0,metrics.vertAdvance)</p>
-    </td></tr><tr valign=top><td>
-    <b><tt>linearHoriAdvance</tt></b>
-    </td><td>
-    <p>
-    This field contains the linearly-scaled value of the glyph's horizontal
-    advance width. Indeed, the value of <tt>metrics.horiAdvance</tt> that is
-    returned in the glyph slot is normally rounded to integer pixel
-    coordinates (i.e., it will be a multiple of 64) by the font driver used
-    to load the glyph image. <tt>linearHoriAdvance</tt> is a 16.16 fixed float
-    number that gives the value of the original glyph advance width in
-    1/65536th of pixels. It can be use to perform pseudo device-independent
-    text layouts.</p>
-    </td></tr><tr valign=top><td>          
-    <b><tt>linearVertAdvance</tt></b>
-    </td><td>
-    <p>This is the same thing as <tt><b>linearHoriAdvance</b></tt> for the
-    glyph's vertical advance height. Its value is only reliable if the font
-    face contains vertical metrics.</p>
-    </td></tr></table></center>
-       
+    expressed in 26.6 pixel format (i.e 1/64th of pixels), unless you use
+    the <tt>FT_LOAD_NO_SCALE</tt> flag when calling <tt>FT_Load_Glyph()</tt>
+    or <tt>FT_Load_Char()</tt>.  In that case, the metrics will be expressed
+    in original font units.</p>
+
+    <p>The glyph slot object has a few other interesting fields that will
+    ease a developer's work.  You can access them through
+    <tt>face->glyph->???</tt>:</p>
+
+    <center>
+    <table width="90%" cellpadding=5>
+    <tr valign=top>
+      <td>
+        <tt>advance</tt>
+      </td>
+      <td>
+        This field is an <tt>FT_Vector</tt> which holds the transformed
+        advance value for the glyph.  This is useful if you are using a
+        transformation through <tt>FT_Set_Transform()</tt>, as shown in the
+        rotated text example of the previous part.  Other than that, its
+        value is by default (metrics.horiAdvance,0), unless you specify
+        <tt>FT_LOAD_VERTICAL</tt> when loading the glyph image; it will then
+        be (0,metrics.vertAdvance).
+      </td>
+    </tr>
+    <tr valign=top>
+      <td>
+        <tt>linearHoriAdvance</tt>
+      </td>
+      <td>
+        This field contains the linearly-scaled value of the glyph's
+        horizontal advance width.  Indeed, the value of
+        <tt>metrics.horiAdvance</tt> that is returned in the glyph slot is
+        normally rounded to integer pixel coordinates (i.e., it will be a
+        multiple of&nbsp;64) by the font driver used to load the glyph
+        image.  <tt>linearHoriAdvance</tt> is a 16.16 fixed float number
+        that gives the value of the original glyph advance width in
+        1/65536th of pixels.  It can be use to perform pseudo
+        device-independent text layouts.
+      </td>
+    </tr>
+    <tr valign=top>
+      <td>
+        <tt>linearVertAdvance</tt>
+      </td>
+      <td>
+        This is the same thing as <tt>linearHoriAdvance</tt> for the glyph's
+        vertical advance height.  Its value is only reliable if the font
+        face contains vertical metrics.
+      </td>
+    </tr>
+    </table>
+    </center>
 
+    <hr>
 
-  <hr>
+    <h3>
+      2. Managing glyph images
+    </h3>
 
-  <h3>
-    2. Managing glyph images:
-  </h3>
-
-  <p>The glyph image that is loaded in a glyph slot can be converted into
-     a bitmap, either by using <tt>FT_LOAD_RENDER</tt> when loading it, or
-     by calling <tt>FT_Render_Glyph</tt>. Each time you load a new glyph
-     image, the previous one is erased from the glyph slot.</p>
-    
-  <p>There are times however where you may need to extract this image from
-     the glyph slot, in order to cache it within your application, and
-     even perform additional transforms and measures on it before converting
-     it to a bitmap.
-  </p>
-
-  <p>The FreeType 2 API has a specific extension which is capable of dealing
-     with glyph images in a flexible and generic way. To use it, you first need
-     to include the "<tt>ftglyph.h</tt>" header file, as in:</p>
-     
-  <pre><font color="blue">
-      #include &lt;freetype/ftglyph.h&gt;
-  </font></pre>
-
-  <p>We will now explain how to use the functions defined in this file:</p>
-  
-  <h4>a. Extracting the glyph image:</h4>
-
-  <p>You can extract a single glyph image very easily. Here's some code
-     that shows how to do it:</p>
-
-  <pre><font color="blue">
-       FT_Glyph    glyph;    <font color="gray">// handle to glyph image</font>
-       
-       ....
-       error = FT_Load_Glyph( face, glyph, FT_LOAD_NORMAL );
-       if (error) { .... }
-       
-       error = FT_Get_Glyph( face->glyph, &glyph );
-       if (error) { .... }
-  </font></pre>
-
-  <p>As you see, we have:</p>
-  
-  <ul>
-     <li><p>
-       Created a variable, named <tt>glyph</tt>, of type <tt>FT_Glyph</tt>.
-       This is a handle (pointer) to an individual glyph image.
-     </p></li>
-         
-     <li><p>
-       Loaded the glyph image normally in the face's glyph slot. We did not
-       use <tt>FT_LOAD_RENDER</tt> because we want to grab a scalable glyph
-       image, in order to later transform it.
-     </p></li>
-
-     <li><p>
-       Copy the glyph image from the slot into a new <tt>FT_Glyph</tt> object,
-       by calling <tt><b>FT_Get_Glyph</b></tt>. This function returns an error
-       code and sets <tt>glyph</tt>.
-     </p></li>
-  </ul>
-  
-  <p>It is important to note that the extracted glyph is in the same format
-     than the original one that is still in the slot. For example, if we're
-     loading a glyph from a TrueType font file, the glyph image will really
-     be a scalable vector outline.</p>
-
-  <p>You can access the field <tt><b>glyph->format</b></tt> if you want to
-     know exactly how the glyph is modeled and stored. A new glyph object can
-     be destroyed with a call to <tt><b>FT_Done_Glyph</b></tt>.</p>
-
-  <p>The glyph object contains exactly one glyph image and a 2D vector
-     representing the glyph's advance in 16.16 fixed float coordinates.
-     The latter can be accessed directly as <tt><b>glyph->advance</b></tt>
-     </p>
-
-  <p><font color="red">Note that unlike
-     other FreeType objects, the library doesn't keeps a list of all
-     allocated glyph objects. This means you'll need to destroy them
-     yourself, instead of relying on <tt>FT_Done_FreeType</tt> doing
-     all the clean-up.</font></p>
-     
-  <h4>b. Transforming & copying the glyph image</h4>
-
-  <p>If the glyph image is scalable (i.e. if <tt>glyph->format</tt> is not
-     equal to <tt>ft_glyph_format_bitmap</tt>), it is possible to transform
-     the image anytime by a call to <tt><b>FT_Glyph_Transform</b></tt>.</p>
-     
-  <p>You can also copy a single glyph image with <tt><b>FT_Glyph_Copy</b></tt>.
-     Here's some example code:</p>
-     
-  <pre><font color="blue">
-    FT_Glyph  glyph, glyph2;
-    FT_Matrix matrix;
-    FT_Vector delta;
-    
-    ......
+    <p>The glyph image that is loaded in a glyph slot can be converted into
+    a bitmap, either by using <tt>FT_LOAD_RENDER</tt> when loading it, or by
+    calling <tt>FT_Render_Glyph()</tt> afterwards.  Each time you load a new
+    glyph image, the previous one is erased from the glyph slot.</p>
+
+    <p>There are times, however, where you may need to extract this image
+    from the glyph slot, in order to cache it within your application, and
+    even perform additional transformations and measures on it before
+    converting it to a bitmap.</p>
+
+    <p>The FreeType&nbsp;2 API has a specific extension which is capable of
+    dealing with glyph images in a flexible and generic way.  To use it, you
+    first need to include the <tt>ftglyph.h</tt> header file:</p>
+
+    <font color="blue">
+    <pre>
+    #include &lt;freetype/ftglyph.h&gt;</pre>
+    </font>
+
+    <p>We will now explain how to use the functions defined in this
+    file.</p>
+
+      <h4>
+        a. Extracting the glyph image
+      </h4>
+
+      <p>You can extract a single glyph image very easily.  Here some code
+      that shows how to do it.</p>
+
+      <font color="blue">
+      <pre>
+    FT_Glyph  glyph;    /* handle to glyph image */
+
+
+    ...
+    error = FT_Load_Glyph( face, glyph, FT_LOAD_NORMAL );
+    if ( error ) { .... }
+
+    error = FT_Get_Glyph( face->glyph, &amp;glyph );
+    if ( error ) { .... }</pre>
+    </font>
+
+      <p>As can be seen, we have</p>
+
+      <ul>
+        <li>
+          created a variable, named <tt>glyph</tt>, of type
+          <tt>FT_Glyph</tt>.  This is a handle (pointer) to an individual
+          glyph image,
+        </li>
+        <li>
+          loaded the glyph image normally in the face's glyph slot.  We did
+          not use <tt>FT_LOAD_RENDER</tt> because we want to grab a scalable
+          glyph image, in order to transform it later,
+        </li>
+        <li>
+          copied the glyph image from the slot into a new <tt>FT_Glyph</tt>
+          object, by calling <tt>FT_Get_Glyph()</tt>.  This function returns
+          an error code and sets <tt>glyph</tt>.
+        </li>
+      </ul>
+
+      <p>It is important to note that the extracted glyph is in the same
+      format as the original one that is still in the slot.  For example, if
+      we are loading a glyph from a TrueType font file, the glyph image will
+      really be a scalable vector outline.</p>
+
+      <p>You can access the field <tt>glyph->format</tt> if you want to know
+      exactly how the glyph is modeled and stored.  A new glyph object can
+      be destroyed with a call to <tt>FT_Done_Glyph</tt>.</p>
+
+      <p>The glyph object contains exactly one glyph image and a 2d vector
+      representing the glyph's advance in 16.16 fixed float coordinates.
+      The latter can be accessed directly as <tt>glyph->advance</tt>.</p>
+
+      <p><em>Note that unlike other FreeType objects, the library doesn't
+      keep a list of all allocated glyph objects.  This means you will need
+      to destroy them yourself, instead of relying on
+      <tt>FT_Done_FreeType()</tt> doing all the clean-up.</em></p>
+
+      <h4>
+        b. Transforming & copying the glyph image
+      </h4>
+
+      <p>If the glyph image is scalable (i.e., if <tt>glyph->format</tt> is
+      not equal to <tt>ft_glyph_format_bitmap</tt>), it is possible to
+      transform the image anytime by a call to
+      <tt>FT_Glyph_Transform()</tt>.</p>
+
+      <p>You can also copy a single glyph image with
+      <tt>FT_Glyph_Copy()</tt>.  Here some example code:</p>
+
+      <font color="blue">
+      <pre>
+    FT_Glyph   glyph, glyph2;
+    FT_Matrix  matrix;
+    FT_Vector  delta;
+
+
+    ...
     .. load glyph image in "glyph" ..
-    
-    <font color="gray">// copy glyph to glyph2
-    //</font>
-    error = FT_Glyph_Copy( glyph, &glyph2 );
-    if (error) { ... could not copy (out of memory) }
-    
-    <font color="gray">// translate "glyph"
-    //</font>    
-    delta.x = -100 * 64;   // coordinates are in 26.6 pixels
-    delta.y =  50  * 64;
-    
-    FT_Glyph_Transform( glyph, 0, &delta );
-    
-    <font color="gray">// transform glyph2 (horizontal shear)
-    //</font>
-    matrix.xx = 0x10000;
+
+    /* copy glyph to glyph2 */
+    error = FT_Glyph_Copy( glyph, &amp;glyph2 );
+    if ( error ) { ... could not copy (out of memory) }
+
+    /* translate "glyph" */
+    delta.x = -100 * 64;   /* coordinates are in 26.6 pixels */
+    delta.y =   50 * 64;
+
+    FT_Glyph_Transform( glyph, 0, &amp;delta );
+
+    /* transform glyph2 (horizontal shear) */
+    matrix.xx = 0x10000L;
     matrix.xy = 0;
-    matrix.yx = 0.12 * 0x10000;
-    matrix.yy = 0x10000;
-    
-    FT_Glyph_Transform( glyph2, &matrix, 0 );
-  </font></pre>
-
-  <p>Note that the 2x2 transform matrix is always applied to the 16.16
-     advance vector in the glyph, you thus don't need to recompute it..</p>
-
-  <h4>c. Measuring the glyph image</h4>
-  
-  <p>You can also retrieve the control (bounding) box of any glyph image
-     (scalable or not), through the <tt><b>FT_Glyph_Get_CBox</b></tt> function,
-     as in:
-     </p>
-
-  <pre><font color="blue">
-     FT_BBox   bbox;
-     ...
-     FT_Glyph_BBox(  glyph, <em>bbox_mode</em>, &bbox );
-  </font></pre>
-
-  <p>Coordinates are relative to the glyph origin, i.e. (0,0), using the
-     Y_upwards convention. This function takes a special argument, the
-     "bbox mode", that is a set of bit flags used to indicate how
-     box coordinates are expressed. If <tt><b>ft_glyph_bbox_subpixels</b></tt>
-     is set in the bbox mode, the coordinates are returned in 26.6 pixels
-     (i.e. 1/64th of pixels). Otherwise, they're in integer pixels.</p>
-
-  <p>Note that the box's maximum coordinates are exclusive, which means
-     that you can always compute the width and height of the glyph image,
-     be in in integer or 26.6 pixels with:</p>
-     
-  <pre><font color="blue">     
-     width  = bbox.xMax - bbox.xMin;
-     height = bbox.yMax - bbox.yMin;
-  </font></pre>
-
-  <p>Note also that for 26.6 coordinates, if
-     <tt><b>ft_glyph_bbox_gridfit</b></tt> is set in the bbox mode,
-     the coordinates will also be grid-fitted, which corresponds to:</p>
-     
-  <pre><font color="blue">
-     bbox.xMin = FLOOR(bbox.xMin)
-     bbox.yMin = FLOOR(bbox.yMin)
-     bbox.xMax = CEILING(bbox.xMax)
-     bbox.yMax = CEILING(bbox.yMax)
-  </font></pre>
-
-  <p>The default value for the bbox mode, which is 0, corresponds to
-     <b><tt>ft_glyph_bbox_pixels</tt></b> (i.e. integer pixel coordinates).</p>
-
-
-  <h4>d. Converting the glyph image to a bitmap</h4>
-  
-  <p>You may need to convert the glyph object to a bitmap once you have
-     convienently cached or transformed it. This can be done easily with
-     the <b><tt>FT_Glyph_To_Bitmap</tt></b> function. It is chared of
-     converting any glyph object into a bitmap, as in:</p>
-     
-  <pre><font color="blue">
+    matrix.yx = 0.12 * 0x10000L;
+    matrix.yy = 0x10000L;
+
+    FT_Glyph_Transform( glyph2, &amplmatrix, 0 );</pre>
+      </font>
+
+      <p>Note that the 2x2 transform matrix is always applied to the 16.16
+      advance vector in the glyph; you thus don't need to recompute it.</p>
+
+      <h4>
+        c. Measuring the glyph image
+      </h4>
+
+      <p>You can also retrieve the control (bounding) box of any glyph image
+      (scalable or not), using the <tt>FT_Glyph_Get_CBox</tt> function:</p>
+
+      <font color="blue">
+      <pre>
+    FT_BBox  bbox;
+
+
+    ...
+    FT_Glyph_Get_CBox( glyph, <em>bbox_mode</em>, &amp;bbox );</pre>
+      </font>
+
+      <p>Coordinates are relative to the glyph origin, i.e. (0,0), using the
+      Y&nbsp;upwards convention.  This function takes a special argument,
+      the <em>bbox mode</em>, to indicate how box coordinates are expressed.
+      If <tt>bbox_mode</tt> is set to <tt>ft_glyph_bbox_subpixels</tt>, the
+      coordinates are returned in 26.6 pixels (i.e. 1/64th of pixels).
+
+      <p>Note that the box's maximum coordinates are exclusive, which means
+      that you can always compute the width and height of the glyph image,
+      be it in integer or 26.6 pixels with</p>
+
+      <font color="blue">
+      <pre>
+    width  = bbox.xMax - bbox.xMin;
+    height = bbox.yMax - bbox.yMin;</pre>
+      </font>
+
+      <p>Note also that for 26.6 coordinates, if
+      <tt>ft_glyph_bbox_gridfit</tt> is set in <tt>bbox_mode</tt>, the
+      coordinates will also be grid-fitted, which corresponds to</p>
+
+      <font color="blue">
+      <pre>
+    bbox.xMin = FLOOR(bbox.xMin)
+    bbox.yMin = FLOOR(bbox.yMin)
+    bbox.xMax = CEILING(bbox.xMax)
+    bbox.yMax = CEILING(bbox.yMax)</pre>
+      </font>
+
+      <p>The default value for the bbox mode is
+      <tt>ft_glyph_bbox_pixels</tt> (i.e. integer, grid-fitted pixel
+      coordinates).  Please check the API reference for
+      <tt>FT_Glyph_Get_CBox()</tt> other possible values</p>
+
+      <h4>
+        d. Converting the glyph image to a bitmap
+      </h4>
+
+      <p>You may need to convert the glyph object to a bitmap once you have
+      conveniently cached or transformed it.  This can be done easily with
+      the <tt>FT_Glyph_To_Bitmap()</tt> function:</p>
+
+      <font color="blue">
+      <pre>
     FT_Vector  origin;
-    
-    origin.x = 32;   <font color="gray">/* 1/2 pixel in 26.26 format */</font>
+
+
+    origin.x = 32;   /* 1/2 pixel in 26.26 format */
     origin.y = 0;
-    
-    error = FT_Glyph_To_Bitmap( &glyph,
+
+    error = FT_Glyph_To_Bitmap( &amp;glyph,
                                 <em>render_mode</em>,
-                                &origin,
-                                1 );        <font color="gray">// destroy original image == true</font>
-  </font></pre>
+                                &amp;origin,
+                                1 );  /* destroy orig. image == true */</pre>
+      </font>
+
+      <p>Some details on this function's parameters:</p>
+
+      <ul>
+        <li>
+          The first parameter is <em>the address of the source glyph's
+          handle</em>.  When the function is called, it reads it to access
+          the source glyph object.  After the call, the handle will point to
+          a <em>new</em> glyph object that contains the rendered bitmap.
+        </li>
+        <li>
+          The second parameter is a standard render mode that is used to
+          specify what kind of bitmap we want.  It can be
+          <tt>ft_render_mode_default</tt> for an 8-bit anti-aliased pixmap,
+          or <tt>ft_render_mode_mono</tt> for a 1-bit monochrome bitmap.
+        </li>
+        <li>
+          The third parameter is a pointer to a 2d vector that is used to
+          translate the source glyph image before the conversion.  Note that
+          the source image will be translated back to its original position
+          (and will thus be left unchanged) after the call.  If you do not
+          need to translate the source glyph before rendering, set this
+          pointer to&nbsp;0.
+        </li>
+        <li>
+          The last parameter is a Boolean to indicate whether the source
+          glyph object should be destroyed by the function.  By default, the
+          original glyph object is never destroyed, even if its handle is
+          lost (it's up to client applications to keep it).
+        </li>
+      </ul>
+
+      <p>The new glyph object always contains a bitmap (when no error is
+      returned), and you must <em>typecast</em> its handle to the
+      <tt>FT_BitmapGlyph</tt> type in order to access its contents.  This
+      type is a sort of <em>subclass</em> of <tt>FT_Glyph</tt> that contains
+      additional fields:</p>
+
+      <center>
+      <table width="90%" cellpadding=5>
+      <tr valign=top>
+        <td>
+          <tt>left</tt>
+        </td>
+        <td>
+          Just like the <tt>bitmap_left</tt> field of a glyph slot, this is
+          the horizontal distance from the glyph origin (0,0) to the
+          left-most pixel of the glyph bitmap.  It is expressed in integer
+          pixels.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>top</tt>
+        </td>
+        <td>
+          Just like the <tt>bitmap_top</tt> field of a glyph slot, this is
+          the vertical distance from the glyph origin (0,0) to the top-most
+          pixel of the glyph bitmap (more exactly, to the pixel just above
+          the bitmap).  This distance is expressed in integer pixels, and is
+          positive for upwards&nbsp;Y.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>bitmap</tt>
+        </td>
+        <td>
+          This is a bitmap descriptor for the glyph object, just like the
+          <tt>bitmap</tt> field in a glyph slot.
+        </td>
+      </tr>
+      </table>
+      </center>
 
-  <p>We will know details this function's parameters:</p>
-  
-  <ul>
-     <li><p>
-       the first parameter is <em>the address of the source glyph's handle</em>.
-       When the function is called, it reads its to access the source
-       glyph object. After the call, the handle will point to a
-       <b><em>new</em></b> glyph object that contains the rendered bitmap.
-     </p></li>
-     
-     <li><p>
-       the second parameter is a standard render mode, that is used to specify
-       what kind of bitmap we want. It can be <tt>ft_render_mode_default</tt>
-       for an 8-bit anti-aliased pixmap, or <tt>ft_render_mode_mono</tt> for
-       a 1-bit monochrome bitmap.
-     </p></li>
-     
-     <li><p>
-       the third parameter is a pointer to a 2D vector that is used to
-       translate the source glyph image before the conversion. Note that
-       the source image will be translated back to its original position
-       (and will thus be left unchanged) after the call. If you do not need
-       to translate the source glyph before rendering, set this pointer to 0.
-     </p></li>
-     
-     <li><p>
-       the last parameter is a boolean that indicates wether the source
-       glyph object should be destroyed by the function. By default, the
-       original glyph object is never destroyed, even if its handle is
-       lost (it's up to client applications to keep it).
-     </p></li>
-  </ul>
-  
-  <p>The new glyph object always contain a bitmap (when no error is returned),
-     and you must <b><em>typecast</em></b> its handle to the
-     <tt><b>FT_BitmapGlyph</b></tt> type in order to access its content.
-     This type is a sort of "subclass" of <tt>FT_Glyph</tt> that contains
-     additional fields:</p>
-  
-  <center><table width="80%" cellpadding=5><tr valign=top><td>
-  <tt><b>left</b></tt>
-  </td><td>
-  <p>Just like the <tt><b>bitmap_left</b></tt> field of a glyph slot, this is the
-  horizontal distance from the glyph origin (0,0) to the left-most pixel
-  of the glyph bitmap. It is expressed in integer pixels.</p>
-  </td></tr><tr valign=top><td>
-  <tt><b>top</b></tt>
-  </td><td>
-  <p>Just like the <tt><b>bitmap_top</b></tt> field of a glyph slot, this is the
-  vertical distance from the glyph origin (0,0) to the top-most pixel
-  of the glyph bitmap (more exactly, to the pixel just above the bitmap).
-  This distance is expressed in integer pixels, and is positive for upwards
-  Y.</p>
-  </td></tr><tr valign=top><td>
-  <tt><b>bitmap</b></tt>
-  </td><td>
-  <p>This is a bitmap descriptor for the glyph object, just like the
-  <tt><b>bitmap</b></tt> field in a glyph slot.</p>
-  </td></tr></table></center>
-  
-  <hr>
-  <h3>
-    3. Global glyph metrics:
-  </h3>
-  
-  <p>Unlike glyph metrics, global ones are used to describe distances
-     and features of a whole font face. They can be expressed either in
-     26.6 pixels or in design "font units" for scalable formats.</p>
-
-  <h4>
-    a. Design Global Metrics:
-  </h4>
-
-  <p>For scalable formats, all global metrics are expressed in font units
-     in order to be later scaled to device space, according to the rules
-     described in the last chapter of this section of the tutorial. You
-     can access them directly as simple fields of a <tt>FT_Face</tt>
-     handle.</p>
-     
-  <p>However, you need to check that the font face's format is scalable
-     before using them. One can do it by using the macro
-     <tt><b>FT_IS_SCALABLE(face)</b></tt> which returns true when
-     appropriate.</p>
-
-  <p>In this case, you can access the global design metrics as:</p>
-
-  <center><table width="90%" cellpadding=5><tr valign=top><td>
-  <tt><b>units_per_EM</b></tt>
-  </td><td>
-  <p>This is the size of the EM square for the font face. It is used by scalable
-     formats to scale design coordinates to device pixels, as described by the
-     last chapter of this section. Its value usually is 2048 (for TrueType)
-     or 1000 (for Type1), but others are possible too. It is set to 1 for
-     fixed-size formats like FNT/FON/PCF/BDF.</p>
-  </td></tr><tr valign=top><td>
-  <tt><b>global_bbox</b></tt>
-  </td><td>
-  <p>The global bounding box is defined as the largest rectangle that can
-     enclose all the glyphs in a font face. It is defined for horizontal
-     layouts only.</p>
-  </td></tr><tr valign=top><td>
-  <tt><b>ascender</b></tt>
-  </td><td>
-  <p>The ascender is the vertical distance from the horizontal baseline to
-     the highest "character" coordinate in a font face. <em>Unfortunately, font
-     formats define the ascender differently</em>. For some, it represents
-     the ascent of all capital latin characters, without accents, for others
-     it's the ascent of the highest accented character, and finally, other
-     formats define it as being equal to <tt>global_bbox.yMax</tt>.</p>
-  </td></tr><tr valign=top><td>
-  <tt><b>descender</b></tt>
-  </td><td>
-  <p>The descender is the vertical distance from the horizontal baseline to
-     the lowest "character" coordinate in a font face. <em>Unfortunately, font
-     formats define the descender differently</em>. For some, it represents
-     the descent of all capital latin characters, without accents, for others
-     it's the ascent of the lowest accented character, and finally, other
-     formats define it as being equal to <tt>global_bbox.yMin</tt>.
-     <em><b>This field is usually negative</b></em></p>
-  </td></tr><tr valign=top><td>
-  <tt><b>text_height</b></tt>
-  </td><td>
-  <p>This field is simply used to compute a default line spacing (i.e. the
-  baseline-to-baseline distance) when writing text with this font. Note that
-  it usually is larger than the sum of the ascender and descender taken in
-  absolute value. There is also no guarantee that no glyphs can extend
-  above or below subsequent baselines when using this distance.</p>
-  </td></tr><tr valign=top><td>
-  <tt><b>max_advance_width</b></tt>
-  </td><td>
-  <p>This field gives the maximum horizontal cursor advance for all glyphs
-  in the font. It can be used to quickly compute the maximum advance width
-  of a string of text. <em>It doesn't correspond to the maximum glyph image
-  width !!</em></p>
-  </td></tr><tr valign=top><td>
-  <tt><b>max_advance_height</b></tt>
-  </td><td>
-  <p>Same as <tt>max_advance_width</tt> but for vertical text layout. It is
-  only available in fonts providing vertical glyph metrics.</p>
-  </td></tr><tr valign=top><td>
-  <tt><b>underline_position</b></tt>
-  </td><td>
-  <p>When displaying or rendering underlined text, this value corresponds to
-  the vertical position, relative to the baseline, of the underline bar. It
-  noramlly is negative (as it's below the baseline).</p>
-  </td></tr><tr valign=top><td>
-  <tt><b>underline_thickness</b></tt>
-  </td><td>
-  <p>When displaying or rendering underlined text, this value corresponds to
-  the vertical thickness of the underline.</p>
-  </td></tr></table></center>
-  
-  <p>Notice how, unfortunately, the values of the ascender and the descender
-     are not reliable (due to various discrepancies in font formats).</p>       
-  
-  <h4>
-    b. Scaled Global Metrics:
-  </h4>
-
-  <p>Each size object also contains a scaled versions of some of the global
-     metrics described above. They can be accessed directly through the
-     <tt><b>face->size->metrics</b></tt> structure.</p>
-     
-  <p>Note that these values correspond to scaled versions of the design
-     global metrics, <em>with no rounding/grid-fitting performed.</em>.
-     They are also completely independent of any hinting process. In other
-     words, don't rely on them to get exact metrics at the pixel level.
-     They're expressed in 26.6 pixels.</p>
-
-  <center><table width="80%" cellpadding=5><tr valign=top><td>
-  <b><tt>ascender</tt></b>
-  </td><td>
-  <p>This is the scaled version of the original design ascender.</p>
-  </td></tr><tr valign=top><td>
-  <b><tt>descender</tt></b>
-  </td><td>
-  <p>This is the scaled version of the original design descender.</p>
-  </td></tr><tr valign=top><td>
-  <b><tt>height</tt></b>
-  </td><td>
-  <p>This is the scaled version of the original design text height.
-  That probably is the only field you should really use in this structure.</p>
-  </td></tr><tr valign=top><td>
-  <b><tt>max_advance</tt></b>
-  </td><td>
-  <p>Thi is the scaled version of the original design max advance.</p>
-  </td></tr></table></center>
-
-  <p>Note that the <tt><b>face->size->metrics</b></tt> structure contains other
-  fields that are used to scale design coordinates to device space. They're
-  described, in the last chapter.</p>
-
-  <h4>
-    c. Kerning:
-  </h4>  
-  
-  <p>Kerning is the process of adjusting the position of two subsequent
-     glyph images in a string of text, in order to improve the general
-     appearance of text. Basically, it means that when the glyph for an
-     "A" is followed by the glyph for a "V", the space between them can
-     be slightly reduced to avoid extra "diagonal whitespace".</p>
-     
-  <p>Note that in theory, kerning can happen both in the horizontal and
-     vertical direction between two glyphs; however, it only happens in
-     the horizontal direction in nearly all cases except really extreme
-     ones.</p>
-
-  <p>Note all font formats contain kerning information. Instead, they sometimes
-     rely on an additional file that contains various glyph metrics, including
-     kerning, but no glyph images. A good example would be the Type 1 format,
-     where glyph images are stored in a file with extension ".pfa" or ".pfb",
-     and where kerning metrics can be found in an additional file with extension
-     ".afm" or ".pfm".</p>
-     
-  <p>FreeType 2 allows you to deal with this, by providing the
-     <tt><b>FT_Attach_File</b></tt> and <tt><b>FT_Attach_Stream</b></tt> APIs.
-     Both functions are used to load additional metrics into a face object,
-     by reading them from an additional format-specific file. For example,
-     you could open a Type 1 font by doing the following:</p>
-     
-  <pre><font color="blue">
-      error = FT_New_Face( library, "/usr/shared/fonts/cour.pfb", 0, &face );
-      if (error) { ... }
-      
-      error = FT_Attach_File( face, "/usr/shared/fonts/cour.afm" );
-      if (error) { .. could not read kerning and additional metrics .. }
-  </font></pre>
-
-  <p>Note that <tt><b>FT_Attach_Stream</b></tt> is similar to
-     <tt><b>FT_Attach_File</b></tt> except that it doesn't take a C string
-     to name the extra file, but a <tt>FT_Stream</tt> handle. Also,
-     <em>reading a metrics file is in no way, mandatory</em>.</p>
-
-  <p>Finally, the file attachment APIs are very generic and can be used to
-     load any kind of extra information for a given face. The nature of the
-     additional content is entirely font format specific.</p>
-
-  <p>FreeType 2 allows you to retrieve the kerning information between
-     two glyphs through the <tt><b>FT_Get_Kerning</b></tt> function, whose
-     interface looks like:</p>
-     
-  <pre><font color="blue">
-     FT_Vector  kerning;
-     ...
-     error = FT_Get_Kerning( face,                  <font color="gray">// handle to face object</font>
-                             left,                  <font color="gray">// left glyph index</font>
-                             right,                 <font color="gray">// right glyph index</font>
-                             <em>kerning_mode</em>,          <font color="gray">// kerning mode</font>
-                             &kerning );            <font color="gray">// target vector</font>
-  </font></pre>
-
-  <p>As you see, the function takes a handle to a face object, the indices
-     of the left and right glyphs for which the kerning value is desired,
-     as well as an integer, called the "kerning mode", and a pointer to
-     a destination vector that receives the corresponding distances.</p>
-  
-  <p>The kerning mode is very similar to the "bbox mode" described in a
-     previous chapter. It's a enumeration that indicates how the
-     kerning distances are expressed in the target vector.</p>
-     
-  <p>The default value is <tt><b>ft_kerning_mode_default</b></tt> which
-     has value 0. It corresponds to kerning distances expressed in 26.6
-     grid-fitted pixels (which means that the values are multiples of 64).
-     For scalable formats, this means that the design kerning distance is
-     scaled then rounded.</p>
-     
-  <p>The value <tt><b>ft_kerning_mode_unfitted</b></tt> corresponds to kerning
-     distances expressed in 26.6 unfitted pixels (i.e. that do not correspond
-     to integer coordinates). It's the design kerning distance that is simply
-     scaled without rounding.</p>
-     
-  <p>Finally, the value <tt><b>ft_kerning_mode_unscaled</b></tt> is used to
-     return the design kerning distance, expressed in font units. You can
-     later scale it to device space using the computations explained in the
-     last chapter of this section.</p>
-
-  <p>Note that the "left" and "right" positions correspond to the <em>visual
-     order</em> of the glyphs in the string of text. This is important for
-
-     bi-directional text, or simply when writing right-to-left text..</p>
-     
-  <hr>
+    <hr>
+
+    <h3>
+      3. Global glyph metrics
+    </h3>
+
+    <p>Unlike glyph metrics, global ones are used to describe distances and
+    features of a whole font face.  They can be expressed either in 26.6
+    pixel format or in design <em>font units</em> for scalable formats.</p>
+
+      <h4>
+        a. Design global metrics
+      </h4>
+
+      <p>For scalable formats, all global metrics are expressed in font
+      units in order to be later scaled to device space, according to the
+      rules described in the last chapter of this part of the tutorial.  You
+      can access them directly as simple fields of a <tt>FT_Face</tt>
+      handle.</p>
+
+      <p>However, you need to check that the font face's format is scalable
+      before using them.  One can do it by using the macro
+      <tt>FT_IS_SCALABLE(face)</tt> which returns true if we have a
+      scalable format.</p>
+
+      <p>In this case, you can access the global design metrics as</p>
+
+      <center>
+      <table width="90%" cellpadding=5>
+      <tr valign=top>
+        <td>
+          <tt>units_per_EM</tt>
+        </td>
+        <td>
+          This is the size of the EM square for the font face.  It is used
+          by scalable formats to scale design coordinates to device pixels,
+          as described by the last chapter of this part.  Its value usually
+          is&nbsp;2048 (for TrueType) or&nbsp;1000 (for Type&nbsp;1), but
+          other values are possible too.  It is set to&nbsp;1 for fixed-size
+          formats like FNT/FON/PCF/BDF.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>global_bbox</tt>
+        </td>
+        <td>
+          The global bounding box is defined as the largest rectangle that
+          can enclose all the glyphs in a font face.  It is defined for
+          horizontal layouts only.  This is not necessarily the smallest
+          bounding box which is possible.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>ascender</tt>
+        </td>
+        <td>
+          The ascender is the vertical distance from the horizontal baseline
+          to the height of the highest character in a font face.
+          <em>Unfortunately, font formats define the ascender
+          differently</em>.  For some, it represents the ascent of all
+          capital Latin characters, without accents, for others it is the
+          ascent of the highest accented character, and finally, other
+          formats define it as being equal to <tt>global_bbox.yMax</tt>.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>descender</tt>
+        </td>
+        <td>
+          The descender is the vertical distance from the horizontal
+          baseline to the depth of the lowest character in a font face.
+          <em>Unfortunately, font formats define the descender
+          differently</em>.  For some, it represents the descent of all
+          capital Latin characters, without accents, for others it is the
+          ascent of the lowest accented character, and finally, other
+          formats define it as being equal to <tt>global_bbox.yMin</tt>.
+          <em>This field is usually negative.</em>
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>text_height</tt>
+        </td>
+        <td>
+          This field is used to compute a default line spacing (i.e. the
+          baseline-to-baseline distance) when writing text with this font.
+          Note that it usually is larger than the sum of the ascender and
+          descender taken as absolute values.  There is also no guarantee
+          that no glyphs can extend above or below subsequent baselines when
+          using this distance.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>max_advance_width</tt>
+        </td>
+        <td>
+          This field gives the maximum horizontal cursor advance for all
+          glyphs in the font.  It can be used to quickly compute the maximum
+          advance width of a string of text.  <em>It doesn't correspond to
+          the maximum glyph image width!</em>
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>max_advance_height</tt>
+        </td>
+        <td>
+          Same as <tt>max_advance_width</tt> but for vertical text layout.
+          It is only available in fonts providing vertical glyph metrics.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>underline_position</tt>
+        </td>
+        <td>
+          When displaying or rendering underlined text, this value
+          corresponds to the vertical position, relative to the baseline, of
+          the underline bar. It normally is negative (as it is below the
+          baseline).
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>underline_thickness</tt>
+        </td>
+        <td>
+          When displaying or rendering underlined text, this value
+          corresponds to the vertical thickness of the underline.
+        </td>
+      </tr>
+      </table>
+      </center>
+
+      <p>Notice how, unfortunately, the values of the ascender and the
+      descender are not reliable (due to various discrepancies in font
+      formats).</p>
+
+      <h4>
+        b. Scaled global metrics
+      </h4>
+
+      <p>Each size object also contains a scaled versions of some of the
+      global metrics described above.  They can be accessed directly through
+      the <tt>face->size->metrics</tt> structure.</p>
+
+      <p>Note that these values correspond to scaled versions of the design
+      global metrics, <em>with no rounding/grid-fitting performed</em>. They
+      are also completely independent of any hinting process.  In other
+      words, don't rely on them to get exact metrics at the pixel level.
+      They are expressed in 26.6 pixel format.</p>
+
+      <center>
+      <table width="90%" cellpadding=5>
+      <tr valign=top>
+        <td>
+          <tt>ascender</tt>
+        </td>
+        <td>
+          This is the scaled version of the original design ascender.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>descender</tt>
+        </td>
+        <td>
+          This is the scaled version of the original design descender.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>height</tt>
+        </td>
+        <td>
+          The scaled version of the original design text height.  This is
+          probably the only field you should really use in this structure.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>max_advance</tt>
+        </td>
+        <td>
+          This is the scaled version of the original design max advance.
+        </td>
+      </tr>
+      </table>
+      </center>
+
+      <p>Note that the <tt>face->size->metrics</tt> structure contains other
+      fields that are used to scale design coordinates to device space.
+      They are described below.</p>
+
+      <h4>
+        c. Kerning
+      </h4>
+
+      <p>Kerning is the process of adjusting the position of two subsequent
+      glyph images in a string of text, in order to improve the general
+      appearance of text.  Basically, it means that when the glyph for an
+      "A" is followed by the glyph for a "V", the space between them can be
+      slightly reduced to avoid extra "diagonal whitespace".</p>
+
+      <p>Note that in theory, kerning can happen both in the horizontal and
+      vertical direction between two glyphs; however, it only happens in the
+      horizontal direction in nearly all cases except really extreme
+      ones.</p>
+
+      <p>Not all font formats contain kerning information.  Instead, they
+      sometimes rely on an additional file that contains various glyph
+      metrics, including kerning, but no glyph images.  A good example would
+      be the Type&nbsp;1 format, where glyph images are stored in a file
+      with extension <tt>.pfa</tt> or <tt>.pfb</tt>, and where kerning
+      metrics can be found in an additional file with extension
+      <tt>.afm</tt> or <tt>.pfm</tt>.</p>
+
+      <p>FreeType&nbsp;2 allows you to deal with this by providing the
+      <tt>FT_Attach_File()</tt> and <tt>FT_Attach_Stream()</tt> APIs.  Both
+      functions are used to load additional metrics into a face object, by
+      reading them from an additional format-specific file.  For example,
+      you could open a Type&nbsp;1 font by doing the following:</p>
+
+      <font color="blue">
+      <pre>
+    error = FT_New_Face( library,
+                         "/usr/shared/fonts/cour.pfb",
+                         0,
+                         &amp;face );
+    if ( error ) { ... }
+
+    error = FT_Attach_File( face, "/usr/shared/fonts/cour.afm" );
+    if ( error ) { .. could not read kerning and additional metrics .. }</pre>
+      </font>
+
+      <p>Note that <tt>FT_Attach_Stream()</tt> is similar to
+      <tt>FT_Attach_File()</tt> except that it doesn't take a C&nbsp;string
+      to name the extra file, but a <tt>FT_Stream</tt> handle.  Also,
+      <em>reading a metrics file is in no way mandatory</em>.</p>
+
+      <p>Finally, the file attachment APIs are very generic and can be used
+      to load any kind of extra information for a given face.  The nature of
+      the additional data is entirely font format specific.</p>
+
+      <p>FreeType&nbsp;2 allows you to retrieve the kerning information
+      between two glyphs through the <tt>FT_Get_Kerning()</tt> function,
+      whose interface looks like</p>
+
+      <font color="blue">
+      <pre>
+    FT_Vector  kerning;
+
+
+    ...
+    error = FT_Get_Kerning(
+              face,              /* handle to face object */
+              left,              /* left glyph index      */
+              right,             /* right glyph index     */
+              <em>kerning_mode</em>,      /* kerning mode          */
+              &amp;kerning );        /* target vector         */</pre>
+      </font>
+
+      <p>As can be seen, the function takes a handle to a face object, the
+      indices of the left and right glyphs for which the kerning value is
+      desired, as well as an integer, called the <em>kerning mode</em>, and
+      a pointer to a destination vector that receives the corresponding
+      distances.</p>
+
+      <p>The kerning mode is very similar to the <em>bbox mode</em>
+      described in a previous part.  It is an enumeration value that
+      indicates how the kerning distances are expressed in the target
+      vector.</p>
+
+      <p>The default value <tt>ft_kerning_mode_default</tt> (which has
+      value&nbsp;0) corresponds to kerning distances expressed in 26.6
+      grid-fitted pixels (which means that the values are multiples
+      of&nbsp;64).  For scalable formats, this means that the design kerning
+      distance is scaled, then rounded.</p>
+
+      <p>The value <tt>ft_kerning_mode_unfitted</tt> corresponds to kerning
+      distances expressed in 26.6 unfitted pixels (i.e. that do not
+      correspond to integer coordinates).  It is the design kerning distance
+      that is scaled without rounding.</p>
+
+      <p>Finally, the value <tt>ft_kerning_mode_unscaled</tt> is used to
+      return the design kerning distance, expressed in font units.  You can
+      later scale it to device space using the computations explained in the
+      last chapter of this part.</p>
+
+      <p>Note that the "left" and "right" positions correspond to the
+      <em>visual order</em> of the glyphs in the string of text.  This is
+      important for bi-directional text, or simply when writing
+      right-to-left text.</p>
+
+    <hr>
+
+    <h3>
+      4. Simple text rendering: kerning + centering
+    </h3>
+
+    <p>In order to show off what we have just learned, we will now show how
+    to modify the example code that was provided in the first part to render
+    a string of text, and enhance it to support kerning and delayed
+    rendering.</p>
+
+      <h4>
+        a. Kerning support
+      </h4>
+
+      <p>Adding support for kerning to our code is trivial, as long as we
+      consider that we are still dealing with a left-to-right script like
+      Latin.  We simply need to retrieve the kerning distance between two
+      glyphs in order to alter the pen position appropriately.  The code
+      looks like</p>
+
+      <font color="blue">
+      <pre>
+    FT_GlyphSlot  slot = face->glyph;  /* a small shortcut */
+    FT_UInt       glyph_index;
+    FT_Bool       use_kerning;
+    FT_UInt       previous;
+    int           pen_x, pen_y, n;
+
+
+    .. initialize library ..
+    .. create face object ..
+    .. set character size ..
+
+    pen_x = 300;
+    pen_y = 200;
+
+    use_kerning = FT_HAS_KERNING( face );
+    previous    = 0;
+
+    for ( n = 0; n &lt; num_chars; n++ )
+    {
+      /* convert character code to glyph index */
+      glyph_index = FT_Get_Char_Index( face, text[n] );
 
-  <h3>
-    4. Simple text rendering: kerning + centering:
-  </h3>  
-
-  <p>In order to show off what we just learned, we will now show how to modify
-     the example code that was provided in section I to render a string of text,
-     and enhance it to support kerning and delayed rendering.</p>
-
-   <h4>
-     a. Kerning support:
-   </h4>
-   
-   <p>Adding support for kerning to our code is trivial, as long as we consider
-      that we're still dealing with a left-to-right script like Latin. We
-      simply need to retrieve the kerning distance between two glyphs in order
-      to alter the pen position appropriately. The code looks like:</p>
-      
-   <font color="blue"><pre>
-      FT_GlyphSlot  slot = face->glyph;  // a small shortcut
-      FT_UInt       glyph_index;
-      FT_Bool       use_kerning;
-      FT_UInt       previous;
-      int           pen_x, pen_y, n;
-
-      .. initialise library ..
-      .. create face object ..
-      .. set character size ..
-      
-      pen_x = 300;
-      pen_y = 200;
-      
-      use_kerning = FT_HAS_KERNING(face);
-      previous    = 0;
-      
-      for ( n = 0; n &lt; num_chars; n++ )
+      /* retrieve kerning distance and move pen position */
+      if ( use_kerning && previous && glyph_index )
       {
-        <font color="gray">// convert character code to glyph index</font>
-        glyph_index = FT_Get_Char_Index( face, text[n] );
-        
-        <font color="gray">// retrieve kerning distance and move pen position</font>
-        if ( use_kerning && previous && glyph_index )
-        {
-          FT_Vector  delta;
-          
-          FT_Get_Kerning( face, previous, glyph_index,
-                          ft_kerning_mode_default, &delta );
-                          
-          pen_x += delta.x >> 6;
-        }
-      
-        <font color="gray">// load glyph image into the slot (erase previous one)</font>
-        error = FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER );
-        if (error) continue;  <font color="gray">// ignore errors</font>
-        
-        <font color="gray">// now, draw to our target surface</font>
-        my_draw_bitmap( &slot->bitmap,
-                        pen_x + slot->bitmap_left,
-                        pen_y - slot->bitmap_top );
-                        
-        <font color="gray">// increment pen position</font>
-        pen_x += slot->advance.x >> 6;
-        
-        <font color="gray">// record current glyph index</font>
-        previous = glyph_index
+        FT_Vector  delta;
+
+
+        FT_Get_Kerning( face, previous, glyph_index,
+                        ft_kerning_mode_default, &amp;delta );
+
+        pen_x += delta.x >> 6;
       }
-   </pre></font>   
-
-   <p>That's it. You'll notice that:</p>
-   
-   <ul>
-     <li><p>
-        As kerning is determined from glyph indices, we need to explicitely
-        convert our character code into a glyph index, then later call
-        <tt>FT_Load_Glyph</tt> instead of <tt>FT_Load_Char</tt>. No big
-        deal, if you ask me :-)
-     </p></li>
-     
-     <li><p>
-        We use a boolean named <tt>use_kerning</tt> which is set with the
-        result of the macro <tt><b>FT_HAS_KERNING(face)</b></tt>. It's
-        certainly faster not to call <tt>FT_Get_Kerning</tt> when we know
-        that the font face does not contain kerning information.
-     </p></li>
-     
-     <li><p>
-        We move the position of the pen <em>before</em> a new glyph is drawn.
-     </p></li>
-     
-     <li><p>
-        We did initialize the variable <tt>previous</tt> with the value 0,
-        which always correspond to the "missing glyph" (also called
-        <tt>.notdef</tt> in the Postscript world). There is never any
-        kerning distance associated with this glyph.
-     </p></li>
-     
-     <li><p>
-        We do not check the error code returned by <tt>FT_get_Kerning</tt>.
-        This is because the function always set the content of <tt>delta</tt>
-        to (0,0) when an error occurs.
-     </p></li>
-   </ul>
-
-   <p>As you see, this is not terribly complex :-)</p>
-
-  <h4>
-    b. Centering:
-  </h4>
-
-   <p>Our code begins to become interesting but it's still a bit too simple
-      for normal uses. For example, the position of the pen is determined
-      before we do the rendering when in a normal situation, you would want
+
+      /* load glyph image into the slot (erase previous one) */
+      error = FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER );
+      if ( error ) continue;  /* ignore errors */
+
+      /* now, draw to our target surface */
+      my_draw_bitmap( &amp;slot->bitmap,
+                      pen_x + slot->bitmap_left,
+                      pen_y - slot->bitmap_top );
+
+      /* increment pen position */
+      pen_x += slot->advance.x >> 6;
+
+      /* record current glyph index */
+      previous = glyph_index;
+    }</pre>
+      </font>
+
+      <p>We are done.  Notice that</p>
+
+      <ul>
+        <li>
+          As kerning is determined from glyph indices, we need to
+          explicitly convert our character code into a glyph index, then
+          later call <tt>FT_Load_Glyph()</tt> instead of
+          <tt>FT_Load_Char()</tt>.
+        </li>
+        <li>
+          We use a Boolean named <tt>use_kerning</tt> which is set with the
+          result of the macro <tt>FT_HAS_KERNING(face)</tt>.  It is
+          certainly faster not to call <tt>FT_Get_Kerning()</tt> if we
+          know that the font face does not contain kerning information.
+        </li>
+        <li>
+          We move the position of the pen <em>before</em> a new glyph is
+          drawn.
+        </li>
+        <li>
+          We did initialize the variable <tt>previous</tt> with the
+          value&nbsp;0, which always correspond to the <em>missing
+          glyph</em> (also called <tt>.notdef</tt> in the PostScript world).
+          There is never any kerning distance associated with this glyph.
+        </li>
+        <li>
+          We do not check the error code returned by
+          <tt>FT_Get_Kerning()</tt>.  This is because the function always
+          set the content of <tt>delta</tt> to (0,0) when an error occurs.
+        </li>
+      </ul>
+
+      <h4>
+        b. Centering
+      </h4>
+
+      <p>Our code becomes more interesting but it is still a bit too simple
+      for normal uses.  For example, the position of the pen is determined
+      before we do the rendering if in a real-life situation; you would want
       to layout the text and measure it before computing its final position
       (e.g. centering) or perform things like word-wrapping.</p>
-      
-   <p>We're thus now going to decompose our text rendering function into two
-      distinct but successive parts: the first one will position individual
-      glyph images on the baseline, while the second one will render the
-      glyphs. As we'll see, this has many advantages.</p>
-      
-   <p>We will thus start by storing individual glyph images, as well as their
-      position on the baseline. This can be done with code like:</p>
-      
-   <font color="blue"><pre>
-      FT_GlyphSlot  slot = face->glyph;  <font color="gray">// a small shortcut</font>
-      FT_UInt       glyph_index;
-      FT_Bool       use_kerning;
-      FT_UInt       previous;
-      int           pen_x, pen_y, n;
-      
-      FT_Glyph      glyphs[ MAX_GLYPHS ];   <font color="gray">// glyph image</font>
-      FT_Vector     pos   [ MAX_GLYPHS ];   <font color="gray">// glyph position</font>
-      FT_UInt       num_glyphs;
-
-      .. initialise library ..
-      .. create face object ..
-      .. set character size ..
-      
-      pen_x = 0;   <font color="gray">/* start at (0,0) !! */</font>
-      pen_y = 0;
-      
-      num_glyphs  = 0;
-      use_kerning = FT_HAS_KERNING(face);
-      previous    = 0;
-      
-      for ( n = 0; n &lt; num_chars; n++ )
+
+      <p>As a consequence we are now going to decompose our text rendering
+      function into two distinct but successive parts: The first one will
+      position individual glyph images on the baseline, while the second one
+      will render the glyphs.  As will be shown, this has many
+      advantages.</p>
+
+      <p>We start by storing individual glyph images, as well as their
+      position on the baseline.  This can be done with code like</p>
+
+      <font color="blue">
+      <pre>
+    FT_GlyphSlot  slot = face->glyph;  /* a small shortcut */
+    FT_UInt       glyph_index;
+    FT_Bool       use_kerning;
+    FT_UInt       previous;
+    int           pen_x, pen_y, n;
+
+    FT_Glyph      glyphs[MAX_GLYPHS];  /* glyph image    */
+    FT_Vector     pos   [MAX_GLYPHS];  /* glyph position */
+    FT_UInt       num_glyphs;
+
+
+    .. initialize library ..
+    .. create face object ..
+    .. set character size ..
+
+    pen_x = 0;   /* start at (0,0)! */
+    pen_y = 0;
+
+    num_glyphs  = 0;
+    use_kerning = FT_HAS_KERNING( face );
+    previous    = 0;
+
+    for ( n = 0; n &lt; num_chars; n++ )
+    {
+      /* convert character code to glyph index */
+      glyph_index = FT_Get_Char_Index( face, text[n] );
+
+      /* retrieve kerning distance and move pen position */
+      if ( use_kerning && previous && glyph_index )
       {
-        <font color="gray">// convert character code to glyph index</font>
-        glyph_index = FT_Get_Char_Index( face, text[n] );
-        
-        <font color="gray">// retrieve kerning distance and move pen position</font>
-        if ( use_kerning && previous && glyph_index )
-        {
-          FT_Vector  delta;
-          
-          FT_Get_Kerning( face, previous, glyph_index,
-                          ft_kerning_mode_default, &delta );
-                          
-          pen_x += delta.x >> 6;
-        }
-      
-        <font color="gray">// store current pen position</font>
-        pos[ num_glyphs ].x = pen_x;
-        pos[ num_glyphs ].y = pen_y;
-      
-        <font color="gray">// load glyph image into the slot. DO NOT RENDER IT !!</font>
-        error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
-        if (error) continue;  // ignore errors, jump to next glyph
-        
-        <font color="gray">// extract glyph image and store it in our table</font>
-        error = FT_Get_Glyph( face->glyph, & glyphs[num_glyphs] );
-        if (error) continue;  // ignore errors, jump to next glyph
-        
-        <font color="gray">// increment pen position</font>
-        pen_x += slot->advance.x >> 6;
-        
-        <font color="gray">// record current glyph index</font>
-        previous = glyph_index
-        
-        <font color="gray">// increment number of glyphs</font>
-        num_glyphs++;
+        FT_Vector  delta;
+
+
+        FT_Get_Kerning( face, previous, glyph_index,
+                        ft_kerning_mode_default, &delta );
+
+        pen_x += delta.x >> 6;
       }
-   </pre></font>   
-      
-   <p>As you see, this is a very simple variation of our previous code
+
+      /* store current pen position */
+      pos[num_glyphs].x = pen_x;
+      pos[num_glyphs].y = pen_y;
+
+      /* load glyph image into the slot.  DO NOT RENDER IT! */
+      error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
+      if ( error ) continue;  /* ignore errors, jump to next glyph */
+
+      /* extract glyph image and store it in our table */
+      error = FT_Get_Glyph( face->glyph, &amp;glyphs[num_glyphs] );
+      if ( error ) continue;  /* ignore errors, jump to next glyph */
+
+      /* increment pen position */
+      pen_x += slot->advance.x >> 6;
+
+      /* record current glyph index */
+      previous = glyph_index;
+
+      /* increment number of glyphs */
+      num_glyphs++;
+    }</pre>
+      </font>
+
+      <p>As you see, this is a very simple variation of our previous code
       where we extract each glyph image from the slot, and store it, along
       with the corresponding position, in our tables.</p>
-   
-   <p>Note also that "pen_x" contains the total advance for the string of
-      text. We can now compute the bounding box of the text string with
-      a simple function like:</p>
-      
-      
-   <font color="blue"><pre>
-      void   compute_string_bbox( FT_BBox  *abbox )
+
+      <p>Note also that <tt>pen_x</tt> contains the total advance for the
+      string of text.  We can now compute the bounding box of the text
+      string with a simple function like</p>
+
+      <font color="blue">
+      <pre>
+    void  compute_string_bbox( FT_BBox*  abbox )
+    {
+      FT_BBox  bbox;
+
+
+      /* initialize string bbox to "empty" values */
+      bbox.xMin = bbox.yMin =  32000;
+      bbox.xMax = bbox.yMax = -32000;
+
+      /* for each glyph image, compute its bounding box, */
+      /* translateit, and grow the string bbox           */
+      for ( n = 0; n &lt; num_glyphs; n++ )
       {
-        FT_BBox  bbox;
-        
-        <font color="gray">// initialise string bbox to "empty" values</font>
-        bbox.xMin = bbox.yMin =  32000;
-        bbox.xMax = bbox.yMax = -32000;
-        
-        <font color="gray">// for each glyph image, compute its bounding box, translate it,
-        // and grow the string bbox</font>
-        for ( n = 0; n &lt; num_glyphs; n++ )
-        {
-          FT_BBox   glyph_bbox;
-
-          FT_Glyph_Get_CBox( glyphs[n], &glyph_bbox );
-
-          glyph_bbox.xMin += pos[n].x;
-          glyph_bbox.xMax += pos[n].x;
-          glyph_bbox.yMin += pos[n].y;
-          glyph_bbox.yMax += pos[n].y;
-
-          if (glyph_bbox.xMin &lt; bbox.xMin)
-            bbox.xMin = glyph_bbox.xMin;
-
-          if (glyph_bbox.yMin &lt; bbox.yMin)
-            bbox.yMin = glyph_bbox.yMin;
-
-          if (glyph_bbox.xMax &gt; bbox.xMax)
-            bbox.xMax = glyph_bbox.xMax;
-
-          if (glyph_bbox.yMax &gy; bbox.yMax)
-            bbox.yMax = glyph_bbox.yMax;
-        }
-        
-        <font color="gray">// check that we really grew the string bbox</font>
-        if ( bbox.xMin > bbox.xMax )
-        {
-          bbox.xMin = 0;
-          bbox.yMin = 0;
-          bbox.xMax = 0;
-          bbox.yMax = 0;
-        }
-        
-        <font color="gray">// return string bbox</font>
-        *abbox = bbox;
+        FT_BBox  glyph_bbox;
+
+
+        FT_Glyph_Get_CBox( glyphs[n], &amp;glyph_bbox );
+
+        glyph_bbox.xMin += pos[n].x;
+        glyph_bbox.xMax += pos[n].x;
+        glyph_bbox.yMin += pos[n].y;
+        glyph_bbox.yMax += pos[n].y;
+
+        if ( glyph_bbox.xMin &lt; bbox.xMin )
+          bbox.xMin = glyph_bbox.xMin;
+
+        if ( glyph_bbox.yMin &lt; bbox.yMin )
+          bbox.yMin = glyph_bbox.yMin;
+
+        if ( glyph_bbox.xMax &gt; bbox.xMax )
+          bbox.xMax = glyph_bbox.xMax;
+
+        if ( glyph_bbox.yMax &gy; bbox.yMax )
+          bbox.yMax = glyph_bbox.yMax;
       }
-   </pre></font>
-
-   <p>The resulting bounding box dimensions can then be used to compute the
-      final pen position before rendering the string as in:</p>
-
-   <font color="blue"><pre>
-      <font color="gray">// compute string dimensions in integer pixels</font>
-      string_width  = (string_bbox.xMax - string_bbox.xMin)/64;
-      string_height = (string_bbox.yMax - string_bbox.yMin)/64;
-   
-      <font color="gray">// compute start pen position in 26.6 cartesian pixels</font>
-      start_x = (( my_target_width  - string_width )/2)*64;
-      start_y = (( my_target_height - string_height)/2)*64;
-      
-      for ( n = 0; n &lt; num_glyphs; n++ )
+
+      /* check that we really grew the string bbox */
+      if ( bbox.xMin > bbox.xMax )
       {
-        FT_Glyph  image;
-        FT_Vector pen;
-        
-        image = glyphs[n];
-        
-        pen.x = start_x + pos[n].x;
-        pen.y = start_y + pos[n].y;
-        
-        error = FT_Glyph_To_Bitmap( &image, ft_render_mode_normal,
-                                    &pen.x, 0 );
-        if (!error)
-        {
-          FT_BitmapGlyph  bit = (FT_BitmapGlyph)image;
-          
-          my_draw_bitmap( bitmap->bitmap,
-                          bitmap->left,
-                          my_target_height - bitmap->top );
-                          
-          FT_Done_Glyph( image );
-        }
+        bbox.xMin = 0;
+        bbox.yMin = 0;
+        bbox.xMax = 0;
+        bbox.yMax = 0;
       }
-   </pre></font>
-   
-   <p>You'll take note that:</p>
-   
-   <ul>
-     <li><p>
-       The pen position is expressed in the cartesian space (i.e. Y upwards).
-     </p></li>
-     
-     <li><p>
-       We call <tt><b>FT_Glyph_To_Bitmap</b></tt> with the <tt>destroy</tt>
-       parameter set to 0 (false), in order to avoid destroying the original
-       glyph image. The new glyph bitmap is accessed through <tt>image</tt>
-       after the call and is typecasted to a <tt>FT_BitmapGlyph</tt>.
-     </p></li>
-     
-     <li><p>
-       We use translation when calling <tt>FT_Glyph_To_Bitmap</tt>. This
-       ensures that the <tt><b>left</b></tt> and <tt><b>top</b></tt> fields
-       of the bitmap glyph object are already set to the correct pixel
-       coordinates in the cartesian space.
-     </p></li>
-     
-     <li><p>
-       Of course, we still need to convert pixel coordinates from cartesian
-       to device space before rendering, hence the <tt>my_target_height -
-       bitmap->top</tt> in the call to <tt>my_draw_bitmap</tt>.
-     </p></li>
-     
-   </ul>
-   
-   <p>The same loop can be used to render the string anywhere on our display
-      surface, without the need to reload our glyph images each time.. We
-      could also decide to implement word wrapping, and only draw</p>
 
-  <hr>
-  <h3>
-    5. Advanced text rendering:  transform + centering + kerning:
-  </h3>
-
-  <p>We are now going to modify our code in order to be able to easily
-     transform the rendered string, for example to rotate it. We will
-     start by performing a few minor improvements:</p>
-
-  <h4>a. packing & translating glyphs:</h4>
-  
-  <p>We'll start by packing the information related to a single glyph image
-     into a single structure, instead of parallel arrays. We thus define the
-     following structure type:</p>
-     
-  <font color="blue"><pre>
-     typedef struct TGlyph_
-     {
-       FT_UInt    index;    <font color="gray">// glyph index</font>
-       FT_Vector  pos;      <font color="gray">// glyph origin on the baseline</font>
-       FT_Glyph   image;    <font color="gray">// glyph image</font>
-     
-     } TGlyph, *PGlyph;
-  </pre></font>
-
-  <p>We will also translate each glyph image directly after it is loaded
-     to its position on the baseline at load time. As we'll see, this
-     as several advantages. Our glyph sequence loader thus becomes:</p>
-
-   <font color="blue"><pre>
-      FT_GlyphSlot  slot = face->glyph;  <font color="gray">// a small shortcut</font>
-      FT_UInt       glyph_index;
-      FT_Bool       use_kerning;
-      FT_UInt       previous;
-      int           pen_x, pen_y, n;
-      
-      TGlyph        glyphs[ MAX_GLYPHS ];   <font color="gray">// glyphs table</font>
-      PGlyph        glyph;                  <font color="gray">// current glyph in table</font>
-      FT_UInt       num_glyphs;
-
-      .. initialise library ..
-      .. create face object ..
-      .. set character size ..
-      
-      pen_x = 0;   <font color="gray">/* start at (0,0) !! */</font>
-      pen_y = 0;
-      
-      num_glyphs  = 0;
-      use_kerning = FT_HAS_KERNING(face);
-      previous    = 0;
-
-      glyph = glyphs;      
-      for ( n = 0; n &lt; num_chars; n++ )
+      /* return string bbox */
+      *abbox = bbox;
+    }</pre>
+      </font>
+
+      <p>The resulting bounding box dimensions can then be used to compute
+      the final pen position before rendering the string as in:</p>
+
+      <font color="blue">
+      <pre>
+    /* compute string dimensions in integer pixels */
+    string_width  = ( string_bbox.xMax - string_bbox.xMin ) / 64;
+    string_height = ( string_bbox.yMax - string_bbox.yMin ) / 64;
+
+    /* compute start pen position in 26.6 cartesian pixels */
+    start_x = ( ( my_target_width  - string_width  ) / 2 ) * 64;
+    start_y = ( ( my_target_height - string_height ) / 2 ) * 64;
+
+    for ( n = 0; n &lt; num_glyphs; n++ )
+    {
+      FT_Glyph  image;
+      FT_Vector pen;
+
+
+      image = glyphs[n];
+
+      pen.x = start_x + pos[n].x;
+      pen.y = start_y + pos[n].y;
+
+      error = FT_Glyph_To_Bitmap( &amp;image, ft_render_mode_normal,
+                                  &amp;pen.x, 0 );
+      if ( !error )
       {
-        glyph->index = FT_Get_Char_Index( face, text[n] );
-        
-        if ( use_kerning && previous && glyph->index )
-        {
-          FT_Vector  delta;
-          
-          FT_Get_Kerning( face, previous, glyph->index,
-                          ft_kerning_mode_default, &delta );
-                          
-          pen_x += delta.x >> 6;
-        }
-      
-        <font color="gray">// store current pen position</font>
-        glyph->pos.x = pen_x;
-        glyph->pos.y = pen_y;
-      
-        error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
-        if (error) continue;
-        
-        error = FT_Get_Glyph( face->glyph, &glyph->image );
-        if (error) continue;
-        
-        <font color="gray">// translate the glyph image now..</font>
-        FT_Glyph_Transform( glyph->image, 0, &glyph->pos );
-        
-        pen_x   += slot->advance.x >> 6;
-        previous = glyph->index
-        
-        <font color="gray">// increment number of glyphs</font>
-        glyph++;
+        FT_BitmapGlyph  bit = (FT_BitmapGlyph)image;
+
+
+        my_draw_bitmap( bitmap->bitmap,
+                        bitmap->left,
+                        my_target_height - bitmap->top );
+
+        FT_Done_Glyph( image );
       }
-      <font color="gray">// count number of glyphs loaded..</font>
-      num_glyphs = glyph - glyphs;
-   </pre></font>   
+    }</pre>
+      </font>
+
+      <p>Some remarks:</p>
+
+      <ul>
+        <li>
+          The pen position is expressed in the cartesian space (i.e.
+          Y&nbsp;upwards).
+        </li>
+        <li>
+          We call <tt>FT_Glyph_To_Bitmap()</tt> with the <tt>destroy</tt>
+          parameter set to&nbsp;0 (false), in order to avoid destroying the
+          original glyph image.  The new glyph bitmap is accessed through
+          <tt>image</tt> after the call and is typecasted to a
+          <tt>FT_BitmapGlyph</tt>.
+        </li>
+        <li>
+          We use translation when calling <tt>FT_Glyph_To_Bitmap()</tt>.
+          This ensures that the <tt>left</tt> and <tt>top</tt> fields of the
+          bitmap glyph object are already set to the correct pixel
+          coordinates in the cartesian space.
+        </li>
+        <li>
+          Of course, we still need to convert pixel coordinates from
+          cartesian to device space before rendering, hence the
+          <tt>my_target_height - bitmap->top</tt> in the call to
+          <tt>my_draw_bitmap()</tt>.
+        </li>
+      </ul>
+
+      <p>The same loop can be used to render the string anywhere on our
+      display surface, without the need to reload our glyph images each
+      time.</p>
+
+    <hr>
+
+    <h3>
+      5. Advanced text rendering: transformation + centering + kerning
+    </h3>
+
+    <p>We are now going to modify our code in order to be able to easily
+    transform the rendered string, for example to rotate it.  We will start
+    by performing a few minor improvements:</p>
+
+      <h4>
+        a. packing & translating glyphs
+      </h4>
+
+      <p>We start by packing the information related to a single glyph image
+      into a single structure instead of parallel arrays.  We thus define
+      the following structure type:</p>
+
+      <font color="blue">
+      <pre>
+    typedef struct  TGlyph_
+    {
+      FT_UInt    index;    /* glyph index                  */
+      FT_Vector  pos;      /* glyph origin on the baseline */
+      FT_Glyph   image;    /* glyph image                  */
+
+     } TGlyph, *PGlyph;</pre>
+      </font>
+
+      <p>We will also translate each glyph image directly after it is loaded
+      to its position on the baseline at load time, which has several
+      advantages.  Our glyph sequence loader thus becomes:</p>
+
+      <font color="blue">
+      <pre>
+    FT_GlyphSlot  slot = face->glyph;  /* a small shortcut */
+    FT_UInt       glyph_index;
+    FT_Bool       use_kerning;
+    FT_UInt       previous;
+    int           pen_x, pen_y, n;
+
+    TGlyph        glyphs[MAX_GLYPHS];  /* glyphs table           */
+    PGlyph        glyph;               /* current glyph in table */
+    FT_UInt       num_glyphs;
 
-   <p>Note that translating glyphs now has several advantages. The first
-      one, is that we don't need to translate the glyph bbox when we compute
-      the string's bounding box. The code becomes:</p>
 
-   <font color="blue"><pre>
-      void   compute_string_bbox( FT_BBox  *abbox )
+    .. initialize library ..
+    .. create face object ..
+    .. set character size ..
+
+    pen_x = 0;   /* start at (0,0)! */
+    pen_y = 0;
+
+    num_glyphs  = 0;
+    use_kerning = FT_HAS_KERNING( face );
+    previous    = 0;
+
+    glyph = glyphs;
+    for ( n = 0; n &lt; num_chars; n++ )
+    {
+      glyph->index = FT_Get_Char_Index( face, text[n] );
+
+      if ( use_kerning && previous && glyph->index )
       {
-        FT_BBox  bbox;
-        
-        bbox.xMin = bbox.yMin =  32000;
-        bbox.xMax = bbox.yMax = -32000;
-        
-        for ( n = 0; n &lt; num_glyphs; n++ )
-        {
-          FT_BBox   glyph_bbox;
-
-          FT_Glyph_Get_CBox( glyphs[n], &glyph_bbox );
-
-          if (glyph_bbox.xMin &lt; bbox.xMin)
-            bbox.xMin = glyph_bbox.xMin;
-
-          if (glyph_bbox.yMin &lt; bbox.yMin)
-            bbox.yMin = glyph_bbox.yMin;
-
-          if (glyph_bbox.xMax &gt; bbox.xMax)
-            bbox.xMax = glyph_bbox.xMax;
-
-          if (glyph_bbox.yMax &gy; bbox.yMax)
-            bbox.yMax = glyph_bbox.yMax;
-        }
-        
-        if ( bbox.xMin > bbox.xMax )
-        {
-          bbox.xMin = 0;
-          bbox.yMin = 0;
-          bbox.xMax = 0;
-          bbox.yMax = 0;
-        }
-        
-        *abbox = bbox;
+        FT_Vector  delta;
+
+
+        FT_Get_Kerning( face, previous, glyph->index,
+                        ft_kerning_mode_default, &amp;delta );
+
+        pen_x += delta.x >> 6;
       }
-   </pre></font>
-
-   <p>Now take a closer look, the <tt>compute_string_bbox</tt> can now
-      compute the bounding box of a transformed glyph string. For example,
-      we can do something like:</p>
-   
-   <pre><font color="blue">
-      FT_BBox    bbox;
-      FT_Matrix  matrix;
-      FT_Vector  delta;
-   
-      ... load glyph sequence
-      
-      ... setup "matrix" and "delta"
-      
-      <font color="gray">// transform glyphs</font>
-      for ( n = 0; n &lt; num_glyphs; n++ )
-        FT_Glyph_Transform( glyphs[n].image, &matrix, &delta );
-      
-      <font color="gray">// compute bounding box of transformed glyphs</font>
-      compute_string_bbox( &bbox );
-   </font></pre>
-
-  <h4>
-    b. Rendering a transformed glyph sequence:
-  </h4>
-  
-  <p>However, directly transforming the glyphs in our sequence is not an idea
-     if we want to re-use them in order to draw the text string with various
-     angles or transforms. It's better to perform the affine transformation
-     just before the glyph is rendered, as in the following code:</p>
-     
-   <font color="blue"><pre>
-      FT_Vector  start;
-      FT_Matrix  transform;
-   
-      <font color="gray">// get bbox of original glyph sequence</font>
-      compute_string_bbox( &string_bbox );
-   
-      <font color="gray">// compute string dimensions in integer pixels</font>
-      string_width  = (string_bbox.xMax - string_bbox.xMin)/64;
-      string_height = (string_bbox.yMax - string_bbox.yMin)/64;
-   
-      <font color="gray">// set up start position in 26.6 cartesian space</font>
-      start.x = (( my_target_width  - string_width )/2)*64;
-      start.y = (( my_target_height - string_height)/2)*64;
-      
-      <font color="gray">// set up transform (a rotation here)</font>
-      matrix.xx = (FT_Fixed)( cos(angle)*0x10000);
-      matrix.xy = (FT_Fixed)(-sin(angle)*0x10000);
-      matrix.yx = (FT_Fixed)( sin(angle)*0x10000);
-      matrix.yy = (FT_Fixed)( cos(angle)*0x10000);
-      
+
+      /* store current pen position */
+      glyph->pos.x = pen_x;
+      glyph->pos.y = pen_y;
+
+      error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
+      if ( error ) continue;
+
+      error = FT_Get_Glyph( face->glyph, &glyph->image );
+      if ( error ) continue;
+
+      /* translate the glyph image now */
+      FT_Glyph_Transform( glyph->image, 0, &glyph->pos );
+
+      pen_x   += slot->advance.x >> 6;
+      previous = glyph->index
+
+      /* increment number of glyphs */
+      glyph++;
+    }
+
+    /* count number of glyphs loaded */
+    num_glyphs = glyph - glyphs;</pre>
+      </font>
+
+      <p>Translating glyphs now has several advantages, as mentioned
+      earlier.  The first one is that we don't need to translate the glyph
+      bounding box when we compute the string's bounding box.  The code
+      becomes:</p>
+
+      <font color="blue">
+      <pre>
+    void  compute_string_bbox( FT_BBox*  abbox )
+    {
+      FT_BBox  bbox;
+
+
+      bbox.xMin = bbox.yMin =  32000;
+      bbox.xMax = bbox.yMax = -32000;
+
       for ( n = 0; n &lt; num_glyphs; n++ )
       {
-        FT_Glyph  image;
-        FT_Vector pen;
-        FT_BBox   bbox;
-        
-        <font color="gray">// create a copy of the original glyph</font>
-        error = FT_Glyph_Copy( glyphs[n].image, &image );
-        if (error) continue;
-
-        <font color="gray">// transform copy (this will also translate it to the correct
-        // position</font>
-        FT_Glyph_Transform( image, &matrix, &start );
-        
-        <font color="gray">// check bounding box, if the transformed glyph image
-        // is not in our target surface, we can avoid rendering it</font>
-        FT_Glyph_Get_CBox( image, ft_glyph_bbox_pixels, &bbox );
-        if ( bbox.xMax &lt;= 0 || bbox.xMin >= my_target_width  ||
-             bbox.yMax &lt;= 0 || bbox.yMin >= my_target_height )
-          continue;
-        
-        <font color="gray">// convert glyph image to bitmap (destroy the glyph copy !!)
-        //</font>
-        error = FT_Glyph_To_Bitmap( &image,
-                                    ft_render_mode_normal,
-                                    0,      <font color="gray">// no additional translation</font>
-                                    1 );    <font color="gray">// destroy copy in "image"</font>
-        if (!error)
-        {
-          FT_BitmapGlyph  bit = (FT_BitmapGlyph)image;
-          
-          my_draw_bitmap( bitmap->bitmap,
-                          bitmap->left,
-                          my_target_height - bitmap->top );
-                          
-          FT_Done_Glyph( image );
-        }
+        FT_BBox  glyph_bbox;
+
+
+        FT_Glyph_Get_CBox( glyphs[n], &amp;glyph_bbox );
+
+        if ( glyph_bbox.xMin &lt; bbox.xMin )
+          bbox.xMin = glyph_bbox.xMin;
+
+        if ( glyph_bbox.yMin &lt; bbox.yMin )
+          bbox.yMin = glyph_bbox.yMin;
+
+        if ( glyph_bbox.xMax &gt; bbox.xMax )
+          bbox.xMax = glyph_bbox.xMax;
+
+        if ( glyph_bbox.yMax &gy; bbox.yMax )
+          bbox.yMax = glyph_bbox.yMax;
       }
-   </pre></font>
 
-   <p>You'll notice a few changes compared to the original version of this
+      if ( bbox.xMin > bbox.xMax )
+      {
+        bbox.xMin = 0;
+        bbox.yMin = 0;
+        bbox.xMax = 0;
+        bbox.yMax = 0;
+      }
+
+      *abbox = bbox;
+    }</pre>
+      </font>
+
+      <p><tt>compute_string_bbox()</tt> can now compute the bounding box of
+      a transformed glyph string.  For example, we can do something
+      like</p>
+
+      <font color="blue">
+      <pre>
+    FT_BBox    bbox;
+    FT_Matrix  matrix;
+    FT_Vector  delta;
+
+
+    ... load glyph sequence
+
+    ... setup "matrix" and "delta"
+
+    /* transform glyphs */
+    for ( n = 0; n &lt; num_glyphs; n++ )
+      FT_Glyph_Transform( glyphs[n].image, &amp;matrix, &amp;delta );
+
+    /* compute bounding box of transformed glyphs */
+    compute_string_bbox( &amp;bbox );</pre>
+      </font>
+
+      <h4>
+        b. Rendering a transformed glyph sequence
+      </h4>
+
+      <p>However, directly transforming the glyphs in our sequence is not a
+      useful idea if we want to re-use them in order to draw the text string
+      with various angles or transforms.  It is better to perform the affine
+      transformation just before the glyph is rendered, as in the following
       code:</p>
-      
-   <ul>
-     <li><p>
-       We keep the original glyph images untouched, by transforming a
-       copy.
-     </p></li>
-     
-     <li><p>
-       We perform clipping computations, in order to avoid rendering &
-       drawing glyphs that are not within our target surface
-     </p></li>
-     
-     <li><p>
-       We always destroy the copy when calling <tt>FT_Glyph_To_Bitmap</tt>
-       in order to get rid of the transformed scalable image. Note that
-       the image is destroyed even when the function returns an error
-       code (which is why <tt>FT_Done_Glyph</tt> is only called within
-       the compound statement.
-     </p></li>
-     
-     <li><p>
-       The translation of the glyph sequence to the start pen position is
-       integrated in the call to <tt>FT_Glyph_Transform</tt> intead of
-       <tt>FT_Glyph_To_Bitmap</tt>.
-     </p></li>
-  </ul>
 
-  <p>It's possible to call this function several times to render the string
-     width different angles, or even change the way "start" is computed in
-     order to move it to different place.</p>
-
-  <p>This code is the basis of the FreeType 2 demonstration program
-     named"<tt>ftstring.c</tt>". It could be easily extended to perform
-     advanced text layout or word-wrapping in the first part, without
-     changing the second one.</p>
-     
-  <p>Note however that a normal implementation would use a glyph cache in
-     order to reduce memory needs. For example, let's assume that our text
-     string is "FreeType". We would store three identical glyph images in
-     our table for the letter "e", which isn't optimal (especially when you
-     consider longer lines of text, or even whole pages..).
-  </p>
+      <font color="blue">
+      <pre>
+    FT_Vector  start;
+    FT_Matrix  transform;
+
+
+    /* get bbox of original glyph sequence */
+    compute_string_bbox( &amp;string_bbox );
+
+    /* compute string dimensions in integer pixels */
+    string_width  = ( string_bbox.xMax - string_bbox.xMin ) / 64;
+    string_height = ( string_bbox.yMax - string_bbox.yMin ) / 64;
+
+    /* set up start position in 26.6 cartesian space */
+    start.x = ( ( my_target_width  - string_width  ) / 2 ) * 64;
+    start.y = ( ( my_target_height - string_height ) / 2 ) * 64;
+
+    /* set up transformation (a rotation here) */
+    matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L );
+    matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L );
+    matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L );
+    matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L );
+
+    for ( n = 0; n &lt; num_glyphs; n++ )
+    {
+      FT_Glyph  image;
+      FT_Vector pen;
+      FT_BBox   bbox;
+
+
+      /* create a copy of the original glyph */
+      error = FT_Glyph_Copy( glyphs[n].image, &amp;image );
+      if ( error ) continue;
+
+      /* transform copy (this will also translate it to the */
+      /* correct position                                   */
+      FT_Glyph_Transform( image, &amp;matrix, &amp;start );
+
+      /* check bounding box -- if the transformed glyph image */
+      /* is not in our target surface, we can avoid rendering */
+      FT_Glyph_Get_CBox( image, ft_glyph_bbox_pixels, &amp;bbox );
+      if ( bbox.xMax &lt;= 0 || bbox.xMin >= my_target_width  ||
+           bbox.yMax &lt;= 0 || bbox.yMin >= my_target_height )
+        continue;
+
+      /* convert glyph image to bitmap (destroy the glyph */
+      /* copy!)                                           */
+      error = FT_Glyph_To_Bitmap(
+                &amp;image,
+                ft_render_mode_normal,
+                0,                /* no additional translation */
+                1 );              /* destroy copy in "image"   */
+      if ( !error )
+      {
+        FT_BitmapGlyph  bit = (FT_BitmapGlyph)image;
 
-  <hr>
-    
-  <h3>
-    6. Accessing metrics in design font units, and scaling them:
-  </h3>
-
-  <p>Scalable font formats usually store a single vectorial image, called
-     an "outline", for each in a face. Each outline is defined in an abstract
-     grid called the "design space", with coordinates expressed in nominal
-     "font units". When a glyph image is loaded, the font driver usually
-     scales the outline to device space according to the current character
-     pixel size found in a <tt>FT_Size</tt> object. The driver may also
-     modify the scaled outline in order to significantly improve its
-     appearance on a pixel-based surface (a process known as "hinting"
-     or "grid-fitting").</p>
-     
-  <p>This chapter describes how design coordinates are scaled to device
-     space, and how to read glyph outlines and metrics in font units. This
-     is important for a number of things:</p>
-     
-  <ul>
-    <li><p>
-      In order to perform "true" WYSIWYG text layout
-    </p></li>
-    
-    <li><p>
-      In order to access font content for conversion or analysis purposes
-    </p></li>
-  </ul>
 
-  <h4>a.Scaling distances to device space:</h4>
-  
-  <p>Design coordinates are scaled to device space using a simple scaling
-     transform, whose coefficients are computed with the help of the
-     <em><b>character pixel size</b></em>:</p>
-     
-  <pre><font color="purple">
-     device_x = design_x * x_scale
-     device_y = design_y * y_scale
-
-     x_scale  = pixel_size_x / EM_size
-     y_scale  = pixel_size_y / EM_size
-  </font></pre>
-
-  <p>Here, the value <b><tt>EM_size</tt></b> is font-specific and correspond
-     to the size of an abstract square of the design space (called the "EM"),
-     which is used by font designers to create glyph images. It is thus
-     expressed in font units. It is also accessible directly for scalable
-     font formats as <tt><b>face->units_per_EM</b></tt>. You should
-     check that a font face contains scalable glyph images by using the
-     <tt><b>FT_IS_SCALABLE(face)</b></tt> macro, which returns true when
-     appropriate.</p>
-
-  <p>When you call the function <tt><b>FT_Set_Pixel_Sizes</b></tt>, you're
-     specifying the value of <tt>pixel_size_x</tt> and <tt>pixel_size_y</tt>
-     you want to use to FreeType, which will immediately compute the values
-     of <tt>x_scale</tt> and <tt>y_scale</tt>.</p>
-
-  <p>When you call the function <tt><b>FT_Set_Char_Size</b></tt>, you're
-     specifying the character size in physical "points", which is used,
-     along with the device's resolutions, to compute the character pixel
-     size, then the scaling factors.</p>
-
-  <p>Note that after calling any of these two functions, you can access
-     the values of the character pixel size and scaling factors as fields
-     of the <tt><b>face->size->metrics</b></tt> structure. These fields are:</p>
-     
-  <center>
-  <table width="80%" cellpadding="5"><tr valign=top><td>
-  <b><tt>x_ppem</t></b>
-  </td><td>
-  <p>Which stands for "X Pixels Per EM", this is the size in integer pixels
-  of the EM square, which also is the <em>horizontal character pixel size</em>,
-  called <tt>pixel_size_x</tt> in the above example.</p>
-  </td></tr><tr valign=top><td>
-  <b><tt>y_ppem</tt></b>
-  </td><td>
-  <p>Which stands for "Y Pixels Per EM", this is the size in integer pixels
-  of the EM square, which also is the <em>vertical character pixel size</em>,
-  called <tt>pixel_size_y</tt> in the above example.</p>
-  </td></tr><tr valign=top><td>
-  <b><tt>x_scale</tt></b>
-  </td><td>
-  <p>This is a 16.16 fixed float scale that is used to directly
-  scale horizontal distances from design space to 1/64th of device pixels.
-  </p>
-  </td></tr><tr valign=top><td>
-  <b><tt>y_scale</tt></b>
-  </td><td>
-  <p>This is a 16.16 fixed float scale that is used to directly scale
-  vertical distances from design space to 1/64th of device pixels.</p>
-  </td></tr>
-  </table>
-  </center>
-
-  <p>Basically, this means that you can scale a distance expressed in
-     font units to 26.6 pixels directly with the help of the <tt>FT_MulFix</tt>
-     function, as in:</p>
-     
-  <pre><font color="blue">
-      <font color="gray">// convert design distances to 1/64th of pixels
-      //</font>
-      pixels_x = FT_MulFix( design_x, face->size->metrics.x_scale );
-      pixels_y = FT_MulFix( design_y, face->size->metrics.y_scale );
-  </font></pre>
-  
-  <p>However, you can also scale the value directly with more accuracy
-     by using doubles and the equations:</p>
-     
-  <pre><font color="blue">
-      FT_Size_Metrics*  metrics = &face->size->metrics;    // shortcut
-      double            pixels_x, pixels_y;
-      double            em_size, x_scale, y_scale;
-
-      <font color="gray">// compute floating point scale factors
-      //</font>
-      em_size = 1.0 * face->units_per_EM;
-      x_scale = metrics->x_ppem / em_size;
-      y_scale = metrics->y_ppem / em_size;
-      
-      <font color="gray">// convert design distances to floating point pixels
-      //</font>
-      pixels_x = design_x * x_scale;
-      pixels_y = design_y * y_scale;
-  </font></pre>
-  
-  <h4>
-    b. Accessing design metrics (glyph & global):
-  </h4>
-  
-  <p>You can access glyph metrics in font units simply by specifying the
-     <tt><b>FT_LOAD_NO_SCALE</b></tt> bit flag in <tt>FT_Load_Glyph</tt>
-     or <tt>FT_Load_Char</tt>. The metrics returned in
-     <tt>face->glyph->metrics</tt> will all be in font units.</p>
-  
-  <p>You can access unscaled kerning data using the
-     <tt><b>ft_kerning_mode_unscaled</b></tt> mode</p>
-
-  <p>Finally, a few global metrics are available directly in font units
-     as fields of the <tt>FT_Face</tt> handle, as described in chapter 3
-     of this section.</p>
-     
-  <hr>
-  
-  <h3>
-    Conclusion
-  </h3>
-  
-  <p>This is the end of the second section of the FreeType 2 tutorial,
-     you're now able to access glyph metrics, manage glyph images, and
-     render text much more intelligently (kerning, measuring, transforming
-     & caching).</p>
-  
-  <p>You have now sufficient knowledge to build a pretty decent text service
-     on top of FreeType 2, and you could possibly stop there if you want.</p>
-  
-  <p>The next section will deal with FreeType 2 internals (like modules,
-     vector outlines, font drivers, renderers), as well as a few font format
-     specific issues (mainly, how to access certain TrueType or Type 1 tables).
-     </p>
+        my_draw_bitmap( bitmap->bitmap,
+                        bitmap->left,
+                        my_target_height - bitmap->top );
+
+        FT_Done_Glyph( image );
+      }
+    }</pre>
+      </font>
+
+      <p>There are a few changes compared to the previous version of this
+      code:</p>
+
+      <ul>
+        <li>
+          We keep the original glyph images untouched, by transforming a
+          copy.
+        </li>
+        <li>
+          We perform clipping computations in order to avoid rendering &
+          drawing glyphs that are not within our target surface.
+        </li>
+        <li>
+          We always destroy the copy when calling
+          <tt>FT_Glyph_To_Bitmap()</tt> in order to get rid of the
+          transformed scalable image.  Note that the image is destroyed even
+          when the function returns an error code (which is why
+          <tt>FT_Done_Glyph()</tt> is only called within the compound
+          statement).
+        </li>
+        <li>
+          The translation of the glyph sequence to the start pen position is
+          integrated in the call to <tt>FT_Glyph_Transform()</tt> intead of
+          <tt>FT_Glyph_To_Bitmap()</tt>.
+        </li>
+      </ul>
+
+      <p>It is possible to call this function several times to render the
+      string width different angles, or even change the way <tt>start</tt>
+      is computed in order to move it to different place.</p>
+
+      <p>This code is the basis of the FreeType&nbsp;2 demonstration program
+      named <tt>ftstring.c</tt>.  It could be easily extended to perform
+      advanced text layout or word-wrapping in the first part, without
+      changing the second one.</p>
+
+      <p>Note however that a normal implementation would use a glyph cache
+      in order to reduce memory consumption.  For example, let us assume
+      that our text string to render is "FreeType".  We would store three
+      identical glyph images in our table for the letter "e", which isn't
+      optimal (especially when you consider longer lines of text, or even
+      whole pages).</p>
+
+    <hr>
+
+    <h3>
+      6. Accessing metrics in design font units, and scaling them
+    </h3>
+
+    <p>Scalable font formats usually store a single vectorial image, called
+    an <em>outline</em>, for each in a face.  Each outline is defined in an
+    abstract grid called the <em>design space</em>, with coordinates
+    expressed in nominal <em>font units</em>.  When a glyph image is loaded,
+    the font driver usually scales the outline to device space according to
+    the current character pixel size found in a <tt>FT_Size</tt> object.
+    The driver may also modify the scaled outline in order to significantly
+    improve its appearance on a pixel-based surface (a process known as
+    <em>hinting</em> or <em>grid-fitting</em>).</p>
+
+    <p>This section describes how design coordinates are scaled to device
+    space, and how to read glyph outlines and metrics in font units.  This
+    is important for a number of things:</p>
+
+    <ul>
+      <li>
+        <p>to perform "true" WYSIWYG text layout.</p>
+      </li>
+      <li>
+        <p>to access font data for conversion or analysis purposes</p>
+      </li>
+    </ul>
+
+      <h4>
+        a. Scaling distances to device space
+      </h4>
+
+      <p>Design coordinates are scaled to device space using a simple
+      scaling transformation whose coefficients are computed with the help
+      of the <em>character pixel size</em>:</p>
+
+      <font color="purple">
+      <pre>
+    device_x = design_x * x_scale
+    device_y = design_y * y_scale
+
+    x_scale  = pixel_size_x / EM_size
+    y_scale  = pixel_size_y / EM_size</pre>
+      </font>
+
+      <p>Here, the value <tt>EM_size</tt> is font-specific and corresponds
+      to the size of an abstract square of the design space (called the
+      "EM"), which is used by font designers to create glyph images.  It is
+      thus expressed in font units.  It is also accessible directly for
+      scalable font formats as <tt>face->units_per_EM</tt>.  You should
+      check that a font face contains scalable glyph images by using the
+      <tt>FT_IS_SCALABLE(face)</tt> macro, which returns true when the font
+      is scalable.</p>
+
+      <p>When you call the function <tt>FT_Set_Pixel_Sizes()</tt>, you are
+      specifying the value of <tt>pixel_size_x</tt> and
+      <tt>pixel_size_y</tt>; FreeType will then immediately compute the
+      values of <tt>x_scale</tt> and <tt>y_scale</tt>.</p>
+
+      <p>When you call the function <tt>FT_Set_Char_Size()</tt>, you are
+      specifying the character size in physical "points", which is used,
+      along with the device's resolutions, to compute the character pixel
+      size, then the scaling factors.</p>
+
+      <p>Note that after calling any of these two functions, you can access
+      the values of the character pixel size and scaling factors as fields
+      of the <tt>face->size->metrics</tt> structure.  These fields are:</p>
+
+      <center>
+      <table width="90%" cellpadding="5">
+      <tr valign=top>
+        <td>
+          <tt>x_ppem</t>
+        </td>
+        <td>
+          Which stands for "X Pixels Per EM"; this is the size in integer
+          pixels of the EM square, which also is the <em>horizontal
+          character pixel size</em>, called <tt>pixel_size_x</tt> in the
+          above example.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>y_ppem</tt>
+        </td>
+        <td>
+          Which stands for "Y Pixels Per EM"; this is the size in integer
+          pixels of the EM square, which also is the <em>vertical character
+          pixel size</em>, called <tt>pixel_size_y</tt> in the above
+          example.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>x_scale</tt>
+        </td>
+        <td>
+          This is a 16.16 fixed float scale that is used to directly scale
+          horizontal distances from design space to 1/64th of device pixels.
+        </td>
+      </tr>
+      <tr valign=top>
+        <td>
+          <tt>y_scale</tt>
+        </td>
+        <td>
+          This is a 16.16 fixed float scale that is used to directly scale
+          vertical distances from design space to 1/64th of device pixels.
+        </td>
+      </tr>
+      </table>
+      </center>
+
+      <p>Basically, this means that you can scale a distance expressed in
+      font units to 26.6 pixels directly with the help of the
+      <tt>FT_MulFix()</tt> function, as in:</p>
+
+      <font color="blue">
+      <pre>
+    /* convert design distances to 1/64th of pixels */
+    pixels_x = FT_MulFix( design_x, face->size->metrics.x_scale );
+    pixels_y = FT_MulFix( design_y, face->size->metrics.y_scale );</pre>
+      </font>
+
+      <p>However, you can also scale the value directly with more accuracy
+      by using doubles and the equations:</p>
+
+      <font color="blue">
+      <pre>
+    FT_Size_Metrics*  metrics = &face->size->metrics;  /* shortcut */
+    double            pixels_x, pixels_y;
+    double            em_size, x_scale, y_scale;
+
+
+    /* compute floating point scale factors */
+    em_size = 1.0 * face->units_per_EM;
+    x_scale = metrics->x_ppem / em_size;
+    y_scale = metrics->y_ppem / em_size;
+
+    /* convert design distances to floating point pixels */
+    pixels_x = design_x * x_scale;
+    pixels_y = design_y * y_scale;</pre>
+      </font>
+
+      <h4>
+        b. Accessing design metrics (glyph & global)
+      </h4>
+
+      <p>You can access glyph metrics in font units simply by specifying the
+      <tt>FT_LOAD_NO_SCALE</tt> bit flag in <tt>FT_Load_Glyph()</tt> or
+      <tt>FT_Load_Char()</tt>.  The metrics returned in
+      <tt>face->glyph->metrics</tt> will then all be in font units.</p>
+
+      <p>You can access unscaled kerning data using the
+      <tt>ft_kerning_mode_unscaled</tt> mode.</p>
+
+      <p>Finally, a few global metrics are available directly in font units
+      as fields of the <tt>FT_Face</tt> handle, as described in
+      section&nbsp;3 of this tutorial part.</p>
+
+    <hr>
+
+    <h3>
+      Conclusion
+    </h3>
+
+    <p>This is the end of the second part of the FreeType&nbsp;2 tutorial;
+    you are now able to access glyph metrics, manage glyph images, and
+    render text much more intelligently (kerning, measuring, transforming
+    & caching).</p>
+
+    <p>You have now sufficient knowledge to build a pretty decent text
+    service on top of FreeType&nbsp;2, and you could possibly stop there if
+    you want.</p>
+
+    <p>The next section will deal with FreeType&nbsp;2 internals (like
+    modules, vector outlines, font drivers, renderers), as well as a few
+    font format specific issues (mainly, how to access certain TrueType or
+    Type&nbsp;1 tables).</p>
 </td></tr>
 </table>
 </center>