removed obsolete documentation files they are now moved to the "www" module, under "www/freetype2/docs"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911
diff --git a/docs/cache/cache.txt b/docs/cache/cache.txt
deleted file mode 100644
index 4c51948..0000000
--- a/docs/cache/cache.txt
+++ /dev/null
@@ -1,267 +0,0 @@
- The FreeType 2 cache sub-system explained
- (c) 2000 David Turner
-
- -----------------------------------------------
-
-Introduction :
---------------
-
- this document describes the caching sub-system that comes
- with the FreeType library, version 2.0. Note that unlike
- the rest of the library, this code is still in beta stage
- and might still suffer slight changes in the future.
-
- Its basic design shouldn't evolve though and is explained
- in this paper.
-
-
-I. Requirements and Design Goals:
----------------------------------
-
- The FT2 cache sub-system was designed to implement caching
- of glyph images. However, it is extremely flexible and can
- be easily extended to cache other kind of data like metrics,
- character maps, coverage tables, etc..
-
-
-II. Base Concepts:
-------------------
-
- 1. The cache manager object:
-
- at the heart of the caching sub-system is a single object
- called the "cache manager". It is used to deal with FT_Face
- and FT_Size objects, as well as to manager a LRU list of
- abstract "cache nodes".
-
- a. caching FT_Face and FT_Size objects:
-
- each FT_Face object created by FreeType 2 can take from
- a few hundred bytes to several tens of kilobytes, depending
- on the original font's file format as well as its content.
-
- there is no easy way to compute the size of a given FT_Face
- object, so it's always a good idea to assume that it is
- large and to want to limit the number of live face objects
- as much as possible.
-
- similarly, each FT_Face can have one or more FT_Size childs,
- whose byte size depends heavily on the font format.
-
- the first purpose of the cache manager is to provide a
- small cache for FT_Face and FT_Size objects. Basically,
- an application can use it as follows:
-
- - each font face is described to the cache manager
- through a typeless pointer, called a FTC_FaceID.
-
- the cache manager itself doesn't interpret or use
- the value of FTC_FaceIDs directly. Rather, it passes
- them to a user-provided function called a
- "face requester". see the defintion of the
- FTC_Face_Requester type in <freetype/ftcache.h>
- for details..
-
- the face requester is in charge of translating a given
- face into into a real new FT_Face object that is
- returned to the cache manager. The latter will keep
- the face object alive as long as it needs to.
-
- the face requester is unique and must be passed
- to the function named FTC_Manager_New used to
- create/initialise a new cache manager.
-
-
- - to lookup a given FT_Face, call the function
- FTC_Manager_Lookup_Face as in the following code:
-
- FTC_Manager_Lookup_Face( manager,
- face_id,
- &face );
-
- if the corresponding FT_Face object is kept in
- the cache manager's list, it will be returned
- directly. Otherwise, this function will call
- the user-provided face requester to create
- a new FT_Face object, add it to the manager's
- list to finally return it.
-
- FT_Face objects are always destroyed by the cache
- manager. An application that uses the cache
- sub-system should never call FT_Done_Face !!
-
- - to lookup a given FT_Size and FT_Face, call the
- function FTC_Manager_Lookup_Size, as in:
-
- FTC_Manager_Lookup_Size( manager,
- ftc_font,
- &face,
- &size );
-
- where "ftc_font" is a pointer to a FTC_Font descriptor
- (a structure containing a FTC_FaceIDs and character
- dimensions corresponding to the desired FT_Size).
-
- note that the function returns both a FT_Face and
- a FT_Size object. You don't need to call
- FTC_Manager_Lookup_Face before it !!
-
- also note that returned FT_Size objects are always
- destroyed by the cache manager. A client application
- that uses it should never call FT_Done_Size !!
-
-
- the big advantage of using FTC_FaceIDs is that is
- makes the caching sub-system completely independent
- of the way font files are installed / listed / managed
- in your application. In most implementations, a FTC_FaceID
- is really a pointer to an application-specific structure
- that describe the source font file + face index.
-
-
- b - manage a MRU list of abstract "cache nodes":
-
- the second role of the cache manager is to hold and manager
- a list of abstract "cache nodes". The list is always sorted
- in most-recently-used order. The manager always ensure that
- the total size of nodes in memory doesn't over-reach a
- certain threshold, by eliminating "old" nodes when
- necessary.
-
- the cache manager doesn't know much about the cache nodes:
-
- - it knows how to move them in its list
- - it knows how to destroy them when they're too old
- - it knows how to "size" them (i.e. compute their byte
- size in memory)
-
-
- 2. Cache objects:
-
- the cache manager doesn't create new cache nodes however, this
- is the charge of what are called "cache objects".
-
- Basically, each cache object is in charge of managing cache
- nodes of a certain type. Its role is to:
-
- - provide a simple description of its cache nodes to the
- manager (i.e. through a FTC_CacheNode_Class structure)
-
- - provide a high-level API that can be called by client
- applications to lookup cache nodes of the corresponding
- type.
-
- this function usually creates new nodes when they're not
- available yet.
-
- - also, and even though this is completely transparent to
- the applications and the cache manager, each cache object
- manages "node sets", where each set contains cache nodes
- usually correspond to the same font face + font size.
-
-
- For example, the cache sub-system currently comes with two
- distinct cache classes:
-
- - a FTC_Image_Cache, which is used to cache FT_Glyph images
- (with one FT_Glyph per cache node).
-
-
- - a FTC_SBit_Cache, which is used to cache small glyph bitmaps
- ("sbit" means "embedded bitmaps" in digital typography).
-
-
- the small bitmaps glyph is useful because storing one glyph
- image per cache node isn't memory efficient when the data
- associated to each node is very small. Indeed, each cache
- node has a minimal size of 20 bytes, which is huge when
- your data is an 8x8 monochrome bitmap :-)
-
- Hence, a FTC_SBit_Cache is capable of storing several
- contiguous sbits in a single cache node, resulting in much
- higher cached glyphs / total cache size.
-
- an application can lookup a FT_Glyph image with a FTC_Image_Cache
- by calling:
-
- error = FTC_Image_Cache_Lookup( image_cache,
- ftc_font,
- glyph_index,
- &ft_glyph );
-
- or a FTC_SBit (small bitmap descriptor) by calling:
-
- error = FTC_SBit_Cache_Lookup( sbit_cache,
- ftc_font,
- glyph_index,
- &ftc_sbit );
-
-III. Extending the cache sub-system:
-
- It is possible to extend the current cache sub-system by
- providing your own cache class and register it in the cache
- manager. That might be useful to cache other kind of data
- in the sub-system, like glyph metrics (without images),
-
- To do it, you'll need to read the cache sub-system public
- header files rather heavily :-) Fortunately, they're pretty
- well commented and should guide you to your goal.
-
- Note that the cache sub-system already provides two "abstract
- cache" classes that can be re-used by your own implementation:
-
-
- 1. The abstract "FTC_GlyphCache" class:
-
- this code is used to implement an abstract "glyph cache",
- i.e. one that simply maps one glyph data per cache node.
-
- it is sub-classed by FTC_Image_Cache, whose implementation
- only consists in simple code to store a FT_Glyph in each
- cache node.
-
- you could sub-class it in your application to store glyph
- images in a different format, for example.
-
- see the files <freetype/cache/ftcglyph.h> and
- "src/cache/ftcglyph.h" for details.
-
-
- 2. The abstract "FTC_ChunkCache" class:
-
- this code is used to implement an abstract "glyph chunk cache".
- it's very similar to a FTC_GlyphCache, except that it is capable
- of storing several glyph-specific elements per cache node.
-
- it is sub-classed by FTC_SBit_Cache, whose implementation
- only consists in code to store a FTC_SBitRec record in each
- node element.
-
- you could sub-class it in your application to store small
- glyph data, like metrics, glyph names, wathever.
-
- see the files <freetype/cache/ftcchunk.h> and
- "src/cache/ftcchunk.h" for details..
-
-
- Note that the two abstract caches are rather complex because
- they use "glyph sets". Each glyph set corresponds to a single
- font face + font size combination. both caches are also
- glyph-specific, though it is perfectly possible to use
- broader selection criterion, here are a few examples:
-
- - caching language coverage maps corresponding to
- a given font face + language combination
-
- - caching charmaps, layout tables, and other global
- data..
-
- - caching (font_face + font_size) specific "latin1"
- ascender + descender
-
-
- as you can see, a lot is possible with this design :-)
-
-
-
-
diff --git a/docs/convntns.txt b/docs/convntns.txt
deleted file mode 100644
index 0841383..0000000
--- a/docs/convntns.txt
+++ /dev/null
@@ -1,710 +0,0 @@
-
- Conventions and Design in the FreeType 2 library
- ------------------------------------------------
-
-
-Table of Contents
-
-Introduction
-
-I. Style and Formatting
-
- 1. Naming
- 2. Declarations & Statements
- 3. Blocks
- 4. Macros
- 5. Conventions
-
-II. Design conventions
-
- 1. Modularity and Components Layout
- 2. Configuration and Debugging
-
-III. Usage conventions
-
- 1. Error handling
- 2. Font File I/O
- 3. Memory management
- 4. Support for threaded environments
- 5. Object Management
-
-
-
-Introduction
-============
-
-This text introduces the many conventions used within the FreeType 2
-library code. Please read it before trying any modifications or
-extensions of the source code.
-
-
-
-I. Style and Formatting
-=======================
-
-The following coding rules are extremely important to keep the
-library's source code homogeneously. Keep in mind the following
-points:
-
- - `Humans read source code, not machines' (Donald Knuth)
-
- The library source code should be as readable as possible, even
- by non-C experts. With `readable', two things are meant: First,
- the source code should be pleasant to the eye, with sufficient
- whitespace and newlines, to not look like a boring stack of
- characters stuck to each other. Second, the source should be
- _expressive_ enough about its goals. This convention contains
- rules that can help the source focus on its purpose, not on a
- particular implementation.
-
- - `Paper is the _ultimate_ debugger' (David Turner :-)
-
- There is nothing like sheets of paper (and a large floor) to
- help you understand the design of a library you're new to, or to
- debug it. The formatting style presented here is targeted at
- printing. For example, it is more than highly recommended to
- never produce a source line that is wider than 78 columns. More
- on this below.
-
-
-1. Naming
----------
-
- a. Long and expressive labels
-
- Never hesitate to use long labels for your types, variables,
- etc.! Except maybe for things like very trivial types, the
- longest is the best, as it increases the source's
- _expressiveness_. Never forget that the role of a label is to
- express the `function' of the entity it represents, not its
- implementation!
-
- NOTE: Hungarian notation is NOT expressive, as it sticks the
- `type' of a variable to its name. A label like `usFoo'
- rarely tells the use of the variable it represents.
-
- And the state of a variable (global, static, dynamic)
- isn't helpful anymore.
-
- Conclusion: Avoid Hungarian Notation in FreeType 2.
-
-
- When forging a name with several nouns
- (e.g. `number-of-points'), use an uppercase letter for the first
- letter of each word (except the first), like:
-
- numberOfPoints
-
- You are also welcome to introduce underscores `_' in your
- labels, especially when sticking large nouns together, as it
- `airs' the code greatly. E.g.:
-
- `numberOfPoints' or `number_Of_Points'
-
- `IncredibleFunction' or `Incredible_Function'
-
- And finally, always put a capital letter after an underscore,
- except in variable labels that are all lowercase:
-
- `number_of_points' is OK for a variable (_all_ lowercase label)
-
- `incredible_function' is NOT for a function!
- ^ ^
-
- `Microsoft_windows' is a *shame*!
- ^ ^
-
- `Microsoft_Windows' isn't really better, but at least its a
- ^ ^ correct function label within this
- convention ;-)
-
- b. Data types
-
- Try to use C types to the very least! Rely on internally
- defined equivalent types instead. For example, not all
- compilers agree on the sign of `char'; the size of `int' is
- platform-specific, etc.
-
- There are equivalents to the most common types in the
- `fttypes.h' public header file, like `FT_Short', `FT_UShort',
- etc. Using the internal types will guarantee that you won't
- need to replace every occurence of `short' or whatever when
- compiling on a weird platform or with a weird compiler, and
- there are many more than you could think of...
-
- c. Functions
-
- The name of a function should always begin with a capital
- letter, as lowercase first letters are reserved for variables.
- The name of a function should be, again, _expressive_! Never
- hesitate to put long function names in your code: It will make
- the code much more readable.
-
- Expressiveness doesn't necessarily imply lengthiness though; for
- instance, reading various data types from a file stream is
- performed using the following functions defined in the
- `ftstream.c' file of the `base' module:
-
- FT_Get_Char(), FT_Get_Short(), FT_Get_Long(), etc.
-
- Which is somewhat more readable than:
-
- cget, sget, usget, lget, etc.
-
- d. Variables
-
- Variable names (at least meant for the public interface) should
- always begin with a lowercase letter. Lowercase first letters
- are reserved for variables in this convention, as it has been
- already explained above. You are still welcome to use long and
- expressive variable names.
-
- Something like `numP' can express a number of pixels, porks,
- pancakes, and much more... Something like `num_points' won't.
-
- Unfortunately (mostly due to the lazyness of the developers),
- short variable names are still used in many parts of the
- library. Volunteers are highly welcome to improve this...
-
- As a side note, a field name of a structure counts as a variable
- name too.
-
-
-2. Declarations & Statements
-----------------------------
-
- Try to align declarations and assignments in columns, if it proves
- logically. For example (taken from `ttraster.c'):
-
- struct TProfile_
- {
- FT_F26Dot6 X; /* current coordinate during sweep */
- PProfile link; /* link to next profile - various purpose */
- PLong offset; /* start of profile's data in render pool */
- Int flow; /* profile orientation: asc/descending */
- Long height; /* profile's height in scanlines */
- Long start; /* profile's starting scanline */
-
- UShort countL; /* number of lines to step before this */
- /* profile becomes drawable */
-
- PProfile next; /* next profile in same contour, used */
- /* during drop-out control */
- };
-
- instead of
-
- struct TProfile_
- {
- FT_F26Dot6 X; /* current coordinate during sweep */
- PProfile link; /* link to next profile - various purpose */
- PLong offset; /* start of profile's data in render pool */
- Int flow; /* profile orientation: asc/descending */
- Long height; /* profile's height in scanlines */
- Long start; /* profile's starting scanline */
- UShort countL; /* number of lines to step before this */
- /* profile becomes drawable */
- PProfile next; /* next profile in same contour, used */
- /* during drop-out control */
- };
-
- This comes from the fact that you are more interested in the field
- and its function than in its type.
-
- Or:
-
- x = i + 1;
- y += j;
- min = 100;
-
- instead of
-
- x=i+1;
- y+=j;
- min=100;
-
- And don't hesitate to separate blocks of declarations with
- newlines to `distinguish' logical sections.
-
- E.g., taken from an old source file, in the declarations of the
- CMap loader:
-
- long n, num_SH;
- unsigned short u;
- long off;
- unsigned short l;
- long num_Seg;
- unsigned short* glArray;
- long table_start;
- int limit, i;
-
- TCMapDir cmap_dir;
- TCMapDirEntry entry_;
- PCMapTable Plcmt;
- PCMap2SubHeader Plcmsub;
- PCMap4 Plcm4;
- PCMap4Segment segments;
-
- instead of
-
- long n, num_SH;
- unsigned short u;
- long off;
- unsigned short l;
- long num_Seg;
- unsigned short *glArray;
- long table_start;
- int limit, i;
- TCMapDir cmap_dir;
- TCMapDirEntry entry_;
- PCMapTable Plcmt;
- PCMap2SubHeader Plcmsub;
- PCMap4 Plcm4;
- PCMap4Segment segments;
-
-
-3. Blocks
----------
-
- Block separation is done with `{' and `}'. We do not use the K&R
- convention which becomes only useful with an extensive use of
- tabs. The `{' and its corresponding `}' should always be on the
- same column. It makes it easier to separate a block from the rest
- of the source, and it helps your _brain_ associate the accolades
- easily (ask any Lisp programmer on the topic!).
-
- Use two spaces for the next indentation level.
-
- Never use tabs in FreeType 2 code; their widths may vary with
- editors and systems.
-
- Example:
-
- if (condition_test) {
- waow mamma;
- I'm doing K&R format;
- just like the Linux kernel;
- } else {
- This test failed poorly;
- }
-
- should be rather formatted as
-
- if ( condition_test )
- {
- This code isn't stuck to the condition;
- read it on paper, you will find it more;
- pleasant to the eye;
- }
- else
- {
- Of course, this is a matter of taste;
- This is just the way it is in this convention;
- and you should follow it to be homogenuous with;
- the rest of the FreeType code;
- }
-
-
-4. Macros
----------
-
- Macros should be made of uppercase letters. If a macro label is
- forged from several words, it is possible to only uppercasify the
- first word, using an underscore to separate the nouns. This is
- used in in some files for macros like
-
- GET_UShort(), USE_Stream(), etc.
-
- The role of macros used throughout the engine is explained later
- in this document.
-
-
-5. Conventions
---------------
-
- Currently, FreeType 2 source code uses the following formatting
- rules:
-
- . The data type is separated with two spaces from the variable,
- structure, or function name:
-
- const char foo;
-
- Usually, the `*' operator is concatenated to the data type:
-
- FT_Int* pointer;
-
- However, when declaring resp. defining an `output' parameter
- (i.e. a pointer which will be assigned by the function), the
- last `*' must be placed on the right in order to denote this, as
- in:
-
- FT_New_Face( FT_Library library,
- FT_Face *aface );
-
- where the `*' is used to indicate that `aface' is returned. In
- most cases, the name of such an output variable starts with `a'
- or `an' (`aface' instead of `face', `anlru' instead of `lru',
- etc.), following the English rules of the indefinite article.
-
- . As mentioned above, multiple declarations are vertically
- aligned:
-
- FT_Short foo;
- FT_Long bar;
- FT_GlyphSlot slot;
-
- . Declarations are separated with two blank lines from the
- following code. This intentionally disturbs the code flow to
- make variable definitions more visible.
-
- {
- char x, y;
-
-
- x = 3;
- y = 5;
- }
-
- . An opening parenthesis follows a function directly without
- space; after a built-in C keyword, one space is used:
-
- x = sin( y );
- y = sizeof ( long );
-
- Except for casts, empty parameters, and the closing semicolon,
- parentheses are surrounded with space:
-
- x = (char*)( foo + bar );
- y = rand();
-
- . Binary operators are surrounded by spaces; unary operators have
- no space after it:
-
- x = ( 3 + 4 ) / ( 7 - 2 );
- y = -( 3 + 4 ) * 7;
-
- . Array arguments are not surrounded by spaces:
-
- array[3] = array[1] + array[2];
- array[4] = array[1 + 3];
-
- . Comma and semicolon have only space at the right side:
-
- if ( x = 0; x < y; x++, y-- )
- do_something();
-
- Exception:
-
- for (;;)
- {
- ...
-
- . Don't use
-
- if ( x == y ) a = b;
-
- but
-
- if ( x == y )
- a = b;
-
- in general.
-
- . Preprocessor directives are never indented and always start in
- the first column.
-
- . All function/structure/variable definitions start at column
- three.
-
- . All full-line comments (except the header of a file) start at
- column three (even comments for preprocessor directives).
-
- . Labels are sticking out two positions to the left:
-
- switch ( x )
- {
- case 1:
- do_something();
- break;
- default:
- do_nothing();
- break;
- }
-
-
-
-II. Design Conventions
-======================
-
-
-1. Modularity and Components Layout
------------------------------------
-
- The FreeType 2 engine has been designed with portability in mind.
- This implies the ability to compile and run it on a great variety
- of systems and weird environments, unlike many packages where the
- word strictly means `runs on a bunch of Unix-like systems'. We
- have thus decided to stick to the following restrictions:
-
- - The C version is written entirely in ANSI C.
-
- - The library, if compiled with gcc, doesn't produce any warning
- with the `-ansi -pedantic' flags. Other compilers with better
- checks may produce ANSI warnings -- please report.
-
- (NOTE: It can of course be compiled by an `average' C compiler,
- and even by a C++ one.)
-
- - It only requires in its simplest form an ANSI libc to compile,
- and no utilities other than a C preprocessor, compiler, and
- linker.
-
- - It consists of modules, starting with a `base' module which
- provides the API, some auxiliary modules used by the font
- drivers, the font driver modules itself, and the rasterizer
- modules.
-
- - The very low-level components can be easily replaced by
- system-specific ones that do not rely on the standard libc.
- These components deal mainly with i/o, memory, and mutex
- operations.
-
- - A client application only needs to include one header file named
- `freetype.h' to use the engine. Other public header files like
- `ftglyph.h' or `ftimage.h' provide functional extensions.
-
- - All configuration options are gathered in two files,
- `ftconfig.h' and `ftoption.h'. The former contains the
- processor and OS specific configuration options, while the
- latter treats options that may be enabled or disabled by the
- user to enable and disable various features.
-
-
-2. Configuration and Debugging
-------------------------------
-
- Configuration is covered by the `BUILD' documentation file.
-
- Debugging is controlled by two macros in `ftoption.h',
- FT_DEBUG_LEVEL_ERROR and FT_DEBUG_LEVEL_TRACE; don't use them in
- code to be released. Check the source code of the `ftview.c'
- demonstration program (in the `ft2demos' package) how tracing can
- be used and activated.
-
-
-
-III. Usage conventions
-======================
-
-
-1. Error Handling
------------------
-
- Most functions directly return an error code. A return value of 0
- (FT_Err_Ok) means that no error occured, while a non-zero other
- value indicates a failure of any kind.
-
- We use code like this in FreeType 2:
-
- if ( ( rc = Perform_Action_1( parms_of_1 ) ) ||
- ( rc = Perform_Action_2( parms_of_2 ) ) ||
- ( rc = Perform_Action_3( parms_of_3 ) ) )
- goto Fail;
-
- which is better but uses assignments within expressions, which are
- always delicate to manipulate in C (the risk of writing `=='
- exists, and would go unnoticed by a compiler). Moreover, the
- assignments are a bit redundant and don't express much things
- about the actions performed (they only speak of the error
- management issue).
-
- That is why some macros have been defined for the most frequently
- used functions. They relate to low-level routines that are called
- very often (mainly i/o and memory handling functions). Each macro
- produces an implicit assignment to a variable called `error' and
- can be used instead as a simple function call. Example:
-
- if ( PERFORM_Action_1( parms_of_1 ) ||
- PERFORM_Action_2( parms_of_2 ) ||
- PERFORM_Action_3( parms_of_3 ) )
- goto Fail;
-
- with
-
- #define PERFORM_Action_1( parms_1 ) \
- ( error = Perform_Action_1( parms_1 ) )
- #define PERFORM_Action_2( parms_1 ) \
- ( error = Perform_Action_2( parms_1 ) )
- #define PERFORM_Action_3( parms_1 ) \
- ( error = Perform_Action_3( parms_1 ) )
-
- defined in some header file.
-
- There, the developer only needs to define a local `error' variable
- and use the macros directly in the code, without caring about the
- actual error handling performed. Another advantage is that the
- structure of source files remain very similar, even though the
- error handling may be different.
-
- This convention is very close to the use of exceptions in
- languages like C++, Pascal, Java, etc. where the developer
- focuses on the actions to perform, and not on every little error
- checking.
-
-
-2. Font File I/O
-----------------
-
- a. Streams
-
- The engine uses `streams' to access the font files. A stream is
- a structure containing information used to access files through
- a system-specific i/o library.
-
- The default implementation of streams uses the ANSI libc i/o
- functions. However, for the sake of embedding in light systems
- and independence of a complete C library, it is possible to
- re-implement the component for a specific system or OS, letting
- it use system calls.
-
- b. Frames
-
- TrueType is tied to the big-endian format, which implies that
- reading shorts or longs from the font file may need conversions
- depending on the target processor. To be able to easily detect
- read errors and allow simple conversion calls or macros, the
- engine is able to access a font file using `frames'.
-
- A frame is simply a sequence of successive bytes taken from the
- input file at the current position. A frame is pre-loaded into
- memory by a call to the `ACCESS_Frame()' macro.
-
- It is then possible to read all sizes of data through the
- `GET_xxx()' macros described above.
-
- When all important data is read, the frame can be released by a
- call to `FORGET_Frame()'.
-
- The benefits of frames are various. Consider these two
- approaches at extracting values:
-
- if ( ( error = Read_Short( &var1 ) ) ||
- ( error = Read_Long ( &var2 ) ) ||
- ( error = Read_Long ( &var3 ) ) ||
- ( error = Read_Short( &var4 ) ) )
-
- return FAILURE;
-
- and
-
- /* Read the next 16 bytes */
- if ( ACCESS_Frame( 16L ) )
- return error; /* The Frame could not be read */
-
- var1 = GET_Short(); /* extract values from the frame */
- var2 = GET_Long();
- var3 = GET_Long();
- var4 = GET_Short();
-
- FORGET_Frame(); /* release the frame */
-
- In the first case, there are four error assignments with four
- checks of the file read. This unnecessarily increases the size
- of the generated code. Moreover, you must be sure that `var1'
- and `var4' are short variables, `var2' and `var3' long ones, if
- you want to avoid bugs and/or compiler warnings.
-
- In the second case, you perform only one check for the read, and
- exit immediately on failure. Then the values are extracted from
- the frame, as the result of function calls. This means that you
- can use automatic type conversion; there is no problem if
- e.g. `var1' and `var4' are longs, unlike previously.
-
- Finally, frames are ideal when you are using memory-mapped
- files, as the frame is not really `pre-loaded' and never uses
- any `heap' space.
-
- IMPORTANT: You CANNOT nest several frame accesses. There is
- only one frame available at a time for a specific
- instance.
-
- It is also the programmer's responsibility to never
- extract more data than was pre-loaded in the frame!
- (But you usually know how many values you want to
- extract from the file before doing so).
-
-
-3. Memory Management
---------------------
-
- The library now has a component which uses an interface similar to
- malloc()/free().
-
- * FT_Alloc()
-
- To be used like malloc(), except that it returns an error code,
- not an address. Its arguments are the size of the requested
- block and the address of the target pointer to the `fresh'
- block. An error code is returned in case of failure (and this
- will also set the target pointer to NULL), 0 in case of success.
-
- FT_Alloc() internally calls the ft_alloc() function defined in
- an FT_Memory object. All error checking is done by FT_Alloc()
- itself so that ft_alloc() directly calls malloc().
-
- * FT_Realloc()
-
- Similar to FT_Alloc(); it calls realloc() by default.
-
- * FT_Free()
-
- As you may have already guessed, FT_Free() is FT_Alloc()'s
- counterpart. It takes as argument the _target pointer's
- address_! You should _never_ pass the block's address directly,
- i.e. the pointer, to FT_Free().
-
- Similar to FT_Alloc(), FT_Free() does the necessary error
- checking and calls free() by default.
-
- As the pointers addresses needed as arguments are typed `void**',
- ftmemory.h provides some macros to help use the above functions
- more easily, these are:
-
- MEM_Alloc() A version of FT_Alloc() that casts the argument
- pointer to (void**). Similar functions are
- MEM_Alloc_Array(), MEM_Realloc(), and
- MEM_Realloc_Array()
-
- ALLOC() Same as MEM_Alloc(), but with an assignment to a
- variable called `error'. See the section `error
- handling' above for more info on this. Similar
- functions are REALLOC(), ALLOC_ARRAY(), and
- REALLOC_ARRAY().
-
- FREE() A version of FT_Free() that casts the argument
- pointer to (void**).
-
- MEM_Set() An alias for `memset()', which can be easily
- changed to anything else if you wish to use a
- different memory manager than the functions
- provided by the ANSI libc.
-
- MEM_Copy() An alias of `memcpy()' or `bcopy()' used to move
- blocks of memory. You may change it to something
- different if necessary (e.g. not using libc).
-
- MEM_Move() An alias of `memmove().' Change its definition if
- necessary.
-
-
-4. Support for threaded environments
-------------------------------------
-
- Thread synchronisation has been dropped in FreeType 2. The
- library is already re-entrant, and if you really need two threads
- accessing the same FT_Library object, you should synchronize
- access to it yourself with a simple mutex.
-
-
---- end of convntns.txt ---
diff --git a/docs/design/basic-design.png b/docs/design/basic-design.png
deleted file mode 100644
index 5acdccc..0000000
Binary files a/docs/design/basic-design.png and /dev/null differ
diff --git a/docs/design/design-1.html b/docs/design/design-1.html
deleted file mode 100644
index f168b53..0000000
--- a/docs/design/design-1.html
+++ /dev/null
@@ -1,160 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>The design of FreeType 2</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- The design of FreeType 2
-</h1>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
-
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-2.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#ccccee"><td>
- <h1>
- Introduction
- </h1>
- </td></tr>
- </table>
-
- <p>This document provides details on the design and implementation of the
- FreeType 2 library. Its goal is to allow developers to better
- understand the way how FreeType 2 is organized, in order to let them
- extend, customize, and debug it.</p>
-
- <p>Before anything else, it is important to understand the
- <em>purpose</em> of this library, i.e., why it has been written:</p>
-
- <ul>
- <li>
- <p>It allows client applications to <em>access font files easily</em>,
- wherever they could be stored, and as independently of the font format
- as possible.</p>
- </li>
- <li>
- <p>Easy <em>retrieval of global font data</em> most commonly found in
- normal font formats (i.e. global metrics, encoding/charmaps,
- etc.).</p>
- </li>
- <li>
- <p>It allows easy <em>retrieval of individual glyph data</em>
- (metrics, images, name, anything else).</p>
- </li>
- <li>
- <p><em>Access to font format-specific "features"</em> whenever
- possible (e.g. SFNT tables, Multiple Masters, OpenType Layout tables,
- etc.).</p>
- </li>
- </ul>
-
- <p>Its design has also severely been influenced by the following
- requirements:</p>
-
- <ul>
- <li>
- <p><em>High portability</em>. The library must be able to run on any
- kind of environment. This requirement introduces a few drastic
- choices that are part of FreeType 2's low-level system
- interface.</p>
- </li>
- <li>
- <p><em>Extendability</em>. New features should be added with the
- least modifications in the library's code base. This requirement
- induces an extremely simple design where nearly all operations are
- provided by modules.</p>
- </li>
- <li>
- <p><em>Customization</b>. It should be easy to build a version of the
- library that only contains the features needed by a specific project.
- This really is important when you need to integrate it in a font
- server for embedded graphics libraries.</p>
- </li>
- <li>
- <p><em>Compactness</em> and <em>efficiency</em>. The primary target
- for this library are embedded systems with low cpu and memory
- resources.</p>
- </li>
- </ul>
-
- <p>The rest of this document is divided in several sections. First, a few
- chapters will present the library's basic design as well as the
- objects/data managed internally by FreeType 2.</p>
-
- <p>A later section is then dedicated to library customization, relating
- such topics as system-specific interfaces, how to write your own module
- and how to tailor library initialization & compilation to your needs.</p>
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC" valign=center>
- <td align=center
- width="30%">
-
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-3.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/design/design-2.html b/docs/design/design-2.html
deleted file mode 100644
index 39a9ac8..0000000
--- a/docs/design/design-2.html
+++ /dev/null
@@ -1,187 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>The design of FreeType 2</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- The design of FreeType 2
-</h1>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="design-1.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-3.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#ccccee"><td>
- <h1>
- I. Components and APIs
- </h1>
- </td></tr>
- </table>
-
- <p>It's better to describe FreeType 2 as a collection of
- <em>components</em>. Each one of them is a more or less abstract part of
- the library that is in charge of one specific task. We will now explicit
- the connections and relationships between them.</p>
-
- <p>A first brief description of this system of components could be:</p>
-
- <ul>
- <li>
- <p>Client applications typically call the FreeType 2
- <b>high-level API</b>, whose functions are implemented in a single
- component called the <em>Base Layer</em>.</p>
- </li>
- <li>
- <p>Depending on the context or the task, the base layer then calls one
- or more <em>module</em> components to perform the work. In most
- cases, the client application doesn't need to know which module was
- called.</p>
- </li>
- <li>
- <p>The base layer also contains a set of routines that are used for
- generic things like memory allocation, list processing, i/o stream
- parsing, fixed point computation, etc. these functions can also be
- called by a module at any time, and they form what is called the
- <b>low-level base API</b>.</p>
- </li>
- </ul>
-
- <p>This is illustrated by the following graphics (note that component
- entry points are represented as colored triangles):</p>
-
- <center>
- <img src="basic-design.png"
- width="394" height="313"
- alt="Basic FreeType design">
- </center>
-
- <p>Now, a few additional things must be added to complete this
- picture:</p>
-
- <ul>
- <li>
- <p>Some parts of the base layer can be replaced for specific builds of
- the library, and can thus be considered as components themselves.
- This is the case for the <tt>ftsystem</tt> component, which is in
- charge of implementing memory management & input stream access, as
- well as <tt>ftinit</tt>, which is in charge of library initialization
- (i.e. implementing the <tt>FT_Init_FreeType()</tt> function).</p>
- </li>
- <li>
- <p>FreeType 2 comes also with a set of <em>optional
- components</em>, which can be used either as a convenience for client
- applications (e.g. the <tt>ftglyph</tt> component, used to provide a
- simple API to manage glyph images independently of their internal
- representation), or to access format-specific features (e.g. the
- <tt>ftmm</tt> component used to access and manage Multiple Masters
- data in Type 1 fonts).</p>
- </li>
- <li>
- <p>Finally, a module is capable of calling functions provided by
- another module. This is very useful to share code and tables between
- several font driver modules (for example, the <tt>truetype</tt> and
- <tt>cff</tt> modules both use the routines provided by the
- <tt>sfnt</tt> module).</p>
- </li>
- </ul>
-
- <p>Hence, a more complete picture would be:</p>
-
- <center>
- <img src="detailed-design.png"
- width="390" height="429"
- alt="Detailed FreeType design">
- </center>
-
- <p>Please take note of the following important points:</p>
-
- <ul>
- <li>
- <p>An optional component can use either the high-level or base API.
- This is the case of <tt>ftglyph</tt> in the above picture.</p>
- </li>
- <li>
- <p>Some optional components can use module-specific interfaces ignored
- by the base layer. In the above example, <tt>ftmm</tt> directly
- accesses the Type 1 module to set/query data.</p>
- </li>
- <li>
- <p>A replacable component can provide a function of the high-level
- API. For example, <tt>ftinit</tt> provides
- <tt>FT_Init_FreeType()</tt> to client applications.</p>
- </li>
- </ul>
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC" valign=center>
- <td align=center
- width="30%">
- <a href="design-1.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-3.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/design/design-3.html b/docs/design/design-3.html
deleted file mode 100644
index 947fcce..0000000
--- a/docs/design/design-3.html
+++ /dev/null
@@ -1,353 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>The design of FreeType 2</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- The design of FreeType 2
-</h1>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="design-2.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-4.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#ccccee"><td>
- <h1>
- II. Public Objects and Classes
- </h1>
- </td></tr>
- </table>
-
- <p>We will now explain the abstractions provided by FreeType 2 to
- client applications to manage font files and data. As you would normally
- expect, these are implemented through objects/classes.</p>
-
- <h2>
- 1. Object Orientation in FreeType 2
- </h2>
-
- <p>Though written in ANSI C, the library employs a few techniques,
- inherited from object-oriented programming, to make it easy to extend.
- Hence, the following conventions apply in the FreeType 2 source
- code:</p>
-
- <ol>
- <li>
- <p>Each object type/class has a corresponding <em>structure
- type</em> <b>and</b> a corresponding <em>structure pointer
- type</em>. The latter is called the <em>handle type</em> for the
- type/class.</p>
-
- <p>Consider that we need to manage objects of type "foo" in
- FreeType 2. We would define the following structure and handle
- types as follows:</p>
-
- <font color="blue"><pre>
- typedef struct FT_FooRec_* FT_Foo;
-
- typedef struct FT_FooRec_
- {
- // fields for the "foo" class
- ...
-
- } FT_FooRec;</pre>
- </font>
-
- <p>As a convention, handle types use simple but meaningful
- identifiers beginning with <tt>FT_</tt>, as in <tt>FT_Foo</tt>,
- while structures use the same name with a <tt>Rec</tt> suffix
- appended to it ("Rec" is short for "record"). <em>Note that each
- class type has a corresponding handle type</em>.</p>
- </li>
- <li>
- <p>Class derivation is achieved internally by wrapping base class
- structures into new ones. As an example, we define a "foobar" class
- that is derived from "foo". We would do something like:</p>
-
- <font color="blue"><pre>
- typedef struct FT_FooBarRec_* FT_FooBar;
-
- typedef struct FT_FooBarRec_
- {
- // the base "foo" class fields
- FT_FooRec root;
-
- // fields proper to the "foobar" class
- ...
- } FT_FooBarRec;</pre>
- </font>
-
- <p>As you can see, we ensure that a "foobar" object is also a "foo"
- object by placing a <tt>FT_FooRec</tt> at the start of the
- <tt>FT_FooBarRec</tt> definition. It is called <b>root</b> by
- convention.</p>
-
- <p>Note that a <tt>FT_FooBar</tt> handle also points to a "foo"
- object and can be typecasted to <tt>FT_Foo</tt>. Similarly, when
- the library returns a <tt>FT_Foo</tt> handle to client applications,
- the object can be really implemented as a <tt>FT_FooBar</tt> or any
- derived class from "foo".</p>
- </li>
- </ol>
-
- <p>In the following sections of this chapter, we will refer to "the
- <tt>FT_Foo</tt> class" to indicate the type of objects handled through
- <tt>FT_Foo</tt> pointers, be they implemented as "foo" or "foobar".</p>
-
- <hr>
-
- <h2>
- 2. The <tt>FT_Library</tt> class
- </h2>
-
- <p>This type corresponds to a handle to a single instance of the
- library. Note that the corresponding structure <tt>FT_LibraryRec</tt>
- is not defined in public header files, making client applications unable
- to access its internal fields.</p>
-
- <p>The library object is the <em>parent</em> of all other objects in
- FreeType 2. You need to create a new library instance before doing
- anything else with the library. Similarly, destroying it will
- automatically destroy all its children (i.e. faces and modules).</p>
-
- <p>Typical client applications should call <tt>FT_Init_FreeType()</tt>
- in order to create a new library object, ready to be used for further
- actions.</p>
-
- <p>Another alternative is to create a fresh new library instance by
- calling the function <tt>FT_New_Library()</tt>, defined in the
- <tt><freetype/ftmodule.h></tt> public header file. This function
- will however return an "empty" library instance with no module
- registered in it. You can "install" modules in the instance by calling
- <tt>FT_Add_Module()</tt> manually.</p>
-
- <p>Calling <tt>FT_Init_FreeType()</tt> is a lot more convenient, because
- this function basically registers a set of default modules into each new
- library instance. The way this list is accessed and/or computed is
- determined at build time, and depends on the content of the
- <tt>ftinit</tt> component. This process is explained in details later
- in this document.</p>
-
- <p>For now, one should consider that library objects are created with
- <tt>FT_Init_FreeType()</tt>, and destroyed along with all children with
- <tt>FT_Done_FreeType()</tt>.</p>
-
- <hr>
-
- <h2>
- 3. The <tt>FT_Face</tt> class
- </h2>
-
- <p>A face object corresponds to a single <em>font face</em>, i.e., a
- specific typeface with a specific style. For example, "Arial" and
- "Arial Italic" correspond to two distinct faces.</p>
-
- <p>A face object is normally created through <tt>FT_New_Face()</tt>.
- This function takes the following parameters: an <tt>FT_Library</tt>
- handle, a C file pathname used to indicate which font file to open, an
- index used to decide which face to load from the file (a single file may
- contain several faces in certain cases), and the address of a
- <tt>FT_Face</tt> handle. It returns an error code:</p>
-
- <font color="blue"><pre>
- FT_Error FT_New_Face( FT_Library library,
- const char* filepathname,
- FT_Long face_index,
- FT_Face* face );</pre>
- </font>
-
- <p>In case of success, the function will return 0, and the handle
- pointed to by the <tt>face</tt> parameter will be set to a non-NULL
- value.</p>
-
- <p>Note that the face object contains several fields used to describe
- global font data that can be accessed directly by client applications.
- For example, the total number of glyphs in the face, the face's family
- name, style name, the EM size for scalable formats, etc. For more
- details, look at the <tt>FT_FaceRec</tt> definition in the
- FreeType 2 API Reference.</p>
-
- <hr>
-
- <h2>
- 4. The <tt>FT_Size</tt> class
- </h2>
-
- <p>Each <tt>FT_Face</tt> object <em>has</em> one or more
- <tt>FT_Size</tt> objects. A <em>size object</em> is used to store data
- specific to a given character width and height. Each newly created face
- object has one size, which is directly accessible as
- <tt>face->size</tt>.</p>
-
- <p>The contents of a size object can be changed by calling either
- <tt>FT_Set_Pixel_Sizes()</tt> or <tt>FT_Set_Char_Size()</tt>.</p>
-
- <p>A new size object can be created with <tt>FT_New_Size()</tt>, and
- destroyed manually with </tt>FT_Done_Size()</tt>. Note that typical
- applications don't need to do this normally: they tend to use the
- default size object provided with each <tt>FT_Face</tt>.</p>
-
- <p>The public fields of <tt>FT_Size</tt> objects are defined in a very
- small structure named <tt>FT_SizeRec</tt>. However, it is important to
- understand that some font drivers define their own derivatives of
- <tt>FT_Size</tt> to store important internal data that is re-computed
- each time the character size changes. Most of the time, these are
- size-specific <em>font hints</em>./p>
-
- <p>For example, the TrueType driver stores the scaled CVT table that
- results from the execution of the "cvt" program in a <tt>TT_Size</tt>
- structure, while the Type 1 driver stores scaled global metrics
- (like blue zones) in a <tt>T1_Size</tt> object. Don't worry if you
- don't understand the current paragraph; most of this stuff is highly
- font format specific and doesn't need to be explained to client
- developers :-)</p>
-
- <hr>
-
- <h2>
- 5. The <tt>FT_GlyphSlot</tt> class
- </h2>
-
- <p>The purpose of a glyph slot is to provide a place where glyph images
- can be loaded one by one easily, independently of the glyph image format
- (bitmap, vector outline, or anything else).</p>
-
- <p>Ideally, once a glyph slot is created, any glyph image can be loaded
- into it without additional memory allocation. In practice, this is only
- possible with certain formats like TrueType which explicitly provide
- data to compute a slot's maximum size.</p>
-
- <p>Another reason for glyph slots is that they are also used to hold
- format-specific hints for a given glyphs as well as all other data
- necessary to correctly load the glyph.</p>
-
- <p>The base <tt>FT_GlyphSlotRec</tt> structure only presents glyph
- metrics and images to client applications, while actual implementation
- may contain more sophisticated data.</p>
-
- <p>As an example, the TrueType-specific <tt>TT_GlyphSlotRec</tt>
- structure contains additional fields to hold glyph-specific bytecode,
- transient outlines used during the hinting process, and a few other
- things.
-
- The Type 1-specific <tt>T1_GlyphSlotRec</tt> structure holds glyph
- hints during glyph loading, as well as additional logic used to properly
- hint the glyphs when a native Type 1 hinter is used.</p>
-
- <p>Finally, each face object has a single glyph slot that is directly
- accessible as <tt>face->glyph</tt>.</p>
-
- <hr>
-
- <h2>
- 6. The <tt>FT_CharMap</tt> class
- </h2>
-
- <p>The <tt>FT_CharMap</tt> type is used as a handle to character map
- objects, or <em>charmaps</em>. A charmap is simply some sort of table
- or dictionary which is used to translate character codes in a given
- encoding into glyph indices for the font.</p>
-
- <p>A single face may contain several charmaps. Each one of them
- corresponds to a given character repertoire, like Unicode, Apple Roman,
- Windows codepages, and other encodings.</p>
-
- <p>Each <tt>FT_CharMap</tt> object contains a "platform" and an
- "encoding" field used to identify precisely the character repertoire
- corresponding to it.</p>
-
- <p>Each font format provides its own derivative of
- <tt>FT_CharMapRec</tt> and thus needs to implement these objects.</p>
-
- <hr>
-
- <h2>
- 7. Objects relationships
- </h2>
-
- <p>The following diagram summarizes what we have just said regarding the
- public objects managed by the library, as well as explicitely describes
- their relationships</p>
-
- <center>
- <img src="simple-model.png"
- width=453 height=378
- alt="Simple library model">
- </center>
-
- <p>Note that this picture will be updated at the end of the next
- chapter, related to <em>internal objects</em>.</p>
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC" valign=center>
- <td align=center
- width="30%">
- <a href="design-2.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-4.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/design/design-4.html b/docs/design/design-4.html
deleted file mode 100644
index 6bdfbb5..0000000
--- a/docs/design/design-4.html
+++ /dev/null
@@ -1,361 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>The design of FreeType 2</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- The design of FreeType 2
-</h1>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="design-3.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-5.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#ccccee"><td>
- <h1>
- III. Internal Objects and Classes
- </h1>
- </td></tr>
- </table>
-
- <p>Let us have a look now at the <em>internal</em> objects that
- FreeType 2 uses, i.e., those not directly available to client
- applications, and see how they fit into the picture.</p>
-
- <h2>
- 1. Memory management
- </h2>
-
- <p>All memory management operations are performed through three specific
- routines of the base layer, namely: <tt>FT_Alloc()</tt>,
- <tt>FT_Realloc()</tt>, and <tt>FT_Free()</tt>. Each one of these
- functions expects a <tt>FT_Memory</tt> handle as its first
- parameter.</p>
-
- <p>The latter is a pointer to a simple object used to describe the
- current memory pool/manager. It contains a simple table of
- alloc/realloc/free functions. A memory manager is created at library
- initialization time by <tt>FT_Init_FreeType()</tt>, calling the function
- <tt>FT_New_Memory()</tt> provided by the <tt>ftsystem</tt>
- component.</p>
-
- <p>By default, this manager uses the ANSI <tt>malloc()</tt>,
- <tt>realloc()</tt>, and <tt>free()</tt> functions. However, as
- <tt>ftsystem</tt> is a replaceable part of the base layer, a specific
- build of the library could provide a different default memory
- manager.</p>
-
- <p>Even with a default build, client applications are still able to
- provide their own memory manager by not calling
- <tt>FT_Init_FreeType()</tt> but follow these simple steps:</p>
-
- <ol>
- <li>
- <p>Create a new <tt>FT_Memory</tt> object by hand. The definition
- of <tt>FT_MemoryRec</tt> is located in the public file
- <tt><freetype/ftsystem.h></tt>.</p>
- </li>
- <li>
- <p>Call <tt>FT_New_Library()</tt> to create a new library instance
- using your custom memory manager. This new library doesn't yet
- contain any registered modules.</p>
- </li>
- <li>
- <p>Register the set of default modules by calling the function
- <tt>FT_Add_Default_Modules()</tt> provided by the <tt>ftinit</tt>
- component, or manually register your drivers by repeatedly
- calling <tt>FT_Add_Module()</tt>.</p>
- </li>
- </ol>
-
- <hr>
-
- <h2>
- 2. Input streams
- </h2>
-
- <p>Font files are always read through <tt>FT_Stream</tt> objects. The
- definition of <tt>FT_StreamRec</tt> is located in the public file
- <tt><freetype/ftsystem.h></tt>, which allows client developers to
- provide their own implementation of streams if they wish so.</p>
-
- <p>The function <tt>FT_New_Face()</tt> will always automatically create
- a new stream object from the C pathname given as its second
- argument. This is achieved by calling the function
- <tt>FT_New_Stream()</tt> provided by the <tt>ftsystem</tt> component.
- As the latter is replaceable, the implementation of streams may vary
- greatly between platforms.</p>
-
- <p>As an example, the default implementation of streams is located in
- the file <tt>src/base/ftsystem.c</tt> and uses the ANSI
- <tt>fopen()</tt>, <tt>fseek()</tt>, and <tt>fread()</tt> calls.
- However, the Unix build of FreeType 2 provides an alternative
- implementation that uses memory-mapped files, when available on the host
- platform, resulting in a significant access speed-up.</p>
-
- <p>FreeType distinguishes between memory-based and disk-based streams.
- In the first case, all data is directly accessed in memory (e.g.
- ROM-based, write-only static data and memory-mapped files), while in the
- second, portions of the font files are read in chunks called
- <em>frames</em>, and temporarily buffered similarly through typical
- seek/read operations.</p>
-
- <p>The FreeType stream sub-system also implements extremely efficient
- algorithms to very quickly load structures from font files while
- ensuring complete safety in the case of a "broken file".</p>
-
- <p>The function <tt>FT_New_Memory_Face()</tt> can be used to directly
- create/open a <tt>FT_Face</tt> object from data that is readily
- available in memory (including ROM-based fonts).</p>
-
- <p>Finally, in the case where a custom input stream is needed, client
- applications can use the function <tt>FT_Open_Face()</tt>, which can
- accept custom input streams. This may be useful in the case of
- compressed or remote font files, or even embedded font files that need
- to be extracted from certain documents.</p>
-
- <p>Note that each face owns a single stream, which is also destroyed by
- <tt>FT_Done_Face()</tt>. Generally speaking, it is certainly
- <em>not</em> a good idea to keep numerous <tt>FT_Face</tt> objects
- opened.</p>
-
- <hr>
-
- <h2>
- 3. Modules
- </h2>
-
- <p>A FreeType 2 module is itself a piece of code. However, the
- library creates a single <tt>FT_Module</tt> object for each module that
- is registered when <tt>FT_Add_Module()</tt> is called.</p>
-
- <p>The definition of <tt>FT_ModuleRec</tt> is not publicly available to
- client applications. However, each <em>module type</em> is described by
- a simple public structure named <tt>FT_Module_Class</tt>, defined in
- <tt><freetype/ftmodule.h></tt>, and is described later in this
- document:</p>
-
- <p>You need a pointer to an <tt>FT_Module_Class</tt> structure when
- calling <tt>FT_Add_Module()</tt>, whose declaration is:</p>
-
- <font color="blue"><pre>
- FT_Error FT_Add_Module( FT_Library library,
- const FT_Module_Class* clazz );</pre>
- </font>
-
- <p>Calling this function will do the following:</p>
-
- <ul>
- <li>
- <p>It will check whether the library already holds a module object
- corresponding to the same module name as the one found in
- <tt>FT_Module_Class</tt>.</p>
- </li>
- <li>
- <p>If this is the case, it will compare the module version number to
- see whether it is possible to <em>upgrade</em> the module to a new
- version. If the module class's version number is smaller than the
- already installed one, the function returns immediately. Similarly,
- it checks that the version of FreeType 2 that is running is
- correct compared to the one required by the module.</p>
- </li>
- <li>
- <p>It creates a new <tt>FT_Module</tt> object, using data and flags
- of the module class to determine its byte size and how to properly
- initialize it.</p>
- </li>
- <li>
- <p>If a module initializer is present in the module class, it will
- be called to complete the module object's initialization.</p>
- </li>
- <li>
- <p>The new module is added to the library's list of "registered"
- modules. In case of an upgrade, the previous module object is
- simply destroyed.</p>
- </li>
- </ul>
-
- <p>Note that this function doesn't return an <tt>FT_Module</tt> handle,
- given that module objects are completely internal to the library (and
- client applications shouldn't normally mess with them :-)</p>
-
- <p>Finally, it is important to understand that FreeType 2
- recognizes and manages several kinds of modules. These will be
- explained in more details later in this document, but we will list for
- now the following types:</p>
-
- <ul>
- <li>
- <p><em>Renderer</em> modules are used to convert native glyph images
- to bitmaps/pixmaps. FreeType 2 comes with two renderer modules
- by default: one to generate monochrome bitmaps, the other to
- generate high-quality anti-aliased pixmaps.</p>
- </li>
- <li>
- <p><em>Font driver</em> modules are used to support one or more font
- formats. Typically, each font driver provides a specific
- implementation/derivative of <tt>FT_Face</tt>, <tt>FT_Size</tt>,
- <tt>FT_GlyphSlot</tt>, as well as <tt>FT_CharMap</tt>.</p>
- </li>
- <li>
- <p><em>Helper</em> modules are shared by several font drivers. For
- example, the <tt>sfnt</tt> module parses and manages tables found in
- SFNT-based font formats; it is then used by both the TrueType and
- OpenType font drivers.</p>
- </li>
- <li>
- <p>Finally, the <em>auto-hinter</em> module has a specific place in
- the library's design, as its role is to process vectorial glyph
- outlines, independently of their native font format, to produce
- optimal results at small pixel sizes.</p>
- </li>
- </ul>
-
- <p>Note that every <tt>FT_Face</tt> object is <em>owned</em> by the
- corresponding font driver, depending on the original font file's format.
- This means that all face objects are destroyed when a module is
- removed/unregistered from a library instance (typically by calling the
- <tt>FT_Remove_Module()</tt> function).</p>
-
- <p><em>Because of this, you should always take care that no
- <tt>FT_Face</tt> object is opened when you upgrade or remove a module
- from a library, as this could cause unexpected object deletion!</em></p>
-
- <hr>
-
- <h2>
- 4. Libraries
- </h2>
-
- <p>We now come back to our well-known <tt>FT_Library</tt> object. From
- what have been said before, we already know that a library instance owns
- at least the following:</p>
-
- <ul>
- <li>
- <p>A memory manager object (<tt>FT_Memory</tt>), used for all
- allocation/releases within the instance.</p>
- </li>
- <li>
- <p>A list of <tt>FT_Module</tt> objects, corresponding to the
- "installed" or "registered" modules of the instance. This list can
- be changed at any time through <tt>FT_Add_Module()</tt> and
- <tt>FT_Remove_Module()</tt>.</p>
- </li>
- <li>
- <p>Remember that face objects are owner by font drivers that are
- themselves modules owned by the library.</p>
- </li>
- </ul>
-
- <p>There is however another object owned by the library instance that
- hasn't been described yet: the <em>raster pool</em>.</p>
-
- <p>The <em>raster pool</em> is simply a block of memory of fixed size
- that is used internally as a "scratch area" for various memory-hungry
- transient operations, avoiding memory allocation. For example, it is
- used by each renderer when converting a vectorial glyph outline into a
- bitmap (actually, that's where its name comes from :-).</p>
-
- <p>The size of the raster pool is fixed at initialisation time (it
- defaults to 16kByte) and cannot be changed at run-time (though we could
- fix this if there is a real need for that).</p>
-
- <p>When a transient operation needs more memory than the pool's size, it
- can decide to either allocate a heap block as an exceptional condition,
- or sub-divide recursively the task to perform in order to never exceed
- the pool's threshold.</p>
-
- <p>This extremely memory-conservative behaviour is certainly one of the
- keys to FreeType's performance in certain areas (most importantly in
- glyph rendering/scanline-conversion).</p>
-
- <hr>
-
- <h2>
- 5. Summary
- </h2>
-
- <p>Finally, the following picture illustrates what has been said in this
- section, as well as the previous, by presenting the complete object
- graph of FreeType 2's base design:</p>
-
- <center>
- <img src="library-model.png"
- width=411 height=405
- alt="Complete library model">
- </center>
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC" valign=center>
- <td align=center
- width="30%">
- <a href="design-3.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-5.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/design/design-5.html b/docs/design/design-5.html
deleted file mode 100644
index 71fa25d..0000000
--- a/docs/design/design-5.html
+++ /dev/null
@@ -1,458 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>The design of FreeType 2</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- The design of FreeType 2
-</h1>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="design-4.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-6.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#ccccee"><td>
- <h1>
- IV. Module Classes
- </h1>
- </td></tr>
- </table>
-
- <p>We will now try to explain more precisely the <em>types</em> of modules
- that FreeType 2 is capable of managing. Note that each one of them
- is decribed with more details in the following chapters of this
- document.</p>
-
- <ul>
- <li>
- <p><em>Renderer</em> modules are used to manage scalable glyph images.
- This means <em>transforming</em> them, computing their <em>bounding
- box</em>, and <em>converting</em> them to either <em>monochrome</em>
- or <em>anti-aliased</em> bitmaps</em>.</p>
-
- <p>Note that FreeType 2 is capable of dealing with <em>any</em>
- kind of glyph images, as long as a renderer module is provided for it.
- The library comes by default with two renderers:</p>
-
- <p><table cellpadding=8>
- <tr valign=top>
- <td>
- <tt>raster</tt>
- </td>
- <td>
- <p>Supports the conversion of vectorial outlines (described by a
- <tt>FT_Outline</tt> object) to <em>monochrome</em> bitmaps.
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>smooth</tt>
- </td>
- <td>
- <p>Supports the conversion of the same outlines to high-quality
- <em>anti-aliased</em> pixmaps (using 256 levels of gray). Note
- that this renderer also supports direct span generation.</p>
- </td>
- </tr>
- </table></p>
-
- <li>
- <p><em>Font driver</em> modules are used to support one or more
- specific font format. By default, FreeType 2 comes with the
- following font drivers:</p>
-
- <p><table cellpadding=8>
- <tr valign=top>
- <td>
- <tt>truetype</tt>
- </td>
- <td>
- <p>supports TrueType font files</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>type1</tt>
- </td>
- <td>
- <p>supports Postscript Type 1 fonts, both in binary
- (<tt>.pfb</tt>) or ASCII (<tt>.pfa</tt>) formats, including
- Multiple Master fonts.</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>cid</tt>
- </td>
- <td>
- <p>supports Postscript CID-keyed fonts</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>cff</tt>
- </td>
- <td>
- <p>supports OpenType, CFF as well as CEF fonts (CEF is a
- derivative of CFF used by Adobe in its SVG viewer)</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>winfonts</tt>
- </td>
- <td>
- <p>supports Windows bitmap fonts (i.e. <tt>.fon</tt> and
- <tt>.fnt</tt>)</p>
- </td>
- </tr>
- </table></p>
-
- <p>Note that font drivers can support bitmapped or scalable glyph
- images. A given font driver that supports Bézier outlines
- through <tt>FT_Outline</tt> can also provide its own hinter, or rely
- on FreeType's <tt>autohinter</tt> module.</p>
- </li>
-
- <li>
- <p><em>Helper</em> modules are used to hold shared code that is often
- used by several font drivers, or even other modules. Here are the
- default helpers:</p>
-
- <p><table cellpadding=8>
- <tr valign=top>
- <td>
- <tt>sfnt</tt>
- </td>
- <td>
- used to support font formats based on the <tt>SFNT</tt> storage
- scheme: TrueType & OpenType fonts as well as other variants (like
- TrueType fonts that only contain embedded bitmaps)
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>psnames</tt>
- </td>
- <td>
- used to provide various useful functions related to glyph names
- ordering and Postscript encodings/charsets. For example, this
- module is capable of automatically synthetizing a Unicode charmap
- from a Type 1 glyph name dictionary.
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>psaux</tt>
- </td>
- <td>
- used to provide various useful functions related to Type 1
- charstring decoding, as this "feature" is needed by the
- <tt>type1</tt>, <tt>cid</tt>, and <tt>cff</tt> drivers.
- </td>
- </tr>
- </table></p>
- </li>
-
- <li>
- <p>Finally, the <em>autohinter</em> module has a specific role in
- FreeType 2, as it can be used automatically during glyph loading
- to process individual glyph outlines when a font driver doesn't
- provide it's own hinting engine.</p>
-
- <p>This module's purpose and design is also heavily described on the
- FreeType web site.</p>
- </li>
- </ul>
-
- <p>We will now study how modules are described, then managed by the
- library.</p>
-
- <h3>
- 1. The <tt>FT_Module_Class</tt> structure
- </h3>
-
- <p>As described later in this document, library initialization is
- performed by calling the <tt>FT_Init_FreeType()</tt> function. The
- latter is in charge of creating a new "empty" <tt>FT_Library</tt>
- object, then register each "default" module by repeatedly calling the
- <tt>FT_Add_Module()</tt> function.</p>
-
- <p>Similarly, client applications can call <tt>FT_Add_Module()</tt> any
- time they wish in order to register a new module in the library. Let us
- take a look at this function's declaration:</p>
-
- <font color="blue"><pre>
- extern FT_Error FT_Add_Module(
- FT_Library library,
- const FT_Module_Class* clazz );</pre>
- </font>
-
- <p>As one can see, this function expects a handle to a library object,
- as well as a pointer to a <tt>FT_Module_Class</tt> structure. It
- returns an error code. In case of success, a new module object is
- created and added to the library. Note by the way that the module isn't
- returned directly by the call!</p>
-
- <p>Here the definition of <tt>FT_Module_Class</tt>, with some
- explanation. The following code is taken from
- <tt><freetype/ftmodule.h></tt>:</p>
-
- <font color="blue"><pre>
- typedef struct FT_Module_Class_
- {
- FT_ULong module_flags;
- FT_Int module_size;
- const FT_String* module_name;
- FT_Fixed module_version;
- FT_Fixed module_requires;
-
- const void* module_interface;
-
- FT_Module_Constructor module_init;
- FT_Module_Destructor module_done;
- FT_Module_Requester get_interface;
-
- } FT_Module_Class;</pre>
- </font>
-
- <p>A description of its fields:</p>
-
- <p><table cellpadding=8>
- <tr valign=top>
- <td>
- <tt>module_flags</tt>
- </td>
- <td>
- <p>A set of bit flags used to describe the module's category. Valid
- values are:</p>
-
- <ul>
- <li>
- <tt>ft_module_font_driver</tt> if the module is a font driver
- </li>
- <li>
- <tt>ft_module_renderer</tt> if the module is a renderer
- </li>
- <li>
- <tt>ft_module_hinter</tt> if the module is an auto-hinter
- </li>
- <li>
- <tt>ft_module_driver_scalable</tt> if the module is a font
- driver supporting scalable glyph formats
- </li>
- <li>
- <tt>ft_module_driver_no_outlines</tt> if the module is a font
- driver supporting scalable glyph formats that <em>cannot</em> be
- described by an <tt>FT_Outline</tt> object
- </li>
- <li>
- <tt>ft_module_driver_has_hinter</tt> if the module is a font
- driver that provides its own hinting scheme/algorithm
- </li>
- </ul>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>module_size</tt>
- </td>
- <td>
- <p>An integer that gives the size in <em>bytes</em> of a given
- module object. This should <em>never</em> be less than
- <tt>sizeof(FT_ModuleRec)</tt>, but can be more if the module needs
- to sub-class the base <tt>FT_ModuleRec</tt> class.</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>module_name</tt>
- </td>
- <td>
- <p>The module's internal name, coded as a simple ASCII
- C string. There can't be two modules with the same name
- registered in a given <tt>FT_Library</tt> object. However,
- <tt>FT_Add_Module()</tt> uses the <tt>module_version</tt> field to
- detect module upgrades and perform them cleanly, even at
- run-time.</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>module_version</tt>
- </td>
- <td>
- <p>A 16.16 fixed float number giving the module's major and minor
- version numbers. It is used to determine whether a module needs to
- be upgraded when calling <tt>FT_Add_Module()</tt>.</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>module_requires</tt>
- </td>
- <td>
- <p>A 16.16 fixed float number giving the version of FreeType 2
- that is required to install this module. The default value is
- 0x20000 for FreeType version 2.0</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>module_requires</tt>
- </td>
- <td>
- <p>Most modules support one or more "interfaces", i.e. tables of
- function pointers. This field is used to point to the module's main
- interface, if there is one. It is a short-cut that prevents users
- of the module to call "get_interface()" each time they need to
- access one of the object's common entry points.</p>
-
- <p>Note that is is optional, and can be set to NULL. Other
- interfaces can also be accessed through the <tt>get_interface()</tt>
- field.</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>module_init</tt>
- </td>
- <td>
- <p>A pointer to a function used to initialize the fields of a fresh
- new <tt>FT_Module</tt> object. It is called <em>after</em> the
- module's base fields have been set by the library, and is generally
- used to initialize the fields of <tt>FT_ModuleRec</tt>
- subclasses.</p>
-
- <p>Most module classes set it to NULL to indicate that no extra
- initialization is necessary.</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>module_done</tt>
- </td>
- <td>
- <p>A pointer to a function used to finalize the fields of a given
- <tt>FT_Module</tt> object. Note that it is called <em>before</em>
- the library unsets the module's base fields, and is generally used
- to finalize the fields of <tt>FT_ModuleRec</tt> subclasses.</p>
-
- <p>Most module classes set it to NULL to indicate that no extra
- finalization is necessary</p>
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>get_interface</tt>
- </td>
- <td>
- <p>A pointer to a function used to request the address of a given
- module interface. Set it to NULL if you don't need to support
- additional interfaces but the main one.</p>
- </td>
- </tr>
- </table></p>
-
-
- <h3>
- 2. The <tt>FT_Module</tt> type
- </h3>
-
- <p>The <tt>FT_Module</tt> type is a handle (i.e. a pointer) to a given
- module object/instance, whose base structure is given by the internal
- <tt>FT_ModuleRec</tt> type. We will intentionally <em>not</em> describe
- this structure here, as there is no point to look so far into the
- library's design.</p>
-
- <p>When <tt>FT_Add_Module</tt> is called, it first allocates a new
- module instance, using the <tt>module_size</tt> class field to determine
- its byte size. The function initializes the root <tt>FT_ModuleRec</tt>
- field, then calls the class-specific initializer <tt>module_init</tt>
- when this field is not set to NULL.</p>
-
- <p>Note that the library defines several sub-classes of
- <tt>FT_ModuleRec</tt>, which are, as you could have guessed:</p>
-
- <ul>
- <li><p><tt>FT_Renderer</tt> for renderer modules</p>
- <li><p><tt>FT_Driver</tt> for font driver modules</p>
- <li><p><tt>FT_AutoHinter</tt> for the auto-hinter</p>
- </ul>
-
- <p>Helper modules use the base <tt>FT_ModuleRec</tt> type. We will
- describe these classes in the next chapters.</p>
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC" valign=center>
- <td align=center
- width="30%">
- <a href="design-4.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="design-6.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/design/design-6.html b/docs/design/design-6.html
deleted file mode 100644
index f7c0a9e..0000000
--- a/docs/design/design-6.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>The design of FreeType 2</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- The design of FreeType 2
-</h1>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="design-5.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
-
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#ccccee"><td>
- <h1>
- TO BE CONTINUED...
- </h1>
- </td></tr>
- </table>
-
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC" valign=center>
- <td align=center
- width="30%">
- <a href=design-5.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
-
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/design/detailed-design.png b/docs/design/detailed-design.png
deleted file mode 100644
index d27f761..0000000
Binary files a/docs/design/detailed-design.png and /dev/null differ
diff --git a/docs/design/index.html b/docs/design/index.html
deleted file mode 100644
index 0270fa8..0000000
--- a/docs/design/index.html
+++ /dev/null
@@ -1,81 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>The design of FreeType 2</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- The design of FreeType 2
-</h1>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-
-<center>
-<table width="70%">
-<tr><td>
-
- <p>This document describes the details of FreeType 2's internals.
- Read this carefully if you need to understand the innards of the library
- in order to hack or extend it.</p>
-
- <table width="100%">
- <tr valign=center
- bgcolor="#CCCCFF">
- <td align=center>
- <h2>
- Table of Contents
- </h2>
- </td>
- </tr>
- </table>
-
- <center>
- <table width="80%">
- <tr><td>
-
- <h2>
- <a href="design-1.html">Introduction</a>
- </h2>
-
- <h2>
- <a href="design-2.html">I. Components and APIs</a>
- </h2>
-
- <h2>
- <a href="design-3.html">II. Public Objects and Classes</a>
- </h2>
-
- <h2>
- <a href="design-4.html">III. Internal Objects and Classes</a>
- </h2>
-
- <h2>
- <a href="design-5.html">IV. Module Classes</a>
- </h2>
-
- </td></tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-</body>
-</html>
diff --git a/docs/design/library-model.png b/docs/design/library-model.png
deleted file mode 100644
index b305458..0000000
Binary files a/docs/design/library-model.png and /dev/null differ
diff --git a/docs/design/modules.html b/docs/design/modules.html
deleted file mode 100644
index fad6e62..0000000
--- a/docs/design/modules.html
+++ /dev/null
@@ -1,639 +0,0 @@
-<html>
-<head><title>FreeType 2 - Modules</title>
-<basefont face="Georgia, Arial, Helvetica, Geneva">
-<style content="text/css">
- P { text-align=justify }
- H1 { text-align=center }
- H2 { text-align=center }
- LI { text-align=justify }
-</style>
-</head>
-<body text=#000000 bgcolor=#ffffff>
-
-<center><table width="500"><tr><td>
-
-<center><h1>FreeType 2 Modules</h1></center>
-
-<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
-<h1>Introduction</h1>
-</td></tr></table>
-
-<p>
-The purpose of this document is to present in great details the way
-FreeType 2 uses and manages modules. Among other things, it answers
-the following questions:</p>
-
-<ul>
- <li><p>
- what is a module, and what kind of modules are recognized
- by the library?
- </p></li>
-
- <li><p>
- how are modules registered and managed by the library?
- </p></li>
-
- <li><p>
- how to write a new module, especially new font drivers?
- </p></li>
-
- <li><p>
- how to select specific modules for a given build of the
- library ?
- </p></li>
-
- <li><p>
- how to compile modules as stand-alone DLLs / shared objects?
- </p></li>
-
-</ul>
-
-<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
-<h1>Overview</h1>
-</td></tr></table>
-
-
-<h3>1. Library design:</h3>
-
-<p>The design of the library is pretty basic:</p>
-<ul>
- <li><p>
- client applications typically call the FreeType 2 high-level
- API, whose functions are implemented in a single component
- called the <em>Base Layer</em>.
- </p></li>
-
- <li><p>
- depending on the context or the task, the base
- layer then calls one or more modules to perform the
- work. In most cases, the client application doesn't
- need to know what module was called.
- </p></li>
-
- <li><p>
- the base layer also contains a set of routines that are
- used for generic things like memory allocation, list
- processing, i/o stream parsing, fixed point computation,
- etc.. these functions can also be called by a module
- at any, and they form what is called the "low-level
- base API".
- </p></li>
-</ul>
-
-<p>This is illustrated by the following graphics:</p>
-
-<center><img src="basic-design.png" width="312" height="312"></center>
-
-<p>Note that, however, FT2 comes with a set of <em>optional</em>
-components that can be ommited from certain builds, and whose
-purpose vary between two situations:</p>
-
-<ul>
- <li><p>
- some are located on top of the high-level API and provide
- convenience functions that make certain things easier
- for typical applications. They typically do not call
- modules directly, though they can use the low level
- base API for certain tasks.</p>
-
- <p>As an example, see the the <tt>ftglyph</tt> component
- that is used to manipulate glyph images more conveniently
- than the default API.</p>
- </p></li>
-
- <li><p>
- some other components complement the base layer, by providing
- additional routines. Most of them allow client applications
- to access format-specific data.</p>
-
- <p>For example, the <tt>ftmm</tt> component provides high-level
- functions to specify Multiple Master coordinates for MM Type 1
- fonts.</p>
- </p></li>
-</ul>
-
-<p>This is illustrated by the following graphics:</p>
-
-<center><img src="detailed-design.png" width="365" height="392"></center>
-
-<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
-<h1>Module Classes</h1>
-</td></tr></table>
-
-<p>
-The library is capable of managing and using several kinds of
-modules:</p>
-
-<ul>
- <li><p>
- <b>renderer</b> modules are used to convert scalable glyph images
- to bitmaps. FreeType 2 comes by default with two of them:</p>
-
- <center><table cellpadding=5><tr valign=top><td>
- <p><b><tt>raster1</tt></b></p>
- </td><td>
- <p>supports the conversion of vectorial outlines (described by a
- <tt>FT_Outline</tt> object) to <em>monochrome</em> bitmaps.
- </td></tr><tr valign=top><td></p>
-
- <p><b><tt>smooth</tt></b></p>
- </td><td>
- <p>supports the conversion of the same outlines to high-quality
- <em>anti-aliased</em> pixmaps.</p>
- </td></tr></table></center>
-
-
- <p>The specification and interface of renderers is described in
- details within this document.</p>
-
- <p>Note that most font formats use <tt>FT_Outline</tt> objects
- to describe scalable glyph images. However, FT2 is flexible
- and allows specific modules to register and support other
- formats. As an example, it's (at least theorically :-) perfectly
- possible to write a renderer module that is capable of directly
- converting MetaFont glyph definitions to bitmaps or pixmaps !
- (of course, this assumes that you also write a MetaFont font
- driver to load the definitions :-).
- </p></li>
-
- <li><p>
- <b>font driver</b> modules are used to support one or more specific
- font format. By default, FT2 comes with the following modules:</p>
-
- <center><table cellpadding=5><tr valign=top><td>
- <p><tt><b>truetype</b></tt></p>
- </td><td>
- <p>supports TrueType font files</p>
- </td></tr><tr valign=top><td>
-
- <p><tt><b>type1</b></tt></p>
- </td><td>
- <p>supports Postscript Type 1 fonts, both in binary (.pfb) or ASCII
- (.pfa) formats, including Multiple Master fonts.</p>
- </td></tr><tr valign=top><td>
-
- <p><tt><b>cid</b></tt></p>
- </td><td>
- <p>supports Postscript CID-keyed fonts</p>
- </td></tr><tr valign=top><td>
-
- <p><tt><b>cff</b></tt></p>
- </td><td>
- <p>supports OpenType, CFF as well as CEF fonts (CEF is a derivative
- of CFF used by Adobe in its SVG viewer).</p>
- </td></tr><tr valign=top><td>
-
- <p><tt><b>winfonts</b></tt></p>
- </td><td>
- <p>supports Windows bitmap fonts (i.e. ".FON" and ".FNT").</p>
- </td></tr>
-
- </td></tr></table></center>
-
- <p>Note that font drivers can support bitmapped or scalable glyph
- images. A given font driver that supports bezier outlines through
- the <tt>FT_Outline</tt> can also provide its own hinter, or rely
- on FreeType's <b>autohinter</b> module.
- </p></li>
-
- <li><p>
- <b>helper</b> modules are used to hold shared code that is
- often used by several font drivers, or even other modules.
- Here are a few examples of helper modules that come with
- FreeType 2:</p>
-
- <table cellpadding=5><tr valign=top><td>
- <b><tt>sfnt</tt></b>
- </td><td>
- used to support font formats based on the "<tt>SFNT</tt>"
- storage scheme. This means TrueType & OpenType fonts as
- well as other variants (like TrueType fonts that only
- contain embedded bitmaps).
- </td></tr><tr valign=top><td>
-
- <b><tt>psnames</tt></b>
- </td><td>
- used to provide various useful function related to glyph
- names ordering and Postscript encodings/charsets. For example,
- this module is capable of automatically synthetizing a Unicode
- charmap from a Type 1 glyph name dictionary.
- </td></tr></table></center>
- </p></li>
-
-
- <li><p>
- finally, the <b>autohinter</b> module has a specific role in
- FreeType 2, as it can be used automatically during glyph loading
- to process individual glyph outlines when a font driver doesn't
- provide it's own hinting engine.
- </p></li>
-</ul>
-
-<p>We will now study how modules are described, then managed by
- the library.</p>
-
-<h3>1. The <tt>FT_Module_Class</tt> structure:</h3>
-
-<p>As described later in this document, library initialisation is
- performed by calling the <tt>FT_Init_FreeType</tt> function. The
- latter is in charge of creating a new "empty" <tt>FT_Library</tt>
- object, then register each "default" module by repeatedly calling
- the <tt>FT_Add_Module</tt> function.</p>
-
-<p>Similarly, client applications can call <tt>FT_Add_Module</tt>
- any time they wish in order to register a new module in the library.
- Let's take a look at this function's declaration:</p>
-
-<pre><font color="blue">
- extern FT_Error FT_Add_Module( FT_Library library,
- const FT_Module_Class* clazz );
-</font></pre>
-
-<p>As one can see, this function expects a handle to a library object,
- as well as a pointer to a <tt>FT_Module_Class</tt> structure. It
- returns an error code. In case of success, a new module object is
- created and added to the library. Note by the way that the module
- isn't returned directly by the call !.</p>
-
-<p>Let's study the definition of <tt>FT_Module_Class</tt>, and explain it
- a bit. The following code is taken from
- <tt><freetype/ftmodule.h></tt>:</p>
-
-<pre><font color="blue">
- typedef struct FT_Module_Class_
- {
- FT_ULong module_flags;
- FT_Int module_size;
- const FT_String* module_name;
- FT_Fixed module_version;
- FT_Fixed module_requires;
-
- const void* module_interface;
-
- FT_Module_Constructor module_init;
- FT_Module_Destructor module_done;
- FT_Module_Requester get_interface;
-
- } FT_Module_Class;
-</font></pre>
-
-<p>here's a description of its fields:</p>
-
-<center><table cellpadding=5><tr valign=top><td>
-<p><b>module_flags</b></p>
-</td><td>
-<p>this is a set of bit flags used to describe the module's
-category. Valid values are:</p>
- <ul>
- <li><p>
- <b>ft_module_font_driver</b> if the module is a font driver
- </p></li>
-
- <li><p>
- <b>ft_module_renderer</b> if the module is a renderer
- </p></li>
-
- <li><p>
- <b>ft_module_hinter</b> if the module is an auto-hinter
- </p></li>
-
- <li><p>
- <b>ft_module_driver_scalable</b> if the module is a font
- driver supporting scalable glyph formats.
- </p></li>
-
- <li><p>
- <b>ft_module_driver_no_outlines</b> if the module is a
- font driver supporting scalable glyph formats that <em>cannot</em>
- be described by a <tt>FT_Outline</tt> object
- </p></li>
-
- <li><p>
- <b>ft_module_driver_has_hinter</b> if the module is a font
- driver that provides its own hinting scheme/algorithm
- </p></li>
- </ul>
-</td></tr><tr valign=top><td>
-
-<p><b>module_size</b></p>
-</td><td>
-<p>an integer that gives the size in <em>bytes</em> of a given module
-object. This should <em>never</em> be less than
-<tt>sizeof(FT_ModuleRec)</tt>, but can be more when the module
-needs to sub-class the base <tt>FT_ModuleRec</tt> class.</p>
-</td></tr><tr valign=top><td>
-
-<p><b>module_name</b></p>
-</td><td>
-<p>this is the module's internal name, coded as a simple ASCII C
-string. There can't be two modules with the same name registered
-in a given <tt>FT_Library</tt> object. However, <tt>FT_Add_Module</tt>
-uses the <b>module_version</b> field to detect module upgrades
-and perform them cleanly, even at run-time.</p>
-</td></tr><tr valign=top><td>
-
-<p><b>module_version</b></p>
-</td><td>
-<p>a 16.16 fixed float number giving the module's major and minor
- version numbers. It is used to determine wether a module needs
- to be upgraded when calling <tt>FT_Add_Module</tt>.</p>
-</td></tr><tr valign=top><td>
-
-<p><b>module_requires</b></p>
-</td><td>
-<p>a 16.16 fixed float number giving the version of FreeType 2 that
- is required to install this module. By default, should be 0x20000
- for FreeType 2.0</p>
-</td></tr><tr valign=top><td>
-
-<p><b>module_requires</b></p>
-</td><td>
-<p>most modules support one or more "interfaces", i.e. tables of function
-pointers. This field is used to point to the module's main interface,
-where there is one. It's a short-cut that prevents users of the module
-to call "get_interface" each time they need to access one of the object's
-common entry points.</p>
-
-<p>Note that is is optional, and can be set to NULL. Other interfaces
-can also be accessed through the <b>get_interface</b> field.</p>
-</td></tr><tr valign=top><td>
-
-<p><b>module_init</b></p>
-</td><td>
-<p>this is a pointer to a function used to initialise the fields of
-a fresh new <tt>FT_Module</tt> object. It is called <em>after</em> the module's
-base fields have been set by the library, and is generally used to
-initialise the fields of <tt>FT_ModuleRec</tt> subclasses.</p>
-
-<p>Most module classes set it to NULL to indicate that no extra
-initialisation is necessary</p>
-</td></tr><tr valign=top><td>
-
-<p><b>module_done</b></p>
-</td><td>
-<p>this is a pointer to a function used to finalise the fields of
-a given <tt>FT_Module</tt> object. Note that it is called <em>before</em> the
-library unsets the module's base fields, and is generally used to
-finalize the fields of <tt>FT_ModuleRec</tt> subclasses.</p>
-
-<p>Most module classes set it to NULL to indicate that no extra
-finalisation is necessary</p>
-</td></tr><tr valign=top><td>
-
-<p><b>get_interface</b></p>
-</td><td>
-<p>this is a pointer to a function used to request the address of
-a given module interface. Set it to NULL if you don't need to support
-additional interfaces but the main one.</p>
-</td></tr><tr valign=top><td>
-
-</td></tr></table></center>
-
-
-<h3>2. The <tt>FT_Module</tt> type:</h3>
-
-<p>the <tt>FT_Module</tt> type is a handle (i.e. a pointer) to a given
- module object / instance, whose base structure is given by the
- internal <tt>FT_ModuleRec</tt> type (we will not detail its
- structure here).</p>
-
-<p>When <tt>FT_Add_Module</tt> is called, it first allocate a new
- module instance, using the <tt><b>module_size</b></tt> class
- field to determine its byte size. The function initializes
- a the root <tt>FT_ModuleRec</tt> fields, then calls
- the class-specific initializer <tt><b>module_init</b></tt>
- when this field is not set to NULL.</p>
-
-
-
-
-<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
-<h1>Renderer Modules</h1>
-</td></tr></table>
-
-<p>As said previously, <b>renderers</b> are used to convert scalable
- glyph images to bitmaps or pixmaps. Each renderer module is defined
- through a <b>renderer class</b>, whose definition is found in the
- file <tt><freetype/ftrender.h></tt>. However, a few concepts
- need to be explained before having a detailed look at this structure.
- </p>
-
-<h3>1. Glyph formats:</h3>
-
-<p>Each glyph image that is loaded by FreeType (either through
- <tt>FT_Load_Glyph</tt> or <tt>FT_Load_Char</tt>), has a given
- <em>image format</em>, described by the field
- <tt>face->glyph->format</tt>. It is a 32-byte integer that
- can take any value. However, the file <tt><freetype/ftimage.h></tt>
- defines at least the following values:</p>
-
-<center><table cellpadding=5>
-<tr valign=top><td>
-<tt><b>ft_glyph_format_bitmap</b></tt>
-</td><td>
-this value is used to indicate that the glyph image is a bitmap or pixmap.
-Its content can then be accessed directly from
-<tt>face->glyph->bitmap</tt> after the glyph was loaded.
-</td></tr>
-
-<tr valign=top><td>
-<tt><b>ft_glyph_format_outline</b></tt>
-</td><td>
-this value is used to indicate that the glyph image is a scalable vectorial
-outline, that can be described by a <tt>FT_Outline</tt> object. Its content
-can be accessed directly from
-<tt>face->glyph->outline</tt> after the glyph was loaded.
-this is the format that is commonly returned by TrueType, Type1 and
-OpenType / CFF fonts.
-</td></tr>
-
-<tr valign=top><td>
-<tt><b>ft_glyph_format_plotter</b></tt>
-</td><td>
-this value is equivalent to <tt><b>ft_glyph_format_outline</b></tt> except
-that the outline stored corresponds to path strokes, instead of filled
-outlines. It can be returned from certain Type 1 fonts (notably the Hershey
-collection of free fonts).
-</td></tr>
-
-<tr valign=top><td>
-<tt><b>ft_glyph_format_composite</b></tt>
-</td><td>
-this value is used to indicate that the glyph image is really a "compound"
-of several other "sub-glyphs". This value is only returned when a glyph
-is loaded with the <tt><b>FT_LOAD_NO_RECURSE</b></tt> flag. The list of
-subglyphs that make up the composite can be accessed directly as
-<tt>face->glyph->subglyphs</tt> after the glyph was loaded.
-</td></tr>
-
-</table></center>
-
-<p>Note that this is only a list of pre-defined formats supported by
- FreeType. Nothing prevents an application to install a new font
- driver that creates other kinds of glyph images. For example, one
- could imagine a MetaFont font driver, that would be capable to
- parse font definition files and create in-memory "glyph programs",
- that could be returned in <tt>face->glyph->other</tt>.</p>
-
-<h3>2. The <tt>FT_Outline</tt> type:</h3>
-
-<p>This structure, which is also defined, and heavily commented, in
- the file <tt><freetype/ftimage.h></tt>, is used to hold
- a scalable glyph image that is made of one or more contours, each
- contour being described by line segments or bezier arcs (either
- quadratic or cubic). The outline itself is stored in a compact
- way that makes processing it easy.</p>
-
-<p>Points are placed in a 2D plane that uses the y-upwards convention,
- and their coordinates are stored in 1/64th of pixels (also known
- as the 26.6 fixed point format). Pixels correspond to single squares
- whose borders are on integer coordinates (i.e. mutiples of 64).
- In other words, pixel centers are located on half pixel coordinates.</p>
-
-<p>Outlines can be very easily transformed (translated, rotated, etc..)
- before being converted to bitmap, which allows for sophisticated
- use of text. FreeType 2 comes by default with two "outline renderer"
- modules:</p>
-
-<p><ul>
- <li><b>raster1</b>, used to convert them to monochrome bitmaps</li>
- <li><b>smooth</b>, used to convert them to high-quality anti-aliased
- pixmaps</li>
-</ul></p>
-
-<h3>3. Bitmaps and scan-conversion:</h3>
-
-<p>Bitmaps and pixmaps are described through a <tt>FT_Bitmap</tt>
- structure, which is defined and heavily commented in
- <tt><freetype/ftimage.h></tt>
-
-
-<pre><font color="blue">
- typedef struct FT_Renderer_Class_
- {
- FT_Module_Class root;
-
- FT_Glyph_Format glyph_format;
-
- FTRenderer_render render_glyph;
- FTRenderer_transform transform_glyph;
- FTRenderer_getCBox get_glyph_cbox;
- FTRenderer_setMode set_mode;
-
- FT_Raster_Funcs* raster_class;
-
- } FT_Renderer_Class;
-</font></pre>
-
-<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
-<h1>Font Driver Modules</h1>
-</td></tr></table>
-
-<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
-<h1>Library Initialisation & Dynamic Builds</h1>
-</td></tr></table>
-
-<p>By default, all components of FreeType 2 are compiled independently,
- then grouped into a single static library file that can be installed
- or used directly to compile client applications</p>
-
-<p>Such applications must normally call the <tt>FT_Init_FreeType</tt>
- function before using the library. This function is in charge of
- two things:</p>
-
-<ul>
- <li><p>
- First, it creates a <tt>FT_Library</tt> object (by calling
- the public function <tt>FT_New_Library</tt>). This new
- object is "empty" and has no module registered in it.
- </p></li>
-
- <li><p>
- Then, it registers all "default modules" by repeatedly calling
- <tt>FT_Add_Module</tt>.
- </p></li>
-</ul>
-
-<p>It is important to notice that the default implementation of
- <tt>FT_Init_FreeType</tt>, which is located in the source
- file <tt>"src/base/ftinit.c"</tt> always uses a <em>static</em>
- list of modules that is generated at compile time from the
- configuration file <tt><freetype/config/ftmodule.h></tt>.
-</p>
-
-<p>There are cases where this may be inadequate. For example, one
- might want to compile modules as independent DLLs in a specific
- location (like <tt>"/usr/lib/freetype/module/"</tt>), and have
- the library initialisation function load the modules dynamically
- by parsing the directory's content</p>
-
-<p>This is possible, and we're going to explain how to do it.</p>
-
-
-<h4>a. Building the library as a DLL (i.e. "shared object" on Unix)</h4>
-
-<p>But first of all, let's explain how to build FreeType 2 as a single
- DLL or shared object, i.e. one that includes the base layer, all
- default modules and optional components into a single file.</p>
-
-<p>When building dynamic libraries, certain compilers require specific
- directives to <em>declare</em> exported DLL entry points. For example, the
- "<tt>__cdecl</tt>" directive is required by Win32 compilers, as it forces
- the use of the "C" parameter passing convention (instead of "smarter"
- schemes, which usually use registers and the stack to pass parameters).</p>
-
-<p>To make matter worse, some of these compilers require the directive
- before the function's return type, while some others want it between
- the return type and the function's identifier.</p>
-
-<p>To allow such compilations, the <tt>FT_EXPORT_DEF()</tt> macro is
- used in all public header files in order to declare each high-level
- API function of FreeType 2, as in the following example, taken from
- <tt><freetype/freetype.h></tt>:</p>
-
-<pre><font color="blue">
- FT_EXPORT_DEF(FT_Error) FT_Init_FreeType( void );
-</font></pre>
-
-<p>the definition of <tt>FT_EXPORT_DEF(x)</tt> defaults to <tt>"extern x"</tt>,
- except when a specific definition is given in the library's system-specific
- configuration file <tt><freetype/config/ftconfig.h></tt>. This
- allows project builders to specify the exact compilation directive
- they need.</p>
-
-<p>Similarly, the <tt>FT_EXPORT_FUNC(x)</tt> macro is defined and used to
- <em>define</em> exported functions within the FreeType 2 source code.
- However, it is only used at compilation time.</p>
-
-
-<p>Note that on Unix, there is no need for specific exportation directives.
- However, the code must be compiled in a special way, named Position
- Independent Code ("PIC"), which is normally selected through specific
- compiler flags (like "-PIC" with gcc).</p>
-
-
-<h4>b. Building modules as DLLs</h4>
-
-<p>In order to build modules as dynamic libraries, we first need to compile
- the base layer (and optional components) as a single DLL. This is very
- similar to the case we just described, except that we also need to
- export all functions that are part of the "low level base API",
- as these will get called by the modules in various cases.</p>
-
-<p>Similarly to the high-level API, all functions of the low-level base
- API are declared in the internal header files of FreeType 2 with the
- <tt>BASE_DEF(x)</tt> macro. The latter is similar to
- <tt>FT_EXPORT_DEF</tt> and defaults to <tt>"extern x"</tt> unless
- you specify a specific definition in
- <tt><freetype/config/ftconfig.h></tt>.</p>
-<p>
-
-<hr>
-
-<table width="100%" cellpadding=5><tr bgcolor="#ccccee"><td>
-<h1>Conclusion</h1>
-</td></tr></table>
-
-</td></tr></table></center>
-</body>
-</html>
diff --git a/docs/design/simple-model.png b/docs/design/simple-model.png
deleted file mode 100644
index 2543404..0000000
Binary files a/docs/design/simple-model.png and /dev/null differ
diff --git a/docs/freetype2.html b/docs/freetype2.html
deleted file mode 100644
index dbac6b9..0000000
--- a/docs/freetype2.html
+++ /dev/null
@@ -1,352 +0,0 @@
-<html>
-<head>
-<title>FreeType 2 Introduction</title>
-<basefont face="Georgia, Arial, Helvetica, Geneva">
-<style content="text/css">
- P { text-align=justify }
- H1 { text-align=center }
- H2 { text-align=center }
- LI { text-align=justify }
-</style>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-
-<font size=1>http://www.freetype.org</font><p>
-
-<center>
- <a href="freetype.html">
- <img src="image/freetype.jpg" width=550 height=105 alt="The FreeType Project" border=0></a>
- <h1>An Introduction to FreeType 2</h1>
-</center>
-
-<center><table width=750 cellspacing=10 cellpadding=30><tr><td>
-<hr><p>
-
-DOCUMENT INDEX:<br>
-<ul>
- <li><a href="#what">What is FreeType 2 ?</a>
- <li><a href="#features">Features</a>
- <li><a href="#requirements">Requirements</a>
- <li><a href="#patents">Patents issues</a>
-</ul><p>
-
-
-<hr><p>
-
-<table width="100%" cellspacing=5><tr bgcolor="#CCCCEE"><td>
-<h2 align=center><a name="what">What is FreeType 2 ?</h2>
-</td></tr><tr><td>
-
-<p>The FreeType project is a team of volunteers who develop free, portable
-and high-quality software solutions for digital typography. We specifically
-target embedded systems and focus on bringing small, efficient and
-ubiquitous products.</p>
-
-<p>the FreeType 2 library is our new software font engine. It has been
- designed to provide the following important features:</p>
-
- <ul>
- <li><p>
- <b>A universal and simple API to manage font files:</b><br>
- <ul>
- <p>The FreeType 2 API is simple and easy to use. It supports both
- bitmapped and scalable fonts and is well-suited to manage font
- files of all formats. Unlike other font libraries, FreeType 2
- returns and manages outline font data (images & metrics).</p>
- </ul>
- </p></li>
-
- <li><p>
- <b>Support for several font formats through loadable modules:</b><br>
- <ul>
- <p>FreeType 2 uses <em>"font drivers"</em>. Each driver is a loadable
- module used to support one specific font format. Each driver can also
- provide specific extensions used to access format-specific features of
- the font.</p>
- </ul>
- </p></li>
-
-
- <li><p>
- <b>High-quality anti-aliasing:</b><br>
- <ul>
- <p>FreeType 2 produces etremely smooth outlines at small sizes, with its new
- anti-aliasing renderer, which produces bitmaps with 256-levels of gray.
- It uses a new algorithm that has been specifically designed to render
- small complex shapes (like glyphs) at high speed. Indeed, it's even
- faster than the monochrome renderer for small character sizes (under
- 20 pixels) !!
- </p>
- </ul>
-
-
- <li><b>High portability & performance:</b><br>
- <ul>
- <p>The FreeType 2 source code is written in ANSI C and runs on any
- platform with a compliant compiler. Client applications can
- provide their own memory manager or input stream to the library
- (which means that font files can come from any place: disk,
- memory, compressed file, network, etc..).
- </p>
- </ul>
-
- </ul>
-
- <p>Note that <em>the beta of FreeType 2 is available <b>now</b></em>. For more
- info, check our <a href="download.html">Download page</a> or see the source
- and its diffs through our <a href="cgi-bin/cvsweb.cgi">CVS Web interface</a>.
- </p>
-</ul>
-
-</td></tr></table>
-
-<table width="100%" cellspacing=5><tr bgcolor="#CCCCEE"><td>
-<h2 align=center><a name="features">Features</h2>
-</td></tr><tr><td>
-
-<h3>Supported font formats</h3>
-
-<p>FreeType 2 readily supports the following font formats:</p>
-
-<ul>
- <li>TrueType files (.ttf) and collections (.ttc)</li>
- <li>Type 1 font files both in ASCII (.pfa) or binary (.pfb) format</li>
- <li>Type 1 Multiple Master fonts. The FreeType 2 API also provides
- routines to manage design instances easily</li>
- <li>Type 1 CID-keyed fonts</li>
- <li>OpenType/CFF (.otf) fonts</li>
- <li>CFF/Type 2 fonts</li>
- <li>Adobe CEF fonts (.cef), used to embed fonts in SVG documents
- with the Adobe SVG viewer plugin.</li>
- <li>Windows FNT/FON bitmap fonts</li>
-</ul>
-
-<p>Note that Apple's TrueType GX fonts are supported as normal TTFs,
- (the advanced tables are ignored).</p>
-
-<p>Besides, it's possible to add support for new font formats by providing
- a specific <em>font driver</em> module. Modules can be added either at
- build time (when recompiling the library), or at <em>run-time</em>;
- this allows, for example, applications to register their own
- font driver to support program-specific formats.</p>
-
-
-<h3>Patent-free automatic hinter</h3>
-
-<p>TrueType fonts are normally renderered (hinted) with the help of a
- specific bytecode where the behaviour of a few opcodes is patented by
- Apple. We're currently in contact with Apple to discuss the importance
- of such patents and their use in open source projects like FreeType.
- </p>
-
-<p>In the meantime, we have developped our own alternative technology that
- is capable of automatically hinting scalable glyph images. It is
- now part of the FreeType 2 source tree as the "autohint" module,
- and is used to hint glyphs when the bytecode interpreter is disabled
- (through a configuration macro when building the engine). Note that
- the auto-hinter is also used to handle glyphs in other formats like
- CFF and Type 1.</p>
-
-<p>The auto-hinter provides pretty good results (in some cases, it even
- significantly improves the output of poorly hinted fonts) but we'll
- continue to improve it with each new release of FreeType to achieve
- the highest possible quality.</p>
-
-
-<h3>Modular design:</h3>
-
-<p>The design of FreeType 2 is extremely modular as most features are
- supported through optional modules. This means it's easily possible to
- only compile the features you need. As each module is between
- 10 and 20 Kb in size, it's possible to build a bare-bones
- font engine that supports anti-aliasing in about 30 Kb !!</p>
-
-<p>Configuration is performed by modifications of only two header
- files (one to select global features, another one to select modules)
- and don't need tweaking of source code. Note that it is however
- possible to provide your own implementation of certain components.</p>
-
-<p>For example, when building on Unix, the engine will automatically
- use memory-mapped files when available on the target platform,
- thus significantly increasing font file i/o.</p>
-
-
-<p>Due to its very flexible design, it is possible to add, remove and
- upgrade modules at run-time.</p>
-
-
-
-<h3>Advanced glyph management</h3>
-
-<p>The API comes with a standard extension used to extract individual
- glyph images from font files. These images can be bitmaps, scalable
- bezier outlines or even anything else. (e.g. bi-color or metafont
- glyphs, as long as they're supported by a module).</p>
-
-<p>Each scalable glyph image can be transformed, measured and
- rendered into a monochrome or anti-aliased bitmaps easily
- through a uniform interface.
-
- This allows client applications to easily cache glyphs or
- perform text rendering effects with minimal difficulty
- (look at the FreeType 2 Tutorial to see how to render
- rotated text with very few lines of code).
-</p>
-
-
-
-<h3>Advanced font access</h3>
-
-<p>The FreeType 2 API is useful to retrieve advanced information from
- various fonts:</p>
-
-<ul>
- <li>vertical metrics are available whenever found in the font file</li>
-
- <li>kerning distances are available when found in the font file. It
- is also possible to "attach" a given additional file to a given
- font face. This is useful to load kerning distances from an
- .afm file into a Type 1 face for example.</li>
-
- <li>provides ASCII glyph names whenever available in the font
- (TrueType, OpenType, Type1, etc..)</li>
-
- <li>provides access to important tables for SFNT-based font formats
- (i.e. TrueType, OpenType, CEF, etc..), like the name table,
- font header, maximum profile, etc...</li>
-
- <li>automatic synthesis of Unicode-based character maps for
- those fonts or formats that do not provide one. This is
- extremely useful with Type 1 fonts which are normally
- limited to a stupid 256-characters encoding.</li>
-</ul>
-
-
-<h3>Simple & clean API</h3>
-
-<p>The FreeType 2 high-level API is simple and straightforward, as it
- has been specifically designed to make the most commmon font operations
- easy</p>
-
-<p>As a comparison, the number of function calls needed to perform a
- the tasks of font face creation/opening and glyph loading/rendering
- has been reduced by a factor of 4 !!</p>
-
-<p>The API is also independent of any font-format specific issue, though
- it provides standard extensions to access format-specific tables and
- information. More extensions can also be easily added through new
- modules</p>
-
-
-<h3>Robust & Portable code</h3>
-
-<p>Because it is written in industry-standard ANSI C, FreeType 2 compiles
- on all platforms with a compliant compiler. Because the default build
- only relies on the C library, it is free of any system-specific
- dependencies, even if it is possible to "enhance" certain components
- by providing a specific implementation.</p>
-
-<p>The code doesn't use global or static variables. Client applications
- can provide their own memory manager. Font files can be read from
- a disk file, memory, or through a client-provided input stream. This
- allows to support compressed font files, remote fonts, fonts embedded
- in other streams (e.g. Type42 fonts), etc..</p>
-
-<p>An advanced i/o sub-system is used to optimise file access, as well
- as reduce memory usage of the library when the file is memory-based
- ( ROM, RAM, memory-mapped ).</p>
-
-
-<h3>Open Source & Vendor Independence</h3>
-
-<p>Finally, FreeType 2 is released under its own BSD-like open source
- license, one of the less restricting licenses available, and this
- means that:</p>
-
-<ul>
- <li><p>
- It can be included in all kinds of products, be they proprietary
- or not.
- </p></li>
-
- <li><p>
- As any module can be added or replaced anytime, any third party
- vendor has the ability to provide its own set of modules (under
- its own license) in order to support proprietary font formats or
- more advanced features (e.g. a new auto-hinter, or a new
- anti-aliasing renderer for LCDs or TV screens).
- </p></li>
-</ul>
-
-<p>One could even imagine an application using the FreeType 2 API with
- a "wrapper" module used to access system-specific fonts (like through
- the Windows GDI). This would mean native font support with more portable
- application code (as simply changing the wrapper module would be required
- to port the application to another system).</p>
-
-</td></tr></table>
-
-<table width="100%" cellspacing=5><tr bgcolor="#CCCCEE"><td>
-<h2 align=center><a name="requirements">Requirements</h2>
-</td></tr><tr><td>
-
-<p>FreeType 2 is written in ANSI C and should compile with no problems
- on a great variety of platforms. We have taken care of removing all
- compilation warnings from major compliant compilers. Detailed compilation
- instructions are provided in the software archive.</p>
-
-<p>This version of the library has been succesfully compiled and run
- under the following systems: Dos, OS/2, Windows, Macintosh, Unix
- (including the 64-bits DEC Unix, a.k.a. "True64"). You should not
- encounter major problems compiling it on any other kind of platform.
- In all cases, contact us if you do.</p>
-
-<p>Note that a small set of demonstration programs is also separately
- available. They include a tiny graphics sub-system that is used to
- display and show-off the library's capabilities on the following
- platforms: X11, MacOS, OS/2 & Windows.</p>
-
-<p>Please visit our <a href="http://www.freetype.org/download.html">
- Download section</a> to access the software archives.</p>
-
-</ul>
-
-</td></tr></table>
-
-<table width="100%" cellspacing=5><tr bgcolor="#CCCCEE"><td>
-<h2 align=center><a name="patents">Patents issues</h2>
-</td></tr><tr><td>
-
-<p>The FreeType 2 source code includes a TrueType bytecode interpreter that
- is covered by the Apple patents. However, this piece of code is never
- compiled by default in this release (unlike in previous betas) making
- a default build of the library <em>entirely patent-free !!</em></p>
-
-<p>Note that in order to compile the interpreter, one needs to define
- the configuration macro <tt><b>TT_CONFIG_OPTION_BYTECODE_INTERPRETER</b></tt> configuration
- macro in the file "<tt>ftoption.h</tt>". More details are available in
- the software archive. Note that the use of the interpreter is normally
- protected by US, UK and French patents. In the event you'd absolutely
- need it, you may have to <a href="mailto:patents@apple.org">contact
- Apple legal department</a> for licensing conditions, depending on your
- location and the places you distribute/sell your products.</p>
-
-<p>Please do not ask us any detailed information regarding licensing, as
- we're still discussing with Apple this issue, we're unable to inform
- the public of what's currently going on..</p>
-
-</td></tr></table>
-
-<hr>
-<p>
-<a href="index.html">Back to FreeType homepage</a><p>
-
-</td></tr></table>
-</body>
-</html>
diff --git a/docs/ft2faq.html b/docs/ft2faq.html
deleted file mode 100644
index 2442395..0000000
--- a/docs/ft2faq.html
+++ /dev/null
@@ -1,729 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType 2 FAQ</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-
-<font size=1>http://www.freetype.org</font><p>
-
-<h1 align=center>
- <a href="freetype.html">
- <img src="image/freetype.jpg"
- width=550 height=105
- alt="The FreeType Project"
- border=0></a>
- <h1>The FreeType 2 FAQ</h1>
-</h1>
-
-<center>
-<table width="75%">
-<tr><td>
-
- <hr><p>
-
- Document index
-
- <ul>
- <li><a href="#general">General</a>
- <ul><p>
- <li>
- <a href="#general-dead">I thought the FreeType project was dead.
- Is this true?</a>
- </li>
- <li>
- <a href="#general-long">Why did it take so long to release
- FreeType 2?</a>
- </li>
- <li>
- <a href="#general-unix">Is FreeType 2 a Unix-only
- project?</a>
- </li>
- <li>
- <a href="#general-x11">When will X11 support anti-aliased
- glyphs?</a>
- </li>
- <li>
- <a href="#general-ft1">Is FreeType 2 backwards compatible
- to FreeType 1.x?</a>
- </li>
- <li>
- <a href="#general-edit">Can I use FreeType 2 to edit fonts
- or create new ones?</a>
- </li>
- </p></ul>
- </li>
- <li><a href="#builds">Compilation & Configuration</a>
- <ul><p>
- <li>
- <a href="#builds-compile">How do I compile the FreeType 2
- library?</a>
- </li>
- <li>
- <a href="#builds-config">How do I configure my library build?</a>
- </li>
- <li>
- <a href="#builds-modules">How do I select the modules I need?</a>
- </li>
- <li>
- <a href="#builds-flat">How do I compile all FreeType 2 files
- in a single directory?</a>
- </li>
- </p></ul>
- </li>
- <li>
- <a href="#autohint">The FreeType 2 autohinter</a>
- <ul><p>
- <li>
- <a href="#autohint-license">Under which license is the auto-hinter
- released?</a>
- </li>
- <li>
- <a href="#autohint-work">How does auto-hinting work in
- FreeType 2?</a>
- </li>
- <li>
- <a href="#autohint-cjk">Why doesn't the auto-hinter work well
- with CJK fonts?</a>
- </li>
- </p></ul>
- </li>
- <li>
- <a href="#other">Other questions</a>
- <ul><p>
- <li>
- <a href="#other-color">How can I set the color of text rendered
- by FreeType?</a>
- </li>
- <li>
- <a href="#other-depth">Can I use FreeType to draw text on a pixmap
- with arbitrary depth?</a>
- </li>
- <li>
- <a href="#other-size">I set the pixel size to 8x8, but the
- resulting glyphs are larger than that. Why?</a>
- </li>
- <li>
- <a href="#other-bbox">How can I compute the bounding box of a text
- string without loading its glyphs?</a>
- </li>
- <li>
- <a href="#other-antialias">Which anti-aliasing algorithm is
- used in the FreeType 2 renderer?</a>
- </li>
- <li>
- <a href="#other-opentype">When will FreeType 2 support
- OpenType?</a>
- </li>
- </p></ul>
- </li>
- </ul>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#CCCCEE"><td>
- <h2 align=center>
- <a name="general">General questions & answers
- </h2>
- </td></tr>
- <tr><td>
-
- <a name="general-dead">
- <h3>
- I.1 I though the FreeType project was dead. Is this true?
- </h3>
-
- <p>Well, not exactly :-) It's true that the TrueType patents
- issues have been less than a graceful event to handle but it didn't not
- really killed the project per se, as Apple hasn't made an official
- statement yet regarding the use of the patented "technology" in open
- source projects (or other products).</p>
-
- <p>We have thus continued updating FreeType 1.x, and started
- developing FreeType 2 with the idea of providing this time a
- completely patent free font engine. However, we largely preferred not
- to broadly communicate about it until we've got a satisfying
- implementation to show.</p>
-
- <hr>
- <a name="general-long">
- <h3>
- I.2 Why did it take so long to release FreeType 2?
- </h3>
-
- <p>Several factors come to mind. The first one is that FreeType 2
- is a much more complex and dense project that was mostly developed
- during non-working hours. And surely some important changes in the life
- (like marriage, new jobs and kids) of some the FreeType developers
- cannot be ignored :-)</p>
-
- <p>A second one is that a first version of the library was designed one
- year ago (and already worked with a multitude of font drivers), though
- with a design that was judged by its authors as well as beta testers as
- not enough flexible or consistent. In short, it worked well but we were
- not exactly proud of it (call us perfectionists). It has then be
- significantly reworked to become what we are now distributing as
- FreeType 2</p>
-
- <p>Finally, it would have been hard to distribute such a library without
- an alternative technology to replace the patented bytecode interpreter.
- This involved significant research work that could only be performed
- correctly full-time, and we had to found a company to fund such a
- development and still make it available under a BSD-like license. Huge
- thanks to <a href="http://www.catharon.com">Catharon Productions,
- Inc.</a> for their commitment to this project.</p>
-
- <p>And of course, we added support for more font files, and we will
- continue to as long as the specifications are available and that we find
- an interest in it. For example, FreeType 2 is to date the only
- software library available on the market that supports the new Adobe
- "CEF" font format.</p>
-
- <hr>
- <a name="general-unix">
- <h3>
- I.3 Is FreeType 2 a Unix-only project?
- </h3>
-
- <p>Absolutely not, even though many people still seem to think
- so :-) FreeType 2, just like version 1.x, can be compiled
- on any platform with an ANSI compiler. Some beta versions of the
- library are even heavily used in brand new OSes (see the <a
- href="http://www.atheos.cx">AtheOS</a> screenshots for examples).</p>
-
- <p>The library is itself mainly developed on several platforms (Windows
- & Linux, though a great deal has also been achieved on OS/2) and the
- code is highly generic and modular to adapt even the most strict
- environments like low-memory embedded systems.</p>
-
- <hr>
- <a name="general-x11">
- <h3>
- I.4 When will X11/XFree support anti-aliased text?
- </h3>
-
- <p>This question isn't exactly related to FreeType as we have no direct
- connection to the XFree people, but we have been asked so frequently
- about it that it deserves a prominent place in this FAQ :-)</p>
-
- <p>FreeType has been capable of anti-aliasing since version 1.0.
- The reason why XFree doesn't support it is directly related to the
- limitations of the design and specification of X11. More
- specifically:</p>
-
- <ul>
- <li>
- X11 assumes that all glyph images are monochrome bitmaps, hence the
- X font library and server are unable to send anything else to
- the X server.
- </li>
- <li>
- Even if the X font library/server was able to generate
- anti-aliased bitmaps (and this has been already done through
- extensions), the X rendering model doesn't allow translucent
- composition of "gray" pixmaps onto an arbitrary drawable.
- </li>
- </ul>
-
- <p>As both the font and rendering models of X11 are limited, it is
- basically impossible to draw anti-aliased glyphs without performing
- <em>huge</em> hacks within the server.</p>
-
- <p>Note that Keith Packard, from XFree86 fame, has recently started
- working on a new rendering model for X11 in order to support new
- features (mainly transparency and anti-aliased fonts). This will be
- provided through protocol extensions. The question of knowing whether
- legacy X applications will be able to display anti-aliased text is still
- very uncertain.</p>
-
- <hr>
- <a name="general-ft1">
- <h3>
- I.5 Is FreeType 2 backwards compatible with FreeType 1.x?
- </h3>
-
- <p>Not directly, though we had the project to provide an optional binary
- compatibility layer on top of it in order to easily re-link applications
- with the new version. However, this idea has been dropped as it is
- possible to install and use the two versions independently on any system
- (read: no namespace conflicts).</p>
-
- <p>The FreeType 2 API is a lot simpler than the one in 1.x
- while being much more powerful. We thus encourage you to adapt your
- source code to it as this should not involve much work.</p>
-
- <hr>
- <a name="general-edit">
- <h3>
- I.6 Can I use FreeType 2 to edit fonts or create new ones?
- </h3>
-
- <p>The answer is a definitive <b>no</b>, because the library was
- specifically designed to <em>read</em> font files with small code size
- and very low memory usage.</p>
-
- <p>We thus do not plan to support editing or creation in the font engine
- in any way, as this would imply a complete rewrite. This doesn't mean
- that we won't introduce a font editing/creation library in the future,
- as this really depends on how many people are asking for it (or how much
- they would be willing to pay for it), as well as the time of the
- FreeType developers.</p>
-
- <p>Do not expect anything in this direction until we officially announce
- something though. There are other axes of development for this project
- (like text-layout capabilities, glyph caching, etc.) that may be more
- important to us at the moment.</p>
- </td></tr>
- </table>
-
- <br>
-
- <table width="100%">
- <tr bgcolor="#CCCCEE"><td>
- <h2 align=center>
- <a name="builds">Compilation & Configuration
- </h2>
- </td></tr>
- <tr><td>
-
- <a name="builds-compile">
- <h3>
- II.1 How do I compile the FreeType 2 library?
- </h3>
-
- <p>The library can be compiled in various ways, and a detailed
- documentation is available in the file <tt>freetype2/docs/BUILD</tt>.
- However, we will summarize the process to a few cases:</p>
-
- <h4>
- a. Using the command-line 2 build system
- </h4>
-
- <p>The engine comes with a sophisticated build system that is used to
- configure and compile a build of the library. You will need <em>GNU
- Make</em> installed on your platform (<b>Note:</b> It will
- <em>not</em> work with other Make tools).</p>
-
- <p>Basically, you will need to invoke <tt>make</tt> a first time in
- the top-level FreeType 2 directory in order to set up the build.
- This will detect your current platform and choose a configuration
- sub-makefile to drive the build. A specific compiler can be selected
- on some platforms by providing an additional target. For example, on
- Win32:</p>
-
- <ul>
- <li>
- <b><tt>make visualc</tt></b> will select the Visual C++
- compiler
- </li>
- <li>
- <b><tt>make lcc</tt></b> will select the Win32-lcc compiler
- </li>
- </ul>
-
- <p>Note that on Unix, when the first time make is called, a configure
- script located in <tt>freetype2/builds/unix</tt> will be run in order
- to automatically detect the platform & compiler.</p>
-
- <p>A summary will be displayed showing the detected platform and
- compiler selected. You will then be able to start the build by
- invoking <tt>make</tt> a second time. In case of problem, consult the
- <tt>BUILD</tt> document.</p>
-
- <h4>
- b. Direct compilation
- </h4>
-
- <p>You can also directly compile the library from the command line by
- using these simple rules:</p>
-
- <ul>
- <li>
- You should place the directories <tt>freetype2/include</tt> and
- <tt>freetype2/src</tt> in your include path in order to compile
- any component of the library. You can also add the
- system-specific build directory (i.e.
- <tt>builds/<em>system</em>/</tt>) in the case where an alternate
- implementation of some of the components is available there (e.g.
- the memory-mapped i/o implementation on some Unix systems).
- </li>
- <li>
- The components of the library are located in sub-directories of
- <tt>src</tt>, for example: <tt>src/base</tt>,
- <tt>src/truetype</tt>, etc.
- </li>
- <li>
- Each component is normally compiled through a single C file that
- <em>wraps</em> other sources in the component's directory. For
- example, you should build the TrueType font driver by compiling
- the file <tt>src/truetype/truetype.c</tt>. The list of
- C files to compile for a feature-complete build of the
- library is given in the <tt>BUILD</tt> document.
- </li>
- </ul>
-
- <h4>
- c. Using a graphical IDE
- </h4>
-
- <p>Well, the process is vastly similar to the one described in b.,
- except that you need to set the include paths, source code paths, etc.
- in dialog boxes before running the compilation.</p>
-
- <hr>
- <a name="builds-config">
- <h3>
- II.2 How do I configure my build of the library?
- </h3>
-
- <p>Each build of the library is configured through two header files
- located in <tt>include/freetype/config</tt>:</p>
-
- <ul>
- <li>
- <tt>ftoption.h</tt>
- <br>
- This file contains various configuration macros whose definition can
- be toggled on a per-build basis. Each macro is heavily commented in
- this file's comment, and we invite you to refer to it directly.
- </li>
- <li>
- <tt>ftmodule.h</tt>
- <br>
- This file contains the list of all the modules that are initially
- registered (added) when the function <tt>FT_Init_FreeType()</tt> is
- called. See the next answer to know how to change it and why it may
- be important.
- </li>
- </ul>
-
- <p>Alternatively, some specific implementations of some FreeType 2
- components can be provided in a <tt>builds/<em>system</em>/</tt>
- directory (e.g. the Unix-specific <tt>ftsystem.c</tt> that uses
- memory-mapped file for i/o).</p>
-
- <hr>
- <a name="builds-modules">
- <h3>
- II.3 How do I select the modules I need in my build?
- </h3>
-
- <p>The function <tt>FT_Init_FreeType()</tt> creates a new instance of
- the FreeType 2 library and registers a set of "default" modules
- before returning to the calling application. Its default implementation
- is in the file <tt>src/base/ftinit.c</tt>.</p>
-
- <p>The list of default modules used by <tt>ftinit.c</tt> is located in
- the configuration file <tt>include/freetype/config/ftmodule.h</tt>.
- Normally, it is automatically generated by the build system by invoking
- the "<tt><b>make modules</b></tt>" command in the top level
- FreeType 2 directory (Note: this only works with GNU Make; you can
- edit the file by hand otherwise). It does so by parsing all
- sub-directories of <tt>src</tt> that contain a file named
- <tt>module.mk</tt>.</p>
-
- <p>Note that a specific port or project is free to provide its own
- implementation of <tt>ftinit.c</tt> in order to ensure a different
- initialization sequence. For example, one could do something like:</p>
-
- <ul>
- <li>
- Compile each module as a shared library (DLL or <tt>.so</tt>) with a
- common "entry point" to retrieve a pointer to its module class
- (there is already some code that allows this when compiling each
- module).
- </li>
- <li>
- Place these modules in a directory like
- <tt>/usr/lib/freetype2/modules/</tt>.
- </li>
- <li>
- Provide an implementation of <tt>ftinit.c</tt> that would scan the
- directory for valid modules.
- </li>
- </ul>
-
- <p>This example only emphasizes the flexibility that is left to
- developers when building the library.</p>
-
- <hr>
- <a name="builds-flat">
- <h3>
- II.4 How do I compile all FreeType 2 files in a single
- directory?
- </h3>
-
- <p>Some projects may need, for the sake of simplicity or ease of
- building, to compile the FreeType 2 library with all source files
- copied to a single directory. This is possible.</p>
-
- <p>To do so, you have to copy all source files located under
- <tt>src</tt> to your own directory (you must retain the include files in
- a distinct hierarchy though), then compile each of the FreeType 2
- component with the macro <tt>FT_FLAT_COMPILE</tt>. This will change the
- way <tt>#include</tt> works during the build.</p>
-
- </td></tr>
- </table>
-
- <br>
-
- <table width="100%">
- <tr bgcolor="#CCCCEE"><td>
- <h2 align=center>
- <a name="autohint">The FreeType 2 auto-hinter
- </h2>
- </td></tr>
- <tr><td>
-
- <a name="autohint-license">
- <h3>
- III.1 Under which license is the FreeType 2 auto-hinter released?
- </h3>
-
- <p>The auto-hinter was initially designed and implemented under contract
- for <a href="http://www.catharon.com">Catharon Productions, Inc</a>
- which gladly accepted to released it under an open-source license
- compatible with the FreeType one.</p>
-
- <p>This license can be found in
- <tt>src/autohint/CatharonLicense.txt</tt> and requires that you cite
- Catharon Productions in your documentation (just like you do with
- FreeType) when using the auto-hinting module.</p>
-
- <p>Other than that, you still have the same freedom than with the good
- old FreeType license. Enjoy!</p>
-
- <hr>
- <a name="autohint-work">
- <h3>
- III.2 How does the auto-hinter work?
- </h3>
-
- <p>Well, a complete description would be difficult. Have a look at the
- dedicated <a href="autohinting/index.html">auto-hinter pages</a> on the
- FreeType site, as they describe most of its details with graphics and
- explanations. You could also look at the source code if you want
- to :-)</p>
-
- <p>To give a few details, the auto-hinter is used to perform
- grid-fitting on scalable font formats that use Bézier outlines as
- their primary glyph image format (this means nearly all scalable font
- formats today). If a given font driver doesn't provide its own hinter,
- the auto-hinter is used by default. If a format-specific hinter is
- provided, it is still possible to use the auto-hinter using the
- <tt>FT_LOAD_FORCE_AUTOHINT</tt> bit flag when calling
- <tt>FT_Load_Glyph()</tt>.</p>
-
- <p>The auto-hinter currently doesn't use external hints to do its job,
- as it automatically computes global metrics (when it "opens" a font for
- the first time) and glyph "hints" from their outline. Note that we plan
- the ability to specify external hints, given that it is based on a
- constraint system. That could be used to support native hints in
- Type 1/Type 2 fonts, for example.</p>
-
- <hr>
- <a name="autohint-cjk">
- <h3>
- III.3 Why does the auto-hinter doesn't work correctly with CJK
- fonts?
- </h3>
-
- <p>The auto-hinter was first designed to manage and hint Latin-based
- fonts, as they consist of most of the fonts available today. It doesn't
- hint Asian fonts, as well as a few other complex scripts, because we
- didn't put enough research on the topic yet. Hinting CJK isn't really
- more difficult than Latin, just different, with a set of different
- constraints (basically, more distortion of glyphs is acceptable as long
- as certain features like triple-stem positions are respected more
- strictly).</p>
-
- <p>We thus plan to handle such a case in the near future. Please be
- patient.</p>
- </td></tr>
- </table>
-
- <br>
-
- <table width="100%">
- <tr bgcolor="#CCCCEE"><td>
- <h2 align=center>
- <a name="other">Other questions
- </h2>
- </td></tr>
- <tr><td>
-
- <a name="other-depth">
- <h3>
- IV.1 Can I use FreeType to draw text on a pixmap with arbitratry depth?
- </h3>
-
- <p>Not directly, as FreeType is a font library, not a general purpose
- graphics library or text rendering service. However, note that the
- anti-aliased renderer allows you to convert a vectorial glyph outline
- into a list of "spans" (i.e. horizontal pixel segments with same
- coverage) that can be rendered through user-provided callbacks.</p>
-
- <p>By providing the appropriate span callback, you can render
- anti-aliased text to any kind of surface. You can also use any color or
- fill pattern/image if you want to. This process is called <em>direct
- rendering</em>. For more information, please read the documentation
- contained in the following files:</p>
-
- <ul>
- <li>
- <p><tt><freetype/ftimage.h></tt> contains the definition of
- the <tt>FT_Raster_Params</tt> type used with direct rendering.</p>
- </li>
- <li>
- <p><tt><freetype/ftoutln.h></tt> contains the definition of
- the <tt>FT_Outline_Render()</tt> function that can be used to
- convert vectorial outlines to span lists.</p>
- </li>
- </ul>
-
- <p>Here's some code that uses them:</p>
-
- <font color="blue"><pre>
- FT_Raster_Params params;
- FT_Outline outline;
-
-
- ... load vectorial glyph in "outline" ...
-
- params.flags = ft_raster_flag_aa | ft_raster_flag_direct;
- params.gray_spans = (FT_Raster_Span_Func)your_own_span_function_here;
- params.user = your_own_data_pointer;
-
- error = FT_Outline_Render( library, &outline, &params );</pre>
- </font>
-
- <p>Note that direct rendering is <em>not</em> available with monochrome
- output, as the current renderer uses a two-pass algorithm to generate
- glyphs with correct drop-out control.</p>
-
- <hr>
- <a name="other-color">
- <h3>
- IV.2 How can I set the color of text rendered by FreeType?
- </h3>
-
- <p>Basically, you can't do that, because FreeType is simply a font
- library. In general, you will need to use your favorite graphics
- library to draw the FreeType glyphs with the appropriate color.</p>
-
- <p>Note that for anti-aliased glyphs, you can "set the color" by using
- <em>direct rendering</em> as described in <a href="#other-depth">this
- answer</a>.</p>
-
- <hr>
- <a name="other-size">
- <h3>
- IV.3 I set the pixel size to 8x8, but the resulting glyphs are larger
- (or smaller) than that. Why?
- </h3>
-
- <p>A lot of people have difficulties to understand this topic, because
- they think of glyphs as fixed-width resp. fixed-height "cells", like
- those of fonts used in terminals/consoles. This assumption is simply
- not valid with most "modern" font formats, even bitmapped-based ones
- like <tt>PCF</tt> or <tt>BDF</tt>.</p>
-
- <p>Be aware that the <em>character size</em> that is set either through
- <tt>FT_Set_Char_Size()</tt> or <tt>FT_Set_Pixel_Sizes()</tt> isn't
- directly related to the dimension of the glyph bitmaps generated.</p>
-
- <p>Rather, the character size is indeed the size of <em>an abstract
- square</em>, called the <em>EM</em>, used by typographers to design
- fonts. Scaling two distinct fonts to the same character size, be it
- expressed in points or pixels, will generally result in bitmaps with
- <em>distinct dimensions</em>!</p>
-
- <p>Note that historically, the EM corresponded to the width of a capital
- "M" in Latin typefaces. However, later improvements in typography led
- to designs that greatly detract from this rule. Today, it is not
- possible to connect the EM size to a specific font "feature" in a
- reliable way.</p>
-
- <hr>
- <a name="other-bbox">
- <h3>
- IV.4 How can I compute the bounding box of a given string of text
- without loading its glyphs before?
- </h3>
-
- <p>A lot of people want to be able to compute the size in pixels of a
- simple string of text with minimal overhead. For example, that can be
- useful to draw centered text within a button. (to be continued...)</p>
-
- <hr>
- <a name="other-antialias">
- <h3>
- IV.5 Which anti-aliasing algorithm is used by FreeType 2?</h3>
-
- <p>The algorithm has been specifically designed for FreeType. It is
- based on ideas that were originally found in the implementation of the
- <a href="http://www.levien.com/libart">libArt</a> graphics library to
- compute the <em>exact pixel coverage</em> of a vector image with
- absolutely no sub-sampling/filtering.</p>
-
- <p>However, these two implementations are radically distinct and use
- vastly different models. The FreeType 2 renderer is optimized
- specifically for rendering small complex shapes, like glyphs, at very
- high speed while using very few memory; while libArt shines at general
- shape/polygon processing, especially large ones.</p>
-
- <p>The FreeType 2 anti-aliasing renderer is indeed <em>faster</em>
- than the monochrome renderer for small character sizes (typically
- <20 pixels). The reason is that the monochrome renderer must
- perform two passes on the outline in order to perform drop-out control
- according to the TrueType specification (we could drop this requirement
- later though).</p>
-
- <p>We will try to document its design in a later document, though this
- is not a priority for now.</p>
-
- <hr>
- <a name="other-opentype">
- <h3>
- IV.6 When will FreeType 2 support OpenType?
- </h3>
-
- <p>Well, the engine already reads OpenType/CFF files perfectly. What it
- doesn't do is handle "OpenType Layout" tables yet.</p>
-
- <p>FreeType 1 comes with a set of extensions that are used to load
- and manage OpenType Layout tables. It even has a demonstration program
- named <tt>ftstrtto</tt> to show its capabilities.</p>
-
- <p>For FreeType 2, we have decided that the layout operations
- provided through these tables are better placed in a specific
- text-layout library, (many people having asked for such a thing). This
- new engine will not depend on FreeType2 explicitly and will be developed
- as a separate project. We plan to announce it in a few weeks with all
- gory details, once the definitive 2.0 release of FreeType has been
- made.</p>
-
- </td></tr>
- </table>
-
- <p><hr></p>
-
- <a href="index.html">Back to FreeType homepage</a><p>
-
-</td></tr>
-</table>
-</body>
-</html>
diff --git a/docs/glyphs/Image1.png b/docs/glyphs/Image1.png
deleted file mode 100644
index acffdcd..0000000
Binary files a/docs/glyphs/Image1.png and /dev/null differ
diff --git a/docs/glyphs/Image2.png b/docs/glyphs/Image2.png
deleted file mode 100644
index 07285c9..0000000
Binary files a/docs/glyphs/Image2.png and /dev/null differ
diff --git a/docs/glyphs/Image3.png b/docs/glyphs/Image3.png
deleted file mode 100644
index a482089..0000000
Binary files a/docs/glyphs/Image3.png and /dev/null differ
diff --git a/docs/glyphs/Image4.png b/docs/glyphs/Image4.png
deleted file mode 100644
index f3bbe66..0000000
Binary files a/docs/glyphs/Image4.png and /dev/null differ
diff --git a/docs/glyphs/bbox1.png b/docs/glyphs/bbox1.png
deleted file mode 100644
index d39ee24..0000000
Binary files a/docs/glyphs/bbox1.png and /dev/null differ
diff --git a/docs/glyphs/bbox2.png b/docs/glyphs/bbox2.png
deleted file mode 100644
index a8069b1..0000000
Binary files a/docs/glyphs/bbox2.png and /dev/null differ
diff --git a/docs/glyphs/body_comparison.png b/docs/glyphs/body_comparison.png
deleted file mode 100644
index 7f9d8eb..0000000
Binary files a/docs/glyphs/body_comparison.png and /dev/null differ
diff --git a/docs/glyphs/bravo_kerned.png b/docs/glyphs/bravo_kerned.png
deleted file mode 100644
index d8452d3..0000000
Binary files a/docs/glyphs/bravo_kerned.png and /dev/null differ
diff --git a/docs/glyphs/bravo_unkerned.png b/docs/glyphs/bravo_unkerned.png
deleted file mode 100644
index 1182107..0000000
Binary files a/docs/glyphs/bravo_unkerned.png and /dev/null differ
diff --git a/docs/glyphs/clipping.png b/docs/glyphs/clipping.png
deleted file mode 100644
index cf30ef0..0000000
Binary files a/docs/glyphs/clipping.png and /dev/null differ
diff --git a/docs/glyphs/down_flow.png b/docs/glyphs/down_flow.png
deleted file mode 100644
index 2b3f95f..0000000
Binary files a/docs/glyphs/down_flow.png and /dev/null differ
diff --git a/docs/glyphs/glyphs-1.html b/docs/glyphs/glyphs-1.html
deleted file mode 100644
index 9fd7e7d..0000000
--- a/docs/glyphs/glyphs-1.html
+++ /dev/null
@@ -1,199 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType Glyph Conventions</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType Glyph Conventions
-</h1>
-
-<h2 align=center>
- Version 2.1
-</h2>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
-
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-2.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#CCCCFF"
- valign=center><td>
- <h2>
- I. Basic typographic concepts
- </h2>
- </td></tr>
- </table>
-
- <a name="section-1">
- <h3>
- 1. Font files, format and information
- </h3>
-
- <p>A font is a collection of various character images that can be used
- to display or print text. The images in a single font share some common
- properties, including look, style, serifs, etc. Typographically
- speaking, one has to distinguish between a <em>font family</em> and its
- multiple <em>font faces</em>, which usually differ in style though come
- from the same template.</p>
-
- For example, "Palatino Regular" and "Palatino Italic" are two distinct
- <em>faces</em> from the same famous <em>family</em>, called "Palatino"
- itself.</p>
-
- <p>The single term <em>font</em> is nearly always used in ambiguous ways
- to refer to either a given family or given face, depending on the
- context. For example, most users of word-processors use "font" to
- describe a font family (e.g. "Courier", "Palatino", etc.); however most
- of these families are implemented through several data files depending
- on the file format: For TrueType, this is usually one per face (i.e.
- <tt>arial.ttf</tt> for "Arial Regular", <tt>ariali.ttf</tt> for "Arial
- Italic", etc.). The file is also called a "font" but really contains a
- font face.</p>
-
- <p>A <em>digital font</em> is thus a data file that may contain <em>one
- or more font faces</em>. For each of these, it contains character
- images, character metrics, as well as other kind of information
- important to the layout of text and the processing of specific character
- encodings. In some awkward formats, like Adobe's Type 1, a single
- font face is described through several files (i.e. one contains the
- character images, another one the character metrics). We will ignore
- this implementation issue in most parts of this document and consider
- digital fonts as single files, though FreeType 2.0 is able to
- support multiple-files fonts correctly.</p>
-
- <p>As a convenience, a font file containing more than one face is called
- a <em>font collection</em>. This case is rather rare but can be seen in
- many Asian fonts, which contain images for two or more representation
- forms of a given scripts (usually for horizontal and vertical
- layout.</p>
-
-
- <a name="section-2">
- <h3>
- 2. Character images and mappings
- </h3>
-
- <p>The character images are called <em>glyphs</em>. A single character
- can have several distinct images, i.e. several glyphs, depending on
- script, usage or context. Several characters can also take a single
- glyph (good examples are Roman ligatures like "fi" and "fl" which can be
- represented by a single glyph). The relationships between characters
- and glyphs can be very complex, but won't be discussed in this document.
- Moreover, some formats use more or less awkward schemes to store and
- access glyphs. For the sake of clarity, we only retain the following
- notions when working with FreeType:</p>
-
- <ul>
- <li>
- <p>A font file contains a set of glyphs; each one can be stored as a
- bitmap, a vector representation or any other scheme (most scalable
- formats use a combination of mathematical representation and control
- data/programs). These glyphs can be stored in any order in the font
- file, and is typically accessed through a simple glyph index.</p>
- </li>
- <li>
- <p>The font file contains one or more tables, called a <em>character
- map</em> (or charmap in short), which is used to convert character
- codes for a given encoding (e.g. ASCII, Unicode, DBCS, Big5, etc..)
- into glyph indices relative to the font file. A single font face
- may contain several charmaps. For example, most TrueType fonts
- contain an Apple-specific charmap as well as a Unicode charmap,
- which makes them usable on both Mac and Windows platforms.</p>
- </li>
- </ul>
-
-
- <a name="section-3">
- <h3>
- 3. Character and font metrics
- </h3>
-
- <p>Each glyph image is associated with various metrics which are used to
- describe how it must be placed and managed when rendering text. These
- are described in more details in section III; they relate to glyph
- placement, cursor advances as well as text layout. They are extremely
- important to compute the flow of text when rendering a string of
- text.</p>
-
- <p>Each scalable format also contains some global metrics, expressed in
- notional units, to describe some properties of all glyphs in the same
- face. Examples for global metrics are the maximum glyph bounding box,
- the ascender, descender and text height for the font.</p>
-
- <p>Though these metrics also exist for non-scalable formats, they only
- apply for a set of given character dimensions and resolutions, and are
- usually expressed in pixels.</p>
-
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC" valign=center>
- <td align=center
- width="30%">
-
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-2.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/glyphs/glyphs-2.html b/docs/glyphs/glyphs-2.html
deleted file mode 100644
index dc2b2b9..0000000
--- a/docs/glyphs/glyphs-2.html
+++ /dev/null
@@ -1,397 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType Glyph Conventions</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType Glyph Conventions
-</h1>
-
-<h2 align=center>
- Version 2.1
-</h2>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-1.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-3.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#CCCCFF"
- valign=center><td>
- <h2>
- II. Glyph outlines
- </h2>
- </td></tr>
- </table>
-
- <p>This section describes the way scalable representations of glyph
- images, called outlines, are used by FreeType as well as client
- applications.</p>
-
- <a name="section-1">
- <h3>
- 1. Pixels, points and device resolutions
- </h3>
-
- <p>Though it is a very common assumption when dealing with computer
- graphics programs, the physical dimensions of a given pixel (be it for
- screens or printers) are not squared. Often, the output device, be it a
- screen or printer, exhibits varying resolutions in both horizontal and
- vertical direction, and this must be taken care of when rendering
- text.</p>
-
- <p>It is thus common to define a device's characteristics through two
- numbers expressed in <em>dpi</em> (dots per inch). For example, a
- printer with a resolution of 300x600 dpi has 300 pixels per
- inch in the horizontal direction, and 600 in the vertical one. The
- resolution of a typical computer monitor varies with its size
- (15" and 17" monitors don't have the same pixel sizes at
- 640x480), and of course the graphics mode resolution.</p>
-
- <p>As a consequence, the size of text is usually given in
- <em>points</em>, rather than device-specific pixels. Points are a
- simple <em>physical</em> unit, where 1 point = 1/72th of
- an inch, in digital typography. As an example, most Roman books are
- printed with a body text whose size is somewhere between 10 and
- 14 points.</p>
-
- <p>It is thus possible to compute the size of text in pixels from the
- size in points with the following formula:</p>
-
- <center>
- <tt>pixel_size = point_size * resolution / 72</tt>
- </center>
-
- <p>The resolution is expressed in <em>dpi</em>. Since horizontal and
- vertical resolutions may differ, a single point size usually defines a
- different text width and height in pixels.</p>
-
- <p><em>Unlike what is often thought, the "size of text in pixels" is not
- directly related to the real dimensions of characters when they are
- displayed or printed. The relationship between these two concepts is a
- bit more complex and relate to some design choices made by the font
- designer. This is described in more detail in the next sub-section (see
- the explanations on the EM square).</em></p>
-
-
- <a name="section-2">
- <h3>
- 2. Vectorial representation
- </h3>
-
- <p>The source format of outlines is a collection of closed paths called
- <em>contours</em>. Each contour delimits an outer or inner
- <em>region</em> of the glyph, and can be made of either <em>line
- segments</em> or <em>Bézier arcs</em>.</p>
-
- <p>The arcs are defined through <em>control points</em>, and can be
- either second-order (these are <em>conic</em> Béziers) or
- third-order (<em>cubic</em> Béziers) polynomials, depending on
- the font format. Note that conic Béziers are usually called
- <em>quadratic</em> Béziers in the literature. Hence, each point
- of the outline has an associated flag indicating its type (normal or
- control point). And scaling the points will scale the whole
- outline.</p>
-
- <p>Each glyph's original outline points are located on a grid of
- indivisible units. The points are usually stored in a font file as
- 16-bit integer grid coordinates, with the grid origin's being at (0,0);
- they thus range from -16384 to 16383. (Even though point
- coordinates can be floats in other formats such as Type 1, we will
- restrict our analysis to integer values for simplicity).</p>
-
- <p><em>The grid is always oriented like the traditional mathematical
- two-dimensional plane, i.e., the <i>X</i> axis from the left to the
- right, and the <i>Y</i> axis from bottom to top.</em></p>
-
- <p>In creating the glyph outlines, a type designer uses an imaginary
- square called the <em>EM square</em>. Typically, the EM square can be
- thought of as a tablet on which the characters are drawn. The square's
- size, i.e., the number of grid units on its sides, is very important for
- two reasons:</p>
-
- <ul>
- <li>
- <p>It is the reference used to scale the outlines to a given text
- dimension. For example, a size of 12pt at 300x300 dpi
- corresponds to 12*300/72 = 50 pixels. This is the
- size the EM square would appear on the output device if it was
- rendered directly. In other words, scaling from grid units to
- pixels uses the formula:</p>
-
- <p><center>
- <tt>pixel_size = point_size * resolution / 72</tt><br>
- <tt>pixel_coord = grid_coord * pixel_size / EM_size</tt>
- </center></p>
- </li>
- <li>
- <p>The greater the EM size is, the larger resolution the designer
- can use when digitizing outlines. For example, in the extreme
- example of an EM size of 4 units, there are only 25 point
- positions available within the EM square which is clearly not
- enough. Typical TrueType fonts use an EM size of 2048 units;
- Type 1 PostScript fonts have a fixed EM size of 1000 grid
- units but point coordinates can be expressed as floating values.</p>
- </li>
- </ul>
-
- <p>Note that glyphs can freely extend beyond the EM square if the font
- designer wants so. The EM is used as a convenience, and is a valuable
- convenience from traditional typography.</p>
-
- <p>Grid units are very often called <em>font units</em> or <em>EM
- units</em>.</p>
-
- <p><em>As said before, <tt>pixel_size</tt> computed in the above formula
- does not relate directly to the size of characters on the screen. It
- simply is the size of the EM square if it was to be displayed. Each
- font designer is free to place its glyphs as it pleases him within the
- square. This explains why the letters of the following text have not
- the same height, even though they are displayed at the same point size
- with distinct fonts:</em>
-
- <p><center>
- <img src="body_comparison.png"
- height=40 width=580
- alt="Comparison of font heights">
- </center></p>
-
- <p>As one can see, the glyphs of the Courier family are smaller than
- those of Times New Roman, which themselves are slightly smaller than
- those of Arial, even though everything is displayed or printed at a size
- of 16 points. This only reflects design choices.</p>
-
-
- <a name="section-3">
- <h3>
- 3. Hinting and Bitmap rendering
- </h3>
-
- <p>The outline as stored in a font file is called the "master" outline,
- as its points coordinates are expressed in font units. Before it can be
- converted into a bitmap, it must be scaled to a given size/resolution.
- This is done through a very simple transformation, but always creates
- undesirable artifacts, e.g. stems of different widths or heights in
- letters like "E" or "H".</p>
-
- <p>As a consequence, proper glyph rendering needs the scaled points to
- be aligned along the target device pixel grid, through an operation
- called <em>grid-fitting</em> (often called<em>hinting</em>). One of its
- main purposes is to ensure that important widths and heights are
- respected throughout the whole font (for example, it is very often
- desirable that the "I" and the "T" have their central vertical line of
- the same pixel width), as well as to manage features like stems and
- overshoots, which can cause problems at small pixel sizes.</p>
-
- <p>There are several ways to perform grid-fitting properly; most
- scalable formats associate some control data or programs with each glyph
- outline. Here is an overview:</p>
-
- <ul>
- <li>
- <p><em>explicit grid-fitting</em></p>
-
- <p>The TrueType format defines a stack-based virtual machine, for
- which programs can be written with the help of more than
- 200 opcodes (most of these relating to geometrical operations).
- Each glyph is thus made of both an outline and a control program to
- perform the actual grid-fitting in the way defined by the font
- designer.</p>
- </li>
- <li>
- <p><em>implicit grid-fitting (also called hinting)</em></p>
-
- <p>The Type 1 format takes a much simpler approach: Each glyph
- is made of an outline as well as several pieces called
- <em>hints</em> which are used to describe some important features of
- the glyph, like the presence of stems, some width regularities, and
- the like. There aren't a lot of hint types, and it is up to the
- final renderer to interpret the hints in order to produce a fitted
- outline.</p>
- </li>
- <li>
- <p><em>automatic grid-fitting</em></p>
-
- <p>Some formats simply include no control information with each
- glyph outline, apart from metrics like the advance width and height.
- It is then up to the renderer to "guess" the more interesting
- features of the outline in order to perform some decent
- grid-fitting.</p>
- </li>
- </ul>
-
- <p>The following table summarises the pros and cons of each scheme.</p>
-
- <center>
- <table width="90%"
- bgcolor="#CCCCCC"
- cellpadding=5>
- <tr bgcolor="#999999">
- <td>
- <center>
- <b>grid-fitting scheme</b>
- </center>
- </td>
- <td>
- <center>
- <b>advantages</b>
- </center>
- </td>
- <td>
- <center>
- <b>disadvantages</b>
- </center>
- </td>
- </tr>
-
- <tr>
- <td valign=top>
- <center>
- <b>explicit</b>
- </center>
- </td>
-
- <td valign=top>
- <p><b>Quality.</b> Excellent results at small sizes are possible.
- This is very important for screen display.</p>
-
- <p><b>Consistency.</b> All renderers produce the same glyph
- bitmaps.</p>
- </td>
-
- <td valign=top>
- <p><b>Speed.</b> Intepreting bytecode can be slow if the glyph
- programs are complex.</p>
-
- <p><b>Size.</b> Glyph programs can be long.</p>
-
- <p><b>Technical difficulty.</b>
- It is extremely difficult to write good hinting
- programs. Very few tools available.</p>
- </td>
- </tr>
- <tr>
- <td valign=top>
- <center>
- <b>implicit</b>
- </center>
- </td>
-
- <td valign=top>
- <p><b>Size.</b> Hints are usually much smaller than explicit glyph
- programs.</p>
-
- <p><b>Speed.</b>
- Grid-fitting is usually a fast process.</p>
- </td>
-
- <td valign=top>
- <p><b>Quality.</b> Often questionable at small sizes. Better with
- anti-aliasing though.</p>
-
- <p><b>Inconsistency.</b> Results can vary between different
- renderers, or even distinct versions of the same engine.</p>
- </td>
- </tr>
-
- <tr>
- <td valign=top>
- <center>
- <b>automatic</b>
- </center>
- </td>
-
- <td valign=top>
- <p><b>Size.</b> No need for control information, resulting in
- smaller font files.</p>
-
- <p><b>Speed.</b> Depends on the grid-fitting algorithm. Usually
- faster than explicit grid-fitting.</p>
- </td>
-
- <td valign=top>
- <p><b>Quality.</b> Often questionable at small sizes. Better with
- anti-aliasing though.</p>
-
- <p><b>Speed.</b> Depends on the grid-fitting algorithm.</p>
-
- <p><b>Inconsistency.</b> Results can vary between different
- renderers, or even distinct versions of the same engine.</p>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-1.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-3.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/glyphs/glyphs-3.html b/docs/glyphs/glyphs-3.html
deleted file mode 100644
index bec54e1..0000000
--- a/docs/glyphs/glyphs-3.html
+++ /dev/null
@@ -1,430 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType Glyph Conventions</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType Glyph Conventions
-</h1>
-
-<h2 align=center>
- Version 2.1
-</h2>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-2.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-4.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#CCCCFF"
- valign=center><td>
- <h2>
- III. Glyph metrics
- </h2>
- </td></tr>
- </table>
-
- <a name="section-1">
- <h3>
- 1. Baseline, pens and layouts
- </h3>
-
- <p>The baseline is an imaginary line that is used to "guide" glyphs when
- rendering text. It can be horizontal (e.g. Roman, Cyrillic, Arabic,
- etc.) or vertical (e.g. Chinese, Japanese, Korean, etc). Moreover, to
- render text, a virtual point, located on the baseline, called the <em>pen
- position</em> or <em>origin</em>, is used to locate glyphs.</p>
-
- <p>Each layout uses a different convention for glyph placement:</p>
-
- <ul>
- <li>
- <p>With horizontal layout, glyphs simply "rest" on the baseline.
- Text is rendered by incrementing the pen position, either to the
- right or to the left.</p>
-
- <p>The distance between two successive pen positions is
- glyph-specific and is called the <em>advance width</em>. Note that
- its value is <em>always</em> positive, even for right-to-left
- oriented alphabets, like Arabic. This introduces some differences
- in the way text is rendered.</p>
-
- <p><em>The pen position is always placed on the baseline.</em></p>
-
- <p><center>
- <img src="Image1.png"
- height=179 width=458
- alt="horizontal layout">
- </center></p>
- </li>
- <li>
- <p>With a vertical layout, glyphs are centered around the
- baseline:</p>
-
- <p><center>
- <img src="Image2.png"
- height=275 width=162
- alt="vertical layout">
- </center></p>
- </li>
- </ul>
-
-
- <a name="section-2">
- <h3>
- 2. Typographic metrics and bounding boxes
- </h3>
-
- <p>A various number of face metrics are defined for all glyphs in a
- given font.</p>
-
- <ul>
- <li>
- <p><em>Ascent</em></p>
-
- <p>The distance from the baseline to the highest/upper grid
- coordinate used to place an outline point. It is a positive value,
- due to the grid's orientation with the <i>Y</i> axis
- upwards.</p>
- </li>
-
- <li>
- <p><em>Descent</em></p>
-
- <p>The distance from the baseline to the lowest grid coordinate used
- to place an outline point. This is a negative value, due to the
- grid's orientation.</p>
- </li>
-
- <li>
- <p><em>Linegap</em></p>
-
- <p>The distance that must be placed between two lines of text. The
- baseline-to-baseline distance should be computed as:
-
- <center><p>
- <tt>ascent - descent + linegap</tt>
- </p></center>
-
- <p>if you use the typographic values.</p>
- </li>
- </ul>
-
- <p>Other, simpler metrics are:</p>
-
- <ul>
- <li>
- <p><em>The glyph's bounding box</em>, also called <em>bbox</em></p>
-
- <p>This is an imaginary box that encloses all glyphs from the font,
- usually as tightly as possible. It is represented by four fields,
- namely <tt>xMin</tt>, <tt>yMin</tt>, <tt>xMax</tt>, and
- <tt>yMax</tt>, that can be computed for any outline. Their values
- can be in font units (if measured in the original outline) or in
- fractional/integer pixel units (when measured on scaled
- outlines).</p>
-
- <p>Note that if it wasn't for grid-fitting, you wouldn't need to
- know a box's complete values, but only its dimensions to know how
- big is a glyph outline/bitmap. However, correct rendering of hinted
- glyphs needs the preservation of important grid alignment on each
- glyph translation/placement on the baseline.</p>
- </li>
-
- <li>
- <p><em>Internal leading</em></p>
-
- <p>This concept comes directly from the world of traditional
- typography. It represents the amount of space within the
- <em>leading</em> which is reserved for glyph features that lay
- outside of the EM square (like accentuation). It usually can be
- computed as:</p>
-
- <center><p>
- <tt>internal leading = ascent - descent - EM_size</tt>
- </p></center>
- </li>
-
- <li>
- <p><em>External leading</em></p>
-
- <p>This is another name for the line gap.</p>
- </li>
- </ul>
-
-
- <a name="section-3">
- <h3>
- 3. Bearings and Advances
- </h3>
-
- Each glyph has also distances called <em>bearings</em> and
- <em>advances</em>. Their definition is constant, but their values
- depend on the layout, as the same glyph can be used to render text
- either horizontally or vertically:
-
- <ul>
- <li>
- <p><em>Left side bearing</em> or <em>bearingX</em></p>
-
- <p>The horizontal distance from the current pen position to the
- glyph's left bbox edge. It is positive for horizontal layouts, and
- in most cases negative for vertical ones.</p>
- </li>
-
- <li>
- <p><em>Top side bearing</em> or <em>bearingY</em></p>
-
- <p>The vertical distance from the baseline to the top of the glyph's
- bbox. It is usually positive for horizontal layouts, and negative
- for vertical ones.</p>
- </li>
-
- <li>
- <p><em>Advance width</em> or <em>advanceX</em></p>
-
- <p>The horizontal distance the pen position must be incremented (for
- left-to-right writing) or decremented (for right-to-left writing) by
- after each glyph is rendered when processing text. It is always
- positive for horizontal layouts, and null for vertical ones.</p>
- </li>
-
- <li>
- <p><em>Advance height</em> <em>advanceY</em></p>
-
- <p>The vertical distance the pen position must be decremented by
- after each glyph is rendered. It is always null for horizontal
- layouts, and positive for vertical layouts.</p>
- </li>
-
- <li>
- <p><em>Glyph width</em></p>
-
- <p>The glyph's horizontal extent. For unscaled font coordinates, it
- is <tt>bbox.xMax-bbox.xMin</tt>. For scaled glyphs, its computation
- requests specific care, described in the grid-fitting chapter
- below.</p>
- </li>
-
- <li>
- <p><em>Glyph height</em>
-
- <p>The glyph's vertical extent. For unscaled font coordinates, it is
- <tt>bbox.yMax-bbox.yMin</tt>. For scaled glyphs, its computation
- requests specific care, described in the grid-fitting chapter
- below.</p>
- </li>
-
- <li>
- <p><em>Right side bearing</em></p>
-
- <p>Only used for horizontal layouts to describe the distance from
- the bbox's right edge to the advance width. It is in most cases a
- non-negative number:</p>
-
- <p><center>
- <tt>advance_width - left_side_bearing - (xMax-xMin)</tt>
- </center></p>
- </li>
- </ul>
-
- <p>Here is a picture giving all the details for horizontal metrics:
-
- <center><p>
- <img src="Image3.png"
- height=253 width=388
- alt="horizontal glyph metrics">
- </p></center>
-
- <p>And here is another one for the vertical metrics:</p>
-
- <center><p>
- <img src="Image4.png"
- height=278 width=294
- alt="vertical glyph metrics">
- </p></center>
-
-
- <a name="section-4">
- <h3>
- 4. The effects of grid-fitting
- </h3>
-
- <p>Because hinting aligns the glyph's control points to the pixel grid,
- this process slightly modifies the dimensions of character images in
- ways that differ from simple scaling.</p>
-
- <p>For example, the image of the lowercase "m" letter sometimes fits a
- square in the master grid. However, to make it readable at small pixel
- sizes, hinting tends to enlarge its scaled outline in order to keep its
- three legs distinctly visible, resulting in a larger character
- bitmap.</p>
-
- <p>The glyph metrics are also influenced by the grid-fitting process:
-
- <ul>
- <li>
- The image's width and height are altered. Even if this is only by
- one pixel, it can make a big difference at small pixel sizes.
- </li>
- <li>
- The image's bounding box is modified, thus modifying the bearings.
- </li>
- <li>
- The advances must be updated. For example, the advance width must
- be incremented if the hinted bitmap is larger than the scaled one,
- to reflect the augmented glyph width.
- </li>
- </ul>
-
- <p>This has some implications:</p>
-
- <ul>
- <li>
- Because of hinting, simply scaling the font ascent or descent might
- not give correct results. A possible solution is to keep the
- ceiling of the scaled ascent, and floor of the scaled descent.
- </li>
-
- <li>
- There is no easy way to get the hinted glyph and advance widths of a
- range of glyphs, as hinting works differently on each outline. The
- only solution is to hint each glyph separately and record the
- returned values. Some formats, like TrueType, even include a table
- of pre-computed values for a small set of common character pixel
- sizes.
- </li>
- <li>
- Hinting depends on the final character width and height in pixels,
- which means that it is highly resolution-dependent. This property
- makes correct WYSIWYG layouts difficult to implement.
- </li>
- </ul>
-
-
- <em>
- <p>Performing 2D transformations on glyph outlines is very easy with
- FreeType. However, when using translation on a hinted outlines, one
- should aways take care of <b>exclusively using integer pixel
- distances</b> (which means that the parameters to the
- <tt>FT_Translate_Outline()</tt> API should all be multiples
- of 64, as the point coordinates are in 26.6 fixed float
- format).</p>
-
- <p>Otherwise, the translation will simply <em>ruin the hinter's
- work</em>, resulting in a very low quality bitmaps!</p>
- </em>
-
-
- <a name="section-5">
- <h3>
- 5. Text widths and bounding box
- </h3>
-
- <p>As seen before, the "origin" of a given glyph corresponds to the
- position of the pen on the baseline. It is not necessarily located on
- one of the glyph's bounding box corners, unlike many typical bitmapped
- font formats. In some cases, the origin can be out of the bounding box,
- in others, it can be within it, depending on the shape of the given
- glyph.</p>
-
- <p>Likewise, the glyph's "advance width" is the increment to apply to
- the pen position during layout, and is not related to the glyph's
- "width", which really is the glyph's bounding width.
-
- <p>The same conventions apply to strings of text. This means that:
-
- <ul>
- <li>
- The bounding box of a given string of text doesn't necessarily
- contain the text cursor, nor is the latter located on one of its
- corners.
- </li>
-
- <li>
- The string's advance width isn't related to its bounding box
- dimensions. Especially if it contains beginning and terminal spaces
- or tabs.
- </li>
- <li>
- Finally, additional processing like kerning creates strings of text
- whose dimensions are not directly related to the simple
- juxtaposition of individual glyph metrics. For example, the advance
- width of "VA" isn't the sum of the advances of "V" and "A" taken
- separately.
- </li>
- </ul>
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-2.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-4.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/glyphs/glyphs-4.html b/docs/glyphs/glyphs-4.html
deleted file mode 100644
index 37af040..0000000
--- a/docs/glyphs/glyphs-4.html
+++ /dev/null
@@ -1,231 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType Glyph Conventions</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType Glyph Conventions
-</h1>
-
-<h2 align=center>
- Version 2.1
-</h2>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-3.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-4.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#CCCCFF"
- valign=center><td>
- <h2>
- IV. Kerning
- </h2>
- </td></tr>
- </table>
-
- <p>The term <em>kerning</em> refers to specific information used to
- adjust the relative positions of coincident glyphs in a string of text.
- This section describes several types of kerning information, as well as
- the way to process them when performing text layout.</p>
-
-
- <a name="section-1">
- <h3>
- 1. Kerning pairs
- </h3>
-
- <p>Kerning consists of modifying the spacing between two successive
- glyphs according to their outlines. For example, a "T" and a "y" can be
- easily moved closer, as the top of the "y" fits nicely under the upper
- right bar of the "T".</p>
-
- <p>When laying out text with only their standard widths, some
- consecutive glyphs seem a bit too close or too distant. For example,
- the space between the "A" and the "V" in the following word seems a
- little wider than needed.</p>
-
- <center><p>
- <img src="bravo_unkerned.png"
- height=37 width=116
- alt="the word 'bravo' unkerned">
- </p></center>
-
- <p>Compare this to the same word, where the distance between these two
- letters has been slightly reduced:</p>
-
- <center><p>
- <img src="bravo_kerned.png"
- height=37 width=107
- alt="the word 'bravo' with kerning">
- </p></center>
-
- <p>As you can see, this adjustment can make a great difference. Some
- font faces thus include a table containing kerning distances for a set
- of given glyph pairs for text layout.</p>
-
- <ul>
- <li>
- <p>The pairs are ordered, i.e., the space for pair (A,V) isn't
- necessarily the space for pair (V,A). They also index glyphs, and
- not characters.</p>
- </li>
- <li>
- <p>Kerning distances can be expressed in horizontal or vertical
- directions, depending on layout and/or script. For example, some
- horizontal layouts like Arabic can make use of vertical kerning
- adjustments between successive glyphs. A vertical script can have
- vertical kerning distances.</p>
- </li>
- <li>
- <p>Kerning distances are expressed in grid units. They are usually
- oriented in the <i>X</i> axis, which means that a negative
- value indicates that two glyphs must be set closer in a horizontal
- layout.</p>
- </li>
- </ul>
-
-
- <a name="section-2">
- <h3>
- 2. Applying kerning
- </h3>
-
- <p>Applying kerning when rendering text is a rather easy process. It
- merely consists in adding the scaled kern distance to the pen position
- before writing each next glyph. However, the typographically correct
- renderer must take a few more details in consideration.</p>
-
- <p>The "sliding dot" problem is a good example: Many font faces include
- a kerning distance between capital letters like "T" or "F" and a
- following dot ("."), in order to slide the latter glyph just right to
- their main leg:</p>
-
- <center><p>
- <img src="twlewis1.png"
- height=38 width=314
- alt="example for sliding dots">
- </p></center>
-
- <p>This sometimes requires additional adjustments between the dot and
- the letter following it, depending on the shapes of the enclosing
- letters. When applying "standard" kerning adjustments, the previous
- sentence would become:</p>
-
- <center><p>
- <img src="twlewis2.png"
- height=36 width=115
- alt="example for too much kerning">
- </p></center>
-
- <p>This is clearly too contracted. The solution here, as exhibited in
- the first example, is to only slide the dots when possible. Of course,
- this requires a certain knowledge of the text's meaning. The above
- adjustments would not necessarily be welcome if we were rendering the
- final dot of a given paragraph.</p.
-
- <p>This is only one example, and there are many others showing that a
- real typographer is needed to layout text properly. If not available,
- some kind of user interaction or tagging of the text could be used to
- specify some adjustments, but in all cases, this requires some support
- in applications and text libraries.</p>
-
- <p>For more mundane and common uses, however, we can have a very simple
- algorithm, which avoids the sliding dot problem, and others, though not
- producing optimal results. It can be seen as</p>
-
- <ol>
- <li>
- Place the first glyph on the baseline.
- </li>
- <li>
- Save the location of the pen position/origin in <tt>pen1</tt>.
- </li>
- <li>
- Adjust the pen position with the kerning distance between the first
- and second glyph.
- </li>
- <li>
- Place the second glyph and compute the next pen position/origin in
- <tt>pen2</tt>.
- </li>
- <li>
- Use <tt>pen1</tt> as the next pen position if it is beyond
- <tt>pen2</tt>, use <tt>pen2</tt> otherwise.
- </li>
- </ol>
-
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-3.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-5.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/glyphs/glyphs-5.html b/docs/glyphs/glyphs-5.html
deleted file mode 100644
index 4dbb7e7..0000000
--- a/docs/glyphs/glyphs-5.html
+++ /dev/null
@@ -1,484 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType Glyph Conventions</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType Glyph Conventions
-</h1>
-
-<h2 align=center>
- Version 2.1
-</h2>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-4.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-6.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#CCCCFF"
- valign=center><td>
- <h2>
- V. Text processing
- </h2>
- </td></tr>
- </table>
-
- <p>This section demonstrates how to use the concepts previously defined
- to render text, whatever the layout you use.</p>
-
-
- <a name="section-1">
- <h3>
- 1. Writing simple text strings
- </h3>
-
- <p>In this first example, we will generate a simple string of Roman
- text, i.e. with a horizontal left-to-right layout. Using exclusively
- pixel metrics, the process looks like:
-
- <tt>
- <ol>
- <li>
- Convert the character string into a series of glyph
- indices.
- </li>
- <li>
- Place the pen to the cursor position.
- </li>
- <li>
- Get or load the glyph image.
- </li>
- <li>
- Translate the glyph so that its 'origin' matches the pen position.
- </li>
- <li>
- Render the glyph to the target device.
- </li>
- <li>
- Increment the pen position by the glyph's advance width in pixels.
- </li>
- <li>
- Start over at step 3 for each of the remaining glyphs.
- </li>
- <li>
- When all glyphs are done, set the text cursor to the new pen
- position.
- </li>
- </ol>
- </tt>
-
- <p>Note that kerning isn't part of this algorithm.</p>
-
-
- <a name="section-2">
- <h3>
- 2. Sub-pixel positioning
- </h3>
-
- <p>It is somewhat useful to use sub-pixel positioning when rendering
- text. This is crucial, for example, to provide semi-WYSIWYG text
- layouts. Text rendering is very similar to the algorithm described in
- subsection 1, with the following few differences:</p>
-
- <ul>
- <li>
- The pen position is expressed in fractional pixels.
- </li>
- <li>
- Because translating a hinted outline by a non-integer distance will
- ruin its grid-fitting, the position of the glyph origin must be
- rounded before rendering the character image.
- </li>
- <li>
- The advance width is expressed in fractional pixels, and isn't
- necessarily an integer.
- </li>
- </ol>
-
- <p>Here an improved version of the algorithm:</p>
-
- <tt>
- <ol>
- <li>
- Convert the character string into a series of glyph
- indices.
- </li>
- <li>
- Place the pen to the cursor position. This can be a non-integer
- point.
- </li>
- <li>
- Get or load the glyph image.
- </li>
- <li>
- Translate the glyph so that its "origin" matches the rounded pen
- position.
- </li>
- <li>
- Render the glyph to the target device.
- </li>
- <li>
- Increment the pen position by the glyph's advance width in
- fractional pixels.
- </li>
- <li>
- Start over at step 3 for each of the remaining glyphs.
- </li>
- <li>
- When all glyphs are done, set the text cursor to the new pen
- position.
- </li>
- </ol>
- </tt>
-
- <p>Note that with fractional pixel positioning, the space between two
- given letters isn't fixed, but determined by the accumulation of
- previous rounding errors in glyph positioning.</p>
-
-
- <a name="section-3">
- <h3>
- 3. Simple kerning
- </h3>
-
- <p>Adding kerning to the basic text rendering algorithm is easy: When a
- kerning pair is found, simply add the scaled kerning distance to the pen
- position before step 4. Of course, the distance should be rounded
- in the case of algorithm 1, though it doesn't need to for
- algorithm 2. This gives us:</p>
-
- <p>Algorithm 1 with kerning:</p>
-
- <tt>
- <ol>
- <li>
- Convert the character string into a series of glyph
- indices.
- </li>
- <li>
- Place the pen to the cursor position.
- </li>
- <li>
- Get or load the glyph image.
- </li>
- <li>
- Add the rounded scaled kerning distance, if any, to the pen
- position.
- </li>
- <li>
- Translate the glyph so that its "origin" matches the pen position.
- </li>
- <li>
- Render the glyph to the target device.
- </li>
- <li>
- Increment the pen position by the glyph's advance width in pixels.
- </li>
- <li>
- Start over at step 3 for each of the remaining glyphs.
- </li>
- </ol>
- </tt>
-
- <p>Algorithm 2 with kerning:</p>
-
- <tt>
- <ol>
- <li>
- Convert the character string into a series of glyph
- indices.
- </li>
- <li>
- Place the pen to the cursor position.
- </li>
- <li>
- Get or load the glyph image.
- </li>
- <li>
- Add the scaled unrounded kerning distance, if any, to the pen
- position.
- </li>
- <li>
- Translate the glyph so that its "origin" matches the rounded pen
- position.
- </li>
- <li>
- Render the glyph to the target device.
- </li>
- <li>
- Increment the pen position by the glyph's advance width in
- fractional pixels.
- </li>
- <li>
- Start over at step 3 for each of the remaining glyphs.
- </li>
- </ol>
- </tt>
-
- Of course, the algorithm described in section IV can also be
- applied to prevent the sliding dot problem if one wants to.
-
-
- <a name="section-4">
- <h3>
- 4. Right-to-left layout
- </h3>
-
- <p>The process of laying out Arabic or Hebrew text is extremely similar.
- The only difference is that the pen position must be decremented before
- the glyph rendering (remember: the advance width is always positive,
- even for Arabic glyphs).</p>
-
- <p>Right-to-left algorithm 1:</p>
-
- <tt>
- <ol>
- <li>
- Convert the character string into a series of glyph
- indices.
- </li>
- <li>
- Place the pen to the cursor position.
- </li>
- <li>
- Get or load the glyph image.
- </li>
- <li>
- Decrement the pen position by the glyph's advance width in pixels.
- </li>
- <li>
- Translate the glyph so that its "origin" matches the pen position.
- </li>
- <li>
- Render the glyph to the target device.
- </li>
- <li>
- Start over at step 3 for each of the remaining glyphs.
- </li>
- </ol>
- </tt>
-
- <p>The changes to algorithm 2, as well as the inclusion of kerning
- are left as an exercise to the reader.</p>
-
-
- <a name="section-5">
- <h3>
- 5. Vertical layouts
- </h3>
-
- <p>Laying out vertical text uses exactly the same processes, with the
- following significant differences:</p>
-
- <ul>
- <li>
- <p>The baseline is vertical, and the vertical metrics must be used
- instead of the horizontal one.</p>
- </li>
- <li>
- <p>The left bearing is usually negative, but this doesn't change the
- fact that the glyph origin must be located on the baseline.</p>
- </li>
- <li>
- The advance height is always positive, so the pen position must be
- decremented if one wants to write top to bottom (assuming the
- <i>Y</i> axis is oriented upwards).
- </li>
- </ul>
-
- <p>Here the algorithm:</p>
-
- <tt>
- <ol>
- <li>
- Convert the character string into a series of glyph
- indices.
- </li>
- <li>
- Place the pen to the cursor position.
- </li>
- <li>
- Get or load the glyph image.
- </li>
- <li>
- Translate the glyph so that its "origin" matches the pen position.
- </li>
- <li>
- Render the glyph to the target device.
- </li>
- <li>
- Decrement the vertical pen position by the glyph's advance height
- in pixels.
- </li>
- <li>
- Start over at step 3 for each of the remaining glyphs.
- </li>
- <li>
- When all glyphs are done, set the text cursor to the new pen
- position.
- </li>
- </ol>
- </tt>
-
-
- <a name="section-6">
- <h3>
- 6. WYSIWYG text layouts
- </h3>
-
- <p>As you probably know, the acronym WYSIWYG stands for "What You See Is
- What You Get". Basically, this means that the output of a document on
- the screen should match "perfectly" its printed version. A
- <em>true</em> WYSIWYG system requires two things:</p>
-
- <ul>
- <li>
- <p><em>device-independent text layout</em></p>
-
- <p>This means that the document's formatting is the same on the
- screen than on any printed output, including line breaks,
- justification, ligatures, fonts, position of inline images, etc.</p>
- </li>
- <li>
- <p><em>matching display and print character sizes</em></p>
-
- <p>The displayed size of a given character should match its
- dimensions when printed. For example, a text string which is
- exactly 1 inch tall when printed should also appear 1 inch
- tall on the screen (when using a scale of 100%).</p>
- </li>
- </ul>
-
- <p>It is clear that matching sizes cannot be possible if the computer
- has no knowledge of the physical resolutions of the display device(s) it
- is using. And of course, this is the most common case! That is not too
- unfortunate, however, because most users really don't care about this
- feature. Legibility is much more important.</p>
-
- <p>When the Mac appeared, Apple decided to choose a resolution of
- 72 dpi to describe the Macintosh screen to the font sub-system
- (whatever the monitor used). This choice was most probably driven by
- the fact that, at this resolution, 1 point equals exactly
- 1 pixel. However, it neglected one crucial fact: As most users
- tend to choose a document character size between 10 and 14 points,
- the resultant displayed text was rather small and not too legible
- without scaling. Microsoft engineers took notice of this problem and
- chose a resolution of 96 dpi on Windows, which resulted in slightly
- larger, and more legible, displayed characters (for the same printed
- text size).</p>
-
- <p>These distinct resolutions explain some differences when displaying
- text at the same character size on a Mac and a Windows machine.
- Moreover, it is not unusual to find some TrueType fonts with enhanced
- hinting (technical note: through delta-hinting) for the sizes of 10, 12,
- 14 and 16 points at 96 dpi.</p>
-
- <p>The term <em>device-independent text</em> is, unfortunately, often
- abused. For example, many word processors, including MS Word, do
- not really use device-independent glyph positioning algorithms when
- laying out text. Rather, they use the target printer's resolution to
- compute <em>hinted</em> glyph metrics for the layout. Though it
- guarantees that the printed version is always the "nicest" it can be,
- especially for very low resolution printers (like dot-matrix), it has a
- very sad effect: Changing the printer can have dramatic effects on the
- <em>whole</em> document layout, especially if it makes strong use of
- justification, uses few page breaks, etc.</p>
-
- <p>Because glyph metrics vary slightly when the resolution changes (due
- to hinting), line breaks can change enormously, when these differences
- accumulate over long runs of text. Try for example printing a very long
- document (with no page breaks) on a 300 dpi ink-jet printer, then
- the same one on a 3000 dpi laser printer: You will be extremely
- lucky if your final page count didn't change between the prints! Of
- course, we can still call this WYSIWYG, as long as the printer
- resolution is fixed.</p>
-
- <p>Some applications, like Adobe Acrobat, which targeted
- device-independent placement from the start, do not suffer from this
- problem. There are two ways to achieve this: either use the scaled and
- unhinted glyph metrics when laying out text both in the rendering and
- printing processes, or simply use whatever metrics you want and store
- them with the text in order to get sure they are printed the same on all
- devices (the latter being probably the best solution, as it also enables
- font substitution without breaking text layouts).</p>
-
- <p>Just like matching sizes, device-independent placement isn't
- necessarily a feature that most users want. However, it is pretty clear
- that for any kind of professional document processing work, it
- <em>is</em> a requirement.</p>
-
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-4.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-6.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/glyphs/glyphs-6.html b/docs/glyphs/glyphs-6.html
deleted file mode 100644
index df98401..0000000
--- a/docs/glyphs/glyphs-6.html
+++ /dev/null
@@ -1,432 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType Glyph Conventions</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType Glyph Conventions
-</h1>
-
-<h2 align=center>
- Version 2.1
-</h2>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-5.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-7.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#CCCCFF"
- valign=center><td>
- <h2>
- VI. FreeType outlines
- </h2>
- </td></tr>
- </table>
-
- <p>The purpose of this section is to present the way FreeType manages
- vectorial outlines, as well as the most common operations that can be
- applied on them.</p>
-
- <a name="section-1">
- <h3>
- 1. FreeType outline description and structure
- </h3>
-
- <h4>
- a. Outline curve decomposition
- </h4>
-
- <p>An outline is described as a series of closed contours in the 2D
- plane. Each contour is made of a series of line segments and
- Bézier arcs. Depending on the file format, these can be
- second-order or third-order polynomials. The former are also called
- quadratic or conic arcs, and they are used in the TrueType format.
- The latter are called cubic arcs and are mostly used in the
- Type 1 format.</p>
-
- <p>Each arc is described through a series of start, end, and control
- points. Each point of the outline has a specific tag which indicates
- whether it is used to describe a line segment or an arc. The tags can
- take the following values:</p>
-
- <center>
- <table cellspacing=5
- cellpadding=5
- width="80%">
- <tr VALIGN=TOP>
- <td valign=top>
- <tt>FT_Curve_Tag_On</tt>
- </td>
- <td valign=top>
- <p>Used when the point is "on" the curve. This corresponds to
- start and end points of segments and arcs. The other tags specify
- what is called an "off" point, i.e. a point which isn't located on
- the contour itself, but serves as a control point for a
- Bézier arc.</p>
- </td>
- </tr>
-
- <tr>
- <td valign=top>
- <tt>FT_Curve_Tag_Conic</tt>
- </td>
- <td valign=top>
- <p>Used for an "off" point used to control a conic Bézier
- arc.</p>
- </td>
- </tr>
-
- <tr>
- <td valign=top>
- <tt>FT_Curve_Tag_Cubic</tt>
- </td>
- <td valign=top>
- <p>Used for an "off" point used to control a cubic Bézier
- arc.</p>
- </td>
- </tr>
- </table>
- </center>
-
- <p>The following rules are applied to decompose the contour's points
- into segments and arcs:</p>
-
- <ul>
- <li>
- Two successive "on" points indicate a line segment joining them.
- </li>
- <li>
- One conic "off" point amidst two "on" points indicates a conic
- Bézier arc, the "off" point being the control point, and
- the "on" ones the start and end points.
- </li>
- <li>
- Two successive cubic "off" points amidst two "on" points indicate
- a cubic Bézier arc. There must be exactly two cubic
- control points and two "on" points for each cubic arc (using a
- single cubic "off" point between two "on" points is forbidden, for
- example).
- </li>
- <li>
- Finally, two successive conic "off" points forces the rasterizer
- to create (during the scan-line conversion process exclusively) a
- virtual "on" point amidst them, at their exact middle. This
- greatly facilitates the definition of successive conic
- Bézier arcs. Moreover, it is the way outlines are
- described in the TrueType specification.
- </li>
- </ul>
-
- <p>Note that it is possible to mix conic and cubic arcs in a single
- contour, even though no current font driver produces such
- outlines.</p>
-
- <center>
- <table>
- <tr>
- <td>
- <img src="points_segment.png"
- height=166 width=221
- alt="segment example">
- </td>
- <td>
- <img src="points_conic.png"
- height=183 width=236
- alt="conic arc example">
- </td>
- </tr>
- <tr>
- <td>
- <img src="points_cubic.png"
- height=162 width=214
- alt="cubic arc example">
- </td>
- <td>
- <img src="points_conic2.png"
- height=204 width=225
- alt="cubic arc with virtual 'on' point">
- </td>
- </tr>
- </table>
- </center>
-
-
- <h4>
- b. Outline descriptor
- </h4>
-
- <p>A FreeType outline is described through a simple structure:</p>
-
- <center>
- <table cellspacing=3
- cellpadding=3>
- <caption>
- <b><tt>FT_Outline</tt></b>
- </caption>
-
- <tr>
- <td>
- <tt>n_points</tt>
- </td>
- <td>
- the number of points in the outline
- </td>
- </tr>
- <tr>
- <td>
- <tt>n_contours</tt>
- </td>
- <td>
- the number of contours in the outline
- </td>
- </tr>
- <tr>
- <td>
- <tt>points</tt>
- </td>
- <td>
- array of point coordinates
- </td>
- </tr>
- <tr>
- <td>
- <tt>contours</tt>
- </td>
- <td>
- array of contour end indices
- </td>
- </tr>
- <tr>
- <td>
- <tt>tags</tt>
- </td>
- <td>
- array of point flags
- </td>
- </tr>
- </table>
- </center>
-
- <p>Here, <tt>points</tt> is a pointer to an array of
- <tt>FT_Vector</tt> records, used to store the vectorial coordinates of
- each outline point. These are expressed in 1/64th of a pixel, which
- is also known as the <em>26.6 fixed float format</em>.</p>
-
- <p><tt>contours</tt> is an array of point indices used to delimit
- contours in the outline. For example, the first contour always starts
- at point 0, and ends at point <tt>contours[0]</tt>. The second
- contour starts at point <tt>contours[0]+1</tt> and ends at
- <tt>contours[1]</tt>, etc.</p>
-
- <p>Note that each contour is closed, and that <tt>n_points</tt> should
- be equal to <tt>contours[n_contours-1]+1</tt> for a valid outline.</p>
-
- <p>Finally, <tt>tags</tt> is an array of bytes, used to store each
- outline point's tag.</p>
-
-
- <a name="section-2">
- <h3>
- 2. Bounding and control box computations
- </h3>
-
- <p>A <em>bounding box</em> (also called <em>bbox</em>) is simply a
- rectangle that completely encloses the shape of a given outline. The
- interesting case is the smallest bounding box possible, and in the
- following we subsume this under the term "bounding box". Because of the
- way arcs are defined, Bézier control points are not necessarily
- contained within an outline's (smallest) bounding box.</p>
-
- <p>This situation happens when one Bézier arc is, for example,
- the upper edge of an outline and an "off" point happens to be above the
- bbox. However, it is very rare in the case of character outlines
- because most font designers and creation tools always place "on" points
- at the extrema of each curved edges, as it makes hinting much
- easier.</p>
-
- <p>We thus define the <em>control box</em> (also called <em>cbox</em>)
- as the smallest possible rectangle that encloses all points of a given
- outline (including its "off" points). Clearly, it always includes the
- bbox, and equates it in most cases.</p>
-
- <p>Unlike the bbox, the cbox is much faster to compute.</p>
-
- <center>
- <table>
- <tr>
- <td>
- <img src="bbox1.png"
- height=264 width=228
- alt="a glyph with different bbox and cbox">
- </td>
- <td>
- <img src="bbox2.png"
- height=229 width=217
- alt="a glyph with identical bbox and cbox">
- </td>
- </tr>
- </table>
- </center>
-
- <p>Control and bounding boxes can be computed automatically through the
- functions <tt>FT_Get_Outline_CBox()</tt> and
- <tt>FT_Get_Outline_BBox()</tt>. The former function is always very
- fast, while the latter <em>may</em> be slow in the case of "outside"
- control points (as it needs to find the extreme of conic and cubic arcs
- for "perfect" computations). If this isn't the case, it is as fast as
- computing the control box.
-
- <p>Note also that even though most glyph outlines have equal cbox and
- bbox to ease hinting, this is not necessary the case anymore when a
- transformation like rotation is applied to them.</p>
-
-
- <a name="section-3">
- <h3>
- 3. Coordinates, scaling and grid-fitting
- </h3>
-
- <p>An outline point's vectorial coordinates are expressed in the
- 26.6 format, i.e. in 1/64th of a pixel, hence the coordinates
- (1.0,-2.5) are stored as the integer pair (x:64,y:-192).</p>
-
- <p>After a master glyph outline is scaled from the EM grid to the
- current character dimensions, the hinter or grid-fitter is in charge of
- aligning important outline points (mainly edge delimiters) to the pixel
- grid. Even though this process is much too complex to be described in a
- few lines, its purpose is mainly to round point positions, while trying
- to preserve important properties like widths, stems, etc.</p>
-
- <p>The following operations can be used to round vectorial distances in
- the 26.6 format to the grid:</p>
-
- <pre>
- round( x ) == ( x + 32 ) & -64
- floor( x ) == x & -64
- ceiling( x ) == ( x + 63 ) & -64</pre>
-
- <p>Once a glyph outline is grid-fitted or transformed, it often is
- interesting to compute the glyph image's pixel dimensions before
- rendering it. To do so, one has to consider the following:</p>
-
- <p>The scan-line converter draws all the pixels whose <em>centers</em>
- fall inside the glyph shape. It can also detect <em>drop-outs</em>,
- i.e. discontinuities coming from extremely thin shape fragments, in
- order to draw the "missing" pixels. These new pixels are always located
- at a distance less than half of a pixel but it is not easy to predict
- where they will appear before rendering.</p>
-
- <p>This leads to the following computations:</p>
-
- <ul>
- <li>
- <p>compute the bbox</p>
- </li>
- <li>
- <p>grid-fit the bounding box with the following:</p>
-
- <pre>
- xmin = floor( bbox.xMin )
- xmax = ceiling( bbox.xMax )
- ymin = floor( bbox.yMin )
- ymax = ceiling( bbox.yMax )</pre>
- </li>
- <li>
- return pixel dimensions, i.e.
-
- <pre>
- width = (xmax - xmin)/64</pre>
-
- and
-
- <pre>
- height = (ymax - ymin)/64</pre>
- </li>
- </ul>
-
- <p>By grid-fitting the bounding box, it is guaranteed that all the pixel
- centers that are to be drawn, <em>including those coming from drop-out
- control</em>, will be <em>within</em> the adjusted box. Then the box's
- dimensions in pixels can be computed.</p>
-
- <p>Note also that, when translating a grid-fitted outline, one should
- <em>always use integer distances</em> to move an outline in the 2D
- plane. Otherwise, glyph edges won't be aligned on the pixel grid
- anymore, and the hinter's work will be lost, producing <em>very low
- quality </em>bitmaps and pixmaps.</p>
-
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-5.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
- <a href="glyphs-7.html">Next</a>
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/glyphs/glyphs-7.html b/docs/glyphs/glyphs-7.html
deleted file mode 100644
index 381a98d..0000000
--- a/docs/glyphs/glyphs-7.html
+++ /dev/null
@@ -1,356 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType Glyph Conventions</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType Glyph Conventions
-</h1>
-
-<h2 align=center>
- Version 2.1
-</h2>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-<center>
-<table width="65%">
-<tr><td>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-6.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
-
- </td>
- </tr>
- </table>
- </center>
-
- <p><hr></p>
-
- <table width="100%">
- <tr bgcolor="#CCCCFF"
- valign=center><td>
- <h2>
- VII. FreeType bitmaps
- </h2>
- </td></tr>
- </table>
-
- <p>The purpose of this section is to present the way FreeType manages
- bitmaps and pixmaps, and how they relate to the concepts previously
- defined. The relationships between vectorial and pixel coordinates is
- explained.</p>
-
-
- <a name="section-1">
- <h3>
- 1. Vectorial versus pixel coordinates
- </h3>
-
- <p>This sub-section explains the differences between vectorial and pixel
- coordinates. To make things clear, brackets will be used to describe
- pixel coordinates, e.g. [3,5], while parentheses will be used for
- vectorial ones, e.g. (-2,3.5).</p>
-
- <p>In the pixel case, as we use the <em>Y upwards</em> convention;
- the coordinate [0,0] always refers to the <em>lower left pixel</em> of a
- bitmap, while coordinate [width-1, rows-1] to its <em>upper right
- pixel</em>.</p>
-
- <p>In the vectorial case, point coordinates are expressed in floating
- units, like (1.25, -2.3). Such a position doesn't refer to a given
- pixel, but simply to an immaterial point in the 2D plane.</p>
-
- <p>The pixels themselves are indeed <em>square boxes</em> of the 2D
- plane, whose centers lie in half pixel coordinates. For example, the
- lower left pixel of a bitmap is delimited by the square (0,0)-(1,1), its
- center being at location (0.5,0.5).</p>
-
- <p>This introduces some differences when computing distances. For
- example, the <em>length</em> in pixels of the line [0,0]-[10,0] is 11.
- However, the vectorial distance between (0,0)-(10,0) covers exactly
- 10 pixel centers, hence its length is 10.</p>
-
- <center>
- <img src="grid_1.png"
- height=390 width=402
- alt="bitmap and vector grid">
- </center>
-
-
- <a name="section-2">
- <h3>
- 2. FreeType bitmap and pixmap descriptor
- </h3>
-
- <p>A bitmap or pixmap is described through a single structure, called
- <tt>FT_Bitmap</tt>, defined in the file
- <tt><freetype/ftimage.h></tt>. It is a simple descriptor whose
- fields are:</p>
-
- <center>
- <table cellspacing=3
- cellpadding=5
- width="80%">
- <caption>
- <b><tt>FT_Bitmap</tt></b>
- </caption>
-
- <tr>
- <td valign=top>
- <tt>rows</tt>
- </td>
- <td valign=top>
- the number of rows, i.e. lines, in the bitmap
- </td>
- </tr>
-
- <tr>
- <td valign=top>
- <tt>width</tt>
- </td>
- <td valign=top>
- the number of horizontal pixels in the bitmap
- </td>
- </tr>
-
- <tr>
- <td valign=top>
- <tt>pitch</tt>
- </td>
- <td valign=top>
- its absolute value is the number of bytes per bitmap line; it can
- be either positive or negative depending on the bitmap's vertical
- orientation
- </td>
- </tr>
-
- <tr>
- <td valign=top>
- <tt>buffer</tt>
- </td>
- <td valign=top>
- a typeless pointer to the bitmap pixel bufer
- </td>
- </tr>
-
- <tr>
- <td valign=top>
- <tt>pixel_mode</tt>
- </td>
- <td valign=top>
- an enumeration used to describe the pixel format of the bitmap;
- examples are <tt>ft_pixel_mode_mono</tt> for 1-bit monochrome
- bitmaps and <tt>ft_pixel_mode_grays</tt> for 8-bit anti-aliased
- "gray" values
- </td>
- </tr>
-
- <tr>
- <td valign=top>
- <tt>num_grays</tt>
- </td>
- <td valign=top>
- this is only used for "gray" pixel modes; it gives the number of
- gray levels used to describe the anti-aliased gray levels --
- FreeType 2 defaults to 256 grays.
- </td>
- </tr>
- </table>
- </center>
-
-
- <p>Note that the sign of the <tt>pitch</tt> fields determines whether
- the rows in the pixel buffer are stored in ascending or descending
- order.</p>
-
- <p>Remember that FreeType uses the <em>Y upwards</em> convention in
- the 2D plane, which means that a coordinate of (0,0) always refer to the
- <em>lower-left corner</em> of a bitmap.</p>
-
- <p>If the pitch is positive, the rows are stored in decreasing vertical
- position; the first bytes of the pixel buffer are part of the
- <em>upper</em> bitmap row.</p>
-
- <p>On the opposite, if the pitch is negative, the first bytes of the
- pixel buffer are part of the <em>lower</em> bitmap row.</p>
-
- <p>In all cases, one can see the pitch as the byte increment needed to
- skip to the <em>next lower scanline</em> in a given bitmap buffer.</p>
-
- <center>
- <table>
- <tr>
- <td>
- <img src="up_flow.png"
- height=261 width=275
- alt="negative 'pitch'">
- </td>
- <td>
- <img src="down_flow.png"
- height=263 width=273
- alt="positive 'pitch'">
- </td>
- </tr>
- </table>
- </center>
-
- <p>The "positive pitch" convention is very often used, though
- some systems might need the other.</p>
-
-
- <a name="section-3">
- <h3>
- 3. Converting outlines into bitmaps and pixmaps
- </h3>
-
- <p>Generating a bitmap or pixmap image from a vectorial image is easy
- with FreeType. However, one must understand a few points regarding the
- positioning of the outline in the 2D plane before converting it to a
- bitmap:</p>
-
- <ul>
- <li>
- <p>The glyph loader and hinter always places the outline in the 2D
- plane so that (0,0) matches its character origin. This means that
- the glyph's outline, and corresponding bounding box, can be placed
- anywhere in the 2D plane (see the graphics in section III).</p>
- </li>
- <li>
- <p>The target bitmap's area is mapped to the 2D plane, with its
- lower left corner at (0,0). This means that a bitmap or pixmap of
- dimensions [<tt>w,h</tt>] will be mapped to a 2D rectangle window
- delimited by (0,0)-(<tt>w,h</tt>).</p>
- </li>
- <li>
- <p>When scan-converting the outline, everything that falls within
- the bitmap window is rendered, the rest is ignored.</p>
- </li>
-
- <p>A common mistake made by many developers when they begin using
- FreeType is believing that a loaded outline can be directly rendered
- in a bitmap of adequate dimensions. The following images illustrate
- why this is a problem.</p>
-
- <ul>
- <li>
- The first image shows a loaded outline in the 2D plane.
- </li>
- <li>
- The second one shows the target window for a bitmap of arbitrary
- dimensions [w,h].
- </li>
- <li>
- The third one shows the juxtaposition of the outline and window in
- the 2D plane.
- </li>
- <li>
- The last image shows what will really be rendered in the bitmap.
- </li>
- </ul>
-
- <center>
- <img src="clipping.png"
- height=151 width=539
- alt="clipping algorithm">
- </center>
- </ul>
-
- <p>Indeed, in nearly all cases, the loaded or transformed outline must
- be translated before it is rendered into a target bitmap, in order to
- adjust its position relative to the target window.</p>
-
- <p>For example, the correct way of creating a <em>standalone</em> glyph
- bitmap is as follows</p>
-
- <ul>
- <li>
- <p>Compute the size of the glyph bitmap. It can be computed
- directly from the glyph metrics, or by computing its bounding box
- (this is useful when a transformation has been applied to the
- outline after the load, as the glyph metrics are not valid
- anymore).</p>
- </li>
- <li>
- <p>Create the bitmap with the computed dimensions. Don't forget to
- fill the pixel buffer with the background color.</p>
- </li>
- <li>
- <p>Translate the outline so that its lower left corner matches
- (0,0). Don't forget that in order to preserve hinting, one should
- use integer, i.e. rounded distances (of course, this isn't required
- if preserving hinting information doesn't matter, like with rotated
- text). Usually, this means translating with a vector
- <tt>(-ROUND(xMin), -ROUND(yMin))</tt>.</p>
- </li>
- <li>
- <p>Call the rendering function (it can be
- <tt>FT_Outline_Render()</tt> for example).</p>
- </li>
- </ul>
-
- <p>In the case where one wants to write glyph images directly into a
- large bitmap, the outlines must be translated so that their vectorial
- position correspond to the current text cursor/character origin.</p>
-
- <p><hr></p>
-
- <center>
- <table width="100%"
- border=0
- cellpadding=5>
- <tr bgcolor="#CCFFCC"
- valign=center>
- <td align=center
- width="30%">
- <a href="glyphs-6.html">Previous</a>
- </td>
- <td align=center
- width="30%">
- <a href="index.html">Contents</a>
- </td>
- <td align=center
- width="30%">
-
- </td>
- </tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/glyphs/grid_1.png b/docs/glyphs/grid_1.png
deleted file mode 100644
index f99826b..0000000
Binary files a/docs/glyphs/grid_1.png and /dev/null differ
diff --git a/docs/glyphs/index.html b/docs/glyphs/index.html
deleted file mode 100644
index 8ee2fa5..0000000
--- a/docs/glyphs/index.html
+++ /dev/null
@@ -1,200 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType Glyph Conventions</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType Glyph Conventions
-</h1>
-
-<h2 align=center>
- Version 2.1
-</h2>
-
-<h3 align=center>
- Copyright 1998-2000 David Turner (<a
- href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- Copyright 2000 The FreeType Development Team (<a
- href="mailto:devel@freetype.org">devel@freetype.org</a>)
-</h3>
-
-
-<center>
-<table width="70%">
-<tr><td>
-
- <p>This document presents the core conventions used within the FreeType
- library to manage font and glyph data. It is a <em>must-read</em> for all
- developers who need to understand digital typography, especially if you
- want to use the FreeType 2 library in your projects.</p>
-
- <table width="100%">
- <tr valign=center
- bgcolor="#CCCCFF">
- <td align=center>
- <h2>
- Table of Contents
- </h2>
- </td>
- </tr>
- </table>
-
- <center>
- <table width="80%">
- <tr><td>
-
- <h2>
- <a href="glyphs-1.html">I. Basic Typographic Concepts</a>
- </h2>
- <blockquote>
- <h3>
- <a href="glyphs-1.html#section-1">1. Font files, format and
- information</a>
- <br>
-
- <a href="glyphs-1.html#section-2">2. Character images and mappings</a>
- <br>
-
- <a href="glyphs-1.html#section-3">3. Character and font metrics</a>
- <br>
- </h3>
- </blockquote>
-
- <h2>
- <a href="glyphs-2.html">II. Glyph outlines</a>
- </h2>
- <blockquote>
- <h3>
- <a href="glyphs-2.html#section-1">1. Pixels, points and device
- resolutions</a>
- <br>
-
- <a href="glyphs-2.html#section-2">2. Vectorial representation</a>
- <br>
-
- <a href="glyphs-2.html#section-3">3. Hinting and bitmap rendering</a>
- <br>
- </h3>
- </blockquote>
-
- <h2>
- <a href="glyphs-3.html">III. Glyph metrics</a>
- </h2>
- <blockquote>
- <h3>
- <a href="glyphs-3.html#section-1">1. Baseline, pens and layouts</a>
- <br>
-
- <a href="glyphs-3.html#section-2">2. Typographic metrics and
- bounding boxes</a>
- <br>
-
- <a href="glyphs-3.html#section-3">3. Bearings and advances</a>
- <br>
-
- <a href="glyphs-3.html#section-4">4. The effects of grid-fitting</a>
- <br>
-
- <a href="glyphs-3.html#section-5">5. Text widths and bounding box</a>
- <br>
- </h3>
- </blockquote>
-
- <h2>
- <a href="glyphs-4.html">IV. Kerning</a>
- </h2>
- <blockquote>
- <h3>
- <a href="glyphs-4.html#section-1">1. Kerning pairs</a>
- <br>
-
- <a href="glyphs-4.html#section-2">2. Applying kerning</a>
- <br>
- </h3>
- </blockquote>
-
- <h2>
- <a href="glyphs-5.html">V. Text processing</a>
- </h2>
- <blockquote>
- <h3>
- <a href="glyphs-5.html#section-1">1. Writing simple text strings</a>
- <br>
-
- <a href="glyphs-5.html#section-2">2. Sub-pixel positioning</a>
- <br>
-
- <a href="glyphs-5.html#section-3">3. Simple kerning</a>
- <br>
-
- <a href="glyphs-5.html#section-4">4. Right-to-left layouts</a>
- <br>
-
- <a href="glyphs-5.html#section-5">5. Vertical layouts</a>
- <br>
-
- <a href="glyphs-5.html#section-6">6. WYSIWYG text layouts</a>
- <br>
- </h3>
- </blockquote>
-
- <h2>
- <a href="glyphs-6.html">VI. FreeType Outlines</a>
- </h2>
- <blockquote>
- <h3>
- <a href="glyphs-6.html#section-1">1. FreeType outline description
- and structure</a>
- <br>
-
- <a href="glyphs-6.html#section-2">2. Bounding and control box
- computations</a>
- <br>
-
- <a href="glyphs-6.html#section-3">3. Coordinates, scaling, and
- grid-fitting</a>
- <br>
- </h3>
- </blockquote>
-
- <h2>
- <a href="glyphs-7.html">VII. FreeType bitmaps</a>
- </h2>
- <blockquote>
- <h3>
- <a href="glyphs-7.html#section-1">1. Vectorial versus pixel
- coordinates</a>
- <br>
-
- <a href="glyphs-7.html#section-2">2. FreeType bitmap and pixmap
- descriptor</a>
- <br>
-
- <a href="glyphs-7.html#section-3">3. Converting outlines into
- bitmaps and pixmaps</a>
- <br>
- </h3>
- </blockquote>
-
- </td></tr>
- </table>
- </center>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/glyphs/points_conic.png b/docs/glyphs/points_conic.png
deleted file mode 100644
index 80a670f..0000000
Binary files a/docs/glyphs/points_conic.png and /dev/null differ
diff --git a/docs/glyphs/points_conic2.png b/docs/glyphs/points_conic2.png
deleted file mode 100644
index 8d6ff88..0000000
Binary files a/docs/glyphs/points_conic2.png and /dev/null differ
diff --git a/docs/glyphs/points_cubic.png b/docs/glyphs/points_cubic.png
deleted file mode 100644
index 5facf65..0000000
Binary files a/docs/glyphs/points_cubic.png and /dev/null differ
diff --git a/docs/glyphs/points_segment.png b/docs/glyphs/points_segment.png
deleted file mode 100644
index 67f94b5..0000000
Binary files a/docs/glyphs/points_segment.png and /dev/null differ
diff --git a/docs/glyphs/twlewis1.png b/docs/glyphs/twlewis1.png
deleted file mode 100644
index 05a2192..0000000
Binary files a/docs/glyphs/twlewis1.png and /dev/null differ
diff --git a/docs/glyphs/twlewis2.png b/docs/glyphs/twlewis2.png
deleted file mode 100644
index eb780a2..0000000
Binary files a/docs/glyphs/twlewis2.png and /dev/null differ
diff --git a/docs/glyphs/up_flow.png b/docs/glyphs/up_flow.png
deleted file mode 100644
index 390828b..0000000
Binary files a/docs/glyphs/up_flow.png and /dev/null differ
diff --git a/docs/image/freetype.jpg b/docs/image/freetype.jpg
deleted file mode 100644
index 0c6304f..0000000
Binary files a/docs/image/freetype.jpg and /dev/null differ
diff --git a/docs/tutorial/metrics.png b/docs/tutorial/metrics.png
deleted file mode 100644
index e5eb472..0000000
Binary files a/docs/tutorial/metrics.png and /dev/null differ
diff --git a/docs/tutorial/metrics2.png b/docs/tutorial/metrics2.png
deleted file mode 100644
index 0b4a66f..0000000
Binary files a/docs/tutorial/metrics2.png and /dev/null differ
diff --git a/docs/tutorial/step1.html b/docs/tutorial/step1.html
deleted file mode 100644
index d4c4e99..0000000
--- a/docs/tutorial/step1.html
+++ /dev/null
@@ -1,948 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType 2 Tutorial</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType 2.0 Tutorial<br>
- Step 1 -- simple glyph loading
-</h1>
-
-<h3 align=center>
- © 2000 David Turner
- (<a href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- © 2000 The FreeType Development Team
- (<a href="http://www.freetype.org">www.freetype.org</a>)
-</h3>
-
-<center>
-<table width="550">
-<tr><td>
-
- <hr>
-
- <h2>
- Introduction
- </h2>
-
- <p>This is the first part of the FreeType 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>
- <li>select a character size in points or in pixels</li>
- <li>load a single glyph image and convert it to a bitmap</li>
- <li>render a very simple string of text</li>
- <li>render a rotated string of text easily</li>
- </ul>
-
- <hr>
-
- <h3>
- 1. Header files
- </h3>
-
- <p>To include the main FreeType header file, say</p>
-
- <font color="blue">
- <pre>
- #include <freetype/freetype.h></pre>
- </font>
-
- <p>in your application code. Note that other files are available in the
- FreeType include directory, most of them being included by
- <tt>freetype.h</tt> and other (internal) files. Some of them will be
- described later in this tutorial.</p>
-
- <hr>
-
- <h3>
- 2. Initialize the library
- </h3>
-
- <p>Simply create a variable of type <tt>FT_Library</tt> named, for
- example, <tt>library</tt>, and call the function
- <tt>FT_Init_FreeType()</tt> as in</p>
-
- <font color="blue">
- <pre>
- #include <freetype/freetype.h>
-
- FT_Library library;
-
- ...
-
- {
- ...
- error = FT_Init_FreeType( &library );
- if ( error )
- {
- ... an error occurred during library initialization ...
- }
- }</pre>
- </font>
-
- <p>This function is in charge of the following:</p>
-
- <ul>
- <li>
- Creating a new instance of the FreeType 2 library, and set the
- handle <tt>library</tt> to it.
- </li>
- <li>
- Load each module that FreeType knows about in the library. This
- means that by default, your new <tt>library</tt> object is able to
- handle TrueType, Type 1, Windows FON, CID-keyed & OpenType/CFF
- fonts gracefully.
- </li>
- </ul>
-
- <p>As you can see, the function returns an error code, like most others
- in the FreeType API. An error code of 0 <em>always</em> means that
- the operation was successful; otherwise, the value describes the error,
- and <tt>library</tt> is set to <tt>NULL</tt>.</p>
-
- <hr>
-
- <h3>
- 3. Load a font face
- </h3>
-
- <h4>
- a. From a font file
- </h4>
-
- <p>Create a new <em>face</em> object by calling
- <tt>FT_New_Face()</tt>. A <em>face</em> describes a given typeface
- and style. For example, "Times New Roman Regular" and "Times New
- Roman Italic" correspond to two different faces.</p>
-
- <font color="blue">
- <pre>
- FT_Library library; /* handle to library */
- FT_Face face; /* handle to face object */
-
-
- error = FT_Init_FreeType( &library );
- if ( error ) { ... }
-
- error = FT_New_Face( library,
- "/usr/share/fonts/truetype/arial.ttf",
- 0,
- &face );
- if ( error == FT_Err_Unknown_File_Format )
- {
- ... the font file could be opened and read, but it appears
- ... that its font format is unsupported
- }
- else if ( error )
- {
- ... another error code means that the font file could not
- ... be opened or read, or that it is broken
- }</pre>
- </font>
-
- <p>As you can certainly imagine, <tt>FT_New_Face()</tt> opens a font
- file, then tries to extract one face from it. Its parameters are</p>
-
- <table cellpadding=5>
- <tr valign="top">
- <td>
- <tt>library</tt>
- </td>
- <td>
- <p>A handle to the FreeType library instance where the face
- object is created</p>
- </td>
- </tr>
- <tr valign="top">
- <td>
- <tt>filepathname</tt>
- </td>
- <td>
- <p>The font file pathname (a standard C string).</p>
- </td>
- </tr>
- <tr valign="top">
- <td>
- <tt>face_index</tt>
- </td>
- <td>
- <p>Certain font formats allow several font faces to be embedded
- in a single file.</p>
-
- <p>This index tells which face you want to load. An error will
- be returned if its value is too large.</p>
-
- <p>Index 0 always work though.</p>
- </td>
- </tr>
- <tr valign="top">
- <td>
- <tt>face</tt>
- </td>
- <td>
- <p>A <em>pointer</em> to the handle that will be set to describe
- the new face object.</p>
-
- <p>It is set to <tt>NULL</tt> in case of error.</p>
- </td>
- </tr>
- </table>
-
- <p>To know how many faces a given font file contains, load its first
- face (use <tt>face_index</tt>=0), then check the value of
- <tt>face->num_faces</tt> which indicates how many faces are embedded
- in the font file.</p>
-
- <h4>
- b. From memory
- </h4>
-
- <p>In the case where you have already loaded the font file in memory,
- you can similarly create a new face object for it by calling
- <tt>FT_New_Memory_Face()</tt> as in</p>
-
- <font color="blue">
- <pre>
- FT_Library library; /* handle to library */
- FT_Face face; /* handle to face object */
-
-
- error = FT_Init_FreeType( &library );
- if ( error ) { ... }
-
- error = FT_New_Memory_Face( library,
- buffer, /* first byte in memory */
- size, /* size in bytes */
- 0, /* face_index */
- &face );
- if ( error ) { ... }</pre>
- </font>
-
- <p>As you can see, <tt>FT_New_Memory_Face()</tt> takes a pointer to
- the font file buffer and its size in bytes instead of a file pathname.
- Other than that, it has exactly the same semantics as
- <tt>FT_New_Face()</tt>.</p>
-
- <h4>
- c. From other sources (compressed files, network, etc.)
- </h4>
-
- <p>There are cases where using a file pathname or preloading the file
- in memory is not sufficient. With FreeType 2, it is possible to
- provide your own implementation of I/O routines.</p>
-
- <p>This is done through the <tt>FT_Open_Face()</tt> function, which
- can be used to open a new font face with a custom input stream, select
- a specific driver for opening, or even pass extra parameters to the
- font driver when creating the object. We advise you to refer to the
- FreeType 2 API reference in order to learn how to use it.</p>
-
- <p>Note that providing a custom stream might also be used to access a
- TrueType font embedded in a Postscript Type 42 wrapper.</p>
-
- <hr>
-
- <h3>
- 4. Accessing face contents
- </h3>
-
- <p>A <em>face object</em> models all information that globally describes
- the face. Usually, this data can be accessed directly by dereferencing
- a handle, like</p>
-
- <table cellpadding=5>
- <tr valign="top">
- <td>
- <tt>face->num_glyphs</tt>
- </td>
- <td>
- <p>Gives the number of <em>glyphs</em> available in the font face.
- A glyph is simply a character image. It doesn't necessarily
- correspond to a <em>character code</em> though.</p>
- </td>
- </tr>
- <tr valign="top">
- <td>
- <tt>face->flags</tt>
- </td>
- <td>
- <p>A 32-bit integer containing bit flags used to describe some
- face properties. For example, the flag
- <tt>FT_FACE_FLAG_SCALABLE</tt> is used to indicate that the face's
- font format is scalable and that glyph images can be rendered for
- all character pixel sizes. For more information on face flags,
- please read the <a href="#">FreeType 2 API Reference</a>.</p>
- </td>
- </tr>
- <tr valign="top">
- <td>
- <tt>face->units_per_EM</tt>
- </td>
- <td>
- <p>This field is only valid for scalable formats (it is set
- to 0 otherwise). It indicates the number of font units
- covered by the EM.</p>
- </td>
- </tr>
- <tr valign="top">
- <td>
- <tt>face->num_fixed_sizes</tt>
- </td>
- <td>
- <p>This field gives the number of embedded bitmap <em>strikes</em>
- in the current face. A <em>strike</em> is a series of glyph
- images for a given character pixel size. For example, a font face
- could include strikes for pixel sizes 10, 12 and 14. Note
- that even scalable font formats can have embedded bitmap
- strikes!</p>
- </td>
- </tr>
- <tr valign="top">
- <td>
- <tt>face->fixed_sizes</tt>
- </td>
- <td>
- <p>This is a pointer to an array of <tt>FT_Bitmap_Size</tt>
- elements. Each <tt>FT_Bitmap_Size</tt> indicates the horizontal
- and vertical <em>pixel sizes</em> for each of the strikes that are
- present in the face.</p>
- </td>
- </tr>
- </table>
-
- <p>For a complete listing of all face properties and fields, please read
- the <a href="#">FreeType 2 API Reference</a>.<p>
-
- <hr>
-
- <h3>
- 5. Setting the current pixel size
- </h3>
-
- <p>FreeType 2 uses <em>size objects</em> to model all information
- related to a given character size for a given face. For example, a size
- object will hold the value of certain metrics like the ascender or text
- height, expressed in 1/64th of a pixel, for a character size of
- 12 points.</p>
-
- <p>When the <tt>FT_New_Face()</tt> function is called (or one of its
- 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>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>Before a glyph can be loaded, the size object must be set up. To do
- that, simply call <tt>FT_Set_Char_Size()</tt>. Here is an example where
- the character size is set to 16pt for a 300x300 dpi device:</p>
-
- <font color="blue">
- <pre>
- error = FT_Set_Char_Size(
- face, /* handle to face object */
- 0, /* char_width in 1/64th of points */
- 16 * 64, /* char_height in 1/64th of points */
- 300, /* horizontal device resolution */
- 300 ); /* vertical device resolution */</pre>
- </font>
-
- <p>You will notice that</p>
-
- <ul>
- <li>
- 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 is not a pixel.
- </li>
- <li>
- Horizontal and vertical device resolutions are expressed in
- <em>dots-per-inch</em>, or <em>dpi</em>. You can use 72 or
- 96 dpi for display devices like the screen. The resolution is
- used to compute the character pixel size from the character point
- size.
- </li>
- <li>
- A value of 0 for the character width means <em>same as
- character height</em>, a value of 0 for the character height
- means <em>same as character width</em>. Otherwise, it is possible
- to specify different char widths and heights.
- </li>
- <li>
- Using a value of 0 for the horizontal or vertical resolution
- means 72 dpi, which is the default.
- </li>
- <li>
- The first argument is a handle to a face object, not a size object.
- This behaviour must be seen as a convenience.
- </li>
- </ul>
-
- <p>This function computes the character pixel size that corresponds to
- the character width and height and device resolutions. However, if you
- want to specify the pixel sizes yourself, you can simply call
- <tt>FT_Set_Pixel_Sizes()</tt>, as in</p>
-
- <font color="blue">
- <pre>
- error = FT_Set_Pixel_Sizes(
- face, /* handle to face object */
- 0, /* pixel_width */
- 16 ); /* pixel_height */</pre>
- </font>
-
- <p>This example will set the character pixel sizes to 16x16 pixels.
- As previously, a value of 0 for one of the dimensions means
- <em>same as the other</em>.</p>
-
- <p>Note that both functions return an error code. Usually, an error
- occurs with a fixed-size font format (like FNT or PCF) when trying to
- set the pixel size to a value that is not listed in the
- <tt>face->fixed_sizes</tt> array.</p>
-
- <hr>
-
- <h3>
- 6. Loading a glyph image
- </h3>
-
- <h4>
- a. Converting a character code into a glyph index
- </h4>
-
- <p>Usually, an application wants to load a glyph image based on its
- <em>character code</em>, which is a unique value that defines the
- character for a given <em>encoding</em>. For example, the character
- code 65 in ASCII encoding represents letter `A'.</p>
-
- <p>A face object contains one or more tables, called
- <em>charmaps</em>, that are used to convert character codes to glyph
- indices. For example, most TrueType fonts contain two charmaps. One
- is used to convert Unicode character codes to glyph indices, the other
- is used to convert Apple Roman encoding into glyph indices. Such
- fonts can then be used either on Windows (which uses Unicode) and
- Macintosh (which uses Apple Roman usually). Note also that a given
- charmap might not map to all the glyphs present in the font.</p>
-
- <p>By default, when a new face object is created, it lists all the
- charmaps contained in the font face and selects the one that supports
- 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.
- 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
- <tt>FT_Get_Char_Index()</tt> as in</p>
-
- <font color="blue">
- <pre>
- glyph_index = FT_Get_Char_Index( face, charcode );</pre>
- </font>
-
- <p>This will look up the glyph index corresponding to the given
- <tt>charcode</tt> in the charmap that is currently selected for the
- face.
-
- <p>Note that this is one of the rare FreeType functions that do not
- return an error code. If a given character code has no glyph image in
- the face, the value 0 is returned. By convention, it always
- corresponds to a special glyph image called the <em>missing
- glyph</em>, which usually is represented as a box or a space.</p>
-
- <h4>
- b. Loading a glyph from the face
- </h4>
-
- <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.
- Scalable formats like TrueType or Type 1 use vectorial shapes,
- named <em>outlines</em>, to describe each glyph. Some formats may have
- even more exotic ways of representing glyphs (e.g. MetaFont).
- Fortunately, FreeType 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
- bitmap, an outline, or something else. Each face object has a single
- glyph slot object that can be accessed as <tt>face->glyph</tt>.</p>
-
- <p>Loading a glyph image into the slot is performed by calling
- <tt>FT_Load_Glyph()</tt> as in</p>
-
- <font color="blue">
- <pre>
- error = FT_Load_Glyph(
- face, /* handle to face object */
- glyph_index, /* glyph index */
- load_flags ); /* load flags, see below */</pre>
- </font>
-
- <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 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
- size, it will be loaded into the slot. Embedded bitmaps are
- always favored over native image formats, because we assume that
- they are higher-quality versions of the same glyph. This can be
- changed by using the <tt>FT_LOAD_NO_BITMAP</tt> flag.</p>
- </li>
- <li>
- <p>Otherwise, a native image for the glyph will be loaded. It
- will also be scaled to the current pixel size as well as hinted
- for certain formats like TrueType and Type 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
- it to a bitmap through <tt>FT_Render_Glyph()</tt>, as in</p>
-
- <font color="blue">
- <pre>
- error = FT_Render_Glyph(
- 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 gray levels) bitmap. You can
- alternatively use <tt>ft_render_mode_mono</tt> if you want to generate
- a 1-bit monochrome bitmap.</p>
-
- <p>Once you have a bitmapped glyph image, you can access it directly
- 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.
- <em>It is positive to indicate an upwards distance</em>.</p>
-
- <p>The second part of the tutorial describes the contents of a glyph
- slot and how to access specific glyph information (including
- metrics).</p>
-
- <h4>
- c. Using other charmaps
- </h4>
-
- <p>As said before, when a new face object is created, it will look for
- a Unicode, Latin-1, or ASCII charmap and select it. The currently
- selected charmap is accessed via <tt>face->charmap</tt>. This field
- is <tt>NULL</tt> if no charmap is selected, which typically happens
- when you create a new <tt>FT_Face</tt> object from a font file that
- doesn't contain an ASCII, Latin-1, or Unicode charmap (rare
- stuff).</p>
-
- <p>There are two ways to select a different charmap with
- FreeType 2. The easiest is if the encoding you need already has
- a corresponding enumeration defined in <tt>freetype/freetype.h</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
- expected, 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
- be used to describe the charmap in a rather generic way.</p>
-
- <p>Each value pair corresponds to a given encoding. For example, the
- pair (3,1) corresponds to Unicode (on the Windows platform). A list
- of such pairs is defined in the TrueType specification, but you can
- also use the file <tt><freetype/ttnameid.h></tt> which defines
- several helpful constants to deal with them.</p>
-
- <p>Note that some pid/eid pairs are <em>artificial</em>; such values
- have been created by FreeType to identify platforms resp. encodings
- not covered by the original TrueType specification.</p>
-
- <p>To look up a specific encoding you need to find a corresponding
- value pair in the specification, then look for it in the
- <tt>charmaps</tt> 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;
- FT_CharMap charmap;
- int n;
-
-
- for ( n = 0; n < face->num_charmaps; n++ )
- {
- charmap = face->charmaps[n];
- if ( charmap->platform_id == my_platform_id &&
- charmap->encoding_id == my_encoding_id )
- {
- found = charmap;
- break;
- }
- }
-
- if ( !found ) { ... }
-
- /* now, select the charmap for the face object */
- error = FT_Set_CharMap( face, found );
- if ( error ) { ... }</pre>
- </font>
-
- <p>Once a charmap has been selected, either through
- <tt>FT_Select_CharMap()</tt> or <tt>FT_Set_CharMap()</tt>, it is used
- by all subsequent calls to <tt>FT_Get_Char_Index()</tt>.</p>
-
- <h4>
- d. Glyph transformations
- </h4>
-
- <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(
- face, /* target face object */
- &matrix, /* pointer to 2x2 matrix */
- &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 an <tt>FT_Matrix</tt>
- structure that describes a 2x2 affine matrix. The third
- parameter is a pointer to an <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 <tt>NULL</tt>, 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 <tt>NULL</tt> 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
- results if you load a glyph at the size of 24 pixels, or a glyph
- at the size at 12 pixels scaled by 2 through a
- transformation, because hints will have been computed differently
- (unless hints have been disabled, of course).</em></p>
-
- <p>If you ever need to use a non-orthogonal transformation with
- optimal hints, you first need to decompose your transformation into a
- scaling part and a rotation/shearing part. Use the scaling part to
- 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>
-
- <hr>
-
- <h3>
- 7. Simple text rendering
- </h3>
-
- <p>We will now present 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>
-
- <h4>
- a. basic code
- </h4>
-
- <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 */
- int pen_x, pen_y, n;
-
-
- .. initialize library ..
- .. create face object ..
- .. set character size ..
-
- pen_x = 300;
- pen_y = 200;
-
- for ( n = 0; n < 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>
-
- <p>This code needs a few explanations:</p>
-
- <ul>
- <li>
- We define a handle named <tt>slot</tt> that points to the face
- object's glyph slot. (The type <tt>FT_GlyphSlot</tt> is a
- pointer.) This is a convenience to avoid using
- <tt>face->glyph->XXX</tt> every time.
- </li>
- <li>
- We increment the pen position with the vector
- <tt>slot->advance</tt>, which corresponds to the glyph's
- <em>advance width</em> (also known as its <em>escapement</em>).
- The advance vector is expressed in 1/64th of pixels, and is
- truncated to integer pixels on each iteration.
- </li>
- <li>
- The function <tt>my_draw_bitmap()</tt> is not part of FreeType but
- must be provided by the application to draw the bitmap to the
- target surface. In this example, it takes a pointer to an
- <tt>FT_Bitmap</tt> descriptor and the position of its top-left
- corner as arguments.
- </li>
- <li>
- The value of <tt>slot->bitmap_top</tt> is positive for an
- <em>upwards</em> vertical distance. Assuming that the coordinates
- taken by <tt>my_draw_bitmap()</tt> use the opposite convention
- (increasing Y corresponds to downwards scanlines), we substract it
- 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 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 */
- FT_UInt glyph_index;
- int pen_x, pen_y, n;
-
-
- .. initialize library ..
- .. create face object ..
- .. set character size ..
-
- pen_x = 300;
- pen_y = 200;
-
- for ( n = 0; n < 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( &slot->bitmap,
- pen_x + slot->bitmap_left,
- pen_y - slot->bitmap_top );
-
- /* increment pen position */
- pen_x += slot->advance.x >> 6;
- }</pre>
- </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
- <tt>FT_Load_Glyph()</tt>. As you probably imagine, it is
- equivalent to calling <tt>FT_Get_Char_Index()</tt> followed by
- <tt>FT_Get_Load_Glyph()</tt>.</p>
- </li>
- <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.
- 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 by using the <tt>FT_LOAD_MONOCHROME</tt> load flag
- instead.</p>
- </li>
- </ul>
-
- <h4>c. more advanced rendering</h4>
-
- <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">
- <pre>
- FT_GlyphSlot slot = face->glyph; /* a small shortcut */
- FT_Matrix matrix; /* transformation matrix */
- FT_UInt glyph_index;
- FT_Vector pen; /* untransformed origin */
- int n;
-
-
- .. initialize library ..
- .. create face object ..
- .. set character size ..
-
- /* set up matrix */
- 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 );
-
- /* the pen position in 26.6 cartesian space coordinates */
- pen.x = 300 * 64;
- pen.y = ( my_target_height - 200 ) * 64;
-
- for ( n = 0; n < num_chars; n++ )
- {
- /* set transformation */
- FT_Set_Transform( face, &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( &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>
-
- <p>Notes:</p>
-
- <ul>
- <li>
- We now use a vector of type <tt>FT_Vector</tt> to store the pen
- position, with coordinates expressed as 1/64th of pixels, hence a
- multiplication. The position is expressed in cartesian space.
- </li>
- <li>
- In FreeType, glyph images are always loaded, transformed, and
- described in the cartesian coordinate system (which means that
- increasing Y corresponds to upper scanlines), unlike the
- system typically used for bitmaps (where the top-most scanline has
- coordinate 0). We must thus convert between the two systems
- when we define the pen position, and when we compute the top-left
- position of the bitmap.
- </li>
- <li>
- We apply the transformation matrix on each glyph to indicate
- rotation as well as a delta vector that will move the transformed
- image to the current pen position (in cartesian space, not bitmap
- space).
- </li>
- <li>
- The advance width is always returned transformed, which is why it
- can be directly added to the current pen position. Note that it
- 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
- replacement (but a more powerful one).</p>
-
- <p>It has, however, a few shortcomings that we will explain, and
- solve, in the next part of this tutorial.</p>
-
- <hr>
-
- <h3>
- Conclusion
- </h3>
-
- <p>In this first section, you have learned the basics of FreeType 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, 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>
-
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>
diff --git a/docs/tutorial/step2.html b/docs/tutorial/step2.html
deleted file mode 100644
index f472644..0000000
--- a/docs/tutorial/step2.html
+++ /dev/null
@@ -1,1607 +0,0 @@
-<!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"
- content="text/html; charset=iso-8859-1">
- <meta name="Author"
- content="David Turner">
- <title>FreeType 2 Tutorial</title>
-</head>
-
-<body text="#000000"
- bgcolor="#FFFFFF"
- link="#0000EF"
- vlink="#51188E"
- alink="#FF0000">
-
-<h1 align=center>
- FreeType 2.0 Tutorial<br>
- Step 2 -- managing glyphs
-</h1>
-
-<h3 align=center>
- © 2000 David Turner
- (<a href="mailto:david@freetype.org">david@freetype.org</a>)<br>
- © 2000 The FreeType Development Team
- (<a href="http://www.freetype.org">www.freetype.org</a>)
-</h3>
-
-<center>
-<table width="550">
-<tr><td>
-
- <hr>
-
- <h2>
- Introduction
- </h2>
-
- <p>This is the second part of the FreeType 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>
- <li>how to retrieve global metrics (including kerning)</li>
- <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 if needed,
- and how to scale them to device space</li>
- </ul>
-
- <hr>
-
- <h3>
- 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>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 vertical metrics are
- available.</p>
-
- <p>Individual glyph metrics can be accessed by first loading the glyph
- 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 the 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 the 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
- 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"
- 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 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 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 used 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>
-
- <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> 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. For example, you want to cache images within your
- application, or you want to apply additional transformations 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:</p>
-
- <font color="blue">
- <pre>
- #include <freetype/ftglyph.h></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, &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> to do 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 <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" ..
-
- /* copy glyph to glyph2 */
- error = FT_Glyph_Copy( glyph, &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, &delta );
-
- /* transform glyph2 (horizontal shear) */
- matrix.xx = 0x10000L;
- matrix.xy = 0;
- matrix.yx = 0.12 * 0x10000L;
- matrix.yy = 0x10000L;
-
- FT_Glyph_Transform( glyph2, &matrix, 0 );</pre>
- </font>
-
- <p>Note that the 2x2 transformation 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>, &bbox );</pre>
- </font>
-
- <p>Coordinates are relative to the glyph origin, i.e. (0,0), using the
- Y upwards convention. This function takes a special argument,
- <tt>bbox_mode</tt>, 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 <tt>bbox_mode</tt> is
- <tt>ft_glyph_bbox_pixels</tt> (i.e. integer, grid-fitted pixel
- coordinates). Please check the API reference of
- <tt>FT_Glyph_Get_CBox()</tt> for 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; /* 1/2 pixel in 26.6 format */
- origin.y = 0;
-
- error = FT_Glyph_To_Bitmap( &glyph,
- <em>render_mode</em>,
- &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 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 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>
-
- <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 fields of an <tt>FT_Face</tt> handle.</p>
-
- <p>However, you need to check that the font face's format is scalable
- before using them. This can be done with 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 2048 (for TrueType) or 1000 (for Type 1), but
- other values are possible too. It is set to 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 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 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 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 1 font by doing the following:</p>
-
- <font color="blue">
- <pre>
- 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 ..
- }</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 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 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 */
- &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 <tt>bbox_mode</tt> 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 0) 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>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 bidirectional text, or 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 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 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 < 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 )
- {
- FT_Vector delta;
-
-
- FT_Get_Kerning( face, previous, glyph_index,
- ft_kerning_mode_default, &delta );
-
- pen_x += delta.x >> 6;
- }
-
- /* 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( &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 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 <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>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 < 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 )
- {
- FT_Vector delta;
-
-
- FT_Get_Kerning( face, previous, glyph_index,
- ft_kerning_mode_default, &delta );
-
- pen_x += delta.x >> 6;
- }
-
- /* 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, &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 slight 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 <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, */
- /* translate it, and grow the string bbox */
- for ( n = 0; n < 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 < bbox.xMin )
- bbox.xMin = glyph_bbox.xMin;
-
- if ( glyph_bbox.yMin < bbox.yMin )
- bbox.yMin = glyph_bbox.yMin;
-
- if ( glyph_bbox.xMax > bbox.xMax )
- bbox.xMax = glyph_bbox.xMax;
-
- if ( glyph_bbox.yMax &gy; bbox.yMax )
- bbox.yMax = glyph_bbox.yMax;
- }
-
- /* check that we really grew the string bbox */
- if ( bbox.xMin > bbox.xMax )
- {
- bbox.xMin = 0;
- bbox.yMin = 0;
- bbox.xMax = 0;
- bbox.yMax = 0;
- }
-
- /* 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 < 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( &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 );
- }
- }</pre>
- </font>
-
- <p>Some remarks:</p>
-
- <ul>
- <li>
- The pen position is expressed in the cartesian space (i.e.
- Y upwards).
- </li>
- <li>
- We call <tt>FT_Glyph_To_Bitmap()</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 typecast to an
- <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;
-
-
- .. 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 < num_chars; n++ )
- {
- 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;
- }
-
- /* 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 < num_glyphs; n++ )
- {
- FT_BBox glyph_bbox;
-
-
- FT_Glyph_Get_CBox( glyphs[n], &glyph_bbox );
-
- if ( glyph_bbox.xMin < bbox.xMin )
- bbox.xMin = glyph_bbox.xMin;
-
- if ( glyph_bbox.yMin < bbox.yMin )
- bbox.yMin = glyph_bbox.yMin;
-
- if ( glyph_bbox.xMax > 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;
- }</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 < num_glyphs; n++ )
- FT_Glyph_Transform( glyphs[n].image, &matrix, &delta );
-
- /* compute bounding box of transformed glyphs */
- compute_string_bbox( &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 reuse 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>
-
- <font color="blue">
- <pre>
- FT_Vector start;
- FT_Matrix transform;
-
-
- /* get bbox of original glyph sequence */
- compute_string_bbox( &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 < 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, &image );
- if ( error ) continue;
-
- /* transform copy (this will also translate it to the */
- /* correct position */
- FT_Glyph_Transform( image, &matrix, &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, &bbox );
- if ( bbox.xMax <= 0 || bbox.xMin >= my_target_width ||
- bbox.yMax <= 0 || bbox.yMin >= my_target_height )
- continue;
-
- /* convert glyph image to bitmap (destroy the glyph */
- /* copy!) */
- error = FT_Glyph_To_Bitmap(
- &image,
- ft_render_mode_normal,
- 0, /* no additional translation */
- 1 ); /* destroy copy in "image" */
- if ( !error )
- {
- FT_BitmapGlyph bit = (FT_BitmapGlyph)image;
-
-
- 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 with different angles, or even change the way <tt>start</tt>
- is computed in order to move it to a 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 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 glyph 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>
- 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. <tt>x_ppem</tt> means
- "x pixels per EM".
- </td>
- </tr>
- <tr valign=top>
- <td>
- <tt>y_ppem</tt>
- </td>
- <td>
- 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. <tt>y_ppem</tt> means
- "y pixels per EM".
- </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>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 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>Unscaled kerning data can be retrieved 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 3 of this tutorial part.</p>
-
- <hr>
-
- <h3>
- Conclusion
- </h3>
-
- <p>This is the end of the second part of the FreeType 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>With this knowledge you can 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>
-</td></tr>
-</table>
-</center>
-
-</body>
-</html>